Commit 9087b5efe7dbd915b12b5eb62d03c13cf5c11dc8
1 parent
bb7e2aca8c
Exists in
dev
二院患者信息上传修改
Showing 4 changed files with 48 additions and 45 deletions
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/LymsHisInfoController.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsHisInfoServiceImpl.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/GetPatientInfoTask.java
- talkonlineweb/src/main/resources/application-prod.yml
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/LymsHisInfoController.java
View file @
9087b5e
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsHisInfoServiceImpl.java
View file @
9087b5e
| ... | ... | @@ -225,6 +225,9 @@ |
| 225 | 225 | //判断医院是否平台收费,是否存在订单 |
| 226 | 226 | LymsHospital lymsHospital = lymsHospitalService.getById(Integer.valueOf(lymsHisInfo.getHospitalId())); |
| 227 | 227 | if(ChargeWay.PLATFORM.getCode()==lymsHospital.getChargeWay()){ |
| 228 | + if(patient == null){ | |
| 229 | + return "患者还没有缴费,暂时不能上传"; | |
| 230 | + } | |
| 228 | 231 | QueryWrapper<LymsOrder> queryWrapper = new QueryWrapper<>(); |
| 229 | 232 | queryWrapper.eq("pid",patient.getId()); |
| 230 | 233 | queryWrapper.gt("status",0); |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/GetPatientInfoTask.java
View file @
9087b5e
| 1 | 1 | package com.lyms.talkonlineweb.task; |
| 2 | 2 | |
| 3 | -import com.alibaba.fastjson.JSON; | |
| 3 | +import cn.hutool.core.date.DateTime; | |
| 4 | 4 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| 5 | 5 | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| 6 | -import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
| 7 | -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
| 8 | -import com.lyms.talkonlineweb.controller.PatientController; | |
| 9 | 6 | import com.lyms.talkonlineweb.domain.*; |
| 10 | -import com.lyms.talkonlineweb.result.BaseResponse; | |
| 11 | 7 | import com.lyms.talkonlineweb.service.*; |
| 12 | 8 | import com.lyms.talkonlineweb.util.*; |
| 13 | 9 | import lombok.extern.log4j.Log4j2; |
| 14 | -import org.apache.commons.lang3.StringUtils; | |
| 15 | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 16 | 11 | import org.springframework.beans.factory.annotation.Value; |
| 17 | -import org.springframework.stereotype.Component; | |
| 18 | -import org.springframework.validation.BindingResult; | |
| 19 | -import org.springframework.validation.MapBindingResult; | |
| 20 | 12 | import org.springframework.scheduling.annotation.Scheduled; |
| 21 | -import org.w3c.dom.ls.LSInput; | |
| 13 | +import org.springframework.stereotype.Component; | |
| 22 | 14 | |
| 23 | -import javax.swing.event.ListDataEvent; | |
| 24 | 15 | import java.util.*; |
| 25 | 16 | |
| 26 | -import static com.lyms.talkonlineweb.util.DateUtil.YYYY_MM_DD; | |
| 27 | 17 | |
| 28 | 18 | /** |
| 29 | 19 | * 获取医院患者信息任务 |
| 30 | 20 | |
| 31 | 21 | |
| 32 | 22 | |
| 33 | 23 | |
| 34 | 24 | |
| 35 | 25 | |
| 36 | 26 | |
| 37 | 27 | |
| 38 | 28 | |
| ... | ... | @@ -62,52 +52,60 @@ |
| 62 | 52 | |
| 63 | 53 | /** |
| 64 | 54 | * 获取医院患者信息。添加到问诊平台患者信息 |
| 65 | - * 10分钟执行一次 | |
| 55 | + * 每小时执行一次获 | |
| 66 | 56 | */ |
| 67 | - // @Scheduled(cron = "0 */10 * * * ?") | |
| 68 | -// @Scheduled(cron = "0 */5 * * * ?")//测试用 | |
| 57 | + @Scheduled(cron = "0 */30 * * * ?") | |
| 69 | 58 | public void getPatientInfo() throws Exception { |
| 70 | 59 | if(!on_off){ |
| 71 | 60 | return; |
| 72 | 61 | } |
| 62 | + log.info("task get qhddeyy his info start ..."); | |
| 73 | 63 | //每次执行时间范围是上一个小时 |
| 74 | - String param = collateTime(); | |
| 64 | + //String param = collateTime(); | |
| 65 | + DateTime startDate = cn.hutool.core.date.DateUtil.offsetHour(new Date(),-3); | |
| 66 | + DateTime endDate = cn.hutool.core.date.DateUtil.offsetHour(new Date(),-1); | |
| 67 | + String startTime = cn.hutool.core.date.DateUtil.formatDateTime(startDate); | |
| 68 | + String endTime = cn.hutool.core.date.DateUtil.formatDateTime(endDate); | |
| 69 | + | |
| 70 | + String param = ("startTime="+startTime+"&endTime="+endTime).replace(" ", "+");; | |
| 75 | 71 | if (StringUtil.isNotEmpty(param)) { |
| 76 | 72 | //返回数据 |
| 77 | 73 | String result = HttpUtil.getData(url + "?" + param); |
| 74 | + log.info("task get qhddeyy his info result ,{}",result); | |
| 78 | 75 | if (StringUtil.isNotEmpty(result)) { |
| 79 | - Map<String, Object> resultMap = JsonUtil.str2Map(result, HashMap.class); | |
| 80 | - if (CollectionUtils.isNotEmpty(resultMap)) { | |
| 81 | - List<Map<String, Object>> listMap = (List<Map<String, Object>>) resultMap.get("patients"); | |
| 82 | - if (CollectionUtils.isNotEmpty(listMap)) { | |
| 83 | - for (Map<String, Object> map : listMap) { | |
| 84 | - //添加到数据后续页面处理 | |
| 85 | - LymsHisInfo hisInfoMap = (LymsHisInfo) BeanUtils.mapToObject(map, LymsHisInfo.class);//map转对象 | |
| 86 | - if (null != hisInfoMap) { | |
| 87 | - //今天添加过不需要重复添加 | |
| 88 | - QueryWrapper qurey = new QueryWrapper(); | |
| 76 | + List<Map<String, Object>> listMap = JsonUtil.str2Obj(result, List.class); | |
| 77 | + for (Map<String, Object> map : listMap) { | |
| 78 | + //添加到数据后续页面处理 | |
| 79 | + LymsHisInfo hisInfoMap = (LymsHisInfo) BeanUtils.mapToObject(map, LymsHisInfo.class);//map转对象 | |
| 80 | + if (null != hisInfoMap) { | |
| 81 | + //今天添加过不需要重复添加 | |
| 82 | + QueryWrapper qurey = new QueryWrapper(); | |
| 83 | + if(StringUtil.isNotEmpty(hisInfoMap.getIdcard())){ | |
| 89 | 84 | qurey.eq("idCard", hisInfoMap.getIdcard()); |
| 90 | - qurey.eq("diagnose", hisInfoMap.getDiagnose()); | |
| 91 | - qurey.eq("hospitalId", hospital); | |
| 92 | - Calendar calendar = Calendar.getInstance(); | |
| 93 | - calendar.setTime(new Date()); | |
| 94 | - calendar.set(Calendar.HOUR_OF_DAY, 00);//时 | |
| 95 | - calendar.set(Calendar.MINUTE, 00);//分 | |
| 96 | - calendar.set(Calendar.SECOND, 00);//秒 | |
| 97 | - qurey.gt("createdtime", calendar.getTime()); | |
| 98 | - List<LymsHisInfo> list = lymsHisInfoService.list(qurey); | |
| 99 | - if (CollectionUtils.isEmpty(list)) { | |
| 100 | - hisInfoMap.setBirthday(StringUtil.isNotEmpty(hisInfoMap.getBirthday()) ? StringUtil.leftTruncate(hisInfoMap.getBirthday(), ' ') : null); | |
| 101 | - hisInfoMap.setUpType(0);//默认未上传 | |
| 102 | - hisInfoMap.setHospitalId(hospital);//医院id | |
| 103 | - lymsHisInfoService.save(hisInfoMap); | |
| 104 | - } | |
| 85 | + }else{ | |
| 86 | + qurey.eq("phone", hisInfoMap.getPhone()); | |
| 105 | 87 | } |
| 88 | + | |
| 89 | + qurey.eq("diagnose", hisInfoMap.getDiagnose()); | |
| 90 | + qurey.eq("hospitalId", hospital); | |
| 91 | + Calendar calendar = Calendar.getInstance(); | |
| 92 | + calendar.setTime(new Date()); | |
| 93 | + calendar.set(Calendar.HOUR_OF_DAY, 00);//时 | |
| 94 | + calendar.set(Calendar.MINUTE, 00);//分 | |
| 95 | + calendar.set(Calendar.SECOND, 00);//秒 | |
| 96 | + qurey.gt("createdtime", calendar.getTime()); | |
| 97 | + List<LymsHisInfo> list = lymsHisInfoService.list(qurey); | |
| 98 | + if (CollectionUtils.isEmpty(list)) { | |
| 99 | + hisInfoMap.setBirthday(StringUtil.isNotEmpty(hisInfoMap.getBirthday()) ? StringUtil.leftTruncate(hisInfoMap.getBirthday(), ' ') : null); | |
| 100 | + hisInfoMap.setUpType(0);//默认未上传 | |
| 101 | + hisInfoMap.setHospitalId(hospital);//医院id | |
| 102 | + lymsHisInfoService.save(hisInfoMap); | |
| 103 | + } | |
| 106 | 104 | } |
| 107 | 105 | } |
| 108 | - } | |
| 109 | 106 | } |
| 110 | 107 | } |
| 108 | + log.info("task get qhddeyy his info end ..."); | |
| 111 | 109 | } |
| 112 | 110 | |
| 113 | 111 | /** |
talkonlineweb/src/main/resources/application-prod.yml
View file @
9087b5e
| ... | ... | @@ -38,11 +38,11 @@ |
| 38 | 38 | #获取医院患者信息配置 |
| 39 | 39 | patient: |
| 40 | 40 | #医院接口地址(String) |
| 41 | - url: https://rp-zk-api.healthbaby.com.cn:8094/his/zkfy/getZkfyPatientList | |
| 41 | + url: http://121.22.117.38:9090/his/getQhddeyyHisList | |
| 42 | 42 | #需要预建医院获得医院名称(String) |
| 43 | - hospitalName: 周口市妇幼保健院 | |
| 43 | + hospitalName: 秦皇岛市第二医院 | |
| 44 | 44 | #需要预建医院获得id(Integer) |
| 45 | - hospital: 16 | |
| 45 | + hospital: 49 | |
| 46 | 46 | |
| 47 | 47 | #孕产婴平台接口地址 |
| 48 | 48 | platform: |