Commit 61fbe24168ed3485d62eed97b9f0d38255922481
1 parent
e40dcda336
Exists in
master
and in
6 other branches
自定义高危
Showing 9 changed files with 293 additions and 9 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/HosptialHighRiskService.java
- platform-dal/src/main/java/com/lyms/platform/pojo/HosptialHighRisk.java
- platform-dal/src/main/java/com/lyms/platform/query/AntExQuery.java
- platform-dal/src/main/java/com/lyms/platform/query/HosptialHighRiskQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/HosptialHighRiskController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/HosptialHighRiskFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/AntexOtherHighRiskWorker.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/AntexcOtherHighRiskWorker.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/HosptialHighRiskService.java
View file @
61fbe24
| ... | ... | @@ -27,6 +27,11 @@ |
| 27 | 27 | |
| 28 | 28 | private LoadingCache<String, HosptialHighRisk> cached=null; |
| 29 | 29 | |
| 30 | + //删除数据 | |
| 31 | + public void deleteHosptialHighRisk(String id) { | |
| 32 | + hosptialHightRiskDao.deleteHosptialHighRisk(id); | |
| 33 | + } | |
| 34 | + | |
| 30 | 35 | public void addHosptialHighRisk(HosptialHighRisk obj) { |
| 31 | 36 | obj.setModifiedDate(System.currentTimeMillis()); |
| 32 | 37 | hosptialHightRiskDao.addHosptialHighRisk(obj); |
platform-dal/src/main/java/com/lyms/platform/pojo/HosptialHighRisk.java
View file @
61fbe24
| ... | ... | @@ -15,15 +15,16 @@ |
| 15 | 15 | |
| 16 | 16 | @Id |
| 17 | 17 | private String id; |
| 18 | - | |
| 18 | + //分数 | |
| 19 | 19 | private String code; |
| 20 | - | |
| 20 | + //名称 | |
| 21 | 21 | private String name; |
| 22 | - | |
| 22 | + //是否有效0-无效,1-有效 | |
| 23 | 23 | private Integer enable; |
| 24 | - | |
| 24 | + //是否有效0-无效,1-有效 | |
| 25 | + private Integer yn; | |
| 26 | + //医院id | |
| 25 | 27 | private String hospitalId; |
| 26 | - | |
| 27 | 28 | private String typeId; |
| 28 | 29 | |
| 29 | 30 | //权重 |
| ... | ... | @@ -34,6 +35,7 @@ |
| 34 | 35 | |
| 35 | 36 | private Integer score; |
| 36 | 37 | private String describe; |
| 38 | + //颜色 | |
| 37 | 39 | private String color; |
| 38 | 40 | |
| 39 | 41 | public Integer getWeight() { |
| ... | ... | @@ -120,7 +122,6 @@ |
| 120 | 122 | this.name = name; |
| 121 | 123 | } |
| 122 | 124 | |
| 123 | - private Integer yn; | |
| 124 | 125 | |
| 125 | 126 | public String getId() { |
| 126 | 127 | return id; |
platform-dal/src/main/java/com/lyms/platform/query/AntExQuery.java
View file @
61fbe24
| ... | ... | @@ -37,6 +37,17 @@ |
| 37 | 37 | |
| 38 | 38 | private Date gteCreated; |
| 39 | 39 | |
| 40 | + //其他高危 | |
| 41 | + private String otherRisk; | |
| 42 | + | |
| 43 | + public String getOtherRisk() { | |
| 44 | + return otherRisk; | |
| 45 | + } | |
| 46 | + | |
| 47 | + public void setOtherRisk(String otherRisk) { | |
| 48 | + this.otherRisk = otherRisk; | |
| 49 | + } | |
| 50 | + | |
| 40 | 51 | public String getCheckDoctor() { |
| 41 | 52 | return checkDoctor; |
| 42 | 53 | } |
| ... | ... | @@ -137,6 +148,10 @@ |
| 137 | 148 | } |
| 138 | 149 | if(null!=id){ |
| 139 | 150 | condition= condition.and("id",id, MongoOper.IS); |
| 151 | + } | |
| 152 | + if(null!=otherRisk){ | |
| 153 | + condition= condition.and("otherRisk",otherRisk, MongoOper.NE); | |
| 154 | + condition= condition.and("otherRisk",true, MongoOper.EXISTS); | |
| 140 | 155 | } |
| 141 | 156 | if(null!=checkDoctor){ |
| 142 | 157 | condition= condition.and("checkDoctor",checkDoctor, MongoOper.IS); |
platform-dal/src/main/java/com/lyms/platform/query/HosptialHighRiskQuery.java
View file @
61fbe24
| ... | ... | @@ -38,6 +38,17 @@ |
| 38 | 38 | // |
| 39 | 39 | private Boolean existweight; |
| 40 | 40 | |
| 41 | + //颜色 | |
| 42 | + private String color; | |
| 43 | + | |
| 44 | + public String getColor() { | |
| 45 | + return color; | |
| 46 | + } | |
| 47 | + | |
| 48 | + public void setColor(String color) { | |
| 49 | + this.color = color; | |
| 50 | + } | |
| 51 | + | |
| 41 | 52 | public String getHospitalId() { |
| 42 | 53 | return hospitalId; |
| 43 | 54 | } |
| ... | ... | @@ -98,6 +109,9 @@ |
| 98 | 109 | |
| 99 | 110 | if (null != typeId) { |
| 100 | 111 | condition = condition.and("typeId", typeId, MongoOper.IS); |
| 112 | + } | |
| 113 | + if (null != color) { | |
| 114 | + condition = condition.and("color", color, MongoOper.IS); | |
| 101 | 115 | } |
| 102 | 116 | if(null!=enable){ |
| 103 | 117 | condition = condition.and("enable", enable, MongoOper.IS); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/HosptialHighRiskController.java
View file @
61fbe24
| 1 | +package com.lyms.platform.operate.web.controller; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.annotation.TokenRequired; | |
| 4 | +import com.lyms.platform.common.base.LoginContext; | |
| 5 | +import com.lyms.platform.common.result.BaseResponse; | |
| 6 | +import com.lyms.platform.operate.web.facade.HosptialHighRiskFacade; | |
| 7 | +import com.lyms.platform.pojo.HosptialHighRisk; | |
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 9 | +import org.springframework.stereotype.Controller; | |
| 10 | +import org.springframework.web.bind.annotation.*; | |
| 11 | + | |
| 12 | +import javax.servlet.http.HttpServletRequest; | |
| 13 | +import javax.validation.Valid; | |
| 14 | + | |
| 15 | +/** | |
| 16 | + * @auther yangfei | |
| 17 | + * @createTime 2017年12月29日 11时01分 | |
| 18 | + * @discription 医院自定义高危 | |
| 19 | + */ | |
| 20 | +@Controller | |
| 21 | +@RequestMapping("/hospHightRisk") | |
| 22 | +public class HosptialHighRiskController { | |
| 23 | + @Autowired | |
| 24 | + private HosptialHighRiskFacade hosptialHighRiskFacade; | |
| 25 | + | |
| 26 | + /** | |
| 27 | + * 添加自定义高危 | |
| 28 | + * | |
| 29 | + * @param request | |
| 30 | + * @return | |
| 31 | + */ | |
| 32 | + @RequestMapping(method = RequestMethod.POST, value = "/addHightRisk") | |
| 33 | + @ResponseBody | |
| 34 | + @TokenRequired | |
| 35 | + public BaseResponse addHightRisk(@Valid @RequestBody HosptialHighRisk request, HttpServletRequest httpServletRequest) { | |
| 36 | + LoginContext loginState = (LoginContext) httpServletRequest.getAttribute("loginContext"); | |
| 37 | + return hosptialHighRiskFacade.addHosptialHighRisk(request, loginState.getId()); | |
| 38 | + } | |
| 39 | + | |
| 40 | + | |
| 41 | + /** | |
| 42 | + * 删除自定义高危 | |
| 43 | + * | |
| 44 | + * @param id | |
| 45 | + * @return | |
| 46 | + */ | |
| 47 | + @RequestMapping(value = "/deleteHightRiskById/{id}", method = RequestMethod.DELETE) | |
| 48 | + @TokenRequired | |
| 49 | + @ResponseBody | |
| 50 | + public BaseResponse deleteHightRiskById(@PathVariable("id") String id, HttpServletRequest request) { | |
| 51 | + return hosptialHighRiskFacade.deleteHosptialHighRiskById(id); | |
| 52 | + | |
| 53 | + } | |
| 54 | + | |
| 55 | + /** | |
| 56 | + * 根据医院获取自定义高危 | |
| 57 | + * @return | |
| 58 | + */ | |
| 59 | + @RequestMapping(value = "/getHightRisk", method = RequestMethod.GET) | |
| 60 | + @TokenRequired | |
| 61 | + @ResponseBody | |
| 62 | + public BaseResponse getHosptialHighRisk(HttpServletRequest request) { | |
| 63 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
| 64 | + return hosptialHighRiskFacade.getHosptialHighRisk(loginState.getId()); | |
| 65 | + } | |
| 66 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
View file @
61fbe24
| ... | ... | @@ -192,6 +192,25 @@ |
| 192 | 192 | return baseResponse; |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | + /** | |
| 196 | + * 孕妇复诊数据自定义高危数据处理 | |
| 197 | + * | |
| 198 | + * @return | |
| 199 | + */ | |
| 200 | + @RequestMapping(value = "/synAntexOtherHighRisk", method = RequestMethod.GET) | |
| 201 | + @ResponseBody | |
| 202 | + public BaseResponse synAntexOtherHighRisk() { | |
| 203 | + AntExQuery antExQuery = new AntExQuery(); | |
| 204 | + antExQuery.setOtherRisk("{}"); | |
| 205 | + int patientCount = antenatalExaminationService.queryAntenatalExaminationCount(antExQuery.convertToQuery()); | |
| 206 | + System.out.println("一共需要处理数据量:" + patientCount); | |
| 207 | + | |
| 208 | + commonThreadPool.execute(new AntexcOtherHighRiskWorker(0, patientCount, antenatalExaminationService, hosptialHighRiskService, basicConfigService, 1000, patientCount)); | |
| 209 | + BaseResponse baseResponse = new BaseResponse(); | |
| 210 | + baseResponse.setErrormsg("一共需要处理数据量:" + patientCount); | |
| 211 | + return baseResponse; | |
| 212 | + } | |
| 213 | + | |
| 195 | 214 | |
| 196 | 215 | /** |
| 197 | 216 | * 儿童建档服务数据处理 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/HosptialHighRiskFacade.java
View file @
61fbe24
| 1 | 1 | package com.lyms.platform.operate.web.facade; |
| 2 | 2 | |
| 3 | 3 | import com.lyms.platform.biz.service.HosptialHighRiskService; |
| 4 | +import com.lyms.platform.common.result.BaseResponse; | |
| 4 | 5 | import com.lyms.platform.pojo.HosptialHighRisk; |
| 6 | +import com.lyms.platform.query.HosptialHighRiskQuery; | |
| 5 | 7 | import org.springframework.beans.factory.annotation.Autowired; |
| 8 | +import org.springframework.stereotype.Component; | |
| 6 | 9 | |
| 10 | +import java.util.List; | |
| 11 | + | |
| 7 | 12 | /** |
| 8 | 13 | * @auther yangfei |
| 9 | 14 | * @createTime 2017年12月28日 15时27分 |
| 10 | 15 | * @discription 医院自定义高危 |
| 11 | 16 | */ |
| 17 | +@Component | |
| 12 | 18 | public class HosptialHighRiskFacade { |
| 13 | 19 | @Autowired |
| 14 | 20 | private HosptialHighRiskService hosptialHighRiskService; |
| 21 | + @Autowired | |
| 22 | + private AutoMatchFacade autoMatchFacade; | |
| 15 | 23 | |
| 16 | 24 | /** |
| 17 | 25 | * 新增自定义高危 |
| 18 | 26 | * @param hosptialHighRisk |
| 19 | 27 | * @return |
| 20 | 28 | */ |
| 21 | - public boolean addHosptialHighRisk(HosptialHighRisk hosptialHighRisk){ | |
| 29 | + public BaseResponse addHosptialHighRisk(HosptialHighRisk hosptialHighRisk, int userId){ | |
| 30 | + BaseResponse baseResponse = new BaseResponse(); | |
| 31 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
| 32 | + hosptialHighRisk.setHospitalId(hospitalId); | |
| 22 | 33 | hosptialHighRiskService.addHosptialHighRisk(hosptialHighRisk); |
| 23 | - return true; | |
| 34 | + return baseResponse; | |
| 24 | 35 | } |
| 25 | 36 | |
| 37 | + /** | |
| 38 | + * 根据用户id查询自定义高危 | |
| 39 | + * @param userId 当前登录用户id | |
| 40 | + * @return | |
| 41 | + */ | |
| 42 | + public BaseResponse getHosptialHighRisk(int userId){ | |
| 43 | + BaseResponse baseResponse = new BaseResponse(); | |
| 44 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
| 45 | + HosptialHighRiskQuery hosptialHighRiskQuery = new HosptialHighRiskQuery(); | |
| 46 | + hosptialHighRiskQuery.setHospitalId(hospitalId); | |
| 47 | + List<HosptialHighRisk> hosptialHighRisks = hosptialHighRiskService.queryHosptialHighRisk(hosptialHighRiskQuery); | |
| 48 | + baseResponse.setObject(hosptialHighRisks); | |
| 49 | + return baseResponse; | |
| 50 | + } | |
| 26 | 51 | |
| 52 | + /** | |
| 53 | + * 根据Id,删除自定义高危 | |
| 54 | + * @param id | |
| 55 | + * @return | |
| 56 | + */ | |
| 57 | + public BaseResponse deleteHosptialHighRiskById(String id) { | |
| 58 | + BaseResponse baseResponse = new BaseResponse(); | |
| 59 | + hosptialHighRiskService.deleteHosptialHighRisk(id); | |
| 60 | + return baseResponse; | |
| 61 | + } | |
| 27 | 62 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/AntexOtherHighRiskWorker.java
View file @
61fbe24
| 1 | +package com.lyms.platform.operate.web.worker; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.service.AntenatalExaminationService; | |
| 4 | +import com.lyms.platform.biz.service.BasicConfigService; | |
| 5 | +import com.lyms.platform.biz.service.HosptialHighRiskService; | |
| 6 | +import com.lyms.platform.common.enums.YnEnums; | |
| 7 | +import com.lyms.platform.common.utils.JsonUtil; | |
| 8 | +import com.lyms.platform.common.utils.StringUtils; | |
| 9 | +import com.lyms.platform.operate.web.utils.CollectionUtils; | |
| 10 | +import com.lyms.platform.operate.web.utils.FunvCommonUtil; | |
| 11 | +import com.lyms.platform.pojo.AntenatalExaminationModel; | |
| 12 | +import com.lyms.platform.pojo.HosptialHighRisk; | |
| 13 | +import com.lyms.platform.query.AntExQuery; | |
| 14 | +import com.lyms.platform.query.HosptialHighRiskQuery; | |
| 15 | + | |
| 16 | +import java.util.HashMap; | |
| 17 | +import java.util.List; | |
| 18 | +import java.util.Map; | |
| 19 | + | |
| 20 | +/** | |
| 21 | + * @auther yangfei | |
| 22 | + * @createTime 2017年11月22日 11时28分 | |
| 23 | + * @discription 复诊自定义高危数据处理 | |
| 24 | + */ | |
| 25 | +public class AntexOtherHighRiskWorker implements Runnable { | |
| 26 | + private int startIndex; | |
| 27 | + private int endIndex; | |
| 28 | + private int batchSize; | |
| 29 | + private int allCount; | |
| 30 | + private AntenatalExaminationService antenatalExaminationService; | |
| 31 | + private HosptialHighRiskService hosptialHighRiskService; | |
| 32 | + private BasicConfigService basicConfigService; | |
| 33 | + | |
| 34 | + public AntexOtherHighRiskWorker(int startIndex, int endIndex, AntenatalExaminationService antenatalExaminationService, HosptialHighRiskService hosptialHighRiskService, BasicConfigService basicConfigService, int batchSize, int allCount) { | |
| 35 | + this.allCount = allCount; | |
| 36 | + this.startIndex = startIndex; | |
| 37 | + this.endIndex = endIndex; | |
| 38 | + this.antenatalExaminationService = antenatalExaminationService; | |
| 39 | + this.hosptialHighRiskService = hosptialHighRiskService; | |
| 40 | + this.basicConfigService = basicConfigService; | |
| 41 | + if (batchSize >= 1000) { | |
| 42 | + this.batchSize = 1000; | |
| 43 | + } else { | |
| 44 | + this.batchSize = batchSize; | |
| 45 | + } | |
| 46 | + } | |
| 47 | + | |
| 48 | + /** | |
| 49 | + * Computes a result, or throws an exception if unable to do so. | |
| 50 | + * | |
| 51 | + * @return computed result | |
| 52 | + */ | |
| 53 | + @Override | |
| 54 | + public void run() { | |
| 55 | + try { | |
| 56 | + Map<String, Integer> patientsMap = new HashMap<>(); | |
| 57 | + | |
| 58 | + for (int i = startIndex; i < endIndex; i += batchSize) { | |
| 59 | + AntExQuery antExQuery = new AntExQuery(); | |
| 60 | + antExQuery.setOtherRisk("{}"); | |
| 61 | + antExQuery.setLimit(batchSize); | |
| 62 | + antExQuery.setPage((i + batchSize) / batchSize); | |
| 63 | + | |
| 64 | + List<AntenatalExaminationModel> antExChuModels = antenatalExaminationService.queryLastAntenatalExamination(antExQuery.convertToQuery()); | |
| 65 | + System.out.println("查询数据" + antExChuModels.size()); | |
| 66 | + for (AntenatalExaminationModel chu : antExChuModels) { | |
| 67 | + System.out.println(chu.getOtherRisk()); | |
| 68 | + String otherHighRisk = chu.getOtherRisk(); | |
| 69 | + String hospital = chu.getHospitalId(); | |
| 70 | + String color = ""; | |
| 71 | + String pingfen = ""; | |
| 72 | + String yinsu = ""; | |
| 73 | + | |
| 74 | + Map<String, String> otherMap = JsonUtil.jkstr2Obj(otherHighRisk, Map.class); | |
| 75 | + if (otherMap != null) { | |
| 76 | + if (StringUtils.isNotEmpty(otherMap.get("fyyse"))) { | |
| 77 | + color = otherMap.get("fyyse").toString(); | |
| 78 | + // color = FunvCommonUtil.getBaseicConfigByid(id, basicConfigService); | |
| 79 | + // if (color.indexOf("预警") > -1) { | |
| 80 | + // color = color.replace("预警", ""); | |
| 81 | + // } | |
| 82 | + } else { | |
| 83 | + continue; | |
| 84 | + } | |
| 85 | + if (StringUtils.isNotEmpty(otherMap.get("fxpf"))) { | |
| 86 | + String id = otherMap.get("fxpf").toString(); | |
| 87 | + pingfen = FunvCommonUtil.getBaseicConfigByid(id, basicConfigService); | |
| 88 | + } else { | |
| 89 | + continue; | |
| 90 | + } | |
| 91 | + if (StringUtils.isNotEmpty(otherMap.get("fxysu"))) { | |
| 92 | + yinsu = otherMap.get("fxysu").toString(); | |
| 93 | + } else { | |
| 94 | + continue; | |
| 95 | + } | |
| 96 | + } else { | |
| 97 | + continue; | |
| 98 | + } | |
| 99 | + | |
| 100 | + HosptialHighRiskQuery hosptialHighRiskQuery = new HosptialHighRiskQuery(); | |
| 101 | + hosptialHighRiskQuery.setHospitalId(hospital); | |
| 102 | + hosptialHighRiskQuery.setColor(color); | |
| 103 | + hosptialHighRiskQuery.setName(yinsu); | |
| 104 | + | |
| 105 | + List<HosptialHighRisk> hosptialHighRisks = hosptialHighRiskService.queryHosptialHighRisk(hosptialHighRiskQuery); | |
| 106 | + if (CollectionUtils.isEmpty(hosptialHighRisks)) { | |
| 107 | + HosptialHighRisk hosptialHighRisk = new HosptialHighRisk(); | |
| 108 | + hosptialHighRisk.setHospitalId(hospital); | |
| 109 | + hosptialHighRisk.setCode(pingfen); | |
| 110 | + hosptialHighRisk.setName(yinsu); | |
| 111 | + hosptialHighRisk.setEnable(YnEnums.YES.getId()); | |
| 112 | + hosptialHighRisk.setYn(YnEnums.YES.getId()); | |
| 113 | + hosptialHighRisk.setColor(color); | |
| 114 | + hosptialHighRiskService.addHosptialHighRisk(hosptialHighRisk); | |
| 115 | + } | |
| 116 | + } | |
| 117 | + | |
| 118 | + | |
| 119 | + System.out.println("总数据量:" + allCount + ",正在处理第:" + i + "--到--" + (i + batchSize) + ",page:" + antExQuery.getPage() + ",limit:" + antExQuery.getLimit()); | |
| 120 | + | |
| 121 | + | |
| 122 | + System.out.println("线程处理数据完成,开始条数:" + startIndex + ",结束条数:" + endIndex + ",map:" + patientsMap.size()); | |
| 123 | + } | |
| 124 | + } catch (Exception e) { | |
| 125 | + e.printStackTrace(); | |
| 126 | + } | |
| 127 | + } | |
| 128 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/AntexcOtherHighRiskWorker.java
View file @
61fbe24
| ... | ... | @@ -61,7 +61,7 @@ |
| 61 | 61 | antExChuQuery1.setLimit(batchSize); |
| 62 | 62 | antExChuQuery1.setPage((i + batchSize) / batchSize); |
| 63 | 63 | |
| 64 | - List<AntExChuModel> antExChuModels = antenatalExaminationService.queryAntExChu(antExChuQuery1.convertToQuery()); | |
| 64 | + List<AntExChuModel> antExChuModels = antenatalExaminationService.queryAntExChu(antExChuQuery1); | |
| 65 | 65 | System.out.println("查询数据" + antExChuModels.size()); |
| 66 | 66 | for (AntExChuModel chu : antExChuModels) { |
| 67 | 67 | System.out.println(chu.getOtherHighRisk()); |
| ... | ... | @@ -99,6 +99,7 @@ |
| 99 | 99 | |
| 100 | 100 | HosptialHighRiskQuery hosptialHighRiskQuery = new HosptialHighRiskQuery(); |
| 101 | 101 | hosptialHighRiskQuery.setHospitalId(hospital); |
| 102 | + hosptialHighRiskQuery.setColor(color); | |
| 102 | 103 | hosptialHighRiskQuery.setName(yinsu); |
| 103 | 104 | |
| 104 | 105 | List<HosptialHighRisk> hosptialHighRisks = hosptialHighRiskService.queryHosptialHighRisk(hosptialHighRiskQuery); |