Commit 9f2819e08bcb1eaa5dadb9023b8a4113cdcdfca8

Authored by wtt
1 parent e87f55dec7

update

Showing 3 changed files with 186 additions and 14 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ViewController.java View file @ 9f2819e
... ... @@ -351,6 +351,65 @@
351 351 }
352 352  
353 353  
  354 +
  355 + /**
  356 + * 导出全部产妇管理 word导出
  357 + *
  358 + * @param id
  359 + * @param response
  360 + */
  361 + @RequestMapping(value = "/downPuerperaExpostData", method = RequestMethod.GET)
  362 + public void downPuerperaExpostData(@RequestParam("parentId") String id, HttpServletResponse response) {
  363 + Map<String, Object> map = viewFacade.downPuerperaExpostData(id, null);
  364 + try {
  365 + // 验证License
  366 + if (!getLicense()) {
  367 + return;
  368 + }
  369 + Document doc;// 原始word路径
  370 + try {
  371 + doc = new Document(ViewController.class.getClassLoader().getResourceAsStream("qbcf.doc"));
  372 +
  373 + markData(doc, map);//普通数据
  374 +
  375 + List<List<String>> allAntExList = (List<List<String>>) map.get("antExData");
  376 +
  377 + // NodeCollection allTables = doc.getChildNodes(NodeType.TABLE, true); //拿到所有表格
  378 + DocumentBuilder builder = new DocumentBuilder(doc);
  379 +
  380 + List widthList = new ArrayList();
  381 + for (int i = 0; i < 7; i++) {
  382 + builder.moveToCell(0, 12, i, 0); //移动单元格
  383 + double width = builder.getCellFormat().getWidth();//获取单元格宽度
  384 + System.out.println("width:" + width);
  385 + widthList.add(width);
  386 + }
  387 +
  388 + builder.moveToBookmark("table"); //开始添加值
  389 + for (int i = 0; i < allAntExList.size(); i++) {
  390 + for (int j = 0; j < allAntExList.get(i).size(); j++) {
  391 + builder.insertCell();// 添加一个单元格
  392 + builder.getCellFormat().getBorders().setLineStyle(LineStyle.SINGLE);
  393 + builder.getCellFormat().getBorders().setColor(Color.BLACK);
  394 + builder.getCellFormat().setWidth((Double) widthList.get(j));
  395 + builder.getCellFormat().setVerticalMerge(CellMerge.NONE);
  396 + builder.getCellFormat().setVerticalAlignment(CellVerticalAlignment.CENTER); //垂直居中对齐
  397 + builder.getParagraphFormat().setAlignment(ParagraphAlignment.CENTER);//水平居中对齐
  398 + builder.write(allAntExList.get(i).get(j));
  399 + }
  400 + builder.endRow();
  401 + }
  402 + sendToBrowser(doc, "导出", "doc", true, response);
  403 + } catch (Exception e) {
  404 + e.printStackTrace();
  405 + }
  406 + response.flushBuffer();
  407 + } catch (IOException e) {
  408 + e.printStackTrace();
  409 + }
  410 + }
  411 +
  412 +
