修改家庭成员-问诊病例入参、返回值数据
This commit is contained in:
parent
ef5a8f9691
commit
5eb743a052
@ -16,6 +16,7 @@ class PatientCaseController extends AbstractController
|
||||
*/
|
||||
public function getLastCase(): ResponseInterface
|
||||
{
|
||||
return $this->response->json(["暂停使用"]);
|
||||
$PatientCaseService = new PatientCaseService();
|
||||
$data = $PatientCaseService->getLastCase();
|
||||
return $this->response->json($data);
|
||||
|
||||
@ -240,4 +240,14 @@ class PatientFamilyController extends AbstractController
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取家庭成员病例数据
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getFamilyCase(): ResponseInterface
|
||||
{
|
||||
$patientFamilyService = new PatientFamilyService();
|
||||
$data = $patientFamilyService->getFamilyCase();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
}
|
||||
@ -6,6 +6,7 @@ namespace App\Request;
|
||||
|
||||
use App\Constants\HttpEnumCode;
|
||||
use Hyperf\Validation\Request\FormRequest;
|
||||
use Hyperf\Validation\Rule;
|
||||
|
||||
class InquiryRequest extends FormRequest
|
||||
{
|
||||
@ -17,16 +18,14 @@ class InquiryRequest extends FormRequest
|
||||
'diagnosis_date',
|
||||
'disease_desc',
|
||||
'is_allergy_history',// 过敏史
|
||||
'allergy_history',
|
||||
'is_family_history', // 家族病史
|
||||
'family_history',
|
||||
'is_pregnant',// 备孕、妊娠、哺乳期
|
||||
'pregnant',
|
||||
'height',
|
||||
'weight',
|
||||
'inquiry_type', // 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药)
|
||||
'inquiry_mode', // 订单问诊方式(1:图文 2:视频 3:语音 4:电话 5:会员)
|
||||
'client_type', // 客户端类型(1:手机 2:电脑)
|
||||
'is_taboo', // 是否服用过禁忌药物,且无相关禁忌(0:否 1:是)问诊购药时存在
|
||||
],
|
||||
'addInquiryEvaluation' => [ // 新增问诊评价
|
||||
'doctor_id',
|
||||
@ -66,10 +65,11 @@ class InquiryRequest extends FormRequest
|
||||
'disease_class_id' => 'required',
|
||||
'diagnosis_date' => ['sometimes','date'],
|
||||
'disease_desc' => 'required',
|
||||
'is_allergy_history' => ['sometimes','numeric','min:0','max:1'],
|
||||
'is_family_history' => ['sometimes','numeric','min:0','max:1'],
|
||||
'is_pregnant' => ['sometimes','numeric','min:0','max:1'],
|
||||
'is_allergy_history' => ['sometimes',Rule::in([0,1,null])],
|
||||
'is_family_history' => ['sometimes',Rule::in([0,1,null])],
|
||||
'is_pregnant' => ['sometimes',Rule::in([0,1,null])],
|
||||
'client_type' => 'required|integer|min:1|max:2',
|
||||
'is_taboo' => ['sometimes',Rule::in([0,1,null])],
|
||||
|
||||
'doctor_id' => 'required',
|
||||
'order_inquiry_id' => 'required',
|
||||
@ -101,20 +101,14 @@ class InquiryRequest extends FormRequest
|
||||
'disease_class_id.required' => "请您选择疾病",
|
||||
'diagnosis_date.date' => HttpEnumCode::getMessage(HttpEnumCode::DATE_FORMAT_ERROR),
|
||||
'disease_desc.required' => "请您输入病情主诉",
|
||||
'is_allergy_history.numeric' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_allergy_history.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_allergy_history.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_family_history.numeric' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_family_history.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_family_history.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_pregnant.numeric' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_pregnant.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_pregnant.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_allergy_history.in' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_family_history.in' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_pregnant.in' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'client_type.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'client_type.integer' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'client_type.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'client_type.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
|
||||
'is_taboo.in' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'inquiry_status.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'inquiry_status.integer' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'inquiry_status.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
|
||||
@ -88,13 +88,15 @@ class InquiryService extends BaseService
|
||||
}
|
||||
|
||||
// 是否为孕妇
|
||||
if (!empty($request_params['is_pregnant'])) {
|
||||
if ($request_params['is_pregnant'] == 1) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "请您到线下问诊");
|
||||
}
|
||||
|
||||
// 是否服用过禁忌药物,且无相关禁忌(0:否 1:是)问诊购药时存在
|
||||
if ($request_params['is_taboo'] == 0) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "无法为您开具药物");
|
||||
if (isset($request_params['is_taboo'])){
|
||||
if ($request_params['is_taboo'] == 0) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "无法为您开具药物");
|
||||
}
|
||||
}
|
||||
|
||||
// 检测所患疾病是否正确
|
||||
@ -224,12 +226,28 @@ class InquiryService extends BaseService
|
||||
$data['diagnosis_date'] = $request_params['diagnosis_date'] ?: null; // 确诊日期
|
||||
$data['disease_desc'] = $request_params['disease_desc'] ?: null; // 病情描述(主诉)
|
||||
$data['diagnose_images'] = $diagnose_images ?? ""; // 复诊凭证(多个使用逗号分隔)
|
||||
$data['is_allergy_history'] = $request_params['is_allergy_history'] ?: 0; // 是否存在过敏史(0:否 1:是)
|
||||
if (isset($request_params['is_allergy_history'])){
|
||||
if ($request_params['is_allergy_history'] != null){
|
||||
$data['is_allergy_history'] = $request_params['is_allergy_history']; // 是否存在过敏史(0:否 1:是)
|
||||
}
|
||||
}
|
||||
$data['allergy_history'] = $request_params['allergy_history'] ?? null; // 过敏史描述
|
||||
$data['is_family_history'] = $request_params['is_family_history'] ?: 0; // 是否存在家族病史(0:否 1:是)
|
||||
if (isset($request_params['is_family_history'])){
|
||||
if ($request_params['is_family_history'] != null){
|
||||
$data['is_family_history'] = $request_params['is_family_history']; // 是否存在家族病史(0:否 1:是)
|
||||
}
|
||||
}
|
||||
$data['family_history'] = $request_params['family_history'] ?? null; // 家族病史描述
|
||||
$data['is_pregnant'] = $request_params['is_pregnant'] ?: 0; // 是否备孕、妊娠、哺乳期(0:否 1:是)
|
||||
$data['is_taboo'] = $request_params['is_taboo'] ?? 1; // 是否存在禁忌药物(0:否 1:是)问诊购药时存在
|
||||
if (isset($request_params['is_pregnant'])){
|
||||
if ($request_params['is_pregnant'] != null){
|
||||
$data['is_pregnant'] = $request_params['is_pregnant']; // 是否备孕、妊娠、哺乳期(0:否 1:是)
|
||||
}
|
||||
}
|
||||
if (isset($request_params['is_taboo'])){
|
||||
if ($request_params['is_taboo'] != null){
|
||||
$data['is_taboo'] = $request_params['is_taboo']; // 是否存在禁忌药物(0:否 1:是)问诊购药时存在
|
||||
}
|
||||
}
|
||||
$order_inquiry_case = OrderInquiryCase::addOrderInquiryCase($data);
|
||||
if (empty($order_inquiry_case)) {
|
||||
Db::rollBack();
|
||||
@ -390,21 +408,35 @@ class InquiryService extends BaseService
|
||||
$params = array();
|
||||
$params['family_id'] = $order_inquiry_case['family_id'];
|
||||
$patient_family_health = PatientFamilyHealth::getOne($params);
|
||||
$order_inquiry_case['diagnosis_hospital'] = $patient_family_health['diagnosis_hospital'] ?? "";
|
||||
$order_inquiry_case['is_take_medicine'] = $patient_family_health['is_take_medicine'] ?? 0;
|
||||
$order_inquiry_case['drugs_name'] = $patient_family_health['drugs_name'] ?? "";
|
||||
if (empty($patient_family_health)){
|
||||
$order_inquiry_case['diagnosis_hospital'] = "";
|
||||
$order_inquiry_case['is_take_medicine'] = null;
|
||||
$order_inquiry_case['drugs_name'] = "";
|
||||
}else{
|
||||
$order_inquiry_case['diagnosis_hospital'] = $patient_family_health['diagnosis_hospital'];
|
||||
$order_inquiry_case['is_take_medicine'] = $patient_family_health['is_take_medicine'];
|
||||
$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);
|
||||
|
||||
$order_inquiry_case['drink_wine_status'] = $patient_family_personal['drink_wine_status'] ?? 1;
|
||||
$order_inquiry_case['smoke_status'] = $patient_family_personal['smoke_status'] ?? 1;
|
||||
$order_inquiry_case['chemical_compound_status'] = $patient_family_personal['chemical_compound_status'] ?? 1;
|
||||
$order_inquiry_case['chemical_compound_describe'] = $patient_family_personal['chemical_compound_describe'] ?? "";
|
||||
$order_inquiry_case['is_operation'] = $patient_family_personal['is_operation'] ?? 0;
|
||||
$order_inquiry_case['operation'] = $patient_family_personal['operation'] ?? "";
|
||||
if (empty($patient_family_personal)){
|
||||
$order_inquiry_case['drink_wine_status'] = null;
|
||||
$order_inquiry_case['smoke_status'] = null;
|
||||
$order_inquiry_case['chemical_compound_status'] = null;
|
||||
$order_inquiry_case['chemical_compound_describe'] = "";
|
||||
$order_inquiry_case['is_operation'] = null;
|
||||
$order_inquiry_case['operation'] = "";
|
||||
}else{
|
||||
$order_inquiry_case['drink_wine_status'] = $patient_family_personal['drink_wine_status'];
|
||||
$order_inquiry_case['smoke_status'] = $patient_family_personal['smoke_status'];
|
||||
$order_inquiry_case['chemical_compound_status'] = $patient_family_personal['chemical_compound_status'];
|
||||
$order_inquiry_case['chemical_compound_describe'] = $patient_family_personal['chemical_compound_describe'];
|
||||
$order_inquiry_case['is_operation'] = $patient_family_personal['is_operation'];
|
||||
$order_inquiry_case['operation'] = $patient_family_personal['operation'];
|
||||
}
|
||||
|
||||
// 获取用药意向
|
||||
$product = [];
|
||||
|
||||
@ -937,4 +937,58 @@ class PatientFamilyService extends BaseService
|
||||
return success($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取家庭成员病例数据
|
||||
* @return array
|
||||
*/
|
||||
public function getFamilyCase(): array
|
||||
{
|
||||
$family_id = $this->request->route('family_id');
|
||||
|
||||
$user_info = $this->request->getAttribute("userInfo");
|
||||
|
||||
// 患者家庭成员信息表-健康情况
|
||||
$params = array();
|
||||
$params['family_id'] = $family_id;
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$patient_family_health = PatientFamilyHealth::getOne($params);
|
||||
|
||||
$params = array();
|
||||
$params['family_id'] = $family_id;
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$patient_family_personal = PatientFamilyPersonalModel::getOne($params);
|
||||
|
||||
$result = array();
|
||||
$result['user_id'] = $user_info['user_id'];
|
||||
$result['patient_id'] = $user_info['client_user_id'];
|
||||
$result['family_id'] = $family_id;
|
||||
$result['diagnosis_date'] = $patient_family_health['diagnosis_date'] ?? null; // 确诊日期
|
||||
$result['disease_class_id'] = $patient_family_health['disease_class_id'] ?? null; // 疾病分类id-系统
|
||||
$result['disease_class_name'] = $patient_family_health['disease_class_name'] ?? null; // 疾病名称-系统
|
||||
$result['is_allergy_history'] = null; // 是否存在过敏史(0:否 1:是)
|
||||
$result['allergy_history'] = null; // 过敏史描述
|
||||
$result['is_family_history'] = null; // 是否存在家族病史(0:否 1:是)
|
||||
$result['family_history'] = null; // 家族病史描述
|
||||
$result['is_pregnant'] = null; // 是否备孕、妊娠、哺乳期(0:否 1:是)
|
||||
$result['pregnant'] = null; // 备孕、妊娠、哺乳期描述
|
||||
|
||||
if (!empty($patient_family_personal)){
|
||||
if ($patient_family_personal['is_allergy_history'] != null){
|
||||
$result['is_allergy_history'] = (int)$patient_family_personal['is_allergy_history']; // 是否存在过敏史(0:否 1:是)
|
||||
$result['allergy_history'] = $patient_family_personal['allergy_history']; // 过敏史描述
|
||||
}
|
||||
|
||||
if ($patient_family_personal['is_family_history'] != null){
|
||||
$result['is_family_history'] = (int)$patient_family_personal['is_family_history']; // 是否存在家族病史(0:否 1:是)
|
||||
$result['family_history'] = $patient_family_personal['family_history']; // 家族病史描述
|
||||
}
|
||||
|
||||
if ($patient_family_personal['is_pregnant'] != null){
|
||||
$result['is_pregnant'] = (int)$patient_family_personal['is_pregnant']; // 是否备孕、妊娠、哺乳期(0:否 1:是)
|
||||
$result['pregnant'] = $patient_family_personal['pregnant']; // 备孕、妊娠、哺乳期描述
|
||||
}
|
||||
}
|
||||
|
||||
return success($result);
|
||||
}
|
||||
}
|
||||
@ -287,6 +287,9 @@ Router::addGroup('/patient', function () {
|
||||
|
||||
// 家庭成员
|
||||
Router::addGroup('/family', function () {
|
||||
// 获取家庭成员病例数据
|
||||
Router::get('/case/{family_id:\d+}', [PatientFamilyController::class, 'getFamilyCase']);
|
||||
|
||||
// 获取家庭成员列表
|
||||
Router::get('', [PatientFamilyController::class, 'getFamilyList']);
|
||||
|
||||
@ -335,7 +338,7 @@ Router::addGroup('/patient', function () {
|
||||
|
||||
// 病例
|
||||
Router::addGroup('/case', function () {
|
||||
// 获取患者最后一份问诊病例
|
||||
// 获取患者最后一份问诊病例-废弃
|
||||
Router::get('/last/{family_id:\d+}', [PatientCaseController::class, 'getLastCase']);
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user