Commit 64b76130e7e24ec423ceae51e90b56ee30a26266

Authored by yangfei
1 parent ae7eb0d31c
Exists in master and in 1 other branch dev

高危管理

Showing 4 changed files with 287 additions and 11 deletions

platform-dal/src/main/java/com/lyms/platform/pojo/AntExChuModel.java View file @ 64b7613
... ... @@ -151,6 +151,7 @@
151 151 private String fujianSele;
152 152 private Date created;
153 153 private String hospitalId;
  154 + //血压
154 155 private String bp;
155 156 //丈夫健康情况
156 157 private String hHealthInfo;
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ViewController.java View file @ 64b7613
... ... @@ -18,6 +18,7 @@
18 18 import java.awt.*;
19 19 import java.io.IOException;
20 20 import java.io.InputStream;
  21 +import java.util.ArrayList;
21 22 import java.util.List;
22 23 import java.util.Map;
23 24 import java.util.List;
24 25  
... ... @@ -165,16 +166,130 @@
165 166 e.printStackTrace();
166 167 }
167 168 }
168   - @RequestMapping(value = "/downExpostData", method = RequestMethod.GET)
169   -// @TokenRequired
170   - public void downExPostData(@RequestParam("id") String id,
171 169  
172   - HttpServletRequest request, HttpServletResponse response) {
173   -// LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
174   -// if(loginState == null){
175   -// System.out.println("用户未登录!");
176   -// return;
177   -// }
  170 + /**
  171 + * 导出高危孕产妇专案管理
  172 + * @param id
  173 + * @param response
  174 + */
  175 + @RequestMapping(value = "/downHightRiskExpostData", method = RequestMethod.GET)
  176 + public void downHightRiskExpostData(@RequestParam("parentId") String id,HttpServletResponse response) {
  177 + Map<String, Object> map = viewFacade.expHightRiskPostReview(id, null);
  178 + try {
  179 + // 验证License
  180 + if (!getLicense()) {
  181 + return;
  182 + }
  183 + Document doc;// 原始word路径
  184 + try {
  185 + doc = new Document(ViewController.class.getClassLoader().getResourceAsStream("gwyfzagl.doc"));
  186 +
  187 + markData(doc, map);//普通数据
  188 +
  189 + List<List<String>> allAntExList = (List<List<String>>) map.get("antExData");
  190 +
  191 + NodeCollection allTables = doc.getChildNodes(NodeType.TABLE, true); //拿到所有表格
  192 +
  193 +
  194 + DocumentBuilder builder = new DocumentBuilder(doc);
  195 +
  196 + List widthList = new ArrayList();
  197 + for (int i = 0; i < 7; i++)
  198 + {
  199 + builder.moveToCell(0, 5, i, 0); //移动单元格
  200 + double width = builder.getCellFormat().getWidth();//获取单元格宽度
  201 + System.out.println("width:"+width);
  202 + widthList.add(width);
  203 + }
  204 +
  205 + builder.moveToBookmark("table"); //开始添加值
  206 + for (int i=0; i<allAntExList.size(); i++)
  207 + {
  208 + for (int j =0;j<allAntExList.get(i).size();j++)
  209 + {
  210 + builder.insertCell();// 添加一个单元格
  211 + builder.getCellFormat().getBorders().setLineStyle(LineStyle.SINGLE);
  212 + builder.getCellFormat().getBorders().setColor(Color.BLACK);
  213 + builder.getCellFormat().setWidth((Double) widthList.get(j));
  214 + builder.getCellFormat().setVerticalMerge(CellMerge.NONE);
  215 + builder.getCellFormat().setVerticalAlignment(CellVerticalAlignment.CENTER); //垂直居中对齐
  216 + builder.getParagraphFormat().setAlignment(ParagraphAlignment.CENTER);//水平居中对齐
  217 + builder.write(allAntExList.get(i).get(j));
  218 + }
  219 + builder.endRow();
  220 + }
  221 +
  222 + Table table = (Table) allTables.get(0); //拿到表格
  223 + /*for(int i=0; i<allAntExList.size(); i++) {
  224 + Row r2 = new Row(doc);
  225 + for (int a =0;a<allAntExList.get(i).size();a++) {
  226 + Paragraph p = new Paragraph(doc);
  227 + if(allAntExList.get(i).get(a)!=null){
  228 + Cell c1 = new Cell(doc);
  229 + p.appendChild(new Run(doc, allAntExList.get(i).get(a)));
  230 + c1.appendChild(p);
  231 + r2.getCells().add(c1);
  232 + CellFormat cellFormat = c1.getCellFormat();
  233 + cellFormat.setWidth(58);
  234 + }
  235 + }
  236 + System.out.println("::===="+table.getRows().getCount());
  237 + table.getRows().insert(table.getRows().getCount(),r2);
  238 + }*/
  239 +
  240 +
  241 + // DataTable visitTb = new DataTable("antExData"); //网站访问量表格
  242 + // visitTb.getColumns().add("checkDate"); //0 增加三个列 日期
  243 + // visitTb.getColumns().add("dueWeek"); //1 IP访问数量
  244 + // visitTb.getColumns().add("hightRisk"); //2 页面浏览量
  245 + // visitTb.getColumns().add("scale"); //2 页面浏览量
  246 + // visitTb.getColumns().add("treatOpinion"); //2 页面浏览量
  247 + // visitTb.getColumns().add("checkUnit"); //2 页面浏览量
  248 + // visitTb.getColumns().add("doctName"); //2 页面浏览量
  249 + // //向表格中填充数据
  250 + // for(int i=1; i<allAntExList.size(); i++){
  251 + // Map mp = allAntExList.get(i);
  252 + // DataRow row = visitTb.newRow(); //新增一行
  253 + // row.set(0, mp.get("checkDate")); //根据列顺序填入数值
  254 + // row.set(1, mp.get("dueWeek"));
  255 + // row.set(2, mp.get("hightRisk"));
  256 + // row.set(3, mp.get("scale"));
  257 + // row.set(4, mp.get("treatOpinion"));
  258 + // row.set(5, mp.get("checkUnit"));
  259 + // row.set(6, mp.get("doctName"));
  260 + // visitTb.getRows().add(row ); //加入此行数据
  261 + // }
  262 + // //对于无数据的情况,增加一行空记录
  263 + // if( visitTb.getRows().getCount() == 0 ){
  264 + // DataRow row = visitTb.newRow();
  265 + // visitTb.getRows().add( row );
  266 + // }
  267 + // doc.getMailMerge().executeWithRegions( visitTb ); //调用接口
  268 +
  269 +
  270 + // for(Map<String,String> mp:allAntExList){
  271 + // for(Map.Entry<String,String> m:mp.entrySet()){
  272 + // Bookmark mark = doc.getRange().getBookmarks().get(m.getKey());
  273 + // if (mark != null&&m.getValue()!=null) {
  274 + // System.out.println(m.getKey()+":"+m.getValue());
  275 + // mark.setText(m.getValue());
  276 + // }
  277 + // }
  278 + // }
  279 + sendToBrowser(doc, "导出", "doc", true, response);
  280 + } catch (Exception e) {
  281 + e.printStackTrace();
  282 + }
  283 + response.flushBuffer();
  284 + } catch (IOException e) {
  285 + e.printStackTrace();
  286 + }
  287 + }
  288 +
  289 +
  290 +
  291 + @RequestMapping(value = "/downExpostData", method = RequestMethod.GET)
  292 + public void downExPostData(@RequestParam("id") String id,HttpServletRequest request, HttpServletResponse response) {
178 293 Map<String, Object> map = viewFacade.expPostReview(id, null);
179 294 try {
180 295 // 验证License
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ViewFacade.java View file @ 64b7613
... ... @@ -313,10 +313,10 @@
313 313 }
314 314  
315 315 private void getscreenResult(List<String> screenResult, Map<String, Object> map) {
316   - if(CollectionUtils.isNotEmpty(screenResult)){
  316 + if (CollectionUtils.isNotEmpty(screenResult)) {
317 317 BasicConfigQuery basicConfigQuery = new BasicConfigQuery();
318 318 List<Map<String, Object>> list = new ArrayList<>();
319   - for(String scr:screenResult){
  319 + for (String scr : screenResult) {
320 320 basicConfigQuery.setId(scr);
321 321 List<BasicConfig> basicConfigs = basicConfigService.queryBasicConfig(basicConfigQuery);
322 322 if (CollectionUtils.isNotEmpty(basicConfigs)) {
... ... @@ -2836,6 +2836,166 @@
2836 2836 br.setErrormsg("成功");
2837 2837 br.setData(map);
2838 2838 return br;
  2839 + }
  2840 +
  2841 + /**
  2842 + * 到处产后随访数据
  2843 + *
  2844 + * @return
  2845 + */
  2846 + public Map expHightRiskPostReview(String id, Integer userId) {
  2847 + Map map = new HashMap();
  2848 + Patients patients = patientsService.findOnePatientById(id);
  2849 + if (patients != null) {
  2850 + /* 基础信息 */
  2851 + map.put("id", id);
  2852 + map.put("name", patients.getUsername());
  2853 + map.put("age", DateUtil.getAge(patients.getBirth(), new Date()) + "");
  2854 + map.put("nation", getBasicConfig(patients.getPnationId()));
  2855 + map.put("education", getBasicConfig(patients.getPlevelTypeId()));
  2856 + Date dueDate = DateUtil.addDay(patients.getLastMenses(), 280);
  2857 + //返回预产期
  2858 + map.put("lastMenstr", DateUtil.getyyyy_MM_dd(patients.getLastMenses()));
  2859 + map.put("dueDate", DateUtil.getyyyy_MM_dd(dueDate));
  2860 + map.put("address", CommonsHelper.getResidence(patients.getProvinceRegisterId(), patients.getCityRegisterId(),
  2861 + patients.getAreaRegisterId(), patients.getStreetRegisterId(), patients.getAddressRegister(), basicConfigService));
  2862 +
  2863 + map.put("phone", com.lyms.platform.common.utils.StringUtils.isEmpty(patients.getPhone(), ""));
  2864 + map.put("fmDate", DateUtil.getyyyy_MM_dd(patients.getFmDate()));
  2865 + map.put("mremark", com.lyms.platform.common.utils.StringUtils.isEmpty(patients.getMremark(), ""));
  2866 + List<List<String>> allAntExList = getAntExAll(patients, map);
  2867 + map.put("antExData", allAntExList);
  2868 + }
  2869 +
  2870 + return map;
  2871 + }
  2872 +
  2873 + private List<List<String>> getAntExAll(Patients patients, Map map) {
  2874 + List<List<String>> dataMap = new ArrayList<>();
  2875 + //获取产程ID
  2876 + String patientId = patients.getId();
  2877 + Organization organization = null;
  2878 +
  2879 + List<String> patientIds = new ArrayList<>();
  2880 + patientIds.add(patientId);
  2881 +
  2882 + //建档记录
  2883 + if (null != patients.getHospitalId()) {
  2884 + organization = organizationService.getOrganization(Integer.valueOf(patients.getHospitalId()));
  2885 + }
  2886 +
  2887 + PatientsQuery patientsQuery = new PatientsQuery();
  2888 + patientsQuery.setSource(patients.getId());
  2889 +
  2890 + patientsQuery.setBuildType(1);
  2891 + List<Patients> patients1 = patientsService.queryPatient(patientsQuery);
  2892 + if (CollectionUtils.isNotEmpty(patients1)) {
  2893 + for (Patients ps : patients1) {
  2894 + patientIds.add(ps.getId());
  2895 + }
  2896 + }
  2897 + //初诊记录
  2898 + AntExChuQuery antExChuQuery = new AntExChuQuery();
  2899 + antExChuQuery.setYn(YnEnums.YES.getId());
  2900 + antExChuQuery.setParentIds(patientIds);
  2901 + List<AntExChuModel> antExChuModels = antenatalExaminationService.queryAntExChu(antExChuQuery);
  2902 + if (CollectionUtils.isNotEmpty(antExChuModels)) {
  2903 + for (AntExChuModel an : antExChuModels) {
  2904 + List<String> antExChu = new ArrayList();
  2905 + if (null != an.getHospitalId()) {
  2906 + organization = organizationService.getOrganization(Integer.valueOf(an.getHospitalId()));
  2907 + }
  2908 + map.put("stature", an.getHeight());
  2909 + map.put("firstDate", DateUtil.getyyyy_MM_dd(an.getCheckTime()));
  2910 + map.put("weight", an.getWeight());
  2911 + map.put("prodTime", UnitUtils.unitSplice(an.getProdTime(), UnitConstants.CI));
  2912 + map.put("pregnancyTimes", UnitUtils.unitSplice(an.getPregnancyTimes(), UnitConstants.CI));
  2913 +
  2914 + // 血压
  2915 + String ssy = "";
  2916 + String szy = "";
  2917 + Map<String, String> chBpMap = JsonUtil.getMap(an.getBp());
  2918 + if (MapUtils.isNotEmpty(chBpMap)) {
  2919 + ssy = chBpMap.get("ssy");
  2920 + szy = chBpMap.get("szy");
  2921 + }
  2922 + map.put("bp", UnitUtils.unitSplice(ssy + "/" + szy, UnitConstants.MMHG));
  2923 +
  2924 + antExChu.add(DateUtil.getyyyy_MM_dd(an.getCheckTime()));
  2925 + antExChu.add(ResolveUtils.getPregnancyWeek(patients.getLastMenses(), an.getCheckTime()));
  2926 + String hightRiskStr = basicConfigService.getScreenResult(JsonUtil.jkstr2Obj(an.getHighrisk(), List.class));
  2927 + antExChu.add(hightRiskStr);
  2928 +
  2929 + List list2 = JsonUtil.toList(an.getHighrisk(), List.class);
  2930 + HighScoreResult highScoreResult = antenatalExaminationFacade.queryRisk(list2, true);
  2931 +
  2932 + Set sbLev = new HashSet();
  2933 + for (int i = 0;i<highScoreResult.getLevel().size();i++) {
  2934 + Map<String, Object> mp = (Map<String, Object>) highScoreResult.getLevel().get(i);
  2935 + sbLev.add(mp.get("name"));
  2936 + }
  2937 + if(CollectionUtils.isNotEmpty(sbLev)){
  2938 + antExChu.add(sbLev.toString());
  2939 + }else{
  2940 + antExChu.add("健康");
  2941 + }
  2942 + antExChu.add(an.getTreatOpinion()==null?" ":an.getTreatOpinion());
  2943 + antExChu.add(organization.getName());
  2944 + String doctName = "";
  2945 + if (org.apache.commons.lang.StringUtils.isNotEmpty(an.getProdDoctor())) {
  2946 + Users users = usersService.getUsers(Integer.parseInt(an.getProdDoctor()));
  2947 + if (users != null && users.getYn() == YnEnums.YES.getId()) {
  2948 + doctName = users.getName();
  2949 + }
  2950 + }
  2951 + antExChu.add(doctName);
  2952 + dataMap.add(antExChu);
  2953 + }
  2954 + }
  2955 +
  2956 + //复诊记录
  2957 + AntExQuery antExQuery = new AntExQuery();
  2958 + antExQuery.setYn(YnEnums.YES.getId());
  2959 + antExQuery.setParentIds(patientIds);
  2960 + List<AntenatalExaminationModel> list1 = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery());
  2961 + if (CollectionUtils.isNotEmpty(list1)) {
  2962 + for (AntenatalExaminationModel an : list1) {
  2963 + List<String> antExChu = new ArrayList();
  2964 + if (null != an.getHospitalId()) {
  2965 + organization = organizationService.getOrganization(Integer.valueOf(an.getHospitalId()));
  2966 + }
  2967 + antExChu.add(DateUtil.getyyyy_MM_dd(an.getCheckDate()));
  2968 + antExChu.add(ResolveUtils.getPregnancyWeek(patients.getLastMenses(), an.getCheckDate()));
  2969 + String hightRiskStr = basicConfigService.getScreenResult(JsonUtil.jkstr2Obj(an.getRiskFactor(), List.class));
  2970 + antExChu.add(hightRiskStr);
  2971 +
  2972 + List list2 = JsonUtil.toList(an.getRiskFactor(), List.class);
  2973 + HighScoreResult highScoreResult = antenatalExaminationFacade.queryRisk(list2, true);
  2974 + List<Map<String, Object>> checkList = ResolveUtils.queryHighRisk(highScoreResult);
  2975 + Set sbLev = new HashSet();
  2976 + for (int i = 0;i<highScoreResult.getLevel().size();i++) {
  2977 + Map<String, Object> mp = (Map<String, Object>) highScoreResult.getLevel().get(i);
  2978 + sbLev.add(mp.get("name"));
  2979 + }
  2980 + if(CollectionUtils.isNotEmpty(sbLev)){
  2981 + antExChu.add(sbLev.toString());
  2982 + }else{
  2983 + antExChu.add("健康");
  2984 + }
  2985 + antExChu.add(an.getTreatmentOpinion()==null?" ":an.getTreatmentOpinion());
  2986 + antExChu.add(organization.getName());
  2987 + String checkDoctor = "";
  2988 + if (org.apache.commons.lang.StringUtils.isNotEmpty(an.getCheckDoctor())) {
  2989 + Users users = usersService.getUsers(Integer.parseInt(an.getCheckDoctor()));
  2990 + if (users != null && users.getYn() == YnEnums.YES.getId()) {
  2991 + checkDoctor = users.getName();
  2992 + }
  2993 + }
  2994 + antExChu.add(checkDoctor);
  2995 + dataMap.add(antExChu);
  2996 + }
  2997 + }
  2998 + return dataMap;
2839 2999 }
2840 3000  
2841 3001 /**
platform-operate-api/src/main/resources/gwyfzagl.doc View file @ 64b7613

No preview for this file type