From 0adceb672fd7e82ddab93de7b8ee9d29b263d659 Mon Sep 17 00:00:00 2001 From: wucongxing8150 <815046773@qq.com> Date: Thu, 16 May 2024 14:22:22 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BA=86=20=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E5=8C=BB=E7=94=9F=E9=97=AE=E8=AF=8A=E4=BB=B7=E6=A0=BC?= =?UTF-8?q?/=E6=AF=8F=E6=97=A5=E6=8E=A5=E8=AF=8A=E6=95=B0=E9=87=8F-?= =?UTF-8?q?=E5=85=AC=E7=9B=8A=E9=97=AE=E8=AF=8A=20=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AdjustDoctorInquiryPriceCommand.php | 106 ++++++++++++++++++ app/Model/DoctorInquiryConfig.php | 34 ++++-- app/Model/DoctorInquiryConfigService.php | 82 -------------- app/Model/UserDoctor.php | 67 +---------- app/Services/DoctorInquiryService.php | 1 - app/Services/InquiryService.php | 1 - app/Services/UserDoctorService.php | 1 - 7 files changed, 138 insertions(+), 154 deletions(-) create mode 100644 app/Command/AdjustDoctorInquiryPriceCommand.php delete mode 100644 app/Model/DoctorInquiryConfigService.php diff --git a/app/Command/AdjustDoctorInquiryPriceCommand.php b/app/Command/AdjustDoctorInquiryPriceCommand.php new file mode 100644 index 0000000..178a663 --- /dev/null +++ b/app/Command/AdjustDoctorInquiryPriceCommand.php @@ -0,0 +1,106 @@ +setDescription('调整医生问诊价格/每日接诊数量-公益问诊'); + } + + public function handle(): void + { + $this->line("开始"); + + // 获取需执行的医生列表 + $params = array(); + $params[] = ['inquiry_mode', '=', 1];// 接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员) + $doctor_inquiry_configs = DoctorInquiryConfig::getInquiryConfigListByInquiryType($params,['*'],[3]); + if (empty($doctor_inquiry_configs)){ + $this->line("无数据可执行"); + } + + try { + $redis = $this->container->get(Redis::class); + } catch (\Throwable $e) { + $this->line($e->getMessage()); + return; + } + + foreach ($doctor_inquiry_configs as $doctor_inquiry_config){ + $redis_key = "DoctorInquiryConfig" . $doctor_inquiry_config['doctor_id']; + $redis_value = $redis->get($redis_key); + if (!empty($redis_value)){ + // 此医生已处理过,跳过 + continue; + } + + // 价格不为0不处理 + if ($doctor_inquiry_config['inquiry_price'] != 0){ + continue; + } + + Db::beginTransaction(); + try { + // 获取医生数据 + $params = array(); + $params['doctor_id'] = $doctor_inquiry_config['doctor_id']; + $user_doctor = UserDoctor::getOne($params); + if (empty($user_doctor)){ + Db::rollBack(); + $this->line("存在一个错误医生:" . $doctor_inquiry_config['doctor_id']); + continue; + } + + // 公益合作医生不处理 + if ($user_doctor['is_welfare_cooperation'] == 1){ + Db::rollBack(); + continue; + } + + // 调整该医生价格 + $params = array(); + $params['inquiry_config_id'] = $doctor_inquiry_config['inquiry_config_id']; + DoctorInquiryConfig::inc($params,"inquiry_price",5); + + // 调整该医生每日接诊数量 + $params = array(); + $params['inquiry_config_id'] = $doctor_inquiry_config['inquiry_config_id']; + + $data = array(); + $data['work_num_day'] = 3; + DoctorInquiryConfig::editInquiryConfig($params,$data); + + // 添加缓存记录该医生已处理 + $redis->set($redis_key, 1, 60 * 60 * 24 * 1); + + Db::commit(); + }catch (\Throwable $e){ + Db::rollBack(); + $this->line($e->getMessage()); + } + } + + $this->line("全部结束"); + } +} diff --git a/app/Model/DoctorInquiryConfig.php b/app/Model/DoctorInquiryConfig.php index dc722de..8681fe7 100644 --- a/app/Model/DoctorInquiryConfig.php +++ b/app/Model/DoctorInquiryConfig.php @@ -6,6 +6,7 @@ namespace App\Model; +use Carbon\Carbon; use Hyperf\Database\Model\Relations\HasOne; use Hyperf\Snowflake\Concern\Snowflake; @@ -18,8 +19,8 @@ use Hyperf\Snowflake\Concern\Snowflake; * @property int $last_enable_method 最后开启方式(1:自己 2:后台) * @property int $work_num_day 每日接诊数量 * @property string $inquiry_price 接诊价格(专家问诊-公益问诊) - * @property \Carbon\Carbon $created_at 创建时间 - * @property \Carbon\Carbon $updated_at 修改时间 + * @property Carbon $created_at 创建时间 + * @property Carbon $updated_at 修改时间 */ class DoctorInquiryConfig extends Model { @@ -35,11 +36,6 @@ class DoctorInquiryConfig extends Model */ protected array $fillable = ['inquiry_config_id', 'doctor_id', 'inquiry_type', 'inquiry_mode', 'is_enable', 'last_enable_method', 'work_num_day', 'inquiry_price', 'created_at', 'updated_at']; - /** - * The attributes that should be cast to native types. - */ - protected array $casts = ['inquiry_config_id' => 'string', 'doctor_id' => 'string', 'inquiry_type' => 'integer', 'inquiry_mode' => 'integer', 'work_num_day' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime', 'is_enable' => 'integer', 'last_enable_method' => 'integer']; - protected string $primaryKey = "inquiry_config_id"; /** @@ -107,4 +103,28 @@ class DoctorInquiryConfig extends Model { return self::where($params)->min('inquiry_price'); } + + /** + * 自增 + * @param array $params + * @param string $field + * @param float $numeral + * @return int + */ + public static function inc(array $params,string $field,float $numeral = 1): int + { + return self::where($params)->increment($field,$numeral); + } + + /** + * 自减 + * @param array $params + * @param string $field + * @param float $numeral + * @return int + */ + public static function dec(array $params,string $field,float $numeral = 1): int + { + return self::where($params)->decrement($field,$numeral); + } } diff --git a/app/Model/DoctorInquiryConfigService.php b/app/Model/DoctorInquiryConfigService.php deleted file mode 100644 index b33ddad..0000000 --- a/app/Model/DoctorInquiryConfigService.php +++ /dev/null @@ -1,82 +0,0 @@ -first($fields); - } - - /** - * 获取信息-多条 - * @param array $params - * @param array $fields - * @return object|null - */ - public static function getList(array $params, array $fields = ['*']): object|null - { - return self::where($params)->get($fields); - } - - /** - * 新增 - * @param array $data - * @return DoctorInquiryConfigService|\Hyperf\Database\Model\Model - */ - public static function addDoctorInquiryConfigService(array $data): \Hyperf\Database\Model\Model|DoctorInquiryConfigService - { - return self::create($data); - } - - /** - * 修改 - * @param array $params - * @param array $data - * @return int - */ - public static function edit(array $params = [], array $data = []): int - { - return self::where($params)->update($data); - } -} diff --git a/app/Model/UserDoctor.php b/app/Model/UserDoctor.php index 177e938..e09ebe5 100644 --- a/app/Model/UserDoctor.php +++ b/app/Model/UserDoctor.php @@ -49,16 +49,17 @@ use Hyperf\Utils\Arr; * @property int $is_platform_deep_cooperation 是否平台深度合作医生(0:否 1:是) * @property int $is_enterprise_deep_cooperation 是否企业深度合作医生(0:否 1:是) * @property int $is_sys_diagno_cooperation 是否先思达合作医生(0:否 1:是) + * @property int $is_welfare_cooperation 是否公益问诊合作医生(可把公益问诊设为0元) * @property string $qr_code 分享二维码 * @property string $be_good_at 擅长 * @property string $brief_introduction 医生简介 * @property \Carbon\Carbon $created_at 创建时间 * @property \Carbon\Carbon $updated_at 修改时间 - * @property-read \Hyperf\Database\Model\Collection|DoctorExpertise[]|null $DoctorExpertise - * @property-read \Hyperf\Database\Model\Collection|DoctorInquiryConfig[]|null $DoctorInquiryConfig * @property-read Hospital|null $Hospital - * @property-read \Hyperf\Database\Model\Collection|OrderInquiry[]|null $OrderInquiry * @property-read User|null $User + * @property-read \Hyperf\Database\Model\Collection|DoctorInquiryConfig[]|null $DoctorInquiryConfig + * @property-read \Hyperf\Database\Model\Collection|DoctorExpertise[]|null $DoctorExpertise + * @property-read \Hyperf\Database\Model\Collection|OrderInquiry[]|null $OrderInquiry */ class UserDoctor extends Model { @@ -72,7 +73,7 @@ class UserDoctor extends Model /** * The attributes that are mass assignable. */ - protected array $fillable = ['doctor_id', 'user_id', 'user_name', 'open_id', 'union_id', 'wx_session_key', 'status', 'idcard_status', 'iden_auth_status', 'iden_auth_time', 'iden_auth_fail_reason', 'multi_point_status', 'multi_point_time', 'multi_point_fail_reason', 'introduction_status', 'introduction_time', 'is_bind_bank', 'is_recommend', 'avatar', 'doctor_title', 'department_custom_id', 'department_custom_name', 'department_custom_mobile', 'hospital_id', 'served_patients_num', 'praise_rate', 'avg_response_time', 'number_of_fans', 'is_img_expert_reception', 'is_img_welfare_reception', 'is_img_quick_reception', 'is_platform_deep_cooperation', 'is_enterprise_deep_cooperation', 'is_sys_diagno_cooperation', 'qr_code', 'be_good_at', 'brief_introduction', 'created_at', 'updated_at']; + protected array $fillable = ['doctor_id', 'user_id', 'user_name', 'open_id', 'union_id', 'wx_session_key', 'status', 'idcard_status', 'iden_auth_status', 'iden_auth_time', 'iden_auth_fail_reason', 'multi_point_status', 'multi_point_time', 'multi_point_fail_reason', 'introduction_status', 'introduction_time', 'is_bind_bank', 'is_recommend', 'avatar', 'doctor_title', 'department_custom_id', 'department_custom_name', 'department_custom_mobile', 'hospital_id', 'served_patients_num', 'praise_rate', 'avg_response_time', 'number_of_fans', 'is_img_expert_reception', 'is_img_welfare_reception', 'is_img_quick_reception', 'is_platform_deep_cooperation', 'is_enterprise_deep_cooperation', 'is_sys_diagno_cooperation', 'is_welfare_cooperation', 'qr_code', 'be_good_at', 'brief_introduction', 'created_at', 'updated_at']; protected string $primaryKey = "doctor_id"; @@ -119,7 +120,6 @@ class UserDoctor extends Model return $this->hasMany(OrderInquiry::class, "doctor_id", "doctor_id"); } - /** * 获取医生信息-单条 * @param array $params @@ -366,63 +366,6 @@ class UserDoctor extends Model return $data; } - /** - * 获取问诊医生列表 - * 专家问诊-公益问诊共用 - * @param string $keyword - * @param array $hospital_params 医院搜索条件 - * @param array $doctor_params 医生搜索条件 - * @param array $doctor_expertise_params - * @param int $is_search_welfare_reception 是否搜索公益问诊 - * @param string|int $is_first_online 是否优先在线(1:是) - * @param string|int $sort_order - * @param array $fields - * @param int|null $page - * @param int|null $per_page - * @return array - */ - public static function getInquiryDoctorPageTest(string $keyword = "", array $hospital_params = [], array $doctor_params = [], array $doctor_expertise_params = [],int $is_search_welfare_reception = 0,string|int $is_first_online = 0, string|int $sort_order = 1, array $fields = ["*"], int $page = null, ?int $per_page = 10): array - { - $doctors = UserDoctor::join('user', function ($query) { - $query->on('user_doctor.user_id', '=', 'user.user_id'); - }) - ->select("user_doctor.*") - ->orderBy('user.is_online', 'desc') - ->get(); - - dump($doctors->toArray()); - return array(); - -// $query = self::orderBy('served_patients_num', 'desc'); -// -// if ($is_first_online == 1){ -// $query = $query->join('user', function ($query) { -// $query->on('user_doctor.user_id', '=', 'user.user_id')s -// ->orderBy('user.is_online', 'desc'); -// }) -// ->select(['user_doctor.*','user.is_online']); -// }q - -// if (!empty($sort_order)){ -// if ($sort_order == 1) { -// // 综合-价格从低到高 -// $query->orderBy('served_patients_num', 'desc');// 服务数从多到少 -// } -// } - -// $result = $query->paginate($per_page, $fields, "page", $page); -// -// $data = array(); -// $data['current_page'] = $result->currentPage();// 当前页码 -// $data['total'] = $result->total();//数据总数 -// $data['data'] = $result->items();//数据 -// $data['per_page'] = $result->perPage();//每页个数 -// $data['last_page'] = $result->lastPage();//最后一页 - -// return $data; - } - - /** * 获取是否存在 * @param array $params diff --git a/app/Services/DoctorInquiryService.php b/app/Services/DoctorInquiryService.php index f109ae7..c8af56e 100644 --- a/app/Services/DoctorInquiryService.php +++ b/app/Services/DoctorInquiryService.php @@ -9,7 +9,6 @@ use App\Model\DoctorConfigFollowPackage; use App\Model\DoctorConfigFollowPackageItem; use App\Model\DoctorConfigHealthPackage; use App\Model\DoctorInquiryConfig; -use App\Model\DoctorInquiryConfigService; use App\Model\DoctorInquiryPriceRecord; use App\Model\HealthPackage; use App\Model\SystemInquiryConfig; diff --git a/app/Services/InquiryService.php b/app/Services/InquiryService.php index 14379bd..e682f08 100644 --- a/app/Services/InquiryService.php +++ b/app/Services/InquiryService.php @@ -14,7 +14,6 @@ use App\Model\DetectionProject; use App\Model\DiseaseClass; use App\Model\DoctorConfigDifficultConsultation; use App\Model\DoctorInquiryConfig; -use App\Model\DoctorInquiryConfigService; use App\Model\Hospital; use App\Model\InquiryCaseProduct; use App\Model\MessageIm; diff --git a/app/Services/UserDoctorService.php b/app/Services/UserDoctorService.php index 8353d02..c551b60 100644 --- a/app/Services/UserDoctorService.php +++ b/app/Services/UserDoctorService.php @@ -22,7 +22,6 @@ use App\Model\DoctorConfigHealthPackage; use App\Model\DoctorExpertise; use App\Model\DoctorInquiryConfig; use App\Model\DoctorInquiryConfig as DoctorInquiryConfigModel; -use App\Model\DoctorInquiryConfigService; use App\Model\DoctorInquiryTime; use App\Model\DoctorWord; use App\Model\Hospital; From ce8896c140f26df55a6799a33f5be12335dece13 Mon Sep 17 00:00:00 2001 From: wucongxing8150 <815046773@qq.com> Date: Thu, 16 May 2024 14:32:23 +0800 Subject: [PATCH 02/11] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BA=86=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=8C=BB=E7=94=9F=E9=97=AE=E8=AF=8A=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=20=E6=8E=A5=E5=8F=A3=EF=BC=8C=E6=96=B0=E5=A2=9E=E4=BA=86?= =?UTF-8?q?=E5=85=AC=E7=9B=8A=E9=97=AE=E8=AF=8A=E7=9A=84=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Command/AdjustDoctorInquiryPriceCommand.php | 14 ++++++++++++++ app/Services/DoctorInquiryService.php | 6 ++++++ 2 files changed, 20 insertions(+) diff --git a/app/Command/AdjustDoctorInquiryPriceCommand.php b/app/Command/AdjustDoctorInquiryPriceCommand.php index 178a663..5c5f5b6 100644 --- a/app/Command/AdjustDoctorInquiryPriceCommand.php +++ b/app/Command/AdjustDoctorInquiryPriceCommand.php @@ -4,7 +4,9 @@ declare(strict_types=1); namespace App\Command; +use App\Constants\HttpEnumCode; use App\Model\DoctorInquiryConfig; +use App\Model\DoctorInquiryPriceRecord; use App\Model\UserDoctor; use Hyperf\Command\Command as HyperfCommand; use Hyperf\Command\Annotation\Command; @@ -91,6 +93,18 @@ class AdjustDoctorInquiryPriceCommand extends HyperfCommand $data['work_num_day'] = 3; DoctorInquiryConfig::editInquiryConfig($params,$data); + // 记录修改记录 + $data = array(); + $data['doctor_id'] = $doctor_inquiry_config['doctor_id']; + $data['inquiry_config_id'] = $doctor_inquiry_config['inquiry_config_id']; + $data['old_price'] = $doctor_inquiry_config['inquiry_price']; + $data['new_price'] = $doctor_inquiry_config['inquiry_price'] + 5; + $doctor_inquiry_price_record = DoctorInquiryPriceRecord::addRecord($data); + if (empty($doctor_inquiry_price_record)) { + Db::rollBack(); + $this->line("添加记录失败"); + } + // 添加缓存记录该医生已处理 $redis->set($redis_key, 1, 60 * 60 * 24 * 1); diff --git a/app/Services/DoctorInquiryService.php b/app/Services/DoctorInquiryService.php index c8af56e..140ad11 100644 --- a/app/Services/DoctorInquiryService.php +++ b/app/Services/DoctorInquiryService.php @@ -520,6 +520,12 @@ class DoctorInquiryService extends BaseService // 验证-问诊价格 // 义诊时不判断,义诊为选择价格,价格后台可调节 + if ($inquiry_type == 3 && $inquiry_price == 0) { + if ($doctor['is_welfare_cooperation'] != 1){ + return fail(HttpEnumCode::HTTP_ERROR, "请联系客服开通权限~"); + } + } + if ($inquiry_type != 3) { if (!empty($system_inquiry_config['min_inquiry_price']) && !empty($system_inquiry_config['max_inquiry_price'])) { if ($inquiry_price > $system_inquiry_config['max_inquiry_price'] || $inquiry_price < $system_inquiry_config['min_inquiry_price']) { From c820720947f2b37baa705704e7b2b2e3633c7a5a Mon Sep 17 00:00:00 2001 From: wucongxing8150 <815046773@qq.com> Date: Thu, 16 May 2024 14:40:31 +0800 Subject: [PATCH 03/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8C=BB=E7=94=9F?= =?UTF-8?q?=E7=AB=AF-=E9=A6=96=E9=A1=B5=E5=A2=9E=E5=8A=A0=E4=BA=86is=5Fwel?= =?UTF-8?q?fare=5Fcooperation=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/IndexService.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/Services/IndexService.php b/app/Services/IndexService.php index 0af084a..7fc9ebc 100644 --- a/app/Services/IndexService.php +++ b/app/Services/IndexService.php @@ -154,6 +154,7 @@ class IndexService extends BaseService "avg_response_time", "number_of_fans", "avatar", + "is_welfare_cooperation", ]; $doctor = UserDoctorModel::getOne($params, $fields); @@ -226,6 +227,7 @@ class IndexService extends BaseService $info['accepting_inquiry_num'] = $accepting_inquiry_num ?? 0;// 获取接诊中患者个数 $info['reject_prescription_number'] = $reject_prescription_number ?? 0;// 获取被驳回处方数据 $info['introduction_status'] = $doctor['introduction_status'];// 个人简介审核状态(0:未审核 1:审核通过 2:审核中 3:审核失败) + $info['is_welfare_cooperation'] = $doctor['is_welfare_cooperation'];// 是否公益问诊合作医生(可把公益问诊设为0元) $data = array(); $data['banner'] = $banner ?? [];// banner From c4143b510489622419ea34a636623f730aa8fe23 Mon Sep 17 00:00:00 2001 From: wucongxing8150 <815046773@qq.com> Date: Fri, 17 May 2024 08:44:28 +0800 Subject: [PATCH 04/11] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B5=8B=E8=AF=95=E9=80=80=E6=AC=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/routes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/routes.php b/config/routes.php index ba59963..7eb22ce 100644 --- a/config/routes.php +++ b/config/routes.php @@ -897,7 +897,7 @@ Router::addGroup('/test', function () { // // Router::get('/uninquiry', [TestController::class, 'uninquiry']); // 模拟退款 -// Router::post('/refund', [TestController::class, 'refund']); + Router::post('/refund', [TestController::class, 'refund']); }); From 7173db8219114920c73ed027c610177d5e2d8550 Mon Sep 17 00:00:00 2001 From: wucongxing8150 <815046773@qq.com> Date: Fri, 17 May 2024 10:51:08 +0800 Subject: [PATCH 05/11] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E5=A4=84=E6=96=B9pd?= =?UTF-8?q?f=E8=BD=AC=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Command/PrescriptionPdfToImgCommand.php | 30 +++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 app/Command/PrescriptionPdfToImgCommand.php diff --git a/app/Command/PrescriptionPdfToImgCommand.php b/app/Command/PrescriptionPdfToImgCommand.php new file mode 100644 index 0000000..80e141b --- /dev/null +++ b/app/Command/PrescriptionPdfToImgCommand.php @@ -0,0 +1,30 @@ +setDescription('处方pdf转图片'); + } + + public function handle(): void + { + $this->line("开始"); + $this->line("全部结束"); + } +} From f54424cf2d4bd546fcccac8c974840fd0af9d777 Mon Sep 17 00:00:00 2001 From: wucongxing8150 <815046773@qq.com> Date: Fri, 17 May 2024 10:56:32 +0800 Subject: [PATCH 06/11] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=A4=84=E6=96=B9?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E8=AF=A6=E6=83=85=E5=A2=9E=E5=8A=A0=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E8=BD=AC=E6=8D=A2=E5=9B=BE=E7=89=87=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Model/OrderPrescriptionFile.php | 6 ++---- app/Services/PatientOrderService.php | 3 +++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/Model/OrderPrescriptionFile.php b/app/Model/OrderPrescriptionFile.php index 3abbd56..37b5f4f 100644 --- a/app/Model/OrderPrescriptionFile.php +++ b/app/Model/OrderPrescriptionFile.php @@ -17,9 +17,7 @@ use Hyperf\Snowflake\Concern\Snowflake; * @property string $hospital_ca_file_id 医院签章pdf文件id(可请求ca下载) * @property string $prescription_img_oss_path 签章img文件oss路径 * @property string $prescription_pdf_oss_path 签章pdf文件oss路径 - * @property string $doctor_sign_image_path 医生签名图片oss地址 - * @property string $pharmacist_sign_image_path 药师签名图片oss地址 - * @property string $hospital_sign_image_path 医院签名图片oss地址 + * @property int $is_converted_pdf 是否已转换pdf为图片(0:否 1:是) * @property \Carbon\Carbon $created_at 创建时间 * @property \Carbon\Carbon $updated_at 修改时间 */ @@ -35,7 +33,7 @@ class OrderPrescriptionFile extends Model /** * The attributes that are mass assignable. */ - protected array $fillable = ['prescription_file_id', 'order_prescription_id', 'doctor_ca_file_id', 'hospital_ca_file_id', 'prescription_img_oss_path', 'prescription_pdf_oss_path', 'doctor_sign_image_path', 'pharmacist_sign_image_path', 'hospital_sign_image_path', 'created_at', 'updated_at']; + protected array $fillable = ['prescription_file_id', 'order_prescription_id', 'doctor_ca_file_id', 'hospital_ca_file_id', 'prescription_img_oss_path', 'prescription_pdf_oss_path', 'is_converted_pdf', 'created_at', 'updated_at']; protected string $primaryKey = "prescription_file_id"; diff --git a/app/Services/PatientOrderService.php b/app/Services/PatientOrderService.php index c532ead..1e2e621 100644 --- a/app/Services/PatientOrderService.php +++ b/app/Services/PatientOrderService.php @@ -2045,6 +2045,9 @@ class PatientOrderService extends BaseService // 获取处方医院签名 $order_prescription['hospital_sign_image'] = "https://img.applets.igandanyiyuan.com/basic/file/hospital_signature.png"; + // 是否已转换pdf为图片 + $order_prescription['is_converted_pdf'] = $order_prescription_file['is_converted_pdf']; + return success($order_prescription->toArray()); } From 14a9c08af2ef9db4e0620901cf0e7a1b65c2f855 Mon Sep 17 00:00:00 2001 From: wucongxing8150 <815046773@qq.com> Date: Fri, 17 May 2024 15:31:34 +0800 Subject: [PATCH 07/11] =?UTF-8?q?=E5=88=A0=E9=99=A4=20=E5=A4=84=E6=96=B9pd?= =?UTF-8?q?f=E8=BD=AC=E5=9B=BE=E7=89=87=E3=80=82=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E4=B8=80=E4=B8=8B=E5=B0=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Command/PrescriptionPdfToImgCommand.php | 30 --------------------- app/Controller/TestController.php | 3 ++- app/Services/CaService.php | 5 ++-- config/routes.php | 5 ++-- 4 files changed, 7 insertions(+), 36 deletions(-) delete mode 100644 app/Command/PrescriptionPdfToImgCommand.php diff --git a/app/Command/PrescriptionPdfToImgCommand.php b/app/Command/PrescriptionPdfToImgCommand.php deleted file mode 100644 index 80e141b..0000000 --- a/app/Command/PrescriptionPdfToImgCommand.php +++ /dev/null @@ -1,30 +0,0 @@ -setDescription('处方pdf转图片'); - } - - public function handle(): void - { - $this->line("开始"); - $this->line("全部结束"); - } -} diff --git a/app/Controller/TestController.php b/app/Controller/TestController.php index 8435533..137a70f 100644 --- a/app/Controller/TestController.php +++ b/app/Controller/TestController.php @@ -106,7 +106,8 @@ class TestController extends AbstractController } // 获取未接诊的医生 - public function uninquiry(){ + public function uninquiry(): \Psr\Http\Message\ResponseInterface + { $datas = array(); $params = array(); diff --git a/app/Services/CaService.php b/app/Services/CaService.php index 371493d..050854a 100644 --- a/app/Services/CaService.php +++ b/app/Services/CaService.php @@ -441,10 +441,10 @@ class CaService extends BaseService /** * 进行处方pdf签章 - * @param string $type 类型 1:医院 2:医生 3:药师 + * @param string|int $type 类型 1:医院 2:医生 3:药师 * @return string 文件id */ - public function addSignPdf(string $type): string + public function addSignPdf(string|int $type): string { $oss = new Oss(); @@ -525,7 +525,6 @@ class CaService extends BaseService throw new BusinessException("处方pdf打开失败"); } - // 处方pdf进行签章 $data = array(); $data['sign_param'] = json_encode($sign_param); diff --git a/config/routes.php b/config/routes.php index 7eb22ce..b700d43 100644 --- a/config/routes.php +++ b/config/routes.php @@ -894,8 +894,9 @@ Router::addGroup('/case', function () { Router::addGroup('/test', function () { Router::get('', [TestController::class, 'test']); - // -// Router::get('/uninquiry', [TestController::class, 'uninquiry']); + // 获取未接诊的医生 + Router::get('/uninquiry', [TestController::class, 'uninquiry']); + // 模拟退款 Router::post('/refund', [TestController::class, 'refund']); From e5dde5519053d518d088345795059b933c40ba58 Mon Sep 17 00:00:00 2001 From: wucongxing8150 <815046773@qq.com> Date: Mon, 20 May 2024 14:13:19 +0800 Subject: [PATCH 08/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=BD=93=E6=97=A5=E9=97=AE=E8=AF=8A=E6=95=B0=E9=87=8F=E6=95=B0?= =?UTF-8?q?=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Model/OrderInquiry.php | 29 ++++++++++++++++++++++++ app/Services/UserDoctorService.php | 36 ++++-------------------------- 2 files changed, 33 insertions(+), 32 deletions(-) diff --git a/app/Model/OrderInquiry.php b/app/Model/OrderInquiry.php index 9176d28..1171ba8 100644 --- a/app/Model/OrderInquiry.php +++ b/app/Model/OrderInquiry.php @@ -138,6 +138,35 @@ class OrderInquiry extends Model return self::where($params)->whereBetween('created_at', $created_at)->count(); } + /** + * 获取当日问诊数量数量 + * @param string|int $doctor_id + * @param string|int $inquiry_type + * @return int + */ + public static function getDoctorDayCount(string|int $doctor_id,string|int $inquiry_type): int + { + $params = array(); + $params[] = ['doctor_id', '=', $doctor_id]; + $params[] = ['inquiry_type', '=', $inquiry_type]; + $params[] = ['inquiry_mode', '=', 1]; + $params[] = ['inquiry_refund_status', '=', 0]; + + // 获取当天开始时间 + $start_date = date('Y-m-d 00:00:00', time()); + + // 获取当天结束时间 + $end_date = date('Y-m-d 23:59:59', time()); + + $created_at = [$start_date, $end_date]; + + return self::where($params) + ->where('inquiry_status',"<>",7) + ->where('inquiry_pay_status',"<>",1) + ->whereBetween('created_at', $created_at) + ->count(); + } + /** * 获取单条,排序 * @param array $params diff --git a/app/Services/UserDoctorService.php b/app/Services/UserDoctorService.php index c551b60..b9bd711 100644 --- a/app/Services/UserDoctorService.php +++ b/app/Services/UserDoctorService.php @@ -2191,22 +2191,8 @@ class UserDoctorService extends BaseService $doctor_inquiry_config = DoctorInquiryConfigModel::getInquiryConfigListByInquiryType($params,['*'],[1,3,4]); if (!empty($doctor_inquiry_config)) { foreach ($doctor_inquiry_config as &$value) { - // 获取医生当日的全部订单 - $params = array(); - $params[] = ['doctor_id', '=', $doctor_id]; - $params[] = ['inquiry_type', '=', $value['inquiry_type']]; - $params[] = ['inquiry_mode', '=', 1]; - $params[] = ['inquiry_refund_status', '=', 0]; - - // 获取当天开始时间 - $start_date = date('Y-m-d 00:00:00', time()); - - // 获取当天结束时间 - $end_date = date('Y-m-d 23:59:59', time()); - - $created_at = [$start_date, $end_date]; - - $value['order_inquiry_count'] = OrderInquiry::getDateCount($params,$created_at); + // 获取当日问诊数量数量 + $value['order_inquiry_count'] = OrderInquiry::getDoctorDayCount($doctor_id, $value['inquiry_type']); // 获取系统问诊配置 $fields = [ @@ -2440,22 +2426,8 @@ class UserDoctorService extends BaseService $doctor_inquiry_config = DoctorInquiryConfigModel::getInquiryConfigListByInquiryType($params,['*'],[1,3,4]); if (!empty($doctor_inquiry_config)) { foreach ($doctor_inquiry_config as &$value) { - // 获取医生当日的全部订单 - $params = array(); - $params[] = ['doctor_id', '=', $doctor_id]; - $params[] = ['inquiry_type', '=', $value['inquiry_type']]; - $params[] = ['inquiry_mode', '=', 1]; - $params[] = ['inquiry_refund_status', '=', 0]; - - // 获取当天开始时间 - $start_date = date('Y-m-d 00:00:00', time()); - - // 获取当天结束时间 - $end_date = date('Y-m-d 23:59:59', time()); - - $created_at = [$start_date, $end_date]; - - $value['order_inquiry_count'] = OrderInquiry::getDateCount($params,$created_at); + // 获取当日问诊数量数量 + $value['order_inquiry_count'] = OrderInquiry::getDoctorDayCount($doctor_id, $value['inquiry_type']); // 获取回合数以及问诊时间 if ($value['inquiry_mode'] == 6){ From fd9a0b82fa81dc1ea77568615f5881b1775b9637 Mon Sep 17 00:00:00 2001 From: wucongxing8150 <815046773@qq.com> Date: Mon, 20 May 2024 14:47:34 +0800 Subject: [PATCH 09/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=BD=93=E6=97=A5=E9=97=AE=E8=AF=8A=E6=95=B0=E9=87=8F=E6=95=B0?= =?UTF-8?q?=E9=87=8F1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Model/OrderInquiry.php | 29 ----------------------- app/Services/InquiryService.php | 38 ++++++++++++++++++++++++++++++ app/Services/UserDoctorService.php | 12 ++++++---- 3 files changed, 46 insertions(+), 33 deletions(-) diff --git a/app/Model/OrderInquiry.php b/app/Model/OrderInquiry.php index 1171ba8..9176d28 100644 --- a/app/Model/OrderInquiry.php +++ b/app/Model/OrderInquiry.php @@ -138,35 +138,6 @@ class OrderInquiry extends Model return self::where($params)->whereBetween('created_at', $created_at)->count(); } - /** - * 获取当日问诊数量数量 - * @param string|int $doctor_id - * @param string|int $inquiry_type - * @return int - */ - public static function getDoctorDayCount(string|int $doctor_id,string|int $inquiry_type): int - { - $params = array(); - $params[] = ['doctor_id', '=', $doctor_id]; - $params[] = ['inquiry_type', '=', $inquiry_type]; - $params[] = ['inquiry_mode', '=', 1]; - $params[] = ['inquiry_refund_status', '=', 0]; - - // 获取当天开始时间 - $start_date = date('Y-m-d 00:00:00', time()); - - // 获取当天结束时间 - $end_date = date('Y-m-d 23:59:59', time()); - - $created_at = [$start_date, $end_date]; - - return self::where($params) - ->where('inquiry_status',"<>",7) - ->where('inquiry_pay_status',"<>",1) - ->whereBetween('created_at', $created_at) - ->count(); - } - /** * 获取单条,排序 * @param array $params diff --git a/app/Services/InquiryService.php b/app/Services/InquiryService.php index e682f08..246987a 100644 --- a/app/Services/InquiryService.php +++ b/app/Services/InquiryService.php @@ -2281,4 +2281,42 @@ class InquiryService extends BaseService return $result->toArray(); } + /** + * 获取医生当日有效问诊数量 + * @param string|int $doctor_id + * @param string|int $inquiry_type + * @return int|mixed + */ + public function getDoctorDayInquiryCount(string|int $doctor_id,string|int $inquiry_type): mixed + { + $params = array(); + $params[] = ['doctor_id', '=', $doctor_id]; + $params[] = ['inquiry_type', '=', $inquiry_type]; + $params[] = ['inquiry_mode', '=', 1]; + $params[] = ['inquiry_refund_status', '=', 0]; + + // 获取当天开始时间 + $start_date = date('Y-m-d 00:00:00', time()); + // 获取当天结束时间 + $end_date = date('Y-m-d 23:59:59', time()); + $created_at = [$start_date, $end_date]; + + $inquiry_status_params = [1,2,3,4,5,6,7]; + + $order_inquirys = OrderInquiry::getInquiryWithCreateTime($params,$created_at,$inquiry_status_params); + if (empty($order_inquirys)){ + return 0; + } + + $count = 0; + foreach ($order_inquirys as $order_inquiry){ + if ($order_inquiry['inquiry_status'] == 7 && $order_inquiry['inquiry_pay_status'] == 1){ + continue; + } + + $count = $count + 1; + } + + return $count; + } } \ No newline at end of file diff --git a/app/Services/UserDoctorService.php b/app/Services/UserDoctorService.php index b9bd711..6c31c9a 100644 --- a/app/Services/UserDoctorService.php +++ b/app/Services/UserDoctorService.php @@ -2183,6 +2183,8 @@ class UserDoctorService extends BaseService // 获取医生问诊配置-问诊购药 $result['multi_point_enable'] = 0; + $inquiryService = new InquiryService(); + // 获取问诊价格 // 专家-公益 $params = array(); @@ -2191,8 +2193,8 @@ class UserDoctorService extends BaseService $doctor_inquiry_config = DoctorInquiryConfigModel::getInquiryConfigListByInquiryType($params,['*'],[1,3,4]); if (!empty($doctor_inquiry_config)) { foreach ($doctor_inquiry_config as &$value) { - // 获取当日问诊数量数量 - $value['order_inquiry_count'] = OrderInquiry::getDoctorDayCount($doctor_id, $value['inquiry_type']); + // 获取医生当日有效问诊数量 + $value['order_inquiry_count'] = $inquiryService->getDoctorDayInquiryCount($doctor_id, $value['inquiry_type']); // 获取系统问诊配置 $fields = [ @@ -2420,14 +2422,16 @@ class UserDoctorService extends BaseService return fail(HttpEnumCode::HTTP_SUCCESS, "医生错误"); } + $inquiryService = new InquiryService(); + // 获取问诊配置 $params = array(); $params[] = ['doctor_id', '=', $doctor_id]; $doctor_inquiry_config = DoctorInquiryConfigModel::getInquiryConfigListByInquiryType($params,['*'],[1,3,4]); if (!empty($doctor_inquiry_config)) { foreach ($doctor_inquiry_config as &$value) { - // 获取当日问诊数量数量 - $value['order_inquiry_count'] = OrderInquiry::getDoctorDayCount($doctor_id, $value['inquiry_type']); + // 获取医生当日有效问诊数量 + $value['order_inquiry_count'] = $inquiryService->getDoctorDayInquiryCount($doctor_id, $value['inquiry_type']); // 获取回合数以及问诊时间 if ($value['inquiry_mode'] == 6){ From edea213fcd938a50ab9ccc28b9d9bd0c1439994e Mon Sep 17 00:00:00 2001 From: wucongxing8150 <815046773@qq.com> Date: Mon, 20 May 2024 14:50:49 +0800 Subject: [PATCH 10/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=BD=93=E6=97=A5=E9=97=AE=E8=AF=8A=E6=95=B0=E9=87=8F=E6=95=B0?= =?UTF-8?q?=E9=87=8F2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/InquiryService.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Services/InquiryService.php b/app/Services/InquiryService.php index 246987a..98df212 100644 --- a/app/Services/InquiryService.php +++ b/app/Services/InquiryService.php @@ -2314,6 +2314,10 @@ class InquiryService extends BaseService continue; } + if ($order_inquiry['inquiry_status'] == 7 && $order_inquiry['inquiry_pay_status'] == 5){ + continue; + } + $count = $count + 1; } From b4f8a4704a4f2f0ae237931ac49f537a4eefe9e5 Mon Sep 17 00:00:00 2001 From: wucongxing8150 <815046773@qq.com> Date: Mon, 20 May 2024 14:55:43 +0800 Subject: [PATCH 11/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=BD=93=E6=97=A5=E9=97=AE=E8=AF=8A=E6=95=B0=E9=87=8F=E6=95=B0?= =?UTF-8?q?=E9=87=8F3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/InquiryService.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/Services/InquiryService.php b/app/Services/InquiryService.php index 98df212..f051743 100644 --- a/app/Services/InquiryService.php +++ b/app/Services/InquiryService.php @@ -2310,11 +2310,7 @@ class InquiryService extends BaseService $count = 0; foreach ($order_inquirys as $order_inquiry){ - if ($order_inquiry['inquiry_status'] == 7 && $order_inquiry['inquiry_pay_status'] == 1){ - continue; - } - - if ($order_inquiry['inquiry_status'] == 7 && $order_inquiry['inquiry_pay_status'] == 5){ + if ($order_inquiry['inquiry_status'] == 7){ continue; }