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

This commit is contained in:
2023-11-22 12:03:36 +08:00
parent 45e4fa886b
commit 8207d73fea
5 changed files with 71 additions and 10 deletions
@@ -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());
}
}