Commit 414b0e836425b8cf88484f82d4ce5ac745ed5877
1 parent
40c286686a
Exists in
master
and in
6 other branches
update
Showing 3 changed files with 119 additions and 6 deletions
platform-operate-api/src/main/java/com/lyms/hospitalapi/lhxfy/LhxfyService.java
View file @
414b0e8
... | ... | @@ -98,7 +98,7 @@ |
98 | 98 | public void autoInLis() |
99 | 99 | { |
100 | 100 | Query query = new Query(); |
101 | - Date start = DateUtil.addDay(new Date(),-3); | |
101 | + Date start = DateUtil.addDay(new Date(),-8); | |
102 | 102 | query.addCriteria(Criteria.where("fillDate").gte(start)); |
103 | 103 | |
104 | 104 | List <PreEugenicsBaseModel> preEugenicsBaseModels = mongoTemplate.find(query, PreEugenicsBaseModel.class); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PremaritalCheckupController.java
View file @
414b0e8
... | ... | @@ -61,7 +61,7 @@ |
61 | 61 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
62 | 62 | |
63 | 63 | |
64 | - return premaritalCheckupFacade.addPremaritalCheckupSign(addRequest , loginState.getId()); | |
64 | + return premaritalCheckupFacade.addPremaritalCheckupSign(addRequest, loginState.getId()); | |
65 | 65 | } |
66 | 66 | |
67 | 67 | |
... | ... | @@ -157,7 +157,19 @@ |
157 | 157 | HttpServletRequest request) { |
158 | 158 | //获取当前登录用户ID |
159 | 159 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
160 | - premaritalCheckupFacade.premaritalCheckupExport(queryRequest,loginState.getId(),response); | |
160 | + premaritalCheckupFacade.premaritalCheckupExport(queryRequest, loginState.getId(), response); | |
161 | + } | |
162 | + | |
163 | + | |
164 | + @RequestMapping(value = "/lhxpremaritalCheckupExport", method = RequestMethod.GET) | |
165 | + @ResponseBody | |
166 | + @TokenRequired | |
167 | + public void lhxpremaritalCheckupExport(@Valid PremaritalCheckupQueryRequest queryRequest, | |
168 | + HttpServletResponse response, | |
169 | + HttpServletRequest request) { | |
170 | + //获取当前登录用户ID | |
171 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
172 | + premaritalCheckupFacade.lhxpremaritalCheckupExport(queryRequest,loginState.getId(),response); | |
161 | 173 | } |
162 | 174 | |
163 | 175 | /** |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PremaritalCheckupFacade.java
View file @
414b0e8
... | ... | @@ -1145,11 +1145,112 @@ |
1145 | 1145 | |
1146 | 1146 | } |
1147 | 1147 | |
1148 | + | |
1149 | + | |
1150 | + public void lhxpremaritalCheckupExport(PremaritalCheckupQueryRequest request, Integer userId, | |
1151 | + HttpServletResponse response) { | |
1152 | + OutputStream out = null; | |
1153 | + List<Map<String, Object>> list = new ArrayList<>(); | |
1154 | + String hospital = autoMatchFacade.getHospitalId(userId); | |
1155 | + try { | |
1156 | + PremaritalCheckupQuery query = new PremaritalCheckupQuery(); | |
1157 | + query.setPage(request.getPage()); | |
1158 | + query.setLimit(request.getLimit()); | |
1159 | + query.setNeed("y"); | |
1160 | + query.setYn(YnEnums.YES.getId()); | |
1161 | + query.setYiXueYiJian(request.getYiXueYiJian()); | |
1162 | + if (StringUtils.isNotEmpty(request.getPremaritalUpTime())) { | |
1163 | + String[] dates = request.getPremaritalUpTime().split(" - "); | |
1164 | + query.setPremaritalUpTimeStart(DateUtil.parseYMD(dates[0])); | |
1165 | + if (dates.length >= 2) { | |
1166 | + Date date = DateUtil.parseYMD(dates[1]); | |
1167 | + if (null != date) { | |
1168 | + long d = date.getTime() + 86398000; | |
1169 | + date = new Date(d); | |
1170 | + } | |
1171 | + query.setPremaritalUpTimeEnd(date); | |
1172 | + } | |
1173 | + } | |
1174 | + query.setHospitalId(hospital); | |
1175 | + List<PremaritalCheckup> data = premaritalCheckupService.queryPremaritalCheckup(query); | |
1176 | + if (CollectionUtils.isNotEmpty(data)) { | |
1177 | + lhxfyExport(out, list, data, response); | |
1178 | + } | |
1179 | + } catch (Exception e) { | |
1180 | + e.printStackTrace(); | |
1181 | + } | |
1182 | + } | |
1183 | + | |
1184 | + public void lhxfyExport(OutputStream out, List<Map<String, Object>> list, List<PremaritalCheckup> data, HttpServletResponse response) { | |
1185 | + if (CollectionUtils.isNotEmpty(data)) { | |
1186 | + try { | |
1187 | + for (PremaritalCheckup checkup : data) { | |
1188 | + Map<String, Object> map = new HashMap<>(); | |
1189 | + String username = ""; | |
1190 | + String phone = ""; | |
1191 | + Integer age = null; | |
1192 | + String certificateNum = ""; | |
1193 | + String residence = ""; | |
1194 | + String blNum = ""; | |
1195 | + //1 婚检 2 孕前优生 3 婚检孕前优生 | |
1196 | + Integer type = null; | |
1197 | + String sex = null; | |
1198 | + if (StringUtils.isNotEmpty(checkup.getParentId())) { | |
1199 | + ResidentsArchiveModel archiveModel = residentsArchiveService.getResident(checkup.getParentId()); | |
1200 | + if (archiveModel != null && archiveModel.getYn() == YnEnums.YES.getId()) { | |
1201 | + username = archiveModel.getUsername(); | |
1202 | + phone = archiveModel.getPhone(); | |
1203 | + blNum = archiveModel.getBlNum(); | |
1204 | + type = archiveModel.getType(); | |
1205 | + sex = archiveModel.getSex(); | |
1206 | + certificateNum = archiveModel.getCertificateNum(); | |
1207 | + residence = CommonsHelper.getResidence(archiveModel.getProvinceId(), archiveModel.getCityId(), | |
1208 | + archiveModel.getAreaId(), archiveModel.getStreetId(), archiveModel.getAddress(), basicConfigService); | |
1209 | + if (archiveModel.getBirthday() != null) { | |
1210 | + age = DateUtil.getAge(archiveModel.getBirthday()); | |
1211 | + } | |
1212 | + } | |
1213 | + } | |
1214 | + | |
1215 | + map.put("username", username); | |
1216 | + map.put("certificateNum", certificateNum); | |
1217 | + map.put("phone", phone); | |
1218 | + map.put("sex", FunvCommonUtil.getBaseicConfigByid(sex, basicConfigService)); | |
1219 | + map.put("cxNum", checkup.getCxNum()); | |
1220 | + map.put("blNum", blNum); | |
1221 | + map.put("type", type == null ? "" : (type == 1 ? "婚检" : (type == 2 ? "孕前优生" : "婚检孕前优生"))); | |
1222 | + map.put("age", age); | |
1223 | + map.put("residence", residence); | |
1224 | + list.add(map); | |
1225 | + | |
1226 | + } | |
1227 | + out = response.getOutputStream(); | |
1228 | + Map<String, String> cnames = new LinkedHashMap<>(); | |
1229 | + | |
1230 | + cnames.put("username", "姓名"); | |
1231 | + cnames.put("age", "年龄"); | |
1232 | + cnames.put("certificateNum", "身份证号"); | |
1233 | + cnames.put("phone", "联系方式"); | |
1234 | + cnames.put("sex", "性别"); | |
1235 | + cnames.put("cxNum", "采血编号"); | |
1236 | + cnames.put("blNum", "病历号"); | |
1237 | + cnames.put("type", "检查类型"); | |
1238 | + cnames.put("residence", "居住地址"); | |
1239 | + | |
1240 | + response.setContentType("application/octet-stream"); | |
1241 | + response.setCharacterEncoding("UTF-8"); | |
1242 | + response.setHeader("Content-Disposition", "attachment;fileName=" + "huanjian.xls"); | |
1243 | + ExcelUtil.toExcel(out, list, cnames); | |
1244 | + | |
1245 | + } catch (Exception e) { | |
1246 | + e.printStackTrace(); | |
1247 | + } | |
1248 | + } | |
1249 | + } | |
1250 | + | |
1148 | 1251 | //导出女性婚前检查 |
1149 | 1252 | public void womenExport(OutputStream out, List<Map<String, Object>> list, List<PremaritalCheckup> data, HttpServletResponse response) { |
1150 | - int one = 1; | |
1151 | - int two = 2; | |
1152 | - int three = 3; | |
1253 | + | |
1153 | 1254 | if (CollectionUtils.isNotEmpty(data)) { |
1154 | 1255 | try { |
1155 | 1256 | for (PremaritalCheckup checkup : data) { |