更新
This commit is contained in:
@@ -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