Commit 10876d6a5c992ff863f59231e7ab0f459fcd8f3f

Authored by liquanyu
1 parent ae89328563

update code

Showing 8 changed files with 328 additions and 8 deletions

platform-dal/src/main/java/com/lyms/platform/beans/SerialIdEnum.java View file @ 10876d6
... ... @@ -29,6 +29,7 @@
29 29 TrackDayConfig("TrackDayConfig", 97531320170L),
30 30 BCInventoryModel("BCInventoryModel", 97531000110L),
31 31 TrackCountRecord("TrackCountRecord", 92231000110L),
  32 + AutoRiskRecord("AutoRiskRecord", 97231000110L),
32 33 BCTransferInHistoryModel("BCTransferInHistoryModel", 97531000120L),
33 34 CommunityConfig("CommunityConfig", 97531000130L),
34 35 CommunityModel("CommunityModel", 97531000140L),
platform-dal/src/main/java/com/lyms/platform/pojo/AutoRiskRecord.java View file @ 10876d6
  1 +package com.lyms.platform.pojo;
  2 +
  3 +import com.lyms.platform.beans.SerialIdEnum;
  4 +import com.lyms.platform.common.result.BaseModel;
  5 +import org.springframework.data.mongodb.core.mapping.Document;
  6 +
  7 +import java.util.Date;
  8 +import java.util.List;
  9 +
  10 +
  11 +/**
  12 + * 处方报表基础项配置
  13 + */
  14 +@Document(collection="lyms_auto_risk_record")
  15 +public class AutoRiskRecord extends BaseModel {
  16 +
  17 + private static final long serialVersionUID = SerialIdEnum.TrackCountRecord.getCid();
  18 +
  19 + private String id;
  20 + private String fid;
  21 + private String hospitalId;
  22 + private String pid;
  23 + private String patientId;
  24 + //高危评分
  25 + private Integer hScore;
  26 + //高危等级
  27 + private List hLevel;
  28 + //风险因素
  29 + private List hRisk;
  30 + private Date created;
  31 + private Date modified;
  32 + //状态 0 未确认 已经确认
  33 + private Integer status;
  34 + //诊断来源 0建档 1产检
  35 + private Integer type;
  36 +
  37 + public String getId() {
  38 + return id;
  39 + }
  40 +
  41 + public void setId(String id) {
  42 + this.id = id;
  43 + }
  44 +
  45 + public String getFid() {
  46 + return fid;
  47 + }
  48 +
  49 + public void setFid(String fid) {
  50 + this.fid = fid;
  51 + }
  52 +
  53 + public String getHospitalId() {
  54 + return hospitalId;
  55 + }
  56 +
  57 + public void setHospitalId(String hospitalId) {
  58 + this.hospitalId = hospitalId;
  59 + }
  60 +
  61 + public String getPid() {
  62 + return pid;
  63 + }
  64 +
  65 + public void setPid(String pid) {
  66 + this.pid = pid;
  67 + }
  68 +
  69 + public String getPatientId() {
  70 + return patientId;
  71 + }
  72 +
  73 + public void setPatientId(String patientId) {
  74 + this.patientId = patientId;
  75 + }
  76 +
  77 + public Integer gethScore() {
  78 + return hScore;
  79 + }
  80 +
  81 + public void sethScore(Integer hScore) {
  82 + this.hScore = hScore;
  83 + }
  84 +
  85 + public List gethLevel() {
  86 + return hLevel;
  87 + }
  88 +
  89 + public void sethLevel(List hLevel) {
  90 + this.hLevel = hLevel;
  91 + }
  92 +
  93 + public List gethRisk() {
  94 + return hRisk;
  95 + }
  96 +
  97 + public void sethRisk(List hRisk) {
  98 + this.hRisk = hRisk;
  99 + }
  100 +
  101 + public Date getCreated() {
  102 + return created;
  103 + }
  104 +
  105 + public void setCreated(Date created) {
  106 + this.created = created;
  107 + }
  108 +
  109 + public Date getModified() {
  110 + return modified;
  111 + }
  112 +
  113 + public void setModified(Date modified) {
  114 + this.modified = modified;
  115 + }
  116 +
  117 + public Integer getStatus() {
  118 + return status;
  119 + }
  120 +
  121 + public void setStatus(Integer status) {
  122 + this.status = status;
  123 + }
  124 +
  125 + public Integer getType() {
  126 + return type;
  127 + }
  128 +
  129 + public void setType(Integer type) {
  130 + this.type = type;
  131 + }
  132 +
  133 +
  134 +
  135 +
  136 +
  137 +
  138 +}
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/AntenatalExaminationController.java View file @ 10876d6
... ... @@ -400,7 +400,7 @@
400 400 @RequestMapping(method = RequestMethod.POST, value = "/getAntexExRisk")
401 401 @ResponseBody
402 402 @TokenRequired
403   - public BaseResponse getAntexExRisk(@Valid @RequestBody AntExcAddRequest antExcAddRequest, HttpServletRequest request) {
  403 + public BaseResponse getAntexExRisk(@Valid @RequestBody AutoRiskRequest antExcAddRequest, HttpServletRequest request) {
404 404 LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
405 405 BaseResponse baseResponse = antenatalExaminationFacade.getAntexExRisk(antExcAddRequest, loginState.getId());
406 406 return baseResponse;
... ... @@ -497,7 +497,20 @@
497 497 return antExRecordFacade.getActualReport(checkTime,getUserId(request));
498 498 }
499 499  
500   -
  500 + /**
  501 + * 自动诊断列表
  502 + * @param antExManagerQueryRequest
  503 + * @param request
  504 + * @return
  505 + */
  506 + @RequestMapping(method = RequestMethod.POST, value = "/getAutoRiskRecord")
  507 + @ResponseBody
  508 + @TokenRequired
  509 + public BaseResponse getAutoRiskRecord(@Valid AntExManagerQueryRequest antExManagerQueryRequest, HttpServletRequest request) {
  510 + LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
  511 + BaseResponse baseResponse = antenatalExaminationFacade.getAutoRiskRecord(antExManagerQueryRequest, loginState.getId());
  512 + return baseResponse;
  513 + }
501 514  
502 515  
503 516 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java View file @ 10876d6
... ... @@ -9,8 +9,10 @@
9 9 import com.lyms.platform.biz.dal.ISieveDao;
10 10 import com.lyms.platform.biz.service.*;
11 11 import com.lyms.platform.common.constants.ErrorCodeConstants;
  12 +import com.lyms.platform.common.dao.BaseQuery;
12 13 import com.lyms.platform.common.dao.operator.MongoQuery;
13 14 import com.lyms.platform.common.enums.*;
  15 +import com.lyms.platform.common.result.BaseListResponse;
14 16 import com.lyms.platform.common.result.BaseObjectResponse;
15 17 import com.lyms.platform.common.result.BaseResponse;
16 18 import com.lyms.platform.common.utils.*;
17 19  
18 20  
19 21  
20 22  
... ... @@ -4124,12 +4126,81 @@
4124 4126 }
4125 4127  
4126 4128  
4127   - public BaseResponse getAntexExRisk(AntExcAddRequest antExcAddRequest, Integer userId) {
  4129 + public void autoPatientRisk(Patients pat,Integer userId)
  4130 + {
  4131 + AutoRiskRequest autoRiskRequest = new AutoRiskRequest();
  4132 + autoRiskRequest.setParentId(pat.getId());
  4133 + List<Map<String, String>> riskList = autoRisk(autoRiskRequest, pat.getHospitalId());
  4134 + saveAutoRisk(riskList,null,pat.getHospitalId(),pat.getPid(),pat.getId(),0);
  4135 + }
4128 4136  
4129   - Set<String> list = new HashSet<>();
4130 4137  
  4138 + /**
  4139 + *
  4140 + * @param risks 高危因素
  4141 + * @param fid 产检id(初诊、复诊)
  4142 + * @param hospitalId 医院id
  4143 + * @param pid
  4144 + * @param patientId
  4145 + * @param type 0 建档诊断 1产检诊断
  4146 + */
  4147 + private void saveAutoRisk(List<Map<String, String>> risks,String fid,String hospitalId,String pid,String patientId,Integer type)
  4148 + {
  4149 + if (CollectionUtils.isNotEmpty(risks))
  4150 + {
  4151 + List rLevel = new ArrayList();
  4152 + List hRisk = new ArrayList();
  4153 + Integer score = 0;
  4154 + for(Map<String, String> risk : risks)
  4155 + {
  4156 + rLevel.add(risk.get("riskLevel"));
  4157 + hRisk.add(risk.get("id"));
  4158 + score+= StringUtils.isNotEmpty(risk.get("code")) ? Integer.parseInt(risk.get("code")) : 0;
  4159 + }
  4160 + AutoRiskRecord riskRecord = new AutoRiskRecord();
  4161 + riskRecord.setPatientId(patientId);
  4162 + riskRecord.setFid(fid);
  4163 + riskRecord.setPid(pid);
  4164 + riskRecord.setHospitalId(hospitalId);
  4165 + riskRecord.setStatus(0);
  4166 + riskRecord.setType(type);
  4167 + riskRecord.sethRisk(hRisk);
  4168 + riskRecord.sethLevel(rLevel);
  4169 + riskRecord.sethScore(score);
  4170 + riskRecord.setCreated(new Date());
  4171 + riskRecord.setModified(new Date());
  4172 + mongoTemplate.save(riskRecord);
  4173 +
  4174 + }
  4175 +
  4176 + }
  4177 +
  4178 +
  4179 + /**
  4180 + *
  4181 + * 由初诊页面调用该方法
  4182 + * 初诊自动判定高危因素
  4183 + * @param antExcAddRequest
  4184 + * @param userId
  4185 + * @return
  4186 + */
  4187 + public BaseResponse getAntexExRisk(AutoRiskRequest antExcAddRequest, Integer userId) {
4131 4188 String hospitalId = autoMatchFacade.getHospitalId(userId);
  4189 + List<Map<String, String>> riskList = autoRisk(antExcAddRequest,hospitalId);
4132 4190  
  4191 + return new BaseObjectResponse().setData(riskList).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  4192 + }
  4193 +
  4194 + /**
  4195 + * 自动判定高危因素
  4196 + * @param antExcAddRequest
  4197 + * @param hospitalId
  4198 + * @return
  4199 + */
  4200 + private List<Map<String, String>> autoRisk(AutoRiskRequest antExcAddRequest,String hospitalId)
  4201 + {
  4202 + Set<String> list = new HashSet<>();
  4203 +
4133 4204 DiagnoseConfigQuery diagnoseConfigQuery = new DiagnoseConfigQuery();
4134 4205 diagnoseConfigQuery.setHospitalId(hospitalId);
4135 4206 List<DiagnoseConfigModel> configModels = diagnoseConfigService.queryDiagnoseConfigs(diagnoseConfigQuery);
... ... @@ -4143,7 +4214,7 @@
4143 4214 List<Map<String, String>> configs = model.getConfigs();
4144 4215  
4145 4216 if (model == null || "0".equals(model.getEnable()) || configs == null || configs.size() == 0) {
4146   - return new BaseObjectResponse().setData(riskList).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  4217 + return riskList;
4147 4218 }
4148 4219 if (CollectionUtils.isNotEmpty(configs)) {
4149 4220 for (Map<String, String> map : configs) {
... ... @@ -5247,8 +5318,7 @@
5247 5318 }
5248 5319 riskList = diagnoseConfigFacde.getRiskName(ids);
5249 5320 }
5250   -
5251   - return new BaseObjectResponse().setData(riskList).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  5321 + return riskList;
5252 5322 }
5253 5323  
5254 5324  
... ... @@ -5344,6 +5414,71 @@
5344 5414 return mapItems;
5345 5415 }
5346 5416  
  5417 +
  5418 + public BaseResponse getAutoRiskRecord(AntExManagerQueryRequest antExManagerQueryRequest, Integer id) {
  5419 +
  5420 + PatientsQuery patientsQuery = new PatientsQuery();
  5421 + List<Patients> patientses = null;
  5422 + if (StringUtils.isNotEmpty(antExManagerQueryRequest.getQueryNo())) {
  5423 + patientsQuery.setQueryNo(antExManagerQueryRequest.getQueryNo());
  5424 + patientses = patientsService.queryPatient1(patientsQuery, "created");
  5425 + }
  5426 +
  5427 + List<String> patientIds = new ArrayList<>();
  5428 + if (CollectionUtils.isNotEmpty(patientses))
  5429 + {
  5430 + for (Patients pat : patientses)
  5431 + {
  5432 + patientIds.add(pat.getId());
  5433 + }
  5434 + }
  5435 +
  5436 + Query query = new Query();
  5437 + if (CollectionUtils.isNotEmpty(patientIds)) {
  5438 + query.addCriteria(Criteria.where("patientId").in(patientIds));
  5439 + }
  5440 + if (StringUtils.isNotEmpty(antExManagerQueryRequest.getAutoTime())) {
  5441 + String[] arrs = antExManagerQueryRequest.getAutoTime().split(" - ");
  5442 + Date startDate = DateUtil.parseYMD(arrs[0]);
  5443 + Date dayFirstSecond = DateUtil.getDayFirstSecond(startDate);
  5444 + Date endDate = DateUtil.parseYMD(arrs[1]);
  5445 + Date dayLastSecond = DateUtil.getDayLastSecond(endDate);
  5446 + query.addCriteria(Criteria.where("created").gte(dayFirstSecond).lte(dayLastSecond));
  5447 + }
  5448 + if (antExManagerQueryRequest.getStatus() != null) {
  5449 + query.addCriteria(Criteria.where("status").in(antExManagerQueryRequest.getStatus()));
  5450 + }
  5451 +
  5452 + long count = mongoTemplate.count(query, AutoRiskRecord.class);
  5453 +
  5454 + BaseQuery baseQuery = new BaseQuery();
  5455 + baseQuery.mysqlBuild((int)count);
  5456 + query.skip(antExManagerQueryRequest.getPage()).limit(antExManagerQueryRequest.getLimit());
  5457 + List riskList = new ArrayList();
  5458 + List<AutoRiskRecord> models = mongoTemplate.find(query.with(new Sort(Sort.Direction.DESC, "created")), AutoRiskRecord.class);
  5459 + if (CollectionUtils.isNotEmpty(models))
  5460 + {
  5461 + for(AutoRiskRecord model : models)
  5462 + {
  5463 + Map map = new HashMap();
  5464 + map.put("id",model.getId());
  5465 +
  5466 + Patients pat = patientsService.findOnePatientById(model.getPatientId());
  5467 + map.put("name",pat.getUsername());
  5468 + map.put("cardNo",pat.getCardNo());
  5469 + map.put("phone",pat.getPhone());
  5470 + map.put("autoTime",DateUtil.getyyyy_MM_dd(model.getCreated()));
  5471 + map.put("week",DateUtil.getWeekDesc(pat.getLastMenses(), model.getCreated()));
  5472 + map.put("riskLevel",commonService.findRiskLevel(model.gethLevel()));
  5473 + String risk = commonService.resloveFactor(model.gethRisk());
  5474 +
  5475 + map.put("risk",risk);
  5476 + map.put("score",model.gethScore());
  5477 + map.put("score",model.getStatus() == 0 ? "未确诊" : "已确诊");
  5478 + }
  5479 + }
  5480 + return new BaseListResponse().setData(riskList).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setPageInfo(baseQuery.getPageInfo());
  5481 + }
