新增药师开具处方ca签章
This commit is contained in:
parent
d09f9d8d77
commit
29965b14af
@ -7,7 +7,7 @@ use App\Amqp\Producer\CancelUnpayOrdersDelayDirectProducer;
|
|||||||
use App\Constants\HttpEnumCode;
|
use App\Constants\HttpEnumCode;
|
||||||
use App\Exception\BusinessException;
|
use App\Exception\BusinessException;
|
||||||
use App\Model\DoctorInquiryTime;
|
use App\Model\DoctorInquiryTime;
|
||||||
use App\Model\DoctorPharmacistCert;
|
use App\Model\UserCaCert;
|
||||||
use App\Model\OrderInquiry;
|
use App\Model\OrderInquiry;
|
||||||
use App\Model\OrderPrescription;
|
use App\Model\OrderPrescription;
|
||||||
use App\Model\OrderPrescriptionIcd;
|
use App\Model\OrderPrescriptionIcd;
|
||||||
@ -38,8 +38,9 @@ class TestController extends AbstractController
|
|||||||
// $this->test_10();
|
// $this->test_10();
|
||||||
// $this->test_11();
|
// $this->test_11();
|
||||||
// $this->test_5();
|
// $this->test_5();
|
||||||
$this->test_1();
|
// $this->test_1();
|
||||||
// $this->test_11();
|
// $this->test_11();
|
||||||
|
$this->test_12();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取云证书-首次
|
// 获取云证书-首次
|
||||||
@ -57,7 +58,7 @@ class TestController extends AbstractController
|
|||||||
// $data['cert_chain_p7'] = $result['certP7'];
|
// $data['cert_chain_p7'] = $result['certP7'];
|
||||||
// $data['cert_serial_number'] = $result['certSerialnumber'];
|
// $data['cert_serial_number'] = $result['certSerialnumber'];
|
||||||
// $data['ca_pin'] = "491925054435950592";
|
// $data['ca_pin'] = "491925054435950592";
|
||||||
// $doctor_pharmacist_cert = DoctorPharmacistCert::addDoctorPharmacistCert($data);
|
// $doctor_pharmacist_cert = UserCaCert::addDoctorPharmacistCert($data);
|
||||||
// if (empty($doctor_pharmacist_cert)){
|
// if (empty($doctor_pharmacist_cert)){
|
||||||
// return fail();
|
// return fail();
|
||||||
// }
|
// }
|
||||||
@ -74,27 +75,27 @@ class TestController extends AbstractController
|
|||||||
// $data['cert_chain_p7'] = $result['certP7'];
|
// $data['cert_chain_p7'] = $result['certP7'];
|
||||||
// $data['cert_serial_number'] = $result['certSerialnumber'];
|
// $data['cert_serial_number'] = $result['certSerialnumber'];
|
||||||
// $data['ca_pin'] = "534534546";
|
// $data['ca_pin'] = "534534546";
|
||||||
// $doctor_pharmacist_cert = DoctorPharmacistCert::addDoctorPharmacistCert($data);
|
// $doctor_pharmacist_cert = UserCaCert::addDoctorPharmacistCert($data);
|
||||||
// if (empty($doctor_pharmacist_cert)){
|
// if (empty($doctor_pharmacist_cert)){
|
||||||
// return fail();
|
// return fail();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// 测试企业
|
// 测试企业
|
||||||
$data = array();
|
// $data = array();
|
||||||
$data['user_id'] = "534534546";
|
// $data['user_id'] = "5345345461";
|
||||||
$data['card_num'] = "410323199603261240";
|
// $data['card_num'] = "91510106MABTJY4K9R";
|
||||||
$result = $ca->getCloudCert($data);
|
// $result = $ca->getCloudCert($data,"Organizational");
|
||||||
|
//
|
||||||
$data = array();
|
// $data = array();
|
||||||
$data['user_id'] = "534534546";
|
// $data['is_system'] = 1;
|
||||||
$data['cert_base64'] = $result['certBase64'];
|
// $data['cert_base64'] = $result['certBase64'];
|
||||||
$data['cert_chain_p7'] = $result['certP7'];
|
// $data['cert_chain_p7'] = $result['certP7'];
|
||||||
$data['cert_serial_number'] = $result['certSerialnumber'];
|
// $data['cert_serial_number'] = $result['certSerialnumber'];
|
||||||
$data['ca_pin'] = "534534546";
|
// $data['ca_pin'] = "5345345461";
|
||||||
$doctor_pharmacist_cert = DoctorPharmacistCert::addDoctorPharmacistCert($data);
|
// $doctor_pharmacist_cert = UserCaCert::addDoctorPharmacistCert($data);
|
||||||
if (empty($doctor_pharmacist_cert)){
|
// if (empty($doctor_pharmacist_cert)){
|
||||||
return fail();
|
// return fail();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取用户云证书数据-验证PKCS7签名
|
// 获取用户云证书数据-验证PKCS7签名
|
||||||
@ -103,7 +104,7 @@ class TestController extends AbstractController
|
|||||||
|
|
||||||
$params = array();
|
$params = array();
|
||||||
$params['user_id'] = "491925054435950592";
|
$params['user_id'] = "491925054435950592";
|
||||||
$doctor_pharmacist_cert = DoctorPharmacistCert::getOne($params);
|
$doctor_pharmacist_cert = UserCaCert::getOne($params);
|
||||||
if (empty($doctor_pharmacist_cert)){
|
if (empty($doctor_pharmacist_cert)){
|
||||||
return fail(HttpEnumCode::HTTP_ERROR,"用户数据错误");
|
return fail(HttpEnumCode::HTTP_ERROR,"用户数据错误");
|
||||||
}
|
}
|
||||||
@ -394,7 +395,7 @@ class TestController extends AbstractController
|
|||||||
|
|
||||||
// pdf进行签章
|
// pdf进行签章
|
||||||
public function test_6(){
|
public function test_6(){
|
||||||
$pdf_file = fopen("./runtime/prescription_img.pdf",'r');
|
$pdf_file = fopen("./runtime/prescription.pdf",'r');
|
||||||
|
|
||||||
$oss = new Oss();
|
$oss = new Oss();
|
||||||
|
|
||||||
@ -578,4 +579,68 @@ class TestController extends AbstractController
|
|||||||
dump($prescription_pdf);
|
dump($prescription_pdf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// pdf进行签章
|
||||||
|
public function test_12(){
|
||||||
|
$ca = new Ca();
|
||||||
|
|
||||||
|
$pdf_file = fopen("./runtime/prescription.pdf",'r');
|
||||||
|
|
||||||
|
$oss = new Oss();
|
||||||
|
|
||||||
|
$filename = "basic/file/hospital_signature.png";
|
||||||
|
|
||||||
|
$style = "image/resize,w_300,h_300";
|
||||||
|
|
||||||
|
$sign_image = $oss->getCusTomObjectToRAM($filename,$style);
|
||||||
|
$sign_image = base64_encode($sign_image);
|
||||||
|
if (!$sign_image){
|
||||||
|
return fail(HttpEnumCode::SERVER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sign_param = [
|
||||||
|
[ // 医院签章
|
||||||
|
"llx"=>"1550", // 左边底部X坐标
|
||||||
|
"lly"=>"1350", // 左边底部Y坐标
|
||||||
|
"urx"=>"2250", // 右边上部x坐标
|
||||||
|
"ury"=>"650", // 右边上部y坐标
|
||||||
|
"pageList"=>[1],
|
||||||
|
"sealImg"=>$sign_image
|
||||||
|
],
|
||||||
|
// [ // 药师端
|
||||||
|
// "llx"=>"350", // 左边底部X坐标
|
||||||
|
// "lly"=>"190", // 左边底部Y坐标
|
||||||
|
// "urx"=>"440", // 右边上部x坐标
|
||||||
|
// "ury"=>"140", // 右边上部y坐标
|
||||||
|
// "pageList"=>[1],
|
||||||
|
// "sealImg"=>$sign_image
|
||||||
|
// ]
|
||||||
|
];
|
||||||
|
$data = array();
|
||||||
|
$data['sign_param'] = json_encode($sign_param);
|
||||||
|
$data['pdf_file'] = $pdf_file;
|
||||||
|
|
||||||
|
|
||||||
|
$result = $ca->addSignPdf("5345345461",$data);
|
||||||
|
|
||||||
|
$file_id = $result[0]['fileId'];
|
||||||
|
|
||||||
|
$result = $ca->getSignedFile("5345345461",$file_id);
|
||||||
|
if (empty($result)){
|
||||||
|
return fail();
|
||||||
|
}
|
||||||
|
|
||||||
|
$file = fopen("./runtime/test.pdf", "w") or die("Unable to open file!");
|
||||||
|
fwrite($file, $result);
|
||||||
|
fclose($file);
|
||||||
|
|
||||||
|
// 上传阿里云oss
|
||||||
|
|
||||||
|
// $oss = new Oss();
|
||||||
|
//
|
||||||
|
// $filename = "applet/doctor/prescription/test.pdf";
|
||||||
|
//
|
||||||
|
// $result = $oss->putObject($filename, $result);
|
||||||
|
// dump($result);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -6,7 +6,7 @@ use App\Amqp\Producer\PrescriptionDistributePhProducer;
|
|||||||
use App\Constants\HttpEnumCode;
|
use App\Constants\HttpEnumCode;
|
||||||
use App\Exception\BusinessException;
|
use App\Exception\BusinessException;
|
||||||
use App\Model\DoctorInquiryTime;
|
use App\Model\DoctorInquiryTime;
|
||||||
use App\Model\DoctorPharmacistCert;
|
use App\Model\UserCaCert;
|
||||||
use App\Model\OrderInquiry;
|
use App\Model\OrderInquiry;
|
||||||
use App\Model\UserDoctor;
|
use App\Model\UserDoctor;
|
||||||
use App\Request\UserRequest;
|
use App\Request\UserRequest;
|
||||||
|
|||||||
@ -11,7 +11,8 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @property int $cert_id 主键id
|
* @property int $cert_id 主键id
|
||||||
* @property int $user_id 用户id
|
* @property int $user_id 用户id(系统证书时为null)
|
||||||
|
* @property int $is_system 是否系统证书(0:否 1:是)
|
||||||
* @property string $cert_base64 签名值证书
|
* @property string $cert_base64 签名值证书
|
||||||
* @property string $cert_chain_p7 证书链
|
* @property string $cert_chain_p7 证书链
|
||||||
* @property string $cert_serial_number 证书序列号
|
* @property string $cert_serial_number 证书序列号
|
||||||
@ -19,19 +20,19 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
|||||||
* @property \Carbon\Carbon $created_at 创建时间
|
* @property \Carbon\Carbon $created_at 创建时间
|
||||||
* @property \Carbon\Carbon $updated_at 修改时间
|
* @property \Carbon\Carbon $updated_at 修改时间
|
||||||
*/
|
*/
|
||||||
class DoctorPharmacistCert extends Model
|
class UserCaCert extends Model
|
||||||
{
|
{
|
||||||
use Snowflake;
|
use Snowflake;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table associated with the model.
|
* The table associated with the model.
|
||||||
*/
|
*/
|
||||||
protected ?string $table = 'doctor_pharmacist_cert';
|
protected ?string $table = 'user_ca_cert';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that are mass assignable.
|
* The attributes that are mass assignable.
|
||||||
*/
|
*/
|
||||||
protected array $fillable = ['cert_id', 'user_id', 'cert_base64', 'cert_chain_p7', 'cert_serial_number', 'ca_pin', 'created_at', 'updated_at'];
|
protected array $fillable = ['cert_id', 'user_id', 'is_system', 'cert_base64', 'cert_chain_p7', 'cert_serial_number', 'ca_pin', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
protected string $primaryKey = "cert_id";
|
protected string $primaryKey = "cert_id";
|
||||||
|
|
||||||
@ -70,9 +71,9 @@ class DoctorPharmacistCert extends Model
|
|||||||
/**
|
/**
|
||||||
* 新增
|
* 新增
|
||||||
* @param array $data
|
* @param array $data
|
||||||
* @return \Hyperf\Database\Model\Model|DoctorPharmacistCert
|
* @return \Hyperf\Database\Model\Model|UserCaCert
|
||||||
*/
|
*/
|
||||||
public static function addDoctorPharmacistCert(array $data = []): \Hyperf\Database\Model\Model|DoctorPharmacistCert
|
public static function addDoctorPharmacistCert(array $data = []): \Hyperf\Database\Model\Model|UserCaCert
|
||||||
{
|
{
|
||||||
return self::create($data);
|
return self::create($data);
|
||||||
}
|
}
|
||||||
@ -4,7 +4,7 @@ namespace App\Services;
|
|||||||
|
|
||||||
use App\Constants\HttpEnumCode;
|
use App\Constants\HttpEnumCode;
|
||||||
use App\Exception\BusinessException;
|
use App\Exception\BusinessException;
|
||||||
use App\Model\DoctorPharmacistCert;
|
use App\Model\UserCaCert;
|
||||||
use App\Model\HospitalDepartmentCustom;
|
use App\Model\HospitalDepartmentCustom;
|
||||||
use App\Model\OrderInquiryCase;
|
use App\Model\OrderInquiryCase;
|
||||||
use App\Model\OrderPrescription;
|
use App\Model\OrderPrescription;
|
||||||
@ -108,8 +108,11 @@ class OrderPrescriptionService extends BaseService
|
|||||||
return OrderPrescription::getCount($params);
|
return OrderPrescription::getCount($params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 开具处方
|
* 开具处方
|
||||||
|
* 医生-正常开具
|
||||||
|
* 药师-先开具药师处方,再开具医院签章
|
||||||
* @param string $order_prescription_id
|
* @param string $order_prescription_id
|
||||||
* @param string $user_id
|
* @param string $user_id
|
||||||
* @return array
|
* @return array
|
||||||
@ -125,31 +128,40 @@ class OrderPrescriptionService extends BaseService
|
|||||||
throw new BusinessException("用户数据错误");
|
throw new BusinessException("用户数据错误");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取用户info数据
|
if ($user['user_type'] != 2 && $user['user_type'] != 3){
|
||||||
$params = array();
|
|
||||||
$params['user_id'] = $user['user_id'];
|
|
||||||
|
|
||||||
$sign_image_path = "";
|
|
||||||
if ($user['user_type'] == 2){
|
|
||||||
$user_doctor_info = UserDoctorInfo::getOne($params);
|
|
||||||
if (!empty($user_doctor_info)){
|
|
||||||
$sign_image_path = $user_doctor_info['sign_image'];
|
|
||||||
}
|
|
||||||
}elseif ($user['user_type'] == 3){
|
|
||||||
$user_pharmacist_info = UserPharmacistInfo::getOne($params);
|
|
||||||
if (!empty($user_pharmacist_info)){
|
|
||||||
$sign_image_path = $user_pharmacist_info['sign_image'];
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
throw new BusinessException("用户类型错误");
|
throw new BusinessException("用户类型错误");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($sign_image_path)){
|
// 获取用户info数据
|
||||||
throw new BusinessException("无签名图片");
|
$params = array();
|
||||||
|
$params['user_id'] = $user['user_id'];
|
||||||
|
if ($user['user_type'] == 2){
|
||||||
|
$user_doctor_info = UserDoctorInfo::getOne($params);
|
||||||
|
if (empty($user_doctor_info)){
|
||||||
|
throw new BusinessException("用户数据错误");
|
||||||
|
}
|
||||||
|
|
||||||
|
$user_sign_image_path = $user_doctor_info['sign_image'];
|
||||||
|
$user_entity_id = "491925054435950592";
|
||||||
|
} else{
|
||||||
|
$user_pharmacist_info = UserPharmacistInfo::getOne($params);
|
||||||
|
if (!empty($user_pharmacist_info)){
|
||||||
|
throw new BusinessException("用户数据错误");
|
||||||
|
}
|
||||||
|
|
||||||
|
$user_sign_image_path = $user_pharmacist_info['sign_image'];
|
||||||
|
$user_entity_id = $user['user_id'];
|
||||||
|
|
||||||
|
$hospital_sign_image_path = "basic/file/hospital_signature.png";
|
||||||
|
$hospital_entity_id = "5345345461";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($user_sign_image_path) || empty($user_entity_id)){
|
||||||
|
throw new BusinessException("无签名图片/用户唯一标识");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 去除第一个/ oss不识别
|
// 去除第一个/ oss不识别
|
||||||
$sign_image_path = substr($sign_image_path, 1, strlen($sign_image_path) - 1);
|
$sign_image_path = substr($user_sign_image_path, 1, strlen($user_sign_image_path) - 1);
|
||||||
|
|
||||||
// 获取处方数据
|
// 获取处方数据
|
||||||
$params = array();
|
$params = array();
|
||||||
@ -163,9 +175,9 @@ class OrderPrescriptionService extends BaseService
|
|||||||
throw new BusinessException("医生开方日期错误");
|
throw new BusinessException("医生开方日期错误");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 药师端检测处方图片
|
// 检测处方图片
|
||||||
if ($user['user_type'] == 3 && empty($order_prescription['prescription_img'])){
|
if ($user['user_type'] == 3 && empty($order_prescription['prescription_img'])){
|
||||||
throw new BusinessException("医生开方日期错误");
|
throw new BusinessException("处方图片错误");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取处方关联疾病数据
|
// 获取处方关联疾病数据
|
||||||
@ -240,28 +252,30 @@ class OrderPrescriptionService extends BaseService
|
|||||||
$product['prescription_product_num'] = $item['prescription_product_num'] . $item['packaging_unit']; // 商品数量 + 基本包装单位(例:盒/瓶)
|
$product['prescription_product_num'] = $item['prescription_product_num'] . $item['packaging_unit']; // 商品数量 + 基本包装单位(例:盒/瓶)
|
||||||
$data['product'][] = $product;
|
$data['product'][] = $product;
|
||||||
}
|
}
|
||||||
dump("签名获取成功");
|
|
||||||
|
|
||||||
if ($user['user_type'] == 3){
|
|
||||||
$cert_sign_result = $ca->getCertSign($user['user_id'], $user['user_id'], $data);
|
|
||||||
}else{
|
|
||||||
$cert_sign_result = $ca->getCertSign("491925054435950592", "491925054435950592", $data);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
$cert_sign_result = $ca->getCertSign($user_entity_id, $user_entity_id, $data);
|
||||||
|
|
||||||
// 验证云证书签名-验证无需处理,只要不返回错误即可
|
// 验证云证书签名-验证无需处理,只要不返回错误即可
|
||||||
$ca->verifyPkcs7($cert_sign_result['signP7'],$data);
|
$ca->verifyPkcs7($cert_sign_result['signP7'],$data);
|
||||||
dump("签名验证成功");
|
|
||||||
|
dump("云证书签名验证成功");
|
||||||
|
|
||||||
|
if ($user['user_type'] == 3){
|
||||||
|
$cert_sign_result = $ca->getCertSign($hospital_entity_id, $hospital_entity_id, $data);
|
||||||
|
|
||||||
|
// 验证云证书签名-验证无需处理,只要不返回错误即可
|
||||||
|
$ca->verifyPkcs7($cert_sign_result['signP7'],$data);
|
||||||
|
dump("医院云证书签名获取成功");
|
||||||
|
}
|
||||||
|
|
||||||
$oss = new Oss();
|
$oss = new Oss();
|
||||||
|
|
||||||
// 医生
|
// 医生
|
||||||
if ($user['user_type'] == 2){
|
if ($user['user_type'] == 2){
|
||||||
// 下载基础处方pdf图片
|
// 下载基础处方图片
|
||||||
$prescription_basic_filename = "basic/file/prescription.jpg";
|
$prescription_basic_filename = "basic/file/prescription.jpg";
|
||||||
$prescription_image = $oss->getObjectToRAM($prescription_basic_filename);
|
$prescription_image = $oss->getObjectToRAM($prescription_basic_filename);
|
||||||
|
|
||||||
dump("下载基础处方pdf图片成功");
|
dump("下载基础处方图片成功");
|
||||||
|
|
||||||
$manager = new ImageManager();
|
$manager = new ImageManager();
|
||||||
|
|
||||||
@ -398,9 +412,8 @@ class OrderPrescriptionService extends BaseService
|
|||||||
|
|
||||||
$local = "./runtime/" . $order_prescription['order_prescription_id'] . '.' . 'pdf';
|
$local = "./runtime/" . $order_prescription['order_prescription_id'] . '.' . 'pdf';
|
||||||
|
|
||||||
$prescription_pdf_local = $oss->getObjectToLocal($prescription_pdf_path,$local);
|
$oss->getObjectToLocal($prescription_pdf_path,$local);
|
||||||
dump("下载医生开具的处方pdf成功");
|
dump("下载医生开具的处方pdf成功");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 下载签名图片
|
// 下载签名图片
|
||||||
@ -444,12 +457,7 @@ class OrderPrescriptionService extends BaseService
|
|||||||
$data = array();
|
$data = array();
|
||||||
$data['sign_param'] = json_encode($sign_param);
|
$data['sign_param'] = json_encode($sign_param);
|
||||||
$data['pdf_file'] = $pdf_file;
|
$data['pdf_file'] = $pdf_file;
|
||||||
if ($user['user_type'] == 2){
|
$sign_pdf_result = $ca->addSignPdf($user_entity_id,$data);
|
||||||
$sign_pdf_result = $ca->addSignPdf("491925054435950592",$data);
|
|
||||||
}else{
|
|
||||||
$sign_pdf_result = $ca->addSignPdf($user['user_id'],$data);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($sign_pdf_result[0]['fileId'])){
|
if (empty($sign_pdf_result[0]['fileId'])){
|
||||||
throw new BusinessException("处方签章失败");
|
throw new BusinessException("处方签章失败");
|
||||||
}
|
}
|
||||||
@ -458,11 +466,7 @@ class OrderPrescriptionService extends BaseService
|
|||||||
|
|
||||||
// 下载处方签章文件
|
// 下载处方签章文件
|
||||||
$file_id = $sign_pdf_result[0]['fileId'];
|
$file_id = $sign_pdf_result[0]['fileId'];
|
||||||
if ($user['user_type'] == 2){
|
$prescription_pdf_result = $ca->getSignedFile($user_entity_id,$file_id);
|
||||||
$prescription_pdf_result = $ca->getSignedFile("491925054435950592",$file_id);
|
|
||||||
}else{
|
|
||||||
$prescription_pdf_result = $ca->getSignedFile($user['user_id'],$file_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($prescription_pdf_result)){
|
if (empty($prescription_pdf_result)){
|
||||||
throw new BusinessException("下载处方签章文件失败");
|
throw new BusinessException("下载处方签章文件失败");
|
||||||
@ -474,6 +478,63 @@ class OrderPrescriptionService extends BaseService
|
|||||||
$filename = "applet/prescription/" . $order_prescription['order_prescription_id'] . '.' . 'pdf';
|
$filename = "applet/prescription/" . $order_prescription['order_prescription_id'] . '.' . 'pdf';
|
||||||
$prescription_pdf_url = $oss->putObject($filename, $prescription_pdf_result);
|
$prescription_pdf_url = $oss->putObject($filename, $prescription_pdf_result);
|
||||||
|
|
||||||
|
if ($user['user_type'] == 3){
|
||||||
|
// 药师端时,需要进行系统签章
|
||||||
|
// 把药师签章的pdf存储至本地文件
|
||||||
|
$file = fopen("./runtime/" . $order_prescription['order_prescription_id'] . '.' . 'pdf', "w");
|
||||||
|
fwrite($file, $prescription_pdf_result);
|
||||||
|
fclose($file);
|
||||||
|
|
||||||
|
// 下载医院签名图片
|
||||||
|
$style = "image/resize,w_300,h_300";
|
||||||
|
$sign_image = $oss->getCusTomObjectToRAM($hospital_sign_image_path,$style);
|
||||||
|
$sign_image = base64_encode($sign_image);
|
||||||
|
if (!$sign_image){
|
||||||
|
throw new BusinessException("医院签名图片下载失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
$sign_param = [
|
||||||
|
[ // 医院签章
|
||||||
|
"llx"=>"1550", // 左边底部X坐标
|
||||||
|
"lly"=>"1350", // 左边底部Y坐标
|
||||||
|
"urx"=>"2250", // 右边上部x坐标
|
||||||
|
"ury"=>"650", // 右边上部y坐标
|
||||||
|
"pageList"=>[1],
|
||||||
|
"sealImg"=>$sign_image
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// 打开处方pdf文件
|
||||||
|
unset($pdf_file);
|
||||||
|
$pdf_file = fopen("./runtime/" . $order_prescription['order_prescription_id'] . ".pdf",'r');
|
||||||
|
|
||||||
|
// 处方pdf进行签章
|
||||||
|
$data = array();
|
||||||
|
$data['sign_param'] = json_encode($sign_param);
|
||||||
|
$data['pdf_file'] = $pdf_file;
|
||||||
|
$hospital_sign_pdf_result = $ca->addSignPdf($hospital_entity_id,$data);
|
||||||
|
if (empty($hospital_sign_pdf_result[0]['fileId'])){
|
||||||
|
throw new BusinessException("处方签章失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
dump("处方pdf进行签章成功");
|
||||||
|
|
||||||
|
// 下载处方签章文件
|
||||||
|
unset($prescription_pdf_result);
|
||||||
|
$file_id = $hospital_sign_pdf_result[0]['fileId'];
|
||||||
|
$prescription_pdf_result = $ca->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);
|
||||||
|
}
|
||||||
|
|
||||||
$result = array();
|
$result = array();
|
||||||
$result['prescription_img_url'] = $prescription_img_url ?? $order_prescription['prescription_img'];
|
$result['prescription_img_url'] = $prescription_img_url ?? $order_prescription['prescription_img'];
|
||||||
$result['prescription_pdf_url'] = '/' . $prescription_pdf_url ?: "";
|
$result['prescription_pdf_url'] = '/' . $prescription_pdf_url ?: "";
|
||||||
|
|||||||
@ -888,7 +888,7 @@ class UserDoctorService extends BaseService
|
|||||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||||
|
|
||||||
$order_inquiry_id = $this->request->input('order_inquiry_id');
|
$order_inquiry_id = $this->request->input('order_inquiry_id');
|
||||||
$order_prescription_id = $this->request->input('order_prescription_id');
|
$order_prescription_id = $this->request->route('order_prescription_id');
|
||||||
|
|
||||||
// 获取医生信息
|
// 获取医生信息
|
||||||
$params = array();
|
$params = array();
|
||||||
@ -1158,8 +1158,8 @@ class UserDoctorService extends BaseService
|
|||||||
$message_content_data['message_type'] = 6;
|
$message_content_data['message_type'] = 6;
|
||||||
$message_content_data['title'] = "处方已开具";
|
$message_content_data['title'] = "处方已开具";
|
||||||
$message_content_data['desc'] = "";
|
$message_content_data['desc'] = "";
|
||||||
$message_content_data['data']['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];
|
$message_content_data['data']['order_inquiry_id'] = (string)$order_inquiry['order_inquiry_id'];
|
||||||
$message_content_data['data']['order_prescription_id'] = $order_prescription['order_prescription_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']['product_name'] = $product_name ?? "药品";
|
||||||
$message_content_data['data']['pharmacist_verify_time'] = date('Y-m-d H:i:s',time());;
|
$message_content_data['data']['pharmacist_verify_time'] = date('Y-m-d H:i:s',time());;
|
||||||
$message_content = [
|
$message_content = [
|
||||||
@ -1236,9 +1236,17 @@ class UserDoctorService extends BaseService
|
|||||||
$params['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];
|
$params['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];
|
||||||
$params['doctor_id'] = $user_info['client_user_id'];
|
$params['doctor_id'] = $user_info['client_user_id'];
|
||||||
$params['pharmacist_audit_status'] = 1;
|
$params['pharmacist_audit_status'] = 1;
|
||||||
$order_prescription = OrderPrescription::getOne($params);
|
$order_prescription = OrderPrescription::getList($params);
|
||||||
if (!empty($order_prescription)) {
|
if (!empty($order_prescription)) {
|
||||||
return fail(HttpEnumCode::HTTP_ERROR, "订单已开具处方,无法重复开具");
|
foreach ($order_prescription as $item){
|
||||||
|
if ($item['pharmacist_audit_status'] == 1){
|
||||||
|
return fail(HttpEnumCode::HTTP_ERROR, "处方正在审核中,请耐心等待");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($item['pharmacist_audit_status'] == 2){
|
||||||
|
return fail(HttpEnumCode::HTTP_ERROR, "您已开具处方,请勿重复开具");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Db::beginTransaction();
|
Db::beginTransaction();
|
||||||
@ -1380,8 +1388,8 @@ class UserDoctorService extends BaseService
|
|||||||
$message_content_data['message_type'] = 6;
|
$message_content_data['message_type'] = 6;
|
||||||
$message_content_data['title'] = "处方已开具";
|
$message_content_data['title'] = "处方已开具";
|
||||||
$message_content_data['desc'] = "";
|
$message_content_data['desc'] = "";
|
||||||
$message_content_data['data']['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];
|
$message_content_data['data']['order_inquiry_id'] = (string)$order_inquiry['order_inquiry_id'];
|
||||||
$message_content_data['data']['order_prescription_id'] = $order_prescription['order_prescription_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']['product_name'] = $product_name ?? "药品";
|
||||||
$message_content_data['data']['pharmacist_verify_time'] = date('Y-m-d H:i:s',time());;
|
$message_content_data['data']['pharmacist_verify_time'] = date('Y-m-d H:i:s',time());;
|
||||||
$message_content = [
|
$message_content = [
|
||||||
|
|||||||
@ -236,8 +236,8 @@ class UserPharmacistService extends BaseService
|
|||||||
$message_content_data['message_type'] = 7;
|
$message_content_data['message_type'] = 7;
|
||||||
$message_content_data['title'] = "处方已开具";
|
$message_content_data['title'] = "处方已开具";
|
||||||
$message_content_data['desc'] = "";
|
$message_content_data['desc'] = "";
|
||||||
$message_content_data['data']['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];
|
$message_content_data['data']['order_inquiry_id'] = (string)$order_inquiry['order_inquiry_id'];
|
||||||
$message_content_data['data']['order_prescription_id'] = $order_prescription['order_prescription_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']['product_name'] = $product_name ?? "药品";
|
||||||
$message_content_data['data']['pharmacist_verify_time'] = date('Y-m-d H:i:s',time());;
|
$message_content_data['data']['pharmacist_verify_time'] = date('Y-m-d H:i:s',time());;
|
||||||
$message_content = [
|
$message_content = [
|
||||||
|
|||||||
@ -559,6 +559,4 @@ class UserService extends BaseService
|
|||||||
|
|
||||||
return $open_id;
|
return $open_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -83,7 +83,7 @@ return [
|
|||||||
'ca' => [ // ca
|
'ca' => [ // ca
|
||||||
"app_id" => env('CA_APP_ID', 'SCCA1560150113940832258'),
|
"app_id" => env('CA_APP_ID', 'SCCA1560150113940832258'),
|
||||||
"secret" => env('CA_APP_SECRET', 'facded39929f4aef9893cb766cd52e25'),
|
"secret" => env('CA_APP_SECRET', 'facded39929f4aef9893cb766cd52e25'),
|
||||||
"api_url" => env('CA_APP_URL', 'http://testmicrosrv.scca.com.cn:9527'),
|
"api_url" => env('CA_API_URL', 'http://testmicrosrv.scca.com.cn:9527'),
|
||||||
],
|
],
|
||||||
'prescription_platform' => [ // 处方平台
|
'prescription_platform' => [ // 处方平台
|
||||||
"client_id" => env('PRE_PLAT_CLIENT_ID', 'ZD-004'),
|
"client_id" => env('PRE_PLAT_CLIENT_ID', 'ZD-004'),
|
||||||
|
|||||||
@ -33,14 +33,15 @@ class Ca
|
|||||||
/**
|
/**
|
||||||
* 获取云证书
|
* 获取云证书
|
||||||
* @param array $data
|
* @param array $data
|
||||||
|
* @param string $type
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function getCloudCert(array $data): mixed
|
public function getCloudCert(array $data,string $type = "Personal"): mixed
|
||||||
{
|
{
|
||||||
$option = [
|
$option = [
|
||||||
'form_params' => [
|
'form_params' => [
|
||||||
'entityId' => $data['user_id'], // 用户唯一标识,由业务系统定义
|
'entityId' => $data['user_id'], // 用户唯一标识,由业务系统定义
|
||||||
'entityType' => "Personal",// 用户类型,可选值[Personal/Organizational]
|
'entityType' => $type,// 用户类型,可选值[Personal/Organizational]
|
||||||
'pin' => $data['user_id'], // 证书PIN码
|
'pin' => $data['user_id'], // 证书PIN码
|
||||||
'cardNumber' => $data['card_num'], // 证件号码(个人身份证;企业统一社会信用代码)
|
'cardNumber' => $data['card_num'], // 证件号码(个人身份证;企业统一社会信用代码)
|
||||||
]
|
]
|
||||||
@ -263,11 +264,11 @@ class Ca
|
|||||||
* @param string $file_id
|
* @param string $file_id
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function getSignedFile(string $user_id, string $file_id): mixed
|
public function getSignedFile(string $entity_id, string $file_id): mixed
|
||||||
{
|
{
|
||||||
$arg = [
|
$arg = [
|
||||||
'form_params' => [
|
'form_params' => [
|
||||||
'userId' => $user_id,// 用户标识信息(为云证书entityId)
|
'userId' => $entity_id,// 用户标识信息(为云证书entityId)
|
||||||
'fileId' => $file_id,// 签章接口返回的文件标识
|
'fileId' => $file_id,// 签章接口返回的文件标识
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|||||||
@ -56,6 +56,7 @@ AMQP_VHOST=gdxz_2022rabbitmq
|
|||||||
# [CA]
|
# [CA]
|
||||||
CA_APP_ID=SCCA1560150113940832258
|
CA_APP_ID=SCCA1560150113940832258
|
||||||
CA_APP_SECRET=facded39929f4aef9893cb766cd52e25
|
CA_APP_SECRET=facded39929f4aef9893cb766cd52e25
|
||||||
|
CA_API_URL=http://testmicrosrv.scca.com.cn:9527
|
||||||
|
|
||||||
# [处方平台]
|
# [处方平台]
|
||||||
PRE_PLAT_CLIENT_ID=ZD-004
|
PRE_PLAT_CLIENT_ID=ZD-004
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user