@@ -1336,13 +1336,47 @@ class UserDoctorService extends BaseService
|
||||
return fail(HttpEnumCode::HTTP_ERROR, $res);
|
||||
}
|
||||
|
||||
if ($user_doctor['multi_point_status'] != 1) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "请先完成多点执业认证");
|
||||
$is_transfer_prescription = false; // 是否抄方医生 false:不是抄方医生 true:抄方医生
|
||||
$transfer_doctor = null; // 抄方医生
|
||||
|
||||
Db::beginTransaction();
|
||||
try {
|
||||
if ($user_doctor['multi_point_status'] != 1) {
|
||||
|
||||
//查找可接受抄方的医生
|
||||
$params = array();
|
||||
$params['is_transfer_prescription'] = 1;
|
||||
$params['multi_point_status'] = 1;
|
||||
$transfer_prescription_list = UserDoctor::getList($params);
|
||||
if (!empty($transfer_prescription_list)) {
|
||||
$transfer_doctor = $transfer_prescription_list[0];//取第一个抄方医生
|
||||
$is_transfer_prescription = true;
|
||||
|
||||
//修改抄方医生id
|
||||
$data = array();
|
||||
$data['transfer_doctor_id'] = $transfer_doctor['doctor_id'];
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $order_inquiry_id;
|
||||
$res = OrderInquiry::edit($params,$data);
|
||||
if (!$res) {
|
||||
Db::rollBack();
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "开具处方失败");
|
||||
}
|
||||
}
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "请先完成多点执业认证");
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
Db::rollBack();
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "开具处方失败");
|
||||
}
|
||||
|
||||
|
||||
// 获取医生问诊配置-问诊购药
|
||||
$params = array();
|
||||
$params['doctor_id'] = $user_doctor['doctor_id'];
|
||||
if ($is_transfer_prescription){
|
||||
$params['doctor_id'] = $transfer_doctor['doctor_id'];
|
||||
}
|
||||
$params['inquiry_type'] = 4;
|
||||
$params['inquiry_mode'] = 1;
|
||||
$doctor_inquiry_config = DoctorInquiryConfig::getOne($params);
|
||||
@@ -1398,7 +1432,7 @@ class UserDoctorService extends BaseService
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "请填写病情主诉");
|
||||
}
|
||||
|
||||
Db::beginTransaction();
|
||||
|
||||
$generator = $this->container->get(IdGeneratorInterface::class);
|
||||
|
||||
try {
|
||||
@@ -1416,12 +1450,18 @@ class UserDoctorService extends BaseService
|
||||
$data = array();
|
||||
$data['order_inquiry_id'] = $order_inquiry_id;
|
||||
$data['doctor_id'] = $user_info['client_user_id'];
|
||||
if ($is_transfer_prescription){
|
||||
$data['doctor_id'] = $transfer_doctor['doctor_id'];
|
||||
}
|
||||
$data['patient_id'] = $order_inquiry['patient_id'];
|
||||
$data['family_id'] = $order_inquiry['family_id'];
|
||||
$data['prescription_status'] = 1;
|
||||
$data['doctor_created_time'] = date('Y-m-d H:i:s',time());
|
||||
$data['prescription_code'] = $generator->generate(); // 处方编号
|
||||
$data['doctor_name'] = $user_doctor['user_name']; // 医生名称
|
||||
if ($is_transfer_prescription){
|
||||
$data['doctor_name'] = $transfer_doctor['user_name'];
|
||||
}
|
||||
$data['patient_name'] = $order_inquiry['patient_name'];
|
||||
$data['patient_sex'] = $order_inquiry['patient_sex'];
|
||||
$data['patient_age'] = $order_inquiry['patient_age'];
|
||||
@@ -1542,8 +1582,14 @@ class UserDoctorService extends BaseService
|
||||
|
||||
// 开具处方
|
||||
$OrderPrescriptionService = new OrderPrescriptionService();
|
||||
$user_id = "";
|
||||
if ($is_transfer_prescription){
|
||||
$user_id = $transfer_doctor['user_id'];
|
||||
}else{
|
||||
$user_id = $user_info['user_id'];
|
||||
}
|
||||
dump($user_info['user_id']);
|
||||
$prescription_open_result = $OrderPrescriptionService->openPrescription($order_prescription->order_prescription_id,2,$user_info['user_id']);
|
||||
$prescription_open_result = $OrderPrescriptionService->openPrescription($order_prescription->order_prescription_id,2,$user_id);
|
||||
if (empty($prescription_open_result['prescription_img_oss_path']) || empty($prescription_open_result['file_id'])){
|
||||
Db::rollBack();
|
||||
return fail(HttpEnumCode::SERVER_ERROR, "处方开具失败");
|
||||
|
||||
Reference in New Issue
Block a user