1
This commit is contained in:
parent
92d67d4492
commit
af3295eaa5
@ -1321,7 +1321,7 @@ class CallBackController extends AbstractController
|
|||||||
|
|
||||||
// 获取检测订单数据
|
// 获取检测订单数据
|
||||||
$params = array();
|
$params = array();
|
||||||
$params['detection_no'] = "D547019667026825217";
|
$params['detection_no'] = "D547725550262296576";
|
||||||
$order_detection = OrderDetection::getOne($params);
|
$order_detection = OrderDetection::getOne($params);
|
||||||
if (empty($order_detection)){
|
if (empty($order_detection)){
|
||||||
return $this->detectionResultFailReturn("非法订单");
|
return $this->detectionResultFailReturn("非法订单");
|
||||||
@ -1359,7 +1359,7 @@ class CallBackController extends AbstractController
|
|||||||
// 检测家庭成员是否存在
|
// 检测家庭成员是否存在
|
||||||
$params = array();
|
$params = array();
|
||||||
$params['family_id'] = $order_detection['family_id'];
|
$params['family_id'] = $order_detection['family_id'];
|
||||||
$params['patient_id'] = $order_detection['user_id'];
|
$params['patient_id'] = $order_detection['patient_id'];
|
||||||
$patient_family = PatientFamily::getOne($params);
|
$patient_family = PatientFamily::getOne($params);
|
||||||
if (empty($patient_family)) {
|
if (empty($patient_family)) {
|
||||||
return $this->detectionResultFailReturn("患者信息错误");
|
return $this->detectionResultFailReturn("患者信息错误");
|
||||||
@ -1368,15 +1368,6 @@ class CallBackController extends AbstractController
|
|||||||
Db::beginTransaction();
|
Db::beginTransaction();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 修改检测状态
|
|
||||||
$data = array();
|
|
||||||
$data['detection_status'] = 4;
|
|
||||||
$data['detection_time'] = date('Y-m-d H:i:s',time());
|
|
||||||
|
|
||||||
$params = array();
|
|
||||||
$params['order_detection_id'] = $order_detection['order_detection_id'];
|
|
||||||
OrderDetection::editOrderDetection($params,$data);
|
|
||||||
|
|
||||||
$generator = $this->container->get(IdGeneratorInterface::class);
|
$generator = $this->container->get(IdGeneratorInterface::class);
|
||||||
|
|
||||||
// 创建问诊订单
|
// 创建问诊订单
|
||||||
@ -1425,6 +1416,16 @@ class CallBackController extends AbstractController
|
|||||||
return $this->detectionResultFailReturn("问诊订单病例创建失败");
|
return $this->detectionResultFailReturn("问诊订单病例创建失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 修改检测状态
|
||||||
|
$data = array();
|
||||||
|
$data['detection_status'] = 4;
|
||||||
|
$data['detection_time'] = date('Y-m-d H:i:s',time());
|
||||||
|
$data['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];// 订单-问诊id
|
||||||
|
|
||||||
|
$params = array();
|
||||||
|
$params['order_detection_id'] = $order_detection['order_detection_id'];
|
||||||
|
OrderDetection::editOrderDetection($params,$data);
|
||||||
|
|
||||||
// 添加自动完成队列
|
// 添加自动完成队列
|
||||||
$time = 1000 * 60 * 60 * 24 * 3;
|
$time = 1000 * 60 * 60 * 24 * 3;
|
||||||
|
|
||||||
@ -1451,7 +1452,7 @@ class CallBackController extends AbstractController
|
|||||||
);
|
);
|
||||||
|
|
||||||
Db::commit();
|
Db::commit();
|
||||||
} catch (\Exception $e) {
|
} catch (\Throwable $e) {
|
||||||
Db::rollBack();
|
Db::rollBack();
|
||||||
return $this->detectionResultFailReturn($e->getMessage());
|
return $this->detectionResultFailReturn($e->getMessage());
|
||||||
}
|
}
|
||||||
@ -1466,15 +1467,17 @@ class CallBackController extends AbstractController
|
|||||||
$order_detection_case['detection_disease_class_names']
|
$order_detection_case['detection_disease_class_names']
|
||||||
);
|
);
|
||||||
|
|
||||||
// 患者-通知患者报告生成结果
|
// 患者-新报告生成通知
|
||||||
|
$MessagePush = new MessagePush($order_detection['user_id']);
|
||||||
|
$MessagePush->patientDetectionResultNotice($order_detection['order_detection_id']);
|
||||||
|
|
||||||
// 医生-发送检测报告短信
|
// 医生-发送检测报告短信
|
||||||
}catch (\Exception $e){
|
}catch (\Throwable $e){
|
||||||
Log::getInstance("detectionResult")->error($e->getMessage());
|
Log::getInstance("detectionResult")->error($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->detectionResultSuccessReturn();
|
return $this->detectionResultSuccessReturn();
|
||||||
} catch (\Exception $e) {
|
} catch (\Throwable $e) {
|
||||||
return $this->detectionResultFailReturn("异常:" . $e->getMessage());
|
return $this->detectionResultFailReturn("异常:" . $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
78
app/Model/BasicDetectionOrgan.php
Normal file
78
app/Model/BasicDetectionOrgan.php
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Model;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
use Hyperf\Database\Model\Collection;
|
||||||
|
use Hyperf\Snowflake\Concern\Snowflake;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property int $gts_ccis_id 主键id
|
||||||
|
* @property string $gts_ccis_name 检测机构名称
|
||||||
|
* @property int $status 状态(1:正常 2:删除)
|
||||||
|
* @property \Carbon\Carbon $created_at 创建时间
|
||||||
|
* @property \Carbon\Carbon $updated_at 修改时间
|
||||||
|
*/
|
||||||
|
class BasicDetectionOrgan extends Model
|
||||||
|
{
|
||||||
|
use Snowflake;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table associated with the model.
|
||||||
|
*/
|
||||||
|
protected ?string $table = 'basic_detection_organ';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*/
|
||||||
|
protected array $fillable = ['gts_ccis_id', 'gts_ccis_name', 'status', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
|
protected string $primaryKey = "gts_ccis_id";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取信息-单条
|
||||||
|
* @param array $params
|
||||||
|
* @param array $fields
|
||||||
|
* @return object|null
|
||||||
|
*/
|
||||||
|
public static function getOne(array $params, array $fields = ['*']): object|null
|
||||||
|
{
|
||||||
|
return self::where($params)->first($fields);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取数据-多
|
||||||
|
* @param array $params
|
||||||
|
* @param array $fields
|
||||||
|
* @return Collection|array
|
||||||
|
*/
|
||||||
|
public static function getList(array $params = [], array $fields = ['*']): Collection|array
|
||||||
|
{
|
||||||
|
return self::where($params)->get($fields);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增-批量
|
||||||
|
* @param array $data 新增数据
|
||||||
|
* @return \Hyperf\Database\Model\Model|BasicDetectionOrgan
|
||||||
|
*/
|
||||||
|
public static function add(array $data): \Hyperf\Database\Model\Model|BasicDetectionOrgan
|
||||||
|
{
|
||||||
|
return self::create($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改-批量
|
||||||
|
* @param array $params
|
||||||
|
* @param array $data
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public static function edit(array $params = [], array $data = []): int
|
||||||
|
{
|
||||||
|
return self::where($params)->update($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -18,6 +18,7 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
|||||||
* @property int $detection_project_id 检测项目id
|
* @property int $detection_project_id 检测项目id
|
||||||
* @property int $purpose_id 检测项目用途id
|
* @property int $purpose_id 检测项目用途id
|
||||||
* @property int $detection_organ_id 检测机构id
|
* @property int $detection_organ_id 检测机构id
|
||||||
|
* @property int $order_inquiry_id 问诊-订单id(检测完成后,会生成此字段)
|
||||||
* @property int $detection_status 检测订单状态(1:待支付 2:待绑定 3:检测中 4:检测完成 5:已取消)
|
* @property int $detection_status 检测订单状态(1:待支付 2:待绑定 3:检测中 4:检测完成 5:已取消)
|
||||||
* @property int $is_delete 删除状态(0:否 1:是)
|
* @property int $is_delete 删除状态(0:否 1:是)
|
||||||
* @property int $detection_refund_status 检测订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常)
|
* @property int $detection_refund_status 检测订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常)
|
||||||
@ -54,7 +55,7 @@ class OrderDetection extends Model
|
|||||||
/**
|
/**
|
||||||
* The attributes that are mass assignable.
|
* 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', 'detection_pic', 'detection_time', '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', 'order_inquiry_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', 'detection_time', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
protected string $primaryKey = "order_detection_id";
|
protected string $primaryKey = "order_detection_id";
|
||||||
|
|
||||||
|
|||||||
@ -537,6 +537,7 @@ class DetectionService extends BaseService
|
|||||||
$detection_pic = PcreMatch::pregRemoveOssWebsite($detection_pic);
|
$detection_pic = PcreMatch::pregRemoveOssWebsite($detection_pic);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取检测所
|
||||||
|
|
||||||
Db::beginTransaction();
|
Db::beginTransaction();
|
||||||
try {
|
try {
|
||||||
@ -545,6 +546,7 @@ class DetectionService extends BaseService
|
|||||||
$data['detection_pic'] = $detection_pic ?? "";
|
$data['detection_pic'] = $detection_pic ?? "";
|
||||||
$data['detection_bar_code'] = $request_params['detection_bar_code'];
|
$data['detection_bar_code'] = $request_params['detection_bar_code'];
|
||||||
$data['detection_status'] = 3;
|
$data['detection_status'] = 3;
|
||||||
|
$data['detection_organ_id'] = 1;// 检测机构id
|
||||||
|
|
||||||
$params = array();
|
$params = array();
|
||||||
$params['order_detection_id'] = $order_detection_id;
|
$params['order_detection_id'] = $order_detection_id;
|
||||||
|
|||||||
@ -7,6 +7,7 @@ use App\Amqp\Producer\SendStationMessageProducer;
|
|||||||
use App\Amqp\Producer\SendSubMessageProducer;
|
use App\Amqp\Producer\SendSubMessageProducer;
|
||||||
use App\Constants\HttpEnumCode;
|
use App\Constants\HttpEnumCode;
|
||||||
use App\Exception\BusinessException;
|
use App\Exception\BusinessException;
|
||||||
|
use App\Model\BasicDetectionOrgan;
|
||||||
use App\Model\DetectionProject;
|
use App\Model\DetectionProject;
|
||||||
use App\Model\DoctorWithdrawal;
|
use App\Model\DoctorWithdrawal;
|
||||||
use App\Model\OrderDetection;
|
use App\Model\OrderDetection;
|
||||||
@ -22,7 +23,8 @@ use App\Model\User;
|
|||||||
use App\Model\UserDoctor;
|
use App\Model\UserDoctor;
|
||||||
use App\Utils\Log;
|
use App\Utils\Log;
|
||||||
use Hyperf\Amqp\Producer;
|
use Hyperf\Amqp\Producer;
|
||||||
use Hyperf\Utils\ApplicationContext;
|
//use Hyperf\Utils\ApplicationContext;
|
||||||
|
use Hyperf\Context\ApplicationContext;
|
||||||
use Psr\Container\ContainerExceptionInterface;
|
use Psr\Container\ContainerExceptionInterface;
|
||||||
use Psr\Container\NotFoundExceptionInterface;
|
use Psr\Container\NotFoundExceptionInterface;
|
||||||
|
|
||||||
@ -418,7 +420,7 @@ class MessagePush extends BaseService
|
|||||||
|
|
||||||
// 问诊内容
|
// 问诊内容
|
||||||
$disease_desc = $order_inquiry_case['disease_desc'];
|
$disease_desc = $order_inquiry_case['disease_desc'];
|
||||||
if (mb_strlen($disease_desc) > 15){
|
if (mb_strlen($disease_desc) > 15) {
|
||||||
$disease_desc = mb_substr($disease_desc, 0, 15, 'UTF-8') . '...';
|
$disease_desc = mb_substr($disease_desc, 0, 15, 'UTF-8') . '...';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1421,7 +1423,7 @@ class MessagePush extends BaseService
|
|||||||
// 短信
|
// 短信
|
||||||
$sms_data = array();
|
$sms_data = array();
|
||||||
$sms_data['template_code'] = "SMS_271905264";
|
$sms_data['template_code'] = "SMS_271905264";
|
||||||
$sms_data['scene_desc'] = "您为{$this->order_inquiry['patient_name']}患者开具的电子处方药师审核不通过,请尽快前往微信小程序“处方管理”中查看原因,并重开处方。模版code:SMS_271905264";
|
$sms_data['scene_desc'] = "您为{$this->order_inquiry['patient_name']}患者开具的电子处方药师审核不通过,请尽快前往微信小程序“处方管理”中查看原因,并重开处方。";
|
||||||
$sms_data['phone'] = $this->user['mobile'];
|
$sms_data['phone'] = $this->user['mobile'];
|
||||||
$sms_data['user_id'] = $this->user['user_id'];
|
$sms_data['user_id'] = $this->user['user_id'];
|
||||||
|
|
||||||
@ -2255,7 +2257,7 @@ class MessagePush extends BaseService
|
|||||||
$params = array();
|
$params = array();
|
||||||
$params['detection_project_id'] = $order_detection['detection_project_id'];
|
$params['detection_project_id'] = $order_detection['detection_project_id'];
|
||||||
$detection_project = DetectionProject::getOne($params);
|
$detection_project = DetectionProject::getOne($params);
|
||||||
if (empty($detection_project)){
|
if (empty($detection_project)) {
|
||||||
Log::getInstance("MessagePush")->error("错误:加入推送队列失败,检测项目错误");
|
Log::getInstance("MessagePush")->error("错误:加入推送队列失败,检测项目错误");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2287,16 +2289,23 @@ class MessagePush extends BaseService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 患者-新报告生成通知
|
/**
|
||||||
// 订阅发送失败发送短信
|
* 患者-新报告生成通知
|
||||||
public function patientDetectionResultNotice(string $order_detection_id){
|
* 订阅发送失败发送短信
|
||||||
|
* @param string $order_detection_id
|
||||||
|
* @return void
|
||||||
|
* @throws ContainerExceptionInterface
|
||||||
|
* @throws NotFoundExceptionInterface
|
||||||
|
*/
|
||||||
|
public function patientDetectionResultNotice(string $order_detection_id): void
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
// 获取检测订单
|
// 获取检测订单
|
||||||
$params = array();
|
$params = array();
|
||||||
$params['order_detection_id'] = $order_detection_id;
|
$params['order_detection_id'] = $order_detection_id;
|
||||||
$order_detection = OrderDetection::getOne($params);
|
$order_detection = OrderDetection::getOne($params);
|
||||||
if (empty($order_detection)) {
|
if (empty($order_detection)) {
|
||||||
Log::getInstance("MessagePush-patientDetectionResultNotice")->error("错误:加入推送队列失败,无检测订单数据");
|
Log::getInstance("MessagePush-patientDetectionResultNotice")->error("无检测订单数据");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2304,8 +2313,17 @@ class MessagePush extends BaseService
|
|||||||
$params = array();
|
$params = array();
|
||||||
$params['detection_project_id'] = $order_detection['detection_project_id'];
|
$params['detection_project_id'] = $order_detection['detection_project_id'];
|
||||||
$detection_project = DetectionProject::getOne($params);
|
$detection_project = DetectionProject::getOne($params);
|
||||||
if (empty($detection_project)){
|
if (empty($detection_project)) {
|
||||||
Log::getInstance("MessagePush-patientDetectionResultNotice")->error("错误:加入推送队列失败,检测项目错误");
|
Log::getInstance("MessagePush-patientDetectionResultNotice")->error("检测项目错误");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取检测机构名称
|
||||||
|
$params = array();
|
||||||
|
$params['detection_organ_id'] = $order_detection['detection_organ_id'];
|
||||||
|
$basic_detection_organ = BasicDetectionOrgan::getOne($params);
|
||||||
|
if (empty($basic_detection_organ)){
|
||||||
|
Log::getInstance("MessagePush-patientDetectionResultNotice")->error("检测机构错误");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2315,22 +2333,22 @@ class MessagePush extends BaseService
|
|||||||
$sub_data['wx_template_id'] = "dNj3azLupP_w3j649v6lqz7je_ScqwgwFsnug6pKvyI"; // 处方审核结果通知
|
$sub_data['wx_template_id'] = "dNj3azLupP_w3j649v6lqz7je_ScqwgwFsnug6pKvyI"; // 处方审核结果通知
|
||||||
$sub_data['params']['page'] = "/pages/checkOrderDetail/checkOrderDetail?order_detection_id=" . $order_detection['detection_no'];
|
$sub_data['params']['page'] = "/pages/checkOrderDetail/checkOrderDetail?order_detection_id=" . $order_detection['detection_no'];
|
||||||
$sub_data['params']['data'] = [
|
$sub_data['params']['data'] = [
|
||||||
"thing1" => $order_detection['patient_name'],// 报告名称
|
"thing1" => "【" . $detection_project['detection_project_name'] . "】报告已出",// 报告名称
|
||||||
"time3" => (string)$detection_project['detection_project_name'],// 生成时间
|
"time3" => date('Y年m月d日 H:i'),// 生成时间
|
||||||
"thing9" => date('Y年m月d日 H:i'),// 就诊人
|
"thing9" => $order_detection['patient_name'],// 就诊人
|
||||||
"thing4" => $order_detection['payment_amount_total'],// 单位名称-检测所名称
|
"thing4" => $basic_detection_organ['gts_ccis_name'],// 单位名称-检测所名称
|
||||||
"thing8" => "订单取消成功,支付金额将立即原路退回。",// 测评结果
|
"thing8" => "请联系医生做报告解读,您有5个沟通回合。",// 测评结果
|
||||||
];
|
];
|
||||||
|
|
||||||
// 短信
|
// 短信
|
||||||
$sms_data = array();
|
$sms_data = array();
|
||||||
$sms_data['template_code'] = "SMS_271905264";
|
$sms_data['template_code'] = "SMS_462035956";
|
||||||
$sms_data['scene_desc'] = "您为{$this->order_inquiry['patient_name']}患者开具的电子处方药师审核不通过,请尽快前往微信小程序“处方管理”中查看原因,并重开处方。模版code:SMS_271905264";
|
$sms_data['scene_desc'] = "您的${$detection_project['detection_project_name']}报告单已出,请联系医生做报告解读。平台已赠送您和医生5个沟通回合,请珍惜沟通机会,请前往肝胆相照互联网医院微信小程序“个人中心”-“检测订单”-“订单详情”查看报告。";
|
||||||
$sms_data['phone'] = $this->user['mobile'];
|
$sms_data['phone'] = $this->user['mobile'];
|
||||||
$sms_data['user_id'] = $this->user['user_id'];
|
$sms_data['user_id'] = $this->user['user_id'];
|
||||||
|
|
||||||
$template_param = array();
|
$template_param = array();
|
||||||
$template_param['name'] = $this->order_inquiry['patient_name'];
|
$template_param['name'] = $order_detection['patient_name'];
|
||||||
$sms_data['template_param'] = $template_param;
|
$sms_data['template_param'] = $template_param;
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
@ -2341,10 +2359,10 @@ class MessagePush extends BaseService
|
|||||||
$producer = ApplicationContext::getContainer()->get(Producer::class);
|
$producer = ApplicationContext::getContainer()->get(Producer::class);
|
||||||
$result = $producer->produce($message);
|
$result = $producer->produce($message);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE));
|
Log::getInstance("MessagePush-patientDetectionResultNotice")->error(json_encode($data, JSON_UNESCAPED_UNICODE));
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . $e->getMessage());
|
Log::getInstance("MessagePush-patientDetectionResultNotice")->error($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1739,6 +1739,7 @@ class PatientOrderService extends BaseService
|
|||||||
}
|
}
|
||||||
|
|
||||||
$order_detection['detection_project_name'] = $detection_project['detection_project_name'];
|
$order_detection['detection_project_name'] = $detection_project['detection_project_name'];
|
||||||
|
|
||||||
return success($order_detection);
|
return success($order_detection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user