更新
This commit is contained in:
@@ -5,6 +5,9 @@ namespace app\adminapi\logic\doctor;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\doctor\Appointment;
|
||||
use app\common\model\doctor\Roster;
|
||||
use app\common\model\tcm\Diagnosis;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\api\logic\ChatNotifyLogic;
|
||||
use think\facade\Db;
|
||||
|
||||
/**
|
||||
@@ -390,6 +393,25 @@ class AppointmentLogic extends BaseLogic
|
||||
$appointment->update_time = time();
|
||||
$appointment->save();
|
||||
|
||||
// 面诊结束:通知对应医助(从诊单 assistant_id 获取)
|
||||
try {
|
||||
$diagnosis = Diagnosis::where('id', $appointment->patient_id)->find();
|
||||
if ($diagnosis && !empty($diagnosis->assistant_id)) {
|
||||
$assistantId = (int) $diagnosis->assistant_id;
|
||||
$patientName = $diagnosis->patient_name ?? '患者';
|
||||
$doctor = Admin::where('id', $appointment->doctor_id)->find();
|
||||
$doctorName = $doctor ? $doctor->name : '医生';
|
||||
ChatNotifyLogic::addConsultationCompleteNotify(
|
||||
$assistantId,
|
||||
$patientName,
|
||||
$doctorName,
|
||||
(int) $appointment->patient_id
|
||||
);
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
\think\facade\Log::warning('面诊结束通知医助失败: ' . $e->getMessage());
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
self::setError($e->getMessage());
|
||||
|
||||
Reference in New Issue
Block a user