Commit 8e3331d770055b541619f59d58c2ad90f44fa623

Authored by jiangjiazhi

Merge remote-tracking branch 'origin/master'

Showing 3 changed files

platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ViewFacade.java View file @ 8e3331d
... ... @@ -14,6 +14,7 @@
14 14 import com.lyms.platform.permission.service.OrganizationService;
15 15 import com.lyms.platform.permission.service.UsersService;
16 16 import com.lyms.platform.pojo.*;
  17 +import com.lyms.platform.query.BabyModelQuery;
17 18 import com.lyms.platform.query.DischargeAbstractBabyQuery;
18 19 import org.apache.commons.collections.CollectionUtils;
19 20 import org.apache.commons.collections.MapUtils;
... ... @@ -51,6 +52,8 @@
51 52 private DischargeAbstractMotherService dischargeAbstractMotherService;
52 53 @Autowired
53 54 private DischargeAbstractBabyService dischargeAbstractBabyService;
  55 + @Autowired
  56 + private BabyService babyService;
54 57  
55 58  
56 59 public BaseObjectResponse findPatientData(String id) {
... ... @@ -192,7 +195,6 @@
192 195 map.put("dueDate",DateUtil.getyyyy_MM_dd(patients.getDueDate()));
193 196 map.put("mremark",patients.getMremark());
194 197  
195   - //TODO 高危需要处理,高危因素名称+颜色+高危评分
196 198 HighScoreResult highScoreResult = null;
197 199 if (StringUtils.isNotEmpty(data.getHighrisk())){
198 200 List<String> ids = JsonUtil.toList(data.getHighrisk(), String.class);
199 201  
200 202  
201 203  
... ... @@ -200,14 +202,40 @@
200 202 highScoreResult = ResolveUtils.queryRisk(ids, true, basicConfigService);
201 203 }
202 204 }
203   - map.put("highRisk",highScoreResult);
  205 + Integer score = 0;
  206 + if (highScoreResult.getScore()!=null){
  207 + score = highScoreResult.getScore();
  208 + }
204 209  
205   - Map<String,Object> otherRisk = new HashMap<>();
206   - if (StringUtils.isNotEmpty(data.getOtherHighRisk())){
  210 + List<Map<String, Object>> list = ResolveUtils.queryHighRisk(highScoreResult);
  211 +
  212 + Map<String,Object> otherRisk = null;
  213 + if (StringUtils.isNotEmpty(data.getOtherHighRisk()) && !"{}".equals(data.getOtherHighRisk())){
  214 + otherRisk = new HashMap<>();
207 215 ResolveUtils.queryOtherRisk(data.getOtherHighRisk(),otherRisk,basicConfigService);
208 216 }
209   - map.put("otherHighRisk",otherRisk);
210 217  
  218 + Map<String,Object> otherMap = new HashMap<>();
  219 +
  220 + if (otherRisk!=null){
  221 + if (otherRisk.get("name")!=null){
  222 + otherMap.put("name",otherRisk.get("name"));
  223 + }
  224 + if (otherRisk.get("color")!=null){
  225 + otherMap.put("color",otherRisk.get("color"));
  226 + }
  227 + if (otherRisk.get("score")!=null){
  228 + String s = (String)otherRisk.get("score");
  229 + if (FunvCommonUtil.isNumeric(s)){
  230 + score = score + Integer.parseInt(s);
  231 + }
  232 + }
  233 + list.add(otherMap);
  234 + }
  235 +
  236 + map.put("score",score);
  237 + map.put("highRisk",list);
  238 +
211 239 //产检基本信息
212 240 map.put("checkDate",DateUtil.getyyyy_MM_dd(data.getCheckTime()));
213 241 //TODO 产检孕周
... ... @@ -425,7 +453,7 @@
425 453 }
426 454  
427 455 map.put("ydfmw",ydfmw);
428   - map.put("ydqjd",ydqjd);
  456 + map.put("ydqjd",FunvCommonUtil.getBaseicConfigByid(ydqjd,basicConfigService));
429 457 map.put("bChao",data.getbChao());
430 458  
431 459  
432 460  
... ... @@ -495,12 +523,11 @@
495 523 map.put("id",data.getId());
496 524 map.put("username",patients.getUsername());
497 525 map.put("birth",DateUtil.getyyyy_MM_dd(patients.getBirth()));
498   - map.put("age",DateUtil.getAge(patients.getBirth()));
  526 + map.put("age",UnitUtils.unitSplice(DateUtil.getAge(patients.getBirth()),UnitConstants.SUI));