354 413 @RequestMapping(value = "/downExpostData", method = RequestMethod.GET)
355 414 public void downExPostData(@RequestParam("id") String id, HttpServletRequest request, HttpServletResponse response) {
356 415 Map<String, Object> map = viewFacade.expPostReview(id, null);
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ViewFacade.java View file @ 9f2819e
... ... @@ -28,6 +28,7 @@
28 28 import com.lyms.platform.operate.web.utils.UnitConstants;
29 29 import com.lyms.platform.permission.model.*;
30 30 import com.lyms.platform.permission.service.CheckItemService;
  31 +import com.lyms.platform.query.*;
31 32 import net.sf.json.JSONArray;
32 33 import org.apache.commons.collections.CollectionUtils;
33 34 import org.apache.commons.collections.MapUtils;
... ... @@ -98,18 +99,6 @@
98 99 import com.lyms.platform.pojo.ReferralApplyOrderModel;
99 100 import com.lyms.platform.pojo.ResidentsArchiveModel;
100 101 import com.lyms.platform.pojo.StopPregModel;
101   -import com.lyms.platform.query.AntExChuQuery;
102   -import com.lyms.platform.query.AntExQuery;
103   -import com.lyms.platform.query.AntExRecordQuery;
104   -import com.lyms.platform.query.BabyCheckModelQuery;
105   -import com.lyms.platform.query.BabyModelQuery;
106   -import com.lyms.platform.query.BasicConfigQuery;
107   -import com.lyms.platform.query.DischargeAbstractBabyQuery;
108   -import com.lyms.platform.query.MatDeliverQuery;
109   -import com.lyms.platform.query.PatientsQuery;
110   -import com.lyms.platform.query.ReferralApplyOrderQuery;
111   -import com.lyms.platform.query.ResidentsArchiveQuery;
112   -import com.lyms.platform.query.StopPregQuery;
113 102  
114 103 /**
115 104 * Created by Administrator on 2017/1/16 0016.
... ... @@ -4691,6 +4680,130 @@
4691 4680 }
4692 4681  
4693 4682  
  4683 +
  4684 + /**
  4685 + * 到处产后随访数据
  4686 + *
  4687 + * @return
  4688 + */
  4689 + public Map downPuerperaExpostData(String id, Integer userId) {
  4690 + Map map = new HashMap();
  4691 + Patients patients = patientsService.findOnePatientById(id);
  4692 + if (patients != null) {
  4693 + /* 基础信息 */
  4694 + map.put("id", id);
  4695 + map.put("name", patients.getUsername());
  4696 + map.put("age", DateUtil.getAge(patients.getBirth(), new Date()) + "");
  4697 + map.put("nation", getBasicConfig(patients.getPnationId()));
  4698 + map.put("education", getBasicConfig(patients.getPlevelTypeId()));
  4699 + Date dueDate = DateUtil.addDay(patients.getLastMenses(), 280);
  4700 + //返回预产期
  4701 + map.put("lastMenstr", DateUtil.getyyyy_MM_dd(patients.getLastMenses()));
  4702 + map.put("dueDate", DateUtil.getyyyy_MM_dd(dueDate));
  4703 + map.put("address", CommonsHelper.getResidence(patients.getProvinceRegisterId(), patients.getCityRegisterId(),
  4704 + patients.getAreaRegisterId(), patients.getStreetRegisterId(), patients.getAddressRegister(), basicConfigService));
  4705 +
  4706 + map.put("phone", com.lyms.platform.common.utils.StringUtils.isEmpty(patients.getPhone(), ""));
  4707 + map.put("fmDate", DateUtil.getyyyy_MM_dd(patients.getFmDate()));
  4708 + map.put("mremark", com.lyms.platform.common.utils.StringUtils.isEmpty(patients.getMremark(), ""));
  4709 + List <List <String>> allAntExList = getAntExAll(patients, map);
  4710 + map.put("antExData", allAntExList);
  4711 +
  4712 + //初诊
  4713 + AntExChuQuery antExChuQuery = new AntExChuQuery();
  4714 + antExChuQuery.setYn(YnEnums.YES.getId());
  4715 + antExChuQuery.setParentId(patients.getId());
  4716 + List <AntExChuModel> antExChuModels = antenatalExaminationService.queryAntExChu(antExChuQuery);
  4717 + if (CollectionUtils.isNotEmpty(antExChuModels)) {
  4718 + AntExChuModel antExChuModel = antExChuModels.get(0);
  4719 + map.put("yaowu", antExChuModel.getYaowu());//药物流产次数
  4720 + map.put("abortion", antExChuModel.getAbortion()); //流产
  4721 + map.put("abortionRG", antExChuModel.getAbortionRG()); //人工流产
  4722 + map.put("abortionZR", antExChuModel.getAbortionZR()); //自然流产
  4723 + }
  4724 + //分娩情况
  4725 + MatDeliverQuery matDeliverQuery1 = new MatDeliverQuery();
  4726 + matDeliverQuery1.setParentId(patients.getId());
  4727 + matDeliverQuery1.setYn(YnEnums.YES.getId());
  4728 + List <MaternalDeliverModel> query = matDeliverService.query(matDeliverQuery1);
  4729 + putMatDeliver(map, query);
  4730 +
  4731 + //产后复查
  4732 + PostReviewQuery antExQuery = new PostReviewQuery();
  4733 + antExQuery.setParentId(patients.getId());
  4734 + antExQuery.setYn(YnEnums.YES.getId());
  4735 + List<PostReviewModel> list = postReviewService.findWithList(antExQuery.convertToQuery().addOrder(Sort.Direction.DESC, "checkTime"));
  4736 + if (CollectionUtils.isNotEmpty(list)) {
  4737 + PostReviewModel postReviewModel = list.get(0);
  4738 + map.put("sfTime",DateUtil.getyyyy_MM_dd(postReviewModel.getCheckTime())); //产后42天随访日期
  4739 + String prodDoctor = "";
  4740 + if (org.apache.commons.lang.StringUtils.isNotEmpty(postReviewModel.getProdDoctor())) {
  4741 + Users users = usersService.getUsers(Integer.parseInt(postReviewModel.getProdDoctor()));
  4742 + if (users != null && users.getYn() == YnEnums.YES.getId()) {
  4743 + prodDoctor = users.getName();
  4744 + }
  4745 + }
  4746 + map.put("prodDoctor", prodDoctor);//产检 医生
  4747 + map.put("healthStatus", postReviewModel.getHealthStatus()); //健康情况
  4748 + }
  4749 + }
  4750 +
  4751 + return map;
  4752 + }
  4753 +
  4754 + private void putMatDeliver(Map map, List <MaternalDeliverModel> query) {
  4755 + if (CollectionUtils.isNotEmpty(query)) {
  4756 + MaternalDeliverModel maternalDeliverModel = query.get(0);
  4757 + String deliveryMode = "";
  4758 + if (StringUtils.isNotEmpty(maternalDeliverModel.getDeliveryMode())) {
  4759 +
  4760 + StringBuilder sb = new StringBuilder();
  4761 +
  4762 + Map m = JsonUtil.str2Obj(maternalDeliverModel.getDeliveryMode(), Map.class);
  4763 + String fmfs = null;
  4764 + if (m != null) {
  4765 + Object b = m.get("fmfs");
  4766 + if (b != null) {
  4767 + fmfs = b.toString();
  4768 + if (fmfs != null) {
  4769 + if (fmfs.equals("1")) {
  4770 + String fmName = FmTypeEnums.getFmNameById(fmfs);
  4771 + sb.append(fmName);
  4772 + if (null != m.get("scfs") && !"null".equals(m.get("scfs").toString())) {
  4773 + sb.append(",");
  4774 + String scfs = m.get("scfs").toString();
  4775 + sb.append(FmTypeEnums.getFmScNameById(scfs));
  4776 + }
  4777 + deliveryMode = sb.toString();
  4778 + } else if (fmfs.equals("2")) {
  4779 + String fmName = FmTypeEnums.getFmNameById(fmfs);
  4780 + deliveryMode = fmName;
  4781 + }
  4782 + }
  4783 + }
  4784 + }
  4785 + }
  4786 + map.put("deliveryMode", deliveryMode);//分娩方式
  4787 + map.put("dueWeek", maternalDeliverModel.getDueWeek());//分娩孕周
  4788 + String fmHospital = "";
  4789 + String cityId = null;
  4790 + if (StringUtils.isNotEmpty(maternalDeliverModel.getFmHospital())) {
  4791 + if (com.lyms.platform.common.utils.StringUtils.isNum(maternalDeliverModel.getFmHospital())) {
  4792 + Organization organization = organizationService.getOrganization(Integer.parseInt(maternalDeliverModel.getFmHospital()));
  4793 + if (organization != null && organization.getYn() == YnEnums.YES.getId()) {
  4794 + fmHospital = organization.getName();
  4795 + cityId = organization.getCityId();
  4796 + }
  4797 + } else {
  4798 + fmHospital = maternalDeliverModel.getFmHospital();
  4799 + }
  4800 + }
  4801 + map.put("fmHospital", fmHospital);//分娩医院
  4802 + //map.put("dueDate", maternalDeliverModel.getDueDate());//分娩时间
  4803 + }
  4804 + }
  4805 +
  4806 +
4694 4807 public Map expHightPjData(String id, Integer userId) {
4695 4808 Map map = new HashMap();
4696 4809 Patients patients = patientsService.findOnePatientById(id);
4697 4810  
... ... @@ -4858,9 +4971,9 @@
4858 4971 if (null != an.getHospitalId()) {
4859 4972 organization = organizationService.getOrganization(Integer.valueOf(an.getHospitalId()));
4860 4973 }
4861   - map.put("stature", an.getHeight());
  4974 + map.put("stature", com.lyms.platform.common.utils.StringUtils.isNotEmpty(an.getHeight()) ? an.getHeight()+"cm" : "");
4862 4975 map.put("firstDate", DateUtil.getyyyy_MM_dd(an.getCheckTime()));
4863   - map.put("weight", an.getWeight());
  4976 + map.put("weight", com.lyms.platform.common.utils.StringUtils.isNotEmpty(an.getWeight()) ? an.getWeight()+"kg" : "");
4864 4977 map.put("prodTime", UnitUtils.unitSplice(an.getProdTime(), UnitConstants.CI));
4865 4978 map.put("pregnancyTimes", UnitUtils.unitSplice(an.getPregnancyTimes(), UnitConstants.CI));
4866 4979  
platform-operate-api/src/main/resources/qbcf.doc View file @ 9f2819e

No preview for this file type