修改上报数据

This commit is contained in:
2023-08-16 10:54:26 +08:00
parent a6732021ca
commit fd9c774c13
4 changed files with 70 additions and 27 deletions
+23 -3
View File
@@ -7,8 +7,10 @@ use App\Exception\BusinessException;
use App\Model\DetectionProject;
use App\Model\DetectionProjectPurpose;
use App\Model\Hospital;
use App\Model\OrderDetection;
use App\Model\OrderDetectionCase;
use App\Model\PatientFamily;
use App\Model\User;
use App\Model\UserDoctor;
use App\Model\UserLocation;
use App\Utils\Log;
@@ -30,7 +32,7 @@ class Wy extends Base
throw new BusinessException("缺少签名数据");
}
$time = date('Y-m-d');
$time = date('Ymd');
return md5($this->app_id . $this->secret . $time);
}
@@ -38,8 +40,15 @@ class Wy extends Base
* 上报数据
* @param array|object $order_detection
*/
public function report(array|object $order_detection)
public function report(string $order_detection_id)
{
$params = array();
$params['order_detection_id'] = $order_detection_id;
$order_detection = OrderDetection::getOne($params);
if (empty($order_detection)){
throw new BusinessException("检测订单数据错误");
}
// 获取检测订单病例数据
$params = array();
$params['order_detection_id'] = $order_detection['order_detection_id'];
@@ -96,6 +105,14 @@ class Wy extends Base
throw new BusinessException("检测数据错误");
}
// 获取用户数据
$params = array();
$params['user_id'] = $order_detection['user_id'];
$user = User::getOne($params);
if (empty($user)){
throw new BusinessException("用户数据错误");
}
// 处理检测管图片
$oss = new Oss();
@@ -138,15 +155,17 @@ class Wy extends Base
$arg['userPatientRelationships'] = $patient_family['relation']; // 操作用户与患者关系(1:本人 2:父母 3:爱人 4:子女 5:亲戚 6:其他 )
$arg['patientName'] = $order_detection['patient_name']; // 患者姓名
$arg['patientSex'] = $order_detection['patient_sex']; // 患者性别(0:未知 1:男 2:女)
$arg['patientAge'] = $order_detection['patient_age']; // 患者年龄
$arg['patientNationality'] = $order_detection_case['nation_name']; // 患者民族
$arg['patientPastMedicalHistory'] = $order_detection_case['detection_disease_class_names']; // 患者既往病史
$arg['patientCardNo'] = $patient_family['id_number']; // 患者身份证号
$arg['patientPhone'] = $patient_family['mobile']; // 患者手机号
$arg['patientPhone'] = $user['mobile']; // 患者手机号
$arg['patientAddress'] = $address ?? ""; // 患者住址(非必填)
$arg['detectBarCode'] = $order_detection['detection_bar_code']; // 检测条形码
$arg['pictureOfDetectionTube'] = $pics; // 检测管图片数组
$arg['hospitalName'] = $hospital['hospital_name']; // 医院名称(送检单位)
$arg['doctorName'] = $user_doctor['user_name']; // 医生名称
$arg['sendSampleDate'] = date('Y-m-d'); // 送检日期(yyyy-MM-dd
$arg['projectName'] = $detection_project['detection_project_name']; // 检测项目名称
$arg['projectPurpose'] = $detection_project_purpose['purpose_name']; // 检测项目用途名称
$arg['payTime'] = $order_detection['pay_time']; // 支付时间
@@ -160,6 +179,7 @@ class Wy extends Base
$path = $this->request_url . "api/sdInternet/v1/externalData/saveOrder";
try {
$response = $this->httpRequest($sign,$path,$option);
dump($response);
if (empty($response)){
// 返回值错误为空
throw new BusinessException("");