Commit 0914c615e82fabe1986278c936ff623ba21fae60
1 parent
41050114ea
Exists in
master
and in
6 other branches
河北省基本公共卫生服务项目(妇幼卫生部分)工作进度表
Showing 5 changed files with 611 additions and 10 deletions
- platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
- platform-dal/src/main/java/com/lyms/platform/query/BabyModelQuery.java
- platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/AreaCountController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientSyncMysqlFacade.java
platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
View file @
0914c61
... | ... | @@ -3,6 +3,7 @@ |
3 | 3 | import org.joda.time.DateTime; |
4 | 4 | |
5 | 5 | import java.math.BigDecimal; |
6 | +import java.text.DecimalFormat; | |
6 | 7 | import java.text.ParseException; |
7 | 8 | import java.text.SimpleDateFormat; |
8 | 9 | import java.util.*; |
... | ... | @@ -1914,6 +1915,50 @@ |
1914 | 1915 | |
1915 | 1916 | return currYearLast; |
1916 | 1917 | } |
1918 | + /** | |
1919 | + * 获取一个时间中月的最后一天日期 | |
1920 | + * @param date 时间 | |
1921 | + * @return Date | |
1922 | + */ | |
1923 | + public static Date getDateMonthLast(Date date){ | |
1924 | + Calendar calendar = Calendar.getInstance(); | |
1925 | + calendar.setTime(date); | |
1926 | + calendar.add(calendar.MONTH,0); | |
1927 | + // 获取某月最大天数 | |
1928 | + int lastDay=0; | |
1929 | + //2月的平年瑞年天数 | |
1930 | + if(Calendar.MONTH==1) { | |
1931 | + lastDay = calendar.getLeastMaximum(Calendar.DAY_OF_MONTH); | |
1932 | + }else { | |
1933 | + lastDay = calendar.getActualMaximum(Calendar.DAY_OF_MONTH); | |
1934 | + } | |
1935 | + // 设置日历中月份的最大天数 | |
1936 | + calendar.set(Calendar.DAY_OF_MONTH, lastDay); | |
1937 | + return calendar.getTime(); | |
1938 | + } | |
1939 | + /** | |
1940 | + * 获取一个时间中月的第一天日期 | |
1941 | + * @param date 时间 | |
1942 | + * @return Date | |
1943 | + */ | |
1944 | + public static Date getDateMonthFirst(Date date){ | |
1945 | + Calendar calendar = Calendar.getInstance(); | |
1946 | + calendar.setTime(date); | |
1947 | + calendar.add(calendar.MONTH, -0); | |
1948 | + // 设置日历中月份的最小天数 | |
1949 | + calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMinimum(Calendar.DAY_OF_MONTH)); | |
1950 | + return calendar.getTime(); | |
1951 | + } | |
1952 | + /** | |
1953 | + * 获取年 | |
1954 | + * @param date | |
1955 | + * @return int | |
1956 | + */ | |
1957 | + public static int getYear(Date date){ | |
1958 | + Calendar calendar = Calendar.getInstance(); | |
1959 | + calendar.setTime(date); | |
1960 | + return calendar.get(Calendar.YEAR); | |
1961 | + } | |
1917 | 1962 | |
1918 | 1963 | |
1919 | 1964 | public static void main(String[] args) { |
... | ... | @@ -1938,7 +1983,7 @@ |
1938 | 1983 | // double f1 = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
1939 | 1984 | // |
1940 | 1985 | System.out.println(DateUtil.getyyyy_MM_dd_hms(DateUtil.parseYMDHMS("2022-8-4 9:49:48"))); |
1941 | - } | |
1986 | + } | |
1942 | 1987 | |
1943 | 1988 | } |
platform-dal/src/main/java/com/lyms/platform/query/BabyModelQuery.java
View file @
0914c61
... | ... | @@ -365,6 +365,8 @@ |
365 | 365 | //是否开通疾病发生推送 1或者空没有开通 2开通 |
366 | 366 | private String openDisease; |
367 | 367 | private String lastCheckDoctor; |
368 | + private Boolean lastCheckDoctor2; | |
369 | + private Boolean checkId; | |
368 | 370 | |
369 | 371 | //分娩孕周 |
370 | 372 | private Integer dueWeekStart; |
... | ... | @@ -2208,6 +2210,7 @@ |
2208 | 2210 | if (StringUtils.isNotEmpty(vcCardNoArticle)) { |
2209 | 2211 | condition = condition.and("vcCardNoArticle", vcCardNoArticle, MongoOper.IS); |
2210 | 2212 | } |
2213 | + | |
2211 | 2214 | Criteria c = null; |
2212 | 2215 | if (null != birthStart) { |
2213 | 2216 | c = Criteria.where("birth").gte(birthStart); |
2214 | 2217 | |
2215 | 2218 | |
... | ... | @@ -2621,14 +2624,21 @@ |
2621 | 2624 | MongoCondition con2 = MongoCondition.newInstance("mphone",cardArticle.get("mphone"),MongoOper.IS); |
2622 | 2625 | cor8=con.orCondition(new MongoCondition[]{con1, con2}).getCriteria(); |
2623 | 2626 | } |
2627 | + Criteria cor9=MongoCondition.newInstance().getCriteria();//这里不能给null return拼接不能为空 | |
2628 | + if (null!=lastCheckDoctor2) { | |
2629 | + cor9.and("lastCheckDoctor").exists(lastCheckDoctor2); | |
2630 | + } | |
2631 | + if (null!=checkId) { | |
2632 | + condition = condition.and("checkId", checkId, MongoOper.EXISTS); | |
2633 | + } | |
2624 | 2634 | |
2625 | 2635 | /** |
2626 | 2636 | * 多个orCondition 需要添加Criteria来控制json同级两个and或者or来解决mongodb执行查询问题 |
2627 | 2637 | */ |
2628 | 2638 | if(c!=null){ |
2629 | - return new MongoCondition(c.andOperator(condition.getCriteria(),cor,cor2,cor3,cor4,cor5,cor6,cor7,cor8)).toMongoQuery(); | |
2639 | + return new MongoCondition(c.andOperator(condition.getCriteria(),cor,cor2,cor3,cor4,cor5,cor6,cor7,cor8,cor9)).toMongoQuery(); | |
2630 | 2640 | } |
2631 | - return new MongoCondition(cor.andOperator(condition.getCriteria(),cor2,cor3,cor4,cor5,cor6,cor7,cor8)).toMongoQuery(); | |
2641 | + return new MongoCondition(cor.andOperator(condition.getCriteria(),cor2,cor3,cor4,cor5,cor6,cor7,cor8,cor9)).toMongoQuery(); | |
2632 | 2642 | } |
2633 | 2643 | |
2634 | 2644 | public Boolean getFmDataStatu() { |
2635 | 2645 | |
... | ... | @@ -2835,12 +2845,28 @@ |
2835 | 2845 | return checkMonthIds; |
2836 | 2846 | } |
2837 | 2847 | |
2848 | + public Boolean getCheckId() { | |
2849 | + return checkId; | |
2850 | + } | |
2851 | + | |
2852 | + public void setCheckId(Boolean checkId) { | |
2853 | + this.checkId = checkId; | |
2854 | + } | |
2855 | + | |
2838 | 2856 | public void setCheckMonthIds(List<String> checkMonthIds) { |
2839 | 2857 | this.checkMonthIds = checkMonthIds; |
2840 | 2858 | } |
2841 | 2859 | |
2842 | 2860 | public String getApparatus() { |
2843 | 2861 | return apparatus; |
2862 | + } | |
2863 | + | |
2864 | + public Boolean getLastCheckDoctor2() { | |
2865 | + return lastCheckDoctor2; | |
2866 | + } | |
2867 | + | |
2868 | + public void setLastCheckDoctor2(Boolean lastCheckDoctor2) { | |
2869 | + this.lastCheckDoctor2 = lastCheckDoctor2; | |
2844 | 2870 | } |
2845 | 2871 | |
2846 | 2872 | public void setApparatus(String apparatus) { |
platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java
View file @
0914c61
... | ... | @@ -390,6 +390,7 @@ |
390 | 390 | |
391 | 391 | //初诊医生id |
392 | 392 | private String firstCheckId; |
393 | + private Boolean firstCheckId2; | |
393 | 394 | //初诊时间 |
394 | 395 | private Date firstCheckTimeStart; |
395 | 396 | private Date firstCheckTimeEnd; |
396 | 397 | |
397 | 398 | |
... | ... | @@ -1454,12 +1455,15 @@ |
1454 | 1455 | c1 = Criteria.where("modified").gte(modifiedStart).lte(modifiedEnd); |
1455 | 1456 | } |
1456 | 1457 | } |
1457 | - | |
1458 | + Criteria c4=MongoCondition.newInstance().getCriteria(); | |
1459 | + if (null != firstCheckId2) { | |
1460 | + c4.and("firstCheckId").exists(firstCheckId2); | |
1461 | + } | |
1458 | 1462 | if (null != c1) { |
1459 | - return new MongoCondition(c1.andOperator(condition.getCriteria(),c2,c3)).toMongoQuery(); | |
1463 | + return new MongoCondition(c1.andOperator(condition.getCriteria(),c2,c3,c4)).toMongoQuery(); | |
1460 | 1464 | // return new MongoCondition(c1.andOperator(condition.getCriteria())).toMongoQuery(); |
1461 | 1465 | } |
1462 | - return new MongoCondition(c2.andOperator(condition.getCriteria(),c3)).toMongoQuery(); | |
1466 | + return new MongoCondition(c2.andOperator(condition.getCriteria(),c3,c4)).toMongoQuery(); | |
1463 | 1467 | // return condition.toMongoQuery(); |
1464 | 1468 | } |
1465 | 1469 | |
... | ... | @@ -2275,6 +2279,14 @@ |
2275 | 2279 | |
2276 | 2280 | public Integer getServiceType() { |
2277 | 2281 | return serviceType; |
2282 | + } | |
2283 | + | |
2284 | + public Boolean getFirstCheckId2() { | |
2285 | + return firstCheckId2; | |
2286 | + } | |
2287 | + | |
2288 | + public void setFirstCheckId2(Boolean firstCheckId2) { | |
2289 | + this.firstCheckId2 = firstCheckId2; | |
2278 | 2290 | } |
2279 | 2291 | |
2280 | 2292 | public void setServiceType(Integer serviceType) { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/AreaCountController.java
View file @
0914c61
... | ... | @@ -13,6 +13,11 @@ |
13 | 13 | import org.slf4j.Logger; |
14 | 14 | import org.slf4j.LoggerFactory; |
15 | 15 | import org.springframework.beans.factory.annotation.Autowired; |
16 | +import org.springframework.data.mongodb.core.MongoTemplate; | |
17 | +import org.springframework.data.mongodb.core.aggregation.Aggregation; | |
18 | +import org.springframework.data.mongodb.core.aggregation.AggregationOperation; | |
19 | +import org.springframework.data.mongodb.core.aggregation.AggregationResults; | |
20 | +import org.springframework.data.mongodb.core.query.Criteria; | |
16 | 21 | import org.springframework.stereotype.Controller; |
17 | 22 | import org.springframework.web.bind.annotation.*; |
18 | 23 | |
... | ... | @@ -21,6 +26,7 @@ |
21 | 26 | import javax.validation.Valid; |
22 | 27 | import java.util.Calendar; |
23 | 28 | import java.util.Date; |
29 | +import java.util.HashMap; | |
24 | 30 | |
25 | 31 | /** |
26 | 32 | * 区域统计接口 |
... | ... | @@ -473,6 +479,52 @@ |
473 | 479 | @RequestParam(required = false) Integer endWeek) { |
474 | 480 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
475 | 481 | return patientSyncMysqlFacade.getLisCheckCount(time, hospitalId,provinceId,cityId,areaId, loginState.getId(),startWeek,endWeek); |
482 | + } | |
483 | + | |
484 | + /** | |
485 | + *河北省基本公共卫生服务项目(妇幼卫生部分)工作进度表 | |
486 | + * @param request | |
487 | + * @param provinceId 省 | |
488 | + * @param cityId 市 | |
489 | + * @param areaId 县区 | |
490 | + * @param streetId 街道 | |
491 | + * @param dateTime 年月日() | |
492 | + * @return | |
493 | + */ | |
494 | + @RequestMapping(method = RequestMethod.GET, value = "/getPublicHygieneServiceCount") | |
495 | + @ResponseBody | |
496 | + @TokenRequired | |
497 | + public BaseResponse getPublicHygieneServiceCount(HttpServletRequest request, | |
498 | + @RequestParam String provinceId, | |
499 | + @RequestParam String cityId, | |
500 | + @RequestParam String areaId, | |
501 | + @RequestParam( required = false) String streetId, | |
502 | + @RequestParam Date dateTime) { | |
503 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
504 | + return patientSyncMysqlFacade.getPublicHygieneServiceCount(provinceId,cityId,areaId,streetId,dateTime); | |
505 | + } | |
506 | + /** | |
507 | + *河北省基本公共卫生服务项目(妇幼卫生部分)工作进度表-导出 | |
508 | + * @param request | |
509 | + * @param provinceId 省 | |
510 | + * @param cityId 市 | |
511 | + * @param areaId 县区 | |
512 | + * @param streetId 街道 | |
513 | + * @param dateTime 年月日() | |
514 | + * @return | |
515 | + */ | |
516 | + @RequestMapping(method = RequestMethod.GET, value = "/getPublicHygieneServiceCountExport") | |
517 | + @ResponseBody | |
518 | + @TokenRequired | |
519 | + public void getPublicHygieneServiceCountExport(HttpServletRequest request, | |
520 | + HttpServletResponse response, | |
521 | + @RequestParam String provinceId, | |
522 | + @RequestParam String cityId, | |
523 | + @RequestParam String areaId, | |
524 | + @RequestParam( required = false) String streetId, | |
525 | + @RequestParam Date dateTime) { | |
526 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
527 | + patientSyncMysqlFacade.getPublicHygieneServiceCountExport(provinceId,cityId,areaId,streetId,dateTime,response); | |
476 | 528 | } |
477 | 529 | |
478 | 530 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientSyncMysqlFacade.java
View file @
0914c61
... | ... | @@ -2,15 +2,15 @@ |
2 | 2 | |
3 | 3 | import com.lyms.platform.biz.service.*; |
4 | 4 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
5 | +import com.lyms.platform.common.dao.operator.MongoCondition; | |
5 | 6 | import com.lyms.platform.common.enums.*; |
6 | 7 | import com.lyms.platform.common.result.BaseObjectResponse; |
7 | 8 | import com.lyms.platform.common.result.BaseResponse; |
8 | -import com.lyms.platform.common.utils.DateUtil; | |
9 | -import com.lyms.platform.common.utils.ExceptionUtils; | |
10 | -import com.lyms.platform.common.utils.JsonUtil; | |
11 | -import com.lyms.platform.common.utils.StringUtils; | |
9 | +import com.lyms.platform.common.result.PageResult; | |
10 | +import com.lyms.platform.common.utils.*; | |
12 | 11 | import com.lyms.platform.operate.web.result.BabyCheckPageResult; |
13 | 12 | import com.lyms.platform.operate.web.result.BabyPageResult; |
13 | +import com.lyms.platform.operate.web.utils.ResponseUtil; | |
14 | 14 | import com.lyms.platform.operate.web.utils.UnitConstants; |
15 | 15 | import com.lyms.platform.operate.web.utils.UnitUtils; |
16 | 16 | import com.lyms.platform.permission.model.*; |
17 | 17 | |
... | ... | @@ -26,7 +26,14 @@ |
26 | 26 | import org.apache.commons.collections.CollectionUtils; |
27 | 27 | import org.springframework.beans.factory.annotation.Autowired; |
28 | 28 | import org.springframework.beans.factory.annotation.Qualifier; |
29 | +import org.springframework.beans.factory.annotation.Value; | |
29 | 30 | import org.springframework.data.domain.Sort; |
31 | +import org.springframework.data.mongodb.core.MongoTemplate; | |
32 | +import org.springframework.data.mongodb.core.aggregation.Aggregation; | |
33 | +import org.springframework.data.mongodb.core.aggregation.AggregationOperation; | |
34 | +import org.springframework.data.mongodb.core.aggregation.AggregationResults; | |
35 | +import org.springframework.data.mongodb.core.query.Criteria; | |
36 | +import org.springframework.data.mongodb.core.query.Query; | |
30 | 37 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
31 | 38 | import org.springframework.stereotype.Component; |
32 | 39 | import org.springframework.web.bind.annotation.RequestMapping; |
33 | 40 | |
... | ... | @@ -34,7 +41,9 @@ |
34 | 41 | import org.springframework.web.bind.annotation.RequestParam; |
35 | 42 | import org.springframework.web.bind.annotation.ResponseBody; |
36 | 43 | |
44 | +import javax.servlet.http.HttpServletResponse; | |
37 | 45 | import java.lang.reflect.InvocationTargetException; |
46 | +import java.text.DecimalFormat; | |
38 | 47 | import java.util.*; |
39 | 48 | import java.util.concurrent.Future; |
40 | 49 | |
... | ... | @@ -69,6 +78,10 @@ |
69 | 78 | private AntenatalExaminationService antenatalExaminationService; |
70 | 79 | @Autowired |
71 | 80 | private OrganizationService organizationService; |
81 | + @Autowired | |
82 | + private MatDeliverFollowService matDeliverFollowService; | |
83 | + @Autowired | |
84 | + private MongoTemplate mongoTemplate; | |
72 | 85 | |
73 | 86 | private static Map<String,Integer> levels = new HashMap<>(); |
74 | 87 | { |
... | ... | @@ -3006,5 +3019,458 @@ |
3006 | 3019 | @Autowired |
3007 | 3020 | @Qualifier("commonThreadPool") |
3008 | 3021 | private ThreadPoolTaskExecutor commonThreadPool; |
3022 | + | |
3023 | + public BaseResponse getPublicHygieneServiceCount(String provinceId, String cityId,String areaId,String streetId, Date dateTime) { | |
3024 | + Date startDate=DateUtil.getDateMonthFirst(dateTime); | |
3025 | + Date endDate=DateUtil.getDayLastSecond(DateUtil.getDateMonthLast(dateTime)); | |
3026 | + List<Map> data=new ArrayList<>(); | |
3027 | + Map<String,Object> mapTotal=new HashMap<>(); | |
3028 | + //获得区县下的街道 | |
3029 | + List<BasicConfig> regions = getRegions(areaId,streetId); | |
3030 | + for (BasicConfig region : regions) { | |
3031 | + Map<String,Object> streetMap=new HashMap<>(); | |
3032 | + streetMap.put("streetName",region.getName()); | |
3033 | + //获得街道下的医院 | |
3034 | + List<Organization> organizations = getOrganization(region.getId()); | |
3035 | + for (Organization organization : organizations) { | |
3036 | + String hospitalId= StringUtils.getIntToVal(organization.getId()); | |
3037 | + //医院数据 | |
3038 | + getDateCount(hospitalId,startDate,endDate,streetMap); | |
3039 | + } | |
3040 | + //合计 | |
3041 | + mapTotal.put("streetName","合计"); | |
3042 | + int lastDate1= null==mapTotal.get("data1")?0:Integer.parseInt(mapTotal.get("data1").toString()); | |
3043 | + mapTotal.put("data1",null==streetMap.get("data1")?lastDate1:Integer.parseInt(streetMap.get("data1").toString())+lastDate1); | |
3044 | + int lastDate2= null==mapTotal.get("data2")?0:Integer.parseInt(mapTotal.get("data2").toString()); | |
3045 | + mapTotal.put("data2",null==streetMap.get("data2")?lastDate2:Integer.parseInt(streetMap.get("data2").toString())+lastDate2); | |
3046 | + int lastDate3= null==mapTotal.get("data3")?0:Integer.parseInt(mapTotal.get("data3").toString()); | |
3047 | + mapTotal.put("data3",null==streetMap.get("data3")?lastDate3:Integer.parseInt(streetMap.get("data3").toString())+lastDate3); | |
3048 | + int lastDate5= null==mapTotal.get("data5")?0:Integer.parseInt(mapTotal.get("data5").toString()); | |
3049 | + mapTotal.put("data5",null==streetMap.get("data5")?lastDate5:Integer.parseInt(streetMap.get("data5").toString())+lastDate5); | |
3050 | + int lastDate6= null==mapTotal.get("data6")?0:Integer.parseInt(mapTotal.get("data6").toString()); | |
3051 | + mapTotal.put("data6",null==streetMap.get("data6")?lastDate6:Integer.parseInt(streetMap.get("data6").toString())+lastDate6); | |
3052 | + int lastDate8= null==mapTotal.get("data8")?0:Integer.parseInt(mapTotal.get("data8").toString()); | |
3053 | + mapTotal.put("data8",null==streetMap.get("data8")?lastDate8:Integer.parseInt(streetMap.get("data8").toString())+lastDate8); | |
3054 | + int lastDate9= null==mapTotal.get("data9")?0:Integer.parseInt(mapTotal.get("data9").toString()); | |
3055 | + mapTotal.put("data9",null==streetMap.get("data9")?lastDate9:Integer.parseInt(streetMap.get("data9").toString())+lastDate9); | |
3056 | + int lastDate11= null==mapTotal.get("data11")?0:Integer.parseInt(mapTotal.get("data11").toString()); | |
3057 | + mapTotal.put("data11",null==streetMap.get("data11")?lastDate11:Integer.parseInt(streetMap.get("data11").toString())+lastDate11); | |
3058 | + int lastDate13= null==mapTotal.get("data13")?0:Integer.parseInt(mapTotal.get("data13").toString()); | |
3059 | + mapTotal.put("data13",null==streetMap.get("data13")?lastDate13:Integer.parseInt(streetMap.get("data13").toString())+lastDate13); | |
3060 | + int lastDate15= null==mapTotal.get("data15")?0:Integer.parseInt(mapTotal.get("data15").toString()); | |
3061 | + mapTotal.put("data15",null==streetMap.get("data15")?lastDate15:Integer.parseInt(streetMap.get("data15").toString())+lastDate15); | |
3062 | + int lastDate17= null==mapTotal.get("data17")?0:Integer.parseInt(mapTotal.get("data17").toString()); | |
3063 | + mapTotal.put("data17",null==streetMap.get("data17")?lastDate17:Integer.parseInt(streetMap.get("data17").toString())+lastDate17); | |
3064 | + int lastDate19= null==mapTotal.get("data19")?0:Integer.parseInt(mapTotal.get("data19").toString()); | |
3065 | + mapTotal.put("data19",null==streetMap.get("data19")?lastDate19:Integer.parseInt(streetMap.get("data19").toString())+lastDate19); | |
3066 | + int lastDate21= null==mapTotal.get("data21")?0:Integer.parseInt(mapTotal.get("data21").toString()); | |
3067 | + mapTotal.put("data21",null==streetMap.get("data21")?lastDate21:Integer.parseInt(streetMap.get("data21").toString())+lastDate21); | |
3068 | + | |
3069 | + data.add(streetMap); | |
3070 | + } | |
3071 | + DecimalFormat df = new DecimalFormat("0.00");//格式化小数,不足的补0 | |
3072 | + String data3_data2="0.00"; | |
3073 | + if(Integer.parseInt(mapTotal.get("data2").toString())!=0){ | |
3074 | + float v = (float) Integer.parseInt(mapTotal.get("data3").toString()) / Integer.parseInt(mapTotal.get("data2").toString()); | |
3075 | + if(v>=1){ | |
3076 | + data3_data2="100.00"; | |
3077 | + }else { | |
3078 | + data3_data2 = df.format(v * 100); | |
3079 | + } | |
3080 | + } | |
3081 | + mapTotal.put("data4",data3_data2+"%"); | |
3082 | + | |
3083 | + String data6_data5="0.00"; | |
3084 | + if(Integer.parseInt(mapTotal.get("data5").toString())!=0){ | |
3085 | + float v = (float) Integer.parseInt(mapTotal.get("data6").toString()) / Integer.parseInt(mapTotal.get("data5").toString()); | |
3086 | + if(v>=1){ | |
3087 | + data6_data5="100.00"; | |
3088 | + }else { | |
3089 | + data6_data5 = df.format(v * 100); | |
3090 | + } | |
3091 | + } | |
3092 | + mapTotal.put("data7",data6_data5+"%"); | |
3093 | + | |
3094 | + String data9_data8="0.00"; | |
3095 | + if(Integer.parseInt(mapTotal.get("data8").toString())!=0){ | |
3096 | + float v = (float) Integer.parseInt(mapTotal.get("data9").toString()) / Integer.parseInt(mapTotal.get("data8").toString()); | |
3097 | + if(v>=1){ | |
3098 | + data9_data8="100.00"; | |
3099 | + }else { | |
3100 | + data9_data8 = df.format(v * 100); | |
3101 | + } | |
3102 | + } | |
3103 | + mapTotal.put("data10",data9_data8+"%"); | |
3104 | + | |
3105 | + | |
3106 | + | |
3107 | + String data11_data8="0.00"; | |
3108 | + if(Integer.parseInt(mapTotal.get("data8").toString())!=0){ | |
3109 | + float v = (float) Integer.parseInt(mapTotal.get("data11").toString()) / Integer.parseInt(mapTotal.get("data8").toString()); | |
3110 | + if(v>=1){ | |
3111 | + data11_data8="100.00"; | |
3112 | + }else { | |
3113 | + data11_data8 = df.format(v * 100); | |
3114 | + } | |
3115 | + } | |
3116 | + mapTotal.put("data12",data11_data8+"%"); | |
3117 | + | |
3118 | + String data13_data8="0.00"; | |
3119 | + if(Integer.parseInt(mapTotal.get("data8").toString())!=0){ | |
3120 | + float v = (float) Integer.parseInt(mapTotal.get("data13").toString()) / Integer.parseInt(mapTotal.get("data8").toString()); | |
3121 | + if(v>=1){ | |
3122 | + data13_data8="100.00"; | |
3123 | + }else { | |
3124 | + data13_data8 = df.format(v * 100); | |
3125 | + } | |
3126 | + } | |
3127 | + mapTotal.put("data14",data13_data8+"%"); | |
3128 | + | |
3129 | + String data15_data2="0.00"; | |
3130 | + if(Integer.parseInt(mapTotal.get("data2").toString())!=0){ | |
3131 | + float v = (float) Integer.parseInt(mapTotal.get("data15").toString()) / Integer.parseInt(mapTotal.get("data2").toString()); | |
3132 | + if(v>=1){ | |
3133 | + data15_data2="100.00"; | |
3134 | + }else { | |
3135 | + data15_data2 = df.format(v * 100); | |
3136 | + } | |
3137 | + } | |
3138 | + mapTotal.put("data16",data15_data2+"%"); | |
3139 | + | |
3140 | + String data17_data2="0.00"; | |
3141 | + if(Integer.parseInt(mapTotal.get("data2").toString())!=0){ | |
3142 | + float v = (float) Integer.parseInt(mapTotal.get("data17").toString()) / Integer.parseInt(mapTotal.get("data2").toString()); | |
3143 | + if(v>=1){ | |
3144 | + data17_data2="100.00"; | |
3145 | + }else { | |
3146 | + data17_data2 = df.format(v * 100); | |
3147 | + } | |
3148 | + } | |
3149 | + mapTotal.put("data18",data17_data2+"%"); | |
3150 | + | |
3151 | + String data19_data2="0.00"; | |
3152 | + if(Integer.parseInt(mapTotal.get("data2").toString())!=0){ | |
3153 | + float v = (float) Integer.parseInt(mapTotal.get("data19").toString()) / Integer.parseInt(mapTotal.get("data2").toString()); | |
3154 | + if(v>=1){ | |
3155 | + data19_data2="100.00"; | |
3156 | + }else { | |
3157 | + data19_data2 = df.format(v * 100); | |
3158 | + } | |
3159 | + } | |
3160 | + mapTotal.put("data20",data19_data2+"%"); | |
3161 | + | |
3162 | + String data21_data2="0.00"; | |
3163 | + if(Integer.parseInt(mapTotal.get("data2").toString())!=0){ | |
3164 | + float v = (float) Integer.parseInt(mapTotal.get("data21").toString()) / Integer.parseInt(mapTotal.get("data2").toString()); | |
3165 | + if(v>=1){ | |
3166 | + data21_data2="100.00"; | |
3167 | + }else { | |
3168 | + data21_data2 = df.format(v * 100); | |
3169 | + } | |
3170 | + } | |
3171 | + mapTotal.put("data22",data21_data2+"%"); | |
3172 | + | |
3173 | + | |
3174 | + data.add(mapTotal); | |
3175 | + return new BaseObjectResponse().setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS).setData(data); | |
3176 | + } | |
3177 | + | |
3178 | + /** | |
3179 | + * 获得区县下的街道 | |
3180 | + * @param parentId 区县id | |
3181 | + * @param streetId 街道id | |
3182 | + * @return | |
3183 | + */ | |
3184 | + private List<BasicConfig> getRegions(String parentId,String streetId){ | |
3185 | + BasicConfigQuery query = new BasicConfigQuery(); | |
3186 | + query.setYn(YnEnums.YES.getId()); | |
3187 | + query.setParentId(parentId); | |
3188 | + query.setEnable(1); | |
3189 | + if(StringUtils.isNotEmpty(streetId)){ | |
3190 | + query.setId(streetId); | |
3191 | + } | |
3192 | + query.setTypeId("b7ea005c-dfac-4c2a-bdae-25239b3f44fd"); | |
3193 | + return basicConfigService.queryBasicConfig(query); | |
3194 | + } | |
3195 | + | |
3196 | + /** | |
3197 | + * 获得街道下的医院 | |
3198 | + * @param streetId 街道id | |
3199 | + * @return | |
3200 | + */ | |
3201 | + private List<Organization> getOrganization(String streetId){ | |
3202 | + OrganizationQuery organizationQuery = new OrganizationQuery(); | |
3203 | + organizationQuery.setStreetId(streetId); | |
3204 | + return organizationService.queryOrganization(organizationQuery); | |
3205 | + } | |
3206 | + | |
3207 | + /** | |
3208 | + * 医院数据 | |
3209 | + * @param hospitalId 医院id | |
3210 | + * @param startDate 开始时间 | |
3211 | + * @param endDate 结束时间 | |
3212 | + * @param hospitalDate 医院数据map | |
3213 | + * data1 本月活产数 | |
3214 | + * data2 累计活产数 | |
3215 | + * data3 新生儿访视人数 | |
3216 | + * data4 新生儿访视率% | |
3217 | + * data5 0-3岁儿童总数 | |
3218 | + * data6 0-3岁儿童系统管理人数 | |
3219 | + * data7 0-3岁儿童系统管理率% | |
3220 | + * data8 0-6岁儿童总数 | |
3221 | + * data9 0-6岁儿童系统管理人数 | |
3222 | + * data10 0-6岁儿童系统管理率% | |
3223 | + * data11 0-6岁儿童健康管理人数 | |
3224 | + * data12 0-6岁儿童健康管理率% | |
3225 | + * data13 0-6岁儿童眼保健及视力检查人数 | |
3226 | + * data14 0-6岁儿童眼保健及视力检查覆盖率% | |
3227 | + * data15 孕13周之前建册的人数 | |
3228 | + * data16 早孕建册率% | |
3229 | + * data17 孕产妇健康管理人数 | |
3230 | + * data18 孕产妇健康管理率% | |
3231 | + * data19 产后访视人数 | |
3232 | + * data20 产后访视率% | |
3233 | + * data21 孕产妇系统管理人数 | |
3234 | + * data22 孕产妇系统管理率% | |
3235 | + */ | |
3236 | + private void getDateCount(String hospitalId,Date startDate, Date endDate,Map hospitalDate){ | |
3237 | + //传入的时间获取年的第一天 | |
3238 | + Date startDateFirst=DateUtil.getYearFirst(DateUtil.getYear(startDate)); | |
3239 | + DecimalFormat df = new DecimalFormat("0.00");//格式化小数,不足的补0 | |
3240 | + //本月活产数 | |
3241 | + int data1=0; | |
3242 | +// for (int i=1;i<=7;i++){//多胎情况 | |
3243 | + MatDeliverQuery matDeliverQuery = new MatDeliverQuery(); | |
3244 | + matDeliverQuery.setHospitalId(hospitalId); | |
3245 | + matDeliverQuery.setYn(YnEnums.YES.getId()); | |
3246 | +// matDeliverQuery.setTireNumber(i); | |
3247 | + matDeliverQuery.setCreatedStart(startDate); | |
3248 | + matDeliverQuery.setEndStart(endDate); | |
3249 | + data1+=matDeliverService.count(matDeliverQuery);//*i | |
3250 | +// } | |
3251 | + int lastDate1= null==hospitalDate.get("data1")?0:Integer.parseInt(hospitalDate.get("data1").toString()); | |
3252 | + hospitalDate.put("data1",data1+lastDate1); | |
3253 | + //累计活产数 | |
3254 | + int data2=0; | |
3255 | +// for (int i=1;i<=7;i++){//多胎情况 | |
3256 | + MatDeliverQuery matDeliverQuery2 = new MatDeliverQuery(); | |
3257 | + matDeliverQuery2.setHospitalId(hospitalId); | |
3258 | + matDeliverQuery2.setYn(YnEnums.YES.getId()); | |
3259 | +// matDeliverQuery.setTireNumber(i); | |
3260 | + matDeliverQuery2.setCreatedStart(startDateFirst); | |
3261 | + matDeliverQuery2.setEndStart(endDate); | |
3262 | + data2+=matDeliverService.count(matDeliverQuery2);//*i; | |
3263 | +// } | |
3264 | + int lastDate2= null==hospitalDate.get("data2")?0:Integer.parseInt(hospitalDate.get("data2").toString()); | |
3265 | + hospitalDate.put("data2",data2+lastDate2); | |
3266 | + //新生儿访视人数 | |
3267 | + int data3=0; | |
3268 | + AggregationOperation match = Aggregation.match(Criteria. | |
3269 | + where("hospitalId").is(hospitalId) | |
3270 | + .and("yn").is("1") | |
3271 | + .and("created").gte(startDateFirst).lte(endDate)); | |
3272 | + AggregationOperation group = Aggregation.group("babyId"); | |
3273 | + Aggregation aggregation= Aggregation.newAggregation(match, group); | |
3274 | + AggregationResults<HashMap> result = mongoTemplate.aggregate(aggregation,"lyms_newborn_visit", HashMap.class); | |
3275 | + data3=result.getMappedResults().size(); | |
3276 | + int lastDate3= null==hospitalDate.get("data3")?0:Integer.parseInt(hospitalDate.get("data3").toString()); | |
3277 | + hospitalDate.put("data3",data3+lastDate3); | |
3278 | + //新生儿访视率% | |
3279 | + String data3_data2="0.00"; | |
3280 | + if(Integer.parseInt(hospitalDate.get("data2").toString())!=0){ | |
3281 | + float v = (float) Integer.parseInt(hospitalDate.get("data3").toString()) / Integer.parseInt(hospitalDate.get("data2").toString()); | |
3282 | + if(v>=1){ | |
3283 | + data3_data2="100.00"; | |
3284 | + }else { | |
3285 | + data3_data2 = df.format(v * 100); | |
3286 | + } | |
3287 | + } | |
3288 | + hospitalDate.put("data4",data3_data2+"%"); | |
3289 | + //0-3岁儿童总数 | |
3290 | + int data5=0; | |
3291 | + BabyModelQuery babyQuery=new BabyModelQuery(); | |
3292 | + babyQuery.setYn(YnEnums.YES.getId()); | |
3293 | + babyQuery.setHospitalId(hospitalId); | |
3294 | + babyQuery.setBirthStart(DateUtil.addYear(startDateFirst,-3)); | |
3295 | + babyQuery.setBirthEnd(endDate); | |
3296 | + data5 = babyBookbuildingService.queryBabyCount(babyQuery); | |
3297 | + int lastDate5= null==hospitalDate.get("data5")?0:Integer.parseInt(hospitalDate.get("data5").toString()); | |
3298 | + hospitalDate.put("data5",data5+lastDate5); | |
3299 | + //0-3岁儿童系统管理人数 | |
3300 | + int data6=0; | |
3301 | + babyQuery.setLastCheckDoctor2(true); | |
3302 | + data6 = babyBookbuildingService.queryBabyCount(babyQuery); | |
3303 | + int lastDate6= null==hospitalDate.get("data6")?0:Integer.parseInt(hospitalDate.get("data6").toString()); | |
3304 | + hospitalDate.put("data6",data6+lastDate6); | |
3305 | + //0-3岁儿童系统管理率% | |
3306 | + String data6_data5="0.00"; | |
3307 | + if(Integer.parseInt(hospitalDate.get("data5").toString())!=0){ | |
3308 | + float v = (float) Integer.parseInt(hospitalDate.get("data6").toString()) / Integer.parseInt(hospitalDate.get("data5").toString()); | |
3309 | + if(v>=1){ | |
3310 | + data6_data5="100.00"; | |
3311 | + }else { | |
3312 | + data6_data5 = df.format(v * 100); | |
3313 | + } | |
3314 | + } | |
3315 | + hospitalDate.put("data7",data6_data5+"%"); | |
3316 | + //0-6岁儿童总数 | |
3317 | + int data8=0; | |
3318 | + BabyModelQuery babyQuery2=new BabyModelQuery(); | |
3319 | + babyQuery2.setYn(YnEnums.YES.getId()); | |
3320 | + babyQuery2.setHospitalId(hospitalId); | |
3321 | + babyQuery2.setBirthStart(DateUtil.addYear(startDateFirst,-6)); | |
3322 | + babyQuery2.setBirthEnd(endDate); | |
3323 | + data8 = babyBookbuildingService.queryBabyCount(babyQuery2); | |
3324 | + int lastDate8= null==hospitalDate.get("data8")?0:Integer.parseInt(hospitalDate.get("data8").toString()); | |
3325 | + hospitalDate.put("data8",data8+lastDate8); | |
3326 | + //0-6岁儿童系统管理人数 | |
3327 | + int data9=0; | |
3328 | + babyQuery2.setLastCheckDoctor2(true); | |
3329 | + data9 = babyBookbuildingService.queryBabyCount(babyQuery2); | |
3330 | + int lastDate9= null==hospitalDate.get("data9")?0:Integer.parseInt(hospitalDate.get("data9").toString()); | |
3331 | + hospitalDate.put("data9",data9+lastDate9); | |
3332 | + //0-6岁儿童系统管理率% | |
3333 | + String data9_data8="0.00"; | |
3334 | + if(Integer.parseInt(hospitalDate.get("data8").toString())!=0){ | |
3335 | + float v = (float) Integer.parseInt(hospitalDate.get("data9").toString()) / Integer.parseInt(hospitalDate.get("data8").toString()); | |
3336 | + if(v>=1){ | |
3337 | + data9_data8="100.00"; | |
3338 | + }else { | |
3339 | + data9_data8 = df.format(v * 100); | |
3340 | + } | |
3341 | + } | |
3342 | + hospitalDate.put("data10",data9_data8+"%"); | |
3343 | + //0-6岁儿童健康管理人数 | |
3344 | + hospitalDate.put("data11",data9+lastDate9); | |
3345 | + //0-6岁儿童健康管理率% | |
3346 | + hospitalDate.put("data12",data9_data8+"%"); | |
3347 | + //0-6岁儿童眼保健及视力检查人数 | |
3348 | + int data13=0; | |
3349 | + BabyModelQuery babyQuery3=new BabyModelQuery(); | |
3350 | + babyQuery3.setYn(YnEnums.YES.getId()); | |
3351 | + babyQuery3.setHospitalId(hospitalId); | |
3352 | + babyQuery3.setBirthStart(DateUtil.addYear(startDateFirst,-6)); | |
3353 | + babyQuery3.setBirthEnd(endDate); | |
3354 | + babyQuery3.setCheckId(true); | |
3355 | + data13 = babyBookbuildingService.queryBabyCount(babyQuery3); | |
3356 | + int lastDate13= null==hospitalDate.get("data13")?0:Integer.parseInt(hospitalDate.get("data13").toString()); | |
3357 | + hospitalDate.put("data13",data13+lastDate13); | |
3358 | + //0-6岁儿童眼保健及视力检查覆盖率% | |
3359 | + String data13_data8="0.00"; | |
3360 | + if(Integer.parseInt(hospitalDate.get("data8").toString())!=0){ | |
3361 | + float v = (float) Integer.parseInt(hospitalDate.get("data13").toString()) / Integer.parseInt(hospitalDate.get("data8").toString()); | |
3362 | + if(v>=1){ | |
3363 | + data13_data8="100.00"; | |
3364 | + }else { | |
3365 | + data13_data8 = df.format(v * 100); | |
3366 | + } | |
3367 | + } | |
3368 | + hospitalDate.put("data14",data13_data8+"%"); | |
3369 | + //孕13周之前建册的人数 | |
3370 | + int data15=0; | |
3371 | + PatientsQuery patientsQuery=new PatientsQuery(); | |
3372 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
3373 | + patientsQuery.setHospitalId(hospitalId); | |
3374 | + patientsQuery.setBuildDaysEnd(13*7); | |
3375 | + patientsQuery.setBookbuildingDateStart(startDateFirst); | |
3376 | + patientsQuery.setBookbuildingDateEnd(endDate); | |
3377 | + data15=patientsService.queryPatientCount(patientsQuery); | |
3378 | + int lastDate15= null==hospitalDate.get("data15")?0:Integer.parseInt(hospitalDate.get("data15").toString()); | |
3379 | + hospitalDate.put("data15",data15+lastDate15); | |
3380 | + //早孕建册率% | |
3381 | + String data15_data2="0.00"; | |
3382 | + if(Integer.parseInt(hospitalDate.get("data2").toString())!=0){ | |
3383 | + float v = (float) Integer.parseInt(hospitalDate.get("data15").toString()) / Integer.parseInt(hospitalDate.get("data2").toString()); | |
3384 | + if(v>=1){ | |
3385 | + data15_data2="100.00"; | |
3386 | + }else { | |
3387 | + data15_data2 = df.format(v * 100); | |
3388 | + } | |
3389 | + } | |
3390 | + hospitalDate.put("data16",data15_data2+"%"); | |
3391 | + //孕产妇健康管理人数 | |
3392 | + int data17=0; | |
3393 | + PatientsQuery patientsQuery2=new PatientsQuery(); | |
3394 | + patientsQuery2.setYn(YnEnums.YES.getId()); | |
3395 | + patientsQuery2.setHospitalId(hospitalId); | |
3396 | + patientsQuery2.setBookbuildingDateStart(startDateFirst); | |
3397 | + patientsQuery2.setBookbuildingDateEnd(endDate); | |
3398 | + patientsQuery2.setFirstCheckId2(true); | |
3399 | + data17=patientsService.queryPatientCount(patientsQuery2); | |
3400 | + int lastDate17= null==hospitalDate.get("data17")?0:Integer.parseInt(hospitalDate.get("data17").toString()); | |
3401 | + hospitalDate.put("data17",data17+lastDate17); | |
3402 | + //孕产妇健康管理率% | |
3403 | + String data17_data2="0.00"; | |
3404 | + if(Integer.parseInt(hospitalDate.get("data2").toString())!=0){ | |
3405 | + float v = (float) Integer.parseInt(hospitalDate.get("data17").toString()) / Integer.parseInt(hospitalDate.get("data2").toString()); | |
3406 | + if(v>=1){ | |
3407 | + data17_data2="100.00"; | |
3408 | + }else { | |
3409 | + data17_data2 = df.format(v * 100); | |
3410 | + } | |
3411 | + } | |
3412 | + hospitalDate.put("data18",data17_data2+"%"); | |
3413 | + //产后访视人数 | |
3414 | + int data19=0; | |
3415 | + AggregationOperation match2 = Aggregation.match(Criteria | |
3416 | + .where("hospitalId").is(hospitalId) | |
3417 | + .and("createDate").gte(startDateFirst).lte(endDate)); | |
3418 | + AggregationOperation group2 = Aggregation.group("pid"); | |
3419 | + Aggregation aggregation2= Aggregation.newAggregation(match2, group2); | |
3420 | + AggregationResults<HashMap> result2 = mongoTemplate.aggregate(aggregation2,"lyms_matdeliver_follow", HashMap.class); | |
3421 | + data19=result2.getMappedResults().size(); | |
3422 | + int lastDate19= null==hospitalDate.get("data19")?0:Integer.parseInt(hospitalDate.get("data19").toString()); | |
3423 | + hospitalDate.put("data19",data19+lastDate19); | |
3424 | + //产后访视率% | |
3425 | + String data19_data2="0.00"; | |
3426 | + if(Integer.parseInt(hospitalDate.get("data2").toString())!=0){ | |
3427 | + float v = (float) Integer.parseInt(hospitalDate.get("data19").toString()) / Integer.parseInt(hospitalDate.get("data2").toString()); | |
3428 | + if(v>=1){ | |
3429 | + data19_data2="100.00"; | |
3430 | + }else { | |
3431 | + data19_data2 = df.format(v * 100); | |
3432 | + } | |
3433 | + } | |
3434 | + hospitalDate.put("data20",data19_data2+"%"); | |
3435 | + //孕产妇系统管理人数 | |
3436 | + hospitalDate.put("data21",data19); | |
3437 | + //孕产妇系统管理率% | |
3438 | + hospitalDate.put("data22",data19_data2+"%"); | |
3439 | + } | |
3440 | + | |
3441 | + public void getPublicHygieneServiceCountExport(String provinceId, String cityId, String areaId, String streetId, Date dateTime, HttpServletResponse response) { | |
3442 | + Map<String, String> cnames = new LinkedHashMap<>(); | |
3443 | + cnames.put("streetName", "乡镇"); | |
3444 | + cnames.put("data1", "本月活产数"); | |
3445 | + cnames.put("data2", "累计活产数"); | |
3446 | + cnames.put("data3", "新生儿访视人数"); | |
3447 | + cnames.put("data4", "新生儿访视率%"); | |
3448 | + cnames.put("data5", "0-3岁儿童总数"); | |
3449 | + cnames.put("data6", "0-3岁儿童系统管理人数"); | |
3450 | + cnames.put("data7", "0-3岁儿童系统管理率%"); | |
3451 | + cnames.put("data8", "0-6岁儿童总数"); | |
3452 | + cnames.put("data9", "0-6岁儿童系统管理人数"); | |
3453 | + cnames.put("data10", "0-6岁儿童系统管理率%"); | |
3454 | + cnames.put("data11", "0-6岁儿童健康管理人数"); | |
3455 | + cnames.put("data12", "0-6岁儿童健康管理率%"); | |
3456 | + cnames.put("data13", "0-6岁儿童眼保健及视力检查人数"); | |
3457 | + cnames.put("data14", "0-6岁儿童眼保健及视力检查覆盖率%"); | |
3458 | + cnames.put("data15", "孕13周之前建册的人数"); | |
3459 | + cnames.put("data16", "早孕建册率%"); | |
3460 | + cnames.put("data17", "孕产妇健康管理人数"); | |
3461 | + cnames.put("data18", "孕产妇健康管理率%"); | |
3462 | + cnames.put("data19", "产后访视人数"); | |
3463 | + cnames.put("data20", "产后访视率%"); | |
3464 | + cnames.put("data21", "孕产妇系统管理人数"); | |
3465 | + cnames.put("data22", "孕产妇系统管理率%"); | |
3466 | + List<Map<String, Object>> results = new ArrayList<>(); | |
3467 | + | |
3468 | + BaseObjectResponse baseObjectResponse= (BaseObjectResponse) getPublicHygieneServiceCount(provinceId, cityId, areaId, streetId, dateTime); | |
3469 | + List<Map> list= (List<Map>) baseObjectResponse.getData(); | |
3470 | + for (Map<String, Object> map : list) { | |
3471 | + results.add(map); | |
3472 | + } | |
3473 | + ResponseUtil.responseExcel(cnames, results, response); | |
3474 | + } | |
3009 | 3475 | } |