新增病情记录model,新增获取患者病例,病情主诉字段
This commit is contained in:
parent
17c979105c
commit
d7d2937159
123
app/Model/PatientPathography.php
Normal file
123
app/Model/PatientPathography.php
Normal file
@ -0,0 +1,123 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $pathography_id 主键id
|
||||
* @property int $user_id 用户id
|
||||
* @property int $patient_id 患者id
|
||||
* @property int $family_id 家庭成员id
|
||||
* @property int $order_inquiry_id 关联问诊id
|
||||
* @property int $order_prescription_id 关联处方id
|
||||
* @property int $disease_class_id 疾病分类id-系统
|
||||
* @property int $nation_id 民族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:女)
|
||||
* @property int $age 患者年龄
|
||||
* @property string $height 身高(cm)
|
||||
* @property string $weight 体重(kg)
|
||||
* @property string $disease_class_name 疾病名称-系统
|
||||
* @property string $diagnosis_date 确诊日期
|
||||
* @property string $disease_desc 病情描述(主诉)
|
||||
* @property string $diagnose_images 复诊凭证(多个使用逗号分隔)
|
||||
* @property int $is_allergy_history 是否存在过敏史(0:否 1:是)
|
||||
* @property string $allergy_history 过敏史描述
|
||||
* @property int $is_family_history 是否存在家族病史(0:否 1:是)
|
||||
* @property string $family_history 家族病史描述
|
||||
* @property int $is_pregnant 是否备孕、妊娠、哺乳期(0:否 1:是)
|
||||
* @property string $pregnant 备孕、妊娠、哺乳期描述
|
||||
* @property int $is_taboo 是否服用过禁忌药物,且无相关禁忌(0:否 1:是)问诊购药时存在
|
||||
* @property int $is_take_medicine 正在服药(0:否 1:是)
|
||||
* @property string $drugs_name 正在服药名称
|
||||
* @property string $nation_name 民族名称
|
||||
* @property string $job_name 职业名称
|
||||
* @property string $diagnosis_hospital 确诊医院
|
||||
* @property int $is_operation 是否存在手术(0:否 1:是)
|
||||
* @property string $operation 手术描述
|
||||
* @property int $drink_wine_status 饮酒状态(1:从不 2:偶尔 3:经常 4:每天 5:已戒酒)
|
||||
* @property int $smoke_status 吸烟状态(1:从不 2:偶尔 3:经常 4:每天 5:已戒烟)
|
||||
* @property int $chemical_compound_status 化合物状态(1:从不 2:偶尔 3:经常 4:每天)
|
||||
* @property string $chemical_compound_describe 化合物描述
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
*/
|
||||
class PatientPathography extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'patient_pathography';
|
||||
|
||||
/**
|
||||
* 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 string $primaryKey = "pathography_id";
|
||||
|
||||
/**
|
||||
* 获取信息-单条
|
||||
* @param array $params
|
||||
* @param array $fields
|
||||
* @return object|null
|
||||
*/
|
||||
public static function getOne(array $params, array $fields = ['*']): object|null
|
||||
{
|
||||
return self::where($params)->first($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取信息-单条
|
||||
* @param array $params
|
||||
* @param array $fields
|
||||
* @return object|null
|
||||
*/
|
||||
public static function getLastOne(array $params, array $fields = ['*']): object|null
|
||||
{
|
||||
return self::where($params)->latest("created_at")->first($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据-多
|
||||
* @param array $params
|
||||
* @param array $fields
|
||||
* @return Collection|array
|
||||
*/
|
||||
public static function getList(array $params = [], array $fields = ['*']): Collection|array
|
||||
{
|
||||
return self::where($params)->get($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param array $data
|
||||
* @return \Hyperf\Database\Model\Model|PatientPathography
|
||||
*/
|
||||
public static function addPatientPathography(array $data): \Hyperf\Database\Model\Model|PatientPathography
|
||||
{
|
||||
return self::create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param array $params
|
||||
* @param array $data
|
||||
* @return int
|
||||
*/
|
||||
public static function edit(array $params = [], array $data = []): int
|
||||
{
|
||||
return self::where($params)->update($data);
|
||||
}
|
||||
}
|
||||
79
app/Model/PatientPathographyProduct.php
Normal file
79
app/Model/PatientPathographyProduct.php
Normal file
@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $pathography_product_id 主键id
|
||||
* @property int $pathography_id 病情记录id
|
||||
* @property int $product_id 商品id
|
||||
* @property int $case_product_num 药品数量
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
*/
|
||||
class PatientPathographyProduct extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'patient_pathography_product';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['pathography_product_id', 'pathography_id', 'product_id', 'case_product_num', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "pathography_product_id";
|
||||
|
||||
/**
|
||||
* 获取信息-单条
|
||||
* @param array $params
|
||||
* @param array $fields
|
||||
* @return object|null
|
||||
*/
|
||||
public static function getOne(array $params, array $fields = ['*']): object|null
|
||||
{
|
||||
return self::where($params)->first($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据-多
|
||||
* @param array $params
|
||||
* @param array $fields
|
||||
* @return Collection|array
|
||||
*/
|
||||
public static function getList(array $params = [], array $fields = ['*']): Collection|array
|
||||
{
|
||||
return self::where($params)->get($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param array $data
|
||||
* @return \Hyperf\Database\Model\Model|PatientPathographyProduct
|
||||
*/
|
||||
public static function addPatientPathographyProduct(array $data): \Hyperf\Database\Model\Model|PatientPathographyProduct
|
||||
{
|
||||
return self::create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param array $params
|
||||
* @param array $data
|
||||
* @return int
|
||||
*/
|
||||
public static function edit(array $params = [], array $data = []): int
|
||||
{
|
||||
return self::where($params)->update($data);
|
||||
}
|
||||
|
||||
}
|
||||
@ -10,6 +10,7 @@ use App\Model\OrderProduct;
|
||||
use App\Model\PatientFamily as PatientFamilyModel;
|
||||
use App\Model\PatientFamilyHealth;
|
||||
use App\Model\PatientFamilyPersonal as PatientFamilyPersonalModel;
|
||||
use App\Model\PatientPathography;
|
||||
use App\Utils\Mask;
|
||||
use Extend\VerifyDun\IdCard;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
@ -96,15 +97,15 @@ class PatientFamilyService extends BaseService
|
||||
}
|
||||
|
||||
// 检测省市区
|
||||
if (!empty($request_params['county_id']) ){
|
||||
if (empty($request_params['city_id']) || empty($request_params['province_id'])){
|
||||
if (!empty($request_params['county_id'])) {
|
||||
if (empty($request_params['city_id']) || empty($request_params['province_id'])) {
|
||||
// 区县存在时需和城市、省份在一块
|
||||
return fail(HttpEnumCode::CLIENT_HTTP_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($request_params['city_id']) ){
|
||||
if (empty($request_params['province_id'])){
|
||||
if (!empty($request_params['city_id'])) {
|
||||
if (empty($request_params['province_id'])) {
|
||||
// 城市存在时需和省份在一块
|
||||
return fail(HttpEnumCode::CLIENT_HTTP_ERROR);
|
||||
}
|
||||
@ -112,13 +113,13 @@ class PatientFamilyService extends BaseService
|
||||
|
||||
$areaService = new AreaService();
|
||||
|
||||
if (!empty($request_params['province_id'])){
|
||||
$req = $areaService->checkAreaById($request_params['province_id'],$request_params['city_id'],$request_params['county_id']);
|
||||
if(empty($req)){
|
||||
return fail(HttpEnumCode::HTTP_ERROR,"地区选择错误");
|
||||
if (!empty($request_params['province_id'])) {
|
||||
$req = $areaService->checkAreaById($request_params['province_id'], $request_params['city_id'], $request_params['county_id']);
|
||||
if (empty($req)) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "地区选择错误");
|
||||
}
|
||||
|
||||
$area = $areaService->getAreaById($request_params['province_id'],$request_params['city_id'],$request_params['county_id']);
|
||||
$area = $areaService->getAreaById($request_params['province_id'], $request_params['city_id'], $request_params['county_id']);
|
||||
}
|
||||
|
||||
if ($request_params['type'] == 1) {
|
||||
@ -129,38 +130,38 @@ class PatientFamilyService extends BaseService
|
||||
}
|
||||
|
||||
// 民族
|
||||
if (!empty($request_params['nation_id'])){
|
||||
if (!empty($request_params['nation_id'])) {
|
||||
$params = array();
|
||||
$params['nation_id'] = $request_params['nation_id'];
|
||||
$nation = BasicNation::getOne($params);
|
||||
if (empty($nation)){
|
||||
return fail(HttpEnumCode::HTTP_ERROR,"民族选择错误");
|
||||
if (empty($nation)) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "民族选择错误");
|
||||
}
|
||||
}
|
||||
|
||||
// 职业
|
||||
if (!empty($request_params['job_id'])){
|
||||
if (!empty($request_params['job_id'])) {
|
||||
$params = array();
|
||||
$params['job_id'] = $request_params['job_id'];
|
||||
$job = BasicJob::getOne($params);
|
||||
if (empty($job)){
|
||||
return fail(HttpEnumCode::HTTP_ERROR,"职位选择错误");
|
||||
if (empty($job)) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "职位选择错误");
|
||||
}
|
||||
}
|
||||
|
||||
// 实人认证-生产环境开启
|
||||
|
||||
|
||||
$app_env = config('app_env','dev');
|
||||
if ($app_env != "dev"){
|
||||
$app_env = config('app_env', 'dev');
|
||||
if ($app_env != "dev") {
|
||||
$IdCard = new IdCard();
|
||||
|
||||
$params =array();
|
||||
$params = array();
|
||||
$params['name'] = $request_params['card_name'];
|
||||
$params['cardNo'] = $request_params['id_number'];
|
||||
$res = $IdCard->checkIdCard($params);
|
||||
if (!empty($res)){
|
||||
return fail(HttpEnumCode::HTTP_ERROR,$res);
|
||||
if (!empty($res)) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, $res);
|
||||
}
|
||||
}
|
||||
|
||||
@ -185,8 +186,8 @@ class PatientFamilyService extends BaseService
|
||||
// 新增 患者家庭成员信息表-基本信息(patient_family)
|
||||
$data = array();
|
||||
$data['patient_id'] = $user_info['client_user_id'];
|
||||
if (isset($request_params['relation'])){
|
||||
if ($request_params['relation'] != null){
|
||||
if (isset($request_params['relation'])) {
|
||||
if ($request_params['relation'] != null) {
|
||||
$data['relation'] = $request_params['relation'];
|
||||
}
|
||||
}
|
||||
@ -214,26 +215,26 @@ class PatientFamilyService extends BaseService
|
||||
$data['county'] = $area['county']['area_name'] ?? "";
|
||||
}
|
||||
|
||||
if (!empty($request_params['height'])){
|
||||
if (!empty($request_params['height'])) {
|
||||
$data['height'] = $request_params['height'];
|
||||
}
|
||||
|
||||
if (!empty($request_params['weight'])){
|
||||
if (!empty($request_params['weight'])) {
|
||||
$data['weight'] = $request_params['weight'];
|
||||
}
|
||||
|
||||
if (isset($request_params['marital_status'])){
|
||||
if ($request_params['marital_status'] !== null){
|
||||
if (isset($request_params['marital_status'])) {
|
||||
if ($request_params['marital_status'] !== null) {
|
||||
$data['marital_status'] = $request_params['marital_status'];
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($request_params['nation_id'])){
|
||||
if (!empty($request_params['nation_id'])) {
|
||||
$data['nation_id'] = $request_params['nation_id'];
|
||||
$data['nation_name'] = $nation['nation_name'];
|
||||
}
|
||||
|
||||
if (!empty($request_params['job_id'])){
|
||||
if (!empty($request_params['job_id'])) {
|
||||
$data['job_id'] = $request_params['job_id'];
|
||||
$data['job_name'] = $job['job_name'];
|
||||
}
|
||||
@ -311,7 +312,7 @@ class PatientFamilyService extends BaseService
|
||||
$params['status'] = 1;
|
||||
|
||||
$patient_family = PatientFamilyModel::getOne($params);
|
||||
if (empty($patient_family)){
|
||||
if (empty($patient_family)) {
|
||||
return success();
|
||||
}
|
||||
|
||||
@ -349,7 +350,7 @@ class PatientFamilyService extends BaseService
|
||||
$patient_familys = PatientFamilyModel::getList($params);
|
||||
if (!empty($patient_familys)) {
|
||||
foreach ($patient_familys as $value) {
|
||||
if ($value['family_id'] == $family_id){
|
||||
if ($value['family_id'] == $family_id) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -382,21 +383,21 @@ class PatientFamilyService extends BaseService
|
||||
}
|
||||
|
||||
// 检测省市区
|
||||
if (isset($request_params['province_id']) && isset($request_params['city_id']) && isset($request_params['county_id'])){
|
||||
if ($request_params['province_id'] != $patient_family['province_id'] || $request_params['city_id'] != $patient_family['city_id'] || $request_params['county_id'] != $patient_family['county_id']){
|
||||
if (isset($request_params['province_id']) && isset($request_params['city_id']) && isset($request_params['county_id'])) {
|
||||
if ($request_params['province_id'] != $patient_family['province_id'] || $request_params['city_id'] != $patient_family['city_id'] || $request_params['county_id'] != $patient_family['county_id']) {
|
||||
$areaService = new AreaService();
|
||||
|
||||
$req = $areaService->checkAreaById($request_params['province_id'],$request_params['city_id'],$request_params['county_id']);
|
||||
if(empty($req)){
|
||||
return fail(HttpEnumCode::HTTP_ERROR,"地区选择错误");
|
||||
$req = $areaService->checkAreaById($request_params['province_id'], $request_params['city_id'], $request_params['county_id']);
|
||||
if (empty($req)) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "地区选择错误");
|
||||
}
|
||||
|
||||
$area = $areaService->getAreaById($request_params['province_id'],$request_params['city_id'],$request_params['county_id']);
|
||||
$area = $areaService->getAreaById($request_params['province_id'], $request_params['city_id'], $request_params['county_id']);
|
||||
}
|
||||
}
|
||||
|
||||
// 检测证件号是否修改
|
||||
if ($patient_family['id_number'] != $request_params['id_number'] || $patient_family['card_name'] != $request_params['card_name']){
|
||||
if ($patient_family['id_number'] != $request_params['id_number'] || $patient_family['card_name'] != $request_params['card_name']) {
|
||||
// 解析年龄、性别字段
|
||||
$age = getIdCardAge($this->request->input('id_number'));
|
||||
|
||||
@ -415,25 +416,25 @@ class PatientFamilyService extends BaseService
|
||||
}
|
||||
|
||||
// 民族
|
||||
if (!empty($request_params['nation_id'])){
|
||||
if ($patient_family['nation_id'] != $request_params['nation_id']){
|
||||
if (!empty($request_params['nation_id'])) {
|
||||
if ($patient_family['nation_id'] != $request_params['nation_id']) {
|
||||
$params = array();
|
||||
$params['nation_id'] = $request_params['nation_id'];
|
||||
$nation = BasicNation::getOne($params);
|
||||
if (empty($nation)){
|
||||
return fail(HttpEnumCode::HTTP_ERROR,"民族选择错误");
|
||||
if (empty($nation)) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "民族选择错误");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 职业
|
||||
if (!empty($request_params['job_id'])){
|
||||
if ($patient_family['job_id'] != $request_params['job_id']){
|
||||
if (!empty($request_params['job_id'])) {
|
||||
if ($patient_family['job_id'] != $request_params['job_id']) {
|
||||
$params = array();
|
||||
$params['job_id'] = $request_params['job_id'];
|
||||
$job = BasicJob::getOne($params);
|
||||
if (empty($job)){
|
||||
return fail(HttpEnumCode::HTTP_ERROR,"职位选择错误");
|
||||
if (empty($job)) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "职位选择错误");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -458,13 +459,13 @@ class PatientFamilyService extends BaseService
|
||||
|
||||
$data = array();
|
||||
if (isset($request_params['relation'])) {
|
||||
if ($request_params['relation'] != $patient_family['relation']){
|
||||
if ($request_params['relation'] != $patient_family['relation']) {
|
||||
$data['relation'] = $request_params['relation'];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($request_params['is_default'])) {
|
||||
if ($request_params['is_default'] !== $patient_family['is_default']){
|
||||
if ($request_params['is_default'] !== $patient_family['is_default']) {
|
||||
$data['is_default'] = $request_params['is_default'];
|
||||
}
|
||||
}
|
||||
@ -477,7 +478,7 @@ class PatientFamilyService extends BaseService
|
||||
$data['id_number_mask'] = Mask::maskIdCard($request_params['id_number']);
|
||||
}
|
||||
|
||||
if(isset($request_params['mobile'])){
|
||||
if (isset($request_params['mobile'])) {
|
||||
if ($patient_family['mobile'] != $request_params['mobile']) {
|
||||
$data['mobile'] = $request_params['mobile'];
|
||||
$data['mobile_mask'] = Mask::maskPhoneStr($request_params['mobile']);
|
||||
@ -494,55 +495,55 @@ class PatientFamilyService extends BaseService
|
||||
|
||||
if (isset($area)) {
|
||||
// 如有改动,变量确定存在
|
||||
if ($request_params['province_id'] != $patient_family['province_id']){
|
||||
if ($request_params['province_id'] != $patient_family['province_id']) {
|
||||
$data['province_id'] = $request_params['province_id'];
|
||||
$data['province'] = $area['province']['area_name'] ?? "";
|
||||
}
|
||||
|
||||
if ($request_params['city_id'] != $patient_family['city_id']){
|
||||
if ($request_params['city_id'] != $patient_family['city_id']) {
|
||||
$data['city_id'] = $request_params['city_id'];
|
||||
$data['city'] = $area['city']['area_name'] ?? "";
|
||||
}
|
||||
|
||||
if ($request_params['county_id'] != $patient_family['county_id']){
|
||||
if ($request_params['county_id'] != $patient_family['county_id']) {
|
||||
$data['county_id'] = $request_params['county_id'];
|
||||
$data['county'] = $area['county']['area_name'] ?? "";
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($request_params['height'])){
|
||||
if ($request_params['height'] != $patient_family['height']){
|
||||
if (isset($request_params['height'])) {
|
||||
if ($request_params['height'] != $patient_family['height']) {
|
||||
$data['height'] = $request_params['height'];
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($request_params['weight'])){
|
||||
if ($request_params['weight'] != $patient_family['weight']){
|
||||
if (isset($request_params['weight'])) {
|
||||
if ($request_params['weight'] != $patient_family['weight']) {
|
||||
$data['weight'] = $request_params['weight'];
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($request_params['marital_status'])){
|
||||
if ($request_params['marital_status'] !== $patient_family['marital_status']){
|
||||
if (isset($request_params['marital_status'])) {
|
||||
if ($request_params['marital_status'] !== $patient_family['marital_status']) {
|
||||
$data['marital_status'] = $request_params['marital_status'];
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($request_params['nation_id'])){
|
||||
if ($request_params['nation_id'] != $patient_family['nation_id']){
|
||||
if (isset($request_params['nation_id'])) {
|
||||
if ($request_params['nation_id'] != $patient_family['nation_id']) {
|
||||
$data['nation_id'] = $request_params['nation_id'];
|
||||
$data['nation_name'] = $nation['nation_name'];
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($request_params['job_id'])){
|
||||
if ($request_params['job_id'] != $patient_family['job_id']){
|
||||
if (isset($request_params['job_id'])) {
|
||||
if ($request_params['job_id'] != $patient_family['job_id']) {
|
||||
$data['job_id'] = $request_params['job_id'];
|
||||
$data['job_name'] = $job['job_name'];
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($data)){
|
||||
if (!empty($data)) {
|
||||
$data['updated_at'] = date('Y-m-d H:i:s', time());
|
||||
PatientFamilyModel::edit($params, $data);
|
||||
}
|
||||
@ -572,7 +573,7 @@ class PatientFamilyService extends BaseService
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$patient_family_personal = PatientFamilyPersonalModel::getOne($params);
|
||||
|
||||
if (empty($patient_family_personal)){
|
||||
if (empty($patient_family_personal)) {
|
||||
return success();
|
||||
}
|
||||
|
||||
@ -600,76 +601,76 @@ class PatientFamilyService extends BaseService
|
||||
|
||||
// 修改
|
||||
$data = array();
|
||||
if (isset($request_params['is_allergy_history'])){
|
||||
if ($request_params['is_allergy_history'] !== $patient_family_personal['is_allergy_history']){
|
||||
if (isset($request_params['is_allergy_history'])) {
|
||||
if ($request_params['is_allergy_history'] !== $patient_family_personal['is_allergy_history']) {
|
||||
// 是否存在过敏史(0:否 1:是)
|
||||
$data['is_allergy_history'] = $request_params['is_allergy_history'];
|
||||
}
|
||||
|
||||
if ($request_params['allergy_history'] != $patient_family_personal['allergy_history']){
|
||||
if ($request_params['allergy_history'] != $patient_family_personal['allergy_history']) {
|
||||
$data['allergy_history'] = $request_params['allergy_history'];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($request_params['is_family_history'])){
|
||||
if ($request_params['is_family_history'] !== $patient_family_personal['is_family_history']){
|
||||
if (isset($request_params['is_family_history'])) {
|
||||
if ($request_params['is_family_history'] !== $patient_family_personal['is_family_history']) {
|
||||
// 是否存在家族病史(0:否 1:是)
|
||||
$data['is_family_history'] = $request_params['is_family_history'];
|
||||
}
|
||||
|
||||
if ($request_params['family_history'] != $patient_family_personal['family_history']){
|
||||
if ($request_params['family_history'] != $patient_family_personal['family_history']) {
|
||||
$data['family_history'] = $request_params['family_history'];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($request_params['is_pregnant'])){
|
||||
if ($request_params['is_pregnant'] !== $patient_family_personal['is_pregnant']){
|
||||
if (isset($request_params['is_pregnant'])) {
|
||||
if ($request_params['is_pregnant'] !== $patient_family_personal['is_pregnant']) {
|
||||
// 是否备孕、妊娠、哺乳期(0:否 1:是)
|
||||
$data['is_pregnant'] = $request_params['is_pregnant'];
|
||||
}
|
||||
|
||||
if ($request_params['pregnant'] != $patient_family_personal['pregnant']){
|
||||
if ($request_params['pregnant'] != $patient_family_personal['pregnant']) {
|
||||
$data['pregnant'] = $request_params['pregnant'];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($request_params['is_operation'])){
|
||||
if ($request_params['is_operation'] !== $patient_family_personal['is_operation']){
|
||||
if (isset($request_params['is_operation'])) {
|
||||
if ($request_params['is_operation'] !== $patient_family_personal['is_operation']) {
|
||||
// 是否存在手术(0:否 1:是)
|
||||
$data['is_operation'] = $request_params['is_operation'];
|
||||
}
|
||||
|
||||
if ($request_params['operation'] != $patient_family_personal['operation']){
|
||||
if ($request_params['operation'] != $patient_family_personal['operation']) {
|
||||
$data['operation'] = $request_params['operation'];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($request_params['drink_wine_status'])){
|
||||
if ($request_params['drink_wine_status'] !== $patient_family_personal['drink_wine_status']){
|
||||
if (isset($request_params['drink_wine_status'])) {
|
||||
if ($request_params['drink_wine_status'] !== $patient_family_personal['drink_wine_status']) {
|
||||
// 饮酒状态(1:从不 2:偶尔 3:经常 4:每天 5:已戒酒)
|
||||
$data['drink_wine_status'] = $request_params['drink_wine_status'];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($request_params['smoke_status'])){
|
||||
if ($request_params['smoke_status'] !== $patient_family_personal['smoke_status']){
|
||||
if (isset($request_params['smoke_status'])) {
|
||||
if ($request_params['smoke_status'] !== $patient_family_personal['smoke_status']) {
|
||||
// 吸烟状态(1:从不 2:偶尔 3:经常 4:每天 5:已戒烟)
|
||||
$data['smoke_status'] = $request_params['smoke_status'];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($request_params['chemical_compound_status'])){
|
||||
if ($request_params['chemical_compound_status'] !== $patient_family_personal['chemical_compound_status']){
|
||||
if (isset($request_params['chemical_compound_status'])) {
|
||||
if ($request_params['chemical_compound_status'] !== $patient_family_personal['chemical_compound_status']) {
|
||||
// 化合物状态(1:从不 2:偶尔 3:经常 4:每天)
|
||||
$data['chemical_compound_status'] = $request_params['chemical_compound_status'];
|
||||
}
|
||||
|
||||
if ($request_params['chemical_compound_describe'] != $patient_family_personal['chemical_compound_describe']){
|
||||
if ($request_params['chemical_compound_describe'] != $patient_family_personal['chemical_compound_describe']) {
|
||||
$data['chemical_compound_describe'] = $request_params['chemical_compound_describe'];
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($data)){
|
||||
if (!empty($data)) {
|
||||
$data['updated_at'] = date('Y-m-d H:i:s', time());
|
||||
$params = array();
|
||||
$params['family_personal_id'] = $patient_family_personal['family_personal_id'];
|
||||
@ -710,50 +711,50 @@ class PatientFamilyService extends BaseService
|
||||
$data = array();
|
||||
$data['family_id'] = $request_params['family_id'];
|
||||
$data['patient_id'] = $user_info['client_user_id'];
|
||||
if (isset($request_params['is_allergy_history'])){
|
||||
if ($request_params['is_allergy_history'] !== null){
|
||||
if (isset($request_params['is_allergy_history'])) {
|
||||
if ($request_params['is_allergy_history'] !== null) {
|
||||
$data['is_allergy_history'] = $request_params['is_allergy_history'];
|
||||
$data['allergy_history'] = $request_params['allergy_history'] ?? "";
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($request_params['is_family_history'])){
|
||||
if ($request_params['is_family_history'] !== null){
|
||||
if (isset($request_params['is_family_history'])) {
|
||||
if ($request_params['is_family_history'] !== null) {
|
||||
$data['is_family_history'] = $request_params['is_family_history'];
|
||||
$data['family_history'] = $request_params['family_history'] ?? "";
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($request_params['is_pregnant'])){
|
||||
if ($request_params['is_pregnant'] !== null){
|
||||
if (isset($request_params['is_pregnant'])) {
|
||||
if ($request_params['is_pregnant'] !== null) {
|
||||
$data['is_pregnant'] = $request_params['is_pregnant'];
|
||||
$data['pregnant'] = $request_params['pregnant'] ?? "";
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($request_params['is_operation'])){
|
||||
if ($request_params['is_operation'] !== null){
|
||||
if (isset($request_params['is_operation'])) {
|
||||
if ($request_params['is_operation'] !== null) {
|
||||
$data['is_operation'] = $request_params['is_operation'];
|
||||
$data['operation'] = $request_params['operation'] ?? "";
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($request_params['drink_wine_status'])){
|
||||
if ($request_params['drink_wine_status'] !== null){
|
||||
if (isset($request_params['drink_wine_status'])) {
|
||||
if ($request_params['drink_wine_status'] !== null) {
|
||||
$data['drink_wine_status'] = $request_params['drink_wine_status'];
|
||||
$data['smoke_status'] = $request_params['smoke_status'] ?? "";
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($request_params['chemical_compound_status'])){
|
||||
if ($request_params['chemical_compound_status'] !== null){
|
||||
if (isset($request_params['chemical_compound_status'])) {
|
||||
if ($request_params['chemical_compound_status'] !== null) {
|
||||
$data['chemical_compound_status'] = $request_params['chemical_compound_status'];
|
||||
$data['chemical_compound_describe'] = $request_params['chemical_compound_describe'];
|
||||
}
|
||||
}
|
||||
|
||||
$patient_family_personal = PatientFamilyPersonalModel::addPatientFamilyPersonal($data);
|
||||
if (empty($patient_family_personal)){
|
||||
if (empty($patient_family_personal)) {
|
||||
return fail();
|
||||
}
|
||||
|
||||
@ -774,7 +775,7 @@ class PatientFamilyService extends BaseService
|
||||
$params['family_id'] = $family_id;
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$patient_family_health = PatientFamilyHealth::getOne($params);
|
||||
if (empty($patient_family_health)){
|
||||
if (empty($patient_family_health)) {
|
||||
return success();
|
||||
}
|
||||
|
||||
@ -801,8 +802,8 @@ class PatientFamilyService extends BaseService
|
||||
}
|
||||
|
||||
$data = array();
|
||||
if (isset($request_params['disease_class_id'])){
|
||||
if ($request_params['disease_class_id'] != $patient_family_health['disease_class_id']){
|
||||
if (isset($request_params['disease_class_id'])) {
|
||||
if ($request_params['disease_class_id'] != $patient_family_health['disease_class_id']) {
|
||||
// 疾病分类id-系统
|
||||
$data['disease_class_id'] = $request_params['disease_class_id'];
|
||||
|
||||
@ -810,43 +811,43 @@ class PatientFamilyService extends BaseService
|
||||
$params = array();
|
||||
$params['disease_class_id'] = $request_params['disease_class_id'];
|
||||
$disease_class = DiseaseClass::getOne($params);
|
||||
if (empty($disease_class)){
|
||||
return fail(HttpEnumCode::HTTP_ERROR,"疾病数据错误");
|
||||
if (empty($disease_class)) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "疾病数据错误");
|
||||
}
|
||||
|
||||
$data['disease_class_name'] = $disease_class['disease_class_name'];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($request_params['diagnosis_date'])){
|
||||
if ($request_params['diagnosis_date'] != $patient_family_health['diagnosis_date']){
|
||||
if (isset($request_params['diagnosis_date'])) {
|
||||
if ($request_params['diagnosis_date'] != $patient_family_health['diagnosis_date']) {
|
||||
$data['diagnosis_date'] = $request_params['diagnosis_date'];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($request_params['diagnosis_hospital'])){
|
||||
if ($request_params['diagnosis_hospital'] != $patient_family_health['diagnosis_hospital']){
|
||||
if (isset($request_params['diagnosis_hospital'])) {
|
||||
if ($request_params['diagnosis_hospital'] != $patient_family_health['diagnosis_hospital']) {
|
||||
$data['diagnosis_hospital'] = $request_params['diagnosis_hospital'];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($request_params['is_take_medicine'])){
|
||||
if ($request_params['is_take_medicine'] !== $patient_family_health['is_take_medicine']){
|
||||
if (isset($request_params['is_take_medicine'])) {
|
||||
if ($request_params['is_take_medicine'] !== $patient_family_health['is_take_medicine']) {
|
||||
$data['is_take_medicine'] = $request_params['is_take_medicine'];
|
||||
|
||||
if ($request_params['drugs_name'] != $patient_family_health['drugs_name']){
|
||||
if ($request_params['drugs_name'] != $patient_family_health['drugs_name']) {
|
||||
$data['drugs_name'] = $request_params['drugs_name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($data)){
|
||||
if (!empty($data)) {
|
||||
$data['updated_at'] = date('Y-m-d H:i:s', time());
|
||||
|
||||
$params = array();
|
||||
$params['family_health_id'] = $patient_family_health['family_health_id'];
|
||||
|
||||
PatientFamilyHealth::edit($params,$data);
|
||||
PatientFamilyHealth::edit($params, $data);
|
||||
}
|
||||
|
||||
return success();
|
||||
@ -883,8 +884,8 @@ class PatientFamilyService extends BaseService
|
||||
$data['family_id'] = $request_params['family_id'];
|
||||
$data['patient_id'] = $user_info['client_user_id'];
|
||||
|
||||
if (isset($request_params['disease_class_id'])){
|
||||
if (!empty($request_params['disease_class_id'])){
|
||||
if (isset($request_params['disease_class_id'])) {
|
||||
if (!empty($request_params['disease_class_id'])) {
|
||||
// 疾病分类id-系统
|
||||
$data['disease_class_id'] = $request_params['disease_class_id'];
|
||||
|
||||
@ -892,35 +893,35 @@ class PatientFamilyService extends BaseService
|
||||
$params = array();
|
||||
$params['disease_class_id'] = $request_params['disease_class_id'];
|
||||
$disease_class = DiseaseClass::getOne($params);
|
||||
if (empty($disease_class)){
|
||||
return fail(HttpEnumCode::HTTP_ERROR,"疾病数据错误");
|
||||
if (empty($disease_class)) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "疾病数据错误");
|
||||
}
|
||||
|
||||
$data['disease_class_name'] = $disease_class['disease_class_name'];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($request_params['diagnosis_date'])){
|
||||
if (!empty($request_params['diagnosis_date'])){
|
||||
if (isset($request_params['diagnosis_date'])) {
|
||||
if (!empty($request_params['diagnosis_date'])) {
|
||||
$data['diagnosis_date'] = $request_params['diagnosis_date'];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($request_params['diagnosis_hospital'])){
|
||||
if (!empty($request_params['diagnosis_hospital'])){
|
||||
if (isset($request_params['diagnosis_hospital'])) {
|
||||
if (!empty($request_params['diagnosis_hospital'])) {
|
||||
$data['diagnosis_hospital'] = $request_params['diagnosis_hospital'];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($request_params['is_take_medicine'])){
|
||||
if ($request_params['is_take_medicine'] !== null){
|
||||
if (isset($request_params['is_take_medicine'])) {
|
||||
if ($request_params['is_take_medicine'] !== null) {
|
||||
$data['is_take_medicine'] = $request_params['is_take_medicine'];
|
||||
$data['drugs_name'] = $request_params['drugs_name'] ?? "";
|
||||
}
|
||||
}
|
||||
|
||||
$patient_family_health = PatientFamilyHealth::addPatientFamilyHealth($data);
|
||||
if (empty($patient_family_health)){
|
||||
if (empty($patient_family_health)) {
|
||||
return fail();
|
||||
}
|
||||
|
||||
@ -935,13 +936,13 @@ class PatientFamilyService extends BaseService
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo");
|
||||
|
||||
$family_id = $this->request->input('family_id',0);
|
||||
$family_id = $this->request->input('family_id', 0);
|
||||
$page = $this->request->input('page', 1);
|
||||
$per_page = $this->request->input('per_page', 10);
|
||||
|
||||
$params = array();
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
if ($family_id != 0){
|
||||
if ($family_id != 0) {
|
||||
$params['family_id'] = $family_id;
|
||||
}
|
||||
|
||||
@ -956,11 +957,11 @@ class PatientFamilyService extends BaseService
|
||||
'created_at',
|
||||
];
|
||||
|
||||
$result = OrderProduct::getProductRecordPage($params,$fields,$page,$per_page);
|
||||
if (!empty($result['data'])){
|
||||
foreach ($result['data'] as &$item){
|
||||
if (!empty($item['OrderProductItem'])){
|
||||
foreach ($item['OrderProductItem'] as &$order_product_item){
|
||||
$result = OrderProduct::getProductRecordPage($params, $fields, $page, $per_page);
|
||||
if (!empty($result['data'])) {
|
||||
foreach ($result['data'] as &$item) {
|
||||
if (!empty($item['OrderProductItem'])) {
|
||||
foreach ($item['OrderProductItem'] as &$order_product_item) {
|
||||
$order_product_item['product_cover_img'] = addAliyunOssWebsite($order_product_item['product_cover_img']);
|
||||
}
|
||||
}
|
||||
@ -990,10 +991,17 @@ class PatientFamilyService extends BaseService
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$patient_family_personal = PatientFamilyPersonalModel::getOne($params);
|
||||
|
||||
if (empty($patient_family_health) && empty($patient_family_personal)){
|
||||
if (empty($patient_family_health) && empty($patient_family_personal)) {
|
||||
return success(null);
|
||||
}
|
||||
|
||||
// 获取病情记录
|
||||
$params = array();
|
||||
$params['user_id'] = $user_info['user_id'];
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$params['family_id'] = $family_id;
|
||||
$patient_pathography = PatientPathography::getLastOne($params);
|
||||
|
||||
$result = array();
|
||||
$result['user_id'] = $user_info['user_id'];
|
||||
$result['patient_id'] = $user_info['client_user_id'];
|
||||
@ -1007,24 +1015,32 @@ class PatientFamilyService extends BaseService
|
||||
$result['family_history'] = null; // 家族病史描述
|
||||
$result['is_pregnant'] = null; // 是否备孕、妊娠、哺乳期(0:否 1:是)
|
||||
$result['pregnant'] = null; // 备孕、妊娠、哺乳期描述
|
||||
$result['disease_desc'] = ""; // 病情描述(主诉)
|
||||
|
||||
if (!empty($patient_family_personal)){
|
||||
if ($patient_family_personal['is_allergy_history'] != 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){
|
||||
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){
|
||||
if ($patient_family_personal['is_pregnant'] != null) {
|
||||
$result['is_pregnant'] = (int)$patient_family_personal['is_pregnant']; // 是否备孕、妊娠、哺乳期(0:否 1:是)
|
||||
$result['pregnant'] = $patient_family_personal['pregnant']; // 备孕、妊娠、哺乳期描述
|
||||
}
|
||||
}
|
||||
|
||||
// 病情主诉
|
||||
if (!empty($patient_pathography)){
|
||||
if ($patient_pathography['disease_desc'] != null){
|
||||
$result['disease_desc'] = $patient_pathography['disease_desc']; // 病情描述(主诉)
|
||||
}
|
||||
}
|
||||
|
||||
return success($result);
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user