Commit ebd7fb5c1f31b5ae4571baed0da17fc408ce33e2
1 parent
c532781ef6
Exists in
master
and in
6 other branches
异常体重管理建档时间查询
Showing 6 changed files with 86 additions and 35 deletions
- platform-dal/src/main/java/com/lyms/platform/pojo/PatientWeight.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/MeasureInfoFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/QuanWeightWorker.java
platform-dal/src/main/java/com/lyms/platform/pojo/PatientWeight.java
View file @
ebd7fb5
... | ... | @@ -79,6 +79,8 @@ |
79 | 79 | } |
80 | 80 | |
81 | 81 | private Date modified; |
82 | + //建档时间 | |
83 | + private Date buildDate; | |
82 | 84 | |
83 | 85 | public Date getModified() { |
84 | 86 | return modified; |
... | ... | @@ -145,6 +147,13 @@ |
145 | 147 | private Integer type; |
146 | 148 | private Integer isUp;//是否增长过快 1和空为正常 2 过快 |
147 | 149 | |
150 | + public Date getBuildDate() { | |
151 | + return buildDate; | |
152 | + } | |
153 | + | |
154 | + public void setBuildDate(Date buildDate) { | |
155 | + this.buildDate = buildDate; | |
156 | + } | |
148 | 157 | |
149 | 158 | public Integer getIsUp() { |
150 | 159 | return isUp; |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
View file @
ebd7fb5
... | ... | @@ -4053,6 +4053,49 @@ |
4053 | 4053 | } |
4054 | 4054 | |
4055 | 4055 | |
4056 | + @ResponseBody | |
4057 | + @RequestMapping(value = "/updateWeightBuildDate", method = RequestMethod.GET) | |
4058 | + public String updateWeightBuildDate(@RequestParam(required = false) String hospitalId) { | |
4059 | + List<PatientWeight> patientWeights = mongoTemplate.find(Query.query(Criteria.where("yn"). | |
4060 | + is("1")), PatientWeight.class); | |
4061 | + | |
4062 | + System.out.println("本次读取了【" + patientWeights.size() + "】条数据"); | |
4063 | + int batchSize = 1000; | |
4064 | + int end = 0; | |
4065 | + for (int i = 0; i < patientWeights.size(); i += batchSize) { | |
4066 | + end = (end + batchSize); | |
4067 | + if (end > patientWeights.size()) { | |
4068 | + end = patientWeights.size(); | |
4069 | + } | |
4070 | + final List<PatientWeight> tempList = patientWeights.subList(i, end); | |
4071 | + commonThreadPool.execute(new Runnable() { | |
4072 | + @Override | |
4073 | + public void run() { | |
4074 | + if (CollectionUtils.isNotEmpty(tempList)) { | |
4075 | + for (PatientWeight weight : tempList) { | |
4076 | + try { | |
4077 | + if (weight != null && StringUtils.isNotEmpty(weight.getPatientId())) | |
4078 | + { | |
4079 | + Patients patients = patientsService.findOnePatientById(weight.getPatientId()); | |
4080 | + if (patients != null) | |
4081 | + { | |
4082 | + | |
4083 | + weight.setBuildDate(patients.getBookbuildingDate()); | |
4084 | + patientWeightService2.update(Query.query(Criteria.where("id").is(weight.getId())), weight); | |
4085 | + } | |
4086 | + } | |
4087 | + }catch (Exception e) | |
4088 | + { | |
4089 | + continue; | |
4090 | + } | |
4091 | + } | |
4092 | + } | |
4093 | + } | |
4094 | + }); | |
4095 | + } | |
4096 | + return "updateWeightBuildDate start......"; | |
4097 | + } | |
4098 | + | |
4056 | 4099 | |
4057 | 4100 | @ResponseBody |
4058 | 4101 | @RequestMapping(value = "/updateBabyAfterVisitStatisticsModel", method = RequestMethod.GET) |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MeasureInfoFacade.java
View file @
ebd7fb5
... | ... | @@ -1100,6 +1100,7 @@ |
1100 | 1100 | patientWeight.setIsNormal(isNormal); |
1101 | 1101 | patientWeight.setIsUp(Integer.parseInt(isUp)); |
1102 | 1102 | patientWeight.setType(patients.getType()); |
1103 | + patientWeight.setBuildDate(patients.getBookbuildingDate()); | |
1103 | 1104 | |
1104 | 1105 | patientWeightService2.add(patientWeight); |
1105 | 1106 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java
View file @
ebd7fb5
... | ... | @@ -783,6 +783,32 @@ |
783 | 783 | criteria.and("type").is(Integer.parseInt(riskPatientsQueryRequest.getType())); |
784 | 784 | } |
785 | 785 | |
786 | + //根据建档时间查询 | |
787 | + String bookbuildingDate=null; | |
788 | + if (StringUtils.isNotEmpty(riskPatientsQueryRequest.getBookbuildingDate())) { | |
789 | + //根据建档时间查询整理传来的时间 | |
790 | + Date bookbuildingDateStart=null; | |
791 | + Date bookbuildingDateEnd=null; | |
792 | + if (StringUtils.isNotEmpty(bookbuildingDate)) { | |
793 | + String[] dates = bookbuildingDate.split(" - "); | |
794 | + bookbuildingDateStart=DateUtil.parseYMD(dates[0]); | |
795 | + if (dates.length == 2) { | |
796 | + bookbuildingDateEnd=new Date(DateUtil.parseYMD(dates[1]).getTime() + 24 * 60 * 60 * 1000 - 1); | |
797 | + } | |
798 | + } | |
799 | + //根据建档时间查询 拼查询语句 | |
800 | + if(null!=bookbuildingDateStart&&null!=bookbuildingDateEnd){ | |
801 | + criteria=criteria.and("buildDate").gte(bookbuildingDateStart).lte(bookbuildingDateEnd); | |
802 | + }else { | |
803 | + if(null!=bookbuildingDateStart){ | |
804 | + criteria=criteria.and("buildDate").gte(bookbuildingDateStart); | |
805 | + } | |
806 | + if(null!=bookbuildingDateEnd){ | |
807 | + criteria=criteria.and("buildDate").lte(bookbuildingDateEnd); | |
808 | + } | |
809 | + } | |
810 | + } | |
811 | + | |
786 | 812 | Query query = Query.query(criteria); |
787 | 813 | String formatBmi = ""; |
788 | 814 | if ("1".equals(riskPatientsQueryRequest.getBmi())) { |
789 | 815 | |
... | ... | @@ -801,16 +827,9 @@ |
801 | 827 | query.addCriteria(Criteria.where("$where").is(formatBmi)); |
802 | 828 | PageResult pageResult = findMongoPage(PatientWeight.class, query.with(new Sort(Sort.Direction.DESC, "modified")), riskPatientsQueryRequest.getPage(), riskPatientsQueryRequest.getLimit()); |
803 | 829 | List <PatientWeight> patientWeightList = (List <PatientWeight>) pageResult.getGrid(); |
804 | - | |
805 | - //根据建档时间查询 | |
806 | - String bookbuildingDate=null; | |
807 | - if (StringUtils.isNotEmpty(riskPatientsQueryRequest.getBookbuildingDate())) { | |
808 | - bookbuildingDate=riskPatientsQueryRequest.getBookbuildingDate(); | |
809 | - } | |
810 | - | |
811 | 830 | List <Map> data = new ArrayList <>(); |
812 | 831 | if (CollectionUtils.isNotEmpty(patientWeightList)) { |
813 | - data = convertToQuanWeight(patientWeightList,bookbuildingDate); | |
832 | + data = convertToQuanWeight(patientWeightList); | |
814 | 833 | } |
815 | 834 | return new BaseListResponse().setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS) |
816 | 835 | .setData(data).setPageInfo(new PageInfo(pageResult.getPage(), pageResult.getLastPage(), pageResult.getCount(), pageResult.getLimit())); |
... | ... | @@ -1678,7 +1697,7 @@ |
1678 | 1697 | return data; |
1679 | 1698 | } |
1680 | 1699 | |
1681 | - private List <Map> convertToQuanWeight(List <PatientWeight> patientWeightList,String bookbuildingDate) { | |
1700 | + private List <Map> convertToQuanWeight(List <PatientWeight> patientWeightList) { | |
1682 | 1701 | List <Map> data = new ArrayList <>(); |
1683 | 1702 | int batchSize = 4; |
1684 | 1703 | int end = 0; |
... | ... | @@ -1688,7 +1707,7 @@ |
1688 | 1707 | if (end > patientWeightList.size()) { |
1689 | 1708 | end = patientWeightList.size(); |
1690 | 1709 | } |
1691 | - listFuture.add(commonThreadPool.submit(new QuanWeightWorker(patientWeightList.subList(i, end),bookbuildingDate, mongoTemplate, | |
1710 | + listFuture.add(commonThreadPool.submit(new QuanWeightWorker(patientWeightList.subList(i, end), mongoTemplate, | |
1692 | 1711 | commonService, basicConfigService, trackDownRecordService,trackDownService,matDeliverService))); |
1693 | 1712 | } |
1694 | 1713 | for (Future f : listFuture) { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java
View file @
ebd7fb5
... | ... | @@ -258,6 +258,7 @@ |
258 | 258 | patientWeight.setIsNormal(result.get("isNormal")); |
259 | 259 | patientWeight.setIsUp(Integer.parseInt(result.get("isUp"))); |
260 | 260 | patientWeight.setType(1); |
261 | + patientWeight.setBuildDate(patients.getBookbuildingDate()); | |
261 | 262 | patientWeightService2.add(patientWeight); |
262 | 263 | |
263 | 264 | operateLogFacade.addAddOptLog(userId, Integer.valueOf(hospitalId), patientWeight, OptActionEnums.ADD.getId(), "添加孕体重"); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/QuanWeightWorker.java
View file @
ebd7fb5
... | ... | @@ -43,14 +43,12 @@ |
43 | 43 | private static final Logger logger = LoggerFactory.getLogger(PatientFacade.class); |
44 | 44 | private ITrackDownService trackDownService; |
45 | 45 | private List<PatientWeight> patientWeightList; |
46 | - private String bookbuildingDate; | |
47 | 46 | private MongoTemplate mongoTemplate; |
48 | 47 | private CommonService commonService; |
49 | 48 | private BasicConfigService basicConfigService; |
50 | 49 | private TrackDownRecordService trackDownRecordService; |
51 | 50 | private MatDeliverService matDeliverService; |
52 | 51 | public QuanWeightWorker(List<PatientWeight> patientWeightList, |
53 | - String bookbuildingDate, | |
54 | 52 | MongoTemplate mongoTemplate, |
55 | 53 | CommonService commonService, |
56 | 54 | BasicConfigService basicConfigService, |
... | ... | @@ -59,7 +57,6 @@ |
59 | 57 | MatDeliverService matDeliverService |
60 | 58 | ) { |
61 | 59 | this.patientWeightList = patientWeightList; |
62 | - this.bookbuildingDate = bookbuildingDate; | |
63 | 60 | this.mongoTemplate = mongoTemplate; |
64 | 61 | this.commonService = commonService; |
65 | 62 | this.basicConfigService = basicConfigService; |
66 | 63 | |
... | ... | @@ -71,31 +68,12 @@ |
71 | 68 | |
72 | 69 | @Override |
73 | 70 | public List<Map> call() throws Exception { |
74 | - //根据建档时间查询整理传来的时间 | |
75 | - Date bookbuildingDateStart=null; | |
76 | - Date bookbuildingDateEnd=null; | |
77 | - if (StringUtils.isNotEmpty(bookbuildingDate)) { | |
78 | - String[] dates = bookbuildingDate.split(" - "); | |
79 | - bookbuildingDateStart=DateUtil.parseYMD(dates[0]); | |
80 | - if (dates.length == 2) { | |
81 | -// bookbuildingDateEnd=DateUtil.parseYMDHMS(dates[1]+" 23:59:59"); | |
82 | - bookbuildingDateEnd=new Date(DateUtil.parseYMD(dates[1]).getTime() + 24 * 60 * 60 * 1000 - 1); | |
83 | - } | |
84 | - } | |
71 | + | |
72 | + | |
85 | 73 | List<Map> data = new ArrayList<>(); |
86 | 74 | for (PatientWeight patientWeight : patientWeightList){ |
87 | 75 | Criteria criteriaPatients=Criteria.where("id").is(patientWeight.getPatientId()).and("yn").ne("0"); |
88 | - //根据建档时间查询 拼查询语句 | |
89 | - if(null!=bookbuildingDateStart&&null!=bookbuildingDateEnd){ | |
90 | - criteriaPatients=criteriaPatients.and("bookbuildingDate").gte(bookbuildingDateStart).lte(bookbuildingDateEnd); | |
91 | - }else { | |
92 | - if(null!=bookbuildingDateStart){ | |
93 | - criteriaPatients=criteriaPatients.and("bookbuildingDate").gte(bookbuildingDateStart); | |
94 | - } | |
95 | - if(null!=bookbuildingDateEnd){ | |
96 | - criteriaPatients=criteriaPatients.and("bookbuildingDate").lte(bookbuildingDateEnd); | |
97 | - } | |
98 | - } | |
76 | + | |
99 | 77 | Query queryPatients=Query.query(criteriaPatients); |
100 | 78 | List <Patients> patientsList = mongoTemplate.find(queryPatients, Patients.class); |
101 | 79 |