diff --git a/pom.xml b/pom.xml index 8cb7a66..490553f 100644 --- a/pom.xml +++ b/pom.xml @@ -93,6 +93,20 @@ ${druid.version} + + + + javax.validation + validation-api + 1.1.0.Final + + + + org.hibernate + hibernate-validator + 5.4.1.Final + + org.springframework @@ -104,6 +118,7 @@ spring-webmvc ${spring.version} + org.springframework spring-jdbc @@ -255,6 +270,36 @@ 1.6.1 + + + + + + org.springframework.data + spring-data-redis + 1.6.0.RELEASE + + + + redis.clients + jedis + 2.7.3 + + + org.apache.commons + commons-pool2 + 2.3 + + + commons-pool + commons-pool + 1.5.5 + + + + + + diff --git a/src/main/java/com/emr/controller/FontController.java b/src/main/java/com/emr/controller/FontController.java index 818970d..9c058df 100644 --- a/src/main/java/com/emr/controller/FontController.java +++ b/src/main/java/com/emr/controller/FontController.java @@ -1,33 +1,27 @@ package com.emr.controller; import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; import com.emr.dao.Emr_DictionaryMapper; import com.emr.dao.TPrintinfoMapper; import com.emr.entity.*; import com.emr.service.Archive_DetailService; import com.emr.service.Archive_MasterService; +import com.emr.service.PushInfoService; import com.emr.service.ipml.*; +import com.emr.util.CommonResult; import com.emr.util.DateUtil; import com.emr.util.ExceptionPrintUtil; import com.emr.util.Msg; import com.emr.vo.*; import net.sf.json.JSONObject; import org.apache.commons.lang3.StringUtils; -import org.apache.cxf.endpoint.Client; -import org.apache.http.HttpEntity; -import org.apache.http.client.ClientProtocolException; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; import org.apache.shiro.util.CollectionUtils; import org.dom4j.Document; -import org.dom4j.DocumentHelper; + import java.text.ParseException; import java.util.ArrayList; import java.util.List; @@ -40,11 +34,12 @@ import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; -import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; +import javax.validation.Valid; import java.io.IOException; import java.io.StringReader; import java.text.SimpleDateFormat; @@ -52,13 +47,13 @@ import java.util.*; /** * @author zwh - * */ + */ @Controller @RequestMapping("font/") public class FontController { @Value("${pdfWater}") private String pdfWater; -// @Value("${RoomDetailsUrl}") + // @Value("${RoomDetailsUrl}") // private String RoomDetailsUrl; // @Value("${RoomDetailsUrlName}") // private String RoomDetailsUrlName; @@ -69,6 +64,8 @@ public class FontController { @Autowired private TPrintinfoService printinfoService; @Autowired + private PushInfoService pushInfoService; + @Autowired private Archive_DetailService archiveDetailService; @Autowired private Archive_MasterService archiveMasterService; @@ -808,262 +805,53 @@ public class FontController { return map; } -// /** -// * 调用第三方接口获取唯一标识patientid -// * -// * @return -// * @throws Exception -// */ -// @RequestMapping(value = "getRoomDetails") -// @ResponseBody -// public String selRoomDetails(EsbPublicVo esbPublicVo,SecureloginVo secureloginVo, HttpServletRequest request) throws Exception { -// //创建连接工厂 -// String patientId1 = esbPublicVo.getPatientId(); -// System.out.println("patientId1:::::"+patientId1); -// JAXDynamicClientFactory dcf = JAXDynamicClientFactory.newInstance(); -// //创建客户端 wsUrl为webService接口地址 -// Client client = dcf.createClient(RoomDetailsUrl); -// String xmlStr = createXml(patientId1); -// Object[] objects = client.invoke(RoomDetailsUrlName, xmlStr); -// //销毁连接 -// client.destroy(); -// //接收结果 -// String result = objects[0].toString(); -// System.out.println("result::::::"+result); -// String patientId=null; -// if (StringUtils.isNotBlank(result)) { -// Map map = new HashMap<>(); -// map = parseXml2Map(result, map); -// //获取序列号 -// patientId = map.get("Body.ResultContent.patientid"); -// -// } -// // 获得Http客户端 -// CloseableHttpClient httpClient = HttpClientBuilder.create().build(); -// // 创建Post请求 -// HttpPost httpPost = new HttpPost("http://10.100.12.12:37727/api/account/securelogin"); -// //json格式转换 -// JSONObject jsonParam = new JSONObject(); -// jsonParam.put("idp","NSDP"); -// jsonParam.put("secret", "Secret"); -// jsonParam.put("userName","002030"); -// jsonParam.put("password", "123456"); -// jsonParam.put("scopes", "openid profile cr-api roles"); -// jsonParam.put("key", patientId1); -// System.out.println(jsonParam); -// StringEntity entity = new StringEntity(jsonParam.toString(), "UTF-8"); -// httpPost.setEntity(entity); -// httpPost.setHeader("Content-Type","application/json"); -// // 响应模型 -// CloseableHttpResponse response = null; -// HttpEntity responseEntity=null; -// String token=""; -// String s =""; -// try { -// // 由客户端执行(发送)Post请求 -// response = httpClient.execute(httpPost); -// // 从响应模型中获取响应实体 -// responseEntity=response.getEntity(); -// System.out.println("响应状态为:" + response.getStatusLine()); -// if (responseEntity != null) { -// Map mapType = JSON.parseObject(EntityUtils.toString(responseEntity),Map.class); -// token = mapType.get("token").toString(); -// System.out.println("token:::"+token); -// s = StringUtils.substringAfter(token, " "); -// System.out.println("s:::"+s); -// } -// } catch (ClientProtocolException e) { -// e.printStackTrace(); -// } catch (IOException e) { -// e.printStackTrace(); -// } finally { -// try { -// // 释放资源 -// if (httpClient != null) { -// httpClient.close(); -// } -// if (response != null) { -// response.close(); -// } -// } catch (IOException e) { -// e.printStackTrace(); -// } -// } -// String pdfUrl="http://10.100.12.3:33600/view/subjects/"+patientId+"/records/"+secureloginVo.getVisitId()+"?token="+s+"&token_type=Bearer"; -// return pdfUrl; -// } -// -// -// /* *//* -// * -//
-// HIS -// D561C89A-6320-4b27-83DE-A6169B1D0761 -// 2021-07-18 11:12:41 -// Get360PatientId -//
-// -// 0000623132 -// -//
-// * */ -// public static String createXml(String patientId1) { -// String strXML = null; -// try { -//// Document document = DocumentHelper.createDocument(); -//// org.dom4j.Element request = document.addElement("Request"); -//// org.dom4j.Element header = request.addElement("Header"); -//// org.dom4j.Element sourceSystem = header.addElement("SourceSystem"); -//// org.dom4j.Element messageId = header.addElement("MessageId"); -//// org.dom4j.Element createTime = header.addElement("CreateTime"); -//// org.dom4j.Element methodName = header.addElement("MethodName"); -//// sourceSystem.setText("record"); -//// messageId.setText(UUID.randomUUID().toString().toUpperCase()); -//// createTime.setText(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); -//// methodName.setText("Get360PatientId"); -//// org.dom4j.Element body = request.addElement("Body"); -//// Element patientIdEle = body.addElement("PatientId"); -//// patientIdEle.setText(patientId); -//// return document.toString(); -// Document document = DocumentHelper.createDocument(); -// //创建根节点 -// Element request = document.addElement("Request"); -// //添加子节点 -// Element header = request.addElement("Header"); -// //给Header标签添加子节点 -// Element sourceSystem = header.addElement("SourceSystem"); -// Element messageId = header.addElement("MessageId"); -// Element createTime = header.addElement("CreateTime"); -// Element methodName = header.addElement("MethodName"); -// //给Request标签添加子节点 -// Element body = request.addElement("Body"); -// //给Body标签添加子节点 -// Element patientIdEle = body.addElement("PatientId"); -// //给xml赋值 -// sourceSystem.addText("CaseSys"); -// UUID guid = UUID.randomUUID(); -// messageId.addText(guid.toString()); -// SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); -// createTime.addText(df.format(new Date())); -// methodName.addText("Get360PatientId"); -// patientIdEle.addText(patientId1); -// strXML = document.asXML(); -// System.out.println("strXML:::::" + strXML); -// } catch (Exception e) { -// System.out.println("生成rssNew.xml失败"); -// } -// return strXML; -// } -// /** -// * 获取token -// * @return -// * @throws -// */ -// @RequestMapping(value="getToken") -// @ResponseBody -// public void selToken(SecureloginVo secureloginVo, HttpServletRequest request){ -// System.out.println(secureloginVo.getKey()); -// // 获得Http客户端 -// CloseableHttpClient httpClient = HttpClientBuilder.create().build(); -// // 创建Post请求 -// HttpPost httpPost = new HttpPost("http://10.100.12.12:37727/api/account/securelogin"); -// secureloginVo.setIDP("NSDP"); -// secureloginVo.setSecret("Secret"); -//// Power_User user = (Power_User)request.getSession().getAttribute("CURRENT_USER"); -//// secureloginVo.setUserName(user.getUserName()); -// secureloginVo.setUserName("002030"); -// secureloginVo.setPassword("123456"); -// secureloginVo.setScopes("openid profile cr-api roles"); -// -// //json格式转换 -// String jsonString = JSON.toJSONString(secureloginVo); -// StringEntity entity = new StringEntity(jsonString, "UTF-8"); -// // post请求是将参数放在请求体里面传过去的;这里将entity放入post请求体中 -// httpPost.setEntity(entity); -// httpPost.setHeader("Content-Type", "application/json;charset=utf8"); -// // 响应模型 -// CloseableHttpResponse response = null; -// try { -// // 由客户端执行(发送)Post请求 -// response = httpClient.execute(httpPost); -// // 从响应模型中获取响应实体 -// HttpEntity responseEntity = response.getEntity(); -// System.out.println("responseEntity::::"+responseEntity); -// System.out.println("响应状态为:" + response.getStatusLine()); -// if (responseEntity != null) { -// System.out.println("响应内容长度为:" + responseEntity.getContentLength()); -// System.out.println("响应内容为:" + EntityUtils.toString(responseEntity)); -// } -// } catch (ClientProtocolException e) { -// e.printStackTrace(); -// } catch (IOException e) { -// e.printStackTrace(); -// } finally { -// try { -// // 释放资源 -// if (httpClient != null) { -// httpClient.close(); -// } -// if (response != null) { -// response.close(); -// } -// } catch (IOException e) { -// e.printStackTrace(); -// } -// } -// } -// -// /** -// * 获取二维码 -// * @return -// * @throws -// */ -// @RequestMapping(value="getQRcode") -// @ResponseBody -// public void getQRcode(QRcode qRcode, HttpServletRequest request) { -// // 获得Http客户端 -// CloseableHttpClient httpClient = HttpClientBuilder.create().build(); -// // 创建Post请求 -// HttpPost httpPost = new HttpPost("https://zh.fstth.cn"); -// qRcode.setType(3); -// qRcode.setProjectUid("cloudkey-fstth"); -// qRcode.setApplicationId("fstth-wzh"); -// //json格式转换 -// String jsonString = JSON.toJSONString(qRcode); -// StringEntity entity = new StringEntity(jsonString, "UTF-8"); -// // post请求是将参数放在请求体里面传过去的;这里将entity放入post请求体中 -// httpPost.setEntity(entity); -// httpPost.setHeader("Content-Type", "application/json;charset=utf8"); -// // 响应模型 -// CloseableHttpResponse response = null; -// try { -// // 由客户端执行(发送)Post请求 -// response = httpClient.execute(httpPost); -// // 从响应模型中获取响应实体 -// HttpEntity responseEntity = response.getEntity(); -// System.out.println("responseEntity::::" + responseEntity); -// System.out.println("响应状态为:" + response.getStatusLine()); -// if (responseEntity != null) { -// System.out.println("响应内容长度为:" + responseEntity.getContentLength()); -// System.out.println("响应内容为:" + EntityUtils.toString(responseEntity)); -// } -// } catch (ClientProtocolException e) { -// e.printStackTrace(); -// } catch (IOException e) { -// e.printStackTrace(); -// } finally { -// try { -// // 释放资源 -// if (httpClient != null) { -// httpClient.close(); -// } -// if (response != null) { -// response.close(); -// } -// } catch (IOException e) { -// e.printStackTrace(); -// } -// } -// } + /** + * @description: 佛山三院电子病历/护理记录接口 + * @params: + * @return: + * @author linjj + * @date: 2023/12/7 15:07 + */ + @RequestMapping(value = "pushInfo") + @ResponseBody + public Msg pushInfo(@Valid PushInfoVo pushInfoVo) { + if (pushInfoVo == null) { + return Msg.pushFail("参数不得为空"); + } + if (StringUtils.isBlank(pushInfoVo.getDataType() + "")) { + return Msg.pushFail("提交类型不得为空"); + } + if (StringUtils.isBlank(pushInfoVo.getInpNo())) { + return Msg.pushFail("住院号不得为空"); + } + if (StringUtils.isBlank(pushInfoVo.getVisitId())) { + return Msg.pushFail("住院次数不得为空"); + } + if (StringUtils.isBlank(pushInfoVo.getSubmitCode())) { + return Msg.pushFail("提交时间不得为空"); + } + if (pushInfoService.pushInfo(pushInfoVo)) { + return Msg.fail("成功"); + } + return Msg.pushFail("失败"); + } + + @RequestMapping(value = "getTask") + @ResponseBody + public CommonResult GetTask(String collectid) { + return pushInfoService.GetTask(collectid); + } + + @RequestMapping(value = "repairTask") + @ResponseBody + public Msg repairTask(String masterId){ + if (StringUtils.isBlank(masterId)){ + return Msg.pushFail("masterId不能为空"); + } + if (pushInfoService.repairTask(masterId)){ + return Msg.fail("成功"); + } + return Msg.pushFail("失败"); + } } diff --git a/src/main/java/com/emr/dao/Archive_MasterMapper.java b/src/main/java/com/emr/dao/Archive_MasterMapper.java index 2233973..8c97d40 100644 --- a/src/main/java/com/emr/dao/Archive_MasterMapper.java +++ b/src/main/java/com/emr/dao/Archive_MasterMapper.java @@ -118,4 +118,36 @@ public interface Archive_MasterMapper { List selectCommonlyUsedNew(@Param("ids") String ids); + + //根据住院号住院次数修改医生提交状态 + int updateCmtDoctorByInpNoAndVisitId(@Param("inpNo")String inpNo, + @Param("visitId")String visitId, + @Param("submitTime")String submitTime, + @Param("submitCode")String submitCode); + + //根据住院号住院次数修改护士提交状态 + int updateCmtNurseByInpNoAndVisitId(@Param("inpNo")String inpNo, + @Param("visitId")String visitId, + @Param("submitTime")String submitTime, + @Param("submitCode")String submitCode); + + //查询医生提交护士提交状态 + int getSubmitStatic(@Param("inpNo")String inpNo, + @Param("visitId")String visitId); + + //修改病历审核状态 + int updateArchiveStateByInpNoAndVisitId(@Param("inpNo")String inpNo, + @Param("visitId")String visitId); + + //根据住院号跟住院次数查询患者信息 + List getArchiveMaster(@Param("inpNo")String inpNo, + @Param("visitId")String visitId); + + + //根据住院号跟住院次数查询患者信息 + List getArchiveMasterByMasterId(@Param("masterId")String masterId); + //查询医生护士提交采集失败病历 + List getFailList(@Param("scheduledFlag")String scheduledFlag); + + } \ No newline at end of file diff --git a/src/main/java/com/emr/dao/PushInfoMapper.java b/src/main/java/com/emr/dao/PushInfoMapper.java new file mode 100644 index 0000000..f8073ed --- /dev/null +++ b/src/main/java/com/emr/dao/PushInfoMapper.java @@ -0,0 +1,15 @@ +package com.emr.dao; + +import com.emr.vo.PushInfoVo; + +/** + * @InterfaceName PushInfoMapper + * @Description 佛山三院电子病历/护理记录接口 + * @Author linjj + * @Date 2023/12/11 14:56 + * @Version 1.0 + */ +public interface PushInfoMapper { + + int addPushTracer(PushInfoVo pushInfoVo); +} diff --git a/src/main/java/com/emr/entity/Archive_Master.java b/src/main/java/com/emr/entity/Archive_Master.java index db8c78d..5e1c73e 100644 --- a/src/main/java/com/emr/entity/Archive_Master.java +++ b/src/main/java/com/emr/entity/Archive_Master.java @@ -5,6 +5,16 @@ import java.math.BigDecimal; public class Archive_Master { private String id; + private String sysFlag; + + public String getSysFlag() { + return sysFlag; + } + + public void setSysFlag(String sysFlag) { + this.sysFlag = sysFlag; + } + private String patientId; private String deptName1; diff --git a/src/main/java/com/emr/entity/Archive_Master_Vo.java b/src/main/java/com/emr/entity/Archive_Master_Vo.java index 0dcc450..65a86eb 100644 --- a/src/main/java/com/emr/entity/Archive_Master_Vo.java +++ b/src/main/java/com/emr/entity/Archive_Master_Vo.java @@ -12,6 +12,11 @@ import java.util.List; @Data public class Archive_Master_Vo extends Archive_Master{ + + private int cmtDoctor; + private int cmtNurse; + private String cmtDoctorDate; + private String cmtNurseDate; private String startDateTo; private String endDateTo; diff --git a/src/main/java/com/emr/quartz/ScheduledJob.java b/src/main/java/com/emr/quartz/ScheduledJob.java new file mode 100644 index 0000000..d4a1492 --- /dev/null +++ b/src/main/java/com/emr/quartz/ScheduledJob.java @@ -0,0 +1,66 @@ +package com.emr.quartz; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.serializer.SerializerFeature; +import com.emr.dao.Archive_MasterMapper; +import com.emr.entity.Archive_Master; +import com.emr.util.RedisMq; +import com.emr.vo.PrintParam; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import java.util.Date; +import java.util.List; + +/** + * @ClassName ScheduledJob + * @Description 定时任务 + * @Author linjj + * @Date 2023/12/14 16:48 + * @Version 1.0 + */ + +@Component +public class ScheduledJob { + + private String redisKey = "docus:task:topic_collect_%s_queue:%s"; + @Autowired(required = false) + private RedisMq redisMq; + + @Value("${scheduledFlag}") + private String scheduledFlag; + @Autowired + private Archive_MasterMapper archiveMasterMapper; + /** + * @description: 采集器失败任务补偿重新加入队列 + * @author linjj + * @date: 2023/12/14 16:54 + */ + @Scheduled(cron = "0 0 1 * * ?") + public void repairTaskAll() { + //查询采集未完成患者继续采集 + List failList = archiveMasterMapper.getFailList(scheduledFlag); + for (Archive_Master list:failList){ + PrintParam printParam = new PrintParam(); + printParam.setMasterId(list.getId()); + printParam.setInpNo(list.getInpNo()); + printParam.setVisitId(list.getVisitId()); + printParam.setDeptName(list.getDeptName()); + printParam.setDischargeDateTime(list.getDischargeDateTime()); + printParam.setName(list.getName()); + GenerateQueue(printParam,1,list.getSysFlag()); + } + } + + + //生成队列消息 + private void GenerateQueue(PrintParam data, Integer ispriority, String collectid) { + String key = String.format(redisKey, collectid, ispriority); + redisMq.push(key, JSON.toJSONString(data, SerializerFeature.WriteDateUseDateFormat, SerializerFeature.WriteMapNullValue)); + + } + + +} diff --git a/src/main/java/com/emr/service/PushInfoService.java b/src/main/java/com/emr/service/PushInfoService.java new file mode 100644 index 0000000..dc0d3da --- /dev/null +++ b/src/main/java/com/emr/service/PushInfoService.java @@ -0,0 +1,23 @@ +package com.emr.service; + +import com.emr.util.CommonResult; +import com.emr.vo.PushInfoVo; + +/** + * @InterfaceName pushInfoService + * @Description 佛山三院电子病历/护理记录接口 + * @Author linjj + * @Date 2023/12/11 14:51 + * @Version 1.0 + */ +public interface PushInfoService { + + + + Boolean pushInfo(PushInfoVo pushInfoVo); + + CommonResult GetTask(String collectid); + + + Boolean repairTask(String masterId); +} diff --git a/src/main/java/com/emr/service/ipml/PushInfoServiceImpl.java b/src/main/java/com/emr/service/ipml/PushInfoServiceImpl.java new file mode 100644 index 0000000..aa3e81c --- /dev/null +++ b/src/main/java/com/emr/service/ipml/PushInfoServiceImpl.java @@ -0,0 +1,161 @@ +package com.emr.service.ipml; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.serializer.SerializerFeature; +import com.emr.dao.Archive_MasterMapper; +import com.emr.dao.PushInfoMapper; +import com.emr.entity.Archive_Master; +import com.emr.entity.Archive_Master_Vo; +import com.emr.service.PushInfoService; +import com.emr.util.CommonResult; +import com.emr.util.RedisMq; +import com.emr.vo.PrintParam; +import com.emr.vo.PushInfoVo; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import java.text.SimpleDateFormat; +import java.util.Arrays; +import java.util.Date; +import java.util.List; + +/** + * @ClassName pushInfoServiceImpl + * @Description 佛山三院电子病历/护理记录实现类 + * @Author linjj + * @Date 2023/12/11 14:51 + * @Version 1.0 + */ +@Service +public class PushInfoServiceImpl implements PushInfoService { + + @Autowired + private Archive_MasterMapper archiveMasterMapper; + + @Autowired + private PushInfoMapper pushInfoMapper; + private String redisKey = "docus:task:topic_collect_%s_queue:%s"; + @Autowired(required = false) + private RedisMq redisMq; + @Value("${doctorFlag}") + private String doctorFlag; + + + @Value("${nurseFlag}") + private String nurseFlag; + + @Value("${collectIdList}") + private String collectIdList; + + @Override + public Boolean pushInfo(PushInfoVo pushInfoVo) { + boolean exist = false; + //将采集器标识转为集合 + List doctorList = Arrays.asList(doctorFlag.split(",")); + List nurseFlagList = Arrays.asList(nurseFlag.split(",")); + List list = archiveMasterMapper.getArchiveMaster(pushInfoVo.getInpNo(), pushInfoVo.getVisitId()); + PrintParam printParam = new PrintParam(); + printParam.setMasterId(list.get(0).getId()); + printParam.setInpNo(pushInfoVo.getInpNo()); + printParam.setVisitId(pushInfoVo.getVisitId()); + printParam.setDeptName(list.get(0).getDeptName()); + printParam.setDischargeDateTime(list.get(0).getDischargeDateTime()); + printParam.setName(list.get(0).getName()); + //判断类型为电子病历或护理记录接1.电子病历2.护理记录 + if (pushInfoVo.getDataType() == 1) { + int i = archiveMasterMapper.updateCmtDoctorByInpNoAndVisitId(pushInfoVo.getInpNo(), pushInfoVo.getVisitId(), pushInfoVo.getSubmitTime(), pushInfoVo.getSubmitCode()); + if (i == 1) { + exist = true; + } + //判断医生护士是否全部提交 + submitStatic(pushInfoVo.getInpNo(), pushInfoVo.getVisitId()); + //保存记录到提交示踪表 + addPushTracer(pushInfoVo); + for (String doctorId : doctorList) { + //存放队列消息 + GenerateQueue(printParam, 5, doctorId); + } + } + if (pushInfoVo.getDataType() == 2) { + int i = archiveMasterMapper.updateCmtNurseByInpNoAndVisitId(pushInfoVo.getInpNo(), pushInfoVo.getVisitId(), pushInfoVo.getSubmitTime(), pushInfoVo.getSubmitCode()); + if (i == 1) { + exist = true; + } + //判断医生护士是否全部提交 + submitStatic(pushInfoVo.getInpNo(), pushInfoVo.getVisitId()); + //保存记录到提交示踪表 + addPushTracer(pushInfoVo); + for (String nurseId : nurseFlagList) { + //存放队列消息 + GenerateQueue(printParam, 5, nurseId); + } + } + return exist; + } + + @Override + public CommonResult GetTask(String collectid) { + String message = ""; + for (int i = 10; i >= 1; i--) { + String key = String.format(redisKey, collectid, i); + message = redisMq.pop(key); + if (!StringUtils.isEmpty(message) && !message.equals("null")) { + break; + } + } + if (StringUtils.isEmpty(message) || message.equals("null")) { + return CommonResult.failed("暂无队列数据"); + } else { + PrintParam data = JSON.parseObject(message, PrintParam.class); + return CommonResult.success(data); + } + } + + @Override + public Boolean repairTask(String masterId) { + boolean exist = false; + //补偿所有采集器id集合 + List idList = Arrays.asList(collectIdList.split(",")); + //获取患者基础信息 + List list = archiveMasterMapper.getArchiveMasterByMasterId(masterId); + PrintParam printParam = new PrintParam(); + printParam.setMasterId(list.get(0).getId()); + printParam.setInpNo(list.get(0).getInpNo()); + printParam.setVisitId(list.get(0).getVisitId()); + printParam.setDeptName(list.get(0).getDeptName()); + printParam.setDischargeDateTime(list.get(0).getDischargeDateTime()); + printParam.setName(list.get(0).getName()); + //存放队列消息 + for (String id : idList) { + GenerateQueue(printParam, 10, id); + exist = true; + } + return exist; + } + + + //生成队列消息 + private void GenerateQueue(PrintParam data, Integer ispriority, String collectid) { + String key = String.format(redisKey, collectid, ispriority); + redisMq.push(key, JSON.toJSONString(data, SerializerFeature.WriteDateUseDateFormat, SerializerFeature.WriteMapNullValue)); + + } + + //判断医生护士是否全部提交 + void submitStatic(String inpNo, String visitId) { + //判断医生护士是否全部提交 + int submitStatic = archiveMasterMapper.getSubmitStatic(inpNo, visitId); + //如果全部提交将改病历修改为病案室终审 + if (submitStatic == 1) { + archiveMasterMapper.updateArchiveStateByInpNoAndVisitId(inpNo, visitId); + } + } + + void addPushTracer(PushInfoVo pushInfoVo) { + pushInfoMapper.addPushTracer(pushInfoVo); + } + + +} diff --git a/src/main/java/com/emr/util/CommonResult.java b/src/main/java/com/emr/util/CommonResult.java new file mode 100644 index 0000000..9fb481d --- /dev/null +++ b/src/main/java/com/emr/util/CommonResult.java @@ -0,0 +1,151 @@ +package com.emr.util; + + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * + * @author docus + * @date 2020/3/28 16:23 + */ +@Data + +@AllArgsConstructor +@NoArgsConstructor +public class CommonResult { + + private Integer code; + + private String msg; + + private T data; + + public CommonResult(Integer code, String msg) { + this.code = code; + this.msg = msg; + } + + /** + * 成功返回结果 + * + * @param data 获取的数据 + * @param + * @return + */ + public static CommonResult success(T data) { + return new CommonResult(ResultCode.SUCCESS.getCode(), ResultCode.SUCCESS.getMessage(), data); + } + + /** + * 成功返回结果 + * + * @param data 获取的数据 + * @param message 提示信息 + * @param + * @return + */ + public static CommonResult success(T data, String message) { + return new CommonResult(ResultCode.SUCCESS.getCode(), message, data); + } + + /** + * 失败返回结果 + * + * @param errorCode 错误码 + * @param + * @return + */ + public static CommonResult failed(IErrorCode errorCode) { + return new CommonResult(errorCode.getCode(), errorCode.getMessage(), null); + } + + /** + * 失败返回结果 + * + * @param errorCode 错误码 + * @param message 提示信息 + * @param + * @return + */ + public static CommonResult failed(IErrorCode errorCode, String message) { + return new CommonResult(errorCode.getCode(), message, null); + } + + /** + * 失败返回结果 + * + * @param message 提示信息 + * @param + * @return + */ + public static CommonResult failed(String message) { + return new CommonResult(ResultCode.FAILED.getCode(), message, null); + } + + + /** + * 失败返回结果 + * + * @param + * @return + */ + public static CommonResult failed() { + return failed(ResultCode.FAILED); + } + + /** + * 参数验证失败返回结果 + * + * @param + * @return + */ + public static CommonResult validateFailed() { + return failed(ResultCode.VALIDATE_FAILED); + } + + /** + * 提示信息 + * + * @param message 提示信息 + * @param + * @return + */ + public static CommonResult validateFailed(String message) { + return new CommonResult(ResultCode.VALIDATE_FAILED.getCode(), message, null); + } + + /** + * 未登录返回结果 + * + * @param data 获取的数据 + * @param + * @return + */ + public static CommonResult unauthorized(T data) { + return new CommonResult(ResultCode.UNAUTHORIZED.getCode(), ResultCode.UNAUTHORIZED.getMessage(), data); + } + + /** + * 重防及重复请求 + * + * @param data 获取的数据 + * @param + * @return + */ + public static CommonResult preventreplay(T data) { + return new CommonResult(ResultCode.PREVENT_REPLAY.getCode(), ResultCode.PREVENT_REPLAY.getMessage(), data); + } + + /** + * 未授权返回结果 + * + * @param data 获取的数据 + * @param + * @return + */ + public static CommonResult forbidden(T data) { + return new CommonResult(ResultCode.FORBIDDEN.getCode(), ResultCode.FORBIDDEN.getMessage(), data); + } +} diff --git a/src/main/java/com/emr/util/IErrorCode.java b/src/main/java/com/emr/util/IErrorCode.java new file mode 100644 index 0000000..7fd8ba5 --- /dev/null +++ b/src/main/java/com/emr/util/IErrorCode.java @@ -0,0 +1,12 @@ +package com.emr.util; + +/** + * @Description 封装API的错误码 + * @Author JacksonTu + * @Date 2020/3/28 16:26 + */ +public interface IErrorCode { + Integer getCode(); + + String getMessage(); +} diff --git a/src/main/java/com/emr/util/Msg.java b/src/main/java/com/emr/util/Msg.java index 0552899..2bc630e 100644 --- a/src/main/java/com/emr/util/Msg.java +++ b/src/main/java/com/emr/util/Msg.java @@ -42,6 +42,23 @@ public class Msg { return result; } + public static Msg pushFail(String msg){ + Msg result=new Msg(); + result.setCode(100); + result.setMsg(msg); + return result; + } + + + public static Msg pushSuccess(String msg){ + Msg result=new Msg(); + result.setCode(200); + result.setMsg(msg); + return result; + } + + + public Msg add(String key,Object value){ this.getExtend().put(key, value); return this; diff --git a/src/main/java/com/emr/util/RedisMq.java b/src/main/java/com/emr/util/RedisMq.java new file mode 100644 index 0000000..1bd36ae --- /dev/null +++ b/src/main/java/com/emr/util/RedisMq.java @@ -0,0 +1,89 @@ +package com.emr.util; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.stereotype.Component; + +import java.util.List; + +@Component +public class RedisMq { + @Autowired + private StringRedisTemplate stringRedisTemplate; + @Autowired + private RedisTemplate redisTemplate; + + /** + * 发送消息 + * + * @param message + */ + public void push(String messageKey, String message) { + String Key = messageKey; + stringRedisTemplate.opsForList().leftPush(Key, message); + } + + public void deleteKey(String Key) + { + try { + redisTemplate.delete(Key); + } catch (Exception e) { + return; + } + } + + public void deleteAllKey(List ids) + { + try { + redisTemplate.delete(ids); + } catch (Exception e) { + return; + } + } + + public void pushAll(String messageKey, List messages) { + String Key = messageKey; + stringRedisTemplate.opsForList().leftPushAll(Key, messages); + } + /** + * 获取队列长度 + * @return + */ + public long size(String messageKey) { + String Key = messageKey; + try { + return stringRedisTemplate.opsForList().size(messageKey); + } catch (Exception e) { + return 0; + } + } + + + /** + * 获取消息,可以对消息进行监听,没有超过监听事件,则返回消息为null + * rightPop:1.key,2.超时时间,3.超时时间类型 + * + * @return + */ + public String pop(String messageKey) { + String Key = messageKey; + try { + return String.valueOf(stringRedisTemplate.opsForList().rightPop(Key)); + } catch (Exception e) { + return null; + } + + } + + + /** + * 是否存在key + * @param messageKey + * @return + */ + public boolean IsExist(String messageKey){ + return stringRedisTemplate.hasKey(messageKey); + } + +} diff --git a/src/main/java/com/emr/util/ResultCode.java b/src/main/java/com/emr/util/ResultCode.java new file mode 100644 index 0000000..289827f --- /dev/null +++ b/src/main/java/com/emr/util/ResultCode.java @@ -0,0 +1,40 @@ +package com.emr.util; + +/** + * @Description 枚举一些常用API操作码 + * @Author JacksonTu + * @Date 2020/3/28 16:26 + */ +public enum ResultCode implements IErrorCode { + + SUCCESS(0, "操作成功"), + FAILED(500, "操作失败"), + VALIDATE_FAILED(404, "参数检验失败"), + UNAUTHORIZED(401, "暂未登录或token已经过期"), + FORBIDDEN(403, "没有相关权限"), + PREVENT_REPLAY(405,"重复请求"), + NOT_EXIST(601,"数据不存在"), + NOT_ENABLE(600,"数据未启用"); + + + + + private Integer code; + private String message; + + private ResultCode(Integer code, String message) { + this.code = code; + this.message = message; + } + + public Integer getCode() { + return code; + } + + public String getMessage() { + return message; + } + + +} + diff --git a/src/main/java/com/emr/vo/PrintParam.java b/src/main/java/com/emr/vo/PrintParam.java new file mode 100644 index 0000000..8f15ddd --- /dev/null +++ b/src/main/java/com/emr/vo/PrintParam.java @@ -0,0 +1,22 @@ +package com.emr.vo; + +import lombok.Data; + +/** + * @ClassName PrintParam + * @Author linjj + * @Date 2023/12/13 9:05 + * @Version 1.0 + */ +@Data +public class PrintParam { + + private String masterId; + + private String inpNo; + private String visitId; + private String name; + private String deptName; + + private String dischargeDateTime; +} diff --git a/src/main/java/com/emr/vo/PushInfoVo.java b/src/main/java/com/emr/vo/PushInfoVo.java new file mode 100644 index 0000000..00d9413 --- /dev/null +++ b/src/main/java/com/emr/vo/PushInfoVo.java @@ -0,0 +1,45 @@ +package com.emr.vo; + + +import lombok.Data; +import org.hibernate.validator.constraints.NotBlank; + +import javax.validation.constraints.NotNull; + +/** + * @ClassName pushInfoVo + * @Description 佛山三院电子病历/护理记录入参 + * @Author linjj + * @Date 2023/12/7 15:07 + * @Version 1.0 + */ +@Data +public class PushInfoVo { + + //住院流水号 + @NotBlank(message = "住院流水号不能为空") + private String inhospNo; + //住院号 + @NotBlank(message = "住院号不能为空") + private String inpNo; + //住院次数 + @NotBlank(message = "住住院次数不能为空") + private String visitId; + //患者姓名 + @NotBlank(message = "患者姓名不能为空") + private String name; + //提交时间 + @NotBlank(message = "提交时间不能为空") + private String submitTime; + //提交类型1.电子病历2.护理记录 + @NotNull(message = "提交类型不能为空") + private int dataType; + //提交用户工号 + @NotBlank(message = "提交用户工号不能为空") + private String submitCode; + //提交用户姓名 + @NotBlank(message = "提交用户姓名不能为空") + private String submitNameString; + + +} diff --git a/src/main/resources/config/applicationContext-redis.xml b/src/main/resources/config/applicationContext-redis.xml new file mode 100644 index 0000000..a312c0c --- /dev/null +++ b/src/main/resources/config/applicationContext-redis.xml @@ -0,0 +1,80 @@ + + + + Redis configuration + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/config/applicationContext-shiro.xml b/src/main/resources/config/applicationContext-shiro.xml index 1cdf370..b302913 100644 --- a/src/main/resources/config/applicationContext-shiro.xml +++ b/src/main/resources/config/applicationContext-shiro.xml @@ -12,6 +12,7 @@ /toLogin=anon + /font/**=anon /static/**=anon /error=authc /test=anon diff --git a/src/main/resources/config/applicationContext.xml b/src/main/resources/config/applicationContext.xml index 2ab764c..bb8e066 100644 --- a/src/main/resources/config/applicationContext.xml +++ b/src/main/resources/config/applicationContext.xml @@ -21,7 +21,6 @@ http://www.springframework.org/schema/task/spring-task.xsd"> - @@ -30,7 +29,7 @@ - + @@ -39,34 +38,33 @@ - + - + - + - + - + - + - - - - - - + + + + + + - + - + - + - @@ -142,7 +140,6 @@ - @@ -169,12 +166,22 @@ + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/config/config.properties b/src/main/resources/config/config.properties index 231114a..0fd8234 100644 --- a/src/main/resources/config/config.properties +++ b/src/main/resources/config/config.properties @@ -54,4 +54,11 @@ allAddortIds = 00000000 overDateSet = 2021-05-01 #\u5404\u5BA1\u6838\u89D2\u8272\u7528\u6237id 1\uFF1A\u533B\u751F\uFF1B2\uFF1A\u62A4\u58EB\uFF1B3\uFF1A\u75C5\u6848\u5BA4\u4EBA\u5458\uFF1B5\uFF1A\u533B\u751F\u8D28\u63A7\u5458\uFF1B6\uFF1A\u79D1\u4E3B\u4EFB\uFF1B7\uFF1A\u62A4\u58EB\u957F\uFF1B8\uFF1A\u62A4\u58EB\u8D28\u63A7\u5458 - +#电子病历采集器标识 +doctorFlag= 2,15,8 +#护理记录采集器标识 +nurseFlag= 1 +#补偿采集器标识 +collectIdList= 1,2,15,8 +#定时需要补偿的采集器id +scheduledFlag=1,2,15,8 diff --git a/src/main/resources/config/redis.properties b/src/main/resources/config/redis.properties new file mode 100644 index 0000000..084c52b --- /dev/null +++ b/src/main/resources/config/redis.properties @@ -0,0 +1,34 @@ +#redis pool config +redis.pool.maxActive=1000 +redis.pool.maxIdle=100 +redis.pool.maxWaitMillis=10000 +redis.pool.testOnBorrow=true + +#redis config +redis.host=127.0.0.1 +redis.port=6379 +redis.timeout=6000 +#redis.password=123456 +redis.dbindex=8 +redis.usePool=1 +redis.default.expire=1800000 + + + + + + +#redis pool config +#redis.pool.maxActive=1000 +#redis.pool.maxIdle=100 +#redis.pool.maxWaitMillis=10000 +#redis.pool.testOnBorrow=true +# +##redis config +#redis.host=127.0.0.1 +#redis.port=16379 +#redis.timeout=6000 +#redis.password=docus@702 +#redis.dbindex=8 +#redis.usePool=1 +#redis.default.expire=1800000 \ No newline at end of file diff --git a/src/main/resources/config/webService.xml b/src/main/resources/config/webService.xml deleted file mode 100644 index e69de29..0000000 diff --git a/src/main/resources/mapper/Archive_MasterMapper.xml b/src/main/resources/mapper/Archive_MasterMapper.xml index e762429..66d327b 100644 --- a/src/main/resources/mapper/Archive_MasterMapper.xml +++ b/src/main/resources/mapper/Archive_MasterMapper.xml @@ -49,6 +49,10 @@ + + + + @@ -58,30 +62,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - + id, patient_id, inp_no, visit_id, name, sex, dept_name, discharge_date_time, ArchiveState, admission_date_time, dept_admission_to, check_doctor, check_datetime, checked_doctor, @@ -462,7 +443,11 @@ archive_master.dept_admission_to, archive_master.LockInfo, archive_master.DOCTOR_IN_CHARGE, - archive_master.D1 + archive_master.D1, + archive_master.cmt_doctor, + archive_master.cmt_nurse, + archive_master.cmt_doctor_date, + archive_master.cmt_nurse_date @@ -701,7 +686,7 @@ ) archive_master - ORDER BY archive_master.dept_name,archive_master.discharge_date_time desc + ORDER BY archive_master.discharge_date_time desc @@ -1582,6 +1567,18 @@ where id = #{id,jdbcType=NVARCHAR} + + update archive_master set cmt_doctor=1,cmt_doctor_date=#{submitTime},cmt_doctor_name=#{submitCode} + where inp_no=#{inpNo} and visit_id=#{visitId} + + + update archive_master set cmt_nurse=1,cmt_nurse_date=#{submitTime},cmt_nurse_name=#{submitCode} + where inp_no=#{inpNo} and visit_id=#{visitId} + + + update archive_master set ArchiveState='64' + where inp_no=#{inpNo} and visit_id=#{visitId} + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/PushInfoMapper.xml b/src/main/resources/mapper/PushInfoMapper.xml new file mode 100644 index 0000000..ab81c1a --- /dev/null +++ b/src/main/resources/mapper/PushInfoMapper.xml @@ -0,0 +1,60 @@ + + + + + + insert into push_tracer + + + inhospNo, + + + inpNo, + + + visitId, + + + name, + + + submitTime, + + + dataType, + + + submitCode, + + + submitNameString, + + + + + #{inhospNo}, + + + #{inpNo}, + + + #{visitId}, + + + #{name}, + + + #{submitTime}, + + + #{dataType}, + + + #{submitCode}, + + + #{submitNameString}, + + + + diff --git a/src/main/webapp/static/js/beHospList/beHospList.js b/src/main/webapp/static/js/beHospList/beHospList.js index 7c14212..c36521e 100644 --- a/src/main/webapp/static/js/beHospList/beHospList.js +++ b/src/main/webapp/static/js/beHospList/beHospList.js @@ -130,13 +130,6 @@ function initTable() { field: 'doctorInCharge', align: 'left' }, - // { - // title: '状态', - // field: 'status', - // align: 'center', - // valign: 'middle', - // formatter:paramsMatter - // }, { title: '是否完整', field: 'lockinfo', @@ -150,6 +143,44 @@ function initTable() { } } }, + { + title: '医生提交状态', + field: 'cmtDoctor', + align: 'center', + valign: 'middle', + formatter:function(value, row){ + if(value == '1'){ + return ''; + }else{ + return ''; + } + } + }, + { + title: '医生提交时间', + field: 'cmtDoctorDate', + align: 'center', + valign: 'middle', + }, + { + title: '护士提交状态', + field: 'cmtNurse', + align: 'center', + valign: 'middle', + formatter:function(value, row){ + if(value == '1'){ + return ''; + }else{ + return ''; + } + } + }, + { + title: '护士提交时间', + field: 'cmtnurseDate', + align: 'center', + valign: 'middle', + }, // { // title: 'HIS召回状态', // field: 'callBackStatus',