Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
86903cdb59 |
+945
-402
File diff suppressed because it is too large
Load Diff
@@ -578,11 +578,14 @@ class AppointmentLogic extends BaseLogic
|
||||
// 面诊结束:通知对应医助(从诊单 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,
|
||||
|
||||
@@ -773,6 +773,7 @@ class PrescriptionLogic
|
||||
}
|
||||
|
||||
$diagnosisId = (int) ($appointment->patient_id ?? 0);
|
||||
|
||||
if ($diagnosisId <= 0) {
|
||||
Log::info('createSystemAutoFromCompletedAppointment: no diagnosis (patient_id), skip appt=' . $appointmentId);
|
||||
|
||||
@@ -826,6 +827,18 @@ class PrescriptionLogic
|
||||
$visitNo = '1K' . str_pad((string) $diagnosisId, 8, '0', STR_PAD_LEFT);
|
||||
|
||||
$herbs = [];
|
||||
|
||||
/** 与手动开方一致:存一份当前诊单详情快照(/admin 开方时用 tcmDiagnosisDetail → 同源 DiagnosisLogic::detail) */
|
||||
$caseSnapshot = [];
|
||||
try {
|
||||
$snap = DiagnosisLogic::detail(['id' => $diagnosisId]);
|
||||
$caseSnapshot = is_array($snap) ? $snap : [];
|
||||
} catch (\Throwable $e) {
|
||||
Log::warning(
|
||||
'createSystemAutoFromCompletedAppointment: case_record snapshot failed diagnosis='
|
||||
. $diagnosisId . ' ' . $e->getMessage()
|
||||
);
|
||||
}
|
||||
|
||||
$data = [
|
||||
'sn' => $sn,
|
||||
@@ -850,7 +863,7 @@ class PrescriptionLogic
|
||||
'tongue' => (string) ($diagnosis->tongue ?? ''),
|
||||
'tongue_image' => '',
|
||||
'clinical_diagnosis' => $clinical,
|
||||
'case_record' => [],
|
||||
'case_record' => $caseSnapshot,
|
||||
'herbs' => $herbs,
|
||||
'dose_count' => 1,
|
||||
'dose_unit' => '剂',
|
||||
@@ -876,7 +889,7 @@ class PrescriptionLogic
|
||||
'creator_id' => $doctorId,
|
||||
'assistant_id' => $assistantIdForRx,
|
||||
];
|
||||
|
||||
|
||||
$prescription = new Prescription();
|
||||
$prescription->save($data);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user