5347 5482  
5348 5483 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java View file @ 10876d6
... ... @@ -194,6 +194,7 @@
194 194 @Autowired
195 195 private IBasicConfigDao basicConfigDao;
196 196  
  197 +
197 198 public static final String syncToV2Url = PropertiesUtils.getPropertyValue("sync_to_v2_url");
198 199  
199 200  
... ... @@ -215,7 +216,7 @@
215 216 * @return
216 217 */
217 218 public BaseObjectResponse addPregnantBookbuilding(
218   - YunBookbuildingAddRequest yunRequest, Integer userId, boolean isSync) {
  219 + YunBookbuildingAddRequest yunRequest, final Integer userId, boolean isSync) {
219 220  
220 221 BaseObjectResponse br = new BaseObjectResponse();
221 222 PatientsQuery patientsQuery = new PatientsQuery();
... ... @@ -485,6 +486,9 @@
485 486 yunBookbuildingService.updatePregnant(patients, tempP.getId());
486 487 }
487 488 }
  489 + //自动诊断
  490 + antenatalExaminationFacade.autoPatientRisk(patient,userId);
  491 +
488 492 }
489 493 });
490 494  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/DiagnoseConfigFacde.java View file @ 10876d6
... ... @@ -265,6 +265,7 @@
265 265 name = "紫色";
266 266 }
267 267 map.put("color", "risk_" + RiskDefaultTypeEnum.getColor(name));
  268 + map.put("riskLevel", basicConfigs2.get(0).getId());
268 269 }
269 270  
270 271 list.add(map);
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/AntExManagerQueryRequest.java View file @ 10876d6
... ... @@ -86,6 +86,27 @@
86 86 //是否有处理意见 0否 1是
87 87 private Integer isOpinion;
88 88  
  89 + //自动诊断试剂
  90 + private String autoTime;
  91 +
  92 + private String status;
  93 +
  94 + public String getStatus() {
  95 + return status;
  96 + }
  97 +
  98 + public void setStatus(String status) {
  99 + this.status = status;
  100 + }
  101 +
  102 + public String getAutoTime() {
  103 + return autoTime;
  104 + }
  105 +
  106 + public void setAutoTime(String autoTime) {
  107 + this.autoTime = autoTime;
  108 + }
  109 +
89 110 public String getTreatOpinion() {
90 111 return treatOpinion;
91 112 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/AutoRiskRequest.java View file @ 10876d6
  1 +package com.lyms.platform.operate.web.request;
  2 +
  3 +/**
  4 + * Created by Administrator on 2020/2/13.
  5 + */
  6 +public class AutoRiskRequest extends AntExcAddRequest {
  7 +}