修改获取家庭成员病情记录分组为从家庭成员修改

This commit is contained in:
wucongxing 2023-12-18 11:32:46 +08:00
parent af4eb0ceaa
commit 1f1aa14804
3 changed files with 33 additions and 18 deletions

View File

@ -7,6 +7,7 @@ namespace App\Model;
use Hyperf\Database\Model\Collection;
use Hyperf\Database\Model\Relations\HasOne;
use Hyperf\Snowflake\Concern\Snowflake;
/**

View File

@ -229,27 +229,43 @@ class PatientPathographyService extends BaseService
{
$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)){
$patient_familys = PatientFamily::getList($params);
if (empty($patient_familys)){
return success();
}
return success($patient_pathographys->toArray());
// 定义返回数据
$results = array();
foreach ($patient_familys as $patient_family){
// 定义返回数据
$result = array();
$result['user_id'] = $user_info['user_id'];
$result['patient_id'] = $patient_family['patient_id'];
$result['family_id'] = $patient_family['family_id'];
$result['status'] = $patient_family['status'];
$result['card_name'] = $patient_family['card_name'];
$result['sex'] = $patient_family['sex'];
$result['age'] = $patient_family['age'];
$result['count'] = 0;
$params = array();
$params['user_id'] = $user_info['user_id'];
$params['patient_id'] = $patient_family['patient_id'];
$params['family_id'] = $patient_family['family_id'];
$params['status'] = 1;
$patient_pathographys = PatientPathography::getList($params);
if (!empty($patient_pathographys)){
$result['count'] = count($patient_pathographys);
}
$results[] = $result;
}
return success($results);
}
/**

View File

@ -377,8 +377,6 @@ Router::addGroup('/patient', function () {
// 获取家庭成员用药记录列表
Router::get('/record', [PatientFamilyController::class, 'getFamilyProductRecord']);
});
});
// 药品