Commit 09e298ba5ea307d21d12b818807aeff11066bf92

Authored by jiangjiazhi
1 parent 863f95e38f

增加获取未读报告接口

Showing 4 changed files with 150 additions and 12 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/BasicConfigServiceTest.java View file @ 09e298b
... ... @@ -1300,18 +1300,33 @@
1300 1300 private static Map<String,String> map = new HashMap<>();
1301 1301 private static Map<String,String> map1 = new HashMap<>();
1302 1302 private static Map<String,Integer> map2 = new HashMap<>();
  1303 + //分类名字和id的映射
  1304 + private static Map<String,Integer> map3 = new HashMap<>();
1303 1305 static {
1304 1306 map.put("血压值正常无波动","00");
1305 1307 map.put("血压波动异常血压值正常","01");
1306 1308 map.put("血压值异常血压值异常但基本平稳","10");
1307 1309 map.put("血压值异常波动异常","11");
  1310 + map.put("饮食原则血压正常","0");
  1311 + map.put("饮食原则血压异常","1");
  1312 + map.put("膳食指导只和孕周有关","2");
  1313 + map.put("食谱推荐","3");
1308 1314  
1309 1315  
  1316 + map3.put("饮食原则血压正常",PloodPressureGuideCategoryTypeEnum.YINSHIYUANZE.getId());
  1317 + map3.put("饮食原则血压异常",PloodPressureGuideCategoryTypeEnum.YINSHIYUANZE.getId());
  1318 + map3.put("膳食指导只和孕周有关", PloodPressureGuideCategoryTypeEnum.SHANSHIZHIDAO.getId());
  1319 + map3.put("食谱推荐", PloodPressureGuideCategoryTypeEnum.SHIPUTUIJIAN.getId());
  1320 +
  1321 + //sheet页对应的标签
1310 1322 map1.put("1","合理运动");
1311 1323 map1.put("2","运动指导");
1312 1324 map1.put("3","心理指导");
1313 1325 map1.put("4","自我监测");
1314 1326 map1.put("5","用药指导");
  1327 + map1.put("6","饮食原则");
  1328 + map1.put("7","膳食构成");
  1329 + map1.put("8","食谱推荐");
1315 1330  
1316 1331  
1317 1332 map2.put("1", PloodPressureGuideCategoryTypeEnum.HELIYUNDONG.getId());
... ... @@ -1319,6 +1334,9 @@
1319 1334 map2.put("3",PloodPressureGuideCategoryTypeEnum.XINLIZHIDAO.getId());
1320 1335 map2.put("4",PloodPressureGuideCategoryTypeEnum.ZIWOJIANCE.getId());
1321 1336 map2.put("5",PloodPressureGuideCategoryTypeEnum.YONGYAOZHIDAO.getId());
  1337 + map2.put("6", PloodPressureGuideCategoryTypeEnum.YINSHIYUANZE.getId());
  1338 + map2.put("7", PloodPressureGuideCategoryTypeEnum.SHANSHIZHIDAO.getId());
  1339 + map2.put("8", PloodPressureGuideCategoryTypeEnum.SHIPUTUIJIAN.getId());
1322 1340 }
1323 1341  
1324 1342 private static class KeyWord extends BaseModel{
... ... @@ -1349,7 +1367,13 @@
1349 1367  
1350 1368  
1351 1369 //早产儿体重百分位数值表(男、女)
1352   - public static void zcet(String fileName)
  1370 +
  1371 + /**
  1372 + *
  1373 + * @param fileName
  1374 + * @param falg 读取的是否是合理运动类型
  1375 + */
  1376 + public static void zcet(String fileName,boolean falg)
1353 1377 {
1354 1378 File file = new File(fileName);
1355 1379 Workbook wb = null;
... ... @@ -1365,6 +1389,9 @@
1365 1389 Sheet s1 = wb.getSheet(j1);
1366 1390 String type =map.get(s1.getName());
1367 1391 System.out.println("sheet name -->>> type :"+map.get(s1.getName()));
  1392 + if(null==type){
  1393 + return;
  1394 + }
1368 1395 int rows1 = s1.getRows();
1369 1396 if(rows1 > 0){
1370 1397 //遍历每行
... ... @@ -1374,9 +1401,6 @@
1374 1401 //遍历每行中的每列
1375 1402 for (int j = 1 ; j < cells.length ; j ++)
1376 1403 {
1377   - PloodPressureGuideModel bpModel=new PloodPressureGuideModel();
1378   - bpModel.setYn(YnEnums.YES.getId());
1379   - bpModel.setType(type);
1380 1404 String week = cells[0].getContents().trim();
1381 1405 String content = cells[j].getContents().trim();
1382 1406 if (!com.lyms.platform.common.utils.StringUtils.isNotEmpty(content))
... ... @@ -1385,7 +1409,16 @@
1385 1409 }
1386 1410 if(i>0){
1387 1411  
1388   - KeyWord keyWord = new KeyWord(week+"_"+j+"_"+type,content);
  1412 + KeyWord keyWord = null;
  1413 + if(falg){
  1414 + keyWord= new KeyWord(week+"_"+j+"_"+type,content);
  1415 + }else {
  1416 + if("3".equals(type)){
  1417 + keyWord= new KeyWord(week+"_"+map3.get(s1.getName())+"_"+type+j,content);
  1418 + }else {
  1419 + keyWord= new KeyWord(week+"_"+map3.get(s1.getName())+"_"+type,content);
  1420 + }
  1421 + }
1389 1422 // System.out.println("keyWord :" +keyWord);
1390 1423  
1391 1424 convertToBean(keyWord,mongoTemplate);
... ... @@ -1428,7 +1461,8 @@
1428 1461 // weightFood("F:\\体重与营养管理\\体重与营养管理第三版(北方)改标红“、冰淇淋”-晓萌.xls");
1429 1462 // bloodSugar("F:\\血糖报告\\血糖报告\\血糖报告基础数据格式(2).xls");
1430 1463  
1431   - zcet("D:\\doc\\高血压报告20180813模板.xls");
  1464 +// zcet("D:\\doc\\高血压报告20180813模板.xls");
  1465 + zcet("D:\\doc\\1.xls",false);
1432 1466  
1433 1467  
1434 1468 /* ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:/spring/applicationContext_biz_patient1.xml");
platform-common/src/main/java/com/lyms/platform/common/enums/PloodPressureGuideCategoryTypeEnum.java View file @ 09e298b
... ... @@ -25,7 +25,13 @@
25 25 // 自我监测
26 26 ZIWOJIANCE(4),
27 27 //用药指导
28   - YONGYAOZHIDAO(5);
  28 + YONGYAOZHIDAO(5),
  29 + //饮食原则
  30 + YINSHIYUANZE(6),
  31 + //膳食指导
  32 + SHANSHIZHIDAO(7),
  33 + //食谱推荐
  34 + SHIPUTUIJIAN(8);
29 35  
30 36 private PloodPressureGuideCategoryTypeEnum(Integer id) {
31 37 this.id = id;
platform-dal/src/main/java/com/lyms/platform/query/PloodPressureGuideQuery.java View file @ 09e298b
... ... @@ -6,6 +6,8 @@
6 6 import com.lyms.platform.common.dao.operator.MongoOper;
7 7 import com.lyms.platform.common.dao.operator.MongoQuery;
8 8  
  9 +import java.util.List;
  10 +
9 11 /**
10 12 * Created by Administrator on 2017/1/13 0013.
11 13 */
12 14  
13 15  
... ... @@ -13,10 +15,31 @@
13 15 private String pid;
14 16 private Integer yn;
15 17 private String type;
  18 + private List<String> typeList;
  19 +
16 20 private Integer week;
17 21 private Integer categoryType;
18 22  
  23 + public String getType() {
  24 + return type;
  25 + }
19 26  
  27 + public List<String> getTypeList() {
  28 + return typeList;
  29 + }
  30 +
  31 + public void setTypeList(List<String> typeList) {
  32 + this.typeList = typeList;
  33 + }
  34 +
  35 + public Integer getWeek() {
  36 + return week;
  37 + }
  38 +
  39 + public Integer getCategoryType() {
  40 + return categoryType;
  41 + }
  42 +
20 43 public void setCategoryType(Integer categoryType) {
21 44 this.categoryType = categoryType;
22 45 }
... ... @@ -39,6 +62,9 @@
39 62 }
40 63 if(null!=type){
41 64 condition=condition.and("type", type, MongoOper.IS);
  65 + }
  66 + if(null!=typeList){
  67 + condition=condition.and("type", typeList, MongoOper.IN);
42 68 }
43 69 if(null!=week){
44 70 condition=condition.and("week", week, MongoOper.IS);
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BpReportFacade.java View file @ 09e298b
... ... @@ -50,9 +50,10 @@
50 50  
51 51 /**
52 52 * 获取未读的消息信息
  53 + *
53 54 * @return
54 55 */
55   - public BaseResponse checkUnReadReport(String pid){
  56 + public BaseResponse checkUnReadReport(String pid) {
56 57 BpReportQuery reportQuery = new BpReportQuery();
57 58 reportQuery.setYn(YnEnums.YES.getId());
58 59 reportQuery.setPid(pid);
... ... @@ -60,8 +61,8 @@
60 61 List<BpReportModel> DATA = bpReportService.queryBpReport(reportQuery);
61 62 //查询最近一个生成的没看的记录
62 63 Map map = new HashMap<>();
63   - if(CollectionUtils.isNotEmpty(DATA)){
64   - BpReportModel bpReport= DATA.get(DATA.size() - 1);
  64 + if (CollectionUtils.isNotEmpty(DATA)) {
  65 + BpReportModel bpReport = DATA.get(DATA.size() - 1);
65 66 map.put("id", bpReport.getId());
66 67 map.put("title", bpReport.getTitle());
67 68 map.put("create", DateUtil.getyyyy_MM_dd(bpReport.getCreated()));
... ... @@ -97,6 +98,53 @@
97 98 return new BaseListResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(data);
98 99 }
99 100  
  101 + //查询食谱推荐
  102 + private void querydiet(Map data) {
  103 + PloodPressureGuideQuery pressureGuideQuery = new PloodPressureGuideQuery();
  104 + pressureGuideQuery.setYn(YnEnums.YES.getId());
  105 + pressureGuideQuery.setCategoryType(8);
  106 + List<PloodPressureGuideModel> guideModelList = pressureGuideService.queryPloodPressureGuides(pressureGuideQuery);
  107 + Map<String, Object> dietModelData = new HashMap<>();
  108 + if (CollectionUtils.isNotEmpty(guideModelList)) {
  109 + for (PloodPressureGuideModel model : guideModelList) {
  110 + switch (model.getType()) {
  111 + case "31":
  112 + dietModelData.put("breakfast", model.getContent());
  113 + break;
  114 + case "32":
  115 + dietModelData.put("lunch", model.getContent());
  116 + break;
  117 + case "33":
  118 + dietModelData.put("dinner", model.getContent());
  119 + break;
  120 + case "34":
  121 + dietModelData.put("dinnerAdd", model.getContent());
  122 + break;
  123 + case "35":
  124 + dietModelData.put("fullday", model.getContent());
  125 + break;
  126 + case "36":
  127 + dietModelData.put("suggests", model.getContent());
  128 + break;
  129 + }
  130 + }
  131 + }
  132 +// 'categoryType':8
  133 + /* private String breakfast;//早餐
  134 + private String breakfastAdd;//上午加餐
  135 + private String lunch;//午餐
  136 + private String lunchAdd;//下午加餐
  137 + private String dinner;//晚餐
  138 + private String dinnerAdd;//晚加餐*/
  139 +// Map<String,Object> dietModelData = new HashMap<>();
  140 + /* dietModelData.put("breakfast",dietModel.getBreakfast());
  141 + dietModelData.put("lunch",dietModel.getLunch());
  142 + dietModelData.put("dinner",dietModel.getDinner());
  143 + dietModelData.put("dinnerAdd",dietModel.getDinnerAdd());
  144 + dietModelData.put("suggests", dietModel.getSuggests());*/
  145 + data.put("dietModelDataData", dietModelData);
  146 + }
  147 +
100 148 /**
101 149 * 根据reportid查看某次报告的详细数据
102 150 *
103 151  
104 152  
105 153  
... ... @@ -106,18 +154,34 @@
106 154 * @return
107 155 */
108 156 public BaseResponse lookReportDetailById(String reportId, String week, String type) {
109   -
  157 + int week1 = NumberUtils.toInt(week, 0);
110 158 PloodPressureGuideQuery pressureGuideQuery = new PloodPressureGuideQuery();
111 159 pressureGuideQuery.setYn(YnEnums.YES.getId());
112 160 pressureGuideQuery.setType(type);
113   - pressureGuideQuery.setWeek(NumberUtils.toInt(week, 0));
  161 + pressureGuideQuery.setWeek(week1);
114 162  
115 163 BpReportModel bpReport = bpReportService.findById(reportId);
116 164 List<PloodPressureGuideModel> guideModelList = pressureGuideService.queryPloodPressureGuides(pressureGuideQuery);
117 165  
  166 + //膳食构成只按孕周
  167 + pressureGuideQuery.setType(null);
  168 + pressureGuideQuery.setCategoryType(7);
  169 +
  170 + List<PloodPressureGuideModel> guideModelList1 = pressureGuideService.queryPloodPressureGuides(pressureGuideQuery);
  171 +
  172 +
  173 + //饮食原则需要按孕周和检查结果来
  174 + pressureGuideQuery.setType("00".equals(type)?"0":"1");
  175 + pressureGuideQuery.setCategoryType(6);
  176 +
  177 + List<PloodPressureGuideModel> guideModelList2 = pressureGuideService.queryPloodPressureGuides(pressureGuideQuery);
118 178 Map data = new HashMap();
119 179  
120 180 if (null != bpReport) {
  181 +
  182 + pressureGuideQuery.setYn(YnEnums.YES.getId());
  183 + pressureGuideQuery.setType(null);
  184 +
121 185 //修改为已读状态
122 186 bpReport.setStatus(1);
123 187  
124 188  
... ... @@ -152,7 +216,14 @@
152 216 data.put("guide", bpReport.getGuide());
153 217  
154 218 data.put("guideData", convertToResponse(guideModelList));
  219 + //膳食构成
  220 + data.put("dietaryPattern", convertToResponse(guideModelList1));
  221 + //饮食原则
  222 + data.put("DietaryPrinciples", convertToResponse(guideModelList2));
155 223  
  224 + //添加食谱推荐部分
  225 + querydiet(data);
  226 +
156 227 }
157 228  
158 229 return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(data);
... ... @@ -166,6 +237,7 @@
166 237 map.put("categoryType", guideModel.getCategoryType());
167 238 map.put("content", guideModel.getContent());
168 239 map.put("order", guideModel.getOrder());
  240 + map.put("type", guideModel.getType());
169 241 list.add(map);
170 242 }
171 243 return list;