新增 获取家庭成员病情记录详情

This commit is contained in:
wucongxing 2023-11-21 10:40:23 +08:00
parent 7df80196c2
commit 45e4fa886b
4 changed files with 113 additions and 7 deletions

View File

@ -33,7 +33,7 @@ class PatientPathographyController extends AbstractController
* 获取家庭成员病情记录列表-分页
* @return ResponseInterface
*/
public function getFamilyPathographyList(): ResponseInterface
public function getFamilyPathographyPage(): ResponseInterface
{
try {
$request = $this->container->get(PatientPathographyRequest::class);
@ -41,12 +41,21 @@ class PatientPathographyController extends AbstractController
return $this->response->json(fail());
}
$request->scene('getFamilyPathographyList')->validateResolved();
$request->scene('getFamilyPathographyPage')->validateResolved();
$PatientPathographyService = new PatientPathographyService();
$data = $PatientPathographyService->getFamilyPathographyList();
$data = $PatientPathographyService->getFamilyPathographyPage();
return $this->response->json($data);
}
/**
* 获取家庭成员病情记录详情
* @return ResponseInterface
*/
public function getFamilyPathographyInfo(): ResponseInterface
{
$PatientPathographyService = new PatientPathographyService();
$data = $PatientPathographyService->getFamilyPathographyInfo();
return $this->response->json($data);
}
}

View File

@ -11,7 +11,7 @@ class PatientPathographyRequest extends FormRequest
'existFamilyPathography' => [ // 检测家庭成员是否存在病情记录
'family_id',
],
'getFamilyPathographyList' => [ // 获取家庭成员病情记录列表-分页
'getFamilyPathographyPage' => [ // 获取家庭成员病情记录列表-分页
'family_id',
],
];

View File

@ -3,8 +3,14 @@
namespace App\Services;
use App\Constants\HttpEnumCode;
use App\Model\OrderPrescription;
use App\Model\OrderPrescriptionIcd;
use App\Model\OrderPrescriptionProduct;
use App\Model\OrderProduct;
use App\Model\PatientPathography;
use App\Model\PatientPathographyProduct;
use App\Model\Product;
use App\Utils\PcreMatch;
/**
* 家庭成员病情记录
@ -40,7 +46,7 @@ class PatientPathographyService extends BaseService
* 获取家庭成员病情记录列表-分页
* @return array
*/
public function getFamilyPathographyList(): array
public function getFamilyPathographyPage(): array
{
$user_info = $this->request->getAttribute("userInfo") ?? [];
$family_id = $this->request->input('family_id');
@ -63,4 +69,92 @@ class PatientPathographyService extends BaseService
return success($patient_pathographys);
}
/**
* 获取家庭成员病情记录详情
* @return array
*/
public function getFamilyPathographyInfo(): array
{
$user_info = $this->request->getAttribute("userInfo") ?? [];
$pathography_id = $this->request->route('pathography_id');
$params = array();
$params['user_id'] = $user_info['user_id'];
$params['patient_id'] = $user_info['client_user_id'];
$params['pathography_id'] = $pathography_id;
$patient_pathography = PatientPathography::getOne($params);
if (empty($patient_pathography)){
return success(null);
}
$result = $patient_pathography->toArray();
$result['order_prescription'] = null; // 处方数据
$result['patient_pathography_product'] = array(); // 用药意向
$result['diagnose_images'] = array(); // 复诊凭证
// 获取处方数据
if (!empty($patient_pathography['order_prescription_id'])){
$params = array();
$params['order_prescription_id'] = $patient_pathography['order_prescription_id'];
$params['patient_id'] = $patient_pathography['patient_id'];
$params['family_id'] = $patient_pathography['family_id'];
$order_prescription = OrderPrescription::getOne($params);
if (!empty($order_prescription)){
// 获取处方疾病数据
$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");
$result['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();
}
$result["order_prescription"]["product"] = $order_prescription_products->toArray();
}
}
// 获取用药意向
$params = array();
$params['pathography_id'] = $patient_pathography['pathography_id'];
$patient_pathography_products = PatientPathographyProduct::getList($params);
if (!empty($patient_pathography_products)){
foreach ($patient_pathography_products as $patient_pathography_product){
// 获取商品数据
$params =array();
$params['product_id'] = $patient_pathography_product['product_id'];
$product = Product::getOne($params);
if (empty($product)){
return fail();
}
$item = array();
$item['product_cover_img'] = addAliyunOssWebsite($product['product_cover_img']);
$item['product_name'] = $product['product_name']; // 名称
$item['product_spec'] = $product['product_spec']; // 商品规格
$item['packaging_unit'] = $product['packaging_unit']; // 基本包装单位(例:盒/瓶)
$item['case_product_num'] = $patient_pathography_product['case_product_num']; // 药品数量
$result['patient_pathography_product'][] = $item;
}
}
// 复诊凭证
if (!empty($patient_pathography['diagnose_images'])){
$diagnose_images = implode(',', $patient_pathography['diagnose_images']);
$result['diagnose_images'] = PcreMatch::pregRemoveOssWebsite($diagnose_images);
}
return success($result);
}
}

View File

@ -388,7 +388,10 @@ Router::addGroup('/patient', function () {
Router::get('/exist', [PatientPathographyController::class, 'existFamilyPathography']);
// 获取家庭成员病情记录列表-分页
Router::get('', [PatientPathographyController::class, 'getFamilyPathographyList']);
Router::get('', [PatientPathographyController::class, 'getFamilyPathographyPage']);
// 获取家庭成员病情记录详情
Router::get('/{pathography_id:\d+}', [PatientPathographyController::class, 'getFamilyPathographyInfo']);
});
});