From e43dbe60437c8901406de4d721f901db96fbaad7 Mon Sep 17 00:00:00 2001 From: wucongxing8150 <815046773@qq.com> Date: Thu, 25 Apr 2024 14:35:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8C=BB=E7=94=9F=E7=96=91?= =?UTF-8?q?=E9=9A=BE=E9=97=AE=E8=AF=8A=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Model/DoctorInquiryConfigService.php | 5 ++- app/Services/DoctorInquiryService.php | 47 +++++++++--------------- app/Services/InquiryService.php | 36 ++++++------------ app/Services/UserDoctorService.php | 25 ++++++------- 4 files changed, 42 insertions(+), 71 deletions(-) diff --git a/app/Model/DoctorInquiryConfigService.php b/app/Model/DoctorInquiryConfigService.php index a030b1d..b33ddad 100644 --- a/app/Model/DoctorInquiryConfigService.php +++ b/app/Model/DoctorInquiryConfigService.php @@ -6,6 +6,7 @@ namespace App\Model; +use Carbon\Carbon; use Hyperf\Snowflake\Concern\Snowflake; /** @@ -17,8 +18,8 @@ use Hyperf\Snowflake\Concern\Snowflake; * @property string $service_process 服务流程 * @property int $service_period 服务周期 * @property int $service_rounds 服务回合数(0表示不限次) - * @property \Carbon\Carbon $created_at 创建时间 - * @property \Carbon\Carbon $updated_at 修改时间 + * @property Carbon $created_at 创建时间 + * @property Carbon $updated_at 修改时间 */ class DoctorInquiryConfigService extends Model { diff --git a/app/Services/DoctorInquiryService.php b/app/Services/DoctorInquiryService.php index f5ffd17..97321fd 100644 --- a/app/Services/DoctorInquiryService.php +++ b/app/Services/DoctorInquiryService.php @@ -632,13 +632,6 @@ class DoctorInquiryService extends BaseService { $user_info = $this->request->getAttribute("userInfo") ?? []; - $inquiry_type = $this->request->input('inquiry_type');// 接诊类型(1:专家问诊 2:快速问诊 3:公益问诊) - $inquiry_mode = $this->request->input('inquiry_mode');// 接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员 6:疑难会诊 7:附赠 8:健康包 9:随访包) - - if ($inquiry_mode != 6) { - return fail(); - } - // 获取医生信息 $params = array(); $params['doctor_id'] = $user_info['client_user_id']; @@ -661,13 +654,11 @@ class DoctorInquiryService extends BaseService $params = array(); $params['doctor_id'] = $user_info['client_user_id']; - $params['inquiry_type'] = $inquiry_type; - $params['inquiry_mode'] = $inquiry_mode; - $doctor_inquiry_config_service = DoctorInquiryConfigService::getOne($params); - if (empty($doctor_inquiry_config_service)) { + $doctor_config_difficult_consultation = DoctorConfigDifficultConsultation::getOne($params); + if (empty($doctor_config_difficult_consultation)) { return success(null); } else { - return success($doctor_inquiry_config_service->toArray()); + return success($doctor_config_difficult_consultation->toArray()); } } @@ -706,23 +697,19 @@ class DoctorInquiryService extends BaseService $params = array(); $params['doctor_id'] = $user_info['client_user_id']; - $params['inquiry_type'] = 1; - $params['inquiry_mode'] = 6; - $doctor_inquiry_config_service = DoctorInquiryConfigService::getOne($params); - if (!empty($doctor_inquiry_config_service)) { + $doctor_config_difficult_consultation = DoctorConfigDifficultConsultation::getOne($params); + if (!empty($doctor_config_difficult_consultation)) { return fail(HttpEnumCode::HTTP_ERROR, "已存在服务设置,请勿重复设置"); } $data = array(); $data['doctor_id'] = $doctor['doctor_id']; - $data['inquiry_type'] = 1; - $data['inquiry_mode'] = 6; $data['service_content'] = $service_content; $data['service_process'] = $service_process; $data['service_period'] = $service_period; $data['service_rounds'] = $service_rounds; - $doctor_inquiry_config_service = DoctorInquiryConfigService::addDoctorInquiryConfigService($data); - if (empty($doctor_inquiry_config_service)) { + $doctor_config_difficult_consultation = DoctorConfigDifficultConsultation::addDoctorConfigDifficultConsultation($data); + if (empty($doctor_config_difficult_consultation)) { return fail(); } @@ -737,7 +724,7 @@ class DoctorInquiryService extends BaseService { $user_info = $this->request->getAttribute("userInfo") ?? []; - $config_service_id = $this->request->route('config_service_id'); + $difficult_consultation_id = $this->request->route('difficult_consultation_id'); $service_content = $this->request->input('service_content'); $service_process = $this->request->input('service_process'); @@ -765,34 +752,34 @@ class DoctorInquiryService extends BaseService } $params = array(); - $params['config_service_id'] = $config_service_id; + $params['difficult_consultation_id'] = $difficult_consultation_id; $params['doctor_id'] = $user_info['client_user_id']; - $doctor_inquiry_config_service = DoctorInquiryConfigService::getOne($params); - if (empty($doctor_inquiry_config_service)) { + $doctor_config_difficult_consultation = DoctorConfigDifficultConsultation::getOne($params); + if (empty($doctor_config_difficult_consultation)) { return fail(); } $data = array(); - if ($doctor_inquiry_config_service['service_content'] != $service_content) { + if ($doctor_config_difficult_consultation['service_content'] != $service_content) { $data['service_content'] = $service_content; } - if ($doctor_inquiry_config_service['service_process'] != $service_process) { + if ($doctor_config_difficult_consultation['service_process'] != $service_process) { $data['service_process'] = $service_process; } - if ($doctor_inquiry_config_service['service_period'] != $service_period) { + if ($doctor_config_difficult_consultation['service_period'] != $service_period) { $data['service_period'] = $service_period; } - if ($doctor_inquiry_config_service['service_rounds'] != $service_rounds) { + if ($doctor_config_difficult_consultation['service_rounds'] != $service_rounds) { $data['service_rounds'] = $service_rounds; } if (!empty($data)) { $params = array(); - $params['config_service_id'] = $doctor_inquiry_config_service['config_service_id']; - $res = DoctorInquiryConfigService::edit($params, $data); + $params['difficult_consultation_id'] = $doctor_config_difficult_consultation['difficult_consultation_id']; + $res = DoctorConfigDifficultConsultation::edit($params, $data); if (!$res) { return fail(); } diff --git a/app/Services/InquiryService.php b/app/Services/InquiryService.php index 5e26f9f..a003cdf 100644 --- a/app/Services/InquiryService.php +++ b/app/Services/InquiryService.php @@ -12,6 +12,7 @@ use App\Constants\HttpEnumCode; use App\Exception\BusinessException; use App\Model\DetectionProject; use App\Model\DiseaseClass; +use App\Model\DoctorConfigDifficultConsultation; use App\Model\DoctorInquiryConfig; use App\Model\DoctorInquiryConfigService; use App\Model\Hospital; @@ -977,15 +978,13 @@ class InquiryService extends BaseService if ($order_inquiry['inquiry_type'] == 1 && $order_inquiry['inquiry_mode'] == 6) { $params = array(); $params['doctor_id'] = $order_inquiry['doctor_id']; - $params['inquiry_type'] = $order_inquiry['inquiry_type']; - $params['inquiry_mode'] = $order_inquiry['inquiry_mode']; - $doctor_inquiry_config_service = DoctorInquiryConfigService::getOne($params); - if (empty($doctor_inquiry_config_service)) { + $doctor_config_difficult_consultation = DoctorConfigDifficultConsultation::getOne($params); + if (empty($doctor_config_difficult_consultation)) { return fail(); } - $order_inquiry['times_number'] = $doctor_inquiry_config_service['service_rounds']; // 服务回合数 - $order_inquiry['duration'] = $doctor_inquiry_config_service['service_period'] * 24 * 60; // 服务周期 + $order_inquiry['times_number'] = $doctor_config_difficult_consultation['service_rounds']; // 服务回合数 + $order_inquiry['duration'] = $doctor_config_difficult_consultation['service_period'] * 24 * 60; // 服务周期 } else { $params = array(); $params['inquiry_type'] = $order_inquiry['inquiry_type']; @@ -1003,14 +1002,8 @@ class InquiryService extends BaseService $order_inquiry['duration'] = $system_inquiry_config['duration']; } } - } - // 获取服务包当月剩余次数 - - // 获取服务包到期天数 - - $result = array(); $result['doctor_user_id'] = $user_doctor['user_id']; $result['patient_user_id'] = $order_inquiry['user_id']; @@ -1570,22 +1563,15 @@ class InquiryService extends BaseService $finish_day = ceil((strtotime($order_service_package['finish_time']) - time()) / 60 / 60 / 24); } - // 获取剩余药品数量 $remaining_quantity = 0; - if ($order_service_package['order_service_type'] == 1) { + if ($order_service_package['order_service_type'] == 1){ $OrderServicePackageService = new OrderServicePackageService(); - $params = array(); - $params['order_service_id'] = $order_service_package['order_service_id']; - $order_service_package_products = OrderServicePackageProduct::getList($params); - if (!empty($order_service_package_products)){ - foreach ($order_service_package_products as $order_service_package_product){ - // 获取服务包内某一药品的总数量 - $total_quantity = $OrderServicePackageService->getOrderServiceProductTotalQuantity($order_service_package_product['product_id']); - - // 获取服务包内某一药品的剩余数量 - $remaining_quantity = $OrderServicePackageService->getOrderServiceProductCanUseQuantity($order_service_package['order_service_id'],$order_service_package_product['product_id'],$total_quantity); - } + // 获取服务包内所有药品 + $health_package_products = $OrderServicePackageService->getOrderServiceProduct($order_service_package_detail['package_id']); + foreach ($health_package_products as $health_package_product) { + // 获取服务包内某一药品的剩余数量 + $remaining_quantity = $OrderServicePackageService->getOrderServiceProductCanUseQuantity($order_service_package['order_service_id'],$health_package_product['product_id'],$health_package_product['quantity']); } } diff --git a/app/Services/UserDoctorService.php b/app/Services/UserDoctorService.php index f276b5f..db1aeda 100644 --- a/app/Services/UserDoctorService.php +++ b/app/Services/UserDoctorService.php @@ -15,6 +15,7 @@ use App\Model\DiseaseClassExpertise; use App\Model\DiseaseClassIcd; use App\Model\DoctorAccount; use App\Model\DoctorBankCard; +use App\Model\DoctorConfigDifficultConsultation; use App\Model\DoctorConfigFollowPackage; use App\Model\DoctorConfigFollowPackageItem; use App\Model\DoctorConfigHealthPackage; @@ -1940,15 +1941,13 @@ class UserDoctorService extends BaseService // 疑难问诊为自己配置周期。 $params = array(); $params['doctor_id'] = $order_inquiry['doctor_id']; - $params['inquiry_type'] = $order_inquiry['inquiry_type']; - $params['inquiry_mode'] = $order_inquiry['inquiry_mode']; - $doctor_inquiry_config_service = DoctorInquiryConfigService::getOne($params); - if(empty($doctor_inquiry_config_service)){ + $doctor_config_difficult_consultation = DoctorConfigDifficultConsultation::getOne($params); + if(empty($doctor_config_difficult_consultation)){ Db::rollBack(); return fail(HttpEnumCode::HTTP_ERROR, "接诊失败"); } - $time = $doctor_inquiry_config_service['service_period'] * 24 * 60 * 60; + $time = $doctor_config_difficult_consultation['service_period'] * 24 * 60 * 60; }else{ $time = $system_inquiry_config['duration'] * 60; } @@ -2430,19 +2429,17 @@ class UserDoctorService extends BaseService if ($value['inquiry_mode'] == 6){ $params = array(); $params['doctor_id'] = $doctor_id; - $params['inquiry_type'] = $value['inquiry_type']; - $params['inquiry_mode'] = $value['inquiry_mode']; - $doctor_inquiry_config_service = DoctorInquiryConfigService::getOne($params); - if (empty($doctor_inquiry_config_service)){ + $doctor_config_difficult_consultation = DoctorConfigDifficultConsultation::getOne($params); + if (empty($doctor_config_difficult_consultation)){ return fail(); } - $value['times_number'] = $doctor_inquiry_config_service['service_rounds']; // 服务回合数(0表示不限次) - $value['duration'] = $doctor_inquiry_config_service['service_period']; // 服务周期(天,不存在0的情况) - $value['service_content'] = $doctor_inquiry_config_service['service_content'];// 服务内容 - $value['service_process'] = $doctor_inquiry_config_service['service_process'];// 服务流程 + $value['times_number'] = $doctor_config_difficult_consultation['service_rounds']; // 服务回合数(0表示不限次) + $value['duration'] = $doctor_config_difficult_consultation['service_period']; // 服务周期(天,不存在0的情况) + $value['service_content'] = $doctor_config_difficult_consultation['service_content'];// 服务内容 + $value['service_process'] = $doctor_config_difficult_consultation['service_process'];// 服务流程 - unset($doctor_inquiry_config_service); + unset($doctor_config_difficult_consultation); }else{ // 获取系统问诊配置 $fields = [