Commit fc5156cf9951d298f0514a3eb76a96736322c1d4
1 parent
69cb5c2960
Exists in
master
and in
6 other branches
服务价格配置
Showing 3 changed files with 97 additions and 23 deletions
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ConfigServiceController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ConfigServiceFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/HospitalDoctSerResult.java
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ConfigServiceController.java
View file @
fc5156c
| ... | ... | @@ -10,6 +10,7 @@ |
| 10 | 10 | import com.lyms.platform.common.utils.StringUtils; |
| 11 | 11 | import com.lyms.platform.operate.web.facade.ConfigServiceFacade; |
| 12 | 12 | import com.lyms.platform.operate.web.utils.CollectionUtils; |
| 13 | +import com.lyms.platform.permission.model.HospitalDoctService; | |
| 13 | 14 | import com.lyms.platform.permission.model.HospitalServiceContent; |
| 14 | 15 | import com.lyms.platform.permission.model.Organization; |
| 15 | 16 | import com.lyms.platform.permission.model.OrganizationQuery; |
| 16 | 17 | |
| ... | ... | @@ -63,10 +64,10 @@ |
| 63 | 64 | @ResponseBody |
| 64 | 65 | @TokenRequired |
| 65 | 66 | @RequestMapping(value = "/addOrUpdateHospSer", method = RequestMethod.POST) |
| 66 | - public BaseResponse addOrUpdateHospitalService(HospitalServiceContent ps,HttpServletRequest request) { | |
| 67 | + public BaseResponse addOrUpdateHospitalService(HospitalServiceContent ps, HttpServletRequest request) { | |
| 67 | 68 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
| 68 | 69 | try { |
| 69 | - return configServiceFacade.addOrUpdateHospitalService(ps,loginState.getId()); | |
| 70 | + return configServiceFacade.addOrUpdateHospitalService(ps, loginState.getId()); | |
| 70 | 71 | } catch (Exception e) { |
| 71 | 72 | e.printStackTrace(); |
| 72 | 73 | BaseResponse baseResponse = new BaseResponse(); |
| 73 | 74 | |
| 74 | 75 | |
| 75 | 76 | |
| 76 | 77 | |
| ... | ... | @@ -76,28 +77,42 @@ |
| 76 | 77 | } |
| 77 | 78 | } |
| 78 | 79 | |
| 80 | + /** | |
| 81 | + * 新增或修改医生价格配置 | |
| 82 | + * | |
| 83 | + * @param hds 医生价格配置 | |
| 84 | + * @param request | |
| 85 | + * @return | |
| 86 | + */ | |
| 87 | + @ResponseBody | |
| 88 | + @TokenRequired | |
| 89 | + @RequestMapping(value = "/addOrUpdateHospDoctSer", method = RequestMethod.POST) | |
| 90 | + public BaseResponse addOrUpdateHosDoctService(HospitalDoctService hds, HttpServletRequest request) { | |
| 91 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
| 92 | + return configServiceFacade.addOrUpdateHosDoctService(hds, loginState.getId()); | |
| 93 | + } | |
| 79 | 94 | |
| 80 | 95 | |
| 81 | 96 | /** |
| 82 | 97 | * 新增或修改服务开通记录 |
| 83 | 98 | * |
| 84 | - * @param ps 服务开通记录 | |
| 85 | - * @param isAutoDoct 是否自动生成专家咨询的服务的数据 | |
| 86 | - * @param hospitalName 医院名称 | |
| 99 | + * @param ps 服务开通记录 | |
| 100 | + * @param isAutoDoct 是否自动生成专家咨询的服务的数据 | |
| 101 | + * @param hospitalName 医院名称 | |
| 87 | 102 | * @param request |
| 88 | 103 | * @return |
| 89 | 104 | */ |
| 90 | 105 | @ResponseBody |
| 91 | 106 | @TokenRequired |
| 92 | 107 | @RequestMapping(value = "/addOrUpdate", method = RequestMethod.POST) |
| 93 | - public BaseResponse addOrUpdatePatientService(HospitalServiceContent ps,String hospitalName,boolean isAutoDoct, HttpServletRequest request) { | |
| 108 | + public BaseResponse addOrUpdatePatientService(HospitalServiceContent ps, String hospitalName, boolean isAutoDoct, HttpServletRequest request) { | |
| 94 | 109 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
| 95 | 110 | |
| 96 | - if(StringUtils.isNotEmpty(hospitalName)){ | |
| 111 | + if (StringUtils.isNotEmpty(hospitalName)) { | |
| 97 | 112 | OrganizationQuery organizationQuery = new OrganizationQuery(); |
| 98 | 113 | organizationQuery.setName(hospitalName); |
| 99 | - List<Organization> organizations = organizationService.queryOrganization(organizationQuery); | |
| 100 | - if(CollectionUtils.isNotEmpty(organizations)){ | |
| 114 | + List<Organization> organizations = organizationService.queryOrganization(organizationQuery); | |
| 115 | + if (CollectionUtils.isNotEmpty(organizations)) { | |
| 101 | 116 | Organization organization = organizations.get(0); |
| 102 | 117 | ps.setHospitalId(String.valueOf(organization.getId())); |
| 103 | 118 | } |
| ... | ... | @@ -109,7 +124,7 @@ |
| 109 | 124 | if (baseResponse.getErrorcode() != ErrorCodeConstants.SUCCESS) { |
| 110 | 125 | return baseResponse; |
| 111 | 126 | } |
| 112 | - return configServiceFacade.addHospitalService(ps,isAutoDoct, loginState.getId()); | |
| 127 | + return configServiceFacade.addHospitalService(ps, isAutoDoct, loginState.getId()); | |
| 113 | 128 | } catch (Exception e) { |
| 114 | 129 | e.printStackTrace(); |
| 115 | 130 | BaseResponse baseResponse = new BaseResponse(); |
| 116 | 131 | |
| 117 | 132 | |
| ... | ... | @@ -160,18 +175,18 @@ |
| 160 | 175 | public BaseResponse validatePatient(HospitalServiceContent ps) { |
| 161 | 176 | BaseResponse baseResponse = new BaseResponse(); |
| 162 | 177 | //医院Id |
| 163 | - if(StringUtils.isEmpty(ps.getHospitalId())){ | |
| 178 | + if (StringUtils.isEmpty(ps.getHospitalId())) { | |
| 164 | 179 | baseResponse.setErrormsg("请传入hospitalId"); |
| 165 | 180 | baseResponse.setErrorcode(ErrorCodeConstants.PARAMETER_ERROR); |
| 166 | 181 | return baseResponse; |
| 167 | 182 | } |
| 168 | 183 | //服务价格 |
| 169 | - if(ps.getSerType()==null){ | |
| 184 | + if (ps.getSerType() == null) { | |
| 170 | 185 | baseResponse.setErrormsg("请传入serType:1-孕期精准医疗、2-体重管理、3-血糖管理、4-血压管理、5-专家咨询、6-标准服务"); |
| 171 | 186 | baseResponse.setErrorcode(ErrorCodeConstants.PARAMETER_ERROR); |
| 172 | 187 | return baseResponse; |
| 173 | 188 | } |
| 174 | - if(ps.getSerPrice()==null){ | |
| 189 | + if (ps.getSerPrice() == null) { | |
| 175 | 190 | baseResponse.setErrormsg("请传入serPrice服务价格"); |
| 176 | 191 | baseResponse.setErrorcode(ErrorCodeConstants.PARAMETER_ERROR); |
| 177 | 192 | return baseResponse; |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ConfigServiceFacade.java
View file @
fc5156c
| ... | ... | @@ -107,13 +107,13 @@ |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /** |
| 110 | - * 新增医院服务配置 | |
| 110 | + * 新增或修改医院服务配置 | |
| 111 | 111 | * |
| 112 | 112 | * @param ps |
| 113 | 113 | * @param userId 用户id |
| 114 | 114 | * @return |
| 115 | 115 | */ |
| 116 | - public BaseResponse addOrUpdateHospitalService(HospitalServiceContent ps,Integer userId) throws Exception { | |
| 116 | + public BaseResponse addOrUpdateHospitalService(HospitalServiceContent ps, Integer userId) throws Exception { | |
| 117 | 117 | BaseResponse baseResponse = new BaseResponse(); |
| 118 | 118 | |
| 119 | 119 | //根据用户id获取医院ID |
| ... | ... | @@ -125,6 +125,7 @@ |
| 125 | 125 | if (CollectionUtils.isNotEmpty(patientServices)) {//修改 |
| 126 | 126 | HospitalServiceContent hospitalServiceContent = patientServices.get(0); |
| 127 | 127 | hospitalServiceContent.setSyncStatus(0); |
| 128 | + hospitalServiceContent.setStatus(ps.getStatus()); | |
| 128 | 129 | hospitalServiceContent.setSerPrice(ps.getSerPrice()); |
| 129 | 130 | hospitalServiceContentService.updateHospitalServiceContent(hospitalServiceContent); |
| 130 | 131 | } else { |
| 131 | 132 | |
| ... | ... | @@ -218,15 +219,15 @@ |
| 218 | 219 | } |
| 219 | 220 | } |
| 220 | 221 | //存放医生列表,医生ID和医生姓名 |
| 221 | - Map<Integer,String> docterMap = new HashMap<>(); | |
| 222 | + Map<Integer, String> docterMap = new HashMap<>(); | |
| 222 | 223 | |
| 223 | 224 | if (CollectionUtils.isNotEmpty(doctIds)) { |
| 224 | 225 | UsersQuery usersQuery = new UsersQuery(); |
| 225 | 226 | usersQuery.setIds(doctIds); |
| 226 | 227 | List<Users> users = usersService.queryUsers(usersQuery); |
| 227 | - if(CollectionUtils.isNotEmpty(users)){ | |
| 228 | - for(Users us:users){ | |
| 229 | - docterMap.put(us.getId(),us.getName()); | |
| 228 | + if (CollectionUtils.isNotEmpty(users)) { | |
| 229 | + for (Users us : users) { | |
| 230 | + docterMap.put(us.getId(), us.getName()); | |
| 230 | 231 | } |
| 231 | 232 | } |
| 232 | 233 | } |
| 233 | 234 | |
| ... | ... | @@ -237,12 +238,13 @@ |
| 237 | 238 | result.setId(hs.getId()); |
| 238 | 239 | result.setDoctId(hs.getDoctId()); |
| 239 | 240 | result.setDoctPrice(hs.getDoctPrice()); |
| 241 | + result.setStatus(hs.getStatus()); | |
| 240 | 242 | if (StringUtils.isNum(hs.getDoctId())) { |
| 241 | 243 | result.setDoctName(docterMap.get(Integer.parseInt(hs.getDoctId()))); |
| 242 | 244 | } |
| 243 | 245 | |
| 244 | 246 | if (hs.getStatus() != null) { |
| 245 | - result.setStatus(HospitalSerStatusEnums.getNameById(hs.getStatus())); | |
| 247 | + result.setStatusName(HospitalSerStatusEnums.getNameById(hs.getStatus())); | |
| 246 | 248 | } |
| 247 | 249 | results.add(result); |
| 248 | 250 | } |
| ... | ... | @@ -351,5 +353,49 @@ |
| 351 | 353 | return baseResponse; |
| 352 | 354 | } |
| 353 | 355 | |
| 356 | + /** | |
| 357 | + * 增加或修改服务医生配置 | |
| 358 | + * | |
| 359 | + * @param hds | |
| 360 | + * @param id | |
| 361 | + * @return | |
| 362 | + */ | |
| 363 | + public BaseResponse addOrUpdateHosDoctService(HospitalDoctService hds, Integer id) { | |
| 364 | + BaseResponse baseResponse = new BaseResponse(); | |
| 365 | + try { | |
| 366 | + if (StringUtils.isNotEmpty(hds.getId())) {//修改 | |
| 367 | + HospitalDoctService oldHosDoct = hospitalDoctService.getHospitalDoctService(hds.getId()); | |
| 368 | + //修改 | |
| 369 | + if (oldHosDoct != null) { | |
| 370 | + oldHosDoct.setStatus(hds.getStatus()); | |
| 371 | + oldHosDoct.setDoctPrice(hds.getDoctPrice()); | |
| 372 | + oldHosDoct.setSyncStatus(0); | |
| 373 | + hospitalDoctService.updateHospitalDoctService(oldHosDoct); | |
| 374 | + } | |
| 375 | + } else { | |
| 376 | + HospitalDoctServiceQuery doctServiceQuery = new HospitalDoctServiceQuery(); | |
| 377 | + doctServiceQuery.setHospServiceId(hds.getHospServiceId()); | |
| 378 | + doctServiceQuery.setDoctId(hds.getDoctId()); | |
| 379 | + List<HospitalDoctService> hospitalDoctServiceList = hospitalDoctService.queryHospitalDoctService(doctServiceQuery); | |
| 380 | + if (CollectionUtils.isNotEmpty(hospitalDoctServiceList)) { | |
| 381 | + HospitalDoctService hospitalDoctSer = hospitalDoctServiceList.get(0); | |
| 382 | + hospitalDoctSer.setStatus(hds.getStatus()); | |
| 383 | + hospitalDoctSer.setDoctPrice(hds.getDoctPrice()); | |
| 384 | + hospitalDoctSer.setSyncStatus(0); | |
| 385 | + hospitalDoctService.updateHospitalDoctService(hospitalDoctSer); | |
| 386 | + } else { | |
| 387 | + hds.setId(UUID.randomUUID().toString().replace("-", "")); | |
| 388 | + hds.setSyncStatus(0); | |
| 389 | + hospitalDoctService.addHospitalDoctService(hds); | |
| 390 | + } | |
| 391 | + } | |
| 392 | + baseResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 393 | + } catch (Exception e) { | |
| 394 | + baseResponse.setErrorcode(ErrorCodeConstants.SYSTEM_ERROR); | |
| 395 | + baseResponse.setErrormsg(e.getMessage()); | |
| 396 | + e.printStackTrace(); | |
| 397 | + } | |
| 398 | + return baseResponse; | |
| 399 | + } | |
| 354 | 400 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/HospitalDoctSerResult.java
View file @
fc5156c
| ... | ... | @@ -40,8 +40,13 @@ |
| 40 | 40 | /** |
| 41 | 41 | * 状态:0-有效、1-暂停、2-删除 |
| 42 | 42 | */ |
| 43 | - private String status; | |
| 43 | + private String statusName; | |
| 44 | 44 | |
| 45 | + /** | |
| 46 | + * 状态:1-有效、2-暂停、3-删除 | |
| 47 | + */ | |
| 48 | + private Integer status; | |
| 49 | + | |
| 45 | 50 | public String getDoctName() { |
| 46 | 51 | return doctName; |
| 47 | 52 | } |
| 48 | 53 | |
| ... | ... | @@ -98,11 +103,19 @@ |
| 98 | 103 | this.doctPrice = doctPrice; |
| 99 | 104 | } |
| 100 | 105 | |
| 101 | - public String getStatus() { | |
| 106 | + public String getStatusName() { | |
| 107 | + return statusName; | |
| 108 | + } | |
| 109 | + | |
| 110 | + public void setStatusName(String statusName) { | |
| 111 | + this.statusName = statusName; | |
| 112 | + } | |
| 113 | + | |
| 114 | + public Integer getStatus() { | |
| 102 | 115 | return status; |
| 103 | 116 | } |
| 104 | 117 | |
| 105 | - public void setStatus(String status) { | |
| 118 | + public void setStatus(Integer status) { | |
| 106 | 119 | this.status = status; |
| 107 | 120 | } |
| 108 | 121 | } |