master
tan 2 years ago
parent 4849eb9c09
commit 518d31f7a8

@ -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:2ftp3)
// "filestoragetype":1,
// //
// "uploadConnector":"http://192.9.100.171:9291/api/downplatform/report",
// //doubleBasic
// "basicDirectory":[""],
// //
// "doubleBasic":["ITEM"],
//
// //--------------/---------------
// /// 01
// "isJudge":"0",
// //
// "judgeDirectory":[""],
// //,0-1-2-
// "judgeIndex":"",
//
//
// //--------------------
// //,
// "repealDirectory":[""],
// //
// "repealSerialnum":"UNIQUE_ID",
// //
// "repoalConnector":"http://192.9.100.171:9291/api/down/cancel",
// "urlReplace":["<ORIGINAL_URL>","</ORIGINAL_URL>","<REPORT_URLS>","</REPORT_URLS>","<URL>","</URL>","<ImageFiles>","</ImageFiles>","<ImageFile>","</ImageFile>"],
//
// //--------------------
// "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:2ftp3)
"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"],
//--------------/---------------
/// 01
@ -49,11 +130,23 @@
//--------------------
//,
"repealDirectory":["DOCUMENT"],
"repealDirectory":[""],
//
"repealSerialnum":"UNIQUE_ID",
//
"repoalConnector":"http://127.0.0.1:9291/api/down/cancel",
"urlReplace":["<REPORT_URLS>","</REPORT_URLS>","<URL>","</URL>"]
"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"
}
}

@ -19,8 +19,13 @@
"serialnum":"IDNO",
//
"filetitle":"FILENAME",
//
"doctorSubmitTime":"SUBMIT_TIME",
//,&
"downurl":"PDF_PATH",
//
"sortingTime":"MIN_TIME",
//id
"assortid":"Wiw213woq412awqe41",
//id

@ -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",
//

@ -19,6 +19,8 @@
"serialnum":"IDNO",
//
"filetitle":"FILENAME",
//
"nurseSubmitTime":"SUBMIT_TIME",
//,&
"downurl":"PDF_PATH",
//id

@ -17,6 +17,16 @@
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
@ -43,10 +53,7 @@
<artifactId>mysql-connector-java</artifactId>
<version>8.0.15</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>

@ -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)")

@ -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;
/**
* <p>
*
* </p>
*
* @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;
}

@ -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<AfCollectTask> {
*/
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<String> listJZHByDate(String date1,String date2);
List<String> 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);
}

@ -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);
}

@ -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<Element> 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 version=\"1.0\" encoding=\"UTF-8\" ?>" + 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<String, Object> 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<ReportDownScanFileDto> reportDownDtoArr = new ArrayList<>();
reportDownPatientDto = new ReportDownPatientDto();
//获取jzh
String empIdText = getElementText(elementRoot, empId.split(","));
reportDownPatientDto.setJzh(empIdText);
logger.info("患者主索引号:" + empIdText);
reportDownDto.setPatient(reportDownPatientDto);
List<Element> 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());
// }
//
// }
/**
* xmlCanlcelDto
@ -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<String> 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();
// }
}

@ -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<AfCollectTask> {
*/
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<AfCollectTask> {
* @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);
}

@ -0,0 +1,20 @@
package com.docus.bgts.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.docus.bgts.entity.TBasicExtend;
/**
* <p>
* Mapper
* </p>
*
* @author jiashi
* @since 2022-06-13
*/
public interface TBasicExtendMapper extends BaseMapper<TBasicExtend> {
TBasicExtend selectByPatientId(String patientId);
int updatenurseSubmitTime(TBasicExtend tBasicExtend);
int updateDoctorSubmitTime(TBasicExtend tBasicExtend);
}

@ -0,0 +1,19 @@
package com.docus.bgts.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.docus.bgts.entity.TBasic;
/**
* <p>
* Mapper
* </p>
*
* @author jiashi
* @since 2021-04-14
*/
public interface TBasicMapper extends BaseMapper<TBasic> {
TBasic selectByjzh(String jzh);
TBasic selectByPatientId(String patientId);
}

@ -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;
/**
* <p>
* Mapper
* </p>
*
* @author jiashi
* @since 2022-11-21
*/
public interface TScanAssortMapper extends BaseMapper<TBasic> {
int updateByPatientId(@Param("patientId") String PatientId,@Param("PrePatientId") String PrePatientId);
}

@ -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.*;
/**
* <p>
@ -49,12 +49,84 @@ public class AfCollectTaskServiceImpl extends ServiceImpl<AfCollectTaskMapper, A
@Autowired
AfInterfaceCollectSubMapper afInterfaceCollectSubMapper;
@Autowired
TBasicExtendMapper tBasicExtendMapper;
@Override
public String getpatientIdByEmpId(String empId) {
String patientId = afCollectTaskMapper.getpatientIdByEmpId(empId);
return patientId;
}
@Override
public String getNameByPatientId(String patientId) {
return afCollectTaskMapper.selectNameByPatientId(patientId);
}
@Override
public String getOutpatientIdByJzhel(String jzh) {
return afCollectTaskMapper.selectPatientByjzh(jzh);
}
@Transactional
@Override
public void insertOut(ReportDownDto reportDownDto) {
if (reportDownDto.getScanfiles().get(0).getFiletype() == 1) {
log.info("新增任务表初始数据:" + reportDownDto);
}
AfCollectTask afCollectTask;
String patientId = getOutpatientIdByJzhel(reportDownDto.getPatient().getJzh());
if (StringUtils.isBlank(patientId)) {
throw new RuntimeException("操作的病案信息不存在");
}
Date date = new Date();
Integer save = null;
List<ReportDownScanFileDto> scanfiles = reportDownDto.getScanfiles();
for (ReportDownScanFileDto scanfile : scanfiles) {
long l = System.currentTimeMillis();
// 判断任务是否已存在
afCollectTask = afCollectTaskMapper.selectOne(new QueryWrapper<AfCollectTask>().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<AfCollectTaskMapper, A
Integer save = null;
List<ReportDownScanFileDto> scanfiles = reportDownDto.getScanfiles();
for (ReportDownScanFileDto scanfile : scanfiles) {
long l = System.currentTimeMillis();
// 判断任务是否已存在
afCollectTask = afCollectTaskMapper.selectOne(new QueryWrapper<AfCollectTask>().eq("C1", scanfile.getSerialnum()).eq("sysflag", reportDownDto.getCollectorid()));
if (afCollectTask == null || afCollectTask.getId() == null) {
@ -83,7 +157,9 @@ public class AfCollectTaskServiceImpl extends ServiceImpl<AfCollectTaskMapper, A
afCollectTask.setC2(scanfile.getFiletitle());
afCollectTask.setC3(reportDownDto.getPatient().getJzh());
save = afCollectTaskMapper.insert(afCollectTask);
} else {
//存在就修改
afCollectTask.setPatientId(patientId);
afCollectTask.setSysflag(reportDownDto.getCollectorid());
@ -93,6 +169,7 @@ public class AfCollectTaskServiceImpl extends ServiceImpl<AfCollectTaskMapper, A
afCollectTask.setC2(scanfile.getFiletitle());
afCollectTask.setC3(reportDownDto.getPatient().getJzh());
save = afCollectTaskMapper.updateById(afCollectTask);
}
if (save <= 0) {
@ -151,6 +228,11 @@ public class AfCollectTaskServiceImpl extends ServiceImpl<AfCollectTaskMapper, A
}
}
@Override
public String selectJzh(String inPatientNo, String examApplyDate) {
return afCollectTaskMapper.selectJzh(inPatientNo, examApplyDate);
}
@Override
public String getAssortIdByAssortId(String assortId) {
return afCollectTaskMapper.getAssortIdByAssortId(assortId);
@ -166,4 +248,187 @@ public class AfCollectTaskServiceImpl extends ServiceImpl<AfCollectTaskMapper, A
afCollectTaskMapper.insertZdAssort(zdAssort);
}
@Override
public int deleteByPatientIdAndCollectorId(String patientId, String collectorId) {
return afCollectTaskMapper.deleteByPatientIdAndCollectorId(patientId, collectorId);
}
@Override
public int deleteByPatientIdAndAssortId(String patientId, String assortId) {
return afCollectTaskMapper.deleteByPatientIdAndAssortId(patientId, assortId);
}
@Override
public int deleteByPatientIdAndSysFlag(String patientId, String sysFlag) {
return afCollectTaskMapper.deleteByPatientIdAndSysFlag(patientId, sysFlag);
}
@Override
public int updateNurseSubmitTime(ReportDownDto reportDownDto, String nurseSubmitTime) {
String patientId = getpatientIdByEmpId(reportDownDto.getPatient().getJzh());
TBasicExtend tBasicExtend = tBasicExtendMapper.selectByPatientId(patientId);
int update = 0;
try {
//TBasicExtend存在修改不存在就新增
if (null != tBasicExtend) {
//暂时使用当前时间为提交时间
tBasicExtend.setNurseSubmitTime(new Date());
// tBasicExtend.setNurseSubmitTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(nurseSubmitTime));
update = tBasicExtendMapper.updatenurseSubmitTime(tBasicExtend);
if (null != patientId && null != tBasicExtend.getNurseSubmitTime()) {
String name = getNameByPatientId(patientId);
Map<String, Object> headMap = new HashMap<>();
headMap.put("Content-Type", "application/json");
Map<String, List<String>> params = new HashMap<>();
List<String> 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<String, Object> headMap = new HashMap<>();
headMap.put("Content-Type", "application/json");
Map<String, List<String>> params = new HashMap<>();
List<String> 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);
}
}

@ -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<String, Object> headers, Map<String, List<String>> params)
throws UnsupportedEncodingException {
HttpPost httpPost = new HttpPost(url);
if (params != null) {
for (Map.Entry<String, Object> 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
*

@ -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();
}
}

@ -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
url: jdbc:mysql://localhost:3306/docus_archivefile?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true&allowMultiQueries=true

@ -21,8 +21,8 @@
<!-- 活动文件的名字会根据fileNamePattern的值每隔一段时间改变一次 -->
<!-- 文件名log/demo.2017-12-05.0.log -->
<fileNamePattern>log/demo.%d.%i.log</fileNamePattern>
<!-- 每产生一个日志文件,该日志文件的保存期限为15-->
<maxHistory>15</maxHistory>
<!-- 每产生一个日志文件,该日志文件的保存期限为30-->
<maxHistory>90</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- maxFileSize:这是活动文件的大小默认值是10MB测试时可改成1KB看效果 -->
<maxFileSize>10MB</maxFileSize>

@ -4,6 +4,7 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.docus.bgts.mapper.AfCollectTaskMapper">
<select id="listJZHByDate" resultType="string">
select jzh
from docus_medicalrecord.t_basic a
@ -17,7 +18,32 @@
(select C3 from af_collect_task where sysflag=22 and state=3)
order by create_time asc
</select>
<select id="selectDisDateIsNull" resultType="com.docus.bgts.entity.TBasic">
select *
from docus_medicalrecord.t_basic
where inpatient_no=#{inPatientNo}
and dis_date is null
</select>
<select id="selectDisDateIsNullJzh" resultType="string">
select t.jzh
from(
select admiss_date,dis_date,jzh
from docus_medicalrecord.t_basic
where inpatient_no=#{inPatientNo} and dis_date is null and ph is null
) t
where date_sub(t.admiss_date, interval 6 hour) &lt;= #{examApplyDate}
</select>
<select id="selectJzh" resultType="string">
select t.jzh
from(
select admiss_date,dis_date,jzh,ph
from docus_medicalrecord.t_basic
where inpatient_no=#{inPatientNo}
) t
where date_sub(t.admiss_date, interval 6 hour) &lt;= #{examApplyDate}
and date_add(t.dis_date, interval 6 hour) &gt;= #{examApplyDate}
and t.ph is null
</select>
<select id="getpatientIdByEmpId" resultType="string">
select patient_id
from docus_medicalrecord.t_basic
@ -32,7 +58,55 @@
select assort_id from zd_assort where assort_name=#{assortName}
</select>
<insert id="insertZdAssort">
insert into zd_assort(assort_id,assort_name,effective) values(#{zdAssort.assortId},#{zdAssort.assortName},#{zdAssort.effective})
</insert>
<delete id="deleteByPatientIdAndCollectorId">
delete from af_downfile where
patient_id=#{patientId} and collectorid=#{collectorId}
</delete>
<delete id="deleteByPatientIdAndAssortId">
delete from t_scan_assort where
patient_id=#{patientId} and assort_id=#{assortId}
</delete>
<delete id="deleteByPatientIdAndSysFlag">
delete from af_collect_task where
patient_id=#{patientId} and sysflag=#{sysFlag}
</delete>
<insert id="insertDoctorState">
insert into docus_medicalrecord.cqc_submit_state(patient_id,doctor_state,nurse_state) values(#{patientId},#{doctorState},#{nurseState})
</insert>
<update id="updateDoctorState">
update docus_medicalrecord.cqc_submit_state
<set>
<if test="doctorState!=null">
doctor_state=#{doctorState},
</if>
<if test="nurseState!=null">
nurse_state=#{nurseState},
</if>
</set>
where patient_id=#{patientId}
</update>
<select id="selectByPatientId" resultType="com.docus.bgts.entity.CqcSubmitState">
select * from docus_medicalrecord.cqc_submit_state
where patient_id=#{patientId}
</select>
<select id="selectPatientByjzh" resultType="java.lang.String">
select patient_id
from docus_medicalrecord.t_basic_out
where jzh=#{jzh}
</select>
<select id="selectNameByPatientId" resultType="java.lang.String">
select creater_name from docus_medicalrecord.cqc_back_info_log where patient_id=#{patientId} and create_time in
(select max(create_time) from docus_medicalrecord.cqc_back_info_log where patient_id=#{patientId})
</select>
</mapper>

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.docus.bgts.mapper.TBasicExtendMapper">
<update id="updatenurseSubmitTime">
update docus_medicalrecord.t_basic_extend
set nurse_submit_time=#{nurseSubmitTime}
where patient_id=#{patientId}
</update>
<update id="updateDoctorSubmitTime">
update docus_medicalrecord.t_basic_extend
set doctor_submit_time=#{doctorSubmitTime}
where patient_id=#{patientId}
</update>
<select id="selectByPatientId" resultType="com.docus.bgts.entity.TBasicExtend">
select *
from
docus_medicalrecord.t_basic_extend
where patient_id=#{patientId}
</select>
<insert id="insert" parameterType="com.docus.bgts.entity.TBasicExtend">
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})
</insert>
</mapper>

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.docus.bgts.mapper.TBasicMapper">
<update id="updateDisDate">
update docus_medicalrecord.t_basic
<set>
<if test="tBasic.admiss_times != null">
IPAddress=#{pcmachine.ipaddress},
</if>
<if test="pcmachine.lastonline != null">
LastOnline=#{pcmachine.lastonline},
</if>
<if test="pcmachine.pcstatus != null">
PCStatus=#{pcmachine.pcstatus}
</if>
<if test="pcmachine.ipaddress != null">
IPAddress=#{pcmachine.ipaddress},
</if>
<if test="pcmachine.lastonline != null">
LastOnline=#{pcmachine.lastonline},
</if>
<if test="pcmachine.pcstatus != null">
PCStatus=#{pcmachine.pcstatus}
</if>
<if test="pcmachine.ipaddress != null">
IPAddress=#{pcmachine.ipaddress},
</if>
<if test="pcmachine.lastonline != null">
LastOnline=#{pcmachine.lastonline},
</if>
<if test="pcmachine.pcstatus != null">
PCStatus=#{pcmachine.pcstatus}
</if>
<if test="pcmachine.ipaddress != null">
IPAddress=#{pcmachine.ipaddress},
</if>
<if test="pcmachine.lastonline != null">
LastOnline=#{pcmachine.lastonline},
</if>
<if test="pcmachine.pcstatus != null">
PCStatus=#{pcmachine.pcstatus}
</if>
<if test="pcmachine.ipaddress != null">
IPAddress=#{pcmachine.ipaddress},
</if>
<if test="pcmachine.lastonline != null">
LastOnline=#{pcmachine.lastonline},
</if>
<if test="pcmachine.pcstatus != null">
PCStatus=#{pcmachine.pcstatus}
</if>
</set>
where id=#{pcmachine.id}
</update>
<select id="selectByjzh" resultType="com.docus.bgts.entity.TBasic">
SELECT * FROM docus_medicalrecord.t_basic WHERE jzh=#{jzh}
</select>
<select id="selectByPatientId" resultType="com.docus.bgts.entity.TBasic">
SELECT * FROM docus_medicalrecord.t_basic WHERE patient_id=#{patientId}
</select>
</mapper>

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.docus.bgts.mapper.TScanAssortMapper">
<update id="updateByPatientId">
update docus_archivefile.t_scan_assort set patient_id=#{patientId},assort_id='Wiw213woq412awqe42' where patient_id=#{PrePatientId}
</update>
</mapper>
Loading…
Cancel
Save