Commit 2d896c3da6384b49d779f9f03005ca1d3e726dd3
1 parent
8af0bacd4b
Exists in
master
and in
6 other branches
update
Showing 1 changed file with 44 additions and 6 deletions
platform-operate-api/src/main/java/com/lyms/hospitalapi/lhxfy/LhxfyService.java
View file @
2d896c3
| ... | ... | @@ -3,6 +3,8 @@ |
| 3 | 3 | import com.lyms.hospitalapi.lhxfy.model.UploadResult; |
| 4 | 4 | import com.lyms.platform.biz.service.BasicConfigService; |
| 5 | 5 | import com.lyms.platform.biz.service.ResidentsArchiveService; |
| 6 | +import com.lyms.platform.common.dao.operator.MongoCondition; | |
| 7 | +import com.lyms.platform.common.dao.operator.MongoOper; | |
| 6 | 8 | import com.lyms.platform.common.enums.YnEnums; |
| 7 | 9 | import com.lyms.platform.common.result.BaseResponse; |
| 8 | 10 | import com.lyms.platform.common.utils.*; |
| ... | ... | @@ -954,8 +956,13 @@ |
| 954 | 956 | private static final String URL = "http://39.101.222.193:8088";//测试 |
| 955 | 957 | private static final String KEY = "27d7bc6992724608bbfa0775a31c4b38";//沧州测试key |
| 956 | 958 | public BaseResponse uploadingProvince(List<String> ids){ |
| 957 | - BaseResponse baseResponse=new BaseResponse(); | |
| 958 | - List<String> baseResponseList=new ArrayList<>(); | |
| 959 | + BaseResponse baseResponse=new BaseResponse();//返回结果对象 | |
| 960 | + if(CollectionUtils.isEmpty(ids)){ | |
| 961 | + LogUtil.error("机构id-NULL", null); | |
| 962 | + baseResponse.setErrormsg("机构id-NULL"); | |
| 963 | + return baseResponse; | |
| 964 | + } | |
| 965 | + List<String> baseResponseList=new ArrayList<>();//记录错误信息 | |
| 959 | 966 | Query query = new Query(); |
| 960 | 967 | //批量ID上传。 |
| 961 | 968 | query.addCriteria(Criteria.where("id").in(ids)); |
| ... | ... | @@ -1160,7 +1167,7 @@ |
| 1160 | 1167 | mongoTemplate.updateFirst(baseQuery5, update5, PreEugenicsBaseModel.class); |
| 1161 | 1168 | LogUtil.error("服务器返回:上传失败,list5:"+preEugenicsBaseModel.getId()+";code:" |
| 1162 | 1169 | + list5.get(0).getCode() + ";msg:" + list5.get(0).getMsg() + ";type:" + list5.get(0).getType(), null); |
| 1163 | - baseResponseList.add(";code:"+ list5.get(0).getCode() + ";msg:" + list5.get(0).getMsg() | |
| 1170 | + baseResponseList.add("code:"+ list5.get(0).getCode() + ";msg:" + list5.get(0).getMsg() | |
| 1164 | 1171 | + ";type:" + list5.get(0).getType()+";"+preEugenicsBaseModel.getId()); |
| 1165 | 1172 | } |
| 1166 | 1173 | } else { |
| ... | ... | @@ -1195,7 +1202,7 @@ |
| 1195 | 1202 | mongoTemplate.updateFirst(baseQuery6, update6, PreEugenicsBaseModel.class); |
| 1196 | 1203 | LogUtil.error("服务器返回:上传失败,list6:"+preEugenicsBaseModel.getId()+";code:" |
| 1197 | 1204 | + list6.get(0).getCode() + ";msg:" + list6.get(0).getMsg() + ";type:" + list6.get(0).getType(), null); |
| 1198 | - baseResponseList.add(";code:"+ list6.get(0).getCode() + ";msg:" + list6.get(0).getMsg() | |
| 1205 | + baseResponseList.add("code:"+ list6.get(0).getCode() + ";msg:" + list6.get(0).getMsg() | |
| 1199 | 1206 | + ";type:" + list6.get(0).getType()+";"+preEugenicsBaseModel.getId()); |
| 1200 | 1207 | } |
| 1201 | 1208 | } else { |
| ... | ... | @@ -1228,7 +1235,7 @@ |
| 1228 | 1235 | mongoTemplate.updateFirst(baseQuery7, update7, PreEugenicsBaseModel.class); |
| 1229 | 1236 | LogUtil.error("服务器返回:上传失败,list7:"+preEugenicsBaseModel.getId()+";code:" |
| 1230 | 1237 | +list7.get(0).getCode()+";msg:"+list7.get(0).getMsg()+";type:"+list7.get(0).getType(),null); |
| 1231 | - baseResponseList.add(";code:"+ list7.get(0).getCode() + ";msg:" + list7.get(0).getMsg() | |
| 1238 | + baseResponseList.add("code:"+ list7.get(0).getCode() + ";msg:" + list7.get(0).getMsg() | |
| 1232 | 1239 | + ";type:" + list7.get(0).getType()+";"+preEugenicsBaseModel.getId()); |
| 1233 | 1240 | } |
| 1234 | 1241 | }else { |
| ... | ... | @@ -1291,7 +1298,7 @@ |
| 1291 | 1298 | mongoTemplate.updateFirst(baseQuery1, update1, PreEugenicsBaseModel.class); |
| 1292 | 1299 | LogUtil.error("服务器返回:上传失败,list1:"+preEugenicsBaseModel.getId()+";code:" |
| 1293 | 1300 | +list1.get(0).getCode()+";msg:"+list1.get(0).getMsg()+";type:"+list1.get(0).getType(),null); |
| 1294 | - baseResponseList.add(";code:"+ list1.get(0).getCode() + ";msg:" + list1.get(0).getMsg() | |
| 1301 | + baseResponseList.add("code:"+ list1.get(0).getCode() + ";msg:" + list1.get(0).getMsg() | |
| 1295 | 1302 | + ";type:" + list1.get(0).getType()+";"+preEugenicsBaseModel.getId()); |
| 1296 | 1303 | } |
| 1297 | 1304 | }else { |
| ... | ... | @@ -1389,6 +1396,37 @@ |
| 1389 | 1396 | return "130825100227"; |
| 1390 | 1397 | } |
| 1391 | 1398 | |
| 1399 | + /** | |
| 1400 | + * 孕前优生-上传省平台定时任务 | |
| 1401 | + * @param hospitalId //必传机构id | |
| 1402 | + * @param start //不传默认当前时间30天前 | |
| 1403 | + * @param end //不传默认当前时间 | |
| 1404 | + */ | |
| 1405 | + public void uploadingProvinceTask(String hospitalId,Date start,Date end){ | |
| 1406 | + if(StringUtils.isEmpty(hospitalId)){ | |
| 1407 | + LogUtil.error("需要指定机构id", null); | |
| 1408 | + return; | |
| 1409 | + } | |
| 1410 | + if(start==null){ | |
| 1411 | + start = DateUtil.addDay(new Date(),-30);//当前时间30天前 | |
| 1412 | + } | |
| 1413 | + if(end==null){ | |
| 1414 | + end = new Date(); | |
| 1415 | + } | |
| 1416 | + Query query = new Query(); | |
| 1417 | + //机构 | |
| 1418 | + query.addCriteria(Criteria.where("hospitalId").is(hospitalId)); | |
| 1419 | + //查询上传失败或者没有上传过的 | |
| 1420 | + MongoCondition c = MongoCondition.newInstance(); | |
| 1421 | + MongoCondition con1 = MongoCondition.newInstance("isUploadingProvince", 0, MongoOper.IS); | |
| 1422 | + MongoCondition con2 = MongoCondition.newInstance("isUploadingProvince",false, MongoOper.EXISTS); | |
| 1423 | + query.addCriteria(c.orCondition(new MongoCondition[]{con1, con2}).getCriteria()); | |
| 1424 | + //检查结果时间 | |
| 1425 | + query.addCriteria(Criteria.where("resultadvice.fillDate").gte(DateUtil.getyyyy_MM_dd(start)).lte(DateUtil.getyyyy_MM_dd(end))); | |
| 1426 | + //查询院内孕前优生档案 | |
| 1427 | + List <String> ids = mongoTemplate.find(query,String.class,"id"); | |
| 1428 | + uploadingProvince(ids); | |
| 1429 | + } | |
| 1392 | 1430 | |
| 1393 | 1431 | |
| 1394 | 1432 | public static final String LHFY_HIS_URL = PropertiesUtils.getPropertyValue("lhfy_his_url"); |