Commit 0dc3196ac99c55eece25d4845d4195ab09c45ac4
1 parent
96dd23e402
Exists in
master
and in
1 other branch
update code
Showing 3 changed files with 83 additions and 0 deletions
platform-dal/src/main/java/com/lyms/platform/pojo/TrackCountRecord.java
View file @
0dc3196
| ... | ... | @@ -34,8 +34,19 @@ |
| 34 | 34 | private Integer trackStatus; |
| 35 | 35 | //召回状态 0 未参与召回 1参与召回 |
| 36 | 36 | private Integer backStatus; |
| 37 | + | |
| 38 | + //下次检查时间 | |
| 39 | + private Date nextCheckTime; | |
| 37 | 40 | private Date created; |
| 38 | 41 | private Date modified; |
| 42 | + | |
| 43 | + public Date getNextCheckTime() { | |
| 44 | + return nextCheckTime; | |
| 45 | + } | |
| 46 | + | |
| 47 | + public void setNextCheckTime(Date nextCheckTime) { | |
| 48 | + this.nextCheckTime = nextCheckTime; | |
| 49 | + } | |
| 39 | 50 | |
| 40 | 51 | public String getId() { |
| 41 | 52 | return id; |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TrackDownController.java
View file @
0dc3196
| ... | ... | @@ -151,5 +151,17 @@ |
| 151 | 151 | downFacade.historyData(startTime, endTime, hospitalId, provinceId, cityId, areaId); |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | + | |
| 155 | + /** | |
| 156 | + * 追访统计 | |
| 157 | + * @param orderTime | |
| 158 | + */ | |
| 159 | + @RequestMapping(value = "/getTrackCount", method = RequestMethod.GET) | |
| 160 | + @ResponseBody | |
| 161 | + @TokenRequired | |
| 162 | + public BaseResponse getTrackCount(@RequestParam String orderTime,HttpServletRequest request) { | |
| 163 | + return downFacade.getTrackCount(orderTime, getUserId(request)); | |
| 164 | + } | |
| 165 | + | |
| 154 | 166 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/TrackDownFacade.java
View file @
0dc3196
| 1 | 1 | package com.lyms.platform.operate.web.facade; |
| 2 | 2 | |
| 3 | 3 | import com.lyms.platform.biz.service.*; |
| 4 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
| 4 | 5 | import com.lyms.platform.common.enums.FmTypeEnums; |
| 5 | 6 | import com.lyms.platform.common.enums.TrackDownDateEnums; |
| 6 | 7 | import com.lyms.platform.common.enums.YnEnums; |
| ... | ... | @@ -21,6 +22,8 @@ |
| 21 | 22 | import com.lyms.platform.permission.service.OrganizationService; |
| 22 | 23 | import com.lyms.platform.pojo.*; |
| 23 | 24 | import com.lyms.platform.query.*; |
| 25 | +import com.mongodb.BasicDBObject; | |
| 26 | +import com.mongodb.DBObject; | |
| 24 | 27 | import org.apache.commons.collections.CollectionUtils; |
| 25 | 28 | import org.slf4j.Logger; |
| 26 | 29 | import org.slf4j.LoggerFactory; |
| ... | ... | @@ -196,6 +199,8 @@ |
| 196 | 199 | ResponseUtil.responseExcel(cnames, results, response); |
| 197 | 200 | } |
| 198 | 201 | |
| 202 | + | |
| 203 | + | |
| 199 | 204 | /** |
| 200 | 205 | * 构建返回字段 |
| 201 | 206 | */ |
| ... | ... | @@ -1262,6 +1267,61 @@ |
| 1262 | 1267 | System.out.println("孕妇处理历史数据 " + patientsList.size()); |
| 1263 | 1268 | System.out.println("追访详情处理历史数据" + trackDownRecords.size()); |
| 1264 | 1269 | System.out.println("处理范围 时间" + DateUtil.getyyyy_MM_dd(startTime) + "到" + DateUtil.getyyyy_MM_dd(endTime) + "医院id" + hospitalId); |
| 1270 | + } | |
| 1271 | + | |
| 1272 | + public BaseResponse getTrackCount(String orderTime, Integer userId) { | |
| 1273 | + Map<String,Object> data = new HashMap<>(); | |
| 1274 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
| 1275 | + if (orderTime != null) | |
| 1276 | + { | |
| 1277 | + String[] arrs = orderTime.split(" - "); | |
| 1278 | + Date start = DateUtil.parseYMD(arrs[0]); | |
| 1279 | + Date end = DateUtil.parseYMD(arrs[1]); | |
| 1280 | + long orderCount = mongoTemplate.count(Query.query(Criteria.where("hospitalId").is(hospitalId).and("nextCheckTime").gte(DateUtil.getDayFirstSecond(start)).lte(DateUtil.getDayLastSecond(end))), TrackCountRecord.class); | |
| 1281 | + data.put("orderCount",String.valueOf(orderCount)); | |
| 1282 | + | |
| 1283 | + long oneTrackCount = mongoTemplate.count(Query.query(Criteria.where("hospitalId").is(hospitalId).and("nextCheckTime").gte(DateUtil.getDayFirstSecond(start)).lte(DateUtil.getDayLastSecond(end)).and("oneTrackStatus").is(1)), TrackCountRecord.class); | |
| 1284 | + data.put("oneTrackCount",String.valueOf(oneTrackCount)); | |
| 1285 | + | |
| 1286 | + long twoTrackCount = mongoTemplate.count(Query.query(Criteria.where("hospitalId").is(hospitalId).and("nextCheckTime").gte(DateUtil.getDayFirstSecond(start)).lte(DateUtil.getDayLastSecond(end)).and("twoTrackStatus").is(1)), TrackCountRecord.class); | |
| 1287 | + data.put("twoTrackCount",String.valueOf(twoTrackCount)); | |
| 1288 | + | |
| 1289 | + long zsCheckCount = mongoTemplate.count(Query.query(Criteria.where("hospitalId").is(hospitalId).and("nextCheckTime").gte(DateUtil.getDayFirstSecond(start)).lte(DateUtil.getDayLastSecond(end)).and("zsCheckStatus").is(1)), TrackCountRecord.class); | |
| 1290 | + data.put("zsCheckCount",String.valueOf(zsCheckCount)); | |
| 1291 | + | |
| 1292 | + long jsCheckCount = mongoTemplate.count(Query.query(Criteria.where("hospitalId").is(hospitalId).and("nextCheckTime").gte(DateUtil.getDayFirstSecond(start)).lte(DateUtil.getDayLastSecond(end)).and("jsCheckStatus").is(1)), TrackCountRecord.class); | |
| 1293 | + data.put("jsCheckCount",String.valueOf(jsCheckCount)); | |
| 1294 | + | |
| 1295 | + long loseCount = mongoTemplate.count(Query.query(Criteria.where("hospitalId").is(hospitalId).and("nextCheckTime").gte(DateUtil.getDayFirstSecond(start)).lte(DateUtil.getDayLastSecond(end)).and("loseStatus").is(1)), TrackCountRecord.class); | |
| 1296 | + data.put("loseCount",String.valueOf(loseCount)); | |
| 1297 | + | |
| 1298 | + long trackCount = sumField("lyms_track_count_record", "trackStatus", Criteria.where("hospitalId").is(hospitalId).and("nextCheckTime").gte(DateUtil.getDayFirstSecond(start)).lte(DateUtil.getDayLastSecond(end)).and("trackStatus").is(1)); | |
| 1299 | + data.put("trackCount",String.valueOf(trackCount)); | |
| 1300 | + | |
| 1301 | + long backCount = mongoTemplate.count(Query.query(Criteria.where("hospitalId").is(hospitalId).and("nextCheckTime").gte(DateUtil.getDayFirstSecond(start)).lte(DateUtil.getDayLastSecond(end)).and("backStatus").is(1)), TrackCountRecord.class); | |
| 1302 | + data.put("backCount",String.valueOf(backCount)); | |
| 1303 | + } | |
| 1304 | + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setData(data).setErrormsg("成功"); | |
| 1305 | + } | |
| 1306 | + | |
| 1307 | + public Integer sumField(String collection,String filedName,Criteria criteria) { | |
| 1308 | + Integer total = 0; | |
| 1309 | + String reduce = "function(doc, aggr){ aggr.total +=doc." + filedName + "; }"; | |
| 1310 | + Query query = new Query(); | |
| 1311 | + if(criteria!=null){ | |
| 1312 | + query.addCriteria(criteria); | |
| 1313 | + } | |
| 1314 | + DBObject result = mongoTemplate.getCollection(collection).group(null, | |
| 1315 | + query.getQueryObject(), | |
| 1316 | + new BasicDBObject("total", total), | |
| 1317 | + reduce); | |
| 1318 | + Map<String,BasicDBObject> map = result.toMap(); | |
| 1319 | + if(map.size() > 0){ | |
| 1320 | + BasicDBObject bdbo = map.get("0"); | |
| 1321 | + if(bdbo != null && bdbo.get("total") != null) | |
| 1322 | + total = bdbo.getInt("total"); | |
| 1323 | + } | |
| 1324 | + return total; | |
| 1265 | 1325 | } |
| 1266 | 1326 | |
| 1267 | 1327 |