Compare commits
1
Commits
UI-202060705
...
deesp-ui
| 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 获取)
|
// 面诊结束:通知对应医助(从诊单 assistant_id 获取)
|
||||||
try {
|
try {
|
||||||
$diagnosis = Diagnosis::where('id', $appointment->patient_id)->find();
|
$diagnosis = Diagnosis::where('id', $appointment->patient_id)->find();
|
||||||
|
|
||||||
if ($diagnosis && !empty($diagnosis->assistant_id)) {
|
if ($diagnosis && !empty($diagnosis->assistant_id)) {
|
||||||
$assistantId = (int) $diagnosis->assistant_id;
|
$assistantId = (int) $diagnosis->assistant_id;
|
||||||
|
|
||||||
$patientName = $diagnosis->patient_name ?? '患者';
|
$patientName = $diagnosis->patient_name ?? '患者';
|
||||||
$doctor = Admin::where('id', $appointment->doctor_id)->find();
|
$doctor = Admin::where('id', $appointment->doctor_id)->find();
|
||||||
$doctorName = $doctor ? $doctor->name : '医生';
|
$doctorName = $doctor ? $doctor->name : '医生';
|
||||||
|
|
||||||
ChatNotifyLogic::addConsultationCompleteNotify(
|
ChatNotifyLogic::addConsultationCompleteNotify(
|
||||||
$assistantId,
|
$assistantId,
|
||||||
$patientName,
|
$patientName,
|
||||||
|
|||||||
@@ -773,6 +773,7 @@ class PrescriptionLogic
|
|||||||
}
|
}
|
||||||
|
|
||||||
$diagnosisId = (int) ($appointment->patient_id ?? 0);
|
$diagnosisId = (int) ($appointment->patient_id ?? 0);
|
||||||
|
|
||||||
if ($diagnosisId <= 0) {
|
if ($diagnosisId <= 0) {
|
||||||
Log::info('createSystemAutoFromCompletedAppointment: no diagnosis (patient_id), skip appt=' . $appointmentId);
|
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);
|
$visitNo = '1K' . str_pad((string) $diagnosisId, 8, '0', STR_PAD_LEFT);
|
||||||
|
|
||||||
$herbs = [];
|
$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 = [
|
$data = [
|
||||||
'sn' => $sn,
|
'sn' => $sn,
|
||||||
@@ -850,7 +863,7 @@ class PrescriptionLogic
|
|||||||
'tongue' => (string) ($diagnosis->tongue ?? ''),
|
'tongue' => (string) ($diagnosis->tongue ?? ''),
|
||||||
'tongue_image' => '',
|
'tongue_image' => '',
|
||||||
'clinical_diagnosis' => $clinical,
|
'clinical_diagnosis' => $clinical,
|
||||||
'case_record' => [],
|
'case_record' => $caseSnapshot,
|
||||||
'herbs' => $herbs,
|
'herbs' => $herbs,
|
||||||
'dose_count' => 1,
|
'dose_count' => 1,
|
||||||
'dose_unit' => '剂',
|
'dose_unit' => '剂',
|
||||||
@@ -876,7 +889,7 @@ class PrescriptionLogic
|
|||||||
'creator_id' => $doctorId,
|
'creator_id' => $doctorId,
|
||||||
'assistant_id' => $assistantIdForRx,
|
'assistant_id' => $assistantIdForRx,
|
||||||
];
|
];
|
||||||
|
|
||||||
$prescription = new Prescription();
|
$prescription = new Prescription();
|
||||||
$prescription->save($data);
|
$prescription->save($data);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user