新增 获取问诊订单病例缺少字段
This commit is contained in:
parent
9d7701f454
commit
f7ccb78efa
@ -45,4 +45,20 @@ class PatientCaseController extends AbstractController
|
||||
$data = $PatientCaseService->getPatientFamilyInquiryCase();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取问诊订单病例缺少字段
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function getPatientFamilyInquiryCaseUnfilledFields(): ResponseInterface
|
||||
{
|
||||
$request = $this->container->get(PatientCaseRequest::class);
|
||||
$request->scene('getPatientFamilyInquiryCaseUnfilledFields')->validateResolved();
|
||||
|
||||
$PatientCaseService = new PatientCaseService();
|
||||
$data = $PatientCaseService->getPatientFamilyInquiryCaseUnfilledFields();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
}
|
||||
@ -24,6 +24,7 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
||||
* @property int $age 患者年龄
|
||||
* @property string $height 身高(cm)
|
||||
* @property string $weight 体重(kg)
|
||||
* @property int $marital_status 婚姻状况(0:未婚 1:已婚 2:离异)
|
||||
* @property string $disease_class_name 疾病名称-系统
|
||||
* @property string $diagnosis_date 确诊日期
|
||||
* @property string $disease_desc 病情描述(主诉)
|
||||
@ -64,7 +65,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', '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 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', 'marital_status', '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";
|
||||
|
||||
|
||||
@ -28,6 +28,7 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
||||
* @property int $age 患者年龄
|
||||
* @property string $height 身高(cm)
|
||||
* @property string $weight 体重(kg)
|
||||
* @property int $marital_status 婚姻状况(0:未婚 1:已婚 2:离异)
|
||||
* @property string $disease_class_name 疾病名称-系统
|
||||
* @property string $diagnosis_date 确诊日期
|
||||
* @property string $disease_desc 病情描述(主诉)
|
||||
@ -52,6 +53,7 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
||||
* @property string $chemical_compound_describe 化合物描述
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
* @property-read OrderInquiry|null $OrderInquiry
|
||||
*/
|
||||
class PatientPathography extends Model
|
||||
{
|
||||
@ -65,7 +67,7 @@ class PatientPathography extends Model
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['pathography_id', 'user_id', 'patient_id', 'family_id', 'order_inquiry_id', 'order_prescription_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 array $fillable = ['pathography_id', 'user_id', 'patient_id', 'family_id', 'order_inquiry_id', 'order_prescription_id', 'disease_class_id', 'nation_id', 'job_id', 'relation', 'status', 'name', 'sex', 'age', 'height', 'weight', 'marital_status', '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 = "pathography_id";
|
||||
|
||||
|
||||
@ -17,6 +17,9 @@ class PatientCaseRequest extends FormRequest
|
||||
'getPatientFamilyInquiryCase' => [ // 获取问诊订单病例详情
|
||||
'order_inquiry_id',
|
||||
],
|
||||
'getPatientFamilyInquiryCaseUnfilledFields' => [ // 获取问诊订单病例缺少字段
|
||||
'order_inquiry_id',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@ -14,6 +14,7 @@ use App\Model\PatientFamily;
|
||||
use App\Model\PatientFamilyHealth;
|
||||
use App\Model\PatientFamilyPersonal;
|
||||
use App\Model\User;
|
||||
use Hyperf\Redis\Redis;
|
||||
|
||||
/**
|
||||
* 患者家庭成员病例
|
||||
@ -93,12 +94,9 @@ class PatientCaseService extends BaseService
|
||||
$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'] ?? "";
|
||||
$order_inquiry_case['marital_status'] = $order_inquiry_case['marital_status'] ?: $patient_family['marital_status'] ?: NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 获取患者家庭成员信息表-健康情况
|
||||
$params = array();
|
||||
$params['family_id'] = $order_inquiry_case['family_id'];
|
||||
@ -207,4 +205,120 @@ class PatientCaseService extends BaseService
|
||||
|
||||
return success($order_inquiry_case);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取问诊订单病例缺少字段
|
||||
* @return array
|
||||
*/
|
||||
public function getPatientFamilyInquiryCaseUnfilledFields(): 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();
|
||||
}
|
||||
|
||||
// 获取患者家庭成员信息表-基本信息
|
||||
$params = array();
|
||||
$params['family_id'] = $order_inquiry_case['family_id'];
|
||||
$patient_family = PatientFamily::getOne($params);
|
||||
|
||||
// 获取患者家庭成员信息表-健康情况
|
||||
$params = array();
|
||||
$params['family_id'] = $order_inquiry_case['family_id'];
|
||||
$patient_family_health = PatientFamilyHealth::getOne($params);
|
||||
|
||||
// 获取患者家庭成员信息表-个人情况
|
||||
$params = array();
|
||||
$params['family_id'] = $order_inquiry_case['family_id'];
|
||||
$patient_family_personal = PatientFamilyPersonal::getOne($params);
|
||||
|
||||
// 初始字段定义
|
||||
$fields = [
|
||||
"relation", // 与患者关系(1:本人 2:父母 3:爱人 4:子女 5:亲戚 6:其他 )
|
||||
"name", // 患者名称
|
||||
"sex", // 患者性别(0:未知 1:男 2:女)
|
||||
"age", // 患者年龄
|
||||
"height", // 身高(cm)
|
||||
"weight", // 体重(kg)
|
||||
"marital_status", // 婚姻状况(0:未婚 1:已婚 2:离异)
|
||||
"disease_class_name", // 疾病名称-系统
|
||||
"diagnosis_date", // 确诊日期
|
||||
"disease_desc", // 病情描述(主诉)
|
||||
"is_allergy_history", // 是否存在过敏史(0:否 1:是)
|
||||
"allergy_history", // 过敏史描述
|
||||
"is_family_history", // 是否存在家族病史(0:否 1:是)
|
||||
"family_history", // 家族病史描述
|
||||
"is_pregnant", // 是否备孕、妊娠、哺乳期(0:否 1:是)
|
||||
"pregnant", // 备孕、妊娠、哺乳期描述
|
||||
"is_taboo", // 是否服用过禁忌药物,且无相关禁忌(0:否 1:是)问诊购药时存在
|
||||
"is_take_medicine", // 正在服药(0:否 1:是)
|
||||
"drugs_name", // 正在服药名称
|
||||
"nation_name", // 民族名称
|
||||
"job_name", // 职业名称
|
||||
"diagnosis_hospital", // 确诊医院
|
||||
"is_operation", // 是否存在手术(0:否 1:是)
|
||||
"operation", // 手术描述
|
||||
"drink_wine_status", // 饮酒状态(1:从不 2:偶尔 3:经常 4:每天 5:已戒酒)
|
||||
"smoke_status", // 吸烟状态(1:从不 2:偶尔 3:经常 4:每天 5:已戒烟)
|
||||
"chemical_compound_status", // 化合物状态(1:从不 2:偶尔 3:经常 4:每天)
|
||||
"chemical_compound_describe", // 化合物描述
|
||||
];
|
||||
|
||||
// 获取缓存
|
||||
$redis = $this->container->get(Redis::class);
|
||||
$redis_key = "patient_family_inquiry_case_unfilled_fields_" . $order_inquiry_id;
|
||||
$redis_value = $redis->get($redis_key);
|
||||
|
||||
// 处理字段
|
||||
$result = null;
|
||||
foreach ($fields as $field){
|
||||
if ($order_inquiry_case[$field] !== null){
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!empty($patient_family)){
|
||||
if ($patient_family[$field] !== null){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($patient_family_health)){
|
||||
if ($patient_family_health[$field] !== null){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($patient_family_personal)){
|
||||
if ($patient_family_personal[$field] !== null){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// 缓存
|
||||
if (!empty($redis_value)){
|
||||
if (strstr($redis_value,$field)){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$result[] = $field;
|
||||
}
|
||||
|
||||
return success($result);
|
||||
}
|
||||
}
|
||||
@ -733,8 +733,10 @@ Router::addGroup('/case', function () {
|
||||
|
||||
// 获取问诊订单病例详情
|
||||
Router::get('/inquiry', [PatientCaseController::class, 'getPatientFamilyInquiryCase']);
|
||||
});
|
||||
|
||||
// 获取问诊订单病例缺少字段
|
||||
Router::get('/fields', [PatientCaseController::class, 'getPatientFamilyInquiryCaseUnfilledFields']);
|
||||
});
|
||||
|
||||
// 测试使用
|
||||
Router::addGroup('/test', function () {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user