Commit 560a519c08f8a4a252af4e25c52375f0b684bc30

Authored by yangfei
1 parent 6dbed81401

服务同步

Showing 2 changed files with 38 additions and 16 deletions

platform-common/src/main/java/com/lyms/platform/common/enums/PatientSerEnums.java View file @ 560a519
... ... @@ -98,11 +98,12 @@
98 98 List<Object> list = new ArrayList<>();
99 99 Map<String, Object> resultMap = new HashMap<>();
100 100 resultMap.put("id", SerTypeEnums.bzfw.id);
101   - resultMap.put("name", SerTypeEnums.bzfw.name());
  101 + resultMap.put("name", SerTypeEnums.bzfw.getTitle());
102 102 list.add(resultMap);
103   - resultMap.put("id", SerTypeEnums.yqjzzd.id);
104   - resultMap.put("name", SerTypeEnums.yqjzzd.name());
105   - list.add(resultMap);
  103 + Map<String, Object> resultMap2 = new HashMap<>();
  104 + resultMap2.put("id", SerTypeEnums.yqjzzd.id);
  105 + resultMap2.put("name", SerTypeEnums.yqjzzd.getTitle());
  106 + list.add(resultMap2);
106 107 return list;
107 108 }
108 109  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientServiceFacade.java View file @ 560a519
1 1 package com.lyms.platform.operate.web.facade;
2 2  
  3 +import com.lyms.platform.biz.service.BabyService;
3 4 import com.lyms.platform.biz.service.CommonService;
4 5 import com.lyms.platform.biz.service.PatientsService;
5 6 import com.lyms.platform.common.constants.ErrorCodeConstants;
... ... @@ -17,6 +18,7 @@
17 18 import com.lyms.platform.operate.web.result.PatientSerResult;
18 19 import com.lyms.platform.permission.model.*;
19 20 import com.lyms.platform.permission.service.*;
  21 +import com.lyms.platform.pojo.BabyModel;
20 22 import com.lyms.platform.pojo.Patients;
21 23 import com.lyms.platform.query.PatientsQuery;
22 24 import net.sf.json.JSONObject;
... ... @@ -45,6 +47,8 @@
45 47 @Autowired
46 48 private PatientsService patientsService;
47 49 @Autowired
  50 + private BabyService babyService;
  51 + @Autowired
48 52 private CommonService commonService;
49 53 @Autowired
50 54 private HospitalDoctServiceService hospitalDoctService;
51 55  
52 56  
53 57  
54 58  
... ... @@ -184,20 +188,34 @@
184 188 continue;
185 189 }
186 190  
187   - Patients patients = patientsService.findOnePatientById(ps.getParentid());
188 191  
189   -
190 192 PatientService pser = new PatientService();
191 193 pser.setCreateUser(ps.getCreateUser());
192 194 pser.setCreateDate(ps.getCreateDate());
193 195 pser.setParentid(ps.getParentid());
194   - if (patients != null) {
195   - pser.setPid(patients.getPid());
196   - //如果有数据源id,取主档案id
197   - if(StringUtils.isNotEmpty(patients.getSource())){
198   - pser.setParentid(patients.getSource());
  196 + //设置服务对象类型 服务人类型(1-孕妇、2-儿童)
  197 + pser.setPerType(ps.getPerType());
  198 + if(ps.getPerType()!=null && ps.getPerType()==2){//儿童
  199 + BabyModel babyModel = babyService.getOneBabyById(ps.getParentid());
  200 + if (babyModel != null) {
  201 + pser.setPid(babyModel.getPid());
  202 + //如果有数据源id,取主档案id
  203 + if(StringUtils.isNotEmpty(babyModel.getSource())){
  204 + pser.setParentid(babyModel.getSource());
  205 + }
199 206 }
  207 + }else{
  208 + Patients patients = patientsService.findOnePatientById(ps.getParentid());
  209 + if (patients != null) {
  210 + pser.setPid(patients.getPid());
  211 + //如果有数据源id,取主档案id
  212 + if(StringUtils.isNotEmpty(patients.getSource())){
  213 + pser.setParentid(patients.getSource());
  214 + }
  215 + }
200 216 }
  217 +
  218 +
201 219 pser.setId(UUID.randomUUID().toString().replace("-", ""));
202 220 //开通医院
203 221 pser.setHospitalId(hospitalId);
204 222  
... ... @@ -224,12 +242,15 @@
224 242  
225 243 operateLogFacade.addAddOptLog(userId, Integer.valueOf(hospitalId), pser, OptActionEnums.ADD.getId(), "开通增值服务");
226 244  
227   - if(PatientSerEnums.SerTypeEnums.yqjzzd.getId() == Integer.parseInt(serInfo.get("serType"))){//孕期精准指导同步到建档
  245 + if(ps.getPerType()!=null&&ps.getPerType() == 2){//儿童建档服务数据处理
228 246  
229   - YunBookbuildingAddRequest yunBookbuildingAddRequest = new YunBookbuildingAddRequest();
230   - yunBookbuildingAddRequest.setServiceType(ServiceTypeEnums.ADD_SERVICE.getId());
231   - yunBookbuildingAddRequest.setServiceStatus(ServiceStatusEnums.ADD_OPEN.getId());
232   - bookbuildingFacade.updatePregnantById(ps.getParentid(),yunBookbuildingAddRequest, userId);
  247 + }else{//孕妇建档服务数据处理
  248 + if(PatientSerEnums.SerTypeEnums.yqjzzd.getId() == Integer.parseInt(serInfo.get("serType"))){//孕期精准指导同步到建档
  249 + YunBookbuildingAddRequest yunBookbuildingAddRequest = new YunBookbuildingAddRequest();
  250 + yunBookbuildingAddRequest.setServiceType(ServiceTypeEnums.ADD_SERVICE.getId());
  251 + yunBookbuildingAddRequest.setServiceStatus(ServiceStatusEnums.ADD_OPEN.getId());
  252 + bookbuildingFacade.updatePregnantById(ps.getParentid(),yunBookbuildingAddRequest, userId);
  253 + }
233 254 }
234 255 }
235 256