家庭成员健康情况增加是否正在服药
This commit is contained in:
parent
b428db8e99
commit
25cdfbc20a
@ -44,7 +44,7 @@ class TestController extends AbstractController
|
|||||||
// 获取云证书-首次
|
// 获取云证书-首次
|
||||||
public function test_1(){
|
public function test_1(){
|
||||||
$ca = new Ca();
|
$ca = new Ca();
|
||||||
|
// // 测试医生
|
||||||
// $data = array();
|
// $data = array();
|
||||||
// $data['user_id'] = "491925054435950592";
|
// $data['user_id'] = "491925054435950592";
|
||||||
// $data['card_num'] = "410323199603261241";
|
// $data['card_num'] = "410323199603261241";
|
||||||
@ -61,9 +61,10 @@ class TestController extends AbstractController
|
|||||||
// return fail();
|
// return fail();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
// 测试药师
|
||||||
$data = array();
|
$data = array();
|
||||||
$data['user_id'] = "534534546";
|
$data['user_id'] = "534534546";
|
||||||
$data['card_num'] = "410323199603261236";
|
$data['card_num'] = "410323199603261240";
|
||||||
$result = $ca->getCloudCert($data);
|
$result = $ca->getCloudCert($data);
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
|
|||||||
@ -163,6 +163,11 @@ class OrderPrescriptionService extends BaseService
|
|||||||
throw new BusinessException("医生开方日期错误");
|
throw new BusinessException("医生开方日期错误");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 药师端检测处方图片
|
||||||
|
if ($user['user_type'] == 3 && empty($order_prescription['prescription_img'])){
|
||||||
|
throw new BusinessException("医生开方日期错误");
|
||||||
|
}
|
||||||
|
|
||||||
// 获取处方关联疾病数据
|
// 获取处方关联疾病数据
|
||||||
$params = array();
|
$params = array();
|
||||||
$params['order_prescription_id'] = $order_prescription_id;
|
$params['order_prescription_id'] = $order_prescription_id;
|
||||||
@ -236,131 +241,157 @@ class OrderPrescriptionService extends BaseService
|
|||||||
$data['product'][] = $product;
|
$data['product'][] = $product;
|
||||||
}
|
}
|
||||||
dump("签名获取成功");
|
dump("签名获取成功");
|
||||||
$cert_sign_result = $ca->getCertSign("491925054435950592", "491925054435950592", $data);
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 验证云证书签名-验证无需处理,只要不返回错误即可
|
// 验证云证书签名-验证无需处理,只要不返回错误即可
|
||||||
$ca->verifyPkcs7($cert_sign_result['signP7'],$data);
|
$ca->verifyPkcs7($cert_sign_result['signP7'],$data);
|
||||||
dump("签名验证成功");
|
dump("签名验证成功");
|
||||||
// 下载基础处方pdf图片
|
|
||||||
$oss = new Oss();
|
$oss = new Oss();
|
||||||
|
|
||||||
$filename = "basic/file/prescription.jpg";
|
// 医生
|
||||||
$prescription_image = $oss->getObjectToRAM($filename);
|
if ($user['user_type'] == 2){
|
||||||
|
// 下载基础处方pdf图片
|
||||||
|
$filename = "basic/file/prescription.jpg";
|
||||||
|
$prescription_image = $oss->getObjectToRAM($filename);
|
||||||
|
|
||||||
dump("下载基础处方pdf图片成功");
|
dump("下载基础处方pdf图片成功");
|
||||||
|
|
||||||
$manager = new ImageManager();
|
$manager = new ImageManager();
|
||||||
|
|
||||||
$image = $manager->make($prescription_image);
|
$image = $manager->make($prescription_image);
|
||||||
|
|
||||||
// $fontPath = './extend/Ca/ZiYuYongSongTi-2.ttf';
|
// $fontPath = './extend/Ca/ZiYuYongSongTi-2.ttf';
|
||||||
$fontPath = './extend/Ca/msyh.ttf';
|
$fontPath = './extend/Ca/msyh.ttf';
|
||||||
|
|
||||||
// 处方号
|
// 处方号
|
||||||
$image->text($order_prescription['prescription_code'], 1480, 540, function ($font) use($fontPath) {
|
$image->text($order_prescription['prescription_code'], 1480, 540, function ($font) use($fontPath) {
|
||||||
$font->file($fontPath);
|
|
||||||
$font->size(60);
|
|
||||||
$font->align('left');
|
|
||||||
});
|
|
||||||
|
|
||||||
// 日期
|
|
||||||
$image->text(date('Y-m-d',strtotime($order_prescription['doctor_created_time'])), 354, 675, function ($font) use($fontPath) {
|
|
||||||
$font->file($fontPath);
|
|
||||||
$font->size(60);
|
|
||||||
$font->align('left');
|
|
||||||
});
|
|
||||||
|
|
||||||
// 科室
|
|
||||||
$image->text($hospital_department_custom['department_name'] ?: "", 1385, 675, function ($font) use($fontPath) {
|
|
||||||
$font->file($fontPath);
|
|
||||||
$font->size(60);
|
|
||||||
$font->align('left');
|
|
||||||
});
|
|
||||||
|
|
||||||
// 姓名
|
|
||||||
$image->text($order_prescription['patient_name'], 354, 795, function ($font) use($fontPath) {
|
|
||||||
$font->file($fontPath);
|
|
||||||
$font->size(60);
|
|
||||||
$font->align('left');
|
|
||||||
});
|
|
||||||
|
|
||||||
// 性别
|
|
||||||
$image->text(sexToStringSex($order_prescription['patient_sex']), 1385, 790, function ($font) use($fontPath) {
|
|
||||||
$font->file($fontPath);
|
|
||||||
$font->size(60);
|
|
||||||
$font->align('left');
|
|
||||||
});
|
|
||||||
|
|
||||||
// 年龄
|
|
||||||
$image->text($order_prescription['patient_age'], 354, 900, function ($font) use($fontPath) {
|
|
||||||
$font->file($fontPath);
|
|
||||||
$font->size(60);
|
|
||||||
$font->align('left');
|
|
||||||
});
|
|
||||||
|
|
||||||
// 过敏史
|
|
||||||
$image->text($order_inquiry_case['allergy_history'] ?: "无", 405, 1030, function ($font) use($fontPath) {
|
|
||||||
$font->file($fontPath);
|
|
||||||
$font->size(60);
|
|
||||||
$font->align('left');
|
|
||||||
});
|
|
||||||
|
|
||||||
// 初步诊断
|
|
||||||
$image->text($icd_name, 445, 1145, function ($font) use($fontPath) {
|
|
||||||
$font->file($fontPath);
|
|
||||||
$font->size(60);
|
|
||||||
$font->align('left');
|
|
||||||
});
|
|
||||||
|
|
||||||
// 医生建议
|
|
||||||
$image->text($order_prescription['doctor_advice'] ?: "无", 445, 1252, function ($font) use($fontPath) {
|
|
||||||
$font->file($fontPath);
|
|
||||||
$font->size(60);
|
|
||||||
$font->align('left');
|
|
||||||
});
|
|
||||||
|
|
||||||
// 商品数据
|
|
||||||
foreach ($order_prescription_product as $key => $item){
|
|
||||||
$x_axis = 229;
|
|
||||||
$y_axis = 1600 + $key * 250;
|
|
||||||
$x_axis_num = 1900;// 数量使用
|
|
||||||
|
|
||||||
// 商品名称
|
|
||||||
$image->text($item['product_name'], $x_axis, $y_axis, function ($font) use($fontPath) {
|
|
||||||
$font->file($fontPath);
|
$font->file($fontPath);
|
||||||
$font->size(50);
|
$font->size(60);
|
||||||
$font->align('left');
|
$font->align('left');
|
||||||
});
|
});
|
||||||
|
|
||||||
$image->text("X" . $item['prescription_product_num'] . $item['packaging_unit'], $x_axis_num, $y_axis, function ($font) use($fontPath) {
|
// 日期
|
||||||
|
$image->text(date('Y-m-d',strtotime($order_prescription['doctor_created_time'])), 354, 675, function ($font) use($fontPath) {
|
||||||
$font->file($fontPath);
|
$font->file($fontPath);
|
||||||
$font->size(50);
|
$font->size(60);
|
||||||
$font->align('left');
|
$font->align('left');
|
||||||
});
|
});
|
||||||
|
|
||||||
// 用量
|
// 科室
|
||||||
$image->text("用量:" . $item['single_unit'] . " " . $item['frequency_use'], $x_axis, $y_axis+70, function ($font) use($fontPath) {
|
$image->text($hospital_department_custom['department_name'] ?: "", 1385, 675, function ($font) use($fontPath) {
|
||||||
$font->file($fontPath);
|
$font->file($fontPath);
|
||||||
$font->size(50);
|
$font->size(60);
|
||||||
$font->align('left');
|
$font->align('left');
|
||||||
});
|
});
|
||||||
|
|
||||||
// 用法
|
// 姓名
|
||||||
$image->text("用法:" . $item['single_use'], $x_axis, $y_axis+140, function ($font) use($fontPath) {
|
$image->text($order_prescription['patient_name'], 354, 795, function ($font) use($fontPath) {
|
||||||
$font->file($fontPath);
|
$font->file($fontPath);
|
||||||
$font->size(50);
|
$font->size(60);
|
||||||
$font->align('left');
|
$font->align('left');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 性别
|
||||||
|
$image->text(sexToStringSex($order_prescription['patient_sex']), 1385, 790, function ($font) use($fontPath) {
|
||||||
|
$font->file($fontPath);
|
||||||
|
$font->size(60);
|
||||||
|
$font->align('left');
|
||||||
|
});
|
||||||
|
|
||||||
|
// 年龄
|
||||||
|
$image->text($order_prescription['patient_age'], 354, 900, function ($font) use($fontPath) {
|
||||||
|
$font->file($fontPath);
|
||||||
|
$font->size(60);
|
||||||
|
$font->align('left');
|
||||||
|
});
|
||||||
|
|
||||||
|
// 过敏史
|
||||||
|
$image->text($order_inquiry_case['allergy_history'] ?: "无", 405, 1030, function ($font) use($fontPath) {
|
||||||
|
$font->file($fontPath);
|
||||||
|
$font->size(60);
|
||||||
|
$font->align('left');
|
||||||
|
});
|
||||||
|
|
||||||
|
// 初步诊断
|
||||||
|
$image->text($icd_name, 445, 1145, function ($font) use($fontPath) {
|
||||||
|
$font->file($fontPath);
|
||||||
|
$font->size(60);
|
||||||
|
$font->align('left');
|
||||||
|
});
|
||||||
|
|
||||||
|
// 医生建议
|
||||||
|
$image->text($order_prescription['doctor_advice'] ?: "无", 445, 1252, function ($font) use($fontPath) {
|
||||||
|
$font->file($fontPath);
|
||||||
|
$font->size(60);
|
||||||
|
$font->align('left');
|
||||||
|
});
|
||||||
|
|
||||||
|
// 商品数据
|
||||||
|
foreach ($order_prescription_product as $key => $item){
|
||||||
|
$x_axis = 229;
|
||||||
|
$y_axis = 1600 + $key * 250;
|
||||||
|
$x_axis_num = 1900;// 数量使用
|
||||||
|
|
||||||
|
// 商品名称
|
||||||
|
$image->text($item['product_name'], $x_axis, $y_axis, function ($font) use($fontPath) {
|
||||||
|
$font->file($fontPath);
|
||||||
|
$font->size(50);
|
||||||
|
$font->align('left');
|
||||||
|
});
|
||||||
|
|
||||||
|
$image->text("X" . $item['prescription_product_num'] . $item['packaging_unit'], $x_axis_num, $y_axis, function ($font) use($fontPath) {
|
||||||
|
$font->file($fontPath);
|
||||||
|
$font->size(50);
|
||||||
|
$font->align('left');
|
||||||
|
});
|
||||||
|
|
||||||
|
// 用量
|
||||||
|
$image->text("用量:" . $item['single_unit'] . " " . $item['frequency_use'], $x_axis, $y_axis+70, function ($font) use($fontPath) {
|
||||||
|
$font->file($fontPath);
|
||||||
|
$font->size(50);
|
||||||
|
$font->align('left');
|
||||||
|
});
|
||||||
|
|
||||||
|
// 用法
|
||||||
|
$image->text("用法:" . $item['single_use'], $x_axis, $y_axis+140, function ($font) use($fontPath) {
|
||||||
|
$font->file($fontPath);
|
||||||
|
$font->size(50);
|
||||||
|
$font->align('left');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 生成图片
|
||||||
|
$img_result = (string) $image->encode('png', 75);
|
||||||
|
dump("处方图片生成成功");
|
||||||
|
|
||||||
|
// 上传处方图片至oss
|
||||||
|
$filename = "applet/prescription/" . $order_prescription['order_prescription_id'] . '.' . 'jpg';
|
||||||
|
$prescription_img_url = $oss->putObject($filename, $img_result);
|
||||||
|
dump("处方图片上传oss成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 生成图片
|
// 药师
|
||||||
$img_result = (string) $image->encode('png', 75);
|
if ($user['user_type'] == 3){
|
||||||
dump("处方图片生成成功");
|
// 下载开具的处方图片
|
||||||
|
$filename = "basic/file/prescription.jpg";
|
||||||
|
$prescription_image = $oss->getObjectToRAM($filename);
|
||||||
|
|
||||||
|
dump("下载基础处方pdf图片成功");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 上传处方图片至oss
|
|
||||||
$filename = "applet/prescription/" . $order_prescription['order_prescription_id'] . '.' . 'jpg';
|
|
||||||
$prescription_img_url = $oss->putObject($filename, $img_result);
|
|
||||||
dump("处方图片上传oss成功");
|
|
||||||
|
|
||||||
// 图片生成pdf
|
// 图片生成pdf
|
||||||
$pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8', false);
|
$pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8', false);
|
||||||
|
|||||||
@ -779,9 +779,12 @@ class PatientFamilyService extends BaseService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($request_params['drugs_name'])){
|
if (isset($request_params['is_take_medicine'])){
|
||||||
if ($request_params['drugs_name'] != $patient_family_health['drugs_name']){
|
if ($request_params['is_take_medicine'] != $patient_family_health['is_take_medicine']){
|
||||||
$data['drugs_name'] = $request_params['drugs_name'];
|
$data['is_take_medicine'] = $request_params['is_take_medicine'];
|
||||||
|
if ($request_params['drugs_name'] != $patient_family_health['drugs_name']){
|
||||||
|
$data['drugs_name'] = $request_params['drugs_name'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -845,7 +848,10 @@ class PatientFamilyService extends BaseService
|
|||||||
|
|
||||||
$data['diagnosis_date'] = $request_params['diagnosis_date'];
|
$data['diagnosis_date'] = $request_params['diagnosis_date'];
|
||||||
$data['diagnosis_hospital'] = $request_params['diagnosis_hospital'];
|
$data['diagnosis_hospital'] = $request_params['diagnosis_hospital'];
|
||||||
$data['drugs_name'] = $request_params['drugs_name'];
|
if (isset($request_params['is_take_medicine'])){
|
||||||
|
$data['is_take_medicine'] = $request_params['is_take_medicine'];
|
||||||
|
$data['drugs_name'] = $request_params['drugs_name'];
|
||||||
|
}
|
||||||
$patient_family_health = PatientFamilyHealth::addPatientFamilyHealth($data);
|
$patient_family_health = PatientFamilyHealth::addPatientFamilyHealth($data);
|
||||||
if (empty($patient_family_health)){
|
if (empty($patient_family_health)){
|
||||||
return fail();
|
return fail();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user