Commit 06dcc557dd666080a5fa4689eabf65b8019b097c
1 parent
e10fd36ae8
Exists in
master
and in
6 other branches
区域围产儿统计
Showing 6 changed files with 680 additions and 17 deletions
- platform-common/src/main/java/com/lyms/platform/common/utils/ExcelUtil.java
- platform-dal/src/main/java/com/lyms/platform/query/MatDeliverQuery.java
- platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyBuildController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java
platform-common/src/main/java/com/lyms/platform/common/utils/ExcelUtil.java
View file @
06dcc55
... | ... | @@ -408,9 +408,115 @@ |
408 | 408 | |
409 | 409 | } |
410 | 410 | |
411 | - ws.addCell(new Label(0, values.size()+5, "实际报出日期:"+DateUtil.getyyyy_MM_dd(new Date())+" 单位负责人签字: 填表人签名: ", h1Formt)); | |
411 | + ws.addCell(new Label(0, values.size()+5, "实际报出日期:"+DateUtil.getyyyy_MM_dd1(new Date())+" 单位负责人签字: 填表人签名: ", h1Formt)); | |
412 | 412 | |
413 | 413 | ws.mergeCells(0, values.size() +5, 28, values.size() + 5); |
414 | + | |
415 | + book.write(); | |
416 | + book.close(); | |
417 | + wb.close(); | |
418 | + }catch (Exception e) | |
419 | + { | |
420 | + e.printStackTrace(); | |
421 | + } | |
422 | + | |
423 | + } | |
424 | + | |
425 | + | |
426 | + | |
427 | + public static void writeWcBabyExclFile(String filePath,OutputStream out,List<Map<String,String>> values,List<Map<String,String>> qkValues,String titleName,String h1) | |
428 | + { | |
429 | + | |
430 | + File file = new File(filePath); | |
431 | + InputStream in = null; | |
432 | + Workbook wb = null; | |
433 | + try { | |
434 | + in = new FileInputStream(file); | |
435 | + wb = Workbook.getWorkbook(in); | |
436 | + | |
437 | + WritableWorkbook book = wb.createWorkbook(out,wb); | |
438 | + WritableSheet ws = book.getSheet(0); | |
439 | + WritableFont contentFont = new WritableFont(WritableFont.ARIAL, 12, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); | |
440 | + WritableCellFormat contentFormt = new WritableCellFormat(contentFont); | |
441 | + contentFormt.setAlignment(jxl.format.Alignment.CENTRE); | |
442 | + contentFormt.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); | |
443 | + contentFormt.setVerticalAlignment(VerticalAlignment.CENTRE); | |
444 | + | |
445 | + WritableFont title = new WritableFont(WritableFont.ARIAL, 18, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); | |
446 | + WritableCellFormat titleFormt = new WritableCellFormat(title); | |
447 | + titleFormt.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); | |
448 | + titleFormt.setAlignment(jxl.format.Alignment.CENTRE); | |
449 | + titleFormt.setVerticalAlignment(VerticalAlignment.CENTRE); | |
450 | + | |
451 | + WritableFont h1Title = new WritableFont(WritableFont.ARIAL, 12, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); | |
452 | + WritableCellFormat h1Formt = new WritableCellFormat(h1Title); | |
453 | + h1Formt.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); | |
454 | + h1Formt.setAlignment(Alignment.LEFT); | |
455 | + h1Formt.setVerticalAlignment(VerticalAlignment.CENTRE); | |
456 | + | |
457 | + Label label = new Label(0, 0, titleName,titleFormt); | |
458 | + ws.addCell(label); | |
459 | + | |
460 | + Label label1 = new Label(0, 1, h1,h1Formt); | |
461 | + ws.addCell(label1); | |
462 | + | |
463 | + int arrayIndex = 0; | |
464 | + for (int i = 6, len = values.size()+6; i < len; i++, arrayIndex++) | |
465 | + { | |
466 | + | |
467 | + Set<String> sets = values.get(arrayIndex).keySet(); | |
468 | + int j = 1; | |
469 | + for (String key : sets) | |
470 | + { | |
471 | + String value = values.get(arrayIndex).get(key); | |
472 | + if (StringUtils.isNotEmpty(value) && StringUtils.isNum(value)) | |
473 | + { | |
474 | + WritableCellFormat wcfN = new WritableCellFormat(contentFont); | |
475 | + wcfN.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); | |
476 | + wcfN.setAlignment(jxl.format.Alignment.CENTRE); | |
477 | + wcfN.setVerticalAlignment(VerticalAlignment.CENTRE); | |
478 | + Number labelNF = new Number(j, i,Integer.parseInt(value), wcfN); | |
479 | + ws.addCell(labelNF); | |
480 | + } | |
481 | + else | |
482 | + { | |
483 | + ws.addCell(new Label(j, i,value, contentFormt)); | |
484 | + } | |
485 | + j++; | |
486 | + } | |
487 | + } | |
488 | + | |
489 | + | |
490 | + int arrayIndex1 = 0; | |
491 | + for (int i = 5, len = values.size()+5; i < len; i++, arrayIndex1++) | |
492 | + { | |
493 | + | |
494 | + Set<String> sets = values.get(arrayIndex).keySet(); | |
495 | + int j = 13; | |
496 | + for (String key : sets) | |
497 | + { | |
498 | + String value = values.get(arrayIndex1).get(key); | |
499 | + if (StringUtils.isNotEmpty(value) && StringUtils.isNum(value)) | |
500 | + { | |
501 | + WritableCellFormat wcfN = new WritableCellFormat(contentFont); | |
502 | + wcfN.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); | |
503 | + wcfN.setAlignment(jxl.format.Alignment.CENTRE); | |
504 | + wcfN.setVerticalAlignment(VerticalAlignment.CENTRE); | |
505 | + Number labelNF = new Number(j, i,Integer.parseInt(value), wcfN); | |
506 | + ws.addCell(labelNF); | |
507 | + } | |
508 | + else | |
509 | + { | |
510 | + ws.addCell(new Label(j, i,value, contentFormt)); | |
511 | + } | |
512 | + j++; | |
513 | + } | |
514 | + } | |
515 | + | |
516 | + | |
517 | + ws.addCell(new Label(0, 12, "实际报出日期:"+DateUtil.getyyyy_MM_dd1(new Date())+" 单位负责人签字: 填表人签字: ", h1Formt)); | |
518 | + | |
519 | + ws.mergeCells(0, 12, 14, 12); | |
414 | 520 | |
415 | 521 | book.write(); |
416 | 522 | book.close(); |
platform-dal/src/main/java/com/lyms/platform/query/MatDeliverQuery.java
View file @
06dcc55
... | ... | @@ -115,6 +115,7 @@ |
115 | 115 | |
116 | 116 | //台数 |
117 | 117 | private Integer tireNumber; |
118 | + private List<Integer> tireNumbers; | |
118 | 119 | |
119 | 120 | //会阴情况 |
120 | 121 | private String perinealCondition; |
... | ... | @@ -149,6 +150,10 @@ |
149 | 150 | condition = condition.and("tireNumber", tireNumber, MongoOper.IS); |
150 | 151 | } |
151 | 152 | |
153 | + if (tireNumbers != null && tireNumbers.size() > 0) { | |
154 | + condition = condition.and("tireNumber", tireNumbers, MongoOper.IN); | |
155 | + } | |
156 | + | |
152 | 157 | if (perinealCondition != null) { |
153 | 158 | condition = condition.and("perinealCondition", perinealCondition, MongoOper.IS); |
154 | 159 | } |
... | ... | @@ -321,6 +326,14 @@ |
321 | 326 | return new MongoCondition(c.andOperator(condition.getCriteria())).toMongoQuery(); |
322 | 327 | } |
323 | 328 | return condition.toMongoQuery(); |
329 | + } | |
330 | + | |
331 | + public List<Integer> getTireNumbers() { | |
332 | + return tireNumbers; | |
333 | + } | |
334 | + | |
335 | + public void setTireNumbers(List<Integer> tireNumbers) { | |
336 | + this.tireNumbers = tireNumbers; | |
324 | 337 | } |
325 | 338 | |
326 | 339 | public List<ObjectId> getBabyIds() { |
platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java
View file @
06dcc55
... | ... | @@ -326,6 +326,8 @@ |
326 | 326 | private String areaPostRestId; |
327 | 327 | private String streetPostRestId; |
328 | 328 | |
329 | + private String pcensusTypeId; | |
330 | + | |
329 | 331 | public MongoQuery convertToQuery() { |
330 | 332 | MongoCondition condition = MongoCondition.newInstance(); |
331 | 333 | |
332 | 334 | |
... | ... | @@ -339,10 +341,14 @@ |
339 | 341 | MongoCondition con = MongoCondition.newInstance("areaPostRestId", areaIdOrRestId, MongoOper.IS); |
340 | 342 | condition = condition.orCondition(new MongoCondition[]{con1, con}); |
341 | 343 | } |
344 | + if (null != pcensusTypeId) { | |
345 | + condition = condition.and("pcensusTypeId", pcensusTypeId, MongoOper.IS); | |
346 | + } | |
342 | 347 | if (null != dueStatus) { |
343 | 348 | condition = condition.and("dueStatus", dueStatus, MongoOper.IS); |
344 | 349 | } |
345 | 350 | |
351 | + | |
346 | 352 | if (null != childExtAddrs && childExtAddrs.size() > 0) { |
347 | 353 | condition = condition.and("childExtAddrs", childExtAddrs, MongoOper.IN); |
348 | 354 | } |
... | ... | @@ -975,6 +981,15 @@ |
975 | 981 | } |
976 | 982 | |
977 | 983 | return condition.toMongoQuery(); |
984 | + } | |
985 | + | |
986 | + | |
987 | + public String getPcensusTypeId() { | |
988 | + return pcensusTypeId; | |
989 | + } | |
990 | + | |
991 | + public void setPcensusTypeId(String pcensusTypeId) { | |
992 | + this.pcensusTypeId = pcensusTypeId; | |
978 | 993 | } |
979 | 994 | |
980 | 995 | public String getProvincePostRestId() { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyBuildController.java
View file @
06dcc55
... | ... | @@ -492,7 +492,7 @@ |
492 | 492 | * @param request |
493 | 493 | * @param response |
494 | 494 | * @param time |
495 | - * @param ageType 1, <= 20 2, 20-=25 3,25-=30, 4,30-=35 5, >35 | |
495 | + * @param ageType 1, < 20 2, 20-24 3,25-29, 4,30-34 5, >=35 | |
496 | 496 | * @param lievType 1 城镇 2 农业 |
497 | 497 | * @return |
498 | 498 | */ |
... | ... | @@ -508,6 +508,43 @@ |
508 | 508 | ){ |
509 | 509 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
510 | 510 | return babyBookbuildingFacade.queryWcBabyReport(loginState.getId(), time, ageType,lievType ,provinceId,cityId); |
511 | + } | |
512 | + | |
513 | + /** | |
514 | + * 获取可以导出的医院列表 | |
515 | + * @param request | |
516 | + * @param response | |
517 | + * @param provinceId | |
518 | + * @param cityId | |
519 | + * @return | |
520 | + */ | |
521 | + @ResponseBody | |
522 | + @RequestMapping(value = "/queryWcExportHospList",method = RequestMethod.GET) | |
523 | + @TokenRequired | |
524 | + public BaseResponse queryWcExportHospList(HttpServletRequest request,HttpServletResponse response, | |
525 | + @RequestParam(required = false)String provinceId, | |
526 | + @RequestParam(required = false)String cityId | |
527 | + ){ | |
528 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
529 | + return babyBookbuildingFacade.queryWcExportHospList(loginState.getId() ,provinceId,cityId); | |
530 | + } | |
531 | + | |
532 | + | |
533 | + /** | |
534 | + * | |
535 | + * @param request | |
536 | + * @param response | |
537 | + * @param time | |
538 | + * @return | |
539 | + */ | |
540 | + @RequestMapping(value = "/exportWcBabyReportExcl",method = RequestMethod.GET) | |
541 | + @TokenRequired | |
542 | + public void exportWcBabyReportExcl(HttpServletRequest request,HttpServletResponse response, | |
543 | + @RequestParam(required = false)String time, | |
544 | + @RequestParam(required = true)String hospitalId | |
545 | + ){ | |
546 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
547 | + babyBookbuildingFacade.exportWcBabyReportExcl(loginState.getId(), time, hospitalId,response); | |
511 | 548 | } |
512 | 549 | |
513 | 550 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java
View file @
06dcc55
... | ... | @@ -16,6 +16,7 @@ |
16 | 16 | import com.lyms.platform.common.result.BaseObjectResponse; |
17 | 17 | import com.lyms.platform.common.result.BaseResponse; |
18 | 18 | import com.lyms.platform.common.utils.*; |
19 | +import com.lyms.platform.common.utils.ArrayUtils; | |
19 | 20 | import com.lyms.platform.common.utils.StringUtils; |
20 | 21 | import com.lyms.platform.operate.web.request.*; |
21 | 22 | import com.lyms.platform.operate.web.result.*; |
... | ... | @@ -58,6 +59,8 @@ |
58 | 59 | |
59 | 60 | public static final String HIS_VERSION = PropertiesUtils.getPropertyValue("his_version"); |
60 | 61 | |
62 | + public static final String CZ = "57624bf90cf23d4631523e9e"; | |
63 | + public static final String NC = "57624c090cf23d4631523e9f"; | |
61 | 64 | |
62 | 65 | @Autowired |
63 | 66 | private HisService hisServiceV2; |
... | ... | @@ -90,6 +93,8 @@ |
90 | 93 | private OrganizationService organizationService; |
91 | 94 | |
92 | 95 | @Autowired |
96 | + private BabyService babyService; | |
97 | + @Autowired | |
93 | 98 | private PatientsService patientsService; |
94 | 99 | |
95 | 100 | @Autowired |
... | ... | @@ -3222,6 +3227,32 @@ |
3222 | 3227 | babyBookbuildingService.deleteFmHistoryRecord(mongoQuery); |
3223 | 3228 | } |
3224 | 3229 | |
3230 | + public BaseResponse queryWcExportHospList(Integer userId, String provinceId, String cityId) { | |
3231 | + //获取用户权限医院和筛选条件的交集 | |
3232 | + List<String> currentUserHospPermissions = areaCountFacade.getCurrentUserHospPermissions(userId, provinceId, | |
3233 | + cityId, null); | |
3234 | + | |
3235 | + List<Map> hospitals = new ArrayList<>(); | |
3236 | + | |
3237 | + if (CollectionUtils.isNotEmpty(currentUserHospPermissions)) | |
3238 | + { | |
3239 | + for (String hid : currentUserHospPermissions) | |
3240 | + { | |
3241 | + Organization org = organizationService.getOrganization(Integer.parseInt(hid)); | |
3242 | + if (org != null) | |
3243 | + { | |
3244 | + Map map = new HashMap(); | |
3245 | + map.put("hospitalId",org.getId()); | |
3246 | + map.put("hospitalName",org.getName()); | |
3247 | + hospitals.add(map); | |
3248 | + } | |
3249 | + } | |
3250 | + } | |
3251 | + | |
3252 | + return new BaseObjectResponse() | |
3253 | + .setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS).setData(hospitals); | |
3254 | + } | |
3255 | + | |
3225 | 3256 | public BaseResponse queryWcBabyReport(Integer userId, String time, Integer ageType, Integer lievType, String provinceId, String cityId) { |
3226 | 3257 | |
3227 | 3258 | //获取用户权限医院和筛选条件的交集 |
3228 | 3259 | |
3229 | 3260 | |
3230 | 3261 | |
3231 | 3262 | |
3232 | 3263 | |
... | ... | @@ -3237,28 +3268,59 @@ |
3237 | 3268 | basicQuery.setYn(YnEnums.YES.getId()); |
3238 | 3269 | basicQuery.setTypeId("b7ea005c-dfac-4c2a-bdae-25239b3f44fd"); |
3239 | 3270 | |
3271 | + | |
3272 | + List<String> ids = new ArrayList<>(); | |
3273 | + | |
3274 | + DataPermissionsModelQuery dataPermissionsModelQuery = new DataPermissionsModelQuery(); | |
3275 | + dataPermissionsModelQuery.setUserId(userId); | |
3276 | + List<DataPermissionsModel> permissionsModels = dataPermissionService.queryPermission(dataPermissionsModelQuery); | |
3277 | + | |
3240 | 3278 | int addrType = 0; |
3241 | 3279 | if (org.apache.commons.lang.StringUtils.isNotEmpty(provinceId)) { |
3242 | - basicQuery.setParentId(provinceId); | |
3280 | + ids = new ArrayList<>(); | |
3281 | + if (CollectionUtils.isNotEmpty(permissionsModels)) { | |
3282 | + List<AddressBean> addressBeanList = JsonUtil.toList(permissionsModels.get(0).getAreaPermission(), AddressBean.class); | |
3283 | + if (CollectionUtils.isNotEmpty(addressBeanList)) | |
3284 | + { | |
3285 | + for (AddressBean bean : addressBeanList) | |
3286 | + { | |
3287 | + if (bean != null && bean.getP() != null && bean.getP().equals(provinceId) && org.apache.commons.lang.StringUtils.isNotEmpty(bean.getC())) | |
3288 | + { | |
3289 | + ids.add(bean.getC()); | |
3290 | + } | |
3291 | + } | |
3292 | + } | |
3293 | + } | |
3294 | + basicQuery.setIds(ids); | |
3243 | 3295 | addrType = 1; |
3244 | 3296 | } |
3245 | 3297 | if (org.apache.commons.lang.StringUtils.isNotEmpty(cityId)) { |
3246 | - basicQuery.setParentId(cityId); | |
3298 | + ids = new ArrayList<>(); | |
3299 | + if (CollectionUtils.isNotEmpty(permissionsModels)) { | |
3300 | + List<AddressBean> addressBeanList = JsonUtil.toList(permissionsModels.get(0).getAreaPermission(), AddressBean.class); | |
3301 | + if (CollectionUtils.isNotEmpty(addressBeanList)) | |
3302 | + { | |
3303 | + for (AddressBean bean : addressBeanList) | |
3304 | + { | |
3305 | + if (bean != null && bean.getC() != null && bean.getC().equals(cityId) && org.apache.commons.lang.StringUtils.isNotEmpty(bean.getA())) | |
3306 | + { | |
3307 | + ids.add(bean.getA()); | |
3308 | + } | |
3309 | + } | |
3310 | + } | |
3311 | + } | |
3312 | + basicQuery.setIds(ids); | |
3247 | 3313 | addrType = 2; |
3248 | 3314 | } |
3249 | 3315 | |
3250 | - | |
3251 | 3316 | //x轴标题数据 |
3252 | 3317 | List<String> xAxis = new ArrayList<>(); |
3253 | - | |
3254 | - | |
3255 | -// DataPermissionsModelQuery dataPermissionsModelQuery = new DataPermissionsModelQuery(); | |
3256 | -// dataPermissionsModelQuery.setUserId(userId); | |
3257 | -// List<DataPermissionsModel> permissionsModels = dataPermissionService.queryPermission(dataPermissionsModelQuery); | |
3258 | - | |
3259 | - | |
3260 | 3318 | //获取地址列表 |
3261 | - List<BasicConfig> configList = basicConfigService.queryBasicConfig(basicQuery); | |
3319 | + List<BasicConfig> configList = new ArrayList<>(); | |
3320 | + if (CollectionUtils.isNotEmpty(ids)) | |
3321 | + { | |
3322 | + configList = basicConfigService.queryBasicConfig(basicQuery); | |
3323 | + } | |
3262 | 3324 | |
3263 | 3325 | if (CollectionUtils.isNotEmpty(configList)) { |
3264 | 3326 | for (BasicConfig addr : configList) { |
... | ... | @@ -3307,9 +3369,32 @@ |
3307 | 3369 | |
3308 | 3370 | if (CollectionUtils.isNotEmpty(hids)) |
3309 | 3371 | { |
3310 | - zsItems.add("0"); | |
3311 | - manItems.add("0"); | |
3312 | - womanItems.add("0"); | |
3372 | + BabyModelQuery babyModelQuery = new BabyModelQuery(); | |
3373 | + if (dates != null) { | |
3374 | + babyModelQuery.setBirthStart(DateUtil.parseYMD(dates[0])); | |
3375 | + if (dates.length == 2) { | |
3376 | + babyModelQuery.setBirthEnd(DateUtil.parseYMDHMS(dates[1])); | |
3377 | + } | |
3378 | + } | |
3379 | + List<String> parentIds = getBabyParentIds( ageType, lievType, hids); | |
3380 | + if (CollectionUtils.isNotEmpty(parentIds)) | |
3381 | + { | |
3382 | + babyModelQuery.setParentIds(parentIds); | |
3383 | + } | |
3384 | + babyModelQuery.setDataStatus(false); | |
3385 | + babyModelQuery.setBuildType(2); | |
3386 | + babyModelQuery.setOrder("birth"); | |
3387 | + babyModelQuery.setHospitalIdList(hids); | |
3388 | + int zsCount = babyService.queryBabyCount(babyModelQuery); | |
3389 | + zsItems.add(String.valueOf(zsCount)); | |
3390 | + | |
3391 | + babyModelQuery.setSex(1); | |
3392 | + int manCount = babyService.queryBabyCount(babyModelQuery); | |
3393 | + manItems.add(String.valueOf(manCount)); | |
3394 | + | |
3395 | + babyModelQuery.setSex(0); | |
3396 | + int womanCount = babyService.queryBabyCount(babyModelQuery); | |
3397 | + womanItems.add(String.valueOf(womanCount)); | |
3313 | 3398 | } |
3314 | 3399 | else |
3315 | 3400 | { |
... | ... | @@ -3355,6 +3440,35 @@ |
3355 | 3440 | |
3356 | 3441 | List<String> hids = getConditionHospitalIds(currentUserHospPermissions, orgs); |
3357 | 3442 | if (CollectionUtils.isNotEmpty(hids)) { |
3443 | + | |
3444 | + BabyModelQuery babyModelQuery = new BabyModelQuery(); | |
3445 | + if (dates != null) { | |
3446 | + babyModelQuery.setBirthStart(DateUtil.parseYMD(dates[0])); | |
3447 | + if (dates.length == 2) { | |
3448 | + babyModelQuery.setBirthEnd(DateUtil.parseYMDHMS(dates[1])); | |
3449 | + } | |
3450 | + } | |
3451 | + | |
3452 | + List<String> parentIds = getBabyParentIds( ageType, lievType, hids); | |
3453 | + if (CollectionUtils.isNotEmpty(parentIds)) | |
3454 | + { | |
3455 | + babyModelQuery.setParentIds(parentIds); | |
3456 | + } | |
3457 | + | |
3458 | + babyModelQuery.setDataStatus(false); | |
3459 | + babyModelQuery.setBuildType(2); | |
3460 | + babyModelQuery.setOrder("birth"); | |
3461 | + babyModelQuery.setHospitalIdList(hids); | |
3462 | + int zsCount = babyService.queryBabyCount(babyModelQuery); | |
3463 | + items.add(String.valueOf(zsCount)); | |
3464 | + | |
3465 | + babyModelQuery.setSex(1); | |
3466 | + int manCount = babyService.queryBabyCount(babyModelQuery); | |
3467 | + items.add(String.valueOf(manCount)); | |
3468 | + | |
3469 | + babyModelQuery.setSex(0); | |
3470 | + int womanCount = babyService.queryBabyCount(babyModelQuery); | |
3471 | + items.add(String.valueOf(womanCount)); | |
3358 | 3472 | } |
3359 | 3473 | else |
3360 | 3474 | { |
3361 | 3475 | |
... | ... | @@ -3377,7 +3491,64 @@ |
3377 | 3491 | } |
3378 | 3492 | |
3379 | 3493 | |
3494 | + private List<String> getBabyParentIds(Integer ageType, Integer lievType,List<String> hids) | |
3495 | + { | |
3380 | 3496 | |
3497 | + List<String> parentIds = new ArrayList<>(); | |
3498 | + if (ageType != null || lievType != null) | |
3499 | + { | |
3500 | + //ageType 1, < 20 2, 20-24 3,25-29, 4,30-34 5, >=35 | |
3501 | + | |
3502 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
3503 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
3504 | + patientsQuery.setHospitalList(hids); | |
3505 | + | |
3506 | + if (ageType != null) | |
3507 | + { | |
3508 | + | |
3509 | + switch (ageType) | |
3510 | + { | |
3511 | + case 1 : | |
3512 | + patientsQuery.setFmAgeStart(0); | |
3513 | + patientsQuery.setFmAgeEnd(19); | |
3514 | + case 2 : | |
3515 | + patientsQuery.setFmAgeStart(20); | |
3516 | + patientsQuery.setFmAgeEnd(24); | |
3517 | + case 3 : | |
3518 | + patientsQuery.setFmAgeStart(25); | |
3519 | + patientsQuery.setFmAgeEnd(29); | |
3520 | + case 4 : | |
3521 | + patientsQuery.setFmAgeStart(30); | |
3522 | + patientsQuery.setFmAgeEnd(34); | |
3523 | + case 5 : | |
3524 | + patientsQuery.setFmAgeStart(35); | |
3525 | + patientsQuery.setFmAgeEnd(100); | |
3526 | + } | |
3527 | + } | |
3528 | + //lievType 1 城镇 2 农业 | |
3529 | + if (lievType != null) | |
3530 | + { | |
3531 | + switch (ageType) { | |
3532 | + case 1: | |
3533 | + patientsQuery.setPcensusTypeId("57624bf90cf23d4631523e9e"); | |
3534 | + case 2: | |
3535 | + patientsQuery.setPcensusTypeId("57624c090cf23d4631523e9f"); | |
3536 | + } | |
3537 | + } | |
3538 | + List<Patients> patientsList = patientsService.queryPatient(patientsQuery); | |
3539 | + if (CollectionUtils.isNotEmpty(patientsList)) | |
3540 | + { | |
3541 | + for (Patients pat : patientsList) | |
3542 | + { | |
3543 | + parentIds.add(pat.getId()); | |
3544 | + } | |
3545 | + } | |
3546 | + } | |
3547 | + | |
3548 | + return parentIds; | |
3549 | + } | |
3550 | + | |
3551 | + | |
3381 | 3552 | private List<String> getConditionHospitalIds(List<String> currentUserHospPermissions, List<Organization> conditionHospitals) { |
3382 | 3553 | List<String> hids = new ArrayList<>(); |
3383 | 3554 | for (Organization org : conditionHospitals) { |
... | ... | @@ -3387,6 +3558,328 @@ |
3387 | 3558 | |
3388 | 3559 | return hids; |
3389 | 3560 | } |
3561 | + | |
3562 | + public void exportWcBabyReportExcl(Integer userId, String time, String hospitalId, HttpServletResponse response) { | |
3563 | + | |
3564 | + try { | |
3565 | + | |
3566 | + Organization org = organizationService.getOrganization(Integer.parseInt(hospitalId)); | |
3567 | + | |
3568 | + String titleName = "围产儿调查表"; | |
3569 | + String h1 = "填报单位(签章): "+org.getName(); | |
3570 | + String[] dates = null; | |
3571 | + if (StringUtils.isNotEmpty(time)) { | |
3572 | + dates = time.split(" - "); | |
3573 | + h1+=" "+time; | |
3574 | + } | |
3575 | + | |
3576 | + List<Map<String,String>> list = getWcBabyDatas(hospitalId, dates); | |
3577 | + List<Map<String,String>> list1 = getWcQkBabyDatas(hospitalId, dates); | |
3578 | + response.setContentType("application/force-download"); | |
3579 | + response.setHeader("Content-Disposition", "attachment;filename=" + new String(("围产儿调查表.xls").getBytes("UTF-8"), "ISO-8859-1")); | |
3580 | + String path = this.getClass().getResource("/").getPath()+ "whfy_wcbaby.xls"; | |
3581 | + ExcelUtil.writeWcBabyExclFile(path, response.getOutputStream(), list,list1, titleName, h1); | |
3582 | + | |
3583 | + } catch (Exception e) { | |
3584 | + ExceptionUtils.catchException(e, "exportDiagnosisReportExcl error"); | |
3585 | + } | |
3586 | + } | |
3587 | + | |
3588 | + private List<Map<String, String>> getWcQkBabyDatas(String hospitalId, String[] dates) { | |
3589 | + | |
3590 | + List<Map<String,String>> list = new ArrayList<>(); | |
3591 | + //死胎,死产 | |
3592 | + //城镇 | |
3593 | + String czs = getNoBaby(hospitalId,CZ,dates); | |
3594 | + String ncs = getNoBaby(hospitalId,NC,dates); | |
3595 | + | |
3596 | + Map<String,String> map = new HashMap<>(); | |
3597 | + map.put("czs",czs); | |
3598 | + map.put("ncs", ncs); | |
3599 | + list.add(map); | |
3600 | + | |
3601 | + //缺陷 | |
3602 | + String czqx = getQueXianBaby(hospitalId,CZ,dates); | |
3603 | + String ncqx = getQueXianBaby(hospitalId,CZ,dates); | |
3604 | + | |
3605 | + Map<String,String> map1 = new HashMap<>(); | |
3606 | + map1.put("czqx",czqx); | |
3607 | + map1.put("ncqx", ncqx); | |
3608 | + list.add(map1); | |
3609 | + | |
3610 | + Map<String,String> map2 = new HashMap<>(); | |
3611 | + map2.put("czqtsw","-"); | |
3612 | + map2.put("ncqtsw", "-"); | |
3613 | + list.add(map2); | |
3614 | + | |
3615 | + Map<String,String> map3 = new HashMap<>(); | |
3616 | + map3.put("czqtsw", czs + czqx); | |
3617 | + map3.put("ncqtsw", ncs + ncqx); | |
3618 | + list.add(map3); | |
3619 | + | |
3620 | + String czst = getTsBaby( hospitalId,CZ,dates,2); | |
3621 | + String ncst = getTsBaby( hospitalId,NC,dates,2); | |
3622 | + | |
3623 | + Map<String,String> map4 = new HashMap<>(); | |
3624 | + map4.put("czst", czst); | |
3625 | + map4.put("ncst", ncst); | |
3626 | + list.add(map4); | |
3627 | + | |
3628 | + | |
3629 | + String czdt = getTsBaby( hospitalId,CZ,dates,3,4,5,6,7,8); | |
3630 | + String ncdt = getTsBaby( hospitalId,NC,dates,3,4,5,6,7,8); | |
3631 | + | |
3632 | + Map<String,String> map5 = new HashMap<>(); | |
3633 | + map5.put("czdt", czdt); | |
3634 | + map5.put("ncdt", ncdt); | |
3635 | + list.add(map5); | |
3636 | + | |
3637 | + Map<String,String> map6 = new HashMap<>(); | |
3638 | + map6.put("czhj", czs+czqx+czst+czdt); | |
3639 | + map6.put("nchj", ncs+ncqx+ncst+ncdt); | |
3640 | + list.add(map6); | |
3641 | + | |
3642 | + return list; | |
3643 | + } | |
3644 | + | |
3645 | + | |
3646 | + private String getTsBaby(String hospitalId,String type,String[] dates,Integer ...tireNumbers) { | |
3647 | + | |
3648 | + MatDeliverQuery matDeliverQuery1 = new MatDeliverQuery(); | |
3649 | + matDeliverQuery1.setYn(YnEnums.YES.getId()); | |
3650 | + if (dates != null) { | |
3651 | + matDeliverQuery1.setCreatedStart(DateUtil.parseYMD(dates[0])); | |
3652 | + if (dates.length == 2) { | |
3653 | + matDeliverQuery1.setEndStart(DateUtil.parseYMDHMS(dates[1])); | |
3654 | + } | |
3655 | + } | |
3656 | + matDeliverQuery1.setParentIdList(getPatientIdByPreType(hospitalId, type, null, null)); | |
3657 | + matDeliverQuery1.setTireNumbers(Arrays.asList(tireNumbers)); | |
3658 | + matDeliverQuery1.setFmHospital(hospitalId); | |
3659 | + int doubleCount = matDeliverService.count(matDeliverQuery1); | |
3660 | + return String.valueOf(doubleCount); | |
3661 | + } | |
3662 | + | |
3663 | + private String getQueXianBaby(String hospitalId,String type,String[] dates) { | |
3664 | + | |
3665 | + BabyModelQuery babyModelQuery3 = new BabyModelQuery(); | |
3666 | + babyModelQuery3.setDataStatus(false); | |
3667 | + babyModelQuery3.setHospitalId(hospitalId); | |
3668 | + babyModelQuery3.setParentIds(getPatientIdByPreType( hospitalId, type,null,null)); | |
3669 | + if (dates != null) { | |
3670 | + babyModelQuery3.setBirthStart(DateUtil.parseYMD(dates[0])); | |
3671 | + if (dates.length == 2) { | |
3672 | + babyModelQuery3.setBirthEnd(DateUtil.parseYMDHMS(dates[1])); | |
3673 | + } | |
3674 | + } | |
3675 | + | |
3676 | + //0非畸形 1畸形 | |
3677 | + babyModelQuery3.setBuildType(2); | |
3678 | + babyModelQuery3.setMalformation(1); | |
3679 | + int queXianBabyCount = babyService.queryBabyCount(babyModelQuery3); | |
3680 | + return String.valueOf(queXianBabyCount); | |
3681 | + } | |
3682 | + | |
3683 | + private List<Map<String, String>> getWcBabyDatas(String hospitalId, String[] dates) { | |
3684 | + List<Map<String,String>> list = new ArrayList<>(); | |
3685 | + | |
3686 | + //57624bf90cf23d4631523e9e 城镇 57624c090cf23d4631523e9f 农业 | |
3687 | + | |
3688 | + for (int i = 1;i <= 5;i++) | |
3689 | + { | |
3690 | + Integer fmAgeStart = null; | |
3691 | + Integer fmAgeEnd = null; | |
3692 | + switch (i) | |
3693 | + { | |
3694 | + case 1 : | |
3695 | + fmAgeStart = 0; | |
3696 | + fmAgeEnd = 19; | |
3697 | + case 2 : | |
3698 | + fmAgeStart = 20; | |
3699 | + fmAgeEnd = 24; | |
3700 | + case 3 : | |
3701 | + fmAgeStart = 25; | |
3702 | + fmAgeEnd = 29; | |
3703 | + case 4 : | |
3704 | + fmAgeStart = 30; | |
3705 | + fmAgeEnd = 34; | |
3706 | + case 5 : | |
3707 | + fmAgeStart = 35; | |
3708 | + fmAgeEnd = 100; | |
3709 | + } | |
3710 | + | |
3711 | + | |
3712 | + Map<String,String> map = new HashMap<>(); | |
3713 | + BabyModelQuery babyModelQuery = new BabyModelQuery(); | |
3714 | + if (dates != null) { | |
3715 | + babyModelQuery.setBirthStart(DateUtil.parseYMD(dates[0])); | |
3716 | + if (dates.length == 2) { | |
3717 | + babyModelQuery.setBirthEnd(DateUtil.parseYMDHMS(dates[1])); | |
3718 | + } | |
3719 | + } | |
3720 | + babyModelQuery.setDataStatus(false); | |
3721 | + babyModelQuery.setBuildType(2); | |
3722 | + | |
3723 | + babyModelQuery.setSex(1); | |
3724 | + babyModelQuery.setParentIds(getPatientIdByPreType(hospitalId, CZ, fmAgeStart, fmAgeEnd)); | |
3725 | + int cznCount = babyService.queryBabyCount(babyModelQuery); | |
3726 | + | |
3727 | + map.put("cznCount", String.valueOf(cznCount)); | |
3728 | + | |
3729 | + babyModelQuery.setSex(0); | |
3730 | + babyModelQuery.setParentIds(getPatientIdByPreType(hospitalId, CZ, fmAgeStart, fmAgeEnd)); | |
3731 | + int czlCount = babyService.queryBabyCount(babyModelQuery); | |
3732 | + map.put("czlCount", String.valueOf(czlCount)); | |
3733 | + | |
3734 | + int czbmCount= 0; | |
3735 | + map.put("czbmCount", String.valueOf(czbmCount)); | |
3736 | + | |
3737 | + | |
3738 | + babyModelQuery.setSex(1); | |
3739 | + babyModelQuery.setParentIds(getPatientIdByPreType(hospitalId, NC, fmAgeStart, fmAgeEnd)); | |
3740 | + int ncnCount = babyService.queryBabyCount(babyModelQuery); | |
3741 | + | |
3742 | + map.put("ncnCount", String.valueOf(ncnCount)); | |
3743 | + | |
3744 | + babyModelQuery.setSex(0); | |
3745 | + babyModelQuery.setParentIds(getPatientIdByPreType(hospitalId, NC, fmAgeStart, fmAgeEnd)); | |
3746 | + int nclCount = babyService.queryBabyCount(babyModelQuery); | |
3747 | + map.put("nclCount", String.valueOf(nclCount)); | |
3748 | + | |
3749 | + int ncbmCount= 0; | |
3750 | + map.put("ncbmCount", String.valueOf(ncbmCount)); | |
3751 | + | |
3752 | + int hjnCount = cznCount+ncnCount; | |
3753 | + map.put("hjnCount", String.valueOf(hjnCount)); | |
3754 | + int hjlCount = czlCount+nclCount; | |
3755 | + map.put("hjlCount", String.valueOf(hjlCount)); | |
3756 | + int hjbmCount = 0; | |
3757 | + map.put("hjbmCount", String.valueOf(hjbmCount)); | |
3758 | + int hjCount = cznCount+ncnCount+czlCount+nclCount; | |
3759 | + map.put("hjCount", String.valueOf(hjCount)); | |
3760 | + | |
3761 | + list.add(map); | |
3762 | + } | |
3763 | + | |
3764 | + sumwcs(list); | |
3765 | + | |
3766 | + return list; | |
3767 | + } | |
3768 | + | |
3769 | + private void sumwcs(List<Map<String, String>> list) { | |
3770 | + | |
3771 | + int cznCount = 0; | |
3772 | + int czlCount = 0; | |
3773 | + int czbmCount= 0; | |
3774 | + | |
3775 | + int ncnCount = 0; | |
3776 | + int nclCount = 0; | |
3777 | + int ncbmCount= 0; | |
3778 | + | |
3779 | + int hjnCount = 0; | |
3780 | + int hjlCount = 0; | |
3781 | + int hjbmCount = 0; | |
3782 | + int hjCount = 0; | |
3783 | + | |
3784 | + if (CollectionUtils.isNotEmpty(list)) | |
3785 | + { | |
3786 | + for (Map<String, String> map : list) | |
3787 | + { | |
3788 | + cznCount += Integer.parseInt(map.get("cznCount")); | |
3789 | + czlCount += Integer.parseInt(map.get("czlCount")); | |
3790 | + czbmCount += Integer.parseInt(map.get("czbmCount")); | |
3791 | + ncnCount += Integer.parseInt(map.get("ncnCount")); | |
3792 | + nclCount += Integer.parseInt(map.get("nclCount")); | |
3793 | + ncbmCount += Integer.parseInt(map.get("ncbmCount")); | |
3794 | + hjnCount += Integer.parseInt(map.get("hjnCount")); | |
3795 | + hjlCount += Integer.parseInt(map.get("hjlCount")); | |
3796 | + hjbmCount += Integer.parseInt(map.get("hjbmCount")); | |
3797 | + hjCount += Integer.parseInt(map.get("hjCount")); | |
3798 | + } | |
3799 | + } | |
3800 | + Map<String,String> dataMap = new LinkedHashMap<>(); | |
3801 | + dataMap.put("cznCount",String.valueOf(cznCount)); | |
3802 | + dataMap.put("czlCount", String.valueOf(czlCount)); | |
3803 | + dataMap.put("czbmCount", String.valueOf(czbmCount)); | |
3804 | + dataMap.put("ncnCount", String.valueOf(ncnCount)); | |
3805 | + dataMap.put("nclCount", String.valueOf(nclCount)); | |
3806 | + dataMap.put("ncbmCount", String.valueOf(ncbmCount)); | |
3807 | + dataMap.put("hjnCount", String.valueOf(hjnCount)); | |
3808 | + dataMap.put("hjlCount",String.valueOf(hjlCount)); | |
3809 | + dataMap.put("hjbmCount",String.valueOf(hjbmCount)); | |
3810 | + dataMap.put("hjCount",String.valueOf(hjCount)); | |
3811 | + | |
3812 | + list.add(dataMap); | |
3813 | + } | |
3814 | + | |
3815 | + private String getNoBaby(String hospitalId,String type,String[] dates) | |
3816 | + { | |
3817 | + List<String> PregnancyOuts = new ArrayList<>(); | |
3818 | + PregnancyOuts.add("1"); | |
3819 | + PregnancyOuts.add("3"); | |
3820 | + | |
3821 | + MatDeliverQuery matDeliverQuery10 = new MatDeliverQuery(); | |
3822 | + matDeliverQuery10.setYn(YnEnums.YES.getId()); | |
3823 | + matDeliverQuery10.setParentIdList(getPatientIdByPreType(hospitalId, type, 0, 100)); | |
3824 | + if (dates != null) { | |
3825 | + matDeliverQuery10.setCreatedStart(DateUtil.parseYMD(dates[0])); | |
3826 | + if (dates.length == 2) { | |
3827 | + matDeliverQuery10.setEndStart(DateUtil.parseYMDHMS(dates[1])); | |
3828 | + } | |
3829 | + } | |
3830 | + | |
3831 | + matDeliverQuery10.setPregnancyOuts(PregnancyOuts); | |
3832 | + matDeliverQuery10.setFmHospital(hospitalId); | |
3833 | + int babySiChanCount = 0; | |
3834 | + int babySiTaiCount = 0; | |
3835 | + List<MaternalDeliverModel> babySiWangList = matDeliverService.query(matDeliverQuery10); | |
3836 | + if (com.lyms.platform.operate.web.utils.CollectionUtils.isNotEmpty(babySiWangList)) | |
3837 | + { | |
3838 | + for (MaternalDeliverModel model : babySiWangList) | |
3839 | + { | |
3840 | + List<MaternalDeliverModel.Baby> babies = model.getBaby(); | |
3841 | + if (com.lyms.platform.operate.web.utils.CollectionUtils.isNotEmpty(babies)) | |
3842 | + { | |
3843 | + for (MaternalDeliverModel.Baby baby : babies) | |
3844 | + { | |
3845 | + if (baby.getPregnancyOut() != null && "3".equals(baby.getPregnancyOut()) ) | |
3846 | + { | |
3847 | + babySiChanCount++; | |
3848 | + } | |
3849 | + else if (baby.getPregnancyOut() != null && "1".equals(baby.getPregnancyOut())) | |
3850 | + { | |
3851 | + babySiTaiCount++; | |
3852 | + } | |
3853 | + } | |
3854 | + } | |
3855 | + } | |
3856 | + } | |
3857 | + babySiWangList.clear(); | |
3858 | + return String.valueOf(babySiChanCount+babySiTaiCount); | |
3859 | + } | |
3860 | + | |
3861 | + private List<String> getPatientIdByPreType(String hospitalId,String type,Integer ageStart,Integer ageEnd) | |
3862 | + { | |
3863 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
3864 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
3865 | + patientsQuery.setHospitalId(hospitalId); | |
3866 | + patientsQuery.setPcensusTypeId(type); | |
3867 | + patientsQuery.setFmAgeStart(ageStart); | |
3868 | + patientsQuery.setFmAgeEnd(ageEnd); | |
3869 | + patientsQuery.setType(3); | |
3870 | + | |
3871 | + List<String> parentIds = new ArrayList<>(); | |
3872 | + List<Patients> patientsList = patientsService.queryPatient(patientsQuery); | |
3873 | + if (CollectionUtils.isNotEmpty(patientsList)) | |
3874 | + { | |
3875 | + for (Patients pat : patientsList) | |
3876 | + { | |
3877 | + parentIds.add(pat.getId()); | |
3878 | + } | |
3879 | + } | |
3880 | + return parentIds; | |
3881 | + } | |
3882 | + | |
3390 | 3883 | |
3391 | 3884 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java
View file @
06dcc55
... | ... | @@ -636,7 +636,6 @@ |
636 | 636 | //查询符合条件的孕妇 |
637 | 637 | StopWatch stopWatch = new StopWatch("queryPatient1 -" + hospital); |
638 | 638 | stopWatch.start(); |
639 | - System.out.println("==========" + patientsQuery.convertToQuery().convertToMongoQuery()); | |
640 | 639 | List<Patients> patientses = patientsService.queryPatientBySort(patientsQuery, riskPatientsQueryRequest.getSort(), riskPatientsQueryRequest.getOrder()); |
641 | 640 | stopWatch.stop(); |
642 | 641 |