Commit 7efcbe39c0303900b431abec7d74a5c2c7fcc080
Exists in
master
and in
8 other branches
Merge remote-tracking branch 'origin/master'
Showing 6 changed files
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IPatientDao.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/PatientDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PatientsService.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ResidentsArchiveFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/ResidentsArchiveAddRequest.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IPatientDao.java
View file @
7efcbe3
... | ... | @@ -34,6 +34,8 @@ |
34 | 34 | |
35 | 35 | void updatePatientOneCol(String id, Object colValue); |
36 | 36 | |
37 | + void updatePatientLastCheckEmployeeIdOne(String id, String lastCheckEmployeeId); | |
38 | + | |
37 | 39 | List<PredictedStatisticsCountModel> predictedStatistics(); |
38 | 40 | |
39 | 41 | List<HashMap> aggregateOne(MongoQuery mongoQuery); |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/PatientDaoImpl.java
View file @
7efcbe3
... | ... | @@ -43,6 +43,11 @@ |
43 | 43 | } |
44 | 44 | |
45 | 45 | @Override |
46 | + public void updatePatientLastCheckEmployeeIdOne(String id, String lastCheckEmployeeId){ | |
47 | + this.mongoTemplate.updateFirst(new Query(Criteria.where("id").is(id)), Update.update("lastCheckEmployeeId", lastCheckEmployeeId), Patients.class); | |
48 | + } | |
49 | + | |
50 | + @Override | |
46 | 51 | public List<PredictedStatisticsCountModel> predictedStatistics() { |
47 | 52 | // List<PredictedStatisticsCountModel> predictedStatisticsCountModelList = new ArrayList<>(); |
48 | 53 | // DBCollection dbCollection = this.mongoTemplate.getCollection("lyms_patient"); |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PatientsService.java
View file @
7efcbe3
... | ... | @@ -117,6 +117,10 @@ |
117 | 117 | iPatientDao.updatePatientOneCol(id,colValue); |
118 | 118 | } |
119 | 119 | |
120 | + public void updatePatientLastCheckEmployeeIdOne(String id, String lastCheckEmployeeId) { | |
121 | + iPatientDao.updatePatientLastCheckEmployeeIdOne(id, lastCheckEmployeeId); | |
122 | + } | |
123 | + | |
120 | 124 | /** |
121 | 125 | * 满足孕15+3至20+6之间和有产筛申请单的数据 |
122 | 126 | */ |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
View file @
7efcbe3
1 | 1 | package com.lyms.platform.operate.web.controller; |
2 | 2 | |
3 | 3 | import com.lyms.hospitalapi.qhdfy.QhdfyHisService; |
4 | -import com.lyms.platform.biz.JdbcUtil; | |
5 | 4 | import com.lyms.platform.biz.service.AntenatalExaminationService; |
6 | 5 | import com.lyms.platform.biz.service.AssayConfigService; |
7 | 6 | import com.lyms.platform.biz.service.PatientsService; |
... | ... | @@ -9,7 +8,6 @@ |
9 | 8 | import com.lyms.platform.common.enums.YnEnums; |
10 | 9 | import com.lyms.platform.common.utils.DateUtil; |
11 | 10 | import com.lyms.platform.common.utils.JsonUtil; |
12 | -import com.lyms.platform.common.utils.StringUtils; | |
13 | 11 | import com.lyms.platform.operate.web.service.SyncDataTaskService; |
14 | 12 | import com.lyms.platform.permission.service.OrganizationService; |
15 | 13 | import com.lyms.platform.pojo.AntExChuModel; |
... | ... | @@ -21,6 +19,7 @@ |
21 | 19 | import com.lyms.platform.query.PatientsQuery; |
22 | 20 | import org.apache.commons.collections.CollectionUtils; |
23 | 21 | import org.apache.commons.io.FileUtils; |
22 | +import org.apache.commons.lang.StringUtils; | |
24 | 23 | import org.springframework.beans.factory.annotation.Autowired; |
25 | 24 | import org.springframework.data.domain.Sort; |
26 | 25 | import org.springframework.data.mongodb.core.MongoTemplate; |
... | ... | @@ -31,8 +30,6 @@ |
31 | 30 | import org.springframework.web.bind.annotation.ResponseBody; |
32 | 31 | |
33 | 32 | import java.io.File; |
34 | -import java.io.IOException; | |
35 | -import java.text.CollationElementIterator; | |
36 | 33 | import java.util.*; |
37 | 34 | |
38 | 35 | /** |
39 | 36 | |
... | ... | @@ -341,10 +338,85 @@ |
341 | 338 | } |
342 | 339 | } |
343 | 340 | } |
344 | - }); | |
341 | + }).start(); | |
345 | 342 | } |
346 | 343 | |
347 | 344 | return "syncPatNextTime finish"; |
345 | + } | |
346 | + | |
347 | + @ResponseBody | |
348 | + @RequestMapping(value = "/syncPatientsLastCheckEmployeeId", method = RequestMethod.GET) | |
349 | + public String syncPatientsLastCheckEmployeeId(@RequestParam String hospitalId, | |
350 | + @RequestParam(required = false) String size) { | |
351 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
352 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
353 | + // 医院id | |
354 | + patientsQuery.setHospitalId(hospitalId); | |
355 | + List<Integer> typeList = new ArrayList<>(); | |
356 | + // 孕妇 | |
357 | + typeList.add(1); | |
358 | + // 产妇 | |
359 | + typeList.add(3); | |
360 | + patientsQuery.setTypeList(typeList); | |
361 | + // 查询 | |
362 | + List<Patients> patientsList = patientsService.queryPatient(patientsQuery); | |
363 | + System.out.println("本次读取了【" + patientsList.size() + "】条数据"); | |
364 | + | |
365 | + int batchSize = StringUtils.isEmpty(size) ? 1000 : Integer.valueOf(size); | |
366 | + int end = 0; | |
367 | + | |
368 | + for (int i = 0; i < patientsList.size(); i += batchSize) { | |
369 | + end = (end + batchSize); | |
370 | + if (end > patientsList.size()) { | |
371 | + end = patientsList.size(); | |
372 | + } | |
373 | + final List<Patients> tempList = patientsList.subList(i, end); | |
374 | + new Thread(new Runnable() { | |
375 | + @Override | |
376 | + public void run() { | |
377 | + if (CollectionUtils.isNotEmpty(tempList)) { | |
378 | + for (Patients patients : tempList) { | |
379 | + | |
380 | + if (StringUtils.isEmpty(patients.getLastCheckEmployeeId())) { | |
381 | + | |
382 | + String id = patients.getId(); | |
383 | + String hospitalId = patients.getHospitalId(); | |
384 | + | |
385 | + String lastCheckEmployeeId = null; | |
386 | + String flag; | |
387 | + | |
388 | + // 查询复诊,如果没有再查询初诊 | |
389 | + AntExQuery antExQuery = new AntExQuery(); | |
390 | + antExQuery.setYn(YnEnums.YES.getId()); | |
391 | + antExQuery.setParentId(id); | |
392 | + antExQuery.setHospitalId(hospitalId); | |
393 | + List<AntenatalExaminationModel> antenatalExaminationModelList = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery().addOrder(Sort.Direction.DESC, "created")); | |
394 | + if (CollectionUtils.isNotEmpty(antenatalExaminationModelList)) { | |
395 | + lastCheckEmployeeId = antenatalExaminationModelList.get(0).getCheckDoctor(); | |
396 | + flag = "复诊"; | |
397 | + } else { | |
398 | + // 查询初诊 | |
399 | + AntExChuQuery antExChuQuery = new AntExChuQuery(); | |
400 | + antExChuQuery.setYn(YnEnums.YES.getId()); | |
401 | + antExChuQuery.setParentId(id); | |
402 | + antExChuQuery.setHospitalId(hospitalId); | |
403 | + List<AntExChuModel> antExChuModelList = antenatalExaminationService.queryAntExChu(antExChuQuery); | |
404 | + if (antExChuModelList.size() == 1) { | |
405 | + lastCheckEmployeeId = antExChuModelList.get(0).getProdDoctor(); | |
406 | + } | |
407 | + flag = "初诊"; | |
408 | + } | |
409 | + if (!StringUtils.isEmpty(lastCheckEmployeeId)) { | |
410 | + patientsService.updatePatientLastCheckEmployeeIdOne(id, lastCheckEmployeeId); | |
411 | + System.out.println("更新lyms_patient:id=" + id + ",lastCheckEmployeeId=" + lastCheckEmployeeId + ",来自" + flag); | |
412 | + } | |
413 | + } | |
414 | + } | |
415 | + } | |
416 | + } | |
417 | + }).start(); | |
418 | + } | |
419 | + return "syncPatientsLastCheckEmployeeId start......"; | |
348 | 420 | } |
349 | 421 | |
350 | 422 | @RequestMapping(value = "/initCardNo", method = RequestMethod.GET) |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ResidentsArchiveFacade.java
View file @
7efcbe3
... | ... | @@ -25,6 +25,7 @@ |
25 | 25 | import com.lyms.platform.pojo.ResidentsArchiveModel; |
26 | 26 | import com.lyms.platform.query.PremaritalCheckupQuery; |
27 | 27 | import com.lyms.platform.query.ResidentsArchiveQuery; |
28 | +import net.sf.json.JSONObject; | |
28 | 29 | import org.apache.commons.collections.CollectionUtils; |
29 | 30 | import org.apache.commons.lang.StringUtils; |
30 | 31 | import org.springframework.beans.factory.annotation.Autowired; |
... | ... | @@ -376,10 +377,10 @@ |
376 | 377 | result.setAddressRegister(model.getAddressRegister()); |
377 | 378 | |
378 | 379 | result.setPastHistory(JsonUtil.str2Obj(model.getPastHistory(),Map.class)); |
379 | - result.setFamilyHistory(JsonUtil.str2Obj(model.getFamilyHistory(),Map.class)); | |
380 | - result.setPersonalHistory(JsonUtil.str2Obj(model.getPresentHistory(),Map.class)); | |
381 | - result.setYwgmHistory(JsonUtil.str2Obj(model.getYwgmHistory(),Map.class)); | |
382 | - result.setPresentHistory(JsonUtil.str2Obj(model.getPresentHistory(),Map.class)); | |
380 | +// result.setFamilyHistory(JsonUtil.str2Obj(model.getFamilyHistory(),Map.class)); | |
381 | +// result.setPersonalHistory(JsonUtil.str2Obj(model.getPresentHistory(),Map.class)); | |
382 | +// result.setYwgmHistory(JsonUtil.str2Obj(model.getYwgmHistory(),Map.class)); | |
383 | +// result.setPresentHistory(JsonUtil.str2Obj(model.getPresentHistory(),Map.class)); | |
383 | 384 | |
384 | 385 | result.setVcCardNo(model.getVcCardNo()); |
385 | 386 | result.setBuildDoctor(model.getBuildDoctor()); |
... | ... | @@ -392,6 +393,22 @@ |
392 | 393 | result.setPublishName(model.getPublishName()); |
393 | 394 | |
394 | 395 | return result; |
396 | + } | |
397 | + | |
398 | + /** | |
399 | + * 把json对象串转换成map对象 | |
400 | + * @param jsonObjStr e.g. {'name':'get','int':1,'double',1.1,'null':null} | |
401 | + * @return Map | |
402 | + */ | |
403 | + public static Map getMapFromJsonObjStr(String jsonObjStr) { | |
404 | + JSONObject jsonObject = JSONObject.fromObject(jsonObjStr); | |
405 | + | |
406 | + Map map = new HashMap(); | |
407 | + for (Iterator iter = jsonObject.keys(); iter.hasNext();) { | |
408 | + String key = (String) iter.next(); | |
409 | + map.put(key, jsonObject.get(key)); | |
410 | + } | |
411 | + return map; | |
395 | 412 | } |
396 | 413 | |
397 | 414 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/ResidentsArchiveAddRequest.java
View file @
7efcbe3
... | ... | @@ -126,19 +126,19 @@ |
126 | 126 | model.setAddressRegister(addressRegister); |
127 | 127 | |
128 | 128 | if (pastHistory!=null){ |
129 | - model.setPastHistory(JsonUtil.array2JsonString(pastHistory)); | |
129 | + model.setPastHistory(JsonUtil.obj2JsonString(pastHistory)); | |
130 | 130 | } |
131 | 131 | if (familyHistory!=null){ |
132 | - model.setFamilyHistory(JsonUtil.array2JsonString(familyHistory)); | |
132 | + model.setFamilyHistory(JsonUtil.obj2JsonString(familyHistory)); | |
133 | 133 | } |
134 | 134 | if (personalHistory!=null){ |
135 | - model.setPersonalHistory(JsonUtil.array2JsonString(personalHistory)); | |
135 | + model.setPersonalHistory(JsonUtil.obj2JsonString(personalHistory)); | |
136 | 136 | } |
137 | 137 | if (ywgmHistory!=null){ |
138 | - model.setYwgmHistory(JsonUtil.array2JsonString(ywgmHistory)); | |
138 | + model.setYwgmHistory(JsonUtil.obj2JsonString(ywgmHistory)); | |
139 | 139 | } |
140 | 140 | if (presentHistory!=null){ |
141 | - model.setPresentHistory(JsonUtil.array2JsonString(presentHistory)); | |
141 | + model.setPresentHistory(JsonUtil.obj2JsonString(presentHistory)); | |
142 | 142 | } |
143 | 143 | model.setVcCardNo(vcCardNo); |
144 | 144 | model.setBuildDoctor(buildDoctor); |