新增 获取患者检测订单详情 接口
This commit is contained in:
parent
15738f0c5a
commit
3732976a2b
@ -253,4 +253,14 @@ class PatientOrderController extends AbstractController
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取患者检测订单详情
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getPatientDetectionOrderInfo(): ResponseInterface
|
||||
{
|
||||
$PatientOrderService = new PatientOrderService();
|
||||
$data = $PatientOrderService->getPatientDetectionOrderInfo();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
}
|
||||
@ -11,6 +11,7 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $detection_project_id 主键id
|
||||
* @property string $detection_project_title 检测项目标题
|
||||
* @property string $detection_project_name 检测项目名称
|
||||
* @property int $company_id 合作公司id
|
||||
* @property string $detection_project_price 检测价格
|
||||
@ -30,7 +31,7 @@ class DetectionProject extends Model
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['detection_project_id', 'detection_project_name', 'company_id', 'detection_project_price', 'img_path', 'created_at', 'updated_at'];
|
||||
protected array $fillable = ['detection_project_id', 'detection_project_title', 'detection_project_name', 'company_id', 'detection_project_price', 'img_path', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "detection_project_id";
|
||||
|
||||
|
||||
@ -37,6 +37,7 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
||||
* @property int $patient_sex 患者性别-就诊人(0:未知 1:男 2:女)
|
||||
* @property int $patient_age 患者年龄-就诊人
|
||||
* @property string $detection_bar_code 检测条码
|
||||
* @property string $detection_pic 检测管图片(逗号分隔)
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
*/
|
||||
@ -52,7 +53,7 @@ class OrderDetection extends Model
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['order_detection_id', 'user_id', 'patient_id', 'doctor_id', 'family_id', 'detection_project_id', 'purpose_id', 'detection_organ_id', 'detection_status', 'is_delete', 'detection_refund_status', 'detection_pay_channel', 'detection_pay_status', 'detection_no', 'escrow_trade_no', 'amount_total', 'coupon_amount_total', 'payment_amount_total', 'pay_time', 'cancel_time', 'cancel_reason', 'cancel_remarks', 'patient_name', 'patient_name_mask', 'patient_sex', 'patient_age', 'detection_bar_code', 'created_at', 'updated_at'];
|
||||
protected array $fillable = ['order_detection_id', 'user_id', 'patient_id', 'doctor_id', 'family_id', 'detection_project_id', 'purpose_id', 'detection_organ_id', 'detection_status', 'is_delete', 'detection_refund_status', 'detection_pay_channel', 'detection_pay_status', 'detection_no', 'escrow_trade_no', 'amount_total', 'coupon_amount_total', 'payment_amount_total', 'pay_time', 'cancel_time', 'cancel_reason', 'cancel_remarks', 'patient_name', 'patient_name_mask', 'patient_sex', 'patient_age', 'detection_bar_code', 'detection_pic', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "order_detection_id";
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@ use App\Amqp\Producer\CancelUnpayOrdersDelayDirectProducer;
|
||||
use App\Constants\DoctorTitleCode;
|
||||
use App\Constants\HttpEnumCode;
|
||||
use App\Model\BasicLogisticsCompany;
|
||||
use App\Model\DetectionProject;
|
||||
use App\Model\Hospital;
|
||||
use App\Model\OrderDetection;
|
||||
use App\Model\OrderInquiry;
|
||||
@ -254,7 +255,6 @@ class PatientOrderService extends BaseService
|
||||
$order_inquiry['user_doctor'] = $user_doctor;
|
||||
|
||||
|
||||
|
||||
unset($hospital);
|
||||
unset($user_doctor);
|
||||
}
|
||||
@ -286,12 +286,12 @@ class PatientOrderService extends BaseService
|
||||
|
||||
$redis = $this->container->get(Redis::class);
|
||||
$redis_key = "order_inquiry_lock_" . $order_inquiry_id;
|
||||
$redis_lock = $redis->setnx($redis_key,1);
|
||||
$redis_lock = $redis->setnx($redis_key, 1);
|
||||
// 设置过期时间
|
||||
$redis->expire($redis_key,3);
|
||||
if (!$redis_lock){
|
||||
$redis->expire($redis_key, 3);
|
||||
if (!$redis_lock) {
|
||||
// 设置失败,表示已经设置该值
|
||||
return fail(HttpEnumCode::HTTP_SUCCESS,"请您稍后重试");
|
||||
return fail(HttpEnumCode::HTTP_SUCCESS, "请您稍后重试");
|
||||
}
|
||||
|
||||
// 检测订单状态
|
||||
@ -343,31 +343,31 @@ class PatientOrderService extends BaseService
|
||||
}
|
||||
|
||||
try {
|
||||
if (!empty($order_inquiry['doctor_id'])){
|
||||
if (!empty($order_inquiry['doctor_id'])) {
|
||||
// 获取医生数据
|
||||
$params = array();
|
||||
$params['doctor_id'] = $order_inquiry['doctor_id'];
|
||||
$user_doctor = UserDoctor::getOne($params);
|
||||
if (empty($user_doctor)){
|
||||
if (empty($user_doctor)) {
|
||||
Db::rollBack();
|
||||
return fail(HttpEnumCode::SERVER_ERROR,"取消失败");
|
||||
return fail(HttpEnumCode::SERVER_ERROR, "取消失败");
|
||||
}
|
||||
|
||||
// 推送医生-患者取消问诊
|
||||
$MessagePush = new MessagePush($user_doctor['user_id'],$order_inquiry['order_inquiry_id']);
|
||||
$MessagePush = new MessagePush($user_doctor['user_id'], $order_inquiry['order_inquiry_id']);
|
||||
$MessagePush->patientCancelInquiryToDoctor();
|
||||
|
||||
// 获取用户优惠卷信息
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];
|
||||
$order_inquiry_coupon = OrderInquiryCoupon::getOne($params);
|
||||
if (!empty($order_inquiry_coupon)){
|
||||
if (!empty($order_inquiry_coupon)) {
|
||||
// 发送站内消息-优惠卷退还
|
||||
$MessagePush = new MessagePush($order_inquiry['user_id'], $order_inquiry['order_inquiry_id']);
|
||||
$MessagePush->patientRefundCoupon($order_inquiry_coupon['coupon_name']);
|
||||
}
|
||||
}
|
||||
}catch(\Exception $e){
|
||||
} catch (\Exception $e) {
|
||||
return success();
|
||||
}
|
||||
|
||||
@ -443,7 +443,7 @@ class PatientOrderService extends BaseService
|
||||
$InquiryService = new InquiryService();
|
||||
$result = $InquiryService->cancelUnpayInquiryOrder($order_inquiry['inquiry_no'], 2, "主动取消");
|
||||
|
||||
if ($result['status'] != 1){
|
||||
if ($result['status'] != 1) {
|
||||
Db::rollBack();
|
||||
return fail();
|
||||
}
|
||||
@ -504,7 +504,7 @@ class PatientOrderService extends BaseService
|
||||
|
||||
$order_product = OrderProduct::getPatientOrderProductPage($params, $fields, $page, $per_page);
|
||||
|
||||
if (!empty($order_product['data'])){
|
||||
if (!empty($order_product['data'])) {
|
||||
foreach ($order_product['data'] as $item) {
|
||||
foreach ($item['orderProductItem'] as &$product_item) {
|
||||
$product_item['product_cover_img'] = addAliyunOssWebsite($product_item['product_cover_img']);
|
||||
@ -603,8 +603,8 @@ class PatientOrderService extends BaseService
|
||||
}
|
||||
$OrderProductService = new OrderProductService();
|
||||
|
||||
$result = $OrderProductService->cancelUnpayProductOrder($order_product['order_product_no'],1,"主动取消");
|
||||
if ($result['status'] != 1){
|
||||
$result = $OrderProductService->cancelUnpayProductOrder($order_product['order_product_no'], 1, "主动取消");
|
||||
if ($result['status'] != 1) {
|
||||
Db::rollBack();
|
||||
return fail();
|
||||
}
|
||||
@ -717,7 +717,7 @@ class PatientOrderService extends BaseService
|
||||
|
||||
// 验证订单过期支付时间
|
||||
$diff_time = (strtotime($order_inquiry['created_at']) - time()) / 60;
|
||||
if ($diff_time >= 30){
|
||||
if ($diff_time >= 30) {
|
||||
$return_result['message'] = "订单已过期";
|
||||
$return_result['data']['order_id'] = $order_inquiry['order_inquiry_id'];
|
||||
$return_result['data']['order_status'] = $order_inquiry['inquiry_status'];
|
||||
@ -734,13 +734,13 @@ class PatientOrderService extends BaseService
|
||||
$result['payment_amount_total'] = $order_inquiry['payment_amount_total']; // 实际订单金额
|
||||
$result['coupon_amount_total'] = $order_inquiry['coupon_amount_total'];; // 优惠金额
|
||||
|
||||
if ($order_inquiry['payment_amount_total'] > 0){
|
||||
if ($order_inquiry['payment_amount_total'] > 0) {
|
||||
// 发起支付
|
||||
$WechatPay = new WechatPay(1,1);
|
||||
$WechatPay = new WechatPay(1, 1);
|
||||
|
||||
|
||||
// 获取预支付交易会话标识
|
||||
$prepay = $WechatPay->getJsapiPrepayId($order_no, (int)round($order_inquiry['payment_amount_total'] * 100), $user_info['open_id'],"问诊服务");
|
||||
$prepay = $WechatPay->getJsapiPrepayId($order_no, (int)round($order_inquiry['payment_amount_total'] * 100), $user_info['open_id'], "问诊服务");
|
||||
if (empty($prepay)) {
|
||||
return fail(HttpEnumCode::SERVER_ERROR);
|
||||
}
|
||||
@ -778,7 +778,7 @@ class PatientOrderService extends BaseService
|
||||
|
||||
// 验证订单过期支付时间
|
||||
$diff_time = (strtotime($order_product['created_at']) - time()) / 60;
|
||||
if ($diff_time >= 30){
|
||||
if ($diff_time >= 30) {
|
||||
$return_result['message'] = "订单已过期";
|
||||
$return_result['data']['order_product_id'] = $order_product['order_product_id'];
|
||||
$return_result['data']['order_product_status'] = $order_product['order_product_status'];
|
||||
@ -794,12 +794,12 @@ class PatientOrderService extends BaseService
|
||||
$result['payment_amount_total'] = $order_product['payment_amount_total']; // 实际订单金额
|
||||
$result['coupon_amount_total'] = 0; // 优惠金额
|
||||
|
||||
if ($order_product['payment_amount_total'] > 0 ){
|
||||
if ($order_product['payment_amount_total'] > 0) {
|
||||
// 发起支付
|
||||
$WechatPay = new WechatPay(1,2);
|
||||
$WechatPay = new WechatPay(1, 2);
|
||||
|
||||
// 获取预支付交易会话标识
|
||||
$prepay = $WechatPay->getJsapiPrepayId($order_no, (int)round($order_product['payment_amount_total'] * 100), $user_info['open_id'],"问诊服务");
|
||||
$prepay = $WechatPay->getJsapiPrepayId($order_no, (int)round($order_product['payment_amount_total'] * 100), $user_info['open_id'], "问诊服务");
|
||||
if (empty($prepay)) {
|
||||
return fail(HttpEnumCode::SERVER_ERROR);
|
||||
}
|
||||
@ -838,7 +838,7 @@ class PatientOrderService extends BaseService
|
||||
|
||||
// 验证订单过期支付时间
|
||||
$diff_time = (strtotime($order_detection['created_at']) - time()) / 60;
|
||||
if ($diff_time >= 30){
|
||||
if ($diff_time >= 30) {
|
||||
$return_result['message'] = "订单已过期";
|
||||
$return_result['data']['order_id'] = $order_detection['order_detection_id'];
|
||||
$return_result['data']['order_status'] = $order_detection['detection_status'];
|
||||
@ -854,12 +854,12 @@ class PatientOrderService extends BaseService
|
||||
$result['payment_amount_total'] = $order_detection['amount_total']; // 实际订单金额
|
||||
$result['coupon_amount_total'] = 0; // 优惠金额
|
||||
|
||||
if ($order_detection['payment_amount_total'] > 0 ){
|
||||
if ($order_detection['payment_amount_total'] > 0) {
|
||||
// 发起支付
|
||||
$WechatPay = new WechatPay(1,3);
|
||||
$WechatPay = new WechatPay(1, 3);
|
||||
|
||||
// 获取预支付交易会话标识
|
||||
$prepay = $WechatPay->getJsapiPrepayId($order_no, (int)round($order_detection['payment_amount_total'] * 100), $user_info['open_id'],"检测服务");
|
||||
$prepay = $WechatPay->getJsapiPrepayId($order_no, (int)round($order_detection['payment_amount_total'] * 100), $user_info['open_id'], "检测服务");
|
||||
if (empty($prepay)) {
|
||||
return fail(HttpEnumCode::SERVER_ERROR);
|
||||
}
|
||||
@ -906,14 +906,14 @@ class PatientOrderService extends BaseService
|
||||
}
|
||||
|
||||
// 验证订单状态
|
||||
if ($order_inquiry['inquiry_status'] != 1){
|
||||
if ($order_inquiry['inquiry_status'] != 1) {
|
||||
Db::rollBack();
|
||||
// 问诊订单状态(1:待支付 2:待分配 3:待接诊 4:已接诊 5:已完成 6:已结束 7:已取消)
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "支付失败");
|
||||
}
|
||||
|
||||
// 验证支付金额
|
||||
if ($order_inquiry['payment_amount_total'] != 0){
|
||||
if ($order_inquiry['payment_amount_total'] != 0) {
|
||||
Db::rollBack();
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "支付失败");
|
||||
}
|
||||
@ -924,22 +924,22 @@ class PatientOrderService extends BaseService
|
||||
$data = array();
|
||||
$data['inquiry_pay_channel'] = 3; // 支付渠道(1:小程序支付 2:微信扫码支付 3:模拟支付)
|
||||
$data['inquiry_pay_status'] = 2;
|
||||
if ($order_inquiry['inquiry_type'] == 1 || $order_inquiry['inquiry_type'] == 3){
|
||||
if ($order_inquiry['inquiry_type'] == 1 || $order_inquiry['inquiry_type'] == 3) {
|
||||
// 专家-公益
|
||||
$data['inquiry_status'] = 3;// 3:待接诊
|
||||
}elseif ($order_inquiry['inquiry_type'] == 2 || $order_inquiry['inquiry_type'] == 4){
|
||||
} elseif ($order_inquiry['inquiry_type'] == 2 || $order_inquiry['inquiry_type'] == 4) {
|
||||
// 快速-购药
|
||||
$data['inquiry_status'] = 2;// 2:待分配
|
||||
}
|
||||
|
||||
$data['escrow_trade_no'] = "GD" . $generator->generate(); // 第三方支付流水号
|
||||
$data['pay_time'] = date('Y-m-d H:i:s',time());// 支付时间
|
||||
$data['updated_at'] = date('Y-m-d H:i:s',time());
|
||||
$data['pay_time'] = date('Y-m-d H:i:s', time());// 支付时间
|
||||
$data['updated_at'] = date('Y-m-d H:i:s', time());
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];
|
||||
OrderInquiry::edit($params,$data);
|
||||
OrderInquiry::edit($params, $data);
|
||||
|
||||
if ($order_inquiry['inquiry_type'] == 2 || $order_inquiry['inquiry_type'] == 4){
|
||||
if ($order_inquiry['inquiry_type'] == 2 || $order_inquiry['inquiry_type'] == 4) {
|
||||
// 快速-购药
|
||||
// 加入分配医生队列
|
||||
$data = array();
|
||||
@ -953,23 +953,23 @@ class PatientOrderService extends BaseService
|
||||
Db::rollBack();
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "分配医生失败");
|
||||
}
|
||||
}elseif ($order_inquiry['inquiry_type'] == 1 || $order_inquiry['inquiry_type'] == 3){
|
||||
} elseif ($order_inquiry['inquiry_type'] == 1 || $order_inquiry['inquiry_type'] == 3) {
|
||||
// 专家-公益,发送im消息
|
||||
// 获取订单医生数据
|
||||
$params = array();
|
||||
$params['doctor_id'] = $order_inquiry['doctor_id'];
|
||||
$user_doctor = UserDoctor::getOne($params);
|
||||
if (empty($user_doctor)){
|
||||
if (empty($user_doctor)) {
|
||||
Db::rollBack();
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "医生数据错误");
|
||||
}
|
||||
|
||||
// 发送IM消息-等待医生接诊
|
||||
$imService = new ImService();
|
||||
$imService->waitDoctorInquiry($order_inquiry,$user_doctor['user_id'],$order_inquiry['user_id']);
|
||||
$imService->waitDoctorInquiry($order_inquiry, $user_doctor['user_id'], $order_inquiry['user_id']);
|
||||
|
||||
// 发送站内、订阅失败发送短信消息-医生有新问诊
|
||||
$MessagePush = new MessagePush($user_doctor['user_id'],$order_inquiry['order_inquiry_id']);
|
||||
$MessagePush = new MessagePush($user_doctor['user_id'], $order_inquiry['order_inquiry_id']);
|
||||
$MessagePush->doctorHaveNewInquiry();
|
||||
|
||||
Log::getInstance()->info("发送im消息成功");
|
||||
@ -978,7 +978,7 @@ class PatientOrderService extends BaseService
|
||||
Db::commit();
|
||||
} catch (\Exception $e) {
|
||||
Db::rollBack();
|
||||
return fail(HttpEnumCode::SERVER_ERROR,$e->getMessage());
|
||||
return fail(HttpEnumCode::SERVER_ERROR, $e->getMessage());
|
||||
}
|
||||
|
||||
return success();
|
||||
@ -1071,15 +1071,15 @@ class PatientOrderService extends BaseService
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "存在库存不足商品", $not_enough_product_ids);
|
||||
}
|
||||
|
||||
$app_env = config('app_env','prod');
|
||||
if ($app_env != "dev"){
|
||||
$app_env = config('app_env', 'prod');
|
||||
if ($app_env != "dev") {
|
||||
// 获取运费金额
|
||||
$Prescription = new Prescription();
|
||||
|
||||
$result = $Prescription->getLogisticsFee();
|
||||
if ($amount_total >= $result['drugCost']){
|
||||
if ($amount_total >= $result['drugCost']) {
|
||||
$logistics_fee = 0;
|
||||
}else{
|
||||
} else {
|
||||
$logistics_fee = $result['freight'];
|
||||
}
|
||||
|
||||
@ -1087,7 +1087,7 @@ class PatientOrderService extends BaseService
|
||||
$payment_amount_total = $amount_total + $logistics_fee;
|
||||
}
|
||||
|
||||
if ($app_env == "dev"){
|
||||
if ($app_env == "dev") {
|
||||
$logistics_fee = 0;
|
||||
$payment_amount_total = 0.01;
|
||||
}
|
||||
@ -1158,7 +1158,7 @@ class PatientOrderService extends BaseService
|
||||
$params = array();
|
||||
$params['product_platform_code'] = $product['product_platform_code'];
|
||||
$product_platform_amount = ProductPlatformAmount::getSharedLockOne($params);
|
||||
if (empty($product_platform_amount)){
|
||||
if (empty($product_platform_amount)) {
|
||||
Db::rollBack();
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "无商品库存数据");
|
||||
}
|
||||
@ -1246,7 +1246,7 @@ class PatientOrderService extends BaseService
|
||||
$params['order_product_id'] = $order_product_id;
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$order_product = OrderProduct::getOne($params);
|
||||
if (empty($order_product)){
|
||||
if (empty($order_product)) {
|
||||
return fail();
|
||||
}
|
||||
|
||||
@ -1273,14 +1273,14 @@ class PatientOrderService extends BaseService
|
||||
$params = array();
|
||||
$params['order_product_id'] = $order_product_id;
|
||||
$order_product_logistics = OrderProductLogistic::getOne($params);
|
||||
if (empty($order_product_logistics)){
|
||||
if (!empty($order_product['logistics_no']) && !empty($order_product['logistics_company_code'])){
|
||||
if (empty($order_product_logistics)) {
|
||||
if (!empty($order_product['logistics_no']) && !empty($order_product['logistics_company_code'])) {
|
||||
// 获取快递公司名称
|
||||
$params = array();
|
||||
$params['company_code'] = $order_product['logistics_company_code'];
|
||||
$params['company_type'] = 1;
|
||||
$basic_logistics_company = BasicLogisticsCompany::getOne($params);
|
||||
if (!empty($basic_logistics_company)){
|
||||
if (!empty($basic_logistics_company)) {
|
||||
$logistics = array();
|
||||
$logistics['order_product_id'] = $order_product_id;
|
||||
$logistics['company_name'] = $basic_logistics_company['company_name'];
|
||||
@ -1289,10 +1289,10 @@ class PatientOrderService extends BaseService
|
||||
$result['logistics'] = $logistics;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
$order_product_logistics = $order_product_logistics->toArray();
|
||||
|
||||
$order_product_logistics['logistics_content'] = json_decode($order_product_logistics['logistics_content'],true);
|
||||
$order_product_logistics['logistics_content'] = json_decode($order_product_logistics['logistics_content'], true);
|
||||
$result['logistics'] = $order_product_logistics;
|
||||
}
|
||||
return success($result);
|
||||
@ -1358,7 +1358,7 @@ class PatientOrderService extends BaseService
|
||||
$params = array();
|
||||
$params['order_prescription_id'] = $order_prescription_id;
|
||||
$order_prescription_file = OrderPrescriptionFile::getOne($params);
|
||||
if (empty($order_prescription_file)){
|
||||
if (empty($order_prescription_file)) {
|
||||
return fail();
|
||||
}
|
||||
|
||||
@ -1368,7 +1368,7 @@ class PatientOrderService extends BaseService
|
||||
$params = array();
|
||||
$params['doctor_id'] = $order_prescription['doctor_id'];
|
||||
$user_doctor_info = UserDoctorInfo::getOne($params);
|
||||
if (empty($user_doctor_info)){
|
||||
if (empty($user_doctor_info)) {
|
||||
return fail(HttpEnumCode::SERVER_ERROR);
|
||||
}
|
||||
$order_prescription['doctor_sign_image'] = addAliyunOssWebsite($user_doctor_info['sign_image']);
|
||||
@ -1377,7 +1377,7 @@ class PatientOrderService extends BaseService
|
||||
$params = array();
|
||||
$params['pharmacist_id'] = $order_prescription['pharmacist_id'];
|
||||
$user_pharmacist_info = UserPharmacistInfo::getOne($params);
|
||||
if (empty($user_pharmacist_info)){
|
||||
if (empty($user_pharmacist_info)) {
|
||||
return fail(HttpEnumCode::SERVER_ERROR);
|
||||
}
|
||||
$order_prescription['pharmacist_sign_image'] = addAliyunOssWebsite($user_pharmacist_info['sign_image']);
|
||||
@ -1458,18 +1458,18 @@ class PatientOrderService extends BaseService
|
||||
|
||||
// 获取运费金额
|
||||
$logistics_fee = 0;
|
||||
if (env("APP_ENV") == "prod"){
|
||||
if (env("APP_ENV") == "prod") {
|
||||
$Prescription = new Prescription();
|
||||
$result = $Prescription->getLogisticsFee();
|
||||
if ($amount_total < $result['drugCost']){
|
||||
if ($amount_total < $result['drugCost']) {
|
||||
$logistics_fee = $result['freight'];
|
||||
}
|
||||
}
|
||||
|
||||
// 实际支付金额
|
||||
if (env("APP_ENV") == "dev"){
|
||||
if (env("APP_ENV") == "dev") {
|
||||
$payment_amount_total = 0.01;
|
||||
}else{
|
||||
} else {
|
||||
$payment_amount_total = $amount_total + $logistics_fee;
|
||||
}
|
||||
|
||||
@ -1645,6 +1645,106 @@ class PatientOrderService extends BaseService
|
||||
return success($order_detection);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取患者检测订单详情
|
||||
* @return array
|
||||
*/
|
||||
public function getPatientDetectionOrderInfo(): array
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
$order_detection_id = $this->request->route('order_detection_id');
|
||||
|
||||
// 获取订单数据
|
||||
$params = array();
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$params['order_detection_id'] = $order_detection_id;
|
||||
$params['is_delete'] = 0;
|
||||
$order_detection = OrderDetection::getOne($params);
|
||||
if (empty($order_detection)) {
|
||||
return fail();
|
||||
}
|
||||
|
||||
$order_detection = $order_detection->toArray();
|
||||
|
||||
// 获取医生数据
|
||||
$order_detection['user_doctor'] = [];
|
||||
if (!empty($order_detection['doctor_id'])) {
|
||||
$fields = [
|
||||
'user_id',
|
||||
'doctor_id',
|
||||
'user_name',
|
||||
'doctor_title',
|
||||
'hospital_id',
|
||||
'avatar',
|
||||
'department_custom_name',
|
||||
'multi_point_status',
|
||||
];
|
||||
|
||||
$params = array();
|
||||
$params['doctor_id'] = $order_detection['doctor_id'];
|
||||
$user_doctor = UserDoctor::getOne($params, $fields);
|
||||
if (empty($user_doctor)) {
|
||||
return fail(HttpEnumCode::SERVER_ERROR);
|
||||
}
|
||||
|
||||
// 转换医生职称
|
||||
$user_doctor['doctor_title'] = empty($user_doctor['doctor_title']) ? "" : DoctorTitleCode::getMessage($user_doctor['doctor_title']);
|
||||
|
||||
// 头像
|
||||
$user_doctor['avatar'] = addAliyunOssWebsite($user_doctor['avatar']);
|
||||
|
||||
// 获取医生医院名称
|
||||
$user_doctor['hospital_name'] = "";
|
||||
$user_doctor['hospital_level_name'] = "";
|
||||
|
||||
$fields = [
|
||||
'hospital_id',
|
||||
'hospital_name',
|
||||
'hospital_level_name',
|
||||
];
|
||||
|
||||
$params = array();
|
||||
$params['hospital_id'] = $user_doctor['hospital_id'];
|
||||
$hospital = Hospital::getOne($params, $fields);
|
||||
if (!empty($hospital)) {
|
||||
$user_doctor['hospital_name'] = $hospital['hospital_name'];
|
||||
$user_doctor['hospital_level_name'] = $hospital['hospital_level_name'];
|
||||
}
|
||||
|
||||
// 获取医生关注状态
|
||||
$params = array();
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$params['doctor_id'] = $user_doctor['doctor_id'];
|
||||
$user_doctor['follow'] = PatientFollow::getExists($params);
|
||||
|
||||
$order_detection['user_doctor'] = $user_doctor;
|
||||
|
||||
unset($hospital);
|
||||
unset($user_doctor);
|
||||
}
|
||||
|
||||
// 检测管图片
|
||||
if (!empty($order_detection['detection_pic'])){
|
||||
$detection_pic = explode(',', $order_detection['detection_pic']);
|
||||
foreach ($detection_pic as &$value) {
|
||||
$value = addAliyunOssWebsite($value);
|
||||
}
|
||||
$order_detection['detection_pic'] = $detection_pic;
|
||||
}
|
||||
|
||||
// 获取项目名称
|
||||
$params = array();
|
||||
$params['detection_project_id'] = $order_detection['detection_project_id'];
|
||||
$detection_project = DetectionProject::getOne($params);
|
||||
if (empty($detection_project)){
|
||||
return fail();
|
||||
}
|
||||
|
||||
$order_detection['detection_project_name'] = $detection_project['detection_project_name'];
|
||||
return success($order_detection);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取患者未完成订单
|
||||
@ -1656,21 +1756,21 @@ class PatientOrderService extends BaseService
|
||||
public function getNotFinishedOrderInquiry(string|int $inquiry_type, string $patient_id = '', string $family_id = ''): string
|
||||
{
|
||||
$params = array();
|
||||
if (!empty($patient_id)){
|
||||
$params[] = ['patient_id','=',$patient_id];
|
||||
if (!empty($patient_id)) {
|
||||
$params[] = ['patient_id', '=', $patient_id];
|
||||
}
|
||||
|
||||
if (!empty($family_id)){
|
||||
$params[] = ['family_id','=',$family_id];
|
||||
if (!empty($family_id)) {
|
||||
$params[] = ['family_id', '=', $family_id];
|
||||
}
|
||||
|
||||
$params[] = ['inquiry_type','=',$inquiry_type];
|
||||
$params[] = ['inquiry_mode','=',1];
|
||||
$params[] = ['inquiry_refund_status','=',0];
|
||||
$params[] = ['inquiry_type', '=', $inquiry_type];
|
||||
$params[] = ['inquiry_mode', '=', 1];
|
||||
$params[] = ['inquiry_refund_status', '=', 0];
|
||||
$order_inquiry = OrderInquiry::getOrderOne($params);
|
||||
if (!empty($order_inquiry)) {
|
||||
// 1:待支付 2:待分配 3:待接诊 4:已接诊
|
||||
if (in_array($order_inquiry['inquiry_status'], [1,2, 3, 4])) {
|
||||
if (in_array($order_inquiry['inquiry_status'], [1, 2, 3, 4])) {
|
||||
return $order_inquiry['order_inquiry_id'];
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user