Commit 97a862cfaafa6aa22b78f70399cba67a4d5433dd

Authored by liquanyu
1 parent a18c634263
Exists in master and in 1 other branch dev

update code

Showing 11 changed files with 630 additions and 14 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/LisCrisisNotifyDao.java View file @ 97a862c
  1 +package com.lyms.platform.biz.dal;
  2 +
  3 +import com.lyms.platform.common.dao.operator.MongoQuery;
  4 +import com.lyms.platform.pojo.LisCrisisNotify;
  5 +
  6 +import java.util.List;
  7 +
  8 +/**
  9 + * Created by Administrator on 2016/10/19 0019.
  10 + */
  11 +public interface LisCrisisNotifyDao {
  12 +
  13 + public LisCrisisNotify addLisCrisisNotify(LisCrisisNotify obj);
  14 +
  15 + public LisCrisisNotify getLisCrisisNotify(String id);
  16 +
  17 + public int queryLisCrisisNotifyCount(MongoQuery query);
  18 +
  19 + public List<LisCrisisNotify> queryLisCrisisNotify(MongoQuery query);
  20 +
  21 + public void updateLisCrisisNotify(LisCrisisNotify obj, String id);
  22 + public void updateMultiLisCrisisNotify(LisCrisisNotify obj, MongoQuery query);
  23 +
  24 +}
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/LisCrisisNotifyDaoImpl.java View file @ 97a862c
  1 +package com.lyms.platform.biz.dal.impl;
  2 +
  3 +import com.lyms.platform.biz.dal.LisCrisisNotifyDao;
  4 +import com.lyms.platform.common.dao.BaseMongoDAOImpl;
  5 +import com.lyms.platform.common.dao.operator.MongoCondition;
  6 +import com.lyms.platform.common.dao.operator.MongoOper;
  7 +import com.lyms.platform.common.dao.operator.MongoQuery;
  8 +import com.lyms.platform.pojo.LisCrisisNotify;
  9 +import org.springframework.stereotype.Repository;
  10 +
  11 +import java.util.List;
  12 +
  13 +/**
  14 + * Created by Administrator on 2016/10/19 0019.
  15 + */
  16 +@Repository("lisCrisisNotifyDao")
  17 +public class LisCrisisNotifyDaoImpl extends BaseMongoDAOImpl<LisCrisisNotify> implements LisCrisisNotifyDao {
  18 +
  19 + @Override
  20 + public LisCrisisNotify addLisCrisisNotify(LisCrisisNotify obj) {
  21 + return save(obj);
  22 + }
  23 +
  24 + @Override
  25 + public LisCrisisNotify getLisCrisisNotify(String id) {
  26 + return findById(id);
  27 + }
  28 +
  29 + @Override
  30 + public int queryLisCrisisNotifyCount(MongoQuery query) {
  31 + return (int) count(query.convertToMongoQuery());
  32 + }
  33 +
  34 + @Override
  35 + public List<LisCrisisNotify> queryLisCrisisNotify(MongoQuery query) {
  36 + return find(query.convertToMongoQuery());
  37 + }
  38 +
  39 + @Override
  40 + public void updateLisCrisisNotify(LisCrisisNotify obj, String id) {
  41 + update(new MongoQuery(new MongoCondition("id", id, MongoOper.IS)).convertToMongoQuery(), obj);
  42 + }
  43 +
  44 + @Override
  45 + public void updateMultiLisCrisisNotify(LisCrisisNotify obj, MongoQuery query) {
  46 + updateMulti(query.convertToMongoQuery(), obj);
  47 + }
  48 +}
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/LisCrisisNotifyService.java View file @ 97a862c
  1 +package com.lyms.platform.biz.service;
  2 +
  3 +import com.lyms.platform.biz.dal.LisCrisisNotifyDao;
  4 +import com.lyms.platform.common.dao.operator.MongoQuery;
  5 +import com.lyms.platform.pojo.LisCrisisNotify;
  6 +import com.lyms.platform.query.LisCrisisNotifyQuery;
  7 +import org.apache.commons.lang.StringUtils;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.data.domain.Sort;
  10 +import org.springframework.stereotype.Service;
  11 +
  12 +import java.util.List;
  13 +
  14 +/**
  15 + * Created by Administrator on 2016/10/19 0019.
  16 + */
  17 +@Service("lisCrisisNotifyService")
  18 +public class LisCrisisNotifyService {
  19 +
  20 + @Autowired
  21 + private LisCrisisNotifyDao lisCrisisNotifyDao;
  22 +
  23 + public LisCrisisNotify addLisCrisisNotify(LisCrisisNotify obj) {
  24 + return lisCrisisNotifyDao.addLisCrisisNotify(obj);
  25 + }
  26 +
  27 + public LisCrisisNotify getLisCrisisNotify(String id) {
  28 + return lisCrisisNotifyDao.getLisCrisisNotify(id);
  29 + }
  30 +
  31 + public List<LisCrisisNotify> query(LisCrisisNotifyQuery query) {
  32 + MongoQuery mongoQuery = query.convertToQuery();
  33 + if (StringUtils.isNotEmpty(query.getNeed())) {
  34 + query.mysqlBuild(lisCrisisNotifyDao.queryLisCrisisNotifyCount(mongoQuery));
  35 + mongoQuery.start(query.getOffset()).end(query.getLimit());
  36 + }
  37 + return lisCrisisNotifyDao.queryLisCrisisNotify(mongoQuery.addOrder(Sort.Direction.DESC, "created"));
  38 + }
  39 +
  40 + public Integer queryCount(LisCrisisNotifyQuery query) {
  41 + MongoQuery mongoQuery = query.convertToQuery();
  42 + return lisCrisisNotifyDao.queryLisCrisisNotifyCount(mongoQuery);
  43 + }
  44 +
  45 + public void updateLisCrisisNotify(LisCrisisNotify obj, String id) {
  46 + lisCrisisNotifyDao.updateLisCrisisNotify(obj, id);
  47 + }
  48 +
  49 + public void updateMultiLisCrisisNotify(LisCrisisNotify obj, LisCrisisNotifyQuery query)
  50 + {
  51 + lisCrisisNotifyDao.updateMultiLisCrisisNotify(obj,query.convertToQuery());
  52 + }
  53 +
  54 +}
