新增 获取家庭成员病情记录分组
This commit is contained in:
parent
45e4fa886b
commit
8207d73fea
@ -58,4 +58,15 @@ class PatientPathographyController extends AbstractController
|
||||
$data = $PatientPathographyService->getFamilyPathographyInfo();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取家庭成员病情记录分组
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getFamilyPathographyGroup(): ResponseInterface
|
||||
{
|
||||
$PatientPathographyService = new PatientPathographyService();
|
||||
$data = $PatientPathographyService->getFamilyPathographyGroup();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
}
|
||||
@ -7,6 +7,7 @@ namespace App\Model;
|
||||
|
||||
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\DbConnection\Db;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
@ -144,4 +145,12 @@ class PatientPathography extends Model
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
// 获取信息-分组
|
||||
public static function getFamilyPathographyGroup(array $params, array $fields = ['*']): object|null
|
||||
{
|
||||
return self::where($params)
|
||||
->groupBy(["family_id"])
|
||||
->get($fields);
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,6 +14,9 @@ class PatientPathographyRequest extends FormRequest
|
||||
'getFamilyPathographyPage' => [ // 获取家庭成员病情记录列表-分页
|
||||
'family_id',
|
||||
],
|
||||
'getFamilyPathographyGroup' => [ // 获取家庭成员病情记录分组
|
||||
'family_id',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@ -11,6 +11,7 @@ use App\Model\PatientPathography;
|
||||
use App\Model\PatientPathographyProduct;
|
||||
use App\Model\Product;
|
||||
use App\Utils\PcreMatch;
|
||||
use Hyperf\DbConnection\Db;
|
||||
|
||||
/**
|
||||
* 家庭成员病情记录
|
||||
@ -34,6 +35,7 @@ class PatientPathographyService extends BaseService
|
||||
$params['user_id'] = $user_info['user_id'];
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$params['family_id'] = $family_id;
|
||||
$params['status'] = 1;
|
||||
$patient_pathography = PatientPathography::getLastOne($params);
|
||||
if (!empty($patient_pathography)){
|
||||
$result['is_exist'] = 1;
|
||||
@ -65,6 +67,7 @@ class PatientPathographyService extends BaseService
|
||||
$params['user_id'] = $user_info['user_id'];
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$params['family_id'] = $family_id;
|
||||
$params['status'] = 1;
|
||||
$patient_pathographys = PatientPathography::getPatientPathographyPage($params, $fields, $page, $per_page);
|
||||
|
||||
return success($patient_pathographys);
|
||||
@ -83,6 +86,7 @@ class PatientPathographyService extends BaseService
|
||||
$params['user_id'] = $user_info['user_id'];
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$params['pathography_id'] = $pathography_id;
|
||||
$params['status'] = 1;
|
||||
$patient_pathography = PatientPathography::getOne($params);
|
||||
if (empty($patient_pathography)){
|
||||
return success(null);
|
||||
@ -157,4 +161,35 @@ class PatientPathographyService extends BaseService
|
||||
|
||||
return success($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取家庭成员病情记录分组
|
||||
* @return array
|
||||
*/
|
||||
public function getFamilyPathographyGroup(): array
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
$fields = [
|
||||
"pathography_id",
|
||||
"user_id",
|
||||
"patient_id",
|
||||
"family_id",
|
||||
"status",
|
||||
"name",
|
||||
"sex",
|
||||
"age",
|
||||
Db::raw('COUNT(0) AS `count`')
|
||||
];
|
||||
$params = array();
|
||||
$params['user_id'] = $user_info['user_id'];
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$params['status'] = 1;
|
||||
$patient_pathographys = PatientPathography::getFamilyPathographyGroup($params,$fields);
|
||||
if (empty($patient_pathographys)){
|
||||
return success();
|
||||
}
|
||||
|
||||
return success($patient_pathographys->toArray());
|
||||
}
|
||||
}
|
||||
@ -382,17 +382,7 @@ Router::addGroup('/patient', function () {
|
||||
Router::get('/record', [PatientFamilyController::class, 'getFamilyProductRecord']);
|
||||
});
|
||||
|
||||
// 病情记录
|
||||
Router::addGroup('/pathography', function () {
|
||||
// 检测家庭成员是否存在病情记录
|
||||
Router::get('/exist', [PatientPathographyController::class, 'existFamilyPathography']);
|
||||
|
||||
// 获取家庭成员病情记录列表-分页
|
||||
Router::get('', [PatientPathographyController::class, 'getFamilyPathographyPage']);
|
||||
|
||||
// 获取家庭成员病情记录详情
|
||||
Router::get('/{pathography_id:\d+}', [PatientPathographyController::class, 'getFamilyPathographyInfo']);
|
||||
});
|
||||
});
|
||||
|
||||
// 药品
|
||||
@ -499,7 +489,20 @@ Router::addGroup('/patient', function () {
|
||||
Router::get('/system/last', [MessageNoticeController::class, 'getPatientMessageServiceLast']);
|
||||
});
|
||||
|
||||
// 病情记录
|
||||
Router::addGroup('/pathography', function () {
|
||||
// 检测家庭成员是否存在病情记录
|
||||
Router::get('/exist', [PatientPathographyController::class, 'existFamilyPathography']);
|
||||
|
||||
// 获取家庭成员病情记录列表-分页
|
||||
Router::get('', [PatientPathographyController::class, 'getFamilyPathographyPage']);
|
||||
|
||||
// 获取家庭成员病情记录详情
|
||||
Router::get('/{pathography_id:\d+}', [PatientPathographyController::class, 'getFamilyPathographyInfo']);
|
||||
|
||||
// 获取家庭成员病情记录分组
|
||||
Router::get('/group', [PatientPathographyController::class, 'getFamilyPathographyGroup']);
|
||||
});
|
||||
});
|
||||
|
||||
// 药师端api
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user