修改ca签章
This commit is contained in:
parent
7f5a1f1192
commit
3d4a941537
@ -20,7 +20,7 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
||||
* @property int $patient_id 患者id
|
||||
* @property int $family_id 家庭成员id(就诊用户)
|
||||
* @property int $pharmacist_id 药师id
|
||||
* @property int $prescription_status 处方状态(1:待审核 2:待使用 3:已失效 4:已使用 5:已作废)
|
||||
* @property int $prescription_status 处方状态(1:待审核 2:待使用 3:已失效 4:已使用)
|
||||
* @property int $pharmacist_audit_status 药师审核状态(0:审核中 1:审核成功 2:审核驳回)
|
||||
* @property string $pharmacist_verify_time 药师审核时间
|
||||
* @property string $pharmacist_fail_reason 药师审核驳回原因
|
||||
@ -29,15 +29,12 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
||||
* @property string $platform_fail_reason 处方平台驳回原因
|
||||
* @property string $doctor_created_time 医生开具处方时间
|
||||
* @property string $expired_time 处方过期时间
|
||||
* @property string $void_time 处方做废时间
|
||||
* @property int $is_delete 是否删除(0:否 1:是)
|
||||
* @property string $prescription_code 处方编号
|
||||
* @property string $doctor_name 医生名称
|
||||
* @property string $patient_name 患者姓名-就诊人
|
||||
* @property int $patient_sex 患者性别-就诊人(1:男 2:女)
|
||||
* @property int $patient_age 患者年龄-就诊人
|
||||
* @property string $prescription_pdf 处方pdf
|
||||
* @property string $prescription_img 处方图片
|
||||
* @property string $doctor_advice 医嘱
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
@ -57,7 +54,7 @@ class OrderPrescription extends Model
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['order_prescription_id', 'order_inquiry_id', 'doctor_id', 'patient_id', 'family_id', 'pharmacist_id', 'prescription_status', 'pharmacist_audit_status', 'pharmacist_verify_time', 'pharmacist_fail_reason', 'platform_audit_status', 'platform_fail_time', 'platform_fail_reason', 'doctor_created_time', 'expired_time', 'void_time', 'is_delete', 'prescription_code', 'doctor_name', 'patient_name', 'patient_sex', 'patient_age', 'prescription_pdf', 'prescription_img', 'doctor_advice', 'created_at', 'updated_at'];
|
||||
protected array $fillable = ['order_prescription_id', 'order_inquiry_id', 'doctor_id', 'patient_id', 'family_id', 'pharmacist_id', 'prescription_status', 'pharmacist_audit_status', 'pharmacist_verify_time', 'pharmacist_fail_reason', 'platform_audit_status', 'platform_fail_time', 'platform_fail_reason', 'doctor_created_time', 'expired_time', 'is_delete', 'prescription_code', 'doctor_name', 'patient_name', 'patient_sex', 'patient_age', 'doctor_advice', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "order_prescription_id";
|
||||
|
||||
|
||||
96
app/Model/OrderPrescriptionFile.php
Normal file
96
app/Model/OrderPrescriptionFile.php
Normal file
@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Hyperf\Database\Model\Builder;
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $prescription_file_id 主键id
|
||||
* @property int $order_prescription_id 订单-处方id
|
||||
* @property string $doctor_ca_file_id 医生签章pdf文件id(可请求ca下载)
|
||||
* @property string $doctor_pdf_oss_path 医生签章pdf文件oss路径(null表示未下载)
|
||||
* @property int $doctor_pdf_down_status 签章文件下载状态(0:未下载 1:已下载 2:下载失败)
|
||||
* @property string $doctor_pdf_down_fail_reason 下载失败原因
|
||||
* @property string $doctor_img_oss_path 医生签章img文件oss路径
|
||||
* @property string $hospital_ca_file_id 医院签章pdf文件id(可请求ca下载)
|
||||
* @property string $hospital_pdf_oss_path 医院签章pdf文件oss路径(null表示未下载)
|
||||
* @property int $hospital_pdf_down_status 签章文件下载状态(0:未下载 1:已下载 2:下载失败)
|
||||
* @property string $hospital_pdf_down_fail_reason 下载失败原因
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
*/
|
||||
class OrderPrescriptionFile extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'order_prescription_file';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['prescription_file_id', 'order_prescription_id', 'doctor_ca_file_id', 'doctor_pdf_oss_path', 'doctor_pdf_down_status', 'doctor_pdf_down_fail_reason', 'doctor_img_oss_path', 'hospital_ca_file_id', 'hospital_pdf_oss_path', 'hospital_pdf_down_status', 'hospital_pdf_down_fail_reason', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "prescription_file_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 Builder[]|Collection
|
||||
*/
|
||||
public static function getList(array $params = [], array $fields = ['*']): Collection|array
|
||||
{
|
||||
return self::where($params)->get($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取是否存在
|
||||
* @param array $params
|
||||
* @return bool
|
||||
*/
|
||||
public static function getExists(array $params): bool
|
||||
{
|
||||
return self::where($params)->exists();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param array $params
|
||||
* @param array $data
|
||||
* @return int
|
||||
*/
|
||||
public static function edit(array $params = [], array $data = []): int
|
||||
{
|
||||
return self::where($params)->update($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param array $data
|
||||
* @return \Hyperf\Database\Model\Model|OrderPrescriptionFile
|
||||
*/
|
||||
public static function addOrderPrescriptionFile(array $data): \Hyperf\Database\Model\Model|OrderPrescriptionFile
|
||||
{
|
||||
return self::create($data);
|
||||
}
|
||||
}
|
||||
@ -74,10 +74,21 @@ class UserCaCert extends Model
|
||||
/**
|
||||
* 新增
|
||||
* @param array $data
|
||||
* @return \Hyperf\Database\Model\Model|UserCaCert
|
||||
* @return UserCaCert|\Hyperf\Database\Model\Model
|
||||
*/
|
||||
public static function addDoctorPharmacistCert(array $data = []): \Hyperf\Database\Model\Model|UserCaCert
|
||||
public static function addUserCaCert(array $data): UserCaCert|\Hyperf\Database\Model\Model
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@ use App\Model\HospitalDepartmentCustom;
|
||||
use App\Model\OrderInquiryCase;
|
||||
use App\Model\OrderPrescriptionIcd;
|
||||
use App\Model\OrderPrescriptionProduct;
|
||||
use App\Model\UserCaCert;
|
||||
use App\Model\UserDoctor;
|
||||
use App\Model\UserDoctorInfo;
|
||||
use App\Model\UserPharmacistInfo;
|
||||
@ -34,6 +35,9 @@ class CaService extends BaseService
|
||||
// 过敏史
|
||||
protected string $allergy_history;
|
||||
|
||||
// 是否已添加签章配置(第一次需申请)
|
||||
protected string $is_sign_config;
|
||||
|
||||
// 用户签名图片地址
|
||||
public string $sign_image_path;
|
||||
|
||||
@ -46,6 +50,15 @@ class CaService extends BaseService
|
||||
// 医院唯一标识
|
||||
protected string $hospital_entity_id;
|
||||
|
||||
// 证书序列号
|
||||
protected string $cert_serial_number;
|
||||
|
||||
// 身份证号
|
||||
protected string $card_num;
|
||||
|
||||
// 信用代码
|
||||
protected string $org_num;
|
||||
|
||||
/**
|
||||
* 初始化类,此处会获取基础数据
|
||||
* @param array|object $order_prescription 处方表数据
|
||||
@ -63,6 +76,7 @@ class CaService extends BaseService
|
||||
|
||||
$user_sign_image_path = $user_doctor_info['sign_image'];
|
||||
$this->user_entity_id = "491925054435950592";
|
||||
$this->card_num = $user_doctor_info['card_num'];
|
||||
} else {
|
||||
$user_pharmacist_info = UserPharmacistInfo::getOne($params);
|
||||
if (empty($user_pharmacist_info)) {
|
||||
@ -71,9 +85,11 @@ class CaService extends BaseService
|
||||
|
||||
$user_sign_image_path = $user_pharmacist_info['sign_image'];
|
||||
$this->user_entity_id = $user['user_id'];
|
||||
$this->card_num = $user_pharmacist_info['card_num'];
|
||||
|
||||
$this->hospital_sign_image_path = "basic/file/hospital_signature.png";
|
||||
$this->hospital_entity_id = "5345345461";
|
||||
$this->org_num = "91510106MABTJY4K9R";
|
||||
}
|
||||
|
||||
if (empty($user_sign_image_path) || empty($this->user_entity_id)) {
|
||||
@ -94,7 +110,7 @@ class CaService extends BaseService
|
||||
$wg->add(4);
|
||||
|
||||
// 获取处方关联疾病名称
|
||||
co(function () use ($wg,$channel,&$icd_name,$order_prescription_id) {
|
||||
co(function () use ($wg,$channel,$order_prescription_id) {
|
||||
defer(function() use ($wg) {
|
||||
$wg->done();
|
||||
});
|
||||
@ -107,6 +123,7 @@ class CaService extends BaseService
|
||||
return;
|
||||
}
|
||||
|
||||
$this->icd_name = "";
|
||||
$icd_name = array_column($order_prescription_icd->toArray(), 'icd_name');
|
||||
if (!empty($icd_name)) {
|
||||
if (count($icd_name) > 1) {
|
||||
@ -134,9 +151,9 @@ class CaService extends BaseService
|
||||
$this->order_prescription_product = $order_prescription_product->toArray();
|
||||
});
|
||||
|
||||
// 获取医生自定义科室数据
|
||||
// 获取医生自定义科室名称
|
||||
$doctor_id = $order_prescription['doctor_id'];
|
||||
co(function () use ($wg,$channel,&$hospital_department_custom,$doctor_id) {
|
||||
co(function () use ($wg,$channel,$doctor_id) {
|
||||
defer(function() use ($wg) {
|
||||
$wg->done();
|
||||
});
|
||||
@ -162,9 +179,9 @@ class CaService extends BaseService
|
||||
$this->department_name = $hospital_department_custom['department_name'] ?: "";
|
||||
});
|
||||
|
||||
// 获取处方关联病例数据
|
||||
// 获取过敏史
|
||||
$order_inquiry_id = $order_prescription['order_inquiry_id'];
|
||||
co(function () use ($wg,$channel,&$order_inquiry_case,$order_inquiry_id) {
|
||||
co(function () use ($wg,$channel,$order_inquiry_id) {
|
||||
defer(function() use ($wg) {
|
||||
$wg->done();
|
||||
});
|
||||
@ -173,6 +190,7 @@ class CaService extends BaseService
|
||||
$params['order_inquiry_id'] = $order_inquiry_id;
|
||||
$order_inquiry_case = OrderInquiryCase::getOne($params);
|
||||
if (empty($order_inquiry_case)) {
|
||||
dump(111);
|
||||
$channel->push('处方病例数据错误');
|
||||
return;
|
||||
}
|
||||
@ -185,7 +203,7 @@ class CaService extends BaseService
|
||||
|
||||
// 判断通道是否存在异常数据
|
||||
$res = $channel->isEmpty();
|
||||
if ($res){
|
||||
if (!$res){
|
||||
// 读取通道数据
|
||||
$data = $channel->pop();
|
||||
|
||||
@ -197,8 +215,6 @@ class CaService extends BaseService
|
||||
// 关闭channel通道
|
||||
$channel->close();
|
||||
}
|
||||
|
||||
$this->icd_name = $icd_name;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -243,6 +259,8 @@ class CaService extends BaseService
|
||||
|
||||
// 验证云证书签名 验证无需处理,只要不返回错误即可
|
||||
$CaOnline->verifyPkcs7($cert_sign_result['signP7'], $data);
|
||||
|
||||
$this->cert_serial_number = $cert_sign_result['certSerialnumber'];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -391,16 +409,17 @@ class CaService extends BaseService
|
||||
* 下载医生开具的处方pdf
|
||||
* 存在:当次发版内医生开具后,药师再去开具
|
||||
* 不存在:医生开具后,进行发版过,此时需重新下载
|
||||
* @param array|object $order_prescription
|
||||
* @param string $order_prescription_id
|
||||
* @param string $doctor_pdf_oss_path
|
||||
* @return void
|
||||
*/
|
||||
public function downDoctorPrescriptionPdf(array|object $order_prescription): void
|
||||
public function downDoctorPrescriptionPdf(string $order_prescription_id,string $doctor_pdf_oss_path): void
|
||||
{
|
||||
$local_path = "./runtime/file/prescription/" . $order_prescription['order_prescription_id'] . '.' . 'pdf';
|
||||
$local_path = "./runtime/file/prescription/" . $order_prescription_id . '.' . 'pdf';
|
||||
$res = file_exists($local_path);
|
||||
if (!$res){
|
||||
// 去除第一个/ oss不识别
|
||||
$prescription_pdf_path = substr($order_prescription['prescription_pdf'], 1, strlen($order_prescription['prescription_pdf']) - 1);
|
||||
$prescription_pdf_path = substr($doctor_pdf_oss_path, 1, strlen($doctor_pdf_oss_path) - 1);
|
||||
|
||||
$oss = new Oss();
|
||||
$oss->getObjectToLocal($prescription_pdf_path, $local_path);
|
||||
@ -479,14 +498,42 @@ class CaService extends BaseService
|
||||
],
|
||||
];
|
||||
|
||||
$CaOnline = new CaOnline();
|
||||
|
||||
// 检测是否已添加签章配置
|
||||
$params = array();
|
||||
$params['cert_serial_number'] = $this->cert_serial_number;
|
||||
$user_ca_cert = UserCaCert::getOne($params);
|
||||
if (empty($user_ca_cert)){
|
||||
throw new BusinessException("未申请证书");
|
||||
}
|
||||
|
||||
if ($user_ca_cert['is_sign_config'] == 0){
|
||||
// 添加签章配置
|
||||
$data = array();
|
||||
$data['sign_param'] = json_encode($sign_param);
|
||||
$data['seal_img'] = $sign_image;
|
||||
|
||||
if ($type == 1){
|
||||
$CaOnline->addUserSignConfig($entity_id,$this->org_num,$data);
|
||||
}else{
|
||||
$CaOnline->addUserSignConfig($entity_id,$this->card_num,$data);
|
||||
}
|
||||
|
||||
$params = array();
|
||||
$params['cert_id'] = $user_ca_cert['cert_id'];
|
||||
|
||||
$data = array();
|
||||
$data['sign_param'] = json_encode($sign_param);
|
||||
UserCaCert::edit($params,$data);
|
||||
}
|
||||
|
||||
// 打开处方pdf文件
|
||||
$pdf_file = fopen("./runtime/" . $order_prescription['order_prescription_id'] . ".pdf", 'r');
|
||||
$pdf_file = fopen("./runtime/file/prescription/" . $order_prescription['order_prescription_id'] . ".pdf", 'r');
|
||||
if (!$pdf_file) {
|
||||
throw new BusinessException("处方图片打开失败");
|
||||
}
|
||||
|
||||
$CaOnline = new CaOnline();
|
||||
|
||||
// 处方pdf进行签章
|
||||
$data = array();
|
||||
$data['sign_param'] = json_encode($sign_param);
|
||||
|
||||
@ -542,4 +542,46 @@ class ImService extends BaseService
|
||||
$this->sendMessage($doctor_user_id, $patient_user_id, $message_content, "TIMCustomElem", $cloud_custom_data);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 药师审核中
|
||||
* @param array|object $order_inquiry
|
||||
* @param string $order_prescription_id
|
||||
* @param string $product_name
|
||||
* @param string $doctor_user_id
|
||||
* @param string $patient_user_id
|
||||
* @return void
|
||||
*/
|
||||
public function pharmacistVerify(array|object $order_inquiry, string $order_prescription_id,string $product_name,string $doctor_user_id, string $patient_user_id): void
|
||||
{
|
||||
try {
|
||||
// 发送消息
|
||||
$cloud_custom_data = array();
|
||||
$cloud_custom_data['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];
|
||||
$cloud_custom_data['is_system'] = 1;
|
||||
$cloud_custom_data['inquiry_type'] = $order_inquiry['inquiry_type'];
|
||||
$cloud_custom_data['message_rounds'] = 0;
|
||||
$cloud_custom_data['patient_family_data']['patient_name'] = $order_inquiry['patient_name'];
|
||||
$cloud_custom_data['patient_family_data']['patient_sex'] = $order_inquiry['patient_sex'];
|
||||
$cloud_custom_data['patient_family_data']['patient_age'] = $order_inquiry['patient_age'];
|
||||
|
||||
// 消息内容 医生-患者
|
||||
$message_content_data = array();
|
||||
$message_content_data['message_type'] = 6;
|
||||
$message_content_data['title'] = "药师审核中";
|
||||
$message_content_data['desc'] = "";
|
||||
$message_content_data['data']['order_inquiry_id'] = (string)$order_inquiry['order_inquiry_id'];
|
||||
$message_content_data['data']['order_prescription_id'] = $order_prescription_id;
|
||||
$message_content_data['data']['product_name'] = $product_name ?: "药品";
|
||||
$message_content_data['data']['pharmacist_verify_time'] = date('Y-m-d H:i:s',time());;
|
||||
|
||||
$message_content = [
|
||||
'Data' => json_encode($message_content_data, JSON_UNESCAPED_UNICODE),
|
||||
];
|
||||
|
||||
$this->sendMessage($doctor_user_id, $patient_user_id, $message_content, "TIMCustomElem", $cloud_custom_data);
|
||||
} catch (\Exception $e) {
|
||||
throw new BusinessException($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5,6 +5,7 @@ namespace App\Services;
|
||||
use App\Constants\HttpEnumCode;
|
||||
use App\Exception\BusinessException;
|
||||
use App\Model\OrderInquiry;
|
||||
use App\Model\OrderPrescriptionFile;
|
||||
use App\Model\OrderProduct;
|
||||
use App\Model\PatientFamily;
|
||||
use App\Model\Product;
|
||||
@ -130,7 +131,7 @@ class OrderPrescriptionService extends BaseService
|
||||
* @param string $user_id
|
||||
* @return array
|
||||
*/
|
||||
public function openPrescription(string $order_prescription_id, string $user_id): array
|
||||
public function openPrescription(string $order_prescription_id, string $user_id,string $doctor_pdf_oss_path = ""): array
|
||||
{
|
||||
try {
|
||||
// 获取用户数据
|
||||
@ -157,10 +158,16 @@ class OrderPrescriptionService extends BaseService
|
||||
throw new BusinessException("医生开方日期错误");
|
||||
}
|
||||
|
||||
// 检测处方图片
|
||||
if ($user['user_type'] == 3 && empty($order_prescription['prescription_img'])) {
|
||||
throw new BusinessException("处方图片错误");
|
||||
}
|
||||
// // 获取处方文件数据
|
||||
// $params = array();
|
||||
// $params['order_prescription_id'] = $order_prescription_id;
|
||||
// $order_prescription_file = OrderPrescriptionFile::getOne($params);
|
||||
// if (empty($order_prescription_file)){
|
||||
// // 检测处方图片
|
||||
// if ($user['user_type'] == 3) {
|
||||
// throw new BusinessException("处方文件错误");
|
||||
// }
|
||||
// }
|
||||
|
||||
$CaService = new CaService($order_prescription,$user);
|
||||
|
||||
@ -175,33 +182,23 @@ class OrderPrescriptionService extends BaseService
|
||||
|
||||
// 药师
|
||||
if ($user['user_type'] == 3) {
|
||||
// 检测处方图片
|
||||
if (empty($doctor_pdf_oss_path)){
|
||||
throw new BusinessException("处方文件错误");
|
||||
}
|
||||
|
||||
// 获取医院云证书签名+验证云证书签名
|
||||
$CaService->getVerifyCertSign($order_prescription,2);
|
||||
|
||||
// 下载医生开具的处方pdf
|
||||
$CaService->downDoctorPrescriptionPdf($order_prescription);
|
||||
$CaService->downDoctorPrescriptionPdf($order_prescription['order_prescription_id'],$doctor_pdf_oss_path);
|
||||
}
|
||||
|
||||
// 进行处方pdf签章
|
||||
$file_id = $CaService->addSignPdf($order_prescription,$user['user_type']);
|
||||
|
||||
// // 增加队列处理、自动下载处方签章文件并上传oss
|
||||
// // 未存在file_id时,药师审核列表无法看到、自动审核不处理
|
||||
//
|
||||
//
|
||||
// // 下载处方签章文件
|
||||
// $prescription_pdf_result = $CaOnline->getSignedFile($user_entity_id, $file_id);
|
||||
//
|
||||
// if (empty($prescription_pdf_result)) {
|
||||
// throw new BusinessException("下载处方签章文件失败");
|
||||
// }
|
||||
//
|
||||
// dump("下载处方签章文件成功");
|
||||
//
|
||||
// // 上传oss
|
||||
// $filename = "applet/prescription/" . $order_prescription['order_prescription_id'] . '.' . 'pdf';
|
||||
// $prescription_pdf_url = $oss->putObject($filename, $prescription_pdf_result);
|
||||
// dump("处方pdf上传pss成功");
|
||||
// 增加队列处理、自动下载处方签章文件并上传oss
|
||||
|
||||
|
||||
if ($user['user_type'] == 3) {
|
||||
// 药师端时,需要进行系统签章
|
||||
@ -213,26 +210,12 @@ class OrderPrescriptionService extends BaseService
|
||||
$file_id = $CaService->addSignPdf($order_prescription,$user['user_type']);
|
||||
|
||||
// 加入下载签章队列
|
||||
//
|
||||
// // 下载处方签章文件
|
||||
// unset($prescription_pdf_result);
|
||||
// $file_id = $hospital_sign_pdf_result[0]['fileId'];
|
||||
// $prescription_pdf_result = $CaOnline->getSignedFile($hospital_entity_id, $file_id);
|
||||
//
|
||||
// if (empty($prescription_pdf_result)) {
|
||||
// throw new BusinessException("下载处方签章文件失败");
|
||||
// }
|
||||
//
|
||||
// dump("下载医院处方签章文件成功");
|
||||
//
|
||||
// // 上传oss
|
||||
// $hospital_filename = "applet/prescription/" . $order_prescription['order_prescription_id'] . '.' . 'pdf';
|
||||
// $prescription_pdf_url = $oss->putObject($hospital_filename, $prescription_pdf_result);
|
||||
// dump("上传医院处方签章文件成功");
|
||||
|
||||
}
|
||||
|
||||
$result = array();
|
||||
$result['prescription_img_url'] = $prescription_img_url ?? $order_prescription['prescription_img'];
|
||||
$result['prescription_img_url'] = $prescription_img_url ?? "";
|
||||
$result['file_id'] = $file_id;
|
||||
return $result;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
|
||||
@ -24,6 +24,7 @@ use App\Model\OrderEvaluation;
|
||||
use App\Model\OrderInquiry;
|
||||
use App\Model\OrderInquiryCase;
|
||||
use App\Model\OrderPrescription;
|
||||
use App\Model\OrderPrescriptionFile;
|
||||
use App\Model\OrderPrescriptionIcd;
|
||||
use App\Model\OrderPrescriptionProduct;
|
||||
use App\Model\OrderProductItem;
|
||||
@ -1363,53 +1364,45 @@ class UserDoctorService extends BaseService
|
||||
return fail();
|
||||
}
|
||||
|
||||
$product_name = $product_name . ";" . $product['product_name'];
|
||||
if (empty($product_name)){
|
||||
$product_name = $product['product_name'];
|
||||
}else{
|
||||
$product_name = $product_name . ";" . $product['product_name'];
|
||||
}
|
||||
|
||||
unset($product);
|
||||
}
|
||||
|
||||
// 开具处方
|
||||
$OrderPrescriptionService = new OrderPrescriptionService();
|
||||
$prescription_open_result = $OrderPrescriptionService->openPrescription($order_prescription->order_prescription_id,$user_info['user_id']);
|
||||
if (empty($prescription_open_result['prescription_img_url'])){
|
||||
if (empty($prescription_open_result['prescription_img_url']) || empty($prescription_open_result['file_id'])){
|
||||
Db::rollBack();
|
||||
return fail(HttpEnumCode::SERVER_ERROR, "处方开具失败");
|
||||
}
|
||||
|
||||
// 修改处方表
|
||||
$data = array();
|
||||
$data['prescription_img'] = $prescription_open_result['prescription_img_url'];
|
||||
$data['doctor_created_time'] = date('Y-m-d H:i:s',time());
|
||||
|
||||
$params = array();
|
||||
$params['order_prescription_id'] = $order_prescription->order_prescription_id;
|
||||
OrderPrescription::edit($params,$data);
|
||||
|
||||
// 发送消息
|
||||
// 保存至ca处方文件表
|
||||
$data = array();
|
||||
$data['order_prescription_id'] = $order_prescription->order_prescription_id;
|
||||
$data['doctor_ca_file_id'] = $prescription_open_result['file_id'];
|
||||
$data['doctor_img_oss_path'] = $prescription_open_result['prescription_img_url'];
|
||||
$order_prescription_file = OrderPrescriptionFile::addOrderPrescriptionFile($data);
|
||||
if (empty($order_prescription_file)){
|
||||
Db::rollBack();
|
||||
return fail(HttpEnumCode::SERVER_ERROR, "处方开具失败");
|
||||
}
|
||||
|
||||
// 发送消息-药师审核中
|
||||
$ImService = new ImService();
|
||||
|
||||
$cloud_custom_data = array();
|
||||
$cloud_custom_data['order_inquiry_id'] = $order_prescription['order_inquiry_id'];
|
||||
$cloud_custom_data['is_system'] = 1;
|
||||
$cloud_custom_data['inquiry_type'] = $order_inquiry['inquiry_type'];
|
||||
$cloud_custom_data['message_rounds'] = 0;
|
||||
$cloud_custom_data['patient_family_data']['patient_name'] = $order_inquiry['patient_name'];
|
||||
$cloud_custom_data['patient_family_data']['patient_sex'] = $order_inquiry['patient_sex'];
|
||||
$cloud_custom_data['patient_family_data']['patient_age'] = $order_inquiry['patient_age'];
|
||||
|
||||
// 消息内容
|
||||
$message_content_data = array();
|
||||
$message_content_data['message_type'] = 6;
|
||||
$message_content_data['title'] = "药师审核中";
|
||||
$message_content_data['desc'] = "";
|
||||
$message_content_data['data']['order_inquiry_id'] = (string)$order_inquiry['order_inquiry_id'];
|
||||
$message_content_data['data']['order_prescription_id'] = (string)$order_prescription['order_prescription_id'];
|
||||
$message_content_data['data']['product_name'] = $product_name ?: "药品";
|
||||
$message_content_data['data']['pharmacist_verify_time'] = date('Y-m-d H:i:s',time());;
|
||||
$message_content = [
|
||||
'Data' => json_encode($message_content_data,JSON_UNESCAPED_UNICODE),
|
||||
];
|
||||
|
||||
$ImService->sendMessage($user_doctor['user_id'], $order_inquiry['user_id'], $message_content, "TIMCustomElem", $cloud_custom_data);
|
||||
$ImService->pharmacistVerify($order_inquiry,(string)$order_prescription->order_prescription_id,$product_name,$user_doctor['user_id'],$order_inquiry['user_id']);
|
||||
|
||||
// 加入分配药师队列
|
||||
$data = array();
|
||||
|
||||
@ -130,7 +130,7 @@ abstract class Ca
|
||||
$this->api_url . '/signature-server/api/open/signature/userSignConfig',
|
||||
$option
|
||||
);
|
||||
|
||||
dump($response);
|
||||
return true;
|
||||
} catch (GuzzleException $e) {
|
||||
throw new BusinessException($e->getMessage());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user