This commit is contained in:
Your Name
2026-03-20 18:00:19 +08:00
parent d765517b74
commit 18fee2e8f8
240 changed files with 976 additions and 280 deletions
@@ -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());