499 527 map.put("phone",patients.getPhone());
500 528 map.put("fmWeek",patients.getFmWeek());
501 529 map.put("dueDate",DateUtil.getyyyy_MM_dd(patients.getDueDate()));
502 530 map.put("mremark",patients.getMremark());
503   - //TODO 高危需要处理,高危因素名称+颜色+高危评分
504 531 HighScoreResult highScoreResult = null;
505 532 if (StringUtils.isNotEmpty(data.getRiskFactor())){
506 533 List<String> ids = JsonUtil.toList(data.getRiskFactor(), String.class);
... ... @@ -511,7 +538,7 @@
511 538 map.put("highRisk",highScoreResult);
512 539  
513 540 Map<String,Object> otherRisk = new HashMap<>();
514   - if (StringUtils.isNotEmpty(data.getOtherRisk())){
  541 + if (StringUtils.isNotEmpty(data.getOtherRisk()) && !"{}".equals(data.getOtherRisk())){
515 542 ResolveUtils.queryOtherRisk(data.getOtherRisk(),otherRisk,basicConfigService);
516 543 }
517 544 map.put("otherHighRisk",otherRisk);
... ... @@ -1110,7 +1137,6 @@
1110 1137 return br;
1111 1138 }
1112 1139  
1113   -
1114 1140 DischargeAbstractMotherModel data = dischargeAbstractMotherService.findOneById(id);
1115 1141 if (data==null){
1116 1142 br.setErrorcode(ErrorCodeConstants.NO_DATA);
... ... @@ -1150,7 +1176,14 @@
1150 1176 map.put("riskScore",UnitUtils.unitSplice(patients.getRiskScore(),UnitConstants.FEN));
1151 1177 map.put("leaveHospitalDate", DateUtil.getyyyy_MM_dd(data.getLeaveHospitalDate()));
1152 1178 map.put("afterMakeBabyDays", data.getAfterMakeBabyDays()==null?"":"产后"+data.getAfterMakeBabyDays()+"天");
1153   - map.put("inputMan",data.getInputMan());
  1179 + String inputMan = "";
  1180 + if (StringUtils.isNotEmpty(data.getInputMan()) && FunvCommonUtil.isNumeric(data.getInputMan())){
  1181 + Users users = usersService.getUsers(Integer.parseInt(data.getInputMan()));
  1182 + if (users!=null && users.getYn()==YnEnums.YES.getId()){
  1183 + inputMan = users.getName();
  1184 + }
  1185 + }
  1186 + map.put("inputMan",inputMan);
1154 1187 /* 出院信息 */
1155 1188 map.put("description",data.getDescription());
1156 1189  
... ... @@ -1161,6 +1194,18 @@
1161 1194 List<DischargeAbstractBabyModel> babyModelList = dischargeAbstractBabyService.query(babyQuery);
1162 1195 if (CollectionUtils.isNotEmpty(babyModelList)){
1163 1196 for (DischargeAbstractBabyModel temp : babyModelList){
  1197 + if (temp.getpId()==null){
  1198 + continue;
  1199 + }
  1200 + BabyModelQuery babyModelQuery = new BabyModelQuery();
  1201 + babyModelQuery.setYn(YnEnums.YES.getId());
  1202 + babyModelQuery.setPid(temp.getpId());
  1203 + babyModelQuery.setPregnancyOut(RenShenJieJuEnums.O.getId());
  1204 + List<BabyModel> babyModels = babyService.queryBabyWithQuery(babyModelQuery);
  1205 + if (CollectionUtils.isEmpty(babyModels)){
  1206 + continue;
  1207 + }
  1208 +
1164 1209 Map<String,Object> babyMap = new HashMap<>();
1165 1210 babyMap.put("description",temp.getDescription());
1166 1211 babyMap.put("birthCertificateId",temp.getBirthCertificateId());
... ... @@ -1191,7 +1236,6 @@
1191 1236 }
1192 1237 }
1193 1238 map.put("babys",babys);
1194   -
1195 1239 br.setErrorcode(ErrorCodeConstants.SUCCESS);
1196 1240 br.setErrormsg("成功");
1197 1241 br.setData(map);
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/FunvCommonUtil.java View file @ 8e3331d
... ... @@ -12,6 +12,8 @@
12 12 import org.apache.commons.lang.math.NumberUtils;
13 13  
14 14 import java.util.*;
  15 +import java.util.regex.Matcher;
  16 +import java.util.regex.Pattern;
15 17  
16 18 /**
17 19 * 妇女模块公共方法
... ... @@ -111,6 +113,21 @@
111 113 }
112 114 return "";
113 115 }
  116 +
  117 + /**
  118 + * 判断是否为数字
  119 + * @param str
  120 + * @return
  121 + */
  122 + public static boolean isNumeric(String str){
  123 + Pattern pattern = Pattern.compile("[0-9]*");
  124 + Matcher isNum = pattern.matcher(str);
  125 + if( !isNum.matches() ){
  126 + return false;
  127 + }
  128 + return true;
  129 + }
  130 +
114 131  
115 132 /**
116 133 * 获取生日(****年**月**日)
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/ResolveUtils.java View file @ 8e3331d
... ... @@ -245,6 +245,36 @@
245 245 return map;
246 246 }
247 247  
  248 + public static List<Map<String,Object>> queryHighRisk(HighScoreResult result){
  249 +
  250 + if (result==null){
  251 + return null;
  252 + }
  253 +
  254 + List<Map<String,Object>> mapList = new ArrayList<>();
  255 +
  256 + if (CollectionUtils.isNotEmpty(result.getHighRisk())){
  257 + List<Map> list = (List<Map>)result.getHighRisk();
  258 + if (CollectionUtils.isNotEmpty(list)){
  259 + for (Map m : list){
  260 +
  261 + Map<String,Object> map = new HashMap<>();
  262 +
  263 + if (m.get("name")!=null){
  264 + map.put("name",m.get("name"));
  265 + }
  266 + if (m.get("color")!=null){
  267 + map.put("color",m.get("color"));
  268 + }
  269 +
  270 + mapList.add(map);
  271 + }
  272 + }
  273 + }
  274 + return mapList;
  275 + }
  276 +
  277 +
248 278  
249 279  
250 280 public static void main(String[] str) {