docus_webservice_1.1
tan 2 years ago
parent 5f0eca1e6c
commit cbabcbf1df

@ -0,0 +1,4 @@
{
"task_count": 4,
"collectList":[]
}

@ -3,22 +3,22 @@
{
"serialNumber": "1",
"tableName": "t_basic",
"columnName": "ward_palce",
"qualityColumn": "SUBOR_HOSPITAL_DISTRICT",
"columnName": "inpatient_no",
"qualityColumn": "INHOSP_INDEX_NO",
"byNull":0
},
{
"serialNumber": "2",
"tableName": "t_basic",
"columnName": "emp_id",
"qualityColumn": "EMPI_ID",
"columnName": "jzh",
"qualityColumn": "INHOSP_NO",
"byNull":0
},
{
"serialNumber": "3",
"tableName": "t_basic",
"columnName": "admiss_id",
"qualityColumn": "ACCOUNT_NUM",
"columnName": "emp_id",
"qualityColumn": "EMPI_ID",
"byNull":0
},
{
@ -31,136 +31,65 @@
{
"serialNumber": "5",
"tableName": "t_basic",
"columnName": "admiss_times",
"qualityColumn": "VISIT_NO",
"columnName": "visit_type_code",
"qualityColumn": "VISIT_TYPE_CODE",
"byNull":0
},
{
"serialNumber": "6",
"tableName": "t_basic",
"columnName": "dis_dept",
"qualityColumn": "DEPT_CODE",
"byNull":1
"columnName": "visit_type_name",
"qualityColumn": "VISIT_TYPE_NAME",
"byNull":0
},
{
"serialNumber": "7",
"tableName": "t_basic",
"columnName": "dis_dept_name",
"qualityColumn": "DEPT_NAME",
"columnName": "admiss_date",
"qualityColumn": "ADMIT_DATETIME",
"byNull":0
},
{
"serialNumber": "8",
"tableName": "t_basic",
"columnName": "attending",
"qualityColumn": "CHAR_DOC_CODE",
"columnName": "admiss_times",
"qualityColumn": "INHOSP_NUM",
"byNull":0
},
{
"serialNumber": "9",
"tableName": "t_basic",
"columnName": "dis_date",
"qualityColumn": "DISCHARGE_DATETIME",
"byNull":0
"columnName": "id_card",
"qualityColumn": "ID_NUMBER",
"byNull":1
},
{
"serialNumber": "10",
"tableName": "t_basic",
"columnName": "is_dead",
"qualityColumn": "DEATH_FLAG",
"columnName": "attending",
"qualityColumn": "PRIMARY_DR_CODE",
"byNull":0
},
{
"serialNumber": "11",
"tableName": "t_basic",
"columnName": "inpatient_no",
"qualityColumn": "INHOSP_NO",
"columnName": "attending_name",
"qualityColumn": "PRIMARY_DR_NAME",
"byNull":0
},
{
"serialNumber": "12",
"tableName": "t_basic",
"columnName": "jzh",
"qualityColumn": "INHOSP_INDEX_NO",
"columnName": "dis_dept",
"qualityColumn": "DEPT_CODE",
"byNull":0
},
{
"serialNumber": "13",
"tableName": "t_basic",
"columnName": "visit_type_code",
"qualityColumn": "VISIT_TYPE_CODE",
"byNull":0
},
{
"serialNumber": "14",
"tableName": "t_basic",
"columnName": "visit_type_name",
"qualityColumn": "VISIT_TYPE_NAME",
"byNull":0
},
{
"serialNumber": "15",
"tableName": "t_basic",
"columnName": "admiss_days",
"qualityColumn": "INHOSP_DAYS",
"byNull":0
},
{
"serialNumber": "16",
"tableName": "t_basic",
"columnName": "id_card",
"qualityColumn": "ID_NUMBER",
"byNull":0
},
{
"serialNumber": "17",
"tableName": "t_basic",
"columnName": "main_diag_code",
"qualityColumn": "WM_DIAG_CODE",
"byNull":0
},
{
"serialNumber": "18",
"tableName": "t_basic",
"columnName": "main_diag_name",
"qualityColumn": "WM_DIAG_NAME",
"byNull":0
},
{
"serialNumber": "19",
"tableName": "t_basic",
"columnName": "tcm_diag_code",
"qualityColumn": "TCM_DIAG_CODE",
"byNull":0
},
{
"serialNumber": "20",
"tableName": "t_basic",
"columnName": "tcm_diag_name",
"qualityColumn": "TCM_DIAG_NAME",
"columnName": "dis_dept_name",
"qualityColumn": "DEPT_NAME",
"byNull":0
},
{
"serialNumber": "21",
"tableName": "t_basic",
"columnName": "admiss_dept",
"qualityColumn": "ADMIT_DEPT_CODE",
"byNull":1
},
{
"serialNumber": "22",
"tableName": "t_basic",
"columnName": "admiss_dept_name",
"qualityColumn": "ADMIT_DEPT_NAME",
"byNull":1
}
,
{
"serialNumber": "23",
"tableName": "t_basic",
"columnName": "admiss_date",
"qualityColumn": "ADMIT_DATE",
"byNull":1
}
]
}

@ -1,25 +0,0 @@
{
"task_count": 4,
"collectList":[
{
"collectsys_code": "13",
"requestUrl": "http://localhost:9302/collect",
"remark": "电生理"
},
{
"collectsys_code": "3",
"requestUrl": "http://localhost:9303/collect",
"remark": "PACS"
},
{
"collectsys_code": "14",
"requestUrl": "http://localhost:9304/collect",
"remark": "内镜"
},
{
"collectsys_code": "4",
"requestUrl": "http://localhost:9305/collect",
"remark": "心电图"
}
]
}

@ -0,0 +1,54 @@
{
"selectColumns":[
{
"serialNumber": "1",
"tableName": "t_seal",
"columnName": "seal_id",
"qualityColumn": "SEAL_ID",
"byNull":0
},
{
"serialNumber": "2",
"tableName": "t_seal",
"columnName": "inpatient_no",
"qualityColumn": "INHOSP_INDEX_NO",
"byNull":0
},
{
"serialNumber": "3",
"tableName": "t_seal",
"columnName": "jzh",
"qualityColumn": "INHOSP_NO",
"byNull":0
},
{
"serialNumber": "4",
"tableName": "t_seal",
"columnName": "name",
"qualityColumn": "PAT_NAME",
"byNull":0
},
{
"serialNumber": "5",
"tableName": "t_seal",
"columnName": "admiss_times",
"qualityColumn": "VISIT_NO",
"byNull":0
},
{
"serialNumber": "6",
"tableName": "t_seal",
"columnName": "seal_date",
"qualityColumn": "SEAL_DATETIME",
"byNull":0
},
{
"serialNumber": "7",
"tableName": "t_seal",
"columnName": "admiss_date",
"qualityColumn": "ADMIT_DATE",
"byNull":0
}
]
}

@ -17,7 +17,7 @@ public class AsyncConfiguration {
// 核心线程数:线程池创建时候初始化的线程数
executor.setCorePoolSize(10);
// 最大线程数:线程池最大的线程数,只有在缓冲队列满了之后才会申请超过核心线程数的线程
executor.setMaxPoolSize(20);
executor.setMaxPoolSize(50);
// 缓冲队列:用来缓冲执行任务的队列
executor.setQueueCapacity(500);
// 允许线程的空闲时间60秒当超过了核心线程之外的线程在空闲时间到达之后会被销毁

@ -17,14 +17,14 @@ public class MyScheduling {
private Logger logger = LogManager.getLogger(MyScheduling.class);
//10分钟执行一次
@Scheduled(fixedRate = 1000 * 60 * 10)
public void beat() {
Integer count = pcmachineService.count();
logger.info("----心跳执行开始,当前在线采集器数:" + count + "----");
pcmachineService.isBeat();
Integer count2 = pcmachineService.count();
logger.info("----心跳执行结束,此次心跳下线采集数:" + (count - count2) + "----");
}
// @Scheduled(fixedRate = 1000 * 60 * 10)
// public void beat() {
// Integer count = pcmachineService.count();
// logger.info("----心跳执行开始,当前在线采集器数:" + count + "----");
// pcmachineService.isBeat();
// Integer count2 = pcmachineService.count();
// logger.info("----心跳执行结束,此次心跳下线采集数:" + (count - count2) + "----");
//
// }
}

@ -1,6 +1,8 @@
package com.docus.webservice.entity;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -71,6 +73,7 @@ public class TBasic implements Serializable {
@ApiModelProperty(value = "住院科室名称")
private String admissDeptName;
@ApiModelProperty(value = "出院日期")
private Date disDate;
@ -162,6 +165,8 @@ public class TBasic implements Serializable {
private String tcmDiagName;
@ApiModelProperty(value = "所在院区")
private String wardPalce;
@ApiModelProperty(value = "是否作废(01是)")
private String isCancel;
/**
* yn

@ -0,0 +1,36 @@
package com.docus.webservice.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <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 String dutyNurse;
@ApiModelProperty(value = "预住院流水号")
private String preJzh;
}

@ -18,8 +18,12 @@ public enum Codes {
RET_CON("103","RetCon"),
//web service 服务名
// EXTERNAL("9201","docus_tBasic_data"),
//静态文件存放位置
JSON_ADDRESS("999","\\dataConfig\\homeQualitySet.json"),
//静态文件存放位置 住院
JSON_ADDRESS("999","\\dataConfig\\In\\homeQualitySet.json"),
//静态文件存放位置 出院
JSON_OUT_ADDRESS("999","\\dataConfig\\Out\\homeQualitySet.json"),
//静态文件存放位置 封存
JSON_SEAL_ADDRESS("999","\\dataConfig\\seal\\homeQualitySet.json"),
//接收二级节点
MSG("201","Msg"),
//错误日志编号
@ -29,7 +33,8 @@ public enum Codes {
//静态文件根元素名
SELECT_COLUMNS("10000","selectColumns"),
//collectList静态文件根元素名
JSON_COLLECTLIST("800","\\dataConfig\\collectList.json"),
JSON_COLLECTLIST("800","\\dataConfig\\In\\collectList.json"),
JSON_OUT_COLLECTLIST("800","\\dataConfig\\Out\\collectList.json"),
JSON_TASK_COUNT("801","task_count"),
JSON_COLLECTLIST_ROOT("802","collectList");
//代码

@ -14,6 +14,35 @@ public interface ITBasicWebService {
@WebMethod
String OUT_HOS_REG(String tbasic);
/**
*
* @param tbasic
* @return
*/
@WebMethod
String OUT_HOS_CAN(String tbasic);
/**
*
* @param tbasic
* @return
*/
@WebMethod
String DISCHARGE_REG(String tbasic);
/**
*
* @param tbasic
* @return
*/
@WebMethod
String DISCHARGE_CAN(String tbasic);
// /**
// * 病案封存
// * @param tseal
// * @return
// */
// @WebMethod
// String MEDICAL_RECORD_SEAL(String tseal);
}

@ -2,15 +2,12 @@ package com.docus.webservice.handler;
import com.alibaba.fastjson.JSON;
import com.docus.webservice.dto.CollectList;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.docus.webservice.dto.SelectColumn;
import com.docus.webservice.entity.AfInterfaceCollect;
import com.docus.webservice.entity.AfInterfaceCollectSub;
import com.docus.webservice.entity.MrReportError;
import com.docus.webservice.entity.*;
import com.docus.webservice.entity.TBasic;
import com.docus.webservice.enums.Codes;
import com.docus.webservice.mapper.AfInterfaceCollectMapper;
import com.docus.webservice.mapper.*;
import com.docus.webservice.service.IMrReportErrorService;
import com.docus.webservice.service.IPcmachineService;
import com.docus.webservice.service.ITBasicService;
@ -19,14 +16,13 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import javax.jws.WebService;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URISyntaxException;
import java.text.SimpleDateFormat;
import java.util.*;
@WebService
@ -44,6 +40,18 @@ public class TBasicWebService implements ITBasicWebService {
@Autowired
private AfInterfaceCollectMapper afInterfaceCollectMapper;
@Autowired
private TBasicMapper tBasicMapper;
@Autowired
private TScanAssortMapper tScanAssortMapper;
@Autowired
private TBasicExtendMapper tBasicExtendMapper;
@Autowired
private TSealMapper tSealMapper;
private Logger log = LogManager.getLogger(TBasicWebService.class);
/**
@ -73,6 +81,12 @@ public class TBasicWebService implements ITBasicWebService {
mrReportErrorService.save(mrReportError);
}
/**
*
*
* @param tbasic
* @return
*/
@Override
public String OUT_HOS_REG(String tbasic) {
log.info("住院成员信息新增xml" + tbasic);
@ -80,7 +94,9 @@ public class TBasicWebService implements ITBasicWebService {
//解析xml
HashMap<String, Object> tBasicMap = new HashMap<>();
HashMap<String, Object> tBasicSubMap = new HashMap<>();
parseXml(tbasic, tBasicMap, tBasicSubMap);
HashMap dateMap = new HashMap<>();
// Date disDate=null;
parseXml(tbasic, tBasicMap, tBasicSubMap, dateMap);
//处理业务
TBasic tBasic;
if (tBasicMap != null && tBasicMap.size() > 0) {
@ -91,12 +107,22 @@ public class TBasicWebService implements ITBasicWebService {
// }
//特殊处理出院时间 没有就取当前时间
Date currentDate = new Date();
if(tBasic.getDisDate()==null){
tBasic.setDisDate(currentDate);
}
// if(tBasic.getDisDate()==null){
// tBasic.setDisDate(currentDate);
// }
//tBasic.setCreateTime(currentDate);
tBasic.setCreateTime(currentDate);
itBasicService.savaAndSub(tBasic, tBasicSubMap);
// this.saveAndCall(tBasic);
itBasicService.savaAndSub(tBasic, tBasicSubMap,String.valueOf(dateMap.get("preJzh")));
// this.saveAndCall(tBasic);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
SimpleDateFormat sdf1 = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy",Locale.US);
if (dateMap.size() > 1) {
Date admissDate = sdf1.parse(String.valueOf(dateMap.get("admissDate")));
Date disDate = sdf1.parse(String.valueOf(dateMap.get("disDate")));
tBasic.setAdmissDate(sdf.parse(sdf.format(admissDate)));
tBasic.setDisDate(sdf.parse(sdf.format(disDate)));
tBasic.setInpatientNo(dateMap.get("inpatientNo").toString());
}
pcmachineService.saveAndCall(tBasic);
} else {
insertLog(tbasic);
@ -110,20 +136,21 @@ public class TBasicWebService implements ITBasicWebService {
} catch (Exception e) {
e.printStackTrace();
log.error("OUT_HOS_REG方法中错误信息:" + e.getMessage());
return ResultUtils.fail();
return ResultUtils.fail(e.getMessage());
}
log.info("返回结果:" + ResultUtils.success().asXML());
log.info("OUT_HOS_REG返回结果:" + ResultUtils.success().asXML());
return ResultUtils.success().asXML();
}
/**
* xml
* xml
*
* @param tbasic
* @param tBasicMap
* @param tBasicSubMap
*/
private void parseXml(String tbasic, HashMap<String, Object> tBasicMap, HashMap<String, Object> tBasicSubMap) {
private void parseXml(String tbasic, HashMap<String, Object> tBasicMap, HashMap<String, Object> tBasicSubMap, HashMap dateMap) {
XmlUtils xmlUtils = null;
log.info("开始解析xml");
try {
@ -162,55 +189,396 @@ public class TBasicWebService implements ITBasicWebService {
}
}
}
try {
String preJzh = xmlUtils.getElementText("PRE_INHOSP_NO");
System.err.println(preJzh);
if (null != preJzh && !"".equals(preJzh)) {
//预住院患者记录
TBasic tBasic = tBasicMapper.selectOne(new QueryWrapper<TBasic>().eq("jzh", preJzh));
//正式住院患者记录
TBasic tBasic1 = tBasicMapper.selectOne(new QueryWrapper<TBasic>().eq("jzh", tBasicMap.get("jzh")));
if (null != tBasic && null != tBasic1) {
dateMap.put("admissDate", tBasic.getAdmissDate().toString());
dateMap.put("disDate", tBasic1.getAdmissDate().toString());
dateMap.put("inpatientNo", tBasic.getInpatientNo());
//将预住院患者病历文件patient_id改为正式住院的patient_id合并病历
int i = tScanAssortMapper.updateByPatientId(tBasic1.getPatientId(), tBasic.getPatientId());
if (i <= 0) {
log.info("当前预住院没有文件!");
}else {
log.info("本次预住院合并"+i+"份报告");
}
} else {
log.error("");
}
}
dateMap.put("preJzh",preJzh);
} catch (Exception e) {
log.error("预住院错误信息{}", e.getMessage());
}
}
/**
*
*
* @param tbasic
* @return
*/
@Override
public String OUT_HOS_CAN(String tbasic) {
log.info("住院成员信息修改xml" + tbasic);
try {
long l = System.currentTimeMillis();
HashMap<String, Object> tBasicMap = new HashMap<>();
HashMap<String, Object> tBasicSubMap = new HashMap<>();
parseXml(tbasic, tBasicMap, tBasicSubMap);
HashMap<String, Date> dateMap = new HashMap<>();
//parseXml(tbasic, tBasicMap, tBasicSubMap);
parseXml(tbasic, tBasicMap, tBasicSubMap, dateMap);
TBasic tBasic;
XmlUtils xmlUtils = new XmlUtils(new ByteArrayInputStream(tbasic.getBytes("UTF-8")));
String elementText = xmlUtils.getElementText("IS_ADM_CANCEL");
if (elementText.equals("1")) {
tBasic = JSON.parseObject(JSON.toJSONString(tBasicMap), TBasic.class);
tBasic.setIsCancel("1");
int update = tBasicMapper.update(tBasic, new QueryWrapper<TBasic>().eq("jzh", tBasic.getJzh()));
if (update > 0) {
log.info(tBasic.getJzh() + "取消入院成功!");
}
} else {
long l1 = System.currentTimeMillis();
log.info("解析xml时间------" + (l1 - l));
//处理业务
long l2 = System.currentTimeMillis();
if (tBasicMap != null && tBasicMap.size() > 0) {
long l3 = System.currentTimeMillis();
tBasic = JSON.parseObject(JSON.toJSONString(tBasicMap), TBasic.class);
// if(StringUtils.isNotBlank(String.valueOf(tBasicMap.get("isDead")))||StringUtils.isNotBlank(String.valueOf("is_dead"))){
// String isDead=StringUtils.isNotBlank(String.valueOf(tBasicMap.get("isDead")))?String.valueOf(tBasicMap.get("isDead")):String.valueOf(tBasicMap.get("is_dead"));
// tBasic.setIsDead(isDead);
// }
long l4 = System.currentTimeMillis();
log.info("获取tBasic对象时间----------" + (l4 - l3));
if (StringUtils.isBlank(tBasic.getEmpId())) {
insertLog(tbasic);
log.info("emp_id字段不能为空值");
return ResultUtils.fail("emp_id字段不能为空值");
}
long l5 = System.currentTimeMillis();
tBasic.setUpdateTime(new Date());
try {
itBasicService.updateAndSub(tBasic, tBasicSubMap,String.valueOf(dateMap.get("preJzh")));
// this.saveAndCall(tBasic);
long l6 = System.currentTimeMillis();
log.info("update耗时----------" + (l6 - l5));
long l7 = System.currentTimeMillis();
tBasic.setAdmissDate(dateMap.get("admissDate"));
tBasic.setDisDate(dateMap.get("disDate"));
pcmachineService.saveAndCall(tBasic);
long l8 = System.currentTimeMillis();
log.info("saveAndCall耗时-------" + (l8 - l7));
} catch (RuntimeException e) {
insertLog(tbasic);
e.printStackTrace();
log.error("OUT_HOS_CAN方法中错误信息:" + e.getMessage());
return ResultUtils.fail(e.getMessage());
}
} else {
insertLog(tbasic);
return ResultUtils.fail("请提供完整的xml");
}
long l3 = System.currentTimeMillis();
log.info("业务处理时间------------" + (l3 - l2));
}
} catch (Exception e) {
e.printStackTrace();
log.error("OUT_HOS_CAN方法中错误信息:" + e.getMessage());
return ResultUtils.fail(e.getMessage());
}
log.info("OUT_HOS_CAN方法运行结果:" + ResultUtils.success().asXML());
return ResultUtils.success().asXML();
}
/**
*
*
* @param tbasic
* @return
*/
@Override
public String DISCHARGE_REG(String tbasic) {
log.info("出院成员信息新增xml" + tbasic);
try {
//解析xml
HashMap<String, Object> tBasicMap = new HashMap<>();
HashMap<String, Object> tBasicSubMap = new HashMap<>();
HashMap<String, Object> tBasicExtendMap = new HashMap<>();
OutParseXml(tbasic, tBasicMap, tBasicSubMap, tBasicExtendMap);
//处理业务
TBasic tBasic;
XmlUtils xmlUtils = new XmlUtils(new ByteArrayInputStream(tbasic.getBytes("UTF-8")));
String elementText = xmlUtils.getElementText("IS_ADM_CANCEL");
if (elementText.equals("1")) {
tBasic = JSON.parseObject(JSON.toJSONString(tBasicMap), TBasic.class);
tBasic.setIsCancel("1");
int update = tBasicMapper.update(tBasic, new QueryWrapper<TBasic>().eq("jzh", tBasic.getJzh()));
if (update > 0) {
log.info(tBasic.getJzh() + "取消入院成功!");
}
}else {
TBasicExtend tBasicExtend;
if (tBasicMap != null && tBasicMap.size() > 0) {
tBasic = JSON.parseObject(JSON.toJSONString(tBasicMap), TBasic.class);
tBasicExtend = JSON.parseObject(JSON.toJSONString(tBasicExtendMap), TBasicExtend.class);
tBasicExtend.setPatientId(tBasic.getPatientId());
// if(StringUtils.isNotBlank(String.valueOf(tBasicMap.get("isDead")))||StringUtils.isNotBlank(String.valueOf("is_dead"))){
// String isDead=StringUtils.isNotBlank(String.valueOf(tBasicMap.get("isDead")))?String.valueOf(tBasicMap.get("isDead")):String.valueOf(tBasicMap.get("is_dead"));
// tBasic.setIsDead(isDead);
// }
//特殊处理出院时间 没有就取当前时间
// if(tBasic.getDisDate()==null){
// tBasic.setDisDate(currentDate);
// }
//tBasic.setCreateTime(currentDate);
itBasicService.OutSavaAndSub(tBasic, tBasicSubMap, tBasicExtend);
// this.saveAndCall(tBasic);
pcmachineService.saveAndCallOut(tBasic);
} else {
insertLog(tbasic);
log.info("请提供完整的xml");
return ResultUtils.fail("请提供完整的xml");
}
}
} catch (RuntimeException e) {
insertLog(tbasic);
log.error("DISCHARGE_REG方法中错误信息:" + e.getMessage());
return ResultUtils.fail(e.getMessage());
} catch (Exception e) {
e.printStackTrace();
log.error("DISCHARGE_REG方法中错误信息:" + e.getMessage());
return ResultUtils.fail(e.getMessage());
}
log.info("DISCHARGE_REG返回结果:" + ResultUtils.success().asXML());
return ResultUtils.success().asXML();
}
/**
*
*
* @param tbasic
* @return
*/
@Override
public String DISCHARGE_CAN(String tbasic) {
log.info("出院成员信息修改xml" + tbasic);
try {
long l = System.currentTimeMillis();
HashMap<String, Object> tBasicMap = new HashMap<>();
HashMap<String, Object> tBasicSubMap = new HashMap<>();
HashMap<String, Object> tBasicExtendMap = new HashMap<>();
TBasic tBasic;
TBasicExtend tBasicExtend;
OutParseXml(tbasic, tBasicMap, tBasicSubMap, tBasicExtendMap);
long l1 = System.currentTimeMillis();
log.info("解析xml时间------" + (l1 - l));
//处理业务
long l2 = System.currentTimeMillis();
if (tBasicMap != null && tBasicMap.size() > 0) {
long l3 = System.currentTimeMillis();
tBasic = JSON.parseObject(JSON.toJSONString(tBasicMap), TBasic.class);
tBasicExtend = JSON.parseObject(JSON.toJSONString(tBasicExtendMap), TBasicExtend.class);
tBasicExtend.setPatientId(tBasic.getPatientId());
// if(StringUtils.isNotBlank(String.valueOf(tBasicMap.get("isDead")))||StringUtils.isNotBlank(String.valueOf("is_dead"))){
// String isDead=StringUtils.isNotBlank(String.valueOf(tBasicMap.get("isDead")))?String.valueOf(tBasicMap.get("isDead")):String.valueOf(tBasicMap.get("is_dead"));
// tBasic.setIsDead(isDead);
// }
if (StringUtils.isBlank(tBasic.getEmpId())) {
long l4 = System.currentTimeMillis();
log.info("获取tBasic对象时间----------" + (l4 - l3));
if (StringUtils.isBlank(tBasic.getJzh())) {
insertLog(tbasic);
log.info("emp_id字段不能为空值");
return ResultUtils.fail("emp_id字段不能为空值");
log.info("INHOSP_NO字段不能为空值");
return ResultUtils.fail("INHOSP_NO字段不能为空值");
}
long l5 = System.currentTimeMillis();
tBasic.setUpdateTime(new Date());
try {
itBasicService.updateAndSub(tBasic, tBasicSubMap);
itBasicService.OutUpdateAndSub(tBasic, tBasicSubMap, tBasicExtend);
// this.saveAndCall(tBasic);
pcmachineService.saveAndCall(tBasic);
long l6 = System.currentTimeMillis();
log.info("update耗时----------" + (l6 - l5));
long l7 = System.currentTimeMillis();
pcmachineService.saveAndCallOut(tBasic);
long l8 = System.currentTimeMillis();
log.info("saveAndCall耗时-------" + (l8 - l7));
} catch (RuntimeException e) {
insertLog(tbasic);
e.printStackTrace();
log.error("OUT_HOS_CAN方法中错误信息:" + e.getMessage());
log.error("DISCHARGE_CAN方法中错误信息:" + e.getMessage());
return ResultUtils.fail(e.getMessage());
}
} else {
insertLog(tbasic);
return ResultUtils.fail("请提供完整的xml");
}
long l3 = System.currentTimeMillis();
log.info("业务处理时间------------" + (l3 - l2));
} catch (Exception e) {
e.printStackTrace();
log.error("OUT_HOS_CAN方法中错误信息:" + e.getMessage());
return ResultUtils.fail();
log.error("DISCHARGE_CAN方法中错误信息:" + e.getMessage());
return ResultUtils.fail(e.getMessage());
}
log.info("OUT_HOS_CAN方法运行结果:" + ResultUtils.success().asXML());
log.info("DISCHARGE_CAN方法运行结果:" + ResultUtils.success().asXML());
return ResultUtils.success().asXML();
}
/**
*
*
* @param tseal
* @return
*/
// @Override
// public String MEDICAL_RECORD_SEAL(String tseal) {
// log.info("病案封存" + tseal);
// try {
// //解析xml
// HashMap<String, Object> tSealMap = new HashMap<>();
// SealParseXml(tseal, tSealMap);
// //处理业务
// TSeal tSeal;
// if (tSealMap != null && tSealMap.size() > 0) {
// tSeal = JSON.parseObject(JSON.toJSONString(tSealMap), TSeal.class);
// int insert = tSealMapper.insert(tSeal);
// if (insert > 0){
// log.info(tSeal.getJzh()+"----封存信息插入成功!");
// }else {
// log.info(tSeal.getJzh()+"----封存信息插入失败!");
// }
// } else {
// insertLog(tseal);
// log.info("请提供完整的xml");
// return ResultUtils.fail("请提供完整的xml");
// }
// } catch (RuntimeException e) {
// insertLog(tseal);
// log.error("MEDICAL_RECORD_SEAL方法中错误信息:" + e.getMessage());
// return ResultUtils.fail(e.getMessage());
// } catch (Exception e) {
// e.printStackTrace();
// log.error("MEDICAL_RECORD_SEAL中错误信息:" + e.getMessage());
// return ResultUtils.fail(e.getMessage());
// }
// log.info("MEDICAL_RECORD_SEAL返回结果:" + ResultUtils.success().asXML());
// return ResultUtils.success().asXML();
// }
// /**
// * 封存解析xml
// *
// * @param tSeal
// * @param tSealMap
// */
// private void SealParseXml(String tSeal, HashMap<String, Object> tSealMap) {
// XmlUtils xmlUtils = null;
// log.info("开始解析xml");
// try {
// xmlUtils = new XmlUtils(new ByteArrayInputStream(tSeal.getBytes("UTF-8")));
// } catch (UnsupportedEncodingException e) {
// e.printStackTrace();
// }
//
// if (StringUtils.isBlank(xmlUtils.getElementText("SEAL_ID"))){
// log.error("SEAL_ID 字段不能为空值");
// throw new RuntimeException("SEAL_ID 字段不能为空值");
// }
// //解析json映射文件
// String json = JsonUtils.readJsonFile(CurrentPath() + Codes.JSON_SEAL_ADDRESS.getMessage());
// Map jsonMap = JSON.parseObject(json, Map.class);
//
// List<SelectColumn> selectColumns = JSON.parseArray(String.valueOf(jsonMap.get(Codes.SELECT_COLUMNS.getMessage())), SelectColumn.class);
// String value;
// for (SelectColumn selectColumn : selectColumns) {
// try {
// value = xmlUtils.getElementText(selectColumn.getQualityColumn()) == null ? null : String.valueOf(xmlUtils.getElementText(selectColumn.getQualityColumn()));
// } catch (RuntimeException e) {
// String message = e.getMessage();
// log.error("解析xml出现:" + message);
// throw new RuntimeException(message);
// }
// if (StringUtils.isBlank(value)) {
// if (selectColumn.getByNull() == 0) {
// insertLog(tSeal);
// log.error(selectColumn.getQualityColumn() + " 字段不能为空值");
// throw new RuntimeException(selectColumn.getQualityColumn() + " 字段不能为空值");
// } else {
// continue;
// }
// } else {
// if (selectColumn.getTableName().equals("t_seal")) {
// tSealMap.put(selectColumn.getColumnName(), value);
// }
// }
// }
// }
//
/**
* xml
*
* @param tbasic
* @param tBasicMap
* @param tBasicSubMap
*/
private void OutParseXml(String tbasic, HashMap<String, Object> tBasicMap, HashMap<String, Object> tBasicSubMap, HashMap<String, Object> tBasicExtendMap) {
XmlUtils xmlUtils = null;
log.info("开始解析xml");
try {
xmlUtils = new XmlUtils(new ByteArrayInputStream(tbasic.getBytes("UTF-8")));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
//解析json映射文件
String json = JsonUtils.readJsonFile(CurrentPath() + Codes.JSON_OUT_ADDRESS.getMessage());
Map jsonMap = JSON.parseObject(json, Map.class);
List<SelectColumn> selectColumns = JSON.parseArray(String.valueOf(jsonMap.get(Codes.SELECT_COLUMNS.getMessage())), SelectColumn.class);
String value;
for (SelectColumn selectColumn : selectColumns) {
try {
value = xmlUtils.getElementText(selectColumn.getQualityColumn()) == null ? null : String.valueOf(xmlUtils.getElementText(selectColumn.getQualityColumn()));
} catch (RuntimeException e) {
String message = e.getMessage();
log.error("解析xml出现:" + message);
throw new RuntimeException(message);
}
if (StringUtils.isBlank(value)) {
if (selectColumn.getByNull() == 0) {
insertLog(tbasic);
log.error(selectColumn.getQualityColumn() + " 字段不能为空值");
throw new RuntimeException(selectColumn.getQualityColumn() + " 字段不能为空值");
} else {
continue;
}
} else {
if (selectColumn.getTableName().equals("t_basic")) {
tBasicMap.put(selectColumn.getColumnName(), value);
}
if (selectColumn.getTableName().equals("t_basic_extend")) {
tBasicExtendMap.put(selectColumn.getColumnName(), value);
}
if (selectColumn.getTableName().equals("t_basic_sub")) {
tBasicSubMap.put(selectColumn.getColumnName(), value);
}
}
}
}
}

@ -0,0 +1,15 @@
package com.docus.webservice.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.docus.webservice.entity.TBasicExtend;
/**
* <p>
* Mapper
* </p>
*
* @author jiashi
* @since 2022-06-13
*/
public interface TBasicExtendMapper extends BaseMapper<TBasicExtend> {
}

@ -0,0 +1,10 @@
package com.docus.webservice.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.docus.webservice.entity.TSeal;
public interface TSealMapper extends BaseMapper<TSeal> {
}

@ -12,4 +12,6 @@ public interface IPcmachineService {
Integer count();
void saveAndCall(TBasic tBasic) throws URISyntaxException;
void saveAndCallOut(TBasic tBasic);
}

@ -3,6 +3,7 @@ package com.docus.webservice.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.docus.webservice.entity.TBasic;
import com.docus.webservice.entity.TBasicExtend;
import java.util.HashMap;
@ -15,7 +16,11 @@ import java.util.HashMap;
* @since 2021-04-14
*/
public interface ITBasicService extends IService<TBasic> {
void savaAndSub(TBasic tBasic, HashMap<String, Object> tBasicSubMap);
void savaAndSub(TBasic tBasic, HashMap<String, Object> tBasicSubMap,String preJzh);
void updateAndSub(TBasic tBasic, HashMap<String, Object> tBasicSubMap);
void OutSavaAndSub(TBasic tBasic, HashMap<String, Object> tBasicSubMap, TBasicExtend tBasicExtend);
void updateAndSub(TBasic tBasic, HashMap<String, Object> tBasicSubMap,String preJzh);
void OutUpdateAndSub(TBasic tBasic, HashMap<String, Object> tBasicSubMap,TBasicExtend tBasicExtend);
}

@ -22,6 +22,7 @@ import org.springframework.stereotype.Service;
import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.text.SimpleDateFormat;
import java.util.*;
@Service
@ -78,6 +79,11 @@ public class PcmachineServiceImpl implements IPcmachineService {
return currentpath;
}
/**
*
* @param tBasic
* @throws URISyntaxException
*/
@Async("execCollector")
@Override
public void saveAndCall(TBasic tBasic) throws URISyntaxException {
@ -124,22 +130,125 @@ public class PcmachineServiceImpl implements IPcmachineService {
log.info("省中医病案采集-子任务失败!");
}
for (CollectList collectList : collectLists) {
//调用http发送请求
//调用http发送请求 执行采集器
try {
this.sendHttp(collectList, tBasic.getJzh());
if (collectList.getCollectsys_code().equals("3")){
this.sendHttpPacs(collectList,tBasic);
log.info("调用pacs采集参数{}",tBasic);
}else {
this.sendHttp(collectList, tBasic.getJzh());
}
}catch (Exception e){
log.info("采集器:"+collectList+"出错");
log.info("采集器:"+collectList+"出错"+e.getMessage()+"参数{}"+tBasic);
}
}
}
log.info("------------异步结束---------------");
}
/**
*
* @param tBasic
* @throws URISyntaxException
*/
@Async("execCollector")
@Override
public void saveAndCallOut(TBasic tBasic) {
log.info("--------------异步调用此方法---------------");
log.info("病案对象" + tBasic.toString());
//解析json映射文件
String json = JsonUtils.readJsonFile(CurrentPath() + Codes.JSON_OUT_COLLECTLIST.getMessage());
if (StringUtils.isNotBlank(json)) {
Map jsonMap = JSON.parseObject(json, Map.class);
//任务数
Integer task_count = JSON.parseObject(String.valueOf(jsonMap.get(Codes.JSON_TASK_COUNT.getMessage())), Integer.class);
List<CollectList> collectLists = JSON.parseArray(String.valueOf(jsonMap.get(Codes.JSON_COLLECTLIST_ROOT.getMessage())), CollectList.class);
if(collectLists==null||collectLists.size()==0){
return;
}
//添加省中医病案采集
SnowflakeIdWorker idWorker = new SnowflakeIdWorker(0, 0);
AfInterfaceCollect afc = new AfInterfaceCollect();
Long afcId = idWorker.nextId();
afc.setId(afcId);
afc.setJzh(tBasic.getJzh());
afc.setTaskCount(task_count);
afc.setCreateTime(new Date());
int i = afInterfaceCollectMapper.addAfInterfaceCollect(afc);
if (i < 0) {
log.info("省中医病案采集表添加信息失败!");
}
//添加省中医病案采集-子任务
List<AfInterfaceCollectSub> list = new ArrayList<>();
for (CollectList collectList : collectLists) {
AfInterfaceCollectSub afInterfaceCollectSub = new AfInterfaceCollectSub();
Long afcsId = idWorker.nextId();
afInterfaceCollectSub.setId(afcsId);
afInterfaceCollectSub.setAfInterfaceCollectId(afcId);
afInterfaceCollectSub.setCollectsysCode(collectList.getCollectsys_code());
afInterfaceCollectSub.setJzh(tBasic.getJzh());
collectList.setId(afcsId);
list.add(afInterfaceCollectSub);
}
int i1 = afInterfaceCollectMapper.addAfInterfaceCollectSub(list);
if (i1 < 0) {
log.info("省中医病案采集-子任务失败!");
}
for (CollectList collectList : collectLists) {
//调用http发送请求 执行采集器
try {
if (collectList.getCollectsys_code().equals("3")){
this.sendHttpPacs(collectList,tBasic);
log.info("调用"+collectList.getRemark()+"采集器");
}else if (collectList.getCollectsys_code().equals("23")||collectList.getCollectsys_code().equals("4")){
this.sendHttpEcg(collectList,tBasic);
log.info("调用"+collectList.getRemark()+"采集器");
}else {
this.sendHttp(collectList, tBasic.getJzh());
log.info("调用"+collectList.getRemark()+"采集器");
}
}catch (Exception e){
log.info("采集器:"+collectList+"出错"+e.getMessage());
}
}
}
log.info("------------异步结束---------------");
}
private String sendHttp(CollectList collectList, String jzh) throws Exception {
Map<String, String> params = new HashMap<>();
params.put("empId", jzh);
params.put("collectSubId", String.valueOf(collectList.getId()));
return HttpUtils.get(collectList.getRequestUrl(), params);
}
private String sendHttpPacs(CollectList collectList, TBasic tBasic) throws Exception {
Map<String, String> params = new HashMap<>();
params.put("empId", tBasic.getInpatientNo());
params.put("collectSubId", String.valueOf(collectList.getId()));
params.put("admissDate",new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(tBasic.getAdmissDate()));
params.put("disDate", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(tBasic.getDisDate()));
System.err.println(params);
log.info("调用pacs采集器参数{}",params);
params.put("times",String.valueOf(tBasic.getAdmissTimes()));
return HttpUtils.get(collectList.getRequestUrl(), params);
}
private String sendHttpEcg(CollectList collectList, TBasic tBasic) throws Exception {
Map<String, String> params = new HashMap<>();
params.put("empId",tBasic.getJzh());
params.put("collectSubId", String.valueOf(collectList.getId()));
params.put("admissDate",new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(tBasic.getAdmissDate()));
params.put("disDate", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(tBasic.getDisDate()));
System.err.println(params);
log.info("调用心电采集器参数{}",params);
params.put("times",String.valueOf(tBasic.getAdmissTimes()));
return HttpUtils.get(collectList.getRequestUrl(), params);
}
}

@ -3,17 +3,28 @@ package com.docus.webservice.service;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.docus.webservice.entity.TBasic;
import com.docus.webservice.entity.TBasicExtend;
import com.docus.webservice.entity.TBasicSub;
import com.docus.webservice.handler.TBasicWebService;
import com.docus.webservice.mapper.TBasicExtendMapper;
import com.docus.webservice.mapper.TBasicMapper;
import com.docus.webservice.mapper.TBasicSubMapper;
import com.docus.webservice.utils.ResultUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.sql.Wrapper;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
/**
@ -34,36 +45,184 @@ public class TBasicServiceImpl extends ServiceImpl<TBasicMapper, TBasic> impleme
@Autowired
private TBasicSubMapper tBasicSubMapper;
@Autowired
private TBasicExtendMapper tBasicExtendMapper;
private Logger log = LogManager.getLogger(ServiceImpl.class);
/**
*
*
* @param tBasic
* @param tBasicSubMap
* @param tBasicExtend
*/
@Transactional
@Override
public void savaAndSub(TBasic tBasic, HashMap<String, Object> tBasicSubMap) {
public void OutSavaAndSub(TBasic tBasic, HashMap<String, Object> tBasicSubMap, TBasicExtend tBasicExtend) {
TBasic selectTBasic = tBasicMapper.selectOne(new QueryWrapper<TBasic>().eq("jzh", tBasic.getJzh()));
if (selectTBasic == null) {
log.info("基础信息住院天数----" + tBasic.getAdmissDays());
int insert = tBasicMapper.insert(tBasic);
if (insert <= 0) {
throw new RuntimeException("数据库执行出错,请重试");
}
TBasicSub tBasicSub = JSON.parseObject(JSON.toJSONString(tBasicSubMap), TBasicSub.class);
tBasicSub.setPatientId(tBasic.getPatientId());
insert = tBasicSubMapper.insert(tBasicSub);
if (tBasicExtend.getClaimPolicyCode() != null || tBasicExtend.getMioSettleTypeCode() != null) {
TBasic selectTBasic1 = tBasicMapper.selectOne(new QueryWrapper<TBasic>().eq("jzh", tBasic.getJzh()));
tBasicExtend.setPatientId(selectTBasic1.getPatientId());
TBasicExtend tBasicExtend1 = tBasicExtendMapper.selectOne(new QueryWrapper<TBasicExtend>().eq("patient_id", tBasicExtend.getPatientId()));
if (tBasicExtend1 == null) {
int insert1 = tBasicExtendMapper.insert(tBasicExtend);
if (insert1 <= 0) {
throw new RuntimeException("医保结算类型/政策出错!");
}
} else {
int i = tBasicExtendMapper.updateById(tBasicExtend);
if (i <= 0) {
throw new RuntimeException("医保结算类型/政策出错!");
}
}
}
//TBasicSub tBasicSub = JSON.parseObject(JSON.toJSONString(tBasicSubMap), TBasicSub.class);
// tBasicSub.setPatientId(tBasic.getPatientId());
//insert = tBasicSubMapper.insert(tBasicSub);
if (insert <= 0) {
throw new RuntimeException("数据库执行出错,请重试");
}
} else {
throw new RuntimeException("就诊号不能和已有的重复");
OutUpdateAndSub(tBasic, tBasicSubMap, tBasicExtend);
}
}
/**
*
*
* @param tBasic
* @param tBasicSubMap
* @param tBasicExtend
*/
@Override
public void updateAndSub(TBasic tBasic, HashMap<String, Object> tBasicSubMap) {
TBasic selectTBasic = tBasicMapper.selectOne(new QueryWrapper<TBasic>().eq("emp_id", tBasic.getEmpId()));
public void OutUpdateAndSub(TBasic tBasic, HashMap<String, Object> tBasicSubMap, TBasicExtend tBasicExtend) {
long l = System.currentTimeMillis();
TBasic selectTBasic = tBasicMapper.selectOne(new QueryWrapper<TBasic>().eq("jzh", tBasic.getJzh()));
long l1 = System.currentTimeMillis();
log.info("selectTBasic耗时---------" + (l1 - l));
if (selectTBasic != null) {
int insert = tBasicMapper.update(tBasic, new QueryWrapper<TBasic>().eq("emp_id", tBasic.getEmpId()));
long l2 = System.currentTimeMillis();
System.err.println(tBasic.getDisDate());
log.info("基础信息住院天数----" + tBasic.getAdmissDays());
LambdaUpdateWrapper<TBasic> eq = Wrappers.<TBasic>lambdaUpdate()
.set(TBasic::getDisDate, null == tBasic.getDisDate() ? null : tBasic.getDisDate())
.set(TBasic::getWardPalce, tBasic.getWardPalce()).set(TBasic::getAdmissDays, tBasic.getAdmissDays())
.set(TBasic::getAdmissDept,tBasic.getAdmissDept()).set(TBasic ::getAdmissDeptName,tBasic.getAdmissDeptName())
.set(TBasic::getIsDead,tBasic.getIsDead()).set(TBasic::getName,tBasic.getName())
.set(TBasic::getInpatientNo,tBasic.getInpatientNo()).set(TBasic::getDisDept,tBasic.getDisDept())
.set(TBasic::getDisDeptName,tBasic.getDisDeptName()).eq(TBasic::getJzh, tBasic.getJzh());
int update1 = tBasicMapper.update(tBasic, eq);
if (tBasicExtend.getClaimPolicyCode() != null || tBasicExtend.getMioSettleTypeCode() != null) {
tBasicExtend.setPatientId(selectTBasic.getPatientId());
TBasicExtend selectTBasicExtend = tBasicExtendMapper.selectOne(new QueryWrapper<TBasicExtend>().eq("patient_id", tBasicExtend.getPatientId()));
if (selectTBasicExtend == null) {
int insert1 = tBasicExtendMapper.insert(tBasicExtend);
if (insert1 <= 0) {
throw new RuntimeException("医保结算类型/政策出错!");
}
} else {
int update = tBasicExtendMapper.update(tBasicExtend, new QueryWrapper<TBasicExtend>().eq("patient_id", selectTBasicExtend.getPatientId()));
if (update <= 0) {
throw new RuntimeException("医保结算类型/政策出错!");
}
}
}
long l3 = System.currentTimeMillis();
log.info("tBasicMapper.update耗时----------" + (l3 - l2));
if (update1 <= 0) {
throw new RuntimeException("数据库执行出错,请重试");
}
if (tBasicSubMap != null && tBasicSubMap.size() > 0) {
long l4 = System.currentTimeMillis();
TBasicSub tBasicSub = JSON.parseObject(JSON.toJSONString(tBasicSubMap), TBasicSub.class);
long l5 = System.currentTimeMillis();
log.info("JSON.parseObject耗时-------" + (l5 - l4));
long l6 = System.currentTimeMillis();
tBasicSub.setPatientId(selectTBasic.getPatientId());
update1 = tBasicSubMapper.updateById(tBasicSub);
if (update1 <= 0) {
throw new RuntimeException("数据库执行出错,请重试");
}
}
} else {
throw new RuntimeException("ResultUtils.fail(\"修改时,需提供有效的emp_id\");");
}
}
/**
*
*
* @param tBasic
* @param tBasicSubMap
*/
@Override
public void savaAndSub(TBasic tBasic, HashMap<String, Object> tBasicSubMap, String preJzh) {
TBasic selectTBasic = tBasicMapper.selectOne(new QueryWrapper<TBasic>().eq("jzh", tBasic.getJzh()));
if (selectTBasic == null) {
tBasic.setFileSource(1);
int insert = tBasicMapper.insert(tBasic);
if (insert <= 0) {
throw new RuntimeException("数据库执行出错,请重试");
}
//TBasicSub tBasicSub = JSON.parseObject(JSON.toJSONString(tBasicSubMap), TBasicSub.class);
// tBasicSub.setPatientId(tBasic.getPatientId());
//insert = tBasicSubMapper.insert(tBasicSub);
// if (insert <= 0) {
// throw new RuntimeException("数据库执行出错,请重试");
// }
} else {
updateAndSub(tBasic, tBasicSubMap,preJzh);
}
if (null != preJzh && !preJzh.equals("")) {
TBasic tbasic1 = tBasicMapper.selectOne(new QueryWrapper<TBasic>().eq("jzh", tBasic.getJzh()));
if (tbasic1 != null) {
TBasicExtend tBasicExtend = new TBasicExtend();
tBasicExtend.setPatientId(tbasic1.getPatientId());
tBasicExtend.setPreJzh(preJzh);
int insert = tBasicExtendMapper.insert(tBasicExtend);
if (insert <= 0) {
throw new RuntimeException("数据库执行出错,请重试");
}
}
}
}
/**
*
*
* @param tBasic
* @param tBasicSubMap
*/
@Override
public void updateAndSub(TBasic tBasic, HashMap<String, Object> tBasicSubMap, String preJzh) {
long l = System.currentTimeMillis();
TBasic selectTBasic = tBasicMapper.selectOne(new QueryWrapper<TBasic>().eq("jzh", tBasic.getJzh()));
long l1 = System.currentTimeMillis();
log.info("selectTBasic耗时---------" + (l1 - l));
if (selectTBasic != null) {
long l2 = System.currentTimeMillis();
tBasic.setFileSource(1);
int insert = tBasicMapper.update(tBasic, new QueryWrapper<TBasic>().eq("patient_id", selectTBasic.getPatientId()));
long l3 = System.currentTimeMillis();
log.info("tBasicMapper.update耗时----------" + (l3 - l2));
if (insert <= 0) {
throw new RuntimeException("数据库执行出错,请重试");
}
if (tBasicSubMap != null && tBasicSubMap.size() > 0) {
long l4 = System.currentTimeMillis();
TBasicSub tBasicSub = JSON.parseObject(JSON.toJSONString(tBasicSubMap), TBasicSub.class);
long l5 = System.currentTimeMillis();
log.info("JSON.parseObject耗时-------" + (l5 - l4));
long l6 = System.currentTimeMillis();
tBasicSub.setPatientId(selectTBasic.getPatientId());
insert = tBasicSubMapper.updateById(tBasicSub);
if (insert <= 0) {
@ -71,7 +230,8 @@ public class TBasicServiceImpl extends ServiceImpl<TBasicMapper, TBasic> impleme
}
}
} else {
throw new RuntimeException("ResultUtils.fail(\"修改时,需提供有效的emp_id\");");
log.info("住院修改:患者"+tBasic.getJzh()+"不存在!\n新增患者"+tBasic.getJzh());
savaAndSub(tBasic,tBasicSubMap,preJzh);
}
}
}

@ -1,5 +1,5 @@
server:
port: 9399
port: 9299
mybatis-plus:
configuration:
@ -16,8 +16,8 @@ spring:
driver-class-name: com.mysql.cj.jdbc.Driver
username: docus
password: docus702
url: jdbc:mysql://db.docus.cn:3306/docus_medicalrecord?characterEncoding=utf8&useSSL=false&rewriteBatchedStatements=true&serverTimezone=Asia/Shanghai
url: jdbc:mysql://localhost:3306/docus_medicalrecord?characterEncoding=utf8&useSSL=false&rewriteBatchedStatements=true&serverTimezone=Asia/Shanghai
ws:
port: 9101
parameter: docus_tBasic_data
parameter: in_docus_tBasic_data

@ -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>30</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- maxFileSize:这是活动文件的大小默认值是10MB测试时可改成1KB看效果 -->
<maxFileSize>10MB</maxFileSize>

@ -3,5 +3,55 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.docus.webservice.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>
</mapper>

@ -0,0 +1,7 @@
<?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.webservice.mapper.TBasicExtendMapper">
</mapper>
Loading…
Cancel
Save