From 8be42f20f0e2c0769b381319b5a720af0d269228 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Fri, 31 Mar 2023 09:27:59 +0800 Subject: [PATCH] 1 --- app/Controller/TestController.php | 161 ++-------------------- app/Model/PatientHistoryInquiry.php | 2 +- app/Services/OrderPrescriptionService.php | 3 + app/Services/PatientDoctorService.php | 2 + app/Services/UserDoctorService.php | 1 + app/Services/UserPatientService.php | 2 +- app/Services/UserPharmacistService.php | 4 + 7 files changed, 27 insertions(+), 148 deletions(-) diff --git a/app/Controller/TestController.php b/app/Controller/TestController.php index a46d2c3..a4e2567 100644 --- a/app/Controller/TestController.php +++ b/app/Controller/TestController.php @@ -9,6 +9,7 @@ use App\Exception\BusinessException; use App\Model\DoctorInquiryTime; use App\Model\DoctorPharmacistCert; use App\Model\OrderInquiry; +use App\Model\OrderPrescription; use App\Model\UserDoctor; use App\Services\ImService; use App\Services\MessagePush; @@ -505,153 +506,21 @@ class TestController extends AbstractController public function test_11(){ - $oss = new Oss(); - - $filename = "basic/file/prescription.jpg"; - $sign_image = $oss->getObjectToRAM($filename); - - $manager = new ImageManager(); - - $image = $manager->make($sign_image); - - $fontPath = './extend/Ca/ZiYuYongSongTi-2.ttf'; - - // 处方号 - $image->text('1234567890', 1480, 540, function ($font) use($fontPath) { - $font->file($fontPath); - $font->size(60); - $font->align('left'); - }); - - // 日期 - $image->text('2023-03-21', 354, 675, function ($font) use($fontPath) { - $font->file($fontPath); - $font->size(60); - $font->align('left'); - }); - - // 科室 - $image->text('测试科室1', 1385, 675, function ($font) use($fontPath) { - $font->file($fontPath); - $font->size(60); - $font->align('left'); - }); - - // 姓名 - $image->text('测试姓名', 354, 795, function ($font) use($fontPath) { - $font->file($fontPath); - $font->size(60); - $font->align('left'); - }); - - // 性别 - $image->text('男', 1385, 790, function ($font) use($fontPath) { - $font->file($fontPath); - $font->size(60); - $font->align('left'); - }); - - // 年龄 - $image->text('19', 354, 900, function ($font) use($fontPath) { - $font->file($fontPath); - $font->size(60); - $font->align('left'); - }); - - // 过敏史 - $image->text('对阿莫西林过敏对阿莫西林过敏', 405, 1030, function ($font) use($fontPath) { - $font->file($fontPath); - $font->size(60); - $font->align('left'); - }); - - // 初步诊断 - $image->text('对阿莫西林过敏对阿莫西林过敏', 445, 1145, function ($font) use($fontPath) { - $font->file($fontPath); - $font->size(60); - $font->align('left'); - }); - - // 医生建议 - $image->text('没有建议', 445, 1252, function ($font) use($fontPath) { - $font->file($fontPath); - $font->size(60); - $font->align('left'); - }); - - $data = array(); - $data['product'] = [ - [ - "product_name" => "感冒药1(50ml*10)", - "single_unit" => "一次一包", - "frequency_use" => "1天3次", - "single_use" => "口服", - "prescription_product_num" => "X1盒", - ], - [ - "product_name" => "感冒药2(50ml*10)", - "single_unit" => "一次一包", - "frequency_use" => "1天3次", - "single_use" => "口服", - "prescription_product_num" => "X1盒", - ], - [ - "product_name" => "感冒药3(50ml*10)", - "single_unit" => "一次一包", - "frequency_use" => "1天3次", - "single_use" => "口服", - "prescription_product_num" => "X1盒", - ], - [ - "product_name" => "感冒药4(50ml*10)", - "single_unit" => "一次一包", - "frequency_use" => "1天3次", - "single_use" => "口服", - "prescription_product_num" => "X1盒", - ], - [ - "product_name" => "感冒药5(50ml*10)", - "single_unit" => "一次一包", - "frequency_use" => "1天3次", - "single_use" => "口服", - "prescription_product_num" => "X1盒", - ], - ]; - - // 用药 - foreach ($data['product'] as $key => $item){ - $x_axis = 229; - $y_axis = 1600 + $key * 250; - $x_axis_num = 1900;// 数量使用 - - $image->text($item['product_name'], $x_axis, $y_axis, function ($font) use($fontPath) { - $font->file($fontPath); - $font->size(50); - $font->align('left'); - }); - - $image->text("X1盒", $x_axis_num, $y_axis, function ($font) use($fontPath) { - $font->file($fontPath); - $font->size(50); - $font->align('left'); - }); - - $image->text("用量:" . $item['single_unit'] . " " . $item['frequency_use'], $x_axis, $y_axis+70, function ($font) use($fontPath) { - $font->file($fontPath); - $font->size(50); - $font->align('left'); - }); - - $image->text("用法:" . $item['single_use'], $x_axis, $y_axis+140, function ($font) use($fontPath) { - $font->file($fontPath); - $font->size(50); - $font->align('left'); - }); - - + $OrderPrescriptionService = new OrderPrescriptionService(); + $prescription_img = $OrderPrescriptionService->openPrescription($order_prescription->order_prescription_id,$user_info['user_id']); + if (empty($prescription_img)){ + Db::rollBack(); + return fail(HttpEnumCode::SERVER_ERROR, "处方开具失败"); } - // 将处理后的图片重新保存到其他路径 - $image->save('./runtime/2.jpg'); + // 修改处方表 + $data = array(); + $data['prescription_img'] = $prescription_img; + $data['doctor_created_time'] = date('Y-m-d H:i:s',time()); + + $params = array(); + $params['order_prescription_id'] = $order_prescription->order_prescription_id; + OrderPrescription::edit($params,$data); } + } \ No newline at end of file diff --git a/app/Model/PatientHistoryInquiry.php b/app/Model/PatientHistoryInquiry.php index d5c2dfe..40b54cc 100644 --- a/app/Model/PatientHistoryInquiry.php +++ b/app/Model/PatientHistoryInquiry.php @@ -141,7 +141,7 @@ class PatientHistoryInquiry extends Model public static function getIndexHistoryDoctorList(array $params, array $fields = ["*"]): Collection|array|\Hyperf\Utils\Collection { return self::with([ - "UserDoctor:doctor_id,user_name,avatar,hospital_id", + "UserDoctor:doctor_id,user_name,avatar,hospital_id,doctor_title", "UserDoctor.Hospital:hospital_id,hospital_name" ]) ->where($params) diff --git a/app/Services/OrderPrescriptionService.php b/app/Services/OrderPrescriptionService.php index 473ee29..109378d 100644 --- a/app/Services/OrderPrescriptionService.php +++ b/app/Services/OrderPrescriptionService.php @@ -425,6 +425,9 @@ class OrderPrescriptionService extends BaseService dump("下载处方签章文件成功"); + // 处方签章pdf转图片 + + // 上传oss $filename = "applet/prescription/" . $order_prescription['order_prescription_id'] . '.' . 'pdf'; $prescription_pdf_url = $oss->putObject($filename, $prescription_pdf_result); diff --git a/app/Services/PatientDoctorService.php b/app/Services/PatientDoctorService.php index 698aa53..6825134 100644 --- a/app/Services/PatientDoctorService.php +++ b/app/Services/PatientDoctorService.php @@ -736,6 +736,8 @@ class PatientDoctorService extends BaseService $data['hospital_name'] = $patient_history_doctor['userDoctor']['Hospital']['hospital_name']; } + $data['doctor_title'] = empty($patient_history_doctor['userDoctor']['doctor_title']) ? "" : DoctorTitleCode::getMessage($patient_history_doctor['userDoctor']['doctor_title']); + // 按照天来计算,当日为1,前一天为2 未服务过为0 if (empty($patient_history_doctor['created_at'])) { $data['days'] = 0; diff --git a/app/Services/UserDoctorService.php b/app/Services/UserDoctorService.php index 837a5f7..a74b2e6 100644 --- a/app/Services/UserDoctorService.php +++ b/app/Services/UserDoctorService.php @@ -1308,6 +1308,7 @@ class UserDoctorService extends BaseService unset($product); } + // 开具处方 $OrderPrescriptionService = new OrderPrescriptionService(); $prescription_img = $OrderPrescriptionService->openPrescription($order_prescription->order_prescription_id,$user_info['user_id']); if (empty($prescription_img)){ diff --git a/app/Services/UserPatientService.php b/app/Services/UserPatientService.php index f5184e3..6e2de0a 100644 --- a/app/Services/UserPatientService.php +++ b/app/Services/UserPatientService.php @@ -53,7 +53,7 @@ class UserPatientService extends BaseService // 获取处方数量-未使用 $OrderPrescriptionService = new OrderPrescriptionService(); - $order_prescription_count = $OrderPrescriptionService->getPatientPrescriptionWithStatus($user_patient['patient_id'],3); + $order_prescription_count = $OrderPrescriptionService->getPatientPrescriptionWithStatus($user_patient['patient_id'],2); // 获取药品数量-待支付 $OrderProductService = new OrderProductService(); diff --git a/app/Services/UserPharmacistService.php b/app/Services/UserPharmacistService.php index ea2c853..4e0fbb2 100644 --- a/app/Services/UserPharmacistService.php +++ b/app/Services/UserPharmacistService.php @@ -197,6 +197,7 @@ class UserPharmacistService extends BaseService // 审核成功 $data['prescription_status'] = 2; $data['pharmacist_audit_status'] = 1; + $data['platform_audit_status'] = 1; }else{ $data['pharmacist_audit_status'] = 2; $data['pharmacist_fail_reason'] = $pharmacist_fail_reason; @@ -208,6 +209,9 @@ class UserPharmacistService extends BaseService OrderPrescription::edit($params,$data); + + + // 发送消息 $ImService = new ImService();