Commit 4f5a3b3b37d13f71d745d7bfea0771fc09187b91
1 parent
5084fa4f00
Exists in
master
and in
6 other branches
听力诊断模块
Showing 1 changed file with 43 additions and 14 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientServiceFacade.java
View file @
4f5a3b3
| ... | ... | @@ -14,6 +14,7 @@ |
| 14 | 14 | import com.lyms.platform.permission.service.OrganizationService; |
| 15 | 15 | import com.lyms.platform.permission.service.PatientServiceService; |
| 16 | 16 | import com.lyms.platform.permission.service.UsersService; |
| 17 | +import org.apache.commons.collections.CollectionUtils; | |
| 17 | 18 | import org.springframework.beans.factory.annotation.Autowired; |
| 18 | 19 | import org.springframework.stereotype.Component; |
| 19 | 20 | |
| ... | ... | @@ -47,6 +48,7 @@ |
| 47 | 48 | |
| 48 | 49 | /** |
| 49 | 50 | * 根据孕妇id查询服务记录 |
| 51 | + * | |
| 50 | 52 | * @param pid |
| 51 | 53 | * @param id |
| 52 | 54 | * @return |
| ... | ... | @@ -61,7 +63,7 @@ |
| 61 | 63 | List<PatientService> patientServices = patientServiceService.queryPatientService(patientQuery); |
| 62 | 64 | |
| 63 | 65 | List<PatientSerResult> patientSerResults = new ArrayList<>(); |
| 64 | - for(PatientService ps : patientServices){ | |
| 66 | + for (PatientService ps : patientServices) { | |
| 65 | 67 | PatientSerResult patientSerResult = convertToResult(ps); |
| 66 | 68 | patientSerResults.add(patientSerResult); |
| 67 | 69 | } |
| ... | ... | @@ -75,6 +77,7 @@ |
| 75 | 77 | |
| 76 | 78 | /** |
| 77 | 79 | * 根据id查询一条服务开通记录 |
| 80 | + * | |
| 78 | 81 | * @param id |
| 79 | 82 | * @return |
| 80 | 83 | */ |
| 81 | 84 | |
| 82 | 85 | |
| ... | ... | @@ -91,14 +94,37 @@ |
| 91 | 94 | |
| 92 | 95 | /** |
| 93 | 96 | * 新增服务开通记录 |
| 97 | + * | |
| 94 | 98 | * @param ps |
| 95 | 99 | * @param id |
| 96 | 100 | * @return |
| 97 | 101 | */ |
| 98 | - public BaseResponse addPatientService(PatientService ps, Integer id){ | |
| 102 | + public BaseResponse addPatientService(PatientService ps, Integer id) { | |
| 99 | 103 | //根据用户id获取医院ID |
| 100 | 104 | String hospitalId = autoMatchFacade.getHospitalId(id); |
| 101 | - ps.setId(UUID.randomUUID().toString().replace("-","")); | |
| 105 | + | |
| 106 | + //先根据孕妇id和开通服务类型、开通医生进行查询,如果已经开通过则开通失败 | |
| 107 | + PatientServiceQuery patientQuery = new PatientServiceQuery(); | |
| 108 | + patientQuery.setHospitalId(hospitalId); | |
| 109 | + patientQuery.setParentid(ps.getParentid()); | |
| 110 | + patientQuery.setSerType(ps.getSerType()); | |
| 111 | + patientQuery.setSerDoct(ps.getSerDoct()); | |
| 112 | + | |
| 113 | + List<PatientService> patientServices = patientServiceService.queryPatientService(patientQuery); | |
| 114 | + if (CollectionUtils.isNotEmpty(patientServices)) { | |
| 115 | + BaseResponse baseResponse = new BaseResponse(); | |
| 116 | + baseResponse.setErrorcode(ErrorCodeConstants.DATA_EXIST); | |
| 117 | + String serType = PatientSerEnums.SerTypeEnums.getTitle(ps.getSerType()); | |
| 118 | + String serDoct = "产检医生"; | |
| 119 | + Users users = usersService.getUsers(Integer.parseInt(ps.getSerDoct())); | |
| 120 | + if (users != null) { | |
| 121 | + serDoct = users.getName(); | |
| 122 | + } | |
| 123 | + baseResponse.setErrormsg("该孕妇已开通"+serDoct+"医生的" + serType + "服务,请勿重复开通"); | |
| 124 | + return baseResponse; | |
| 125 | + } | |
| 126 | + | |
| 127 | + ps.setId(UUID.randomUUID().toString().replace("-", "")); | |
| 102 | 128 | ps.setHospitalId(hospitalId); |
| 103 | 129 | ps.setCreateDate(new Date()); |
| 104 | 130 | ps.setCreateUser(String.valueOf(id)); |
| 105 | 131 | |
| ... | ... | @@ -113,11 +139,12 @@ |
| 113 | 139 | |
| 114 | 140 | /** |
| 115 | 141 | * 修改服务开通记录 |
| 142 | + * | |
| 116 | 143 | * @param ps 服务对象 |
| 117 | 144 | * @param id 用户id |
| 118 | 145 | * @return |
| 119 | 146 | */ |
| 120 | - public BaseResponse updatePatientService(PatientService ps,Integer id){ | |
| 147 | + public BaseResponse updatePatientService(PatientService ps, Integer id) { | |
| 121 | 148 | //根据用户id获取医院ID |
| 122 | 149 | ps.setUpdateDate(new Date()); |
| 123 | 150 | ps.setUpdateUser(String.valueOf(id)); |
| 124 | 151 | |
| ... | ... | @@ -131,11 +158,12 @@ |
| 131 | 158 | |
| 132 | 159 | /** |
| 133 | 160 | * 数据转换 |
| 161 | + * | |
| 134 | 162 | * @param ps |
| 135 | 163 | * @return |
| 136 | 164 | */ |
| 137 | - public PatientSerResult convertToResult(PatientService ps){ | |
| 138 | - if(ps==null){ | |
| 165 | + public PatientSerResult convertToResult(PatientService ps) { | |
| 166 | + if (ps == null) { | |
| 139 | 167 | return null; |
| 140 | 168 | } |
| 141 | 169 | PatientSerResult result = new PatientSerResult(); |
| 142 | 170 | |
| 143 | 171 | |
| ... | ... | @@ -163,15 +191,16 @@ |
| 163 | 191 | |
| 164 | 192 | /** |
| 165 | 193 | * 根据条件查询开通服务记录 |
| 166 | - * @param serType 服务类型(1-高危精准指导、2-体重、3-血糖、4-血压、5-专家咨询) | |
| 167 | - * @param serDoct 服务医生 | |
| 194 | + * | |
| 195 | + * @param serType 服务类型(1-高危精准指导、2-体重、3-血糖、4-血压、5-专家咨询) | |
| 196 | + * @param serDoct 服务医生 | |
| 168 | 197 | * @param createStartDate 开通开始时间 |
| 169 | - * @param createEndDate 开通结束时间 | |
| 170 | - * @param pageInfo 分页信息 | |
| 171 | - * @param serStatus 开通状态(1-开通、2-退订、3-过期、4-暂停) | |
| 198 | + * @param createEndDate 开通结束时间 | |
| 199 | + * @param pageInfo 分页信息 | |
| 200 | + * @param serStatus 开通状态(1-开通、2-退订、3-过期、4-暂停) | |
| 172 | 201 | * @return |
| 173 | 202 | */ |
| 174 | - public BaseListResponse getPatientService(Integer serType, String serDoct, Date createStartDate, Date createEndDate, Integer serStatus, BasePageQueryRequest pageInfo,Integer id) { | |
| 203 | + public BaseListResponse getPatientService(Integer serType, String serDoct, Date createStartDate, Date createEndDate, Integer serStatus, BasePageQueryRequest pageInfo, Integer id) { | |
| 175 | 204 | //根据用户id获取医院ID |
| 176 | 205 | String hospitalId = autoMatchFacade.getHospitalId(id); |
| 177 | 206 | PatientServiceQuery patientQuery = new PatientServiceQuery(); |
| 178 | 207 | |
| ... | ... | @@ -183,13 +212,13 @@ |
| 183 | 212 | patientQuery.setSerStatus(serStatus); |
| 184 | 213 | patientQuery.setSort("create_date"); |
| 185 | 214 | patientQuery.setNeed("y"); |
| 186 | - patientQuery.setOffset((pageInfo.getPage()-1)*pageInfo.getLimit()); | |
| 215 | + patientQuery.setOffset((pageInfo.getPage() - 1) * pageInfo.getLimit()); | |
| 187 | 216 | patientQuery.setLimit(pageInfo.getLimit()); |
| 188 | 217 | patientQuery.setPage(pageInfo.getPage()); |
| 189 | 218 | List<PatientService> patientServices = patientServiceService.queryPatientService(patientQuery); |
| 190 | 219 | |
| 191 | 220 | List<PatientSerResult> patientSerResults = new ArrayList<>(); |
| 192 | - for(PatientService ps : patientServices){ | |
| 221 | + for (PatientService ps : patientServices) { | |
| 193 | 222 | PatientSerResult patientSerResult = convertToResult(ps); |
| 194 | 223 | patientSerResults.add(patientSerResult); |
| 195 | 224 | } |