Commit 8fd7a3474f3fb205beb0ae731143e28ab5013972
1 parent
f30a7f6565
Exists in
master
and in
6 other branches
健康统计-结算管理
Showing 7 changed files with 413 additions and 92 deletions
- platform-dal/src/main/java/com/lyms/platform/pojo/HealthChargeModel.java
- platform-dal/src/main/java/com/lyms/platform/query/HealthChargeQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyNutritionController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/HealthChargeController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyNutritionFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/HealthChargeFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/HealthChargeRequest.java
platform-dal/src/main/java/com/lyms/platform/pojo/HealthChargeModel.java
View file @
8fd7a34
platform-dal/src/main/java/com/lyms/platform/query/HealthChargeQuery.java
View file @
8fd7a34
| ... | ... | @@ -62,6 +62,16 @@ |
| 62 | 62 | */ |
| 63 | 63 | private String doctorId; |
| 64 | 64 | |
| 65 | + private List<String> ids; | |
| 66 | + | |
| 67 | + public List<String> getIds() { | |
| 68 | + return ids; | |
| 69 | + } | |
| 70 | + | |
| 71 | + public void setIds(List<String> ids) { | |
| 72 | + this.ids = ids; | |
| 73 | + } | |
| 74 | + | |
| 65 | 75 | public String getBabyNutritionId() { |
| 66 | 76 | return babyNutritionId; |
| 67 | 77 | } |
| ... | ... | @@ -137,6 +147,9 @@ |
| 137 | 147 | condition = condition.and("babyNutritionId", babyNutritionId, MongoOper.IS); |
| 138 | 148 | } |
| 139 | 149 | |
| 150 | + if (CollectionUtils.isNotEmpty(ids)) { | |
| 151 | + condition = condition.and("id", ids, MongoOper.IN); | |
| 152 | + } | |
| 140 | 153 | Criteria c = null; |
| 141 | 154 | |
| 142 | 155 | if (null != createdStart && createdEnd != null) { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyNutritionController.java
View file @
8fd7a34
| ... | ... | @@ -13,6 +13,7 @@ |
| 13 | 13 | import org.springframework.web.bind.annotation.*; |
| 14 | 14 | |
| 15 | 15 | import javax.servlet.http.HttpServletRequest; |
| 16 | +import javax.servlet.http.HttpServletResponse; | |
| 16 | 17 | import javax.validation.Valid; |
| 17 | 18 | |
| 18 | 19 | |
| ... | ... | @@ -144,6 +145,47 @@ |
| 144 | 145 | public BaseResponse unSettleList(@Valid @RequestBody BabyNutritionSettleRequest request, |
| 145 | 146 | HttpServletRequest httpServletRequest) { |
| 146 | 147 | return babyNutritionFacade.unSettleList(request, getUserId(httpServletRequest)); |
| 148 | + } | |
| 149 | + | |
| 150 | + /** | |
| 151 | + * 结算操作 | |
| 152 | + * | |
| 153 | + * @param request | |
| 154 | + * @return | |
| 155 | + */ | |
| 156 | + @RequestMapping(method = RequestMethod.POST, value = "/settle/status") | |
| 157 | + @ResponseBody | |
| 158 | + @TokenRequired | |
| 159 | + public BaseResponse settleStatus(@Valid @RequestBody BabyNutritionSettleRequest request, | |
| 160 | + HttpServletRequest httpServletRequest) { | |
| 161 | + return babyNutritionFacade.settleStatus(request, getUserId(httpServletRequest)); | |
| 162 | + } | |
| 163 | + | |
| 164 | + /** | |
| 165 | + * 结算历史 | |
| 166 | + * | |
| 167 | + * @param request | |
| 168 | + * @return | |
| 169 | + */ | |
| 170 | + @RequestMapping(method = RequestMethod.POST, value = "/settle/list") | |
| 171 | + @ResponseBody | |
| 172 | + @TokenRequired | |
| 173 | + public BaseResponse settleHistoryList(@Valid @RequestBody BabyNutritionSettleRequest request, | |
| 174 | + HttpServletRequest httpServletRequest) { | |
| 175 | + return babyNutritionFacade.settleHistoryList(request, getUserId(httpServletRequest)); | |
| 176 | + } | |
| 177 | + | |
| 178 | + /** | |
| 179 | + * 导出 | |
| 180 | + * | |
| 181 | + * @param request | |
| 182 | + * @return | |
| 183 | + */ | |
| 184 | + @RequestMapping(method = RequestMethod.POST, value = "/settleHistory/export") | |
| 185 | + @TokenRequired | |
| 186 | + public void settleHistoryExport(@Valid @RequestBody BabyNutritionSettleRequest request, | |
| 187 | + HttpServletResponse response) { | |
| 188 | + babyNutritionFacade.settleHistoryExport(request,response); | |
| 147 | 189 | } |
| 148 | 190 | |
| 149 | 191 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/HealthChargeController.java
View file @
8fd7a34
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyNutritionFacade.java
View file @
8fd7a34
| ... | ... | @@ -9,12 +9,10 @@ |
| 9 | 9 | import com.lyms.platform.common.result.BaseObjectResponse; |
| 10 | 10 | import com.lyms.platform.common.result.BaseResponse; |
| 11 | 11 | import com.lyms.platform.common.utils.*; |
| 12 | -import com.lyms.platform.common.utils.StringUtils; | |
| 13 | 12 | import com.lyms.platform.operate.web.request.BabyNutritionRequest; |
| 14 | 13 | import com.lyms.platform.operate.web.request.BabyNutritionSettleRequest; |
| 15 | 14 | import com.lyms.platform.operate.web.result.*; |
| 16 | 15 | import com.lyms.platform.operate.web.service.PatientWeightService; |
| 17 | - | |
| 18 | 16 | import com.lyms.platform.permission.model.Organization; |
| 19 | 17 | import com.lyms.platform.permission.model.Users; |
| 20 | 18 | import com.lyms.platform.permission.service.MeasureDataInfoService; |
| 21 | 19 | |
| 22 | 20 | |
| ... | ... | @@ -23,15 +21,15 @@ |
| 23 | 21 | import com.lyms.platform.pojo.*; |
| 24 | 22 | import com.lyms.platform.query.*; |
| 25 | 23 | import org.apache.commons.collections.CollectionUtils; |
| 26 | -import org.apache.commons.lang.*; | |
| 27 | 24 | import org.springframework.beans.factory.annotation.Autowired; |
| 28 | - | |
| 29 | 25 | import org.springframework.data.domain.Sort; |
| 30 | 26 | import org.springframework.data.mongodb.core.MongoTemplate; |
| 31 | 27 | import org.springframework.data.mongodb.core.query.Criteria; |
| 32 | 28 | import org.springframework.data.mongodb.core.query.Query; |
| 33 | 29 | import org.springframework.stereotype.Component; |
| 34 | 30 | |
| 31 | +import javax.servlet.http.HttpServletResponse; | |
| 32 | +import java.io.OutputStream; | |
| 35 | 33 | import java.util.*; |
| 36 | 34 | |
| 37 | 35 | @Component |
| ... | ... | @@ -87,6 +85,9 @@ |
| 87 | 85 | @Autowired |
| 88 | 86 | private AreaCountFacade areaCountFacade; |
| 89 | 87 | |
| 88 | + @Autowired | |
| 89 | + private ChargeRecordService chargeRecordService; | |
| 90 | + | |
| 90 | 91 | public BaseObjectResponse queryBabyNutritionRecord(String babyId) { |
| 91 | 92 | Map<String, Object> resMap = new HashMap<>(); |
| 92 | 93 | BabyBasicResult base = new BabyBasicResult(); |
| 93 | 94 | |
| 94 | 95 | |
| 95 | 96 | |
| 96 | 97 | |
| 97 | 98 | |
| 98 | 99 | |
| 99 | 100 | |
| 100 | 101 | |
| ... | ... | @@ -257,65 +258,78 @@ |
| 257 | 258 | Integer currentSettleStatus = getSettleStatus(model); |
| 258 | 259 | if (settleStatus != null) { |
| 259 | 260 | if (currentSettleStatus != null && (currentSettleStatus == Integer.parseInt(settleStatus))) { |
| 260 | - Map map = new HashMap(); | |
| 261 | - map.put("id", model.getId()); | |
| 262 | - map.put("babyId", model.getBabyId()); | |
| 261 | + // 组织数据格式 | |
| 262 | + Map mapData = getMapData(model, currentSettleStatus); | |
| 263 | + list.add(mapData); | |
| 264 | + } | |
| 265 | + } else { | |
| 266 | + // 组织数据格式 | |
| 267 | + Map mapData = getMapData(model, currentSettleStatus); | |
| 268 | + list.add(mapData); | |
| 269 | + } | |
| 270 | + } | |
| 271 | + } | |
| 263 | 272 | |
| 264 | - BabyModel baby = babyBookbuildingService.queryBabyBuildById(model.getBabyId()); | |
| 265 | - map.put("babyName", baby.getName()); | |
| 266 | - map.put("babySex", SexEnum.getTextById(baby.getSex())); | |
| 267 | - map.put("monthAge", StringUtils.emptyDeal(DateUtil.getBabyMonthAge(baby.getBirth(), new Date()))); | |
| 268 | - map.put("motherName", baby.getMname()); | |
| 269 | - map.put("phone", baby.getMphone()); | |
| 270 | - map.put("vcCardNo", baby.getVcCardNo()); | |
| 271 | 273 | |
| 272 | - String highRiskInfos = basicConfigFacade.queryBaseInfoByStr(baby.getHighRiskInfo()); | |
| 273 | - map.put("highRiskInfos", highRiskInfos); | |
| 274 | + objectResponse.setData(list); | |
| 275 | + objectResponse.setPageInfo(babyQuery.getPageInfo()); | |
| 276 | + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 277 | + objectResponse.setErrormsg("成功"); | |
| 278 | + return objectResponse; | |
| 279 | + } | |
| 274 | 280 | |
| 275 | - String diagnose = ""; | |
| 276 | - if (StringUtils.isNotEmpty(baby.getPid())) { | |
| 277 | - List diagList = babyCheckFacade.getBabyLastDiagnose(baby.getPid()); | |
| 278 | - if (CollectionUtils.isNotEmpty(diagList)) { | |
| 279 | - for (Object obj : diagList) { | |
| 280 | - BasicConfig basicConfig = basicConfigService.getOneBasicConfigById((String) obj); | |
| 281 | - if (basicConfig != null) { | |
| 282 | - diagnose += basicConfig.getName() + " "; | |
| 283 | - } | |
| 284 | - } | |
| 285 | - } | |
| 286 | - } | |
| 281 | + private Map getMapData(BabyNutritionModel model, Integer currentSettleStatus) { | |
| 282 | + Map map = new HashMap(); | |
| 283 | + map.put("id",model.getId()); | |
| 284 | + map.put("babyId",model.getBabyId()); | |
| 287 | 285 | |
| 288 | - map.put("diagnose", StringUtils.emptyDeal(diagnose)); | |
| 286 | + BabyModel baby = babyBookbuildingService.queryBabyBuildById(model.getBabyId()); | |
| 287 | + map.put("babyName",baby.getName()); | |
| 288 | + map.put("babySex", SexEnum.getTextById(baby.getSex())); | |
| 289 | + map.put("monthAge", StringUtils.emptyDeal(DateUtil.getBabyMonthAge(baby.getBirth(), new Date()))); | |
| 290 | + map.put("motherName", baby.getMname()); | |
| 291 | + map.put("phone", baby.getMphone()); | |
| 292 | + map.put("vcCardNo", baby.getVcCardNo()); | |
| 289 | 293 | |
| 290 | - map.put("weight", model.getWeight()); | |
| 291 | - map.put("height", model.getHeight()); | |
| 292 | - map.put("recordTime", DateUtil.getyyyy_MM_dd(model.getNutritiTime())); | |
| 294 | + String highRiskInfos = basicConfigFacade.queryBaseInfoByStr(baby.getHighRiskInfo()); | |
| 295 | + map.put("highRiskInfos",highRiskInfos); | |
| 293 | 296 | |
| 294 | - // 新增报表解读人和结算状态 | |
| 295 | - String currInterpretDoctorId = model.getInterpretDoctorId(); | |
| 296 | - String interpretDoctorName = ""; | |
| 297 | - if (StringUtils.isNotEmpty(currInterpretDoctorId)) { | |
| 298 | - Users users = usersService.getUsers(Integer.parseInt(currInterpretDoctorId)); | |
| 299 | - if (users != null) { | |
| 300 | - interpretDoctorName = users.getName(); | |
| 301 | - } | |
| 302 | - } | |
| 303 | - String settleStatusName = currentSettleStatus == 1 ? "未结算" : "已结算"; | |
| 304 | - map.put("interpretDoctorName", interpretDoctorName); | |
| 305 | - map.put("settleStatusName", settleStatusName); | |
| 306 | - | |
| 307 | - list.add(map); | |
| 297 | + String diagnose = ""; | |
| 298 | + if (StringUtils.isNotEmpty(baby.getPid())) { | |
| 299 | + List diagList = babyCheckFacade.getBabyLastDiagnose(baby.getPid()); | |
| 300 | + if (CollectionUtils.isNotEmpty(diagList)) { | |
| 301 | + for (Object obj : diagList) { | |
| 302 | + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById((String) obj); | |
| 303 | + if (basicConfig != null) { | |
| 304 | + diagnose += basicConfig.getName() + " "; | |
| 308 | 305 | } |
| 309 | 306 | } |
| 310 | 307 | } |
| 311 | 308 | } |
| 312 | 309 | |
| 310 | + map.put("diagnose", StringUtils.emptyDeal(diagnose)); | |
| 313 | 311 | |
| 314 | - objectResponse.setData(list); | |
| 315 | - objectResponse.setPageInfo(babyQuery.getPageInfo()); | |
| 316 | - objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 317 | - objectResponse.setErrormsg("成功"); | |
| 318 | - return objectResponse; | |
| 312 | + map.put("weight", model.getWeight()); | |
| 313 | + map.put("height", model.getHeight()); | |
| 314 | + map.put("recordTime", DateUtil.getyyyy_MM_dd(model.getNutritiTime())); | |
| 315 | + | |
| 316 | + // 新增报表解读人和结算状态 | |
| 317 | + String currInterpretDoctorId = model.getInterpretDoctorId(); | |
| 318 | + String interpretDoctorName = ""; | |
| 319 | + if (StringUtils.isNotEmpty(currInterpretDoctorId)){ | |
| 320 | + Users users = usersService.getUsers(Integer.parseInt(currInterpretDoctorId)); | |
| 321 | + if (users != null){ | |
| 322 | + interpretDoctorName = users.getName(); | |
| 323 | + } | |
| 324 | + } | |
| 325 | + String settleStatusName = ""; | |
| 326 | + if (currentSettleStatus != null){ | |
| 327 | + settleStatusName = currentSettleStatus == 1 ? "未结算" : "已结算"; | |
| 328 | + } | |
| 329 | + map.put("interpretDoctorName", interpretDoctorName); | |
| 330 | + map.put("settleStatusName", settleStatusName); | |
| 331 | + | |
| 332 | + return map; | |
| 319 | 333 | } |
| 320 | 334 | |
| 321 | 335 | /** |
| ... | ... | @@ -632,7 +646,7 @@ |
| 632 | 646 | |
| 633 | 647 | data.put("wlysitems", wlysitems); |
| 634 | 648 | |
| 635 | - healthChargeFacade.addHealthCharge(hospitalId, 4, baby.getId(), null, null, | |
| 649 | + healthChargeFacade.addHealthCharge(hospitalId, 5, baby.getId(), null, null, | |
| 636 | 650 | userId, model.getInterpretDoctorId(), true, model.getId()); |
| 637 | 651 | } |
| 638 | 652 | BaseObjectResponse objectResponse = new BaseObjectResponse(); |
| 639 | 653 | |
| ... | ... | @@ -902,11 +916,12 @@ |
| 902 | 916 | * @return |
| 903 | 917 | */ |
| 904 | 918 | public BaseResponse unSettleList(BabyNutritionSettleRequest request, Integer userId) { |
| 905 | - HealthChargeQuery healthChargeQuery = new HealthChargeQuery(); | |
| 919 | + | |
| 920 | + HealthChargeQuery healthChargeQuery = new HealthChargeQuery(); | |
| 906 | 921 | healthChargeQuery.setPage(request.getPage()); |
| 907 | 922 | healthChargeQuery.setLimit(request.getLimit()); |
| 908 | 923 | healthChargeQuery.setNeed("true"); |
| 909 | - healthChargeQuery.setHealthType(4); | |
| 924 | + healthChargeQuery.setHealthType(5); | |
| 910 | 925 | healthChargeQuery.setYn(YnEnums.YES.getId()); |
| 911 | 926 | healthChargeQuery.setHospitalId(request.getHospitalId()); |
| 912 | 927 | healthChargeQuery.setStatus(1); |
| 913 | 928 | |
| 914 | 929 | |
| 915 | 930 | |
| 916 | 931 | |
| 917 | 932 | |
| 918 | 933 | |
| 919 | 934 | |
| 920 | 935 | |
| ... | ... | @@ -914,58 +929,105 @@ |
| 914 | 929 | Date startDate = areaCountFacade.getStartDate(); |
| 915 | 930 | healthChargeQuery.setCreatedStart(startDate); |
| 916 | 931 | healthChargeQuery.setCreatedEnd(new Date()); |
| 917 | - if (request.getStartTime() != null) { | |
| 932 | + if (request.getStartTime() != null){ | |
| 918 | 933 | healthChargeQuery.setCreatedStart(request.getStartTime()); |
| 919 | 934 | healthChargeQuery.setCreatedEnd(request.getEndTime()); |
| 920 | 935 | } |
| 921 | 936 | String findNo = request.getNumber(); |
| 922 | 937 | String keyword = request.getKeyword(); |
| 938 | + List<String> arrayList = new ArrayList<String>() {}; | |
| 939 | + BaseListResponse objectResponse = new BaseListResponse(); | |
| 923 | 940 | |
| 924 | - List<HealthChargeModel> list = healthChargeService.queryHealthChargeList(healthChargeQuery); | |
| 925 | - List<HealthChargeModel> resultList = new LinkedList<>(); | |
| 926 | - if (CollectionUtils.isNotEmpty(list)) { | |
| 927 | - for (HealthChargeModel model : list) { | |
| 928 | - String babyForeignId = model.getBabyForeignId(); | |
| 929 | - | |
| 930 | - if (StringUtils.isNotEmpty(findNo) && StringUtils.isNotEmpty(keyword)) { | |
| 931 | - List<BabyModel> babyModels = getBabyModels(findNo, babyForeignId); | |
| 932 | - if (CollectionUtils.isNotEmpty(babyModels)) { | |
| 933 | - BabyModel babyModel = babyModels.get(0); | |
| 934 | - String name = babyModel.getName(); | |
| 935 | - if (name.contains(keyword)) { | |
| 936 | - resultList.add(model); | |
| 937 | - } | |
| 941 | + if (StringUtils.isNotEmpty(findNo) && StringUtils.isNotEmpty(keyword)){ | |
| 942 | + List<BabyModel> babyModels = getBabyModels(findNo, null); | |
| 943 | + if (CollectionUtils.isNotEmpty(babyModels)){ | |
| 944 | + for (BabyModel model: babyModels){ | |
| 945 | + String name = model.getName(); | |
| 946 | + if (name.contains(keyword)){ | |
| 947 | + String modelId = model.getId(); | |
| 948 | + arrayList.add(modelId); | |
| 938 | 949 | } |
| 939 | 950 | } |
| 940 | - | |
| 941 | - if (StringUtils.isNotEmpty(findNo)) { | |
| 942 | - List<BabyModel> babyModels = getBabyModels(findNo, babyForeignId); | |
| 943 | - if (CollectionUtils.isNotEmpty(babyModels)) { | |
| 944 | - resultList.add(model); | |
| 945 | - } | |
| 951 | + } | |
| 952 | + }else if (StringUtils.isNotEmpty(findNo)){ | |
| 953 | + List<BabyModel> babyModels = getBabyModels(findNo, null); | |
| 954 | + if (CollectionUtils.isNotEmpty(babyModels)){ | |
| 955 | + for (BabyModel model: babyModels){ | |
| 956 | + String modelId = model.getId(); | |
| 957 | + arrayList.add(modelId); | |
| 946 | 958 | } |
| 947 | - | |
| 948 | - if (StringUtils.isNotEmpty(keyword)) { | |
| 949 | - BabyModelQuery babyQuery = new BabyModelQuery(); | |
| 950 | - babyQuery.setId(babyForeignId); | |
| 951 | - babyQuery.setQueryNo(findNo); | |
| 952 | - babyQuery.setYn(YnEnums.YES.getId()); | |
| 959 | + } | |
| 960 | + }else if (StringUtils.isNotEmpty(keyword)){ | |
| 961 | + List<BabyModel> babyModels = mongoTemplate.find(Query.query(Criteria.where("name").regex(keyword)), BabyModel.class); | |
| 962 | + if (CollectionUtils.isNotEmpty(babyModels)){ | |
| 963 | + for (BabyModel babyModel : babyModels){ | |
| 964 | + arrayList.add(babyModel.getId()); | |
| 953 | 965 | } |
| 954 | - | |
| 955 | - if (StringUtils.isEmpty(findNo) && StringUtils.isEmpty(keyword)) { | |
| 956 | - resultList.add(model); | |
| 957 | - } | |
| 958 | 966 | } |
| 959 | 967 | } |
| 960 | - BaseListResponse objectResponse = new BaseListResponse(); | |
| 961 | - objectResponse.setData(list); | |
| 968 | + if (arrayList.size() > 0){ | |
| 969 | + healthChargeQuery.setIds(arrayList); | |
| 970 | + } | |
| 971 | + List<LinkedHashMap<String, Object>> healthChargeModels = getHealthChargeModels(healthChargeQuery); | |
| 972 | + objectResponse.setData(healthChargeModels); | |
| 962 | 973 | objectResponse.setPageInfo(healthChargeQuery.getPageInfo()); |
| 963 | 974 | objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); |
| 964 | 975 | objectResponse.setErrormsg("成功"); |
| 976 | + | |
| 965 | 977 | return objectResponse; |
| 966 | 978 | } |
| 967 | 979 | |
| 968 | 980 | /** |
| 981 | + * 根据添加查询 | |
| 982 | + * | |
| 983 | + * @param healthChargeQuery | |
| 984 | + * @return | |
| 985 | + */ | |
| 986 | + private List<LinkedHashMap<String, Object>> getHealthChargeModels(HealthChargeQuery healthChargeQuery) { | |
| 987 | + List<LinkedHashMap<String, Object>> list = new LinkedList<>(); | |
| 988 | + List<HealthChargeModel> healthChargeModels = healthChargeService.queryHealthChargeList(healthChargeQuery); | |
| 989 | + for (HealthChargeModel healthChargeModel : healthChargeModels){ | |
| 990 | + | |
| 991 | + String foreignId = healthChargeModel.getBabyForeignId(); | |
| 992 | + BabyModel mongoTemplateOne = mongoTemplate.findOne(Query.query(Criteria.where("id").is(foreignId)), BabyModel.class); | |
| 993 | + if (mongoTemplateOne != null) { | |
| 994 | + String babayName = ""; | |
| 995 | + | |
| 996 | + String babyNutritionId = healthChargeModel.getBabyNutritionId(); | |
| 997 | + Date createTime = null; | |
| 998 | + if (babyNutritionId != null){ | |
| 999 | + BabyNutritionModel nutritionModel = mongoTemplate.findOne(Query.query(Criteria.where("id").is(babyNutritionId)), BabyNutritionModel.class); | |
| 1000 | + createTime = nutritionModel.getCreated(); | |
| 1001 | + | |
| 1002 | + } | |
| 1003 | + String doctorId = healthChargeModel.getDoctorId(); | |
| 1004 | + String doctorName = ""; | |
| 1005 | + if (doctorId != null){ | |
| 1006 | + Users users = mongoTemplate.findOne(Query.query(Criteria.where("id")), Users.class); | |
| 1007 | + if (users != null){ | |
| 1008 | + doctorName = users.getName(); | |
| 1009 | + } | |
| 1010 | + } | |
| 1011 | + LinkedHashMap<String, Object> hashMap = new LinkedHashMap<>(); | |
| 1012 | + | |
| 1013 | + babayName = mongoTemplateOne.getName(); | |
| 1014 | + Integer sex = mongoTemplateOne.getSex(); | |
| 1015 | + hashMap.put("babyName", babayName); | |
| 1016 | + hashMap.put("gender", sex != null ? sex == 1 ? "男" : "女" : ""); | |
| 1017 | + hashMap.put("phone", mongoTemplateOne.getMphone()); | |
| 1018 | + hashMap.put("cardNo", mongoTemplateOne.getCardNo()); | |
| 1019 | + hashMap.put("weight", mongoTemplateOne.getBabyWeight()); | |
| 1020 | + hashMap.put("babyHeight", mongoTemplateOne.getBabyHeight()); | |
| 1021 | + hashMap.put("createTime", createTime); | |
| 1022 | + hashMap.put("interpretDoctorName", doctorName); | |
| 1023 | + hashMap.put("id", babyNutritionId); | |
| 1024 | + list.add(hashMap); | |
| 1025 | + } | |
| 1026 | + } | |
| 1027 | + return list; | |
| 1028 | + } | |
| 1029 | + | |
| 1030 | + /** | |
| 969 | 1031 | * 获取儿童 |
| 970 | 1032 | * |
| 971 | 1033 | * @param findNo |
| 972 | 1034 | |
| 973 | 1035 | |
| ... | ... | @@ -974,10 +1036,213 @@ |
| 974 | 1036 | */ |
| 975 | 1037 | private List<BabyModel> getBabyModels(String findNo, String babyForeignId) { |
| 976 | 1038 | BabyModelQuery babyQuery = new BabyModelQuery(); |
| 977 | - babyQuery.setId(babyForeignId); | |
| 978 | 1039 | babyQuery.setQueryNo(findNo); |
| 979 | 1040 | babyQuery.setYn(YnEnums.YES.getId()); |
| 1041 | + if (babyForeignId != null){ | |
| 1042 | + babyQuery.setId(babyForeignId); | |
| 1043 | + } | |
| 980 | 1044 | return babyBookbuildingService.queryBabyBuildByCond(babyQuery); |
| 1045 | + } | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + /** | |
| 1049 | + * 结算操作 | |
| 1050 | + * | |
| 1051 | + * @param request | |
| 1052 | + * @param userId | |
| 1053 | + * @return | |
| 1054 | + */ | |
| 1055 | + public BaseResponse settleStatus(BabyNutritionSettleRequest request, Integer userId) { | |
| 1056 | + HealthChargeQuery healthChargeQuery = new HealthChargeQuery(); | |
| 1057 | + healthChargeQuery.setHealthType(5); | |
| 1058 | + healthChargeQuery.setYn(YnEnums.YES.getId()); | |
| 1059 | + healthChargeQuery.setHospitalId(request.getHospitalId()); | |
| 1060 | + healthChargeQuery.setStatus(1); | |
| 1061 | + Date startTime = request.getStartTime(); | |
| 1062 | + Date endTime = request.getEndTime(); | |
| 1063 | + if (startTime == null || endTime == null){ | |
| 1064 | + return new BaseResponse("请填写起始时间", ErrorCodeConstants.PARAMETER_ERROR); | |
| 1065 | + } | |
| 1066 | + healthChargeQuery.setCreatedStart(startTime); | |
| 1067 | + healthChargeQuery.setCreatedEnd(endTime); | |
| 1068 | + | |
| 1069 | + ChargeRecordModel recordModel = new ChargeRecordModel(); | |
| 1070 | + recordModel.setStartDate(startTime); | |
| 1071 | + recordModel.setEndDate(endTime); | |
| 1072 | + | |
| 1073 | + int chargeCount = healthChargeService.queryHealthChargeCount(healthChargeQuery); | |
| 1074 | + | |
| 1075 | + recordModel.setOperateUserId(String.valueOf(userId)); | |
| 1076 | + recordModel.setHealthType(5); | |
| 1077 | + recordModel.setCreated(new Date()); | |
| 1078 | + recordModel.setHospitalId(request.getHospitalId()); | |
| 1079 | + recordModel.setChargeCount(chargeCount); | |
| 1080 | + | |
| 1081 | + chargeRecordService.addChargeRecord(recordModel); | |
| 1082 | + | |
| 1083 | + HealthChargeModel model = new HealthChargeModel(); | |
| 1084 | + model.setChargeRecordId(recordModel.getId()); | |
| 1085 | + model.setStatus(2); | |
| 1086 | + healthChargeService.updateHealthCharges(healthChargeQuery,model); | |
| 1087 | + | |
| 1088 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); | |
| 1089 | + } | |
| 1090 | + | |
| 1091 | + /** | |
| 1092 | + * 结算历史 | |
| 1093 | + * | |
| 1094 | + * @param request | |
| 1095 | + * @param userId | |
| 1096 | + * @return | |
| 1097 | + */ | |
| 1098 | + public BaseResponse settleHistoryList(BabyNutritionSettleRequest request, Integer userId) { | |
| 1099 | + List<Map> listData = new ArrayList<>(); | |
| 1100 | + ChargeRecordQuery chargeRecordQuery = new ChargeRecordQuery(); | |
| 1101 | + chargeRecordQuery.setHealthType(5); | |
| 1102 | + chargeRecordQuery.setHospitalId(request.getHospitalId()); | |
| 1103 | + chargeRecordQuery.setOperateUserId(userId.toString()); | |
| 1104 | + chargeRecordQuery.setPage(request.getPage()); | |
| 1105 | + chargeRecordQuery.setLimit(request.getLimit()); | |
| 1106 | + chargeRecordQuery.setNeed("true"); | |
| 1107 | + Date startTime = request.getStartTime(); | |
| 1108 | + Date endTime = request.getEndTime(); | |
| 1109 | + if (startTime == null || endTime == null){ | |
| 1110 | + startTime = areaCountFacade.getStartDate(); | |
| 1111 | + endTime = new Date(); | |
| 1112 | + } | |
| 1113 | + chargeRecordQuery.setCreatedStart(startTime); | |
| 1114 | + chargeRecordQuery.setCreatedEnd(endTime); | |
| 1115 | + | |
| 1116 | + List<ChargeRecordModel> list = chargeRecordService.queryChargeRecordList(chargeRecordQuery); | |
| 1117 | + if (CollectionUtils.isNotEmpty(list)) { | |
| 1118 | + for (ChargeRecordModel model : list){ | |
| 1119 | + Map map = new LinkedHashMap(); | |
| 1120 | + map.put("id",model.getId()); | |
| 1121 | + map.put("startDate",DateUtil.getyyyy_MM_dd(model.getStartDate())); | |
| 1122 | + map.put("endDate",DateUtil.getyyyy_MM_dd(model.getEndDate())); | |
| 1123 | + map.put("chargeCount",model.getChargeCount()); | |
| 1124 | + Users users = usersService.getUsers(Integer.parseInt(model.getOperateUserId())); | |
| 1125 | + String doctorName = ""; | |
| 1126 | + if (users != null){ | |
| 1127 | + doctorName = users.getName(); | |
| 1128 | + } | |
| 1129 | + map.put("doctorName",doctorName); | |
| 1130 | + map.put("created",DateUtil.getyyyy_MM_dd(model.getCreated())); | |
| 1131 | + listData.add(map); | |
| 1132 | + } | |
| 1133 | + } | |
| 1134 | + return new BaseListResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(listData).setPageInfo(chargeRecordQuery.getPageInfo()); | |
| 1135 | + } | |
| 1136 | + | |
| 1137 | + /** | |
| 1138 | + * 导出 | |
| 1139 | + * | |
| 1140 | + * @param request | |
| 1141 | + * @param response | |
| 1142 | + */ | |
| 1143 | + public void settleHistoryExport(BabyNutritionSettleRequest request, HttpServletResponse response) { | |
| 1144 | + try { | |
| 1145 | + LinkedList<Map<String, Object>> objects = new LinkedList<>(); | |
| 1146 | + String recordId = request.getKeyword(); | |
| 1147 | + if (StringUtils.isNotEmpty(recordId)){ | |
| 1148 | + return; | |
| 1149 | + } | |
| 1150 | + ChargeRecordQuery chargeRecordQuery = new ChargeRecordQuery(); | |
| 1151 | + chargeRecordQuery.setId(recordId); | |
| 1152 | + | |
| 1153 | + ChargeRecordModel chargeRecordModel = mongoTemplate.findOne(Query.query(Criteria.where("id").is(recordId)), ChargeRecordModel.class); | |
| 1154 | + String date = ""; | |
| 1155 | + if (chargeRecordModel != null){ | |
| 1156 | + date = DateUtil.getyyyy_MM_dd(chargeRecordModel.getCreated()); | |
| 1157 | + } | |
| 1158 | + | |
| 1159 | + List<HealthChargeModel> healthChargeModels = mongoTemplate.find(Query.query(Criteria.where("chargeRecordId").is(recordId)), HealthChargeModel.class); | |
| 1160 | + if (CollectionUtils.isNotEmpty(healthChargeModels)){ | |
| 1161 | + for (HealthChargeModel model: healthChargeModels){ | |
| 1162 | + Map<String, Object> map = new LinkedHashMap<>(); | |
| 1163 | + BabyModel babyModel = mongoTemplate.findOne(Query.query(Criteria.where("id").is(model.getBabyForeignId())), BabyModel.class); | |
| 1164 | + map.put("userName", babyModel.getName()); | |
| 1165 | + String birthStr = DateUtil.getyyyy_MM_dd(babyModel.getBirth()); | |
| 1166 | + map.put("age", getAge(birthStr)); | |
| 1167 | + // 新国说的,以下几个写死 2019/05/28 | |
| 1168 | + map.put("week",""); | |
| 1169 | + map.put("type","儿童膳食报告"); | |
| 1170 | + map.put("status","已结算"); | |
| 1171 | + map.put("source","院内"); | |
| 1172 | + map.put("time", date); | |
| 1173 | + objects.add(map); | |
| 1174 | + } | |
| 1175 | + } | |
| 1176 | + OutputStream out = response.getOutputStream(); | |
| 1177 | + Map<String, String> cnames = new LinkedHashMap<>(); | |
| 1178 | + cnames.put("userName", "姓名"); | |
| 1179 | + cnames.put("age", "年龄"); | |
| 1180 | + cnames.put("week", "孕周"); | |
| 1181 | + cnames.put("type", "报告类型"); | |
| 1182 | + cnames.put("status", "结算状态"); | |
| 1183 | + cnames.put("source", "数据来源"); | |
| 1184 | + cnames.put("time", "结算时间"); | |
| 1185 | + response.setContentType("application/octet-stream"); | |
| 1186 | + response.setCharacterEncoding("UTF-8"); | |
| 1187 | + response.setHeader("Content-Disposition", "attachment;fileName=data.xls"); | |
| 1188 | + ExcelUtil.toExcel(out, objects, cnames); | |
| 1189 | + }catch (Exception e){ | |
| 1190 | + e.printStackTrace(); | |
| 1191 | + } | |
| 1192 | + } | |
| 1193 | + | |
| 1194 | + /** | |
| 1195 | + * 根据生日计算出年龄 | |
| 1196 | + * | |
| 1197 | + * @param date | |
| 1198 | + * @return | |
| 1199 | + */ | |
| 1200 | + public static String getAge(String date) { | |
| 1201 | + String[] data = date.split("-"); | |
| 1202 | + if (data.length <3){ | |
| 1203 | + return ""; | |
| 1204 | + } | |
| 1205 | + | |
| 1206 | + Calendar birthday =new GregorianCalendar(Integer.valueOf(data[0]), Integer.valueOf(data[1]), Integer.valueOf(data[2])); | |
| 1207 | + Calendar now = Calendar.getInstance(); | |
| 1208 | + int day = now.get(Calendar.DAY_OF_MONTH) - birthday.get(Calendar.DAY_OF_MONTH); | |
| 1209 | + | |
| 1210 | + // 月份从0开始计算,所以需要+1 | |
| 1211 | + int month = now.get(Calendar.MONTH) +1 - birthday.get(Calendar.MONTH); | |
| 1212 | + int year = now.get(Calendar.YEAR) - birthday.get(Calendar.YEAR); | |
| 1213 | + | |
| 1214 | + // 按照减法原理,先day相减,不够向month借;然后month相减,不够向year借;最后year相减。 | |
| 1215 | + | |
| 1216 | + if (day <0) { | |
| 1217 | + month -=1; | |
| 1218 | + // 得到上一个月,用来得到上个月的天数。 | |
| 1219 | + now.add(Calendar.MONTH, -1); | |
| 1220 | + day = day + now.getActualMaximum(Calendar.DAY_OF_MONTH); | |
| 1221 | + } | |
| 1222 | + | |
| 1223 | + if (month <0) { | |
| 1224 | + month = (month +12) %12; | |
| 1225 | + year--; | |
| 1226 | + } | |
| 1227 | + | |
| 1228 | + StringBuffer tag =new StringBuffer(); | |
| 1229 | + | |
| 1230 | + if (year >0) { | |
| 1231 | + tag.append(year +"岁"); | |
| 1232 | + } | |
| 1233 | + | |
| 1234 | + if (month >0) { | |
| 1235 | + tag.append(month +"个月"); | |
| 1236 | + } | |
| 1237 | + | |
| 1238 | + if (day >0) { | |
| 1239 | + tag.append(day +"天"); | |
| 1240 | + } | |
| 1241 | + | |
| 1242 | + if (year ==0 && month ==0 && day ==0) { | |
| 1243 | + tag.append("今日出生"); | |
| 1244 | + } | |
| 1245 | + return String.valueOf(tag); | |
| 981 | 1246 | } |
| 982 | 1247 | |
| 983 | 1248 | public BaseObjectResponse queryBabyDietReport(String id, Integer userId) { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/HealthChargeFacade.java
View file @
8fd7a34
| ... | ... | @@ -115,7 +115,7 @@ |
| 115 | 115 | /** |
| 116 | 116 | * 打印体重、血糖、血压调用接口 |
| 117 | 117 | * @param hospitalId 医院id |
| 118 | - * @param healthType 打印类型 1体重 2 血糖 3 血压 4妊高症 | |
| 118 | + * @param healthType 打印类型 1体重 2 血糖 3 血压 4妊高症 5-儿童 | |
| 119 | 119 | * @param foreignId 档案id (院内建档或者临时档案id) |
| 120 | 120 | * @param type 打印报告类别 1普通报告 2高危报告 |
| 121 | 121 | * @param source 档案来源类型 1院内建档 2零时建档 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/HealthChargeRequest.java
View file @
8fd7a34