Commit d64999cf85fb3ed959426d2a3c552f6029aa617a

Authored by wangbo
1 parent 2be9e6d2fa

儿童膳食报告bug修改

Showing 1 changed file with 71 additions and 70 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyNutritionFacade.java View file @ d64999c
... ... @@ -282,11 +282,11 @@
282 282  
283 283 private Map getMapData(BabyNutritionModel model, Integer currentSettleStatus) {
284 284 Map map = new HashMap();
285   - map.put("id",model.getId());
286   - map.put("babyId",model.getBabyId());
  285 + map.put("id", model.getId());
  286 + map.put("babyId", model.getBabyId());
287 287  
288 288 BabyModel baby = babyBookbuildingService.queryBabyBuildById(model.getBabyId());
289   - map.put("babyName",baby.getName());
  289 + map.put("babyName", baby.getName());
290 290 map.put("babySex", SexEnum.getTextById(baby.getSex()));
291 291 map.put("monthAge", StringUtils.emptyDeal(DateUtil.getBabyMonthAge(baby.getBirth(), new Date())));
292 292 map.put("motherName", baby.getMname());
... ... @@ -294,7 +294,7 @@
294 294 map.put("vcCardNo", baby.getVcCardNo());
295 295  
296 296 String highRiskInfos = basicConfigFacade.queryBaseInfoByStr(baby.getHighRiskInfo());
297   - map.put("highRiskInfos",highRiskInfos);
  297 + map.put("highRiskInfos", highRiskInfos);
298 298  
299 299 String diagnose = "";
300 300 if (StringUtils.isNotEmpty(baby.getPid())) {
301 301  
302 302  
... ... @@ -318,14 +318,14 @@
318 318 // 新增报表解读人和结算状态
319 319 String currInterpretDoctorId = model.getInterpretDoctorId();
320 320 String interpretDoctorName = "";
321   - if (StringUtils.isNotEmpty(currInterpretDoctorId)){
  321 + if (StringUtils.isNotEmpty(currInterpretDoctorId)) {
322 322 Users users = usersService.getUsers(Integer.parseInt(currInterpretDoctorId));
323   - if (users != null){
  323 + if (users != null) {
324 324 interpretDoctorName = users.getName();
325 325 }
326 326 }
327 327 String settleStatusName = "";
328   - if (currentSettleStatus != null){
  328 + if (currentSettleStatus != null) {
329 329 settleStatusName = currentSettleStatus == 1 ? "未结算" : "已结算";
330 330 }
331 331 map.put("interpretDoctorName", interpretDoctorName);
... ... @@ -919,7 +919,7 @@
919 919 */
920 920 public BaseResponse unSettleList(BabyNutritionSettleRequest request, Integer userId) {
921 921  
922   - HealthChargeQuery healthChargeQuery = new HealthChargeQuery();
  922 + HealthChargeQuery healthChargeQuery = new HealthChargeQuery();
923 923 healthChargeQuery.setPage(request.getPage());
924 924 healthChargeQuery.setLimit(request.getLimit());
925 925 healthChargeQuery.setNeed("true");
926 926  
927 927  
928 928  
929 929  
930 930  
931 931  
932 932  
933 933  
934 934  
... ... @@ -931,43 +931,44 @@
931 931 Date startDate = areaCountFacade.getStartDate();
932 932 healthChargeQuery.setCreatedStart(startDate);
933 933 healthChargeQuery.setCreatedEnd(new Date());
934   - if (request.getStartTime() != null){
  934 + if (request.getStartTime() != null) {
935 935 healthChargeQuery.setCreatedStart(request.getStartTime());
936 936 healthChargeQuery.setCreatedEnd(request.getEndTime());
937 937 }
938 938 String findNo = request.getNumber();
939 939 String keyword = request.getKeyword();
940   - List<String> arrayList = new ArrayList<String>() {};
  940 + List<String> arrayList = new ArrayList<String>() {
  941 + };
941 942 BaseListResponse objectResponse = new BaseListResponse();
942 943  
943   - if (StringUtils.isNotEmpty(findNo) && StringUtils.isNotEmpty(keyword)){
  944 + if (StringUtils.isNotEmpty(findNo) && StringUtils.isNotEmpty(keyword)) {
944 945 List<BabyModel> babyModels = getBabyModels(findNo, null);
945   - if (CollectionUtils.isNotEmpty(babyModels)){
946   - for (BabyModel model: babyModels){
  946 + if (CollectionUtils.isNotEmpty(babyModels)) {
  947 + for (BabyModel model : babyModels) {
947 948 String name = model.getName();
948   - if (name.contains(keyword)){
  949 + if (name.contains(keyword)) {
949 950 String modelId = model.getId();
950 951 arrayList.add(modelId);
951 952 }
952 953 }
953 954 }
954   - }else if (StringUtils.isNotEmpty(findNo)){
  955 + } else if (StringUtils.isNotEmpty(findNo)) {
955 956 List<BabyModel> babyModels = getBabyModels(findNo, null);
956   - if (CollectionUtils.isNotEmpty(babyModels)){
957   - for (BabyModel model: babyModels){
  957 + if (CollectionUtils.isNotEmpty(babyModels)) {
  958 + for (BabyModel model : babyModels) {
958 959 String modelId = model.getId();
959 960 arrayList.add(modelId);
960 961 }
961 962 }
962   - }else if (StringUtils.isNotEmpty(keyword)){
  963 + } else if (StringUtils.isNotEmpty(keyword)) {
963 964 List<BabyModel> babyModels = mongoTemplate.find(Query.query(Criteria.where("name").regex(keyword)), BabyModel.class);
964   - if (CollectionUtils.isNotEmpty(babyModels)){
965   - for (BabyModel babyModel : babyModels){
  965 + if (CollectionUtils.isNotEmpty(babyModels)) {
  966 + for (BabyModel babyModel : babyModels) {
966 967 arrayList.add(babyModel.getId());
967 968 }
968 969 }
969 970 }
970   - if (arrayList.size() > 0){
  971 + if (arrayList.size() > 0) {
971 972 healthChargeQuery.setIds(arrayList);
972 973 }
973 974 List<LinkedHashMap<String, Object>> healthChargeModels = getHealthChargeModels(healthChargeQuery);
... ... @@ -988,7 +989,7 @@
988 989 private List<LinkedHashMap<String, Object>> getHealthChargeModels(HealthChargeQuery healthChargeQuery) {
989 990 List<LinkedHashMap<String, Object>> list = new LinkedList<>();
990 991 List<HealthChargeModel> healthChargeModels = healthChargeService.queryHealthChargeList(healthChargeQuery);
991   - for (HealthChargeModel healthChargeModel : healthChargeModels){
  992 + for (HealthChargeModel healthChargeModel : healthChargeModels) {
992 993  
993 994 String foreignId = healthChargeModel.getBabyForeignId();
994 995 BabyModel mongoTemplateOne = mongoTemplate.findOne(Query.query(Criteria.where("id").is(foreignId)), BabyModel.class);
995 996  
996 997  
... ... @@ -997,16 +998,16 @@
997 998  
998 999 String babyNutritionId = healthChargeModel.getBabyNutritionId();
999 1000 Date createTime = null;
1000   - if (babyNutritionId != null){
  1001 + if (babyNutritionId != null) {
1001 1002 BabyNutritionModel nutritionModel = mongoTemplate.findOne(Query.query(Criteria.where("id").is(babyNutritionId)), BabyNutritionModel.class);
1002 1003 createTime = nutritionModel.getCreated();
1003 1004  
1004 1005 }
1005 1006 String doctorId = healthChargeModel.getDoctorId();
1006 1007 String doctorName = "";
1007   - if (doctorId != null){
  1008 + if (doctorId != null) {
1008 1009 Users users = mongoTemplate.findOne(Query.query(Criteria.where("id")), Users.class);
1009   - if (users != null){
  1010 + if (users != null) {
1010 1011 doctorName = users.getName();
1011 1012 }
1012 1013 }
... ... @@ -1040,7 +1041,7 @@
1040 1041 BabyModelQuery babyQuery = new BabyModelQuery();
1041 1042 babyQuery.setQueryNo(findNo);
1042 1043 babyQuery.setYn(YnEnums.YES.getId());
1043   - if (babyForeignId != null){
  1044 + if (babyForeignId != null) {
1044 1045 babyQuery.setId(babyForeignId);
1045 1046 }
1046 1047 return babyBookbuildingService.queryBabyBuildByCond(babyQuery);
1047 1048  
... ... @@ -1055,14 +1056,14 @@
1055 1056 * @return
1056 1057 */
1057 1058 public BaseResponse settleStatus(BabyNutritionSettleRequest request, Integer userId) {
1058   - HealthChargeQuery healthChargeQuery = new HealthChargeQuery();
  1059 + HealthChargeQuery healthChargeQuery = new HealthChargeQuery();
1059 1060 healthChargeQuery.setHealthType(5);
1060 1061 healthChargeQuery.setYn(YnEnums.YES.getId());
1061 1062 healthChargeQuery.setHospitalId(request.getHospitalId());
1062 1063 healthChargeQuery.setStatus(1);
1063 1064 Date startTime = request.getStartTime();
1064 1065 Date endTime = request.getEndTime();
1065   - if (startTime == null || endTime == null){
  1066 + if (startTime == null || endTime == null) {
1066 1067 return new BaseResponse("请填写起始时间", ErrorCodeConstants.PARAMETER_ERROR);
1067 1068 }
1068 1069 healthChargeQuery.setCreatedStart(startTime);
... ... @@ -1085,7 +1086,7 @@
1085 1086 HealthChargeModel model = new HealthChargeModel();
1086 1087 model.setChargeRecordId(recordModel.getId());
1087 1088 model.setStatus(2);
1088   - healthChargeService.updateHealthCharges(healthChargeQuery,model);
  1089 + healthChargeService.updateHealthCharges(healthChargeQuery, model);
1089 1090  
1090 1091 return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
1091 1092 }
... ... @@ -1099,7 +1100,7 @@
1099 1100 */
1100 1101 public BaseResponse settleHistoryList(BabyNutritionSettleRequest request, Integer userId) {
1101 1102 List<Map> listData = new ArrayList<>();
1102   - ChargeRecordQuery chargeRecordQuery = new ChargeRecordQuery();
  1103 + ChargeRecordQuery chargeRecordQuery = new ChargeRecordQuery();
1103 1104 chargeRecordQuery.setHealthType(5);
1104 1105 chargeRecordQuery.setHospitalId(request.getHospitalId());
1105 1106 chargeRecordQuery.setOperateUserId(userId.toString());
1106 1107  
1107 1108  
1108 1109  
1109 1110  
1110 1111  
... ... @@ -1108,28 +1109,28 @@
1108 1109 chargeRecordQuery.setNeed("true");
1109 1110 Date startTime = request.getStartTime();
1110 1111 Date endTime = request.getEndTime();
1111   - if (startTime == null || endTime == null){
  1112 + if (startTime == null || endTime == null) {
1112 1113 startTime = areaCountFacade.getStartDate();
1113 1114 endTime = new Date();
1114 1115 }
1115 1116 chargeRecordQuery.setCreatedStart(startTime);
1116 1117 chargeRecordQuery.setCreatedEnd(endTime);
1117 1118  
1118   - List<ChargeRecordModel> list = chargeRecordService.queryChargeRecordList(chargeRecordQuery);
  1119 + List<ChargeRecordModel> list = chargeRecordService.queryChargeRecordList(chargeRecordQuery);
1119 1120 if (CollectionUtils.isNotEmpty(list)) {
1120   - for (ChargeRecordModel model : list){
  1121 + for (ChargeRecordModel model : list) {
1121 1122 Map map = new LinkedHashMap();
1122   - map.put("id",model.getId());
1123   - map.put("startDate",DateUtil.getyyyy_MM_dd(model.getStartDate()));
1124   - map.put("endDate",DateUtil.getyyyy_MM_dd(model.getEndDate()));
1125   - map.put("chargeCount",model.getChargeCount());
  1123 + map.put("id", model.getId());
  1124 + map.put("startDate", DateUtil.getyyyy_MM_dd(model.getStartDate()));
  1125 + map.put("endDate", DateUtil.getyyyy_MM_dd(model.getEndDate()));
  1126 + map.put("chargeCount", model.getChargeCount());
1126 1127 Users users = usersService.getUsers(Integer.parseInt(model.getOperateUserId()));
1127 1128 String doctorName = "";
1128   - if (users != null){
  1129 + if (users != null) {
1129 1130 doctorName = users.getName();
1130 1131 }
1131   - map.put("doctorName",doctorName);
1132   - map.put("created",DateUtil.getyyyy_MM_dd(model.getCreated()));
  1132 + map.put("doctorName", doctorName);
  1133 + map.put("created", DateUtil.getyyyy_MM_dd(model.getCreated()));
1133 1134 listData.add(map);
1134 1135 }
1135 1136 }
1136 1137  
1137 1138  
1138 1139  
1139 1140  
... ... @@ -1146,31 +1147,31 @@
1146 1147 try {
1147 1148 LinkedList<Map<String, Object>> objects = new LinkedList<>();
1148 1149 String recordId = request.getKeyword();
1149   - if (StringUtils.isNotEmpty(recordId)){
  1150 + if (StringUtils.isNotEmpty(recordId)) {
1150 1151 return;
1151 1152 }
1152   - ChargeRecordQuery chargeRecordQuery = new ChargeRecordQuery();
  1153 + ChargeRecordQuery chargeRecordQuery = new ChargeRecordQuery();
1153 1154 chargeRecordQuery.setId(recordId);
1154 1155  
1155 1156 ChargeRecordModel chargeRecordModel = mongoTemplate.findOne(Query.query(Criteria.where("id").is(recordId)), ChargeRecordModel.class);
1156 1157 String date = "";
1157   - if (chargeRecordModel != null){
  1158 + if (chargeRecordModel != null) {
1158 1159 date = DateUtil.getyyyy_MM_dd(chargeRecordModel.getCreated());
1159 1160 }
1160 1161  
1161 1162 List<HealthChargeModel> healthChargeModels = mongoTemplate.find(Query.query(Criteria.where("chargeRecordId").is(recordId)), HealthChargeModel.class);
1162   - if (CollectionUtils.isNotEmpty(healthChargeModels)){
1163   - for (HealthChargeModel model: healthChargeModels){
  1163 + if (CollectionUtils.isNotEmpty(healthChargeModels)) {
  1164 + for (HealthChargeModel model : healthChargeModels) {
1164 1165 Map<String, Object> map = new LinkedHashMap<>();
1165 1166 BabyModel babyModel = mongoTemplate.findOne(Query.query(Criteria.where("id").is(model.getBabyForeignId())), BabyModel.class);
1166 1167 map.put("userName", babyModel.getName());
1167 1168 String birthStr = DateUtil.getyyyy_MM_dd(babyModel.getBirth());
1168 1169 map.put("age", getAge(birthStr));
1169 1170 // 新国说的,以下几个写死 2019/05/28
1170   - map.put("week","");
1171   - map.put("type","儿童膳食报告");
1172   - map.put("status","已结算");
1173   - map.put("source","院内");
  1171 + map.put("week", "");
  1172 + map.put("type", "儿童膳食报告");
  1173 + map.put("status", "已结算");
  1174 + map.put("source", "院内");
1174 1175 map.put("time", date);
1175 1176 objects.add(map);
1176 1177 }
... ... @@ -1188,7 +1189,7 @@
1188 1189 response.setCharacterEncoding("UTF-8");
1189 1190 response.setHeader("Content-Disposition", "attachment;fileName=data.xls");
1190 1191 ExcelUtil.toExcel(out, objects, cnames);
1191   - }catch (Exception e){
  1192 + } catch (Exception e) {
1192 1193 e.printStackTrace();
1193 1194 }
1194 1195 }
1195 1196  
1196 1197  
1197 1198  
1198 1199  
1199 1200  
1200 1201  
1201 1202  
1202 1203  
1203 1204  
1204 1205  
... ... @@ -1199,49 +1200,49 @@
1199 1200 * @param date
1200 1201 * @return
1201 1202 */
1202   - public static String getAge(String date) {
  1203 + public static String getAge(String date) {
1203 1204 String[] data = date.split("-");
1204   - if (data.length <3){
  1205 + if (data.length < 3) {
1205 1206 return "";
1206 1207 }
1207 1208  
1208   - Calendar birthday =new GregorianCalendar(Integer.valueOf(data[0]), Integer.valueOf(data[1]), Integer.valueOf(data[2]));
  1209 + Calendar birthday = new GregorianCalendar(Integer.valueOf(data[0]), Integer.valueOf(data[1]), Integer.valueOf(data[2]));
1209 1210 Calendar now = Calendar.getInstance();
1210 1211 int day = now.get(Calendar.DAY_OF_MONTH) - birthday.get(Calendar.DAY_OF_MONTH);
1211 1212  
1212 1213 // 月份从0开始计算,所以需要+1
1213   - int month = now.get(Calendar.MONTH) +1 - birthday.get(Calendar.MONTH);
  1214 + int month = now.get(Calendar.MONTH) + 1 - birthday.get(Calendar.MONTH);
1214 1215 int year = now.get(Calendar.YEAR) - birthday.get(Calendar.YEAR);
1215 1216  
1216 1217 // 按照减法原理,先day相减,不够向month借;然后month相减,不够向year借;最后year相减。
1217 1218  
1218   - if (day <0) {
1219   - month -=1;
  1219 + if (day < 0) {
  1220 + month -= 1;
1220 1221 // 得到上一个月,用来得到上个月的天数。
1221 1222 now.add(Calendar.MONTH, -1);
1222 1223 day = day + now.getActualMaximum(Calendar.DAY_OF_MONTH);
1223 1224 }
1224 1225  
1225   - if (month <0) {
1226   - month = (month +12) %12;
  1226 + if (month < 0) {
  1227 + month = (month + 12) % 12;
1227 1228 year--;
1228 1229 }
1229 1230  
1230   - StringBuffer tag =new StringBuffer();
  1231 + StringBuffer tag = new StringBuffer();
1231 1232  
1232   - if (year >0) {
1233   - tag.append(year +"岁");
  1233 + if (year > 0) {
  1234 + tag.append(year + "岁");
1234 1235 }
1235 1236  
1236   - if (month >0) {
1237   - tag.append(month +"个月");
  1237 + if (month > 0) {
  1238 + tag.append(month + "个月");
1238 1239 }
1239 1240  
1240   - if (day >0) {
1241   - tag.append(day +"天");
  1241 + if (day > 0) {
  1242 + tag.append(day + "天");
1242 1243 }
1243 1244  
1244   - if (year ==0 && month ==0 && day ==0) {
  1245 + if (year == 0 && month == 0 && day == 0) {
1245 1246 tag.append("今日出生");
1246 1247 }
1247 1248 return String.valueOf(tag);
... ... @@ -1290,7 +1291,7 @@
1290 1291 if (kaupEvaluate.equals("正常") && month >= 0 && month <= 5) {
1291 1292 if (StringUtils.isNotEmpty(model.getFeedType())) {
1292 1293 BabyDietReportModel babyDietReport = mongoTemplate.findOne(Query.query(Criteria.where("monthAge").is(month).and("feedingPattern").is(Integer.valueOf(model.getFeedType())).and("shape").is(1)), BabyDietReportModel.class);
1293   - data.put("feedingPattern", babyDietReport.getFeedingGuide());
  1294 + data.put("feedingGuide", babyDietReport.getFeedingGuide());
1294 1295 }
1295 1296 } else if (kaupEvaluate.equals("正常") && month >= 6 && month <= 11) {
1296 1297 List<BabyDietReportModel> babyDietReportList = mongoTemplate.find(Query.query(Criteria.where("monthAge").is(month).and("shape").is(1)), BabyDietReportModel.class);
1297 1298  
1298 1299  
... ... @@ -1298,14 +1299,14 @@
1298 1299 if (month == 6) {
1299 1300 if (StringUtils.isNotEmpty(model.getFeedType())) {
1300 1301 if (Integer.valueOf(model.getFeedType()) == month) {
1301   - data.put("feedingPattern", babyDiet.getFeedingPattern());
  1302 + data.put("feedingGuide", babyDiet.getFeedingGuide());
1302 1303 }
1303 1304 } else {
1304 1305 //直接返回空
1305   - data.put("feedingPattern", "");
  1306 + data.put("feedingGuide", "");
1306 1307 }
1307 1308 } else {
1308   - data.put("feedingPattern", babyDiet.getFeedingPattern());
  1309 + data.put("feedingGuide", babyDiet.getFeedingGuide());
1309 1310 }
1310 1311 //膳食结构
1311 1312 data.put("dietStructure", babyDiet.getDietStructure());