Commit 2d7371a2ed0c76f75ad3bfacf1684197faca1982
1 parent
7cb7d127b9
Exists in
master
and in
6 other branches
update
Showing 8 changed files with 234 additions and 8 deletions
- platform-dal/src/main/java/com/lyms/platform/pojo/ResidentsArchiveModel.java
- platform-dal/src/main/java/com/lyms/platform/query/ResidentsArchiveQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PreEugenicsBaseController.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/AntExRecordFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/IPreEugenicsService.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PreEugebicsServiceImpl.java
- platform-transfer/src/main/resources/application.yml
platform-dal/src/main/java/com/lyms/platform/pojo/ResidentsArchiveModel.java
View file @
2d7371a
... | ... | @@ -193,6 +193,17 @@ |
193 | 193 | |
194 | 194 | private Long code; |
195 | 195 | |
196 | + //0 或者空不是 1是 | |
197 | + private Integer hasHj; | |
198 | + | |
199 | + public Integer getHasHj() { | |
200 | + return hasHj; | |
201 | + } | |
202 | + | |
203 | + public ResidentsArchiveModel setHasHj(Integer hasHj) { | |
204 | + this.hasHj = hasHj; | |
205 | + return this; | |
206 | + } | |
196 | 207 | |
197 | 208 | public Integer getMilitary() { |
198 | 209 | return military; |
platform-dal/src/main/java/com/lyms/platform/query/ResidentsArchiveQuery.java
View file @
2d7371a
... | ... | @@ -139,6 +139,8 @@ |
139 | 139 | //配偶证件号 |
140 | 140 | private String spouseCardNo; |
141 | 141 | |
142 | + | |
143 | + | |
142 | 144 | @Override |
143 | 145 | public MongoQuery convertToQuery() { |
144 | 146 | MongoCondition condition = MongoCondition.newInstance(); |
... | ... | @@ -153,6 +155,10 @@ |
153 | 155 | condition = condition.and("isHistory", false, MongoOper.EXISTS); |
154 | 156 | } |
155 | 157 | |
158 | + if (hasHj != null) { | |
159 | + condition = condition.and("hasHj", hasHj, MongoOper.IS); | |
160 | + } | |
161 | + | |
156 | 162 | if (StringUtils.isNotEmpty(pregnantBuild)) { |
157 | 163 | condition = condition.and("pregnantBuild", pregnantBuild, MongoOper.IS); |
158 | 164 | } |
... | ... | @@ -327,6 +333,18 @@ |
327 | 333 | return condition.toMongoQuery(); |
328 | 334 | } |
329 | 335 | |
336 | + | |
337 | + //0 或者空不是 1是 | |
338 | + private Integer hasHj; | |
339 | + | |
340 | + public Integer getHasHj() { | |
341 | + return hasHj; | |
342 | + } | |
343 | + | |
344 | + public ResidentsArchiveQuery setHasHj(Integer hasHj) { | |
345 | + this.hasHj = hasHj; | |
346 | + return this; | |
347 | + } | |
330 | 348 | |
331 | 349 | public String getSpouseCardNo() { |
332 | 350 | return spouseCardNo; |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PreEugenicsBaseController.java
View file @
2d7371a
1 | 1 | package com.lyms.platform.operate.web.controller; |
2 | 2 | |
3 | 3 | import javax.servlet.http.HttpServletRequest; |
4 | +import javax.servlet.http.HttpServletResponse; | |
4 | 5 | |
5 | 6 | import com.lyms.hospitalapi.lcfy.LcTyInterface; |
6 | 7 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
8 | +import com.lyms.platform.common.result.BaseObjectResponse; | |
7 | 9 | import com.lyms.platform.operate.web.request.YqysParamRequest; |
8 | 10 | import com.lyms.platform.operate.web.service.impl.PreEugebicsServiceImpl; |
9 | 11 | import com.lyms.platform.pojo.BasicConfig; |
... | ... | @@ -22,6 +24,8 @@ |
22 | 24 | import com.lyms.platform.operate.web.request.PreEugenicsBaseRequest; |
23 | 25 | import com.lyms.platform.operate.web.service.IPreEugenicsService; |
24 | 26 | |
27 | +import java.util.Date; | |
28 | + | |
25 | 29 | /** |
26 | 30 | * @author: shuai-Bo |
27 | 31 | * @Date: 2019/11/20 0020 |
... | ... | @@ -176,6 +180,34 @@ |
176 | 180 | @TokenRequired |
177 | 181 | public BaseResponse setSendCountry(@PathVariable("id")String id) { |
178 | 182 | return iPreEugenicsService.setSendCountry(id); |
183 | + } | |
184 | + | |
185 | + | |
186 | + /** | |
187 | + *获取荣成乡镇婚孕检统计 | |
188 | + * @param time | |
189 | + * @param request | |
190 | + * @return | |
191 | + */ | |
192 | + @RequestMapping(method = RequestMethod.GET, value = "/getRcCount") | |
193 | + @ResponseBody | |
194 | + @TokenRequired | |
195 | + public BaseObjectResponse getRcCount(@RequestParam String time, HttpServletRequest request) { | |
196 | + return iPreEugenicsService.getRcCount(time, getUserId(request)); | |
197 | + } | |
198 | + | |
199 | + | |
200 | + /** | |
201 | + * 导出数据 | |
202 | + * @param time | |
203 | + * @param request | |
204 | + * @param response | |
205 | + */ | |
206 | + @ResponseBody | |
207 | + @TokenRequired | |
208 | + @RequestMapping(value = "/exportRcCount", method = RequestMethod.GET) | |
209 | + public void exportRcCount(@RequestParam String time, HttpServletRequest request, HttpServletResponse response) { | |
210 | + iPreEugenicsService.exportRcCount(time, getUserId(request),response); | |
179 | 211 | } |
180 | 212 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
View file @
2d7371a
... | ... | @@ -3327,7 +3327,7 @@ |
3327 | 3327 | public String setOrgAreaUrlConfig(@RequestParam(required = true) String cityId) |
3328 | 3328 | { |
3329 | 3329 | Map<String,String> urlMap = new HashMap<>(); |
3330 | - urlMap.put("2","https://area-qhd-api.healthbaby.com.cn:18019");//,"秦皇岛" | |
3330 | + urlMap.put("2", "https://area-qhd-api.healthbaby.com.cn:18019");//,"秦皇岛" | |
3331 | 3331 | urlMap.put("5113aa","https://area-nc-api.healthbaby.com.cn:12356");//,"南充" |
3332 | 3332 | urlMap.put("9","https://area-chengde-api.healthbaby.com.cn:12356");//,"承德" |
3333 | 3333 | urlMap.put("4", "https://rp-api.healthbaby.com.cn");//,"线上" |
... | ... | @@ -3382,5 +3382,54 @@ |
3382 | 3382 | String s = HttpClientUtil.doGet("http://localhost:9090/qhd/getVcCardNoPwd", map, "utf-8", null); |
3383 | 3383 | return s; |
3384 | 3384 | } |
3385 | + | |
3386 | + | |
3387 | + @RequestMapping(value = "/setNumberCode", method = RequestMethod.GET) | |
3388 | + @ResponseBody | |
3389 | + public String setNumberCode(@RequestParam(required = false) String hid) { | |
3390 | + PatientsQuery patientQuery = new PatientsQuery(); | |
3391 | + patientQuery.setYn(YnEnums.YES.getId()); | |
3392 | + if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(hid)) | |
3393 | + { | |
3394 | + patientQuery.setHospitalId(hid); | |
3395 | + } | |
3396 | + | |
3397 | + patientQuery.setType(1); | |
3398 | + | |
3399 | + List<Patients> patientses = patientsService.queryPatient(patientQuery); | |
3400 | + int batchSize = 2000; | |
3401 | + int end = 0; | |
3402 | + for (int i = 0; i < patientses.size(); i += batchSize) { | |
3403 | + end = (end + batchSize); | |
3404 | + if (end > patientses.size()) { | |
3405 | + end = patientses.size(); | |
3406 | + } | |
3407 | + System.out.println("start:" + i + ",end:" + end); | |
3408 | + final List<Patients> tempList = patientses.subList(i, end); | |
3409 | + commonThreadPool.execute(new Runnable() { | |
3410 | + @Override | |
3411 | + public void run() { | |
3412 | + if (CollectionUtils.isNotEmpty(tempList)) { | |
3413 | + for (Patients pat : tempList) { | |
3414 | + if (pat != null) { | |
3415 | + if (pat.getCardNo().length() > 8) | |
3416 | + { | |
3417 | + pat.setNumberCode(pat.getCardNo().substring(pat.getCardNo().length() - 8)); | |
3418 | + } | |
3419 | + else | |
3420 | + { | |
3421 | + pat.setNumberCode(pat.getCardNo()); | |
3422 | + } | |
3423 | + patientsService.updatePatient(pat); | |
3424 | + } | |
3425 | + } | |
3426 | + } | |
3427 | + } | |
3428 | + }); | |
3429 | + } | |
3430 | + | |
3431 | + return "setNumberCode finish"; | |
3432 | + } | |
3433 | + | |
3385 | 3434 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntExRecordFacade.java
View file @
2d7371a
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/IPreEugenicsService.java
View file @
2d7371a
1 | 1 | package com.lyms.platform.operate.web.service; |
2 | 2 | |
3 | +import com.lyms.platform.common.result.BaseObjectResponse; | |
3 | 4 | import com.lyms.platform.common.result.BaseResponse; |
4 | 5 | import com.lyms.platform.operate.web.request.PreEugenicsBaseListRequest; |
5 | 6 | import com.lyms.platform.operate.web.request.PreEugenicsBaseRequest; |
6 | 7 | |
8 | +import javax.servlet.http.HttpServletResponse; | |
9 | + | |
7 | 10 | public interface IPreEugenicsService extends IFormReportService<PreEugenicsBaseRequest, PreEugenicsBaseListRequest> { |
8 | 11 | /** |
9 | 12 | * 删除 |
... | ... | @@ -15,5 +18,9 @@ |
15 | 18 | BaseResponse setPreEugenicsCheckItem(String id); |
16 | 19 | |
17 | 20 | BaseResponse setSendCountry(String id); |
21 | + | |
22 | + BaseObjectResponse getRcCount(String time, Integer userId); | |
23 | + | |
24 | + void exportRcCount(String time, Integer userId, HttpServletResponse response); | |
18 | 25 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PreEugebicsServiceImpl.java
View file @
2d7371a
... | ... | @@ -3,9 +3,16 @@ |
3 | 3 | import java.util.*; |
4 | 4 | |
5 | 5 | import com.lyms.hospitalapi.lcfy.LisService; |
6 | +import com.lyms.platform.biz.service.ResidentsArchiveService; | |
6 | 7 | import com.lyms.platform.common.enums.YnEnums; |
8 | +import com.lyms.platform.common.result.BaseObjectResponse; | |
9 | +import com.lyms.platform.common.utils.*; | |
7 | 10 | import com.lyms.platform.operate.web.facade.AutoMatchFacade; |
8 | 11 | import com.lyms.platform.operate.web.request.YqysParamRequest; |
12 | +import com.lyms.platform.operate.web.utils.ResponseUtil; | |
13 | +import com.lyms.platform.permission.model.Organization; | |
14 | +import com.lyms.platform.permission.model.OrganizationQuery; | |
15 | +import com.lyms.platform.permission.service.OrganizationService; | |
9 | 16 | import com.lyms.platform.permission.service.UsersService; |
10 | 17 | import com.lyms.platform.pojo.BasicConfig; |
11 | 18 | import com.lyms.platform.query.ResidentsArchiveQuery; |
... | ... | @@ -23,10 +30,6 @@ |
23 | 30 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
24 | 31 | import com.lyms.platform.common.result.BaseListResponse; |
25 | 32 | import com.lyms.platform.common.result.BaseResponse; |
26 | -import com.lyms.platform.common.utils.DateUtil; | |
27 | -import com.lyms.platform.common.utils.MongoConvertHelper; | |
28 | -import com.lyms.platform.common.utils.ReflectionUtils; | |
29 | -import com.lyms.platform.common.utils.StringUtils; | |
30 | 33 | import com.lyms.platform.operate.web.request.CommonParamRequest; |
31 | 34 | import com.lyms.platform.operate.web.request.PreEugenicsBaseListRequest; |
32 | 35 | import com.lyms.platform.operate.web.request.PreEugenicsBaseRequest; |
... | ... | @@ -36,6 +39,8 @@ |
36 | 39 | import com.lyms.platform.pojo.PreEugenicsBaseModel; |
37 | 40 | import com.lyms.platform.pojo.ResidentsArchiveModel; |
38 | 41 | |
42 | +import javax.servlet.http.HttpServletResponse; | |
43 | + | |
39 | 44 | /** |
40 | 45 | * 孕前优生实现类 |
41 | 46 | * |
42 | 47 | |
43 | 48 | |
44 | 49 | |
... | ... | @@ -53,14 +58,21 @@ |
53 | 58 | private MongoTemplate mongoTemplate; |
54 | 59 | |
55 | 60 | @Autowired |
61 | + private UsersService usersService; | |
62 | + | |
63 | + @Autowired | |
64 | + private LisService lcfyLisService; | |
65 | + | |
66 | + @Autowired | |
56 | 67 | private BasicConfigService basicConfigService; |
57 | 68 | |
58 | 69 | @Autowired |
59 | - private UsersService usersService; | |
70 | + private OrganizationService organizationService; | |
60 | 71 | |
61 | 72 | @Autowired |
62 | - private LisService lcfyLisService; | |
73 | + private ResidentsArchiveService residentsArchiveService; | |
63 | 74 | |
75 | + | |
64 | 76 | /** |
65 | 77 | * 根据身份证号获取对应的孕前优生信息 |
66 | 78 | * |
... | ... | @@ -545,6 +557,102 @@ |
545 | 557 | mongoTemplate.updateFirst(query, update, PreEugenicsBaseModel.class); |
546 | 558 | } |
547 | 559 | return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); |
560 | + } | |
561 | + | |
562 | + @Override | |
563 | + public BaseObjectResponse getRcCount(String time, Integer userId) { | |
564 | + | |
565 | + List<Map<String,Object>> datas = getDatas( time, userId); | |
566 | + | |
567 | + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(datas); | |
568 | + } | |
569 | + | |
570 | + @Override | |
571 | + public void exportRcCount(String time, Integer userId, HttpServletResponse response) { | |
572 | + | |
573 | + List<Map<String,Object>> datas = getDatas( time, userId); | |
574 | + Map<String, String> cnames = new LinkedHashMap<>(); | |
575 | + cnames.put("name", "乡镇"); | |
576 | + cnames.put("hjCount", "单婚"); | |
577 | + cnames.put("yjCount", "单孕"); | |
578 | + cnames.put("tcCount", "套餐"); | |
579 | + ResponseUtil.responseExcel(cnames, datas, response); | |
580 | + | |
581 | + } | |
582 | + | |
583 | + | |
584 | + private List<Map<String,Object>> getDatas(String time,Integer userId) | |
585 | + { | |
586 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
587 | + Organization organization = organizationService.getOrganization(Integer.valueOf(hospitalId)); | |
588 | + List<Map<String,Object>> datas = new LinkedList<>(); | |
589 | + | |
590 | + int hjAllCount = 0; | |
591 | + int yjAllCount = 0; | |
592 | + int tcAllCount = 0; | |
593 | + | |
594 | + List<BasicConfig> items = basicConfigService.queryByParentId(organization.getAreaId()); | |
595 | + if (CollectionUtils.isNotEmpty(items)) | |
596 | + { | |
597 | + for (BasicConfig item : items) | |
598 | + { | |
599 | + Map<String,Object> data = new HashMap(); | |
600 | + data.put("name",item.getName()); | |
601 | + //查询条件 | |
602 | + ResidentsArchiveQuery query = new ResidentsArchiveQuery(); | |
603 | + query.setYn(YnEnums.YES.getId()); | |
604 | + query.setCheckup("1"); | |
605 | + query.setSex(SystemConfig.WOMAN_ID); | |
606 | + query.setStreetId(item.getId()); | |
607 | + | |
608 | + if (hospitalId != null) { | |
609 | + query.setHospitalId(hospitalId); | |
610 | + } | |
611 | + if (StringUtils.isNotEmpty(time)) { | |
612 | + try { | |
613 | + query.setBuildDateStart(DateUtil.getSNDate(time)[0]); | |
614 | + query.setBuildDateEnd(DateUtil.getSNDate(time)[1]); | |
615 | + } catch (Exception e) { | |
616 | + e.printStackTrace(); | |
617 | + } | |
618 | + } | |
619 | + System.out.println(query.convertToQuery().convertToMongoQuery().toString()); | |
620 | + int hjCount = residentsArchiveService.queryResidentCount(query.convertToQuery()); | |
621 | + hjAllCount+=hjCount; | |
622 | + Query yquery = new Query(); | |
623 | + | |
624 | + String[] arrs = time.split(" - "); | |
625 | + Date start = DateUtil.parseYMD(arrs[0]); | |
626 | + Date end = DateUtil.parseYMD(arrs[1]); | |
627 | + end = DateUtil.getDayLastSecond(end); | |
628 | + yquery.addCriteria(Criteria.where("fillDate").gte(start).lte(end)); | |
629 | + | |
630 | + yquery.addCriteria(Criteria.where("hyj").is(1)); | |
631 | + long yjCount = mongoTemplate.count(yquery, PreEugenicsBaseModel.class); | |
632 | + yjAllCount += yjCount; | |
633 | + | |
634 | + | |
635 | + Query tquery = new Query(); | |
636 | + tquery.addCriteria(Criteria.where("fillDate").gte(start).lte(end)); | |
637 | + tquery.addCriteria(Criteria.where("hyj").is(2)); | |
638 | + long tcCount = mongoTemplate.count(tquery, PreEugenicsBaseModel.class); | |
639 | + tcAllCount += tcCount; | |
640 | + | |
641 | + data.put("hjCount",hjCount); | |
642 | + data.put("yjCount", yjCount); | |
643 | + data.put("tcCount",tcCount); | |
644 | + | |
645 | + datas.add(data); | |
646 | + | |
647 | + } | |
648 | + Map<String,Object> data = new HashMap(); | |
649 | + data.put("name","合计"); | |
650 | + data.put("hjCount",hjAllCount); | |
651 | + data.put("yjCount",yjAllCount); | |
652 | + data.put("tcCount",tcAllCount); | |
653 | + datas.add(data); | |
654 | + } | |
655 | + return datas; | |
548 | 656 | } |
549 | 657 | } |
platform-transfer/src/main/resources/application.yml
View file @
2d7371a