diff --git a/dataConfig/homeQualitySet.json b/dataConfig/homeQualitySet.json index b5db7db..d54b3cd 100644 --- a/dataConfig/homeQualitySet.json +++ b/dataConfig/homeQualitySet.json @@ -1,30 +1,111 @@ +//{ +// //----------响应标签------------- +// //外部结构,多层,隔开 +// "ResHead":"Response,RetInfo", +// //响应代码 +// "ResCode":"RetCode", +// //响应消息 +// "ResMsg":"RetCon", +// //成功编码 +// "successCode":"0", +// //失败编码 +// "errorCode":"1", +// +// //唯一键目录结构数组,最高层为前面,最后一层为数据采集层,根节点不填 +// "directory":["Msg"], +// //患者主索引号 +// "indexFlag":"INHOSP_NO", +// //采集流水号 +// "serialnum":"IDNO", +// //文件标题 +// "filetitle":"FILENAME", +// //排序时间 +// "sortingTime":"MIN_TIME", +// //下载地址,&代表多个选其一 +// "downurl":"PDF_PATH", +// //护理提交时间 +// "nurseSubmitTime": "SUBMIT_TIME", +// //医生提交时间 +// "doctorSubmitTime": "SUBMIT_TIME", +// //分类id +// "assortid":"", +// //系统id +// "collectorid":"1", +// //获取分类id参数 +// "assortidParamKey":"TABLE_TYPE", +// //采集类型(文件来源 1:采集器;2:扫描生产软件) +// "filesource":1, +// //下载类型(1:服务器本地;2:ftp服务器;3:共享文件夹) +// "filestoragetype":1, +// //上传接口 +// "uploadConnector":"http://192.9.100.171:9291/api/downplatform/report", +// //基本数据存放处,根节点不填,最后一层为基本信息存放标签与doubleBasic配合 +// "basicDirectory":[""], +// //可能存在存储基本数据不同情况的标签 +// "doubleBasic":["ITEM"], +// +// //--------------采集操作判断撤销/新增--------------- +// //是否开启采集操作判断撤销/新增 0:不开启,1:开启 默认不开启 +// "isJudge":"0", +// //判断标签存在目录,首个标签不填 +// "judgeDirectory":[""], +// //判定标签,值0-新增;1-撤回;2-修改 +// "judgeIndex":"", +// +// +// //--------撤销配置部分------------ +// //采集流水号所在位置,根目录不填 +// "repealDirectory":[""], +// //采集流水号名 +// "repealSerialnum":"UNIQUE_ID", +// //撤销接口 +// "repoalConnector":"http://192.9.100.171:9291/api/down/cancel", +// "urlReplace":["","","","","","","","","",""], +// +// //---------住院接口配置部分----------- +// "zyUrl":"http://192.9.100.32:9022/ktin/api/webservice/ChasWebService?wsdl", +// // "zyUrl":"http://localhost:9000/services/api?wsdl", +// "zyMethod":"ChasMessageServer", +// // "zyMethod":"getPdfId", +// "zyNamespance":"http://webservice.http.plugins.api.his.karrytech.com/", +// // "zyNamespance":"http://server.webservice.example.com", +// "zyDirectory":["PDF_DETAIL_INFO"], +// "pdfUrl":"http://192.9.100.32:9022/ktin/api/flow/flow-mra-getpdffile?PDF_ID=", +// "zysj":"2022-01-28" +// +//} { //----------响应标签------------- //外部结构,多层,隔开 - "ResHead":"Response,Result", + "ResHead":"Response,RetInfo", //响应代码 - "ResCode":"Code", + "ResCode":"RetCode", //响应消息 - "ResMsg":"Msg", + "ResMsg":"RetCon", //成功编码 - "successCode":"1", + "successCode":"0", //失败编码 - "errorCode":"0", + "errorCode":"1", //唯一键目录结构数组,最高层为前面,最后一层为数据采集层,根节点不填 - "directory":[], + "directory":["Msg"], //患者主索引号 - "indexFlag":"VISITING_SERIAL_NUMBER", + "indexFlag":"INHOSP_NO", //采集流水号 - "serialnum":"UNIQUE_ID", + "serialnum":"IDNO", //文件标题 - "filetitle":"DOCUMENT_TITLE", + "filetitle":"FILENAME", + //医生提交时间 + "doctorSubmitTime":"SUBMIT_TIME", + //下载地址,&代表多个选其一 - "downurl":"BASE64&ORIGINAL_URL", + "downurl":"PDF_PATH", + //电子病历排序时间 + "sortingTime":"MIN_TIME", //分类id - "assortid":"", + "assortid":"Wiw213woq412awqe41", //系统id - "collectorid":"2", + "collectorid":"22", //获取分类id参数 "assortidParamKey":"DOCUMENT_TOPIC", //采集类型(文件来源 1:采集器;2:扫描生产软件) @@ -32,11 +113,11 @@ //下载类型(1:服务器本地;2:ftp服务器;3:共享文件夹) "filestoragetype":1, //上传接口 - "uploadConnector":"http://127.0.0.1:9291/api/downplatform/report", + "uploadConnector":"http://192.9.100.171:9291/api/downplatform/report", //基本数据存放处,根节点不填,最后一层为基本信息存放标签与doubleBasic配合 "basicDirectory":[""], //可能存在存储基本数据不同情况的标签 - "doubleBasic":["TestItemInfo","BioTestInfo"], + "doubleBasic":["ITEM"], //--------------采集操作判断撤销/新增--------------- //是否开启采集操作判断撤销/新增 0:不开启,1:开启 默认不开启 @@ -49,11 +130,23 @@ //--------撤销配置部分------------ //采集流水号所在位置,根目录不填 - "repealDirectory":["DOCUMENT"], + "repealDirectory":[""], //采集流水号名 "repealSerialnum":"UNIQUE_ID", //撤销接口 - "repoalConnector":"http://127.0.0.1:9291/api/down/cancel", - "urlReplace":["","","",""] + "repoalConnector":"http://192.9.100.171:9291/api/down/cancel", + "urlReplace":[], + + //---------住院接口配置部分----------- + "zyUrl":"http://192.9.100.32:9022/ktin/api/webservice/ChasWebService?wsdl", + // "zyUrl":"http://localhost:9000/services/api?wsdl", + "zyMethod":"ChasMessageServer", + // "zyMethod":"getPdfId", + "zyNamespance":"http://webservice.http.plugins.api.his.karrytech.com/", + // "zyNamespance":"http://server.webservice.example.com", + "zyDirectory":["PDF_DETAIL_INFO"], + "pdfUrl":"http://192.9.100.32:9022/ktin/api/flow/flow-mra-getpdffile?PDF_ID=", + "zysj":"2022-01-28" + +} -} \ No newline at end of file diff --git a/dataConfig/广东省中医院住院电子病历采集-homeQualitySet.json b/dataConfig/广东省中医院住院电子病历采集-homeQualitySet.json index 850bc33..0f272cc 100644 --- a/dataConfig/广东省中医院住院电子病历采集-homeQualitySet.json +++ b/dataConfig/广东省中医院住院电子病历采集-homeQualitySet.json @@ -19,8 +19,13 @@ "serialnum":"IDNO", //文件标题 "filetitle":"FILENAME", + //医生提交时间 + "doctorSubmitTime":"SUBMIT_TIME", + //下载地址,&代表多个选其一 "downurl":"PDF_PATH", + //电子病历排序时间 + "sortingTime":"MIN_TIME", //分类id "assortid":"Wiw213woq412awqe41", //系统id diff --git a/dataConfig/广东省中医院住院病理-homeQualitySet.json b/dataConfig/广东省中医院住院病理-homeQualitySet.json index d991384..d7115e8 100644 --- a/dataConfig/广东省中医院住院病理-homeQualitySet.json +++ b/dataConfig/广东省中医院住院病理-homeQualitySet.json @@ -15,6 +15,10 @@ "directory":["Msg"], //患者主索引号 "indexFlag":"PatInfo,INHOSP_NO", + //检查申请日期时间 + "examApplyDate": "ExamInfo,EXAM_APPLY_DATETIME", + //住院号 + "inPatientNo": "PatInfo,INHOSP_INDEX_NO", //采集流水号 "serialnum":"ReportInfo,UPDATE_REPORT_NO", //文件标题 diff --git a/dataConfig/广东省中医院护理文书-homeQualitySet.json b/dataConfig/广东省中医院护理文书-homeQualitySet.json index 84cbf39..eeb1d6b 100644 --- a/dataConfig/广东省中医院护理文书-homeQualitySet.json +++ b/dataConfig/广东省中医院护理文书-homeQualitySet.json @@ -19,6 +19,8 @@ "serialnum":"IDNO", //文件标题 "filetitle":"FILENAME", + //护士提交时间 + "nurseSubmitTime":"SUBMIT_TIME", //下载地址,&代表多个选其一 "downurl":"PDF_PATH", //分类id diff --git a/pom.xml b/pom.xml index 0795ca7..f067891 100644 --- a/pom.xml +++ b/pom.xml @@ -17,6 +17,16 @@ 1.8 + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-logging + + + org.springframework.boot spring-boot-starter @@ -43,10 +53,7 @@ mysql-connector-java 8.0.15 - - org.springframework.boot - spring-boot-starter-web - + org.projectlombok lombok diff --git a/src/main/java/com/docus/bgts/entity/ReportDownScanFileDto.java b/src/main/java/com/docus/bgts/entity/ReportDownScanFileDto.java index 9ef7c04..c366ada 100644 --- a/src/main/java/com/docus/bgts/entity/ReportDownScanFileDto.java +++ b/src/main/java/com/docus/bgts/entity/ReportDownScanFileDto.java @@ -17,6 +17,8 @@ public class ReportDownScanFileDto { private String recordid; @ApiModelProperty("采集流水号") private String serialnum; + @ApiModelProperty("排序时间") + private String sortdate; @ApiModelProperty(value = "任务id") private Long taskid; @ApiModelProperty("文件类型(1:url,2:base64)") diff --git a/src/main/java/com/docus/bgts/entity/TBasicExtend.java b/src/main/java/com/docus/bgts/entity/TBasicExtend.java new file mode 100644 index 0000000..3997d08 --- /dev/null +++ b/src/main/java/com/docus/bgts/entity/TBasicExtend.java @@ -0,0 +1,44 @@ +package com.docus.bgts.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + *

+ * 病案基本信息扩展表 + *

+ * + * @author jiashi + * @since 2022-06-13 + */ +@Data +@EqualsAndHashCode +@ApiModel(value="TBasicExtend对象", description="病案基本信息扩展表") +public class TBasicExtend { + @ApiModelProperty(value = "病案主键") + @TableId(value = "patient_id", type = IdType.ASSIGN_ID) + private String patientId; + @ApiModelProperty(value = "报销政策代码") + private String claimPolicyCode; + @ApiModelProperty(value = "报销政策名称") + private String claimPolicyName; + @ApiModelProperty(value = "医保结算类型代码") + private String mioSettleTypeCode; + @ApiModelProperty(value = "医保结算类型名称") + private String mioSettleTypeName; + @ApiModelProperty(value = "医生提交时间") + private Date doctorSubmitTime; + @ApiModelProperty(value = "护理提交时间") + private Date nurseSubmitTime; + @ApiModelProperty(value = "责任护士") + private String dutyNurse; + @ApiModelProperty(value = "预住院流水号") + private String preJzh; +} diff --git a/src/main/java/com/docus/bgts/facade/IAfCollectTaskService.java b/src/main/java/com/docus/bgts/facade/IAfCollectTaskService.java index c3ddf38..9fd2549 100644 --- a/src/main/java/com/docus/bgts/facade/IAfCollectTaskService.java +++ b/src/main/java/com/docus/bgts/facade/IAfCollectTaskService.java @@ -2,10 +2,8 @@ package com.docus.bgts.facade; import com.baomidou.mybatisplus.extension.service.IService; -import com.docus.bgts.entity.AfCollectTask; -import com.docus.bgts.entity.CanlcelDto; -import com.docus.bgts.entity.ReportDownDto; -import com.docus.bgts.entity.ZdAssort; +import com.docus.bgts.entity.*; +import org.apache.ibatis.annotations.Param; import java.util.Date; import java.util.List; @@ -24,30 +22,92 @@ public interface IAfCollectTaskService extends IService { */ String getpatientIdByEmpId(String empId); + String getNameByPatientId(String patientId); + + String getOutpatientIdByJzhel(String jzh); + void insert(ReportDownDto reportDownDto); + void insertOut(ReportDownDto reportDownDto); + void updateInterfaceCollect(String collectSubId, int state); - List listJZHByDate(String date1,String date2); + List listJZHByDate(String date1, String date2); /** * 撤销文件功能 + * * @param canlcelDto */ void invokeRepoalFile(CanlcelDto canlcelDto) throws Exception; + String selectJzh(String inPatientNo, String examApplyDate); + /** * 获取assortId 通过assortId + * * @param assortId * @return */ String getAssortIdByAssortId(String assortId); + /** * 获取assortId 通过assortName + * * @param assortId * @return */ String getAssortIdByAssortName(String assortId); void insertZdAssort(ZdAssort zdAssort); + + /** + * 删除af_downfile表数据 + */ + int deleteByPatientIdAndCollectorId(String patientId, String collectorId); + + /** + * 删除t_scan_assort表数据 + */ + int deleteByPatientIdAndAssortId(String patientId, String assortId); + + /** + * 删除af_collect_task表数据 + */ + int deleteByPatientIdAndSysFlag(String patientId, String sysFlag); + + /** + * 添加护理提交时间 + * + * @param reportDownDto + * @param nurseSubmitTime + * @return + */ + int updateNurseSubmitTime(ReportDownDto reportDownDto, String nurseSubmitTime); + + /** + * 添加医生提交时间 + * + * @param reportDownDto + * @param doctorSubmitTime + * @return + */ + int updateDoctorSubmitTime(ReportDownDto reportDownDto, String doctorSubmitTime); + + /** + * 添加护士提交状态 + */ + void insertNurseState(ReportDownDto reportDownDto, String nurseSubmitTime); + + /** + * 添加医生提交状态 + */ + void insertDoctorState(ReportDownDto reportDownDto, String doctorSubmitTime); + + TBasic selectDisDateIsNull( String inPatientNo); + + String selectDisDateIsNullJzh(String inPatientNo,String examApplyDate); + + + } diff --git a/src/main/java/com/docus/bgts/handler/ITBasicWebService.java b/src/main/java/com/docus/bgts/handler/ITBasicWebService.java index 87a7e0e..b283235 100644 --- a/src/main/java/com/docus/bgts/handler/ITBasicWebService.java +++ b/src/main/java/com/docus/bgts/handler/ITBasicWebService.java @@ -13,20 +13,27 @@ public interface ITBasicWebService { @WebMethod String pushSurveyReport(String xml); - /** - * 电子病理采集(梅州人民医院) - * @param xml - * @return - */ - @WebMethod - String EmrDocumentArchive(String xml); +// /** +// * 电子病理采集(梅州人民医院) +// * @param xml +// * @return +// */ +// @WebMethod +// String EmrDocumentArchive(String xml); +// +// /** +// * 电子病理撤销(梅州人民医院) +// * @param xml +// * @return +// */ +// @WebMethod +// String EmrDocumentArchiveCancel(String xml); /** - * 电子病理撤销(梅州人民医院) - * @param xml + * 肇庆人医门急诊 * @return */ @WebMethod - String EmrDocumentArchiveCancel(String xml); + String outPatient(String xml); } diff --git a/src/main/java/com/docus/bgts/handler/TBasicWebService.java b/src/main/java/com/docus/bgts/handler/TBasicWebService.java index 8eed3ba..122bd95 100644 --- a/src/main/java/com/docus/bgts/handler/TBasicWebService.java +++ b/src/main/java/com/docus/bgts/handler/TBasicWebService.java @@ -2,31 +2,45 @@ package com.docus.bgts.handler; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.docus.bgts.entity.*; import com.docus.bgts.enums.Codes; import com.docus.bgts.facade.IAfCollectTaskService; import com.docus.bgts.facade.IMrReportErrorService; +import com.docus.bgts.mapper.TBasicExtendMapper; +import com.docus.bgts.mapper.TBasicMapper; +import com.docus.bgts.mapper.TScanAssortMapper; import com.docus.bgts.utils.FileUtils; import com.docus.bgts.utils.HttpUtils; import com.docus.bgts.utils.ResultUtils; import com.docus.bgts.utils.XmlUtils; +//import com.sun.xml.internal.ws.util.xml.XmlUtil; +import org.apache.commons.lang3.CharEncoding; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.exception.ExceptionUtils; import org.dom4j.Document; import org.dom4j.DocumentException; import org.dom4j.Element; +import org.dom4j.Namespace; import org.dom4j.io.SAXReader; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import sun.misc.BASE64Decoder; import javax.jws.WebService; -import java.io.ByteArrayInputStream; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; +import java.io.*; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.text.SimpleDateFormat; import java.util.*; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; +import java.util.stream.Collectors; +import java.util.stream.Stream; @WebService public class TBasicWebService implements ITBasicWebService { @@ -37,6 +51,15 @@ public class TBasicWebService implements ITBasicWebService { @Autowired IMrReportErrorService mrReportErrorService; + @Autowired + TBasicMapper tBasicMapper; + + @Autowired + TBasicExtendMapper tBasicExtendMapper; + + @Autowired + TScanAssortMapper tScanAssortMapper; + // private Object lock = new Object(); private final Logger logger = LoggerFactory.getLogger(getClass()); @@ -59,6 +82,7 @@ public class TBasicWebService implements ITBasicWebService { @Override public String pushSurveyReport(String xml) { + long l6 = System.currentTimeMillis(); try { logger.info("报告推送入参:" + xml); // 1、创建document对象 @@ -66,11 +90,18 @@ public class TBasicWebService implements ITBasicWebService { //解析XML XmlUtils xmlUtils = new XmlUtils(new ByteArrayInputStream(xml.getBytes("UTF-8"))); //获取数据存在的节点节点 + Element elementRoot = xmlUtils.getMsgElement(); //key String serialnmnKey = String.valueOf(FileUtils.getJsonByName("serialnum")); String filetitleKey = String.valueOf(FileUtils.getJsonByName("filetitle")); String downurlKey = String.valueOf(FileUtils.getJsonByName("downurl")); + String nurseSubmitTime = String.valueOf(FileUtils.getJsonByName("nurseSubmitTime")); + String doctorSubmitTime = String.valueOf(FileUtils.getJsonByName("doctorSubmitTime")); + String examApplyDate = String.valueOf(FileUtils.getJsonByName("examApplyDate")); + String inPatientNo = String.valueOf(FileUtils.getJsonByName("inPatientNo")); + //电子病历排序时间 + String sortingTimeKey = String.valueOf(FileUtils.getJsonByName("sortingTime")); // 获取患者主索引号 String empId = String.valueOf(FileUtils.getJsonByName(Codes.EMP_ID.getMessage())); //判断是否为撤销 @@ -110,8 +141,15 @@ public class TBasicWebService implements ITBasicWebService { String serialnum; String filetitle; String downurl; + String sortingTime; + String assortid; String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid")); - String assortid = getAssortid(elementRoot); + if(collectorid.equals("1")){ + assortid = String.valueOf(FileUtils.getJsonByName("assortid")); + }else { + assortid = getAssortid(elementRoot); + } + reportDownDto = new ReportDownDto(); reportDownDto.setCollectorid(collectorid); reportDownDto.setAssortid(assortid); @@ -121,21 +159,77 @@ public class TBasicWebService implements ITBasicWebService { //获取jzh String empIdText = getElementText(elementRoot, empId.split(",")); + //病理没有就诊流水号的根据住院号和检查申请日期时间匹配患者 +// String empIdText = getElementTextCanBeEmpty(elementRoot, empId.split(",")); +// if (null==empIdText||empIdText.equals("")){ +// String examApplyDates = getElementText(elementRoot, examApplyDate.split(",")); +// String inPatientNos = getElementText(elementRoot, inPatientNo.split(",")); +// empIdText = afCollectTaskService.selectJzh(inPatientNos, examApplyDates); +// if (null==empIdText){ +// TBasic tBasic = afCollectTaskService.selectDisDateIsNull(inPatientNos); +// if (null!=tBasic){ +// empIdText = tBasic.getJzh(); +// }else { +// throw new RuntimeException("住院号未匹配到患者"); +// } +// } +// +// } + + + + // doctorSubmitTime = getElementText(elementRoot, doctorSubmitTime.split(",")); + + /** + * 删除电子病历数据 + */ + + long l2 = System.currentTimeMillis(); + String patientId = afCollectTaskService.getpatientIdByEmpId(empIdText); + long l3 = System.currentTimeMillis(); + logger.info("查询patient_id耗时"+(l3-l2)); + //删除af_downfile表数据 +// long l4 = System.currentTimeMillis(); +// int i = afCollectTaskService.deleteByPatientIdAndCollectorId(patientId, collectorid); +// long l5 = System.currentTimeMillis(); +// logger.info("删除"+empIdText+"af_downfile表"+i+"条数据耗时-----"+(l5-l4)); +// //删除t_scan_assort表数据 +// long l8 = System.currentTimeMillis(); +// int i1 = afCollectTaskService.deleteByPatientIdAndAssortId(patientId, assortid); +// long l11 = System.currentTimeMillis(); +// logger.info("删除"+empIdText+"t_scan_assort表"+i1+"条数据耗时-----"+(l11-l8)); +// //删除af_collect_task表数据 +// long l9 = System.currentTimeMillis(); +// int i2 = afCollectTaskService.deleteByPatientIdAndSysFlag(patientId, collectorid); +// long l10 = System.currentTimeMillis(); +// logger.info("删除"+empIdText+"af_collect_task表"+i2+"条数据耗时-----"+(l10-l9)); +// + reportDownPatientDto.setJzh(empIdText); logger.info("患者主索引号:" + empIdText); reportDownDto.setPatient(reportDownPatientDto); List elementList = xmlUtils.getJsonByName(elementRoot); - for (Element element : elementList) { filetitle = getElementText(element, filetitleKey.split(",")); downurl = getElementText(element, downurlKey.split(",")); - downurl = handleDownUrl(downurl); + //downurl = handleDownUrl(downurl); + //添加护理提交时间 +// if (filetitle.equals("体温单")||filetitle.equals("护理记录单(通用)")||filetitle.equals("首次护理记录单(通用)")){ +// nurseSubmitTime = getElementText(element, nurseSubmitTime.split(",")); +// afCollectTaskService.updateNurseSubmitTime(reportDownDto, nurseSubmitTime); +// afCollectTaskService.insertNurseState(reportDownDto,nurseSubmitTime); +// } + + + //获取电子病历排序时间 + sortingTime = getElementTextCanBeEmpty(element,sortingTimeKey.split(",")); //获取采集流水号 serialnum = getElementText(element, serialnmnKey.split(",")); reportDownScanFileDto = new ReportDownScanFileDto(); reportDownScanFileDto.setDownurl(downurl); reportDownScanFileDto.setFiletitle(filetitle); reportDownScanFileDto.setSerialnum(serialnum); + reportDownScanFileDto.setSortdate(sortingTime); reportDownScanFileDto.setFilesource(Integer.parseInt(String.valueOf(FileUtils.getJsonByName("filesource")))); reportDownScanFileDto.setFilestoragetype(Integer.parseInt(String.valueOf(FileUtils.getJsonByName("filestoragetype")))); //判断是否为base64 @@ -149,23 +243,59 @@ public class TBasicWebService implements ITBasicWebService { } else { reportDownDto.setScanfiles(reportDownDtoArr); } +// if (collectorid.equals("22")){ +// //查询正式住院患者信息 +// TBasic tBasic = tBasicMapper.selectByjzh(empIdText); +// if (null!=tBasic){ +// //查询预住院患者信息 +// TBasicExtend tBasicExtend = tBasicExtendMapper.selectByPatientId(tBasic.getPatientId()); +// if (null!=tBasicExtend){ +// TBasic tBasicPre = tBasicMapper.selectByjzh(tBasicExtend.getPreJzh()); +// if (null!=tBasicPre){ +// int pre = tScanAssortMapper.updateByPatientId(tBasic.getPatientId(), tBasicPre.getPatientId()); +// if (pre <= 0) { +// logger.info("当前预住院没有文件!"); +// }else { +// logger.info("本次预住院合并"+pre+"份报告"); +// } +// }else { +// logger.info("未查询到预住院患者信息!"); +// } +// } +// } +// } + + //插入医生提交时间 + // afCollectTaskService.updateDoctorSubmitTime(reportDownDto, doctorSubmitTime); + //插入医生提交状态 + // afCollectTaskService.insertDoctorState(reportDownDto,doctorSubmitTime); //插入文件af_collect_task表数据 // synchronized (lock) { - afCollectTaskService.insert(reportDownDto); + // System.err.println(reportDownDto); + afCollectTaskService.insert(reportDownDto); + + // } String post = ""; logger.info("--------执行上传功能----------"); + + Map params = JSON.parseObject(JSON.toJSONString(reportDownDto), Map.class); if (reportDownDto.getScanfiles().get(0).getFiletype() == 1) { logger.info("上传参数:" + params); } + long l = System.currentTimeMillis(); post = HttpUtils.post(String.valueOf(FileUtils.getJsonByName(Codes.UPLOAD.getMessage())), headMap, params); + long l1 = System.currentTimeMillis(); + logger.info("请求下载耗时----------"+(l1-l)); // String post = HttpUtils.post(String.valueOf(FileUtils.getJsonByName(Codes.UPLOAD.getMessage())), map, headMap); if (StringUtils.isBlank(post)) { logger.info("--------上传时出现错误,可能是文件服务没有启动----------"); throw new RuntimeException("上传时出现错误,可能是文件服务没有启动"); } Map resMap = JSON.parseObject(post, Map.class); + long l7 = System.currentTimeMillis(); + logger.info("接口总耗时--------"+(l7-l6)); if (String.valueOf(resMap.get("code")).equals("500")) { throw new RuntimeException(String.valueOf(resMap.get("msg"))); } else { @@ -174,13 +304,137 @@ public class TBasicWebService implements ITBasicWebService { } } catch (RuntimeException e) { e.printStackTrace(); - mrReportErrorService.insert(xml); + // mrReportErrorService.insert(xml); logger.error(e.getMessage()); +// String stackTrace = ExceptionUtils.getStackTrace(e); +// logger.info("错误信息----------"+stackTrace); return ResultUtils.fail(e.getMessage()); } catch (Exception e) { + // mrReportErrorService.insert(xml); + logger.error(e.getMessage()); +// String stackTrace = ExceptionUtils.getStackTrace(e); +// logger.info("错误信息----------"+stackTrace); e.printStackTrace(); - mrReportErrorService.insert(xml); + return ResultUtils.fail(e.getMessage()); + } + } + + + /** + * 肇庆门急诊报告接收 + * @param xml + * @return + */ + @Override + public String outPatient(String xml) { + long l6 = System.currentTimeMillis(); + try { + logger.info("报告推送入参:" + xml); + // 1、创建document对象 + xml = "" + xml; + //解析XML + XmlUtils xmlUtils = new XmlUtils(new ByteArrayInputStream(xml.getBytes("UTF-8"))); + //获取数据存在的节点节点 + + Element elementRoot = xmlUtils.getMsgElement(); + //key + String serialnmnKey = String.valueOf(FileUtils.getJsonByName("serialnum")); + String filetitleKey = String.valueOf(FileUtils.getJsonByName("filetitle")); + String downurlKey = String.valueOf(FileUtils.getJsonByName("downurl")); + + // 获取患者主索引号 + String empId = String.valueOf(FileUtils.getJsonByName(Codes.EMP_ID.getMessage())); + + + Map headMap = new HashMap<>(); + headMap.put("Content-Type", "application/json"); + ReportDownDto reportDownDto; + + ReportDownScanFileDto reportDownScanFileDto; + ReportDownPatientDto reportDownPatientDto; + //临时资料存储 + String serialnum; + String filetitle; + String downurl; + // String sortingTime; + int filetype = Integer.parseInt(String.valueOf(FileUtils.getJsonByName("filetype"))); + String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid")); + + String assortid = getAssortid(elementRoot); + reportDownDto = new ReportDownDto(); + reportDownDto.setCollectorid(collectorid); + reportDownDto.setAssortid(assortid); + //获取基本数据信息 + List reportDownDtoArr = new ArrayList<>(); + reportDownPatientDto = new ReportDownPatientDto(); + //获取jzh + String empIdText = getElementText(elementRoot, empId.split(",")); + + reportDownPatientDto.setJzh(empIdText); + logger.info("患者主索引号:" + empIdText); + reportDownDto.setPatient(reportDownPatientDto); + List elementList = xmlUtils.getJsonByName(elementRoot); + for (Element element : elementList) { + filetitle = getElementText(element, filetitleKey.split(",")); + downurl = getElementText(element, downurlKey.split(",")); + serialnum = getElementText(element, serialnmnKey.split(",")); + reportDownScanFileDto = new ReportDownScanFileDto(); + reportDownScanFileDto.setDownurl(downurl.substring(1,downurl.length() - 1)); + reportDownScanFileDto.setFiletitle(filetitle); + reportDownScanFileDto.setSerialnum(serialnum); + reportDownScanFileDto.setFiletype(filetype); + reportDownScanFileDto.setFilesource(Integer.parseInt(String.valueOf(FileUtils.getJsonByName("filesource")))); + reportDownScanFileDto.setFilestoragetype(Integer.parseInt(String.valueOf(FileUtils.getJsonByName("filestoragetype")))); + //判断是否为base64 + if (reportDownScanFileDto.getDownurl().length() > 200) { + reportDownScanFileDto.setFiletype(2); + } + reportDownDtoArr.add(reportDownScanFileDto); + } + if (reportDownDtoArr.size() <= 0) { + throw new RuntimeException("不存在必要的基本信息"); + } else { + reportDownDto.setScanfiles(reportDownDtoArr); + } + + // System.err.println(reportDownDto); + + afCollectTaskService.insertOut(reportDownDto); + + + String post = ""; + logger.info("--------执行上传功能----------"); + Map params = JSON.parseObject(JSON.toJSONString(reportDownDto), Map.class); + logger.info("上传参数:" + params); + long l = System.currentTimeMillis(); + post = HttpUtils.post(String.valueOf(FileUtils.getJsonByName(Codes.UPLOAD.getMessage())), headMap, params); + long l1 = System.currentTimeMillis(); + logger.info("请求下载耗时----------"+(l1-l)); + + if (StringUtils.isBlank(post)) { + logger.info("--------上传时出现错误,可能是文件服务没有启动----------"); + throw new RuntimeException("上传时出现错误,可能是文件服务没有启动"); + } + Map resMap = JSON.parseObject(post, Map.class); + long l7 = System.currentTimeMillis(); + logger.info("接口总耗时--------"+(l7-l6)); + if (String.valueOf(resMap.get("code")).equals("500")) { + throw new RuntimeException(String.valueOf(resMap.get("msg"))); + } else { + logger.info("----------执行成功-----------"); + return ResultUtils.success().asXML(); + } + } catch (RuntimeException e) { + e.printStackTrace(); + logger.error(e.getMessage()); +// String stackTrace = ExceptionUtils.getStackTrace(e); +// logger.info("错误信息----------"+stackTrace); + return ResultUtils.fail(e.getMessage()); + } catch (Exception e) { logger.error(e.getMessage()); +// String stackTrace = ExceptionUtils.getStackTrace(e); +// logger.info("错误信息----------"+stackTrace); + e.printStackTrace(); return ResultUtils.fail(e.getMessage()); } } @@ -194,6 +448,7 @@ public class TBasicWebService implements ITBasicWebService { private String handleDownUrl(String downurl) { String url = ""; try { + XmlUtils xmlUtils = new XmlUtils(new ByteArrayInputStream(downurl.getBytes("UTF-8"))); if (null != xmlUtils) { url = downurl; @@ -204,40 +459,40 @@ public class TBasicWebService implements ITBasicWebService { return url; } } catch (Exception e) { - + e.printStackTrace(); } return ""; } - @Override - public String EmrDocumentArchive(String xml) { - return pushSurveyReport(xml); - } - - @Override - public String EmrDocumentArchiveCancel(String xml) { - try { - logger.info("--------------撤销接收到xml--------------"); - logger.info(xml); - //解析xml,并提取CanlcelDto对象 - CanlcelDto canlcelDto = getCanlCelDtoByXml(xml); - //调用上传服务撤销功能 - afCollectTaskService.invokeRepoalFile(canlcelDto); - logger.info("--------------撤销操作完成-------------"); - return ResultUtils.success().asXML(); - } catch (RuntimeException e) { - logger.info("发送错误:" + e.getMessage()); - mrReportErrorService.insert(xml); - e.printStackTrace(); - return ResultUtils.fail(e.getMessage()); - } catch (Exception e) { - logger.info("发送错误:" + e.getMessage()); - e.printStackTrace(); - mrReportErrorService.insert(xml); - return ResultUtils.fail(e.getMessage()); - } - - } +// @Override +// public String EmrDocumentArchive(String xml) { +// return pushSurveyReport(xml); +// } +// +// @Override +// public String EmrDocumentArchiveCancel(String xml) { +// try { +// logger.info("--------------撤销接收到xml--------------"); +// logger.info(xml); +// //解析xml,并提取CanlcelDto对象 +// CanlcelDto canlcelDto = getCanlCelDtoByXml(xml); +// //调用上传服务撤销功能 +// afCollectTaskService.invokeRepoalFile(canlcelDto); +// logger.info("--------------撤销操作完成-------------"); +// return ResultUtils.success().asXML(); +// } catch (RuntimeException e) { +// logger.info("发送错误:" + e.getMessage()); +// // mrReportErrorService.insert(xml); +// e.printStackTrace(); +// return ResultUtils.fail(e.getMessage()); +// } catch (Exception e) { +// logger.info("发送错误:" + e.getMessage()); +// e.printStackTrace(); +// // mrReportErrorService.insert(xml); +// return ResultUtils.fail(e.getMessage()); +// } +// +// } /** * 解析xml,返回CanlcelDto对象 @@ -316,6 +571,50 @@ public class TBasicWebService implements ITBasicWebService { return resText; } + /** + * 获取key内容 + * + * @param element + * @param args + * @return + */ + private String getElementTextCanBeEmpty(Element element, String[] args) { + String resText = ""; + Element byElement = (Element) element.clone(); + Element byElement1 = null; + String[] split; + for (String arg : args) { + split = arg.split("&"); + if (split.length > 1) { + for (String spi : split) { + if (byElement1 == null) { + byElement1 = byElement.element(spi); + } else { + byElement1 = byElement1.element(spi); + } + + if (byElement1 != null && StringUtils.isNotBlank(byElement1.getText())) { + break; + } else { + byElement1 = null; + } + } + } else { + if (byElement1 == null) { + byElement1 = byElement.element(arg); + } else { + byElement1 = byElement1.element(arg); + } + } + if (byElement1 != null) { + resText = byElement1.getText(); + } else { + break; + } + } + return resText; + } + /** * 获取分类id @@ -352,4 +651,43 @@ public class TBasicWebService implements ITBasicWebService { } return assortId; } + + + public static void depdf() { + // 存放pdf的base64 + Path path = Paths.get("D:\\pdf.txt"); + Stream lines = null; + try { + lines = Files.lines(path); + } catch (IOException e) { + e.printStackTrace(); + } + // 读取文件转换为String + String collect = lines.collect(Collectors.joining(System.lineSeparator())); + String encodedBytes = collect; + BASE64Decoder decoder = new BASE64Decoder(); + byte[] decodedBytes = new byte[0]; + try { + decodedBytes = decoder.decodeBuffer(encodedBytes); + } catch (IOException e) { + e.printStackTrace(); + } + File file = new File("D:\\newfile.pdf"); + FileOutputStream fop = null; + try { + fop = new FileOutputStream(file); + fop.write(decodedBytes); + fop.flush(); + fop.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + +// public static void main(String[] args) { +// depdf(); +// } + + + } diff --git a/src/main/java/com/docus/bgts/mapper/AfCollectTaskMapper.java b/src/main/java/com/docus/bgts/mapper/AfCollectTaskMapper.java index 9d16b44..1464052 100644 --- a/src/main/java/com/docus/bgts/mapper/AfCollectTaskMapper.java +++ b/src/main/java/com/docus/bgts/mapper/AfCollectTaskMapper.java @@ -3,6 +3,8 @@ package com.docus.bgts.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.docus.bgts.entity.AfCollectTask; +import com.docus.bgts.entity.CqcSubmitState; +import com.docus.bgts.entity.TBasic; import com.docus.bgts.entity.ZdAssort; import org.apache.ibatis.annotations.Param; @@ -27,6 +29,14 @@ public interface AfCollectTaskMapper extends BaseMapper { */ String getpatientIdByEmpId(@Param("jzh") String empId); + String selectJzh(@Param("inPatientNo") String inPatientNo,@Param("examApplyDate") String examApplyDate); + + + TBasic selectDisDateIsNull(@Param("inPatientNo") String inPatientNo); + + String selectDisDateIsNullJzh(@Param("inPatientNo") String inPatientNo,@Param("examApplyDate") String examApplyDate); + + /** * 获取assortId 通过assortId * @param assortId @@ -46,4 +56,39 @@ public interface AfCollectTaskMapper extends BaseMapper { * @param zdAssort */ void insertZdAssort(@Param("zdAssort") ZdAssort zdAssort); + + /** + * 删除af_downfile表数据 + */ + int deleteByPatientIdAndCollectorId(@Param("patientId") String patientId,@Param("collectorId") String collectorId); + /** + * 删除t_scan_assort表数据 + */ + int deleteByPatientIdAndAssortId(@Param("patientId") String patientId,@Param("assortId") String assortId); + /** + * 删除af_collect_task表数据 + */ + int deleteByPatientIdAndSysFlag(@Param("patientId") String patientId,@Param("sysFlag") String sysFlag); + + /** + * 添加医生护士提交状态 + */ + int insertDoctorState(CqcSubmitState cqcSubmitState); + + /** + * 修改医生护士提交状态 + */ + int updateDoctorState(CqcSubmitState cqcSubmitState); + + /** + * 根据patientId查询该患者是否存在 + * @param patientId + * @return + */ + CqcSubmitState selectByPatientId(String patientId); + + String selectPatientByjzh(String jzh); + + String selectNameByPatientId(String patientId); + } diff --git a/src/main/java/com/docus/bgts/mapper/TBasicExtendMapper.java b/src/main/java/com/docus/bgts/mapper/TBasicExtendMapper.java new file mode 100644 index 0000000..3f410ca --- /dev/null +++ b/src/main/java/com/docus/bgts/mapper/TBasicExtendMapper.java @@ -0,0 +1,20 @@ +package com.docus.bgts.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.docus.bgts.entity.TBasicExtend; + +/** + *

+ * 病案基本信息扩展 Mapper 接口 + *

+ * + * @author jiashi + * @since 2022-06-13 + */ +public interface TBasicExtendMapper extends BaseMapper { + TBasicExtend selectByPatientId(String patientId); + + int updatenurseSubmitTime(TBasicExtend tBasicExtend); + + int updateDoctorSubmitTime(TBasicExtend tBasicExtend); +} diff --git a/src/main/java/com/docus/bgts/mapper/TBasicMapper.java b/src/main/java/com/docus/bgts/mapper/TBasicMapper.java new file mode 100644 index 0000000..940d697 --- /dev/null +++ b/src/main/java/com/docus/bgts/mapper/TBasicMapper.java @@ -0,0 +1,19 @@ +package com.docus.bgts.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.docus.bgts.entity.TBasic; + +/** + *

+ * 病案基本信息 Mapper 接口 + *

+ * + * @author jiashi + * @since 2021-04-14 + */ +public interface TBasicMapper extends BaseMapper { + TBasic selectByjzh(String jzh); + + TBasic selectByPatientId(String patientId); +} diff --git a/src/main/java/com/docus/bgts/mapper/TScanAssortMapper.java b/src/main/java/com/docus/bgts/mapper/TScanAssortMapper.java new file mode 100644 index 0000000..fa93217 --- /dev/null +++ b/src/main/java/com/docus/bgts/mapper/TScanAssortMapper.java @@ -0,0 +1,17 @@ +package com.docus.bgts.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.docus.bgts.entity.TBasic; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 病案文件信息 Mapper 接口 + *

+ * + * @author jiashi + * @since 2022-11-21 + */ +public interface TScanAssortMapper extends BaseMapper { + int updateByPatientId(@Param("patientId") String PatientId,@Param("PrePatientId") String PrePatientId); +} diff --git a/src/main/java/com/docus/bgts/service/AfCollectTaskServiceImpl.java b/src/main/java/com/docus/bgts/service/AfCollectTaskServiceImpl.java index 49b53e2..8030f98 100644 --- a/src/main/java/com/docus/bgts/service/AfCollectTaskServiceImpl.java +++ b/src/main/java/com/docus/bgts/service/AfCollectTaskServiceImpl.java @@ -10,8 +10,10 @@ import com.docus.bgts.facade.IAfCollectTaskService; import com.docus.bgts.mapper.AfCollectTaskMapper; import com.docus.bgts.mapper.AfInterfaceCollectMapper; import com.docus.bgts.mapper.AfInterfaceCollectSubMapper; +import com.docus.bgts.mapper.TBasicExtendMapper; import com.docus.bgts.utils.FileUtils; import com.docus.bgts.utils.HttpUtils; +import com.docus.bgts.utils.ResultUtils; import com.docus.bgts.utils.XmlUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; @@ -22,10 +24,8 @@ import org.springframework.transaction.annotation.Transactional; import java.io.ByteArrayInputStream; import java.io.UnsupportedEncodingException; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.text.SimpleDateFormat; +import java.util.*; /** *

@@ -49,12 +49,84 @@ public class AfCollectTaskServiceImpl extends ServiceImpl scanfiles = reportDownDto.getScanfiles(); + for (ReportDownScanFileDto scanfile : scanfiles) { + long l = System.currentTimeMillis(); + + // 判断任务是否已存在 + afCollectTask = afCollectTaskMapper.selectOne(new QueryWrapper().eq("C1", scanfile.getSerialnum()).eq("sysflag", reportDownDto.getCollectorid())); + if (afCollectTask == null || afCollectTask.getId() == null) { + //不存在 新增 + afCollectTask = new AfCollectTask(); + afCollectTask.setPatientId(patientId); + afCollectTask.setSysflag(reportDownDto.getCollectorid()); + afCollectTask.setState("0"); + afCollectTask.setSyncTime(date); + afCollectTask.setC1(scanfile.getSerialnum()); + afCollectTask.setC2(scanfile.getFiletitle()); + afCollectTask.setC3(reportDownDto.getPatient().getJzh()); + save = afCollectTaskMapper.insert(afCollectTask); + + } else { + + //存在就修改 + afCollectTask.setPatientId(patientId); + afCollectTask.setSysflag(reportDownDto.getCollectorid()); + afCollectTask.setState("0"); + afCollectTask.setSyncTime(date); + afCollectTask.setC1(scanfile.getSerialnum()); + afCollectTask.setC2(scanfile.getFiletitle()); + afCollectTask.setC3(reportDownDto.getPatient().getJzh()); + save = afCollectTaskMapper.updateById(afCollectTask); + + } + + if (save <= 0) { + log.info("任务表操作出错"); + throw new RuntimeException("插入病案任务表数据出错"); + } + if (afCollectTask.getId() != null) { + scanfile.setTaskid(afCollectTask.getId()); + } else { + log.info("插入任务id为空!"); + throw new RuntimeException("插入任务id为空"); + } + } + reportDownDto.setScanfiles(scanfiles); + } + @Transactional @Override public void insert(ReportDownDto reportDownDto) { @@ -70,6 +142,8 @@ public class AfCollectTaskServiceImpl extends ServiceImpl scanfiles = reportDownDto.getScanfiles(); for (ReportDownScanFileDto scanfile : scanfiles) { + long l = System.currentTimeMillis(); + // 判断任务是否已存在 afCollectTask = afCollectTaskMapper.selectOne(new QueryWrapper().eq("C1", scanfile.getSerialnum()).eq("sysflag", reportDownDto.getCollectorid())); if (afCollectTask == null || afCollectTask.getId() == null) { @@ -83,7 +157,9 @@ public class AfCollectTaskServiceImpl extends ServiceImpl headMap = new HashMap<>(); + headMap.put("Content-Type", "application/json"); + Map> params = new HashMap<>(); + List list = new ArrayList<>(); + list.add("护士"); + list.add(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(tBasicExtend.getNurseSubmitTime())); + params.put(patientId, list); + params = JSON.parseObject(JSON.toJSONString(params), Map.class); + String post = HttpUtils.postSubmit("http://192.9.100.171:9102/basic/tlog/saveLog?nodeCode=again_submit&" + "userName=" + name + "&" + "name=" + name, headMap, params); + Map resMap = JSON.parseObject(post, Map.class); + long l7 = System.currentTimeMillis(); + if (String.valueOf(resMap.get("code")).equals("500")) { + throw new RuntimeException(String.valueOf(resMap.get("msg"))); + } else { + System.err.println("返回值为--" + resMap); + } + } + } else { + TBasicExtend tBasicExtend1 = new TBasicExtend(); + tBasicExtend1.setPatientId(patientId); + //暂时使用当前时间为提交时间 + // tBasicExtend1.setNurseSubmitTime(new Date()); + tBasicExtend1.setNurseSubmitTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(nurseSubmitTime)); + update = tBasicExtendMapper.insert(tBasicExtend1); + } + } catch (Exception e) { + e.printStackTrace(); + log.error(e.getMessage()); + } + return update; + } + + @Override + public int updateDoctorSubmitTime(ReportDownDto reportDownDto, String doctorSubmitTime) { + String patientId = getpatientIdByEmpId(reportDownDto.getPatient().getJzh()); + TBasicExtend tBasicExtend = tBasicExtendMapper.selectByPatientId(patientId); + int update = 0; + log.info("医生提交方法------"); + try { + SimpleDateFormat simple = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date submitTime = simple.parse(doctorSubmitTime); + //TBasicExtend存在修改,不存在就新增 + if (null != tBasicExtend) { + tBasicExtend.setDoctorSubmitTime(submitTime); + update = tBasicExtendMapper.updateDoctorSubmitTime(tBasicExtend); + try { + if (null != patientId && null != tBasicExtend.getDoctorSubmitTime()) { + String name = getNameByPatientId(patientId); + Map headMap = new HashMap<>(); + headMap.put("Content-Type", "application/json"); + Map> params = new HashMap<>(); + List list = new ArrayList<>(); + list.add("医生"); + list.add(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(tBasicExtend.getDoctorSubmitTime())); + params.put(patientId, list); + params = JSON.parseObject(JSON.toJSONString(params), Map.class); + long l = System.currentTimeMillis(); + String post = HttpUtils.postSubmit("http://192.9.100.171:9102/basic/tlog/saveLog?nodeCode=again_submit&" + "userName=" + name + "&" + "name=" + name, headMap, params); + long l1 = System.currentTimeMillis(); + log.info("调用示踪接口耗时{}", (l1 - l)); + Map resMap = JSON.parseObject(post, Map.class); + long l7 = System.currentTimeMillis(); + if (String.valueOf(resMap.get("code")).equals("500")) { + log.info("调用示踪接口返回----" + resMap); + throw new RuntimeException(String.valueOf(resMap.get("msg"))); + } else { + log.info("调用示踪接口返回----" + resMap); + } + } else { + log.info("未调用示踪接口-----"); + } + } catch (Exception e) { + log.error(e.getMessage()); + } + } else { + TBasicExtend tBasicExtend1 = new TBasicExtend(); + tBasicExtend1.setPatientId(patientId); + tBasicExtend1.setDoctorSubmitTime(submitTime); + update = tBasicExtendMapper.insert(tBasicExtend1); + } + } catch (Exception e) { + e.printStackTrace(); + log.error(e.getMessage()); + } + return update; + } + + @Override + public void insertNurseState(ReportDownDto reportDownDto, String nurseSubmitTime) { + String patientId = getpatientIdByEmpId(reportDownDto.getPatient().getJzh()); + if (StringUtils.isBlank(patientId)) { + throw new RuntimeException("操作的病案信息不存在"); + } + CqcSubmitState cqcSubmitState1 = afCollectTaskMapper.selectByPatientId(patientId); + if (null == cqcSubmitState1) { + CqcSubmitState cqcSubmitState = new CqcSubmitState(); + cqcSubmitState.setPatientId(patientId); + if (null != nurseSubmitTime && !("").equals(nurseSubmitTime)) { + cqcSubmitState.setNurseState(1); + } else { + cqcSubmitState.setNurseState(0); + } + int i = afCollectTaskMapper.insertDoctorState(cqcSubmitState); + + } else { + if (null != nurseSubmitTime && !("").equals(nurseSubmitTime)) { + cqcSubmitState1.setNurseState(1); + } else { + cqcSubmitState1.setNurseState(0); + } + afCollectTaskMapper.updateDoctorState(cqcSubmitState1); + } + + } + + @Override + public void insertDoctorState(ReportDownDto reportDownDto, String doctorSubmitTime) { + String patientId = getpatientIdByEmpId(reportDownDto.getPatient().getJzh()); + if (StringUtils.isBlank(patientId)) { + throw new RuntimeException("操作的病案信息不存在"); + } + CqcSubmitState cqcSubmitState1 = afCollectTaskMapper.selectByPatientId(patientId); + if (null == cqcSubmitState1) { + CqcSubmitState cqcSubmitState = new CqcSubmitState(); + cqcSubmitState.setPatientId(patientId); + if (null != doctorSubmitTime && !("").equals(doctorSubmitTime)) { + cqcSubmitState.setDoctorState(1); + } else { + cqcSubmitState.setDoctorState(0); + } + afCollectTaskMapper.insertDoctorState(cqcSubmitState); + + } else { + if (null != doctorSubmitTime && !("").equals(doctorSubmitTime)) { + cqcSubmitState1.setDoctorState(1); + } else { + cqcSubmitState1.setDoctorState(0); + } + afCollectTaskMapper.updateDoctorState(cqcSubmitState1); + } + + } + + @Override + public TBasic selectDisDateIsNull(String inPatientNo) { + return afCollectTaskMapper.selectDisDateIsNull(inPatientNo); + } + + @Override + public String selectDisDateIsNullJzh(String inPatientNo, String examApplyDate) { + return afCollectTaskMapper.selectDisDateIsNullJzh(inPatientNo, examApplyDate); + } + } diff --git a/src/main/java/com/docus/bgts/utils/HttpUtils.java b/src/main/java/com/docus/bgts/utils/HttpUtils.java index 470ebbd..328e772 100644 --- a/src/main/java/com/docus/bgts/utils/HttpUtils.java +++ b/src/main/java/com/docus/bgts/utils/HttpUtils.java @@ -1,6 +1,7 @@ package com.docus.bgts.utils; import com.alibaba.fastjson.JSON; +import lombok.extern.slf4j.Slf4j; import org.apache.http.HttpEntity; import org.apache.http.NameValuePair; import org.apache.http.client.ClientProtocolException; @@ -14,18 +15,23 @@ import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URISyntaxException; import java.util.ArrayList; +import java.util.List; import java.util.Map; +@Slf4j public class HttpUtils { private static PoolingHttpClientConnectionManager cm; private static String EMPTY_STR = ""; private static String UTF_8 = "UTF-8"; + private static void init() { if (cm == null) { cm = new PoolingHttpClientConnectionManager(); @@ -141,12 +147,27 @@ public class HttpUtils { httpPost.addHeader(param.getKey(), String.valueOf(param.getValue())); } } + log.info("调用下载参数----" + JSON.toJSONString(params)); + httpPost.setEntity(new StringEntity(JSON.toJSONString(params), ContentType.APPLICATION_JSON)); + + return getResult(httpPost); + } + + public static String postSubmit(String url, Map headers, Map> params) + throws UnsupportedEncodingException { + HttpPost httpPost = new HttpPost(url); + if (params != null) { + for (Map.Entry param : headers.entrySet()) { + httpPost.addHeader(param.getKey(), String.valueOf(param.getValue())); + } + } httpPost.setEntity(new StringEntity(JSON.toJSONString(params), ContentType.APPLICATION_JSON)); return getResult(httpPost); } + /** * 处理Http请求 * diff --git a/src/main/java/com/docus/bgts/utils/XmlUtils.java b/src/main/java/com/docus/bgts/utils/XmlUtils.java index 5fa7aa9..d290163 100644 --- a/src/main/java/com/docus/bgts/utils/XmlUtils.java +++ b/src/main/java/com/docus/bgts/utils/XmlUtils.java @@ -35,11 +35,16 @@ public class XmlUtils { } } - public XmlUtils(InputStream path) throws Exception{ + public XmlUtils(InputStream path){ //获取解析器 saxReader = new SAXReader(); + try{ //获取文档对象 document = saxReader.read(path); + }catch (DocumentException e){ + e.printStackTrace(); + } + } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 8ea2999..dd1af26 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,5 +1,5 @@ server: - port: 9701 + port: 9205 # http mybatis-plus: @@ -15,8 +15,8 @@ beat: url: http://localhost:9399/beat system: - code: "EmrDocAr" - prop: 9801 + code: "empcllect" + prop: 9405 # web service @@ -25,4 +25,4 @@ spring: driver-class-name: com.mysql.cj.jdbc.Driver username: docus password: docus702 - url: jdbc:mysql://db.docus.cn:3306/docus_archivefile?characterEncoding=utf8&useSSL=false&serverTimezone=UTC&rewriteBatchedStatements=true \ No newline at end of file + url: jdbc:mysql://localhost:3306/docus_archivefile?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true&allowMultiQueries=true \ No newline at end of file diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml index d053ce9..6946a53 100644 --- a/src/main/resources/logback-spring.xml +++ b/src/main/resources/logback-spring.xml @@ -21,8 +21,8 @@ log/demo.%d.%i.log - - 15 + + 90 10MB diff --git a/src/main/resources/mapper/AfCollectTaskMapper.xml b/src/main/resources/mapper/AfCollectTaskMapper.xml index ae30d10..a13b053 100644 --- a/src/main/resources/mapper/AfCollectTaskMapper.xml +++ b/src/main/resources/mapper/AfCollectTaskMapper.xml @@ -4,6 +4,7 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> + - + + + + insert into zd_assort(assort_id,assort_name,effective) values(#{zdAssort.assortId},#{zdAssort.assortName},#{zdAssort.effective}) + + + delete from af_downfile where + patient_id=#{patientId} and collectorid=#{collectorId} + + + + delete from t_scan_assort where + patient_id=#{patientId} and assort_id=#{assortId} + + + delete from af_collect_task where + patient_id=#{patientId} and sysflag=#{sysFlag} + + + + insert into docus_medicalrecord.cqc_submit_state(patient_id,doctor_state,nurse_state) values(#{patientId},#{doctorState},#{nurseState}) + + + + update docus_medicalrecord.cqc_submit_state + + + doctor_state=#{doctorState}, + + + + nurse_state=#{nurseState}, + + + where patient_id=#{patientId} + + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/TBasicExtendMapper.xml b/src/main/resources/mapper/TBasicExtendMapper.xml new file mode 100644 index 0000000..66b3341 --- /dev/null +++ b/src/main/resources/mapper/TBasicExtendMapper.xml @@ -0,0 +1,27 @@ + + + + + update docus_medicalrecord.t_basic_extend + set nurse_submit_time=#{nurseSubmitTime} + where patient_id=#{patientId} + + + update docus_medicalrecord.t_basic_extend + set doctor_submit_time=#{doctorSubmitTime} + where patient_id=#{patientId} + + + + insert into docus_medicalrecord.t_basic_extend (patient_id,claim_policy_code,claim_policy_name,mio_settle_type_code,mio_settle_type_name,doctor_submit_time,nurse_submit_time,duty_nurse) + values (#{patientId},#{claimPolicyCode},#{claimPolicyName},#{mioSettleTypeCode},#{mioSettleTypeName},#{doctorSubmitTime},#{nurseSubmitTime},#{dutyNurse}) + + \ No newline at end of file diff --git a/src/main/resources/mapper/TBasicMapper.xml b/src/main/resources/mapper/TBasicMapper.xml new file mode 100644 index 0000000..a309095 --- /dev/null +++ b/src/main/resources/mapper/TBasicMapper.xml @@ -0,0 +1,63 @@ + + + + + update docus_medicalrecord.t_basic + + + IPAddress=#{pcmachine.ipaddress}, + + + LastOnline=#{pcmachine.lastonline}, + + + PCStatus=#{pcmachine.pcstatus} + + + IPAddress=#{pcmachine.ipaddress}, + + + LastOnline=#{pcmachine.lastonline}, + + + PCStatus=#{pcmachine.pcstatus} + + + IPAddress=#{pcmachine.ipaddress}, + + + LastOnline=#{pcmachine.lastonline}, + + + PCStatus=#{pcmachine.pcstatus} + + + IPAddress=#{pcmachine.ipaddress}, + + + LastOnline=#{pcmachine.lastonline}, + + + PCStatus=#{pcmachine.pcstatus} + + + IPAddress=#{pcmachine.ipaddress}, + + + LastOnline=#{pcmachine.lastonline}, + + + PCStatus=#{pcmachine.pcstatus} + + + where id=#{pcmachine.id} + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/TScanAssortMapper.xml b/src/main/resources/mapper/TScanAssortMapper.xml new file mode 100644 index 0000000..89d3ddd --- /dev/null +++ b/src/main/resources/mapper/TScanAssortMapper.xml @@ -0,0 +1,10 @@ + + + + +update docus_archivefile.t_scan_assort set patient_id=#{patientId},assort_id='Wiw213woq412awqe42' where patient_id=#{PrePatientId} + + + \ No newline at end of file