新增 获取患者检测订单详情 接口

This commit is contained in:
wucongxing 2023-08-01 17:35:24 +08:00
parent 15738f0c5a
commit 3732976a2b
4 changed files with 181 additions and 69 deletions

View File

@ -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);
}
}

View File

@ -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";

View File

@ -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";

View File

@ -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);
}
@ -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);
}
/**
* 获取患者未完成订单