platform-dal/src/main/java/com/lyms/platform/beans/SerialIdEnum.java View file @ 97a862c
... ... @@ -29,6 +29,7 @@
29 29 HighRiskSmsModel("HighRiskSmsModel", 97531000210L),
30 30 HwModel("HwModel", 97531000220L),
31 31 LisCrisisItem("LisCrisisItem", 97531000230L),
  32 + LisCrisisNotify("LisCrisisNotify", 97231000230L),
32 33 LisReport("LisReport", 97531000240L),
33 34 MaternalDeliverModel("MaternalDeliverModel", 97531000250L),
34 35 Patients("Patients", 97531000260L),
platform-dal/src/main/java/com/lyms/platform/pojo/LisCrisisItem.java View file @ 97a862c
... ... @@ -43,6 +43,16 @@
43 43 private Integer week;
44 44 private String pid;
45 45 private String patientId;
  46 + //同步状态 0未同步 1同步
  47 + private Integer syncStatus;
  48 +
  49 + public Integer getSyncStatus() {
  50 + return syncStatus;
  51 + }
  52 +
  53 + public void setSyncStatus(Integer syncStatus) {
  54 + this.syncStatus = syncStatus;
  55 + }
46 56  
47 57 public String getPatientId() {
48 58 return patientId;
platform-dal/src/main/java/com/lyms/platform/pojo/LisCrisisNotify.java View file @ 97a862c
  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 +
  9 +/**
  10 + * 危急通知记录
  11 + * Created by Administrator on 2016/10/19 0019.
  12 + */
  13 +@Document(collection = "lyms_lis_crisis_notify")
  14 +public class LisCrisisNotify extends BaseModel {
  15 +
  16 + private static final long serialVersionUID = SerialIdEnum.LisCrisisItem.getCid();
  17 +
  18 + private String id;
  19 +
  20 + //医院id
  21 + private String hospitalId;
  22 +
  23 + //孕妇id
  24 + private String patientId;
  25 +
  26 + private String pid;
  27 +
  28 + //医生id
  29 + private String doctorId;
  30 +
  31 + //是否查看状态 0未查看 1查看
  32 + private Integer status;
  33 +
  34 + //创建时间
  35 + private Date created;
  36 +
  37 + //修改时间
  38 + private Date modified;
  39 +
  40 + private Integer yn;
  41 +
  42 + public Integer getYn() {
  43 + return yn;
  44 + }
  45 +
  46 + public void setYn(Integer yn) {
  47 + this.yn = yn;
  48 + }
  49 +
  50 + public String getPid() {
  51 + return pid;
  52 + }
  53 +
  54 + public void setPid(String pid) {
  55 + this.pid = pid;
  56 + }
  57 +
  58 + public String getId() {
  59 + return id;
  60 + }
  61 +
  62 + public void setId(String id) {
  63 + this.id = id;
  64 + }
  65 +
  66 + public String getHospitalId() {
  67 + return hospitalId;
  68 + }
  69 +
  70 + public void setHospitalId(String hospitalId) {
  71 + this.hospitalId = hospitalId;
  72 + }
  73 +
  74 + public String getPatientId() {
  75 + return patientId;
  76 + }
  77 +
  78 + public void setPatientId(String patientId) {
  79 + this.patientId = patientId;
  80 + }
  81 +
  82 + public String getDoctorId() {
  83 + return doctorId;
  84 + }
  85 +
  86 + public void setDoctorId(String doctorId) {
  87 + this.doctorId = doctorId;
  88 + }
  89 +
  90 + public Integer getStatus() {
  91 + return status;
  92 + }
  93 +
  94 + public void setStatus(Integer status) {
  95 + this.status = status;
  96 + }
  97 +
  98 + public Date getCreated() {
  99 + return created;
  100 + }
  101 +
  102 + public void setCreated(Date created) {
  103 + this.created = created;
  104 + }
  105 +
  106 + public Date getModified() {
  107 + return modified;
  108 + }
  109 +
  110 + public void setModified(Date modified) {
  111 + this.modified = modified;
  112 + }
  113 +}
platform-dal/src/main/java/com/lyms/platform/query/LisCrisisItemQuery.java View file @ 97a862c
... ... @@ -39,7 +39,17 @@
39 39 private Integer age;
40 40 //患者ID
41 41 private List<String> parentIds;
  42 + //同步状态 0未同步 1同步
  43 + private Integer syncStatus;
42 44  
  45 + public Integer getSyncStatus() {
  46 + return syncStatus;
  47 + }
  48 +
  49 + public void setSyncStatus(Integer syncStatus) {
  50 + this.syncStatus = syncStatus;
  51 + }
  52 +
43 53 //大于修改时间
44 54 private Date gteModified;
45 55 //大于创建时间
... ... @@ -258,6 +268,9 @@
258 268 }
259 269 if(null!=status){
260 270 condition=condition.and("status",status,MongoOper.IS);
  271 + }
  272 + if(null!=syncStatus){
  273 + condition=condition.and("syncStatus",syncStatus,MongoOper.IS);
261 274 }
262 275  
263 276 if(StringUtils.isNotBlank(patientName)){
platform-dal/src/main/java/com/lyms/platform/query/LisCrisisNotifyQuery.java View file @ 97a862c
  1 +package com.lyms.platform.query;
  2 +
  3 +import com.lyms.platform.common.base.IConvertToNativeQuery;
  4 +import com.lyms.platform.common.dao.BaseQuery;
  5 +import com.lyms.platform.common.dao.operator.MongoCondition;
  6 +import com.lyms.platform.common.dao.operator.MongoOper;
  7 +import com.lyms.platform.common.dao.operator.MongoQuery;
  8 +import org.apache.commons.collections.CollectionUtils;
  9 +import org.apache.commons.lang.StringUtils;
  10 +import org.springframework.data.mongodb.core.query.Criteria;
  11 +
  12 +import java.util.List;
  13 +
  14 +/**
  15 + * Created by Administrator on 2016/10/19 0019.
  16 + */
  17 +public class LisCrisisNotifyQuery extends BaseQuery implements IConvertToNativeQuery {
  18 +
  19 + private String id;
  20 +
  21 + //医院id
  22 + private String hospitalId;
  23 +
  24 + //孕妇id
  25 + private String patientId;
  26 +
  27 + private String pid;
  28 +
  29 + //医生id
  30 + private String doctorId;
  31 +
  32 + private Integer yn;
  33 +
  34 + //是否查看状态 0未查看 1查看
  35 + private Integer status;
  36 +
  37 + public Integer getYn() {
  38 + return yn;
  39 + }
  40 +
  41 + public void setYn(Integer yn) {
  42 + this.yn = yn;
  43 + }
  44 +
  45 + public String getId() {
  46 + return id;
  47 + }
  48 +
  49 + public void setId(String id) {
  50 + this.id = id;
  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 getPatientId() {
  62 + return patientId;
  63 + }
  64 +
  65 + public void setPatientId(String patientId) {
  66 + this.patientId = patientId;
  67 + }
  68 +
  69 + public String getPid() {
  70 + return pid;
  71 + }
  72 +
  73 + public void setPid(String pid) {
  74 + this.pid = pid;
  75 + }
  76 +
  77 + public String getDoctorId() {
  78 + return doctorId;
  79 + }
  80 +
  81 + public void setDoctorId(String doctorId) {
  82 + this.doctorId = doctorId;
  83 + }
  84 +
  85 + public Integer getStatus() {
  86 + return status;
  87 + }
  88 +
  89 + public void setStatus(Integer status) {
  90 + this.status = status;
  91 + }
  92 +
  93 + @Override
  94 + public MongoQuery convertToQuery() {
  95 + MongoCondition condition = MongoCondition.newInstance();
  96 +
  97 + if (StringUtils.isNotBlank(id)) {
  98 + condition = condition.and("id", id, MongoOper.IS);
  99 + }
  100 + if (StringUtils.isNotBlank(hospitalId)) {
  101 + condition = condition.and("hospitalId", hospitalId, MongoOper.IS);
  102 + }
  103 +
  104 + if (StringUtils.isNotBlank(doctorId)) {
  105 + condition = condition.and("doctorId", doctorId, MongoOper.IS);
  106 + }
  107 +
  108 + if (StringUtils.isNotBlank(patientId)) {
  109 + condition = condition.and("patientId", patientId, MongoOper.IS);
  110 + }
  111 +
  112 + if(null!=status){
  113 + condition=condition.and("status", status, MongoOper.IS);
  114 + }
  115 +
  116 + return condition.toMongoQuery();
  117 + }
  118 +}
platform-operate-api/src/main/java/com/lyms/hospitalapi/qhdfy/QhdfyHisService.java View file @ 97a862c
... ... @@ -12,6 +12,7 @@
12 12 import com.lyms.platform.common.utils.DateUtil;
13 13 import com.lyms.platform.common.utils.ExceptionUtils;
14 14 import com.lyms.platform.common.utils.JsonUtil;
  15 +import com.lyms.platform.operate.web.facade.AntenatalExaminationFacade;
15 16 import com.lyms.platform.permission.model.LisReportItemModel;
16 17 import com.lyms.platform.permission.model.LisReportModel;
17 18 import com.lyms.platform.pojo.*;
18 19  
19 20  
20 21  
... ... @@ -53,12 +54,18 @@
53 54 private LisCrisisItemService lisCrisisItemService;
54 55  
55 56 @Autowired
  57 + private LisCrisisNotifyService lisCrisisNotifyService;
  58 +
  59 + @Autowired
56 60 private ReferConfigService referConfigService;
57 61  
  62 + @Autowired
  63 + private AntenatalExaminationFacade antenatalExaminationFacade;
58 64  
  65 +
59 66 public void syncLisReportTimer() {
60 67 Date date = new Date();
61   - queryLisReport(new Date(date.getTime()-1000*60*60));
  68 + queryLisReport(new Date(date.getTime() - 1000 * 60 * 60));
62 69 }
63 70  
64 71 public void syncLisReportTask(final String dateStr) {
65 72  
... ... @@ -75,8 +82,8 @@
75 82  
76 83 public List<QhdfyLisReport> queryLisReport(Date startDate) {
77 84 System.out.print("begin queryLisReport"+ DateUtil.getyyyy_MM_dd_hms(new Date()));
78   - //TODO
79 85 Integer hospitalId = 216;
  86 +
80 87 List<QhdfyLisReport> result = new ArrayList<>();
81 88 if (null != startDate) {
82 89 Connection conn = ConnTools.makeLisConnection();
83 90  
... ... @@ -97,11 +104,15 @@
97 104 buildType.add(2);
98 105 buildType.add(3);
99 106 patientsQuery.setBuildTypeList(buildType);
  107 +
  108 +
100 109 String startDateStr=DateUtil.getyyyy_MM_dd_hms(startDate);
101 110 String sql = "select top 100000 shenqinghao as hospitalId,bingrenid as patientFid,zhuyuanhao as patientHid,kahao as vcCardNo,phone,huanzhexingming as name,xingbie as sex,nianling as age,shenqingkeshidaima as deptCode,shenqingkeshimingcheng as deptName,shenqingyishengdaima as applyDoctorCode,shenqingyishengmingcheng as applyDoctorName,jianchayishengdaima as checkDoctorCode,jianchayishengxingming as checkDoctorName,baogaofabushijian as publishTime from valllist_ex_en where baogaofabushijian > CONVERT(DATETIME,'"+startDateStr+"', 20) and phone is not null and phone !='' and shenqinghao is not null order by shenqinghao desc";
102 111 String subSql = "select top 1000 sheqingdanhao as id,xiangmudaima as code,xiangmumingcheng as name,xiangmujieguo as result,zifujieguo as charResult,shuzijieguo as numberResult,gaodibiaozhi as flag,cankaozhi as ref,danwei as unit,jieguoleixing as result from valresult_ex_en where sheqingdanhao='";
103 112 List<LisReport> list = queryRunner.query(conn, sql, new BeanListHandler<LisReport>(LisReport.class));
104 113 System.out.println("危急值====> " + list.size());
  114 +
  115 +
105 116 if (list.size() > 0) {
106 117 MongoCondition mongoCondition = MongoCondition.newInstance("hospitalId", ""+hospitalId, MongoOper.IS);
107 118 List<AssayConfig> assayConfigList = assayConfigDao.query(mongoCondition.toMongoQuery());
108 119  
... ... @@ -123,9 +134,29 @@
123 134 patientsQuery.setNeed("y");
124 135 List<Patients> patientsList = patientsService.queryPatient(patientsQuery);
125 136 Patients patients = patientsList.get(0);
126   - if(null==patients.getLastMenses()){
  137 + if(null == patients.getLastMenses()){
127 138 continue;
128 139 }
  140 +
  141 + Set<String> sets = antenatalExaminationFacade.getCrisisUnionDoc(patients);
  142 +
  143 + if (CollectionUtils.isNotEmpty(sets))
  144 + {
  145 + LisCrisisNotify notify = new LisCrisisNotify();
  146 + notify.setHospitalId(patients.getHospitalId());
  147 + notify.setPatientId(patients.getId());
  148 + notify.setStatus(0);
  149 + notify.setYn(1);
  150 + notify.setModified(new Date());
  151 + notify.setCreated(new Date());
  152 + for (String doctorId : sets)
  153 + {
  154 + notify.setDoctorId(doctorId);
  155 +
  156 + lisCrisisNotifyService.addLisCrisisNotify(notify);
  157 + }
  158 + }
  159 +
129 160 LisCrisisItem crisisItem = new LisCrisisItem();
130 161 crisisItem.setPid(patients.getPid());
131 162 crisisItem.setPatientId(patients.getId());
... ... @@ -143,6 +174,7 @@
143 174 crisisItem.setHospitalId(hospitalId + "");
144 175 crisisItem.setStatus(1);
145 176 crisisItem.setStatusName("待处理");
  177 + crisisItem.setSyncStatus(0);
146 178  
147 179 List<LisReportItem> itemList = queryRunner.query(conn, subSql+report.getHospitalId()+"'", new BeanListHandler<LisReportItem>(LisReportItem.class));
148 180 System.out.println("itemList ====> "+itemList.size() );
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/LisCrisisItemController.java View file @ 97a862c
1 1 package com.lyms.platform.operate.web.controller;
2 2  
3   -import com.lyms.platform.biz.service.EmergenceTreatmentService;
4 3 import com.lyms.platform.biz.service.LisCrisisItemService;
  4 +import com.lyms.platform.biz.service.LisCrisisNotifyService;
5 5 import com.lyms.platform.biz.service.PatientsService;
6 6 import com.lyms.platform.common.annotation.TokenRequired;
7 7 import com.lyms.platform.common.base.BaseController;
  8 +import com.lyms.platform.common.constants.ErrorCodeConstants;
  9 +import com.lyms.platform.common.result.BaseObjectResponse;
  10 +import com.lyms.platform.common.result.BaseResponse;
8 11 import com.lyms.platform.common.result.CommonResult;
9 12 import com.lyms.platform.common.utils.*;
10 13 import com.lyms.platform.pojo.LisCrisisItem;
  14 +import com.lyms.platform.pojo.LisCrisisNotify;
11 15 import com.lyms.platform.pojo.Patients;
12 16 import com.lyms.platform.query.LisCrisisItemQuery;
  17 +import com.lyms.platform.query.LisCrisisNotifyQuery;
13 18 import com.lyms.platform.query.PatientsQuery;
14 19 import org.apache.commons.collections.CollectionUtils;
15 20 import org.springframework.beans.factory.annotation.Autowired;
16 21 import org.springframework.stereotype.Controller;
17   -import org.springframework.web.bind.annotation.RequestHeader;
18   -import org.springframework.web.bind.annotation.RequestMapping;
19   -import org.springframework.web.bind.annotation.RequestMethod;
20   -import org.springframework.web.bind.annotation.RequestParam;
  22 +import org.springframework.web.bind.annotation.*;
21 23  
  24 +import javax.servlet.http.HttpServletRequest;
22 25 import javax.servlet.http.HttpServletResponse;
23   -import java.text.MessageFormat;
24 26 import java.util.*;
25 27  
26 28 /**
27 29  
28 30  
... ... @@ -35,14 +37,148 @@
35 37 private LisCrisisItemService lisCrisisItemService;
36 38  
37 39 @Autowired
38   - private EmergenceTreatmentService emergenceTreatmentService;
  40 + private LisCrisisNotifyService lisCrisisNotifyService;
  41 +
39 42 @Autowired
40 43 private PatientsService patientsService;
41 44  
42 45  
  46 + /**
  47 + * 更新通知状态为已经查看
  48 + * @param request
  49 + * @return
  50 + */
  51 + @RequestMapping(method = RequestMethod.GET, value = "/updateLisCrisisNotifyStatus")
  52 + @ResponseBody
  53 + @TokenRequired
  54 + public BaseResponse updateLisCrisisNotifyStatus(
  55 + HttpServletRequest request) {
  56 +
  57 + Integer userId = getUserId(request);
  58 + LisCrisisNotifyQuery query = new LisCrisisNotifyQuery();
  59 + query.setYn(1);
  60 + query.setDoctorId(String.valueOf(userId));
  61 +
  62 + LisCrisisNotify notify = new LisCrisisNotify();
  63 + notify.setStatus(1);
  64 + lisCrisisNotifyService.updateMultiLisCrisisNotify(notify,query);
  65 +
  66 + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg(ErrorCodeConstants.SUCCESS_DESCRIPTION);
  67 + }
  68 +
  69 +
  70 + /**
  71 + * 获取当前医生危急条数
  72 + * @return
  73 + */
  74 + @RequestMapping(method = RequestMethod.GET, value = "/getLisCrisisNotifyCount")
  75 + @ResponseBody
  76 + @TokenRequired
  77 + public BaseResponse getSyncLisCrisis(HttpServletRequest request) {
  78 +
  79 + Integer userId = getUserId(request);
  80 + LisCrisisNotifyQuery query = new LisCrisisNotifyQuery();
  81 + query.setYn(1);
  82 + query.setStatus(0);
  83 + query.setDoctorId(String.valueOf(userId));
  84 +
  85 + int count = lisCrisisNotifyService.queryCount(query);
  86 + if (count < 1)
  87 + {
  88 + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.NO_DATA).setErrormsg("没有待处理危急信息");
  89 + }
  90 + String content = "紧急通知:您有"+count+"条危急信息等待处理";
  91 + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg(ErrorCodeConstants.SUCCESS_DESCRIPTION).setData(content);
  92 + }
  93 +
  94 +
  95 + /**
  96 + * 同步危急数据
  97 + * @param token
  98 + * @return
  99 + */
  100 + @RequestMapping(method = RequestMethod.GET, value = "/syncLisCrisisData")
  101 + @ResponseBody
  102 + public List<LisCrisisItem> getSyncLisCrisis(@RequestHeader("Authorization") String token,
  103 + @RequestParam("page") Integer page,
  104 + @RequestParam("limit") Integer limit) {
  105 +
  106 + if (!"3d19960bf3e81e7d816c4f26051c49ba".equals(token))
  107 + {
  108 + ExceptionUtils.catchException("The request token is " + token);
  109 + return new ArrayList<>();
  110 + }
  111 + LisCrisisItemQuery query = new LisCrisisItemQuery();
  112 + query.setSyncStatus(0); //同步状态 0未同步 1同步
  113 + query.setNeed("true");
  114 + query.setLimit(limit);
  115 + query.setPage(page);
  116 + List<LisCrisisItem> lisCrisisItemList = lisCrisisItemService.query(query);
  117 +
  118 + return lisCrisisItemList;
  119 + }
  120 +
  121 +
  122 + /**
  123 + * 更新危急同步状态
  124 + * @param ids
  125 + * @param token
  126 + * @return
  127 + */
  128 + @RequestMapping(method = RequestMethod.GET, value = "/updateLisCrisisSyncStatus")
  129 + @ResponseBody
  130 + public BaseResponse getSyncLisCrisis(@RequestParam("ids") String ids,
  131 + @RequestHeader("Authorization") String token) {
  132 +
  133 + if (!"3d19960bf3e81e7d816c4f26051c49ba".equals(token))
  134 + {
  135 + ExceptionUtils.catchException("The request token is " + token);
  136 + return new BaseResponse().setErrorcode(ErrorCodeConstants.PARAMETER_ERROR).setErrormsg("token错误");
  137 + }
  138 + try {
  139 + String[] arrs = ids.split(",");
  140 + if (arrs != null && arrs.length > 0)
  141 + {
  142 + for (int i = 0 ; i < arrs.length ; i++)
  143 + {
  144 + LisCrisisItem item = new LisCrisisItem();
  145 + item.setSyncStatus(1);
  146 + lisCrisisItemService.updateLisCrisisItem(item,arrs[i]);
  147 + }
  148 +
  149 + }
  150 + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg(ErrorCodeConstants.SUCCESS_DESCRIPTION);
  151 + }
  152 + catch (Exception e)
  153 + {
  154 + ExceptionUtils.catchException(e,"update crisis error.");
  155 + return new BaseResponse().setErrorcode(ErrorCodeConstants.SYSTEM_ERROR).setErrormsg(ErrorCodeConstants.SYSTEM_ERROR_DESCRIPTION);
  156 + }
  157 + }
  158 +
  159 +
  160 + /**
  161 + * 危急列表
  162 + * @param response
  163 + * @param request
  164 + * @param page
  165 + * @param limit
  166 + * @param queryNo
  167 + * @param id
  168 + * @param cardNo
  169 + * @param phone
  170 + * @param age
  171 + * @param startWeek
  172 + * @param endWeek
  173 + * @param name
  174 + * @param status
  175 + * @param refer
  176 + * @param doctor
  177 + */
43 178 @RequestMapping(value = "/lisCrisisItems", method = RequestMethod.GET)
44 179 @TokenRequired
45 180 public void getEmergenceTreatments(HttpServletResponse response,
  181 + HttpServletRequest request,
46 182 @RequestParam("page") int page,
47 183 @RequestParam("limit") int limit,
48 184 @RequestParam(value = "queryNo", required = false) String queryNo,
... ... @@ -55,8 +191,8 @@
55 191 @RequestParam(value = "name", required = false) String name,
56 192 @RequestParam(value = "status", required = false) Integer status,
57 193 @RequestParam(value = "refer", required = false) String refer,
58   - @RequestParam(value = "doctor", required = false) String doctor
59   - ) {
  194 + @RequestParam(value = "doctor", required = false) String doctor)
  195 + {
60 196  
61 197 PatientsQuery patientsQuery = new PatientsQuery();
62 198 List<Patients> patientses = null;
... ... @@ -89,7 +225,6 @@
89 225 }
90 226  
91 227 List<LisCrisisItem> lisCrisisItemList = lisCrisisItemService.query(query);
92   -
93 228 List<Map> list = new ArrayList<>();
94 229  
95 230 if (CollectionUtils.isNotEmpty(lisCrisisItemList)) {
96 231  
... ... @@ -135,8 +270,28 @@
135 270 CommonResult result = new CommonResult();
136 271 result.setList(list);
137 272 result.setPageInfo(query.getPageInfo());
  273 +
  274 + updateLisCrisisNotifyStatus(getUserId(request));
  275 +
138 276 ResultUtils.buildSuccessResultAndWrite(response, result);
139 277 }
  278 +
  279 +
  280 + /**
  281 + * 更新通知状态为已经查看
  282 + * @param userId
  283 + */
  284 + private void updateLisCrisisNotifyStatus(Integer userId)
  285 + {
  286 + LisCrisisNotifyQuery query = new LisCrisisNotifyQuery();
  287 + query.setYn(1);
  288 + query.setDoctorId(String.valueOf(userId));
  289 +
  290 + LisCrisisNotify notify = new LisCrisisNotify();
  291 + notify.setStatus(1);
  292 + lisCrisisNotifyService.updateMultiLisCrisisNotify(notify,query);
  293 + }
  294 +
140 295  
141 296 /**
142 297 * 获取该医院的危机数据
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java View file @ 97a862c
... ... @@ -2344,7 +2344,7 @@
2344 2344 if(CollectionUtils.isNotEmpty(list)){
2345 2345 status= list.get(0).getStatus();
2346 2346 }
2347   - m.put("status",status);
  2347 + m.put("status", status);
2348 2348 if(CollectionUtils.isNotEmpty(examinationModelList)){
2349 2349 for(AntenatalExaminationModel model:examinationModelList){
2350 2350 String zybd=model.getZyqbd();
... ... @@ -2454,6 +2454,54 @@
2454 2454 }
2455 2455 }
2456 2456 return data;
  2457 + }
  2458 +
  2459 +
  2460 + /**
  2461 + * 获取孕妇危急关联的医生
  2462 + * @param patients
  2463 + * @return
  2464 + */
  2465 + public Set<String> getCrisisUnionDoc(Patients patients)
  2466 + {
  2467 + Set<String> doctors = new HashSet<>();
  2468 + if (patients == null)
  2469 + {
  2470 + return doctors;
  2471 + }
  2472 + AntExChuQuery antExChuQuery =new AntExChuQuery();
  2473 + antExChuQuery.setHospitalId(patients.getHospitalId());
  2474 + antExChuQuery.setParentId(patients.getId());
  2475 + antExChuQuery.setYn(YnEnums.YES.getId());
  2476 + List<AntExChuModel> chuModelList = antenatalExaminationService.queryAntExChu(antExChuQuery);
  2477 + if (CollectionUtils.isNotEmpty(chuModelList))
  2478 + {
  2479 + for (AntExChuModel chu : chuModelList)
  2480 + {
  2481 + if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(chu.getProdDoctor()))
  2482 + {
  2483 + doctors.add(chu.getProdDoctor());
  2484 + }
  2485 +
  2486 + }
  2487 +
  2488 + AntExQuery antExQuery = new AntExQuery();
  2489 + antExQuery.setHospitalId(patients.getHospitalId());
  2490 + antExQuery.setParentId(patients.getId());
  2491 + antExQuery.setYn(YnEnums.YES.getId());
  2492 + List<AntenatalExaminationModel> examinationModelList = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery().addOrder(Sort.Direction.DESC, "created"));
  2493 + if (CollectionUtils.isNotEmpty(examinationModelList))
  2494 + {
  2495 + for (AntenatalExaminationModel examinationModel : examinationModelList)
  2496 + {
  2497 + if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(examinationModel.getCheckDoctor()))
  2498 + {
  2499 + doctors.add(examinationModel.getCheckDoctor());
  2500 + }
  2501 + }
  2502 + }
  2503 + }
  2504 + return doctors;
2457 2505 }
2458 2506 }