diff --git a/app/Model/OrderPrescription.php b/app/Model/OrderPrescription.php index a522505..3fd8723 100644 --- a/app/Model/OrderPrescription.php +++ b/app/Model/OrderPrescription.php @@ -21,13 +21,14 @@ use Hyperf\Snowflake\Concern\Snowflake; * @property int $pharmacist_id 药师id * @property int $prescription_status 处方状态(1:待审核 3:待使用 4:已失效 5:已使用) * @property int $pharmacist_audit_status 药师审核状态(0:审核中 1:审核成功 2:审核驳回) + * @property string $pharmacist_verify_time 药师审核时间 * @property string $pharmacist_fail_reason 药师审核驳回原因 * @property int $platform_audit_status 处方平台审核状态(0:审核中 1:审核成功 2:审核驳回) * @property string $platform_fail_time 平台审核失败时间 * @property string $platform_fail_reason 处方平台驳回原因 + * @property string $doctor_created_time 医生开具处方时间 * @property int $is_delete 是否删除(0:否 1:是) * @property string $prescription_code 处方编号 - * @property string $pharmacist_verify_time 药师审核时间 * @property string $doctor_name 医生名称 * @property string $patient_name 患者姓名-就诊人 * @property int $patient_sex 患者性别-就诊人(1:男 2:女) @@ -52,7 +53,7 @@ class OrderPrescription extends Model /** * The attributes that are mass assignable. */ - protected array $fillable = ['order_prescription_id', 'order_inquiry_id', 'doctor_id', 'patient_id', 'family_id', 'pharmacist_id', 'prescription_status', 'pharmacist_audit_status', 'pharmacist_fail_reason', 'platform_audit_status', 'platform_fail_time', 'platform_fail_reason', 'is_delete', 'prescription_code', 'pharmacist_verify_time', 'doctor_name', 'patient_name', 'patient_sex', 'patient_age', 'prescription_img', 'doctor_advice', 'created_at', 'updated_at']; + protected array $fillable = ['order_prescription_id', 'order_inquiry_id', 'doctor_id', 'patient_id', 'family_id', 'pharmacist_id', 'prescription_status', 'pharmacist_audit_status', 'pharmacist_verify_time', 'pharmacist_fail_reason', 'platform_audit_status', 'platform_fail_time', 'platform_fail_reason', 'doctor_created_time', 'is_delete', 'prescription_code', 'doctor_name', 'patient_name', 'patient_sex', 'patient_age', 'prescription_img', 'doctor_advice', 'created_at', 'updated_at']; protected string $primaryKey = "order_prescription_id"; diff --git a/app/Services/InquiryService.php b/app/Services/InquiryService.php index 292be17..9d755c6 100644 --- a/app/Services/InquiryService.php +++ b/app/Services/InquiryService.php @@ -665,9 +665,9 @@ class InquiryService extends BaseService $result['patient_user_id'] = $order_inquiry['user_id']; $result['doctor_id'] = $order_inquiry['doctor_id']; $result['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; - $result['patient_name'] = $order_inquiry['patient_name']; - $result['patient_sex'] = $order_inquiry['patient_sex']; - $result['patient_age'] = $order_inquiry['patient_age']; + $result['patient_family_name'] = $order_inquiry['patient_name']; + $result['patient_family_sex'] = $order_inquiry['patient_sex']; + $result['patient_family_age'] = $order_inquiry['patient_age']; $result['inquiry_type'] = $order_inquiry['inquiry_type']; $result['inquiry_status'] = $order_inquiry['inquiry_status']; $result['times_number'] = $times_number; diff --git a/app/Services/OrderPrescriptionService.php b/app/Services/OrderPrescriptionService.php index 27e553d..2459535 100644 --- a/app/Services/OrderPrescriptionService.php +++ b/app/Services/OrderPrescriptionService.php @@ -2,9 +2,14 @@ namespace App\Services; +use App\Constants\HttpEnumCode; +use App\Exception\BusinessException; +use App\Model\DoctorPharmacistCert; use App\Model\OrderPrescription; +use App\Model\OrderPrescriptionIcd; use App\Model\OrderPrescriptionProduct; use App\Model\OrderProductItem; +use Extend\Ca\Ca; use Hyperf\Contract\LengthAwarePaginatorInterface; class OrderPrescriptionService extends BaseService @@ -33,7 +38,7 @@ class OrderPrescriptionService extends BaseService * @param string|int $per_page * @return array */ - public function getPharmacistWaitAuditPage(string $pharmacist_id,int $pharmacist_audit_status,int $platform_audit_status,string|int $page = 1,string|int $per_page = 10): array + public function getPharmacistWaitAuditPage(string $pharmacist_id, int $pharmacist_audit_status, int $platform_audit_status, string|int $page = 1, string|int $per_page = 10): array { $params = array(); $params['pharmacist_id'] = $pharmacist_id; @@ -93,4 +98,89 @@ class OrderPrescriptionService extends BaseService $params['pharmacist_audit_status'] = 1; return OrderPrescription::getCount($params); } + + // 开具处方时获取云证书签名 + public function getCaCertSign(array $order_prescription, array $order_prescription_icd, array $order_prescription_product) + { + try { +// // 获取处方数据 +// $params = array(); +// $params['order_prescription_id'] = $order_prescription_id; +// $order_prescription = OrderPrescription::getOne($params); +// if (empty($order_prescription)){ +// throw new BusinessException("处方数据错误"); +// } +// +// // 获取处方关联疾病数据 +// $params = array(); +// $params['order_prescription_id'] = $order_prescription_id; +// $order_prescription_icd = OrderPrescriptionIcd::getOne($params); +// if (empty($order_prescription_icd)){ +// throw new BusinessException("处方疾病数据错误"); +// } +// +// // 获取处方关联商品数据 +// $params = array(); +// $params['order_prescription_id'] = $order_prescription_id; +// $order_prescription_product = OrderPrescriptionProduct::getList($params); +// if (empty($order_prescription_product)){ +// throw new BusinessException("处方药品数据错误"); +// } + + $ca = new Ca(); + + // 获取云证书签名 + $data = array(); + $data['created_at'] = $order_prescription; + $data['department_custom_name'] = "外科"; + $data['user_name'] = "测试用户1"; + $data['sex'] = "男"; + $data['age'] = 19; + $data['allergy_history'] = "无"; + $data['icd_name'] = "感冒"; + $data['doctor_advice'] = "多吃药"; + $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盒", + ], + ]; + + $result = $ca->getCertSign("491925054435950592", "491925054435950592", $data); + + } catch (\Exception $e) { + + } + } } \ No newline at end of file diff --git a/app/Services/UserDoctorService.php b/app/Services/UserDoctorService.php index 5663192..1f12e80 100644 --- a/app/Services/UserDoctorService.php +++ b/app/Services/UserDoctorService.php @@ -1206,6 +1206,7 @@ class UserDoctorService extends BaseService return fail(HttpEnumCode::SERVER_ERROR, "处方开具失败"); } + // 疾病数据 foreach ($prescription_icd as $item) { // 获取疾病信息 $params = array(); @@ -1231,6 +1232,7 @@ class UserDoctorService extends BaseService unset($disease_class_icd); } + // 商品数据 foreach ($prescription_product as $item) { // 获取商品数据 $params = array(); @@ -1277,6 +1279,8 @@ class UserDoctorService extends BaseService unset($product); } + + // 加入分配药师队列 $data = array(); $data['order_prescription_id'] = $order_prescription['order_prescription_id'];