新增 删除家庭成员病情记录

This commit is contained in:
wucongxing 2023-11-22 15:15:53 +08:00
parent 8207d73fea
commit c03501b6b5
3 changed files with 50 additions and 0 deletions

View File

@ -69,4 +69,15 @@ class PatientPathographyController extends AbstractController
$data = $PatientPathographyService->getFamilyPathographyGroup();
return $this->response->json($data);
}
/**
* 删除家庭成员病情记录
* @return ResponseInterface
*/
public function deleteFamilyPathography(): ResponseInterface
{
$PatientPathographyService = new PatientPathographyService();
$data = $PatientPathographyService->deleteFamilyPathography();
return $this->response->json($data);
}
}

View File

@ -192,4 +192,40 @@ class PatientPathographyService extends BaseService
return success($patient_pathographys->toArray());
}
/**
* 删除家庭成员病情记录
* @return array
*/
public function deleteFamilyPathography(): array
{
$user_info = $this->request->getAttribute("userInfo") ?? [];
$pathography_id = $this->request->route('pathography_id');
// 获取病情记录
$params = array();
$params['user_id'] = $user_info['user_id'];
$params['patient_id'] = $user_info['client_user_id'];
$params['pathography_id'] = $pathography_id;
$patient_pathography = PatientPathography::getOne($params);
if (empty($patient_pathography)){
return fail(HttpEnumCode::HTTP_ERROR,"无该病例");
}
if ($patient_pathography['status'] == 2){
return success();
}
$params = array();
$params['pathography_id'] = $patient_pathography['pathography_id'];
$data = array();
$data['status'] = 2;
$res = PatientPathography::edit($params,$data);
if (!$res){
return fail();
}
return success();
}
}

View File

@ -502,6 +502,9 @@ Router::addGroup('/patient', function () {
// 获取家庭成员病情记录分组
Router::get('/group', [PatientPathographyController::class, 'getFamilyPathographyGroup']);
// 删除家庭成员病情记录
Router::delete('/{pathography_id:\d+}', [PatientPathographyController::class, 'deleteFamilyPathography']);
});
});