修改获取家庭成员病情记录详情 新增 获取问诊订单病例详情
This commit is contained in:
parent
c69a2e2780
commit
9d7701f454
@ -4,6 +4,7 @@ namespace App\Controller;
|
||||
|
||||
use App\Request\PatientCaseRequest;
|
||||
use App\Services\InquiryService;
|
||||
use App\Services\PatientCaseService;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
@ -14,7 +15,23 @@ use Psr\Http\Message\ResponseInterface;
|
||||
class PatientCaseController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* 获取患者家庭成员问诊病例详情
|
||||
* 获取问诊订单病例详情-基础
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function getPatientFamilyInquiryCaseSimple(): ResponseInterface
|
||||
{
|
||||
$request = $this->container->get(PatientCaseRequest::class);
|
||||
$request->scene('getPatientFamilyInquiryCaseSimple')->validateResolved();
|
||||
|
||||
$PatientCaseService = new PatientCaseService();
|
||||
$data = $PatientCaseService->getPatientFamilyInquiryCaseSimple();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取问诊订单病例详情
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
@ -24,8 +41,8 @@ class PatientCaseController extends AbstractController
|
||||
$request = $this->container->get(PatientCaseRequest::class);
|
||||
$request->scene('getPatientFamilyInquiryCase')->validateResolved();
|
||||
|
||||
$InquiryService = new InquiryService();
|
||||
$data = $InquiryService->getPatientInquiryCase();
|
||||
$PatientCaseService = new PatientCaseService();
|
||||
$data = $PatientCaseService->getPatientFamilyInquiryCase();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
}
|
||||
@ -16,6 +16,8 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
||||
* @property int $family_id 家庭成员id
|
||||
* @property int $disease_class_id 疾病分类id-系统
|
||||
* @property int $nation_id 民族
|
||||
* @property int $job_id 职业id
|
||||
* @property int $relation 与患者关系(1:本人 2:父母 3:爱人 4:子女 5:亲戚 6:其他 )
|
||||
* @property int $status 状态(1:正常 2:删除)
|
||||
* @property string $name 患者名称
|
||||
* @property int $sex 患者性别(0:未知 1:男 2:女)
|
||||
@ -33,8 +35,8 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
||||
* @property int $is_pregnant 是否备孕、妊娠、哺乳期(0:否 1:是)
|
||||
* @property string $pregnant 备孕、妊娠、哺乳期描述
|
||||
* @property int $is_taboo 是否服用过禁忌药物,且无相关禁忌(0:否 1:是)问诊购药时存在
|
||||
* @property int $job_id 职业id
|
||||
* @property int $relation 与患者关系(1:本人 2:父母 3:爱人 4:子女 5:亲戚 6:其他 )
|
||||
* @property int $is_take_medicine 正在服药(0:否 1:是)
|
||||
* @property string $drugs_name 正在服药名称
|
||||
* @property string $nation_name 民族名称
|
||||
* @property string $job_name 职业名称
|
||||
* @property string $diagnosis_hospital 确诊医院
|
||||
@ -62,7 +64,7 @@ class OrderInquiryCase extends Model
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['inquiry_case_id', 'user_id', 'patient_id', 'order_inquiry_id', 'family_id', 'disease_class_id', 'nation_id', 'status', 'name', 'sex', 'age', 'height', 'weight', 'disease_class_name', 'diagnosis_date', 'disease_desc', 'diagnose_images', 'is_allergy_history', 'allergy_history', 'is_family_history', 'family_history', 'is_pregnant', 'pregnant', 'is_taboo', 'job_id', 'relation', 'nation_name', 'job_name', 'diagnosis_hospital', 'is_operation', 'operation', 'drink_wine_status', 'smoke_status', 'chemical_compound_status', 'chemical_compound_describe', 'created_at', 'updated_at'];
|
||||
protected array $fillable = ['inquiry_case_id', 'user_id', 'patient_id', 'order_inquiry_id', 'family_id', 'disease_class_id', 'nation_id', 'job_id', 'relation', 'status', 'name', 'sex', 'age', 'height', 'weight', 'disease_class_name', 'diagnosis_date', 'disease_desc', 'diagnose_images', 'is_allergy_history', 'allergy_history', 'is_family_history', 'family_history', 'is_pregnant', 'pregnant', 'is_taboo', 'is_take_medicine', 'drugs_name', 'nation_name', 'job_name', 'diagnosis_hospital', 'is_operation', 'operation', 'drink_wine_status', 'smoke_status', 'chemical_compound_status', 'chemical_compound_describe', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "inquiry_case_id";
|
||||
|
||||
|
||||
@ -11,7 +11,10 @@ use Hyperf\Validation\Rule;
|
||||
class PatientCaseRequest extends FormRequest
|
||||
{
|
||||
protected array $scenes = [
|
||||
'getPatientFamilyInquiryCase' => [ // 获取患者问诊病例
|
||||
'getPatientFamilyInquiryCaseSimple' => [ // 获取问诊订单病例详情-基础
|
||||
'order_inquiry_id',
|
||||
],
|
||||
'getPatientFamilyInquiryCase' => [ // 获取问诊订单病例详情
|
||||
'order_inquiry_id',
|
||||
],
|
||||
];
|
||||
|
||||
@ -2,10 +2,209 @@
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Model\DetectionProject;
|
||||
use App\Model\InquiryCaseProduct;
|
||||
use App\Model\OrderDetection;
|
||||
use App\Model\OrderInquiry;
|
||||
use App\Model\OrderInquiryCase;
|
||||
use App\Model\OrderPrescription;
|
||||
use App\Model\OrderPrescriptionIcd;
|
||||
use App\Model\OrderPrescriptionProduct;
|
||||
use App\Model\PatientFamily;
|
||||
use App\Model\PatientFamilyHealth;
|
||||
use App\Model\PatientFamilyPersonal;
|
||||
use App\Model\User;
|
||||
|
||||
/**
|
||||
* 患者家庭成员病例
|
||||
*/
|
||||
class PatientCaseService extends BaseService
|
||||
{
|
||||
/**
|
||||
* 获取问诊订单病例详情-基础
|
||||
* @return array
|
||||
*/
|
||||
public function getPatientFamilyInquiryCaseSimple(): array
|
||||
{
|
||||
$order_inquiry_id = $this->request->input('order_inquiry_id');
|
||||
|
||||
// 获取订单数据
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $order_inquiry_id;
|
||||
$order_inquiry = OrderInquiry::getOne($params);
|
||||
if (empty($order_inquiry)) {
|
||||
return fail();
|
||||
}
|
||||
|
||||
// 获取病例信息
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $order_inquiry_id;
|
||||
$params['status'] = 1;
|
||||
$order_inquiry_case = OrderInquiryCase::getOne($params);
|
||||
if (empty($order_inquiry_case)) {
|
||||
return fail();
|
||||
}
|
||||
|
||||
$result = array();
|
||||
$result['patient_name'] = $order_inquiry['patient_name'];
|
||||
$result['patient_sex'] = $order_inquiry['patient_sex'];
|
||||
$result['patient_age'] = $order_inquiry['patient_age'];
|
||||
$result['disease_desc'] = $order_inquiry_case['disease_desc'];
|
||||
$result['reception_time'] = $order_inquiry['reception_time']; // 接诊时间
|
||||
|
||||
return success($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取问诊订单病例详情
|
||||
* @return array
|
||||
*/
|
||||
public function getPatientFamilyInquiryCase(): array
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
$order_inquiry_id = $this->request->input('order_inquiry_id');
|
||||
|
||||
// 获取订单数据
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $order_inquiry_id;
|
||||
$order_inquiry = OrderInquiry::getOne($params);
|
||||
if (empty($order_inquiry)) {
|
||||
return fail();
|
||||
}
|
||||
|
||||
// 获取病例信息
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $order_inquiry_id;
|
||||
$params['status'] = 1;
|
||||
$order_inquiry_case = OrderInquiryCase::getOne($params);
|
||||
if (empty($order_inquiry_case)) {
|
||||
return fail();
|
||||
}
|
||||
|
||||
$order_inquiry_case = $order_inquiry_case->toArray();
|
||||
|
||||
// 获取患者家庭成员信息表-基本信息
|
||||
$params = array();
|
||||
$params['family_id'] = $order_inquiry_case['family_id'];
|
||||
$patient_family = PatientFamily::getOne($params);
|
||||
if (!empty($patient_family)){
|
||||
$order_inquiry_case['height'] = $order_inquiry_case['height'] ?: $patient_family['height'] ?: NULL;
|
||||
$order_inquiry_case['weight'] = $order_inquiry_case['weight'] ?: $patient_family['weight'] ?: NULL;
|
||||
$order_inquiry_case['job_id'] = $order_inquiry_case['job_id'] ?: $patient_family['job_id'] ?: NULL;
|
||||
$order_inquiry_case['job_name'] = $order_inquiry_case['job_name'] ?: $patient_family['job_name'] ?: NULL;
|
||||
$order_inquiry_case['nation_name'] = $order_inquiry_case['nation_name'] ?: $patient_family['nation_name'] ?: NULL;
|
||||
$order_inquiry_case['marital_status'] = $patient_family['marital_status'] ?? 0;
|
||||
$order_inquiry_case['id_number'] = $patient_family['id_number'] ?? "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 获取患者家庭成员信息表-健康情况
|
||||
$params = array();
|
||||
$params['family_id'] = $order_inquiry_case['family_id'];
|
||||
$patient_family_health = PatientFamilyHealth::getOne($params);
|
||||
if (!empty($patient_family_health)) {
|
||||
$order_inquiry_case['diagnosis_hospital'] = $order_inquiry_case['diagnosis_hospital'] ?: $patient_family_health['diagnosis_hospital'] ?: "";
|
||||
$order_inquiry_case['is_take_medicine'] = $order_inquiry_case['is_take_medicine'] ?: $patient_family_health['is_take_medicine'] ?: null;
|
||||
$order_inquiry_case['drugs_name'] = $order_inquiry_case['drugs_name'] ?: $patient_family_health['drugs_name'] ?: "";
|
||||
}
|
||||
|
||||
// 获取患者家庭成员信息表-个人情况
|
||||
$params = array();
|
||||
$params['family_id'] = $order_inquiry_case['family_id'];
|
||||
$patient_family_personal = PatientFamilyPersonal::getOne($params);
|
||||
if (!empty($patient_family_personal)) {
|
||||
$order_inquiry_case['drink_wine_status'] = $order_inquiry_case['drink_wine_status'] ?: $patient_family_personal['drink_wine_status'] ?: null;
|
||||
$order_inquiry_case['smoke_status'] = $order_inquiry_case['smoke_status'] ?: $patient_family_personal['smoke_status'] ?: null;
|
||||
$order_inquiry_case['chemical_compound_status'] = $order_inquiry_case['chemical_compound_status'] ?: $patient_family_personal['chemical_compound_status'] ?: null;
|
||||
$order_inquiry_case['chemical_compound_describe'] = $order_inquiry_case['chemical_compound_describe'] ?: $patient_family_personal['chemical_compound_describe'] ?: "";
|
||||
$order_inquiry_case['is_operation'] = $order_inquiry_case['is_operation'] ?: $patient_family_personal['is_operation'] ?: null;
|
||||
$order_inquiry_case['operation'] = $order_inquiry_case['operation'] ?: $patient_family_personal['operation'] ?: "";
|
||||
}
|
||||
|
||||
// 获取用药意向
|
||||
$product = [];
|
||||
$fields = [
|
||||
'inquiry_case_id',
|
||||
'product_id',
|
||||
'case_product_num',
|
||||
];
|
||||
$params = array();
|
||||
$params['inquiry_case_id'] = $order_inquiry_case['inquiry_case_id'];
|
||||
$inquiry_case_product = InquiryCaseProduct::getWithProductList($params, $fields);
|
||||
if (!empty($inquiry_case_product)) {
|
||||
foreach ($inquiry_case_product as &$item) {
|
||||
if (!empty($item['Product'])) {
|
||||
$product[] = $item['Product']['product_name'] . ' ' . $item['Product']['product_spec'] . '(' . $item['case_product_num'] . $item['Product']['packaging_unit'] . ')';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$order_inquiry_case['product'] = $product;
|
||||
unset($inquiry_case_product);
|
||||
|
||||
// 复诊凭证
|
||||
if (!empty($order_inquiry_case['diagnose_images'])) {
|
||||
$diagnose_images = explode(',', $order_inquiry_case['diagnose_images']);
|
||||
foreach ($diagnose_images as &$item) {
|
||||
$item = addAliyunOssWebsite($item);
|
||||
}
|
||||
|
||||
$order_inquiry_case['diagnose_images'] = $diagnose_images;
|
||||
}
|
||||
|
||||
// 检测项目
|
||||
$order_inquiry_case['detection_project'] = null;
|
||||
if ($order_inquiry['inquiry_type'] == 5) {
|
||||
// 获取检测订单
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];
|
||||
$order_detection = OrderDetection::getOne($params);
|
||||
if (!empty($order_detection)) {
|
||||
// 获取检测项目
|
||||
$params = array();
|
||||
$params['detection_project_id'] = $order_detection['detection_project_id'];
|
||||
$detection_project = DetectionProject::getOne($params);
|
||||
if (!empty($detection_project)) {
|
||||
$order_inquiry_case['detection_project']['detection_project_name'] = $detection_project['detection_project_name']; // 检测项目名称
|
||||
$order_inquiry_case['detection_project']['detection_time'] = $order_detection['detection_time']; // 检测时间
|
||||
$order_inquiry_case['detection_project']['detection_link'] = addAliyunOssWebsite($order_detection['detection_result_pdf']); // 检测结果链接
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 获取处方数据
|
||||
$order_inquiry_case['order_prescription'] = null;
|
||||
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];
|
||||
$order_prescription = OrderPrescription::getOne($params);
|
||||
if (!empty($order_prescription)){
|
||||
$order_inquiry_case['order_prescription']['doctor_created_time'] = $order_prescription['doctor_created_time']; // 医生开具处方时间
|
||||
$order_inquiry_case['order_prescription']['doctor_advice'] = $order_prescription['doctor_advice'];// 医嘱
|
||||
|
||||
// 获取处方疾病数据
|
||||
$params = array();
|
||||
$params['order_prescription_id'] = $order_prescription['order_prescription_id'];
|
||||
$order_prescription_icds = OrderPrescriptionIcd::getList($params);
|
||||
if (empty($order_prescription_icds)){
|
||||
return fail();
|
||||
}
|
||||
|
||||
$icd_name = array_column($order_prescription_icds->toArray(),"icd_name");
|
||||
$order_inquiry_case['order_prescription']['icd_name'] = implode(";",$icd_name);
|
||||
|
||||
// 获取处方药品名称
|
||||
$params = array();
|
||||
$params['order_prescription_id'] = $order_prescription['order_prescription_id'];
|
||||
$order_prescription_products = OrderPrescriptionProduct::getList($params);
|
||||
if (empty($order_prescription_products)){
|
||||
return fail();
|
||||
}
|
||||
|
||||
$order_inquiry_case['order_prescription']["product"] = $order_prescription_products->toArray();
|
||||
}
|
||||
|
||||
return success($order_inquiry_case);
|
||||
}
|
||||
}
|
||||
@ -118,6 +118,9 @@ class PatientPathographyService extends BaseService
|
||||
$params['family_id'] = $patient_pathography['family_id'];
|
||||
$order_prescription = OrderPrescription::getOne($params);
|
||||
if (!empty($order_prescription)){
|
||||
$result['order_prescription']['doctor_created_time'] = $order_prescription['doctor_created_time']; // 医生开具处方时间
|
||||
$result['order_prescription']['doctor_advice'] = $order_prescription['doctor_advice'];// 医嘱
|
||||
|
||||
// 获取处方疾病数据
|
||||
$params = array();
|
||||
$params['order_prescription_id'] = $order_prescription['order_prescription_id'];
|
||||
@ -168,8 +171,12 @@ class PatientPathographyService extends BaseService
|
||||
|
||||
// 复诊凭证
|
||||
if (!empty($patient_pathography['diagnose_images'])){
|
||||
$diagnose_images = implode(',', $patient_pathography['diagnose_images']);
|
||||
$result['diagnose_images'] = PcreMatch::pregRemoveOssWebsite($diagnose_images);
|
||||
$diagnose_images = explode(',', $patient_pathography['diagnose_images']);
|
||||
foreach ($diagnose_images as &$item) {
|
||||
$item = addAliyunOssWebsite($item);
|
||||
}
|
||||
|
||||
$result['diagnose_images'] = $diagnose_images;
|
||||
}
|
||||
|
||||
return success($result);
|
||||
|
||||
@ -726,9 +726,12 @@ Router::addGroup('/user', function () {
|
||||
Router::put('/system', [UserController::class, 'putUserSystem']);
|
||||
});
|
||||
|
||||
// 获取患者家庭成员问诊订单病例
|
||||
// 病例
|
||||
Router::addGroup('/case', function () {
|
||||
// 获取患者家庭成员问诊病例详情
|
||||
// 获取问诊订单病例详情-基础
|
||||
Router::get('/inquiry/simple', [PatientCaseController::class, 'getPatientFamilyInquiryCaseSimple']);
|
||||
|
||||
// 获取问诊订单病例详情
|
||||
Router::get('/inquiry', [PatientCaseController::class, 'getPatientFamilyInquiryCase']);
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user