Commit 5d30e14f3c407dac3dd944e6a54cc7a33fb5a137

Authored by gengxiaokai
1 parent 4cacdf8930
Exists in master and in 1 other branch dev

唐山复诊随访表打印接口修改

Showing 2 changed files with 176 additions and 3 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ViewController.java View file @ 5d30e14
... ... @@ -199,14 +199,14 @@
199 199 */
200 200 @RequestMapping(value = "/printExFuData", method = RequestMethod.GET)
201 201 @TokenRequired
202   - public BaseResponse printExFuData(@RequestParam("id") String id,@RequestParam("num") int num, HttpServletRequest request){
  202 + public BaseResponse printExFuData(@RequestParam("id") String id, HttpServletRequest request){
203 203 LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
204 204 if(loginState == null){
205 205 System.out.println("用户未登录!");
206 206 return new BaseListResponse().setErrormsg("失败").setErrorcode(ErrorCodeConstants.USER_NOT_EXISTS);
207 207 }
208   - Map<String, Object> map = viewFacade.exFuData(id, num, loginState.getId());
209   - return new BaseObjectResponse().setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS).setData(map);
  208 + List<Map<String, Object>> mapList = viewFacade.prFuData(id, 5, loginState.getId());
  209 + return new BaseListResponse().setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS).setData(mapList);
210 210 }
211 211  
212 212  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ViewFacade.java View file @ 5d30e14
... ... @@ -340,6 +340,7 @@
340 340 }
341 341 }
342 342  
  343 +
343 344 /**
344 345 * 导出复诊查询
345 346 *
... ... @@ -499,6 +500,178 @@
499 500 }
500 501 return map;
501 502 }
  503 +
  504 +
  505 + /**
  506 + * 打印复诊查询
  507 + *
  508 + * @param id 复诊id
  509 + * @param num 当前位置
  510 + * @return
  511 + */
  512 + public List<Map<String, Object>> prFuData(String id, int num, Integer userId) {
  513 + List<Map<String, Object>> mList = new ArrayList<Map<String, Object>>();
  514 + List<AntenatalExaminationModel> list = null;
  515 + //Map<String, Object> map = new HashedMap();
  516 + AntenatalExaminationModel[] exData = new AntenatalExaminationModel[4];
  517 + AntenatalExaminationModel antenatalExaminationModel = antExService.findOneById(id);
  518 + Patients patients = patientsService.findOnePatientById(antenatalExaminationModel.getParentId());
  519 + String name = patients.getUsername();
  520 + String riskName = getRisk(antenatalExaminationModel.getRiskFactor(), antenatalExaminationModel.getOtherRisk());
  521 + if (StringUtils.isNotEmpty(riskName))
  522 + {
  523 + name +="("+riskName+")";
  524 + }
  525 +
  526 + //map.put("name",name);
  527 +
  528 + if (num < 4) {
  529 + exData[num - 1] = antenatalExaminationModel;
  530 + } else {//全部
  531 + String patientsId = antenatalExaminationModel.getParentId();
  532 + AntExQuery antExQuery = new AntExQuery();
  533 + antExQuery.setYn(YnEnums.YES.getId());
  534 + antExQuery.setParentId(patientsId);
  535 + //复诊
  536 + list = antExService.queryAntenatalExamination(antExQuery.convertToQuery().addOrder(Sort.Direction.ASC, "checkDate"));
  537 + if(list != null && list.size() > 0){
  538 +
  539 + }else{
  540 + return mList;
  541 + }
  542 + /*exData[0] = list.get(0);
  543 + exData[1] = list.get(1);
  544 + exData[2] = list.get(2);
  545 + exData[3] = list.get(3);*/
  546 + }
  547 +
  548 + // Map<String, Object> map = new HashMap<>();
  549 + for (int i = 0; i < list.size(); i++) {
  550 + Map<String, Object> map = new HashedMap();
  551 + map.put("name",name);
  552 + AntenatalExaminationModel data = list.get(i);
  553 + if (data == null) {
  554 + continue;
  555 + }
  556 + /*String numStr = "";
  557 + if (i == 0) {
  558 + numStr = "one";
  559 + } else if (i == 1) {
  560 + numStr = "two";
  561 + } else if (i == 2) {
  562 + numStr = "thre";
  563 + } else if (i == 3) {
  564 + numStr = "four";
  565 + }*/
  566 +
  567 + if (data.getCheckDate() != null) {
  568 + map.put("checkDate", DateUtil.getyyyy_MM_dd(data.getCheckDate()));
  569 + }
  570 + map.put("currentDueDate", ResolveUtils.getPregnancyWeek(patients.getLastMenses(), data.getCheckDate()));
  571 + if (StringUtils.isNotEmpty(data.getChiefComplaint())) {
  572 + map.put("chiefComplaint", data.getChiefComplaint());
  573 + }
  574 + if (data.getWeight() != null) {
  575 + map.put("weight", UnitUtils.unitSplice(data.getWeight(), UnitConstants.KG));
  576 + }
  577 + if (StringUtils.isNotEmpty(data.getGongGao())) {
  578 + map.put("gongGao", UnitUtils.unitSplice(data.getGongGao(), UnitConstants.CM));
  579 + }
  580 + if (StringUtils.isNotEmpty(data.getAbdominalCircumference())) {
  581 + map.put("abdominalCircumference", UnitUtils.unitSplice(data.getAbdominalCircumference(), UnitConstants.CM));
  582 + }
  583 + if (CollectionUtils.isNotEmpty(data.getTireData())) {
  584 + StringBuffer fposiSb = new StringBuffer();
  585 + StringBuffer hrateSb = new StringBuffer();
  586 + for (Object temp : data.getTireData()) {
  587 + Map<String, String> tire = JsonUtil.getMap(temp.toString());
  588 + if (tire != null) {
  589 + String heartRate = tire.get("heartRate");
  590 + String fetalPosition = tire.get("fetalPosition");
  591 + if (StringUtils.isNotEmpty(heartRate)) {
  592 + hrateSb.append(UnitUtils.unitSplice(heartRate, UnitConstants.CIFEN) + "/");
  593 + }
  594 + if (StringUtils.isNotEmpty(fetalPosition) && !"null".equals(fetalPosition)) {
  595 + fposiSb.append(FetalPositionEnums.getTitle(fetalPosition) + "/");
  596 + }
  597 + }
  598 + }
  599 + if (StringUtils.isNotEmpty(hrateSb.toString())) {
  600 + map.put("heartRate", hrateSb.toString());
  601 + }
  602 + if (StringUtils.isNotEmpty(fposiSb.toString())) {
  603 + map.put("fetalPosition", fposiSb.toString());
  604 + }
  605 + }
  606 + Map<String, String> chBpMap = JsonUtil.getMap(data.getBp());
  607 + if (MapUtils.isNotEmpty(chBpMap)) {
  608 + if (StringUtils.isNotEmpty(chBpMap.get("ssy"))) {
  609 + map.put("ssy", chBpMap.get("ssy"));
  610 + }
  611 + if (StringUtils.isNotEmpty(chBpMap.get("szy"))) {
  612 + map.put("szy", chBpMap.get("szy"));
  613 + }
  614 + }
  615 + if (StringUtils.isNotEmpty(data.getHemoglobin())) {
  616 + map.put("hemoglobin", UnitUtils.unitSplice(data.getHemoglobin(), UnitConstants.GL));
  617 + }
  618 + if (StringUtils.isNotEmpty(data.getUrineProtein())) {
  619 + map.put("urineProtein", data.getUrineProtein());
  620 +
  621 + }
  622 + if (StringUtils.isNotEmpty(data.getbChao())) {
  623 + map.put("bChao", data.getbChao());
  624 +
  625 + }
  626 +
  627 + String hospital = autoMatchFacade.getHospitalId(userId);
  628 + ReferralApplyOrderQuery referralApplyOrderQuery = new ReferralApplyOrderQuery();
  629 + referralApplyOrderQuery.setParentId(data.getParentId());
  630 + referralApplyOrderQuery.setOutHospitalId(hospital);
  631 + List<ReferralApplyOrderModel> orderModels = applyOrderService.queryReferralApplyOrderWithQuery(referralApplyOrderQuery);
  632 + if (CollectionUtils.isNotEmpty(orderModels)) {
  633 + boolean isZhuan = false;
  634 + for (ReferralApplyOrderModel raom : orderModels) {//获取转院时间
  635 + String checkTime = DateUtil.getyyyy_MM_dd(data.getCheckDate());
  636 + String Created = DateUtil.getyyyy_MM_dd(data.getCreated());
  637 +
  638 + if (raom.getCreated().before(data.getCheckDate()) || checkTime.equals(Created)) {
  639 + isZhuan = true;
  640 + continue;
  641 + }
  642 + }
  643 + if (isZhuan) {
  644 + try {
  645 + Organization zhuanc1 = organizationService.getOrganization(Integer.valueOf(hospital));
  646 + if (null != zhuanc1) {
  647 + map.put("zhuancl", zhuanc1.getName());
  648 + map.put("isZhuan", "2");
  649 + }
  650 + } catch (Exception e) {
  651 +
  652 + }
  653 + } else {
  654 + map.put("isZhuan", "1");
  655 + }
  656 + } else {
  657 + map.put("isZhuan", "1");
  658 + }
  659 + if (data.getNextCheckTime() != null) {
  660 + map.put("nextCheckTime", DateUtil.getyyyy_MM_dd(data.getNextCheckTime()));
  661 + }
  662 + String checkDoctor = "";
  663 + if (org.apache.commons.lang.StringUtils.isNotEmpty(data.getCheckDoctor())) {
  664 + Users users = usersService.getUsers(Integer.parseInt(data.getCheckDoctor()));
  665 + if (users != null && users.getYn() == YnEnums.YES.getId()) {
  666 + checkDoctor = users.getName();
  667 + }
  668 + }
  669 + map.put("checkDoctor", checkDoctor);
  670 + mList.add(map);
  671 + }
  672 + return mList;
  673 + }
  674 +
502 675  
503 676  
504 677 private String getRisk(String risk,String otherRisk)