Commit 6a6041661e1a361762f9d70633c0c2f7a4fde60e
1 parent
e91d70068c
Exists in
master
and in
1 other branch
儿童建档
Showing 2 changed files with 98 additions and 173 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java
View file @
6a60416
... | ... | @@ -193,43 +193,68 @@ |
193 | 193 | |
194 | 194 | Patients patients = null; |
195 | 195 | PersonModel resperson = null; |
196 | - if (request.getMommyPhone() != null || request.getMommyCertificateNum() != null) | |
196 | + String babyPersonId = ""; | |
197 | + //更新儿童基本信息的内容 | |
198 | + PersonModel babyPerson = new PersonModel(); | |
199 | + babyPerson.setName(request.getBabyName()); | |
200 | + babyPerson.setBirth(DateUtil.parseYMD(request.getBabyBirthday())); | |
201 | + babyPerson.setPhone(request.getMommyPhone()); | |
202 | + babyPerson.setCardNo(request.getMommyCertificateNum()); | |
203 | + babyPerson.setType(2); | |
204 | + babyPerson.setYn(YnEnums.YES.getId()); | |
205 | + babyPerson.setModified(new Date()); | |
206 | + if (StringUtils.isNotEmpty(request.getPid())) { | |
207 | + babyPersonId = request.getPid(); | |
208 | + personService.updatePerson(babyPerson,request.getPid()); | |
209 | + } | |
210 | + else | |
197 | 211 | { |
198 | - //查询儿童基本信息 | |
199 | - PersonModelQuery personModelQuery = new PersonModelQuery(); | |
200 | -// personModelQuery.setPhone(request.getMommyPhone()); | |
201 | - personModelQuery.setYn(YnEnums.YES.getId()); | |
202 | - personModelQuery.setName(request.getBabyName()); | |
203 | - personModelQuery.setType(2); | |
204 | - personModelQuery.setCardNo(request.getMommyCertificateNum()); | |
205 | - List<PersonModel> personModels = personService.queryPersons(personModelQuery); | |
206 | - | |
207 | - //更新儿童基本信息的内容 | |
208 | - PersonModel pmodel = new PersonModel(); | |
209 | - pmodel.setName(request.getBabyName()); | |
210 | - pmodel.setBirth(DateUtil.parseYMD(request.getBabyBirthday())); | |
211 | - pmodel.setPhone(request.getMommyPhone()); | |
212 | - pmodel.setCardNo(request.getMommyCertificateNum()); | |
213 | - pmodel.setType(2); | |
214 | - pmodel.setYn(YnEnums.YES.getId()); | |
215 | - pmodel.setModified(new Date()); | |
216 | - if (CollectionUtils.isNotEmpty(personModels) && personModels.get(0) != null) | |
217 | - { | |
218 | - resperson = personModels.get(0); | |
219 | - personService.updatePerson(pmodel,personModels.get(0).getId()); | |
220 | - } | |
221 | - else | |
222 | - { | |
223 | - pmodel.setYn(YnEnums.YES.getId()); | |
224 | - pmodel.setCreated(new Date()); | |
225 | - resperson = personService.addPerson(pmodel); | |
226 | - } | |
212 | + babyPerson.setYn(YnEnums.YES.getId()); | |
213 | + babyPerson.setCreated(new Date()); | |
214 | + resperson = personService.addPerson(babyPerson); | |
215 | + babyPersonId = resperson.getId(); | |
227 | 216 | } |
228 | 217 | |
229 | 218 | |
219 | +// Patients patients = null; | |
220 | +// PersonModel resperson = null; | |
221 | +// if (request.getMommyPhone() != null || request.getMommyCertificateNum() != null) | |
222 | +// { | |
223 | +// //查询儿童基本信息 | |
224 | +// PersonModelQuery personModelQuery = new PersonModelQuery(); | |
225 | +//// personModelQuery.setPhone(request.getMommyPhone()); | |
226 | +// personModelQuery.setYn(YnEnums.YES.getId()); | |
227 | +// personModelQuery.setName(request.getBabyName()); | |
228 | +// personModelQuery.setType(2); | |
229 | +// personModelQuery.setCardNo(request.getMommyCertificateNum()); | |
230 | +// List<PersonModel> personModels = personService.queryPersons(personModelQuery); | |
231 | +// | |
232 | +// //更新儿童基本信息的内容 | |
233 | +// PersonModel pmodel = new PersonModel(); | |
234 | +// pmodel.setName(request.getBabyName()); | |
235 | +// pmodel.setBirth(DateUtil.parseYMD(request.getBabyBirthday())); | |
236 | +// pmodel.setPhone(request.getMommyPhone()); | |
237 | +// pmodel.setCardNo(request.getMommyCertificateNum()); | |
238 | +// pmodel.setType(2); | |
239 | +// pmodel.setYn(YnEnums.YES.getId()); | |
240 | +// pmodel.setModified(new Date()); | |
241 | +// if (CollectionUtils.isNotEmpty(personModels) && personModels.get(0) != null) | |
242 | +// { | |
243 | +// resperson = personModels.get(0); | |
244 | +// personService.updatePerson(pmodel,personModels.get(0).getId()); | |
245 | +// } | |
246 | +// else | |
247 | +// { | |
248 | +// pmodel.setYn(YnEnums.YES.getId()); | |
249 | +// pmodel.setCreated(new Date()); | |
250 | +// resperson = personService.addPerson(pmodel); | |
251 | +// } | |
252 | +// } | |
253 | + | |
254 | + | |
230 | 255 | //查询孕妇或者产妇建档的基本信息 |
231 | 256 | PersonModelQuery personYunModelQuery = new PersonModelQuery(); |
232 | - personYunModelQuery.setPhone(request.getMommyPhone()); | |
257 | +// personYunModelQuery.setPhone(request.getMommyPhone()); | |
233 | 258 | personYunModelQuery.setYn(YnEnums.YES.getId()); |
234 | 259 | personYunModelQuery.setTypes(new Integer[]{1, 3}); |
235 | 260 | personYunModelQuery.setCardNo(request.getMommyCertificateNum()); |
236 | 261 | |
237 | 262 | |
238 | 263 | |
... | ... | @@ -251,31 +276,40 @@ |
251 | 276 | //当前状态为 孕妇状态 |
252 | 277 | if (pm.getType() != null && pm.getType() == 1) |
253 | 278 | { |
279 | + boolean isUpdatePatStatus = false; | |
280 | + for(Patients pat : pats) | |
281 | + { | |
282 | + if (pat != null) { | |
283 | + if (pat.getType() == 1) { | |
254 | 284 | |
255 | - if (patients != null) { | |
256 | - if (patients.getType() == 1) { | |
285 | + //判断在儿童建档的时候,是否设置到这个儿童对应的孕妇 设置成产妇 | |
286 | + //计算规则 儿童生日 >= 孕妇末次月经 + 24周 设置成分娩 (高帆 2016-08-09 16:47定 ) | |
287 | + Date lastMenses = pat.getLastMenses(); | |
288 | + if (lastMenses != null && request.getBabyBirthday() != null) { | |
289 | + Date brith = DateUtil.parseYMD(request.getBabyBirthday()); | |
290 | + Date tempDate = DateUtil.addWeek(lastMenses, 24); | |
291 | + if (brith.getTime() >= tempDate.getTime()) { | |
292 | + //设置孕妇已分娩 | |
293 | + Patients patientUpdate = new Patients(); | |
294 | + patientUpdate.setYn(YnEnums.YES.getId()); | |
295 | + patientUpdate.setType(3); | |
296 | + patientsService.updatePatientByPid(patientUpdate, pm.getId()); | |
297 | + if (!isUpdatePatStatus) | |
298 | + { | |
299 | + isUpdatePatStatus = true; | |
300 | + } | |
257 | 301 | |
258 | - //判断在儿童建档的时候,是否设置到这个儿童对应的孕妇 设置成产妇 | |
259 | - //计算规则 儿童生日 >= 孕妇末次月经 + 24周 设置成分娩 (高帆 2016-08-09 16:47定 ) | |
260 | - Date lastMenses = patients.getLastMenses(); | |
261 | - if (lastMenses != null && request.getBabyBirthday() != null) { | |
262 | - Date brith = DateUtil.parseYMD(request.getBabyBirthday()); | |
263 | - Date tempDate = DateUtil.addWeek(lastMenses, 24); | |
264 | - if (brith.getTime() >= tempDate.getTime()) { | |
265 | - //设置孕妇已分娩 | |
266 | - Patients patientUpdate = new Patients(); | |
267 | - patientUpdate.setYn(YnEnums.YES.getId()); | |
268 | - patientUpdate.setType(3); | |
269 | - patientsService.updatePatientByPid(patientUpdate,pm.getId()); | |
270 | - | |
271 | - | |
272 | - pm.setType(3);//基本信息更新成产妇 | |
273 | - resperson = pm; | |
274 | - personService.updatePerson(pm,pm.getId()); | |
302 | + } | |
275 | 303 | } |
276 | 304 | } |
277 | 305 | } |
278 | 306 | } |
307 | + | |
308 | + if (isUpdatePatStatus) | |
309 | + { | |
310 | + pm.setType(3);//基本信息更新成产妇 | |
311 | + personService.updatePerson(pm,pm.getId()); | |
312 | + } | |
279 | 313 | } |
280 | 314 | } |
281 | 315 | } |
... | ... | @@ -304,7 +338,7 @@ |
304 | 338 | |
305 | 339 | |
306 | 340 | BabyModel model = getBabyModel(request); |
307 | - model.setPid(resperson.getId()); | |
341 | + model.setPid(babyPersonId); | |
308 | 342 | |
309 | 343 | if (StringUtils.isNotEmpty(request.getMommyCertificateNum())) { |
310 | 344 | |
311 | 345 | |
... | ... | @@ -852,12 +886,10 @@ |
852 | 886 | List<PersonModel> personModels = personService.queryPersons(personModelQuery); |
853 | 887 | if (CollectionUtils.isNotEmpty(personModels)) |
854 | 888 | { |
855 | - | |
856 | - | |
857 | 889 | for(PersonModel babayPerson : personModels) |
858 | 890 | { |
859 | 891 | BabyInfoResult result = new BabyInfoResult(); |
860 | - result.setId(babayPerson.getId()); | |
892 | + result.setPid(babayPerson.getId()); | |
861 | 893 | result.setCardNo(babayPerson.getCardNo());//母亲的身份证号码 |
862 | 894 | result.setName(babayPerson.getName()); |
863 | 895 | if (babayPerson.getBirth() != null) |
... | ... | @@ -899,10 +931,10 @@ |
899 | 931 | buildRecords.put("buildHospital", ""); |
900 | 932 | } |
901 | 933 | |
902 | - result.setId(build.getId()); | |
903 | - result.setCardNo(build.getCardNo()); | |
904 | - result.setName(build.getName()); | |
905 | - result.setMonthAge(DateUtil.getBabyMonthAge(build.getBirth(), new Date())); | |
934 | +// result.setId(build.getId()); | |
935 | +// result.setCardNo(build.getCardNo()); | |
936 | +// result.setName(build.getName()); | |
937 | +// result.setMonthAge(DateUtil.getBabyMonthAge(build.getBirth(), new Date())); | |
906 | 938 | list.add(buildRecords); |
907 | 939 | } |
908 | 940 | |
... | ... | @@ -935,7 +967,7 @@ |
935 | 967 | puerperaQuery.setCardNo(model.getMcertNo()); |
936 | 968 | |
937 | 969 | BabyInfoResult result = new BabyInfoResult(); |
938 | - result.setId(model.getPid()); | |
970 | + result.setPid(model.getPid()); | |
939 | 971 | result.setCardNo(model.getMcertNo());//母亲的身份证号码 |
940 | 972 | result.setName(model.getName()); |
941 | 973 | if (model.getBirth() != null) |
... | ... | @@ -976,10 +1008,6 @@ |
976 | 1008 | buildRecords.put("buildHospital", ""); |
977 | 1009 | } |
978 | 1010 | |
979 | - result.setId(build.getId()); | |
980 | - result.setCardNo(build.getCardNo()); | |
981 | - result.setName(build.getName()); | |
982 | - result.setMonthAge(DateUtil.getBabyMonthAge(build.getBirth(), new Date())); | |
983 | 1011 | list.add(buildRecords); |
984 | 1012 | } |
985 | 1013 | |
... | ... | @@ -1007,109 +1035,6 @@ |
1007 | 1035 | objectResponse.setData(map); |
1008 | 1036 | objectResponse.setErrormsg("成功"); |
1009 | 1037 | return objectResponse; |
1010 | - | |
1011 | - | |
1012 | - | |
1013 | -// if (userId != null) | |
1014 | -// { | |
1015 | -// Users dbuser = usersService.getUsers(userId); | |
1016 | -// if (dbuser != null) { | |
1017 | -// Integer hospitalId = dbuser.getOrgId(); | |
1018 | -// param.setHospitalId(String.valueOf(hospitalId)); | |
1019 | -// } | |
1020 | -// } | |
1021 | -// | |
1022 | -// | |
1023 | -// | |
1024 | -// Map<String,Object> map = new HashMap<>(); | |
1025 | -// | |
1026 | -// List<BabyInfoResult> results = new ArrayList<>(); | |
1027 | -// BabyModelQuery babyQuery = new BabyModelQuery(); | |
1028 | -// babyQuery.setYn(YnEnums.YES.getId()); | |
1029 | -// List<BabyModel> models = null; | |
1030 | -// if (!StringUtils.isEmpty(param.getCardNo())) { | |
1031 | -// babyQuery.setCardId(param.getCardNo()); | |
1032 | -// babyQuery.setHospitalId(param.getHospitalId()); | |
1033 | -// | |
1034 | -// //通过查询孕妇 | |
1035 | -// PatientsQuery puerperaQuery = new PatientsQuery(); | |
1036 | -// puerperaQuery.setCardNo(param.getCardNo()); | |
1037 | -// puerperaQuery.setYn(YnEnums.YES.getId()); | |
1038 | -// Patients patients = patientsService.findOnePatientByCardNo(puerperaQuery); | |
1039 | -// map.put("patients",patients); | |
1040 | -// | |
1041 | -//// if (patients != null && StringUtils.isNotEmpty(patients.getPhone())) { | |
1042 | -//// babyQuery.setPhoneId(patients.getPhone()); | |
1043 | -//// } | |
1044 | -// | |
1045 | -// models = babyBookbuildingService.queryBabyBuildByCond(babyQuery); | |
1046 | -// | |
1047 | -// } else if (param.getHospitalId() != null & !StringUtils.isEmpty(param.getVcCardNo())) { | |
1048 | -// babyQuery.setHospitalId(param.getHospitalId()); | |
1049 | -// babyQuery.setVcCardNo(param.getVcCardNo()); | |
1050 | -// models = babyBookbuildingService.queryBabyBuildByCond(babyQuery); | |
1051 | -// } | |
1052 | -// | |
1053 | -// if (models != null && models.size() > 0) { | |
1054 | -// Set<String> uid = new HashSet<>(); | |
1055 | -// for (BabyModel model : models) { | |
1056 | -// if (model != null) { | |
1057 | -// uid.add(model.getId()); | |
1058 | -// } | |
1059 | -// | |
1060 | -// } | |
1061 | -// | |
1062 | -// for (String id : uid) { | |
1063 | -// BabyInfoResult result = new BabyInfoResult(); | |
1064 | -// | |
1065 | -// List<Map<String, String>> list = new ArrayList<>(); | |
1066 | -// for (BabyModel model : models) { | |
1067 | -// | |
1068 | -// if (id.equals(model.getId())) { | |
1069 | -// | |
1070 | -// BabyModelQuery hospBuildRecordsQuery = new BabyModelQuery(); | |
1071 | -// hospBuildRecordsQuery.setYn(YnEnums.YES.getId()); | |
1072 | -// hospBuildRecordsQuery.setMcertNo(model.getMcertNo()); | |
1073 | -// List<BabyModel> builds = babyBookbuildingService.queryBabyBuildByCond(hospBuildRecordsQuery); | |
1074 | -// if (CollectionUtils.isNotEmpty(builds)) | |
1075 | -// { | |
1076 | -// for(BabyModel build: builds) | |
1077 | -// { | |
1078 | -// Map<String, String> buildRecords = new HashMap<>(); | |
1079 | -// buildRecords.put("id", build.getId()); | |
1080 | -// buildRecords.put("buildDate", DateUtil.getyyyy_MM_dd(build.getBuildDate())); | |
1081 | -// | |
1082 | -// //查询建档医院 | |
1083 | -// Organization org = organizationService.getOrganization(Integer.valueOf(build.getHospitalId())); | |
1084 | -// if (org != null) { | |
1085 | -// buildRecords.put("buildHospital", org.getName()); | |
1086 | -// } else { | |
1087 | -// buildRecords.put("buildHospital", ""); | |
1088 | -// } | |
1089 | -// | |
1090 | -// result.setId(build.getId()); | |
1091 | -// result.setCardNo(build.getCardNo()); | |
1092 | -// result.setName(build.getName()); | |
1093 | -// result.setMonthAge(DateUtil.getBabyMonthAge(build.getBirth(), new Date())); | |
1094 | -// list.add(buildRecords); | |
1095 | -// } | |
1096 | -// | |
1097 | -// } | |
1098 | -// | |
1099 | -// } | |
1100 | -// result.setBuildRecords(list); | |
1101 | -// } | |
1102 | -// results.add(result); | |
1103 | -// } | |
1104 | -// } | |
1105 | -// | |
1106 | -// map.put("records",results); | |
1107 | -// | |
1108 | -// BaseObjectResponse objectResponse = new BaseObjectResponse(); | |
1109 | -// objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
1110 | -// objectResponse.setData(map); | |
1111 | -// objectResponse.setErrormsg("成功"); | |
1112 | -// return objectResponse; | |
1113 | 1038 | } |
1114 | 1039 | |
1115 | 1040 | private boolean isNotExist(List<Map<String, String>> list, String id) { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/BabyInfoResult.java
View file @
6a60416
... | ... | @@ -8,7 +8,7 @@ |
8 | 8 | */ |
9 | 9 | public class BabyInfoResult { |
10 | 10 | |
11 | - private String id; | |
11 | + private String pid; | |
12 | 12 | private String name; |
13 | 13 | private String monthAge; |
14 | 14 | private String cardNo; |
15 | 15 | |
... | ... | @@ -24,12 +24,12 @@ |
24 | 24 | this.buildRecords = buildRecords; |
25 | 25 | } |
26 | 26 | |
27 | - public String getId() { | |
28 | - return id; | |
27 | + public String getPid() { | |
28 | + return pid; | |
29 | 29 | } |
30 | 30 | |
31 | - public void setId(String id) { | |
32 | - this.id = id; | |
31 | + public void setPid(String pid) { | |
32 | + this.pid = pid; | |
33 | 33 | } |
34 | 34 | |
35 | 35 | public String getName() { |