Commit 157b8c09 by 赵增煜

自动脚本bug修改

parent 5615fd45
...@@ -46,11 +46,14 @@ public function handle() ...@@ -46,11 +46,14 @@ public function handle()
$pharmacist = PharmacyModel::where('id', $prescription->pharmacy_id)->first(); $pharmacist = PharmacyModel::where('id', $prescription->pharmacy_id)->first();
$doctor = DoctorModel::where('id', $prescription->doctor_id)->first(); $doctor = DoctorModel::where('id', $prescription->doctor_id)->first();
if ($doctor->is_auto == 0 && $pharmacist->is_auto == 1) { if ($doctor->is_auto == 0 && $pharmacist->is_auto == 1) {
var_dump($prescription); // var_dump($prescription);
// 更新处方单状态 // 更新处方单状态
PrescriptionModel::where('id', $prescription->id)->update(['status' => PrescriptionModel::PRESCRIPTION_STATUS_SUCCESS]); $prescriptionInfo = PrescriptionModel::find($prescription->id);
if ($prescriptionInfo) {
$prescriptionInfo->status = PrescriptionModel::PRESCRIPTION_STATUS_SUCCESS;
$prescriptionInfo->save();
// 获取患者信息 // 获取患者信息
$patient = PatientModel::where('id', $prescription->patient_id)->first(); $patient = PatientModel::where('id', $prescriptionInfo->patient_id)->first();
// 生成审方日志 // 生成审方日志
$dateTime = new DateTime($prescription->created_at); $dateTime = new DateTime($prescription->created_at);
$dateTime->modify('+5 minutes'); $dateTime->modify('+5 minutes');
...@@ -60,6 +63,9 @@ public function handle() ...@@ -60,6 +63,9 @@ public function handle()
$currentTime = $dateTime->format('Y-m-d H:i:s'); $currentTime = $dateTime->format('Y-m-d H:i:s');
$pharmacistLog->log_info = $prescription->pharmacist_name.'在'.$currentTime.'为'.$prescription->patient_name.'('.$patient->mobile.')审方(处方单编号:'.$prescription->id.')'; $pharmacistLog->log_info = $prescription->pharmacist_name.'在'.$currentTime.'为'.$prescription->patient_name.'('.$patient->mobile.')审方(处方单编号:'.$prescription->id.')';
$pharmacistLog->save(); $pharmacistLog->save();
$this->info($prescription->id.'审方成功');
}
} }
} }
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment