ws的user,dept,basic拆分实现

segment2.0
linrf 2 years ago
parent f97417812d
commit c895a92a5d

@ -4,6 +4,8 @@ package com.docus.server;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.retry.annotation.EnableRetry;
import org.springframework.scheduling.annotation.EnableAsync;
@Slf4j
@ -11,6 +13,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
//@EnableHystrix
//@MapperScan("com.docus.server")
@SpringBootApplication(scanBasePackages = {"com.docus"})
@EnableRetry
@EnableAsync
public class AppRunBootstrap {
public static void main(String[] args) {
System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl");

@ -1,6 +1,6 @@
package com.docus.server;
import com.docus.server.ws.IWebserviceServer;
import com.docus.server.ws.IWebServiceServer;
import org.apache.cxf.Bus;
import org.apache.cxf.bus.spring.SpringBus;
import org.apache.cxf.jaxws.EndpointImpl;
@ -16,7 +16,7 @@ import javax.xml.ws.Endpoint;
@Configuration
public class CxfConfig {
@Resource
private IWebserviceServer webserviceServer;
private IWebServiceServer webserviceServer;
/**
* ServletbeanNamedispatcherServlet

@ -1,4 +1,4 @@
package com.docus.server.collect.basic;
package com.docus.server.collect.basic.http;
import com.docus.server.collect.service.IHttpTBasicCollectService;
import com.docus.server.record.pojo.dto.TBasicDTO;

@ -0,0 +1,189 @@
package com.docus.server.collect.basic.ws;
import com.docus.core.util.Func;
import com.docus.core.util.XmlUtil;
import com.docus.server.collect.infrastructure.dao.FlagEnum;
import com.docus.server.record.pojo.dto.TBasicDTO;
import com.docus.server.tool.ParamsUtils;
import com.docus.server.ws.convert.ITBasicConverter;
import org.w3c.dom.Node;
public class TBasicConverter implements ITBasicConverter {
@Override
public TBasicDTO xmlToConvertBasicDTO(String message, FlagEnum flagEnum) {
XmlUtil xml = XmlUtil.of(message);
//id-消息流水号
String serialId = null;
Node serialIdNode = FlagEnum.INSERT.equals(flagEnum) ?
xml.getNode("/PRPA_HIP0032/id/@extension") : xml.getNode("/PRPA_HIP0033/id/@extension");
if (Func.isNotEmpty(serialIdNode)) {
serialId = serialIdNode.getNodeValue();
}
//接受方
String receive = null;
Node receiveNode = FlagEnum.INSERT.equals(flagEnum) ?
xml.getNode("/PRPA_HIP0032/receiver/device/id/item/@extension") : xml.getNode("/PRPA_HIP0033/receiver/device/id/item/@extension");
if (Func.isNotEmpty(receiveNode)) {
receive = receiveNode.getNodeValue();
}
//发送方
String send = null;
Node sendNode = xml.getNode("/PRPA_HIP0032/sender/device/id/item/@extension");
if (Func.isNotEmpty(sendNode)) {
send = sendNode.getNodeValue();
}
//住院流水号
String jzh = null;
Node jzhNode = xml.getNode("/PRPA_HIP0032/controlActProcess/subject/encounterEvent/item/@extension");
if (Func.isNotEmpty(jzhNode)) {
jzh = jzhNode.getNodeValue();
}
//住院号标识
String inpatientNo = null;
Node inpatientNoNode = xml.getNode("/PRPA_HIP0032/controlActProcess/subject/encounterEvent/id/item/@extension");
if (Func.isNotEmpty(inpatientNoNode)) {
inpatientNo = inpatientNoNode.getNodeValue();
}
//住院次数[]
String admissTimes = null;
Node admissTimesNode = xml.getNode("/PRPA_HIP0032/controlActProcess/subject/encounterEvent/lengthOfStayQuantity[@unit='次']/@value");
if (Func.isNotEmpty(admissTimesNode)) {
admissTimes = admissTimesNode.getNodeValue();
}
//姓名
String name = null;
Node nameNode = xml.getNode("/PRPA_HIP0032/controlActProcess/subject/encounterEvent/subject/patient/patientPerson/name/item/part/@value");
if (Func.isNotEmpty(nameNode)) {
name = nameNode.getNodeValue();
}
//入院日期时间
String admissDate = null;
Node admissDateNode = xml.getNode("/PRPA_HIP0032/controlActProcess/subject/encounterEvent/effectiveTime/low/@value");
if (Func.isNotEmpty(admissDateNode)) {
admissDate = admissDateNode.getNodeValue();
}
//出院日期时间
String disDate = null;
Node disDateNode = xml.getNode("/PRPA_HIP0032/controlActProcess/subject/encounterEvent/effectiveTime/high/@value");
if (Func.isNotEmpty(disDateNode)) {
disDate = disDateNode.getNodeValue();
}
//入院诊断科室名称[]
String admissDeptName = null;
Node admissDeptNameNode = xml.getNode("/PRPA_HIP0032/controlActProcess/subject/encounterEvent/component[@displayName='入院诊断']/section/entry[@displayName='入院诊断-西医条目']/observation/performer/assignedEntity/representedOrganization/name");
if (Func.isNotEmpty(admissDeptNameNode)) {
admissDeptNameNode.getTextContent();
}
//出院诊断科室名称[]
String disDeptName = null;
Node disDeptNameNode = xml.getNode("/PRPA_HIP0032/controlActProcess/subject/encounterEvent/component[@displayName='出院诊断']/section/entry[@displayName='出院诊断-西医条目']/observation/performer/assignedEntity/representedOrganization/name");
if (Func.isNotEmpty(disDeptNameNode)) {
disDeptName = disDeptNameNode.getTextContent();
}
//主治医师[]
String attendingName = null;
Node attendingNameNode = xml.getNode("/PRPA_HIP0032/controlActProcess/subject/encounterEvent/authenticator[@displayName='主治医师']/assignedEntity/assignedPerson/name");
if (Func.isNotEmpty(attendingNameNode)) {
attendingName = attendingNameNode.getTextContent();
}
//年龄
String age = null;
Node ageNode = xml.getNode("/PRPA_HIP0032/controlActProcess/subject/encounterEvent/subject/patient/patientPerson/age[@unit='岁']/@value");
if (Func.isNotEmpty(ageNode)) {
age = ageNode.getNodeValue();
}
//性别
String sex = null;
Node sexNode = xml.getNode("/PRPA_HIP0032/controlActProcess/subject/encounterEvent/subject/patient/patientPerson/administrativeGenderCode/@code");
if (Func.isNotEmpty(sexNode)) {
sex = sexNode.getNodeValue();
}
//身份证号
String idCard = null;
Node idCardNode = xml.getNode("/PRPA_HIP0032/controlActProcess/subject/encounterEvent/subject/patient/patientPerson/id/item/@extension");
if (Func.isNotEmpty(idCardNode)) {
idCard = idCardNode.getNodeValue();
}
//出院科室
String disDept = null;
Node disDeptCardNode = xml.getNode("/PRPA_HIP0032/controlActProcess/subject/encounterEvent/componentOf/encompassingEncounter/location/healthCareFacility/serviceProviderOrganization/asOrganizationPartOf/wholeOrganization/asOrganizationPartOf/wholeOrganization/asOrganizationPartOf/wholeOrganization/id/@extension");
if (Func.isNotEmpty(disDeptCardNode)) {
disDept = disDeptCardNode.getNodeValue();
}
//性别名称
String sexName = null;
Node sexNameNode = xml.getNode("/PRPA_HIP0032/controlActProcess/subject/encounterEvent/subject/patient/patientPerson/administrativeGenderCode/@displayName");
if (Func.isNotEmpty(sexNameNode)) {
sexName = sexNameNode.getNodeValue();
}
//床位号
String bedNum = null;
Node bedNumNode = xml.getNode("/PRPA_HIP0032/controlActProcess/subject/encounterEvent/componentOf/encompassingEncounter/location/healthCareFacility/serviceProviderOrganization/asOrganizationPartOf/wholeOrganization/id/@extension");
if (Func.isNotEmpty(bedNumNode)) {
bedNum = bedNumNode.getNodeValue();
}
//住院天数数[]
String admissDays = null;
Node admissDaysNode = xml.getNode("/PRPA_HIP0032/controlActProcess/subject/encounterEvent/lengthOfStayQuantity[@unit='天']/@value");
if (Func.isNotEmpty(admissDaysNode)) {
admissDays = admissDaysNode.getNodeValue();
}
//是否死亡[]
String isDead = null;
Node isDeadNode = xml.getNode("/PRPA_HIP0032/controlActProcess/subject/encounterEvent/component[@displayName='出院诊断']/section/entry[@displayName='出院情况']/observation/value");
if (Func.isNotEmpty(isDeadNode)) {
isDead = isDeadNode.getTextContent();
}
//病区编号
String wardCode = null;
Node wardCodeNode = xml.getNode("/PRPA_HIP0032/controlActProcess/subject/encounterEvent/componentOf/encompassingEncounter/location/healthCareFacility/serviceProviderOrganization/asOrganizationPartOf/wholeOrganization/asOrganizationPartOf/wholeOrganization/asOrganizationPartOf/wholeOrganization/asOrganizationPartOf/wholeOrganization/id/@extension");
if (Func.isNotEmpty(wardCodeNode)) {
wardCode = wardCodeNode.getNodeValue();
}
//病区名称
String wardName = null;
Node wardNameNode = xml.getNode("/PRPA_HIP0032/controlActProcess/subject/encounterEvent/componentOf/encompassingEncounter/location/healthCareFacility/serviceProviderOrganization/asOrganizationPartOf/wholeOrganization/asOrganizationPartOf/wholeOrganization/asOrganizationPartOf/wholeOrganization/asOrganizationPartOf/wholeOrganization/name");
if (Func.isNotEmpty(wardNameNode)) {
wardName = wardNameNode.getTextContent();
}
//顺德人医第三方索引
String sdryIndex = null;
Node sdryIndexNode = xml.getNode("/PRPA_HIP0032/controlActProcess/subject/encounterEvent/subject/patient/id/item/@extension");
if (Func.isNotEmpty(sdryIndexNode)) {
sdryIndex = sdryIndexNode.getNodeValue();
}
//设置dto
TBasicDTO dto = new TBasicDTO();
dto.setSerialId(serialId);
dto.setSend(send);
dto.setReceive(receive);
dto.setInpatientNo(inpatientNo);
dto.setName(name);
dto.setJzh(jzh);
dto.setAdmissDeptName(admissDeptName);
dto.setDisDeptName(disDeptName);
dto.setAdmissDate(admissDate);
dto.setDisDate(disDate);
dto.setAdmissTimes(admissTimes);
dto.setAttendingName(attendingName);
dto.setAge(age);
dto.setSex(sex);
dto.setIdCard(idCard);
dto.setDisDept(disDept);
dto.setSexName(sexName);
dto.setBedNum(bedNum);
dto.setIsDead(isDead);
dto.setAdmissDays(admissDays);
dto.setWardCode(wardCode);
dto.setWardName(wardName);
dto.setSdryIndex(sdryIndex);
dto.setParams(ParamsUtils.addParam("serialId", dto.getSerialId())
.addParam("receive", dto.getReceive())
.addParam("send", dto.getSend())
.param());
return dto;
}
}

@ -0,0 +1,55 @@
package com.docus.server.collect.basic.ws;
import com.docus.core.util.DateUtil;
import com.docus.core.util.Func;
import com.docus.server.ws.IWsResult;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.Map;
@Component("wsBasicResultImpl")
public class WsBasicResultImpl implements IWsResult {
@Override
public String ok(Map<String, Object> params) {
return null;
}
@Override
public String fail(Map<String, Object> params) {
String createTime = Func.format(new Date(), DateUtil.PATTERN_DATETIME_MINI);
return "<MCCI_IN000002UV01 xmlns=\"urn:hl7-org:v3\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ITSVersion=\"XML_1.0\" xsi:schemaLocation=\"urn:hl7-org:v3 file:///E:/hl7/HL7/v3ballot_fullsite_2011MAY/v3ballot/html/processable/multicacheschemas/MCCI_IN000002UV01.xsd\"> \n" +
" <id extension=\"" + Func.randomUUID() + "\"/> \n" +
" <creationTime value=\"" + createTime + "\"/> \n" +
" <interactionId root=\"2.16.840.1.113883.1.6\" extension=\"MCCI_IN000002UV01\" displayable=\"true\"/> \n" +
" <processingCode code=\"P\"/> \n" +
" <processingModeCode/> \n" +
" <acceptAckCode code=\"AL\"/> \n" +
" <receiver typeCode=\"RCV\"> \n" +
" <device classCode=\"DEV\" determinerCode=\"INSTANCE\"> \n" +
" <id> \n" +
" <item extension=\"" + params.get("receive") + "\"/> \n" +
" </id> \n" +
" </device> \n" +
" </receiver> \n" +
" <sender typeCode=\"SND\"> \n" +
" <device classCode=\"DEV\" determinerCode=\"INSTANCE\"> \n" +
" <id> \n" +
" <item extension=\"" + params.get("send") + "\"/> \n" +
" </id> \n" +
" </device> \n" +
" </sender> \n" +
" <acknowledgement typeCode=\"AE\"> \n" +
" <!--请求消息ID--> \n" +
" <targetMessage> \n" +
" <id extension=\"" + params.get("serialId") + "\"/> \n" +
" </targetMessage> \n" +
" <acknowledgementDetail> \n" +
" <text value=\"" + params.get("msg") + "\"/> \n" +
" </acknowledgementDetail> \n" +
" </acknowledgement> \n" +
"</MCCI_IN000002UV01>\n";
}
}

@ -1,4 +1,4 @@
package com.docus.server.collect.dept;
package com.docus.server.collect.dept.http;
import com.docus.server.collect.service.IHttpDeptCollectService;
import com.docus.server.sys.common.pojo.dto.DeptDTO;

@ -1,4 +1,4 @@
package com.docus.server.collect.dept;
package com.docus.server.collect.dept.mq;
import com.docus.core.util.XmlUtil;
import com.docus.server.collect.mq.dept.AbstractDeptMqCollectService;

@ -0,0 +1,89 @@
package com.docus.server.collect.dept.ws;
import com.docus.core.util.DateUtil;
import com.docus.core.util.Func;
import com.docus.server.tool.IdUtil;
import com.docus.server.ws.IWsResult;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.Map;
@Component("wsDeptResultImpl")
public class WsDeptResultImpl implements IWsResult {
@Override
public String ok(Map<String, Object> params) {
String createTime = Func.format(new Date(), DateUtil.PATTERN_DATETIME_MINI);
return "<MCCI_IN000002UV01 ITSVersion=\"XML_1.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"urn:hl7-org:v3\" xsi:schemaLocation=\"urn:hl7-org:v3\n" +
"file:///E:/hl7/HL7/v3ballot_fullsite_2011MAY/v3ballot/html/processable/multicacheschemas/MCCI\n" +
"_IN000002UV01.xsd\">\n" +
"\t<id extension=\"" + IdUtil.standardUUID() + "\"/>\n" +
"\t<creationTime value=\"" + createTime + "\"/>\n" +
"\t<interactionId root=\"2.16.840.1.113883.1.6\" extension=\"MCCI_IN000002UV01\"/>\n" +
"\t<processingCode code=\"P\"/>\n" +
"\t<processingModeCode/>\n" +
"\t<acceptAckCode code=\"AL\"/>\n" +
"\t<receiver typeCode=\"RCV\">\n" +
"\t\t<device classCode=\"DEV\" determinerCode=\"INSTANCE\">\n" +
"\t\t\t<id>\n" +
"\t\t\t\t<item extension=\"MDM\"/>\n" +
"\t\t\t</id>\n" +
"\t\t</device>\n" +
"\t</receiver>\n" +
"\t<sender typeCode=\"SND\">\n" +
"\t\t<device classCode=\"DEV\" determinerCode=\"INSTANCE\">\n" +
"\t\t\t<id>\n" +
"\t\t\t\t<item extension=\"" + params.get("receiver") + "\"/>\n" +
"\t\t\t</id>\n" +
"\t\t</device>\n" +
"\t</sender>\n" +
"\t<acknowledgement typeCode=\"AA\">\n" +
"\t\t<targetMessage>\n" +
"\t\t\t<id extension=\"" + params.get("msgId") + "\"/>\n" +
"\t\t</targetMessage>\n" +
"\t\t<acknowledgementDetail>\n" +
"\t\t\t<text value=\"" + params.get("msg") + "\"/>\n" +
"\t\t</acknowledgementDetail>\n" +
"\t</acknowledgement>\n" +
"</MCCI_IN000002UV01>";
}
@Override
public String fail(Map<String, Object> params) {
String createTime = Func.format(new Date(), DateUtil.PATTERN_DATETIME_MINI);
return "<RCMR_IN000030UV01 ITSVersion=\"XML_1.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"urn:hl7-org:v3\" xsi:schemaLocation=\"urn:hl7-org:v3\n" +
"file:///E:/hl7/HL7/v3ballot_fullsite_2011MAY/v3ballot/html/processable/multicacheschemas/RCMR\n" +
"_IN000030UV01.xsd\">\n" +
"\t<id extension=\"" + IdUtil.standardUUID() + "\"/>\n" +
"\t<creationTime value=\"" + createTime + "\"/>\n" +
"\t<interactionId root=\"2.16.840.1.113883.1.6\" extension=\"RCMR_IN000030UV01\"/>\n" +
"\t<processingCode code=\"P\"/>\n" +
"\t<processingModeCode/>\n" +
"\t<acceptAckCode code=\"AL\"/>\n" +
"\t<receiver typeCode=\"RCV\">\n" +
"\t\t<device classCode=\"DEV\" determinerCode=\"INSTANCE\">\n" +
"\t\t\t<id>\n" +
"\t\t\t\t<item extension=\"MDM\"/>\n" +
"\t\t\t</id>\n" +
"\t\t</device>\n" +
"\t</receiver>\n" +
"\t<sender typeCode=\"SND\">\n" +
"\t\t<device classCode=\"DEV\" determinerCode=\"INSTANCE\">\n" +
"\t\t\t<id>\n" +
"\t\t\t\t<item extension=\"" + params.get("receiver") + "\"/>\n" +
"\t\t\t</id>\n" +
"\t\t</device>\n" +
"\t</sender>\n" +
"\t<acknowledgement typeCode=\"AE\">\n" +
"\t\t<targetMessage>\n" +
"\t\t\t<id extension=\"" + params.get("msgId") + "\"/>\n" +
"\t\t</targetMessage>\n" +
"\t\t<acknowledgementDetail>\n" +
"\t\t\t<text value=\"" + params.get("msg") + "\"/>\n" +
"\t\t</acknowledgementDetail>\n" +
"\t</acknowledgement>\n" +
"</RCMR_IN000030UV01>\n";
}
}

@ -0,0 +1,41 @@
package com.docus.server.collect.dept.ws;
import com.docus.core.util.XmlUtil;
import com.docus.server.sys.common.pojo.dto.DeptDTO;
import com.docus.server.tool.ParamsUtils;
import com.docus.server.ws.convert.IPowerDeptConverter;
import org.w3c.dom.Node;
public class powerDeptConverter implements IPowerDeptConverter {
@Override
public DeptDTO xmlToConvertDeptDTO(String message) {
//TODO 根据协议进行解析。
XmlUtil xmlParseUtil = XmlUtil.of(message);
Node msgIdNode = xmlParseUtil.getNode("/PRVS_IN000002UV01/id/@extension");
Node receiverNode = xmlParseUtil.getNode("/PRVS_IN000002UV01/receiver/device/id/item/@extension");
Node operateTypeNode = xmlParseUtil.getNode("/PRVS_IN000002UV01/controlActProcess/subject/registrationRequest/subject1/valueSet/valueSetItems/@operateType");
Node deptCodeNode = xmlParseUtil.getNode("/PRVS_IN000002UV01/controlActProcess/subject/registrationRequest/subject1/valueSet/valueSetItems/DEPT_CODE/@value");
Node deptNameNode = xmlParseUtil.getNode("/PRVS_IN000002UV01/controlActProcess/subject/registrationRequest/subject1/valueSet/valueSetItems/DEPT_NAME/@value");
Node authorIdNode = xmlParseUtil.getNode("/PRVS_IN000002UV01/controlActProcess/subject/registrationRequest/author/assignedEntity/id/item/@extension");
Node authorNameNode = xmlParseUtil.getNode("/PRVS_IN000002UV01/controlActProcess/subject/registrationRequest/author/assignedEntity/assignedPerson/name/item/part/@value");
DeptDTO deptDto = new DeptDTO();
deptDto.setMessageId(msgIdNode.getNodeValue());
deptDto.setReceiver(receiverNode.getNodeValue());
deptDto.setOperateType(operateTypeNode.getNodeValue());
deptDto.setDeptCode(deptCodeNode.getNodeValue());
deptDto.setDeptName(deptNameNode.getNodeValue());
deptDto.setAuthorId(authorIdNode.getNodeValue());
deptDto.setAuthorName(authorNameNode.getNodeValue());
deptDto.setSource(message);//原始xml报文
deptDto.setParams(ParamsUtils.addParam("msg", "操作成功!")
.addParam("msgId", deptDto.getMessageId())
.addParam("receiver", deptDto.getReceiver())
.param());
return deptDto;
}
}

@ -1,4 +1,4 @@
package com.docus.server.collect.user;
package com.docus.server.collect.user.http;
import com.docus.server.collect.service.IHttpUserCollectService;
import com.docus.server.sys.common.pojo.dto.UserDTO;

@ -1,4 +1,4 @@
package com.docus.server.collect.user;
package com.docus.server.collect.user.mq;
import com.docus.core.util.XmlUtil;
import com.docus.server.collect.mq.user.AbstractUserMqCollectService;

@ -0,0 +1,89 @@
package com.docus.server.collect.user.ws;
import com.docus.core.util.DateUtil;
import com.docus.core.util.Func;
import com.docus.server.tool.IdUtil;
import com.docus.server.ws.IWsResult;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.Map;
@Component("wsUserResultImpl")
public class WsUserResultImpl implements IWsResult {
@Override
public String ok(Map<String, Object> params) {
String createTime = Func.format(new Date(), DateUtil.PATTERN_DATETIME_MINI);
return "<MCCI_IN000002UV01 ITSVersion=\"XML_1.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"urn:hl7-org:v3\" xsi:schemaLocation=\"urn:hl7-org:v3\n" +
"file:///E:/hl7/HL7/v3ballot_fullsite_2011MAY/v3ballot/html/processable/multicacheschemas/MCCI\n" +
"_IN000002UV01.xsd\">\n" +
"\t<id extension=\"" + IdUtil.standardUUID() + "\"/>\n" +
"\t<creationTime value=\"" + createTime + "\"/>\n" +
"\t<interactionId root=\"2.16.840.1.113883.1.6\" extension=\"MCCI_IN000002UV01\"/>\n" +
"\t<processingCode code=\"P\"/>\n" +
"\t<processingModeCode/>\n" +
"\t<acceptAckCode code=\"AL\"/>\n" +
"\t<receiver typeCode=\"RCV\">\n" +
"\t\t<device classCode=\"DEV\" determinerCode=\"INSTANCE\">\n" +
"\t\t\t<id>\n" +
"\t\t\t\t<item extension=\"MDM\"/>\n" +
"\t\t\t</id>\n" +
"\t\t</device>\n" +
"\t</receiver>\n" +
"\t<sender typeCode=\"SND\">\n" +
"\t\t<device classCode=\"DEV\" determinerCode=\"INSTANCE\">\n" +
"\t\t\t<id>\n" +
"\t\t\t\t<item extension=\"" + params.get("receiver") + "\"/>\n" +
"\t\t\t</id>\n" +
"\t\t</device>\n" +
"\t</sender>\n" +
"\t<acknowledgement typeCode=\"AA\">\n" +
"\t\t<targetMessage>\n" +
"\t\t\t<id extension=\"" + params.get("msgId") + "\"/>\n" +
"\t\t</targetMessage>\n" +
"\t\t<acknowledgementDetail>\n" +
"\t\t\t<text value=\"" + params.get("msg") + "\"/>\n" +
"\t\t</acknowledgementDetail>\n" +
"\t</acknowledgement>\n" +
"</MCCI_IN000002UV01>";
}
@Override
public String fail(Map<String, Object> params) {
String createTime = Func.format(new Date(), DateUtil.PATTERN_DATETIME_MINI);
return "<RCMR_IN000030UV01 ITSVersion=\"XML_1.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"urn:hl7-org:v3\" xsi:schemaLocation=\"urn:hl7-org:v3\n" +
"file:///E:/hl7/HL7/v3ballot_fullsite_2011MAY/v3ballot/html/processable/multicacheschemas/RCMR\n" +
"_IN000030UV01.xsd\">\n" +
"\n" +
"\t<id extension=\"" + IdUtil.standardUUID() + "\"/>\n" +
"\t<creationTime value=\"" + createTime + "\"/>\n" +
"\t<interactionId root=\"2.16.840.1.113883.1.6\" extension=\"RCMR_IN000030UV01\"/>\n" +
"\t<processingCode code=\"P\"/>\n" +
"\t<processingModeCode/>\n" +
"\t<acceptAckCode code=\"AL\"/>\n" +
"\t<receiver typeCode=\"RCV\">\n" +
"\t\t<device classCode=\"DEV\" determinerCode=\"INSTANCE\">\n" +
"\t\t\t<id>\n" +
"\t\t\t\t<item extension=\"MDM\"/>\n" +
"\t\t\t</id>\n" +
"\t\t</device>\n" +
"\t</receiver>\n" +
"\t<sender typeCode=\"SND\">\n" +
"\t\t<device classCode=\"DEV\" determinerCode=\"INSTANCE\">\n" +
"\t\t\t<id>\n" +
"\t\t\t\t<item extension=\"" + params.get("receiver") + "\"/>\n" +
"\t\t\t</id>\n" +
"\t\t</device>\n" +
"\t</sender>\n" +
"\t<acknowledgement typeCode=\"AE\">\n" +
"\t\t<targetMessage>\n" +
"\t\t\t<id extension=\"" + params.get("msgId") + "\"/>\n" +
"\t\t</targetMessage>\n" +
"\t\t<acknowledgementDetail>\n" +
"\t\t\t<text value=\"" + params.get("msg") + "\"/>\n" +
"\t\t</acknowledgementDetail>\n" +
"\t</acknowledgement>\n" +
"</RCMR_IN000030UV01>\n";
}
}

@ -0,0 +1,42 @@
package com.docus.server.collect.user.ws;
import com.docus.core.util.XmlUtil;
import com.docus.server.sys.common.pojo.dto.UserDTO;
import com.docus.server.tool.ParamsUtils;
import com.docus.server.ws.convert.IPowerUserConverter;
import org.w3c.dom.Node;
public class powerUserConverter implements IPowerUserConverter {
@Override
public UserDTO xmlToConvertUserDTO(String message) {
XmlUtil xmlParseUtil = XmlUtil.of(message);
Node msgIdNode = xmlParseUtil.getNode("/PRVS_IN000002UV01/id/@extension");
Node receiverNode = xmlParseUtil.getNode("/PRVS_IN000002UV01/receiver/device/id/item/@extension");
Node operateTypeNode = xmlParseUtil.getNode("/PRVS_IN000002UV01/controlActProcess/subject/registrationRequest/subject1/valueSet/valueSetItems/@operateType");
Node employeeCodeNode = xmlParseUtil.getNode("/PRVS_IN000002UV01/controlActProcess/subject/registrationRequest/subject1/valueSet/valueSetItems/EMPL_CODE/@value");
Node employeeNameNode = xmlParseUtil.getNode("/PRVS_IN000002UV01/controlActProcess/subject/registrationRequest/subject1/valueSet/valueSetItems/EMPL_NAME/@value");
Node deptCodeNode = xmlParseUtil.getNode("/PRVS_IN000002UV01/controlActProcess/subject/registrationRequest/subject1/valueSet/valueSetItems/DEPT_CODE/@value");
Node positionNode = xmlParseUtil.getNode("/PRVS_IN000002UV01/controlActProcess/subject/registrationRequest/subject1/valueSet/valueSetItems/POSI_NAME/@value");
Node authorIdNode = xmlParseUtil.getNode("/PRVS_IN000002UV01/controlActProcess/subject/registrationRequest/author/assignedEntity/id/item/@extension");
Node authorNameNode = xmlParseUtil.getNode("/PRVS_IN000002UV01/controlActProcess/subject/registrationRequest/author/assignedEntity/assignedPerson/name/item/part/@value");
UserDTO userDTO = new UserDTO();
userDTO.setDeptId(deptCodeNode.getNodeValue());
userDTO.setReceiver(receiverNode.getNodeValue());
userDTO.setOperateType(operateTypeNode.getNodeValue());
userDTO.setUserName(employeeCodeNode.getNodeValue());
userDTO.setName(employeeNameNode.getNodeValue());
userDTO.setPosition(positionNode.getNodeValue());
userDTO.setAuthorId(authorIdNode.getNodeValue());
userDTO.setMessageId(msgIdNode.getNodeValue());
userDTO.setAuthorName(authorNameNode.getNodeValue());
userDTO.setRoleId(0L);
userDTO.setParams(ParamsUtils.addParam("msg", "操作成功!")
.addParam("msgId", userDTO.getMessageId())
.addParam("receiver", userDTO.getReceiver())
.param());
return userDTO;
}
}

@ -52,6 +52,7 @@ mybatis-plus:
db-config:
field-strategy: NOT_EMPTY
db-type: MYSQL
type-enums-package: com.docus.server.collect.infrastructure.enums
xxl:
job:
accessToken:

@ -26,5 +26,11 @@
<artifactId>his-sysem</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.retry</groupId>
<artifactId>spring-retry</artifactId>
</dependency>
</dependencies>
</project>

@ -0,0 +1,33 @@
package com.docus.server.collect.infrastructure.dao;
import com.docus.server.collect.infrastructure.enums.IIntegerEnum;
public enum CollectTypeEnum implements IIntegerEnum {
WS_XML_DEPT(0, "ws同步的科室数据"),
WS_XML_USER(1, "ws同步的用户数据"),
WS_XML_BASIC(2, "ws同步的病患数据");
private Integer value;
private String display;
CollectTypeEnum(Integer value, String display) {
this.value = value;
this.display = display;
}
@Override
public Integer getValue() {
return value;
}
@Override
public String getDisplay() {
return display;
}
public static CollectTypeEnum fromValue(Integer value) {
return IIntegerEnum.fromValue(CollectTypeEnum.class, value);
}
}

@ -0,0 +1,32 @@
package com.docus.server.collect.infrastructure.dao;
import com.docus.server.collect.infrastructure.enums.IIntegerEnum;
public enum FlagEnum implements IIntegerEnum {
INSERT(1, "新增"),
UPDATE(2, "更新"),
DELETE(3, "删除");
private Integer value;
private String display;
FlagEnum(Integer value, String display) {
this.value = value;
this.display = display;
}
@Override
public Integer getValue() {
return value;
}
@Override
public String getDisplay() {
return display;
}
public static FlagEnum fromValue(Integer value) {
return IIntegerEnum.fromValue(FlagEnum.class, value);
}
}

@ -0,0 +1,27 @@
package com.docus.server.collect.infrastructure.dao;
import com.docus.server.collect.infrastructure.enums.IIntegerEnum;
public enum StateEnum implements IIntegerEnum {
OK(0, "成功"),
FAIL(1, "失败");
private Integer value;
private String display;
StateEnum(Integer value, String display) {
this.value = value;
this.display = display;
}
@Override
public Integer getValue() {
return value;
}
@Override
public String getDisplay() {
return display;
}
}

@ -0,0 +1,59 @@
package com.docus.server.collect.infrastructure.dao;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author AutoGenerator
* @since 2023-06-01
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("task_original_message")
@ApiModel(value = "TaskOriginalMessage对象", description = "")
public class TaskOriginalMessage implements Serializable {
@ApiModelProperty(value = "主键")
@TableId(value = "id", type = IdType.ASSIGN_UUID)
private long id;
@ApiModelProperty(value = "采集名字")
@TableField("name")
private String name;
@ApiModelProperty(value = "采集类型")
@TableField("collect_type")
private CollectTypeEnum collectType;
@ApiModelProperty(value = "原始报文")
@TableField("source")
private String source;
@ApiModelProperty(value = "状态 1失败0:成功")
@TableField("state")
private StateEnum state;
@ApiModelProperty(value = "入库时间")
@TableField("create_time")
private Date createTime;
@ApiModelProperty(value = "入库更新时间")
@TableField("update_time")
private Date updateTime;
}

@ -0,0 +1,31 @@
package com.docus.server.collect.infrastructure.enums;
public class EnumItemView {
private Integer value;
private String display;
public EnumItemView() {
}
public EnumItemView(Integer value, String display) {
this.value = value;
this.display = display;
}
public Integer getValue() {
return value;
}
public void setValue(Integer value) {
this.value = value;
}
public String getDisplay() {
return display;
}
public void setDisplay(String display) {
this.display = display;
}
}

@ -0,0 +1,49 @@
package com.docus.server.collect.infrastructure.enums;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.EnumTypeHandler;
import org.apache.ibatis.type.JdbcType;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
//mybatis枚举类型分发
public class EnumTypeHandlerDispatch<E extends Enum<E>> extends BaseTypeHandler<E> {
private BaseTypeHandler<E> typeHandler;
public EnumTypeHandlerDispatch(Class<E> type) {
if (type == null) {
throw new IllegalArgumentException("Type argument. cannot be nu11");
}
if (IIntegerEnum.class.isAssignableFrom(type)) {
//如果实现了IIntegerEnum,使用自定义的转换器
typeHandler = new IntegerEnumHandler(type);
} else {
//默认转换器
typeHandler = new EnumTypeHandler<>(type);
}
}
@Override
public void setNonNullParameter(PreparedStatement ps, int i, E parameter, JdbcType jdbcType) throws
SQLException {
typeHandler.setNonNullParameter(ps, i, parameter, jdbcType);
}
@Override
public E getNullableResult(ResultSet rs, String columnName) throws SQLException {
return typeHandler.getNullableResult(rs, columnName);
}
@Override
public E getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
return typeHandler.getNullableResult(rs, columnIndex);
}
@Override
public E getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
return typeHandler.getNullableResult(cs, columnIndex);
}
}

@ -0,0 +1,23 @@
package com.docus.server.collect.infrastructure.enums;
import com.baomidou.mybatisplus.annotation.IEnum;
import java.util.Objects;
public interface IIntegerEnum extends IEnum {
@Override
Integer getValue();
String getDisplay();
static <T extends IIntegerEnum> T fromValue(Class<T> enumType, Integer value) {
for (T object : enumType.getEnumConstants()) {
if (Objects.equals(value, object.getValue())) {
return object;
}
}
throw new IllegalArgumentException("No. enum value 。" + value + "of " + enumType.getCanonicalName());
}
}

@ -0,0 +1,48 @@
package com.docus.server.collect.infrastructure.enums;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
//mybatis枚举类型转换
public class IntegerEnumHandler<E extends IIntegerEnum> extends BaseTypeHandler<E> {
private final Class<E> type;
public IntegerEnumHandler(Class<E> type) {
if (type == null) {
throw new IllegalArgumentException("Type argument. cannot. be nu11");
}
this.type = type;
}
@Override
public void setNonNullParameter(PreparedStatement ps, int i, E parameter, JdbcType jdbcType) throws SQLException {
if (jdbcType == null) {
ps.setInt(i, parameter.getValue());
} else {
ps.setObject(i, parameter.getValue(), jdbcType.TYPE_CODE); //1 / see r3589
}
}
@Override
public E getNullableResult(ResultSet rs, String columnName) throws SQLException {
String s = rs.getString(columnName);
return s == null ? null : IIntegerEnum.fromValue(type, Integer.parseInt(s));
}
@Override
public E getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
String s = rs.getString(columnIndex);
return s == null ? null : IIntegerEnum.fromValue(type, Integer.parseInt(s));
}
@Override
public E getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
String s = cs.getString(columnIndex);
return s == null ? null : IIntegerEnum.fromValue(type, Integer.parseInt(s));
}
}

@ -0,0 +1,14 @@
package com.docus.server.collect.infrastructure.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.docus.server.collect.infrastructure.dao.TaskOriginalMessage;
import org.apache.ibatis.annotations.Mapper;
/**
* Mapper
* Generated on 2023-06-01
*/
@Mapper
public interface TaskOriginalMessageMapper extends BaseMapper<TaskOriginalMessage> {
}

@ -1,35 +1,48 @@
package com.docus.server.collect.service;
import com.docus.server.collect.infrastructure.dao.ReceiveDeptInfoEntity;
import com.docus.server.collect.infrastructure.mapper.ReceiveDeptInfoMapper;
import com.docus.server.sys.common.pojo.dto.DeptDTO;
import com.docus.server.sys.common.pojo.dto.UserDTO;
import com.docus.server.sys.service.IPowerDeptService;
import org.springframework.stereotype.Component;
import com.docus.server.sys.service.IPowerUserService;
import com.docus.server.ws.impl.BaseCollectService;
import org.springframework.retry.annotation.Backoff;
import org.springframework.retry.annotation.Retryable;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Component
@Service
public class CollectService {
public class CollectService extends BaseCollectService {
@Resource
private IPowerDeptService deptService;
@Resource
private ReceiveDeptInfoMapper receiveDeptInfoMapper;
public void receiveDept(DeptDTO dept) {
//判断任务是否存在。
//保存数据库
//从dept 解析为数据库对象
ReceiveDeptInfoEntity receiveDeptInfoEntity = new ReceiveDeptInfoEntity();
receiveDeptInfoMapper.insert(receiveDeptInfoEntity);
private IPowerUserService userService;
/**
* 3
*/
@Async
@Retryable(value = Exception.class, maxAttempts = 3, backoff = @Backoff(delay = 2000L, multiplier = 1.5))
public void toInsertOrUpdateDept(DeptDTO deptDTO) {
//异步写入归档系统,失败自动重试。
deptService.saveOrUpdatePowerDept(dept);
if (checkType(deptDTO.getOperateType(), delType)) {
deptService.delDeptByDeptCode(deptDTO.getDeptCode());
} else {
deptService.saveOrUpdatePowerDept(deptDTO);
}
}
@Async
@Retryable(value = Exception.class, maxAttempts = 3, backoff = @Backoff(delay = 2000L, multiplier = 1.5))
public void toInsertOrUpdateUser(UserDTO userDTO) {
// 判断操作类型
if (checkType(userDTO.getOperateType(), delType)) {
userService.delUserByUserName(userDTO.getUserName());
} else {
userService.saveOrUpdatePowerUser(userDTO);
}
}
}

@ -0,0 +1,34 @@
package com.docus.server.tool;
import java.util.HashMap;
import java.util.Map;
public final class ParamsUtils {
public static Param addParam(String key, Object obj) {
return new Param(key, obj);
}
public Map<String, Object> param(String key, Object obj) {
return new Param(key, obj).param();
}
public static final class Param {
private Map<String, Object> params = new HashMap<String, Object>();
public Param(String key, Object value) {
addParam(key, value);
}
public Param addParam(String key, Object value) {
this.params.put(key, value);
return this;
}
public Map<String, Object> param() {
return this.params;
}
}
}

@ -0,0 +1,16 @@
package com.docus.server.ws;
import javax.jws.WebService;
@WebService
public interface IBasicService {
/**
* @description
*/
public String setTBasic(String str);
/**
* @description
*/
public String updateTBasic(String str);
}

@ -0,0 +1,17 @@
package com.docus.server.ws;
import javax.jws.WebService;
/**
* @author Fang Ruichuan
* @date 2022-11-14 19:03
*/
@WebService
public interface IDeptServer {
/**
*
* @param receiveUser
* @return
*/
String deptModify(String receiveUser);
}

@ -0,0 +1,38 @@
package com.docus.server.ws;
import javax.jws.WebService;
/**
* @author Fang Ruichuan
* @date 2022-11-14 19:03
*/
@WebService
public interface IReportServer {
/**
*
* @param saReportMessage
* @return
*/
String pushSAReport(String saReportMessage);
/**
*
* @param icuReportMessage
* @return
*/
String pushICUReport(String icuReportMessage);
/**
* -
* @param inspectionReportMessage -
* @return
*/
String pushAddInspectionReport(String inspectionReportMessage);
/**
* -
* @param inspectionReportMessage -
* @return
*/
String pushUpdateInspectionReport(String inspectionReportMessage);
}

@ -0,0 +1,11 @@
package com.docus.server.ws;
import com.docus.server.collect.infrastructure.dao.CollectTypeEnum;
public interface ITaskOriginalMessageService {
long insertTaskOriginalMessage(String deptXml, CollectTypeEnum collectType);
void updateTaskOriginalMessage(long id);
}

@ -0,0 +1,17 @@
package com.docus.server.ws;
import javax.jws.WebService;
/**
* @author Fang Ruichuan
* @date 2022-11-14 19:03
*/
@WebService
public interface IUserServer {
/**
*
* @param receiveUser
* @return
*/
String userModify(String receiveUser);
}

@ -2,15 +2,14 @@ package com.docus.server.ws;
import javax.jws.WebService;
@WebService
public interface IWebserviceServer {
@WebService(targetNamespace = "http://impl.webservice.collection.server.docus.com/")
public interface IWebServiceServer {
/**
* xml
*/
String receiveHandNumbness(String handNumbness);
/**
* xml
*

@ -6,9 +6,6 @@ public interface IWsResult {
String ok(Map<String, Object> params);
String fail(String message);
String ok(String message);
String fail(Map<String, Object> params);
}

@ -1,7 +1,5 @@
package com.docus.server.ws;
import com.docus.core.util.Func;
import com.docus.infrastructure.core.exception.BaseException;
import com.docus.server.collect.service.CollectService;
import com.docus.server.collect.service.IParseService;
import com.docus.server.record.pojo.entity.MedicalRecord;
@ -12,9 +10,6 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
@Slf4j
@Component
public class WsCollect {
@ -28,10 +23,6 @@ public class WsCollect {
private IWsResult wsResult;
@Autowired
private IPowerDeptService powerDeptService;
@Autowired
private IWsResult wsResult;
@Autowired
private IWsResult wsResult;
//接收xml。并且下载病案。
public String receiveHandNumbness(String handNumbness) {
@ -58,31 +49,4 @@ public class WsCollect {
}
}
public String deptModify(String receiveUser) {
log.info("新增/修改科室数据:{}", receiveUser);
DeptDTO deptDto = new DeptDTO();
try {
deptDto = parseService.parseDeptXml(receiveUser);
String operateType = deptDto.getOperateType();
String delType = "D";
// 判断操作类型
if (Func.isNotEmpty(operateType) && operateType.contains(delType)) {
powerDeptService.delDeptByDeptCode(deptDto.getDeptCode());
} else {
powerDeptService.saveOrUpdatePowerDept(deptDto);
}
return wsResult.ok(parseService.parseDeptOkXml(deptDto));
} catch (BaseException e) {
log.error(e.getMessage(), e);
deptDto.setErrorMsg(e.getMessage());
return wsResult.fail(parseService.parseDeptFailXml(deptDto));
} catch (Exception e) {
log.error(e.getMessage(), e);
deptDto.setErrorMsg("系统出错啦!");
return wsResult.fail(parseService.parseDeptFailXml(deptDto));
}
}
}

@ -0,0 +1,14 @@
package com.docus.server.ws.convert;
import com.docus.server.sys.common.pojo.dto.DeptDTO;
public interface IPowerDeptConverter {
/**
* ws dept xml
*
* @param message
* @return
*/
DeptDTO xmlToConvertDeptDTO(String message);
}

@ -0,0 +1,14 @@
package com.docus.server.ws.convert;
import com.docus.server.sys.common.pojo.dto.UserDTO;
public interface IPowerUserConverter {
/**
* ws user xml
*
* @param message
* @return
*/
UserDTO xmlToConvertUserDTO(String message);
}

@ -0,0 +1,16 @@
package com.docus.server.ws.convert;
import com.docus.server.collect.infrastructure.dao.FlagEnum;
import com.docus.server.record.pojo.dto.TBasicDTO;
public interface ITBasicConverter {
/**
* ws basic xml
*
* @param message
* @param update
* @return
*/
TBasicDTO xmlToConvertBasicDTO(String message, FlagEnum update);
}

@ -0,0 +1,28 @@
package com.docus.server.ws.convert;
import com.docus.core.util.DateUtil;
import com.docus.infrastructure.redis.service.IdService;
import com.docus.server.collect.infrastructure.dao.CollectTypeEnum;
import com.docus.server.collect.infrastructure.dao.StateEnum;
import com.docus.server.collect.infrastructure.dao.TaskOriginalMessage;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@Component
public class TaskOriginalMessageConverter {
@Resource
private IdService idService;
public TaskOriginalMessage toConvertTaskOriginalMessageDO(String xml, CollectTypeEnum collectType) {
TaskOriginalMessage taskOriginalMessage = new TaskOriginalMessage();
taskOriginalMessage.setId(idService.getDateSeq());
taskOriginalMessage.setName(collectType.name());
taskOriginalMessage.setCollectType(collectType);
taskOriginalMessage.setSource(xml);
taskOriginalMessage.setState(StateEnum.OK);
taskOriginalMessage.setCreateTime(DateUtil.now());
taskOriginalMessage.setUpdateTime(DateUtil.now());
return taskOriginalMessage;
}
}

@ -0,0 +1,16 @@
package com.docus.server.ws.impl;
import com.docus.core.util.Func;
public class BaseCollectService {
protected String delType = "D";
protected boolean checkType(String operateType, String delType) {
return Func.isNotEmpty(operateType)
&& operateType.contains(delType);
}
}

@ -0,0 +1,92 @@
package com.docus.server.ws.impl;
import com.docus.core.util.Func;
import com.docus.server.collect.infrastructure.dao.CollectTypeEnum;
import com.docus.server.collect.infrastructure.dao.FlagEnum;
import com.docus.server.record.pojo.dto.TBasicDTO;
import com.docus.server.record.service.ITBasicService;
import com.docus.server.tool.ParamsUtils;
import com.docus.server.ws.IBasicService;
import com.docus.server.ws.ITaskOriginalMessageService;
import com.docus.server.ws.IWsResult;
import com.docus.server.ws.convert.ITBasicConverter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* @BelongsProject: docus-webservice-sdry
* @BelongsPackage: com.docus.server.collection.webservice
* @Author: chierhao
* @CreateTime: 2023-02-25 14:52
* @Description: TODO
* @Version: 1.0
*/
@Service
@Slf4j
public class BasicServiceImpl implements IBasicService {
@Resource(name = "wsDeptResultImpl")
private IWsResult wsResult;
@Resource
private ITBasicService tBasicService;
@Resource
private ITBasicConverter converter;
@Resource
private ITaskOriginalMessageService taskOriginalMessageService;
@Override
public String setTBasic(String message) {
log.info("新增基础数据:{}", message);
if (Func.isEmpty(message)) {
return toFail();
}
//此处需要存储原xml内容。
TBasicDTO tBasicDTO = new TBasicDTO();
long id = 0;
try {
id = taskOriginalMessageService.insertTaskOriginalMessage(message, CollectTypeEnum.WS_XML_BASIC);
tBasicDTO = converter.xmlToConvertBasicDTO(message, FlagEnum.INSERT);
tBasicService.insertTBasic(tBasicDTO);
return wsResult.ok(tBasicDTO.getParams());
} catch (Exception e) {
log.error(e.getMessage(), e);
taskOriginalMessageService.updateTaskOriginalMessage(id);
tBasicDTO.getParams().put("msg", e.getMessage());
return wsResult.fail(tBasicDTO.getParams());
}
}
@Override
public String updateTBasic(String message) {
log.info("修改基础数据:{}", message);
if (Func.isEmpty(message)) {
return toFail();
}
TBasicDTO tBasicDTO = new TBasicDTO();
long id = 0;
try {
id = taskOriginalMessageService.insertTaskOriginalMessage(message, CollectTypeEnum.WS_XML_BASIC);
tBasicDTO = converter.xmlToConvertBasicDTO(message, FlagEnum.UPDATE);
tBasicService.updateTBasic(tBasicDTO);
return wsResult.ok(tBasicDTO.getParams());
} catch (Exception e) {
log.error(e.getMessage(), e);
taskOriginalMessageService.updateTaskOriginalMessage(id);
tBasicDTO.getParams().put("msg", e.getMessage());
return wsResult.fail(tBasicDTO.getParams());
}
}
private String toFail() {
return wsResult.fail(ParamsUtils.addParam("serialId", null)
.addParam("msg", "参数为空")
.addParam("receive", null)
.addParam("send", null).param());
}
}

@ -0,0 +1,52 @@
package com.docus.server.ws.impl;
import com.docus.server.collect.infrastructure.dao.CollectTypeEnum;
import com.docus.server.collect.service.CollectService;
import com.docus.server.sys.common.pojo.dto.DeptDTO;
import com.docus.server.ws.IDeptServer;
import com.docus.server.ws.ITaskOriginalMessageService;
import com.docus.server.ws.IWsResult;
import com.docus.server.ws.convert.IPowerDeptConverter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* @author wen yongbin
* @date 202322521:56:33
*/
@Service
@Slf4j
public class DeptServerImpl implements IDeptServer {
@Resource(name = "wsBasicResultImpl")
private IWsResult wsResult;
@Resource
private CollectService collectService;
@Resource
private IPowerDeptConverter converter;
@Resource
private ITaskOriginalMessageService taskOriginalMessageService;
@Override
public String deptModify(String message) {
log.info("新增/修改科室数据:{}", message);
DeptDTO deptDTO = new DeptDTO();
long id = 0;
try {
//此处需要存储原xml内容。
id = taskOriginalMessageService.insertTaskOriginalMessage(message, CollectTypeEnum.WS_XML_DEPT);
deptDTO = converter.xmlToConvertDeptDTO(message);
collectService.toInsertOrUpdateDept(deptDTO);
return wsResult.ok(deptDTO.getParams());
} catch (Exception e) {
log.error(e.getMessage(), e);
taskOriginalMessageService.updateTaskOriginalMessage(id);
deptDTO.getParams().put("msg", e.getMessage());
return wsResult.fail(deptDTO.getParams());
}
}
}

@ -0,0 +1,45 @@
package com.docus.server.ws.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.docus.core.util.DateUtil;
import com.docus.server.collect.infrastructure.dao.CollectTypeEnum;
import com.docus.server.collect.infrastructure.dao.StateEnum;
import com.docus.server.collect.infrastructure.dao.TaskOriginalMessage;
import com.docus.server.collect.infrastructure.mapper.TaskOriginalMessageMapper;
import com.docus.server.ws.ITaskOriginalMessageService;
import com.docus.server.ws.convert.TaskOriginalMessageConverter;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Objects;
@Service
public class TaskOriginalMessageServiceImpl extends ServiceImpl<TaskOriginalMessageMapper, TaskOriginalMessage> implements ITaskOriginalMessageService {
@Resource
private TaskOriginalMessageConverter converter;
/**
* ws xml dept
*/
@Transactional(rollbackFor = Exception.class)
@Override
public long insertTaskOriginalMessage(String deptXml, CollectTypeEnum collectType) {
TaskOriginalMessage taskOriginalMessage = converter.toConvertTaskOriginalMessageDO(deptXml, collectType);
super.save(taskOriginalMessage);
return taskOriginalMessage.getId();
}
@Transactional(rollbackFor = Exception.class)
@Override
public void updateTaskOriginalMessage(long id) {
TaskOriginalMessage taskOriginalMessage = super.getById(id);
if (Objects.nonNull(taskOriginalMessage)) {
taskOriginalMessage.setUpdateTime(DateUtil.now());
taskOriginalMessage.setState(StateEnum.FAIL);
super.updateById(taskOriginalMessage);
}
}
}

@ -0,0 +1,51 @@
package com.docus.server.ws.impl;
import com.docus.server.collect.infrastructure.dao.CollectTypeEnum;
import com.docus.server.collect.service.CollectService;
import com.docus.server.sys.common.pojo.dto.UserDTO;
import com.docus.server.ws.ITaskOriginalMessageService;
import com.docus.server.ws.IUserServer;
import com.docus.server.ws.IWsResult;
import com.docus.server.ws.convert.IPowerUserConverter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* @author wen yongbin
* @date 202322521:56:33
*/
@Service
@Slf4j
public class UserServerImpl implements IUserServer {
@Resource(name = "wsUserResultImpl")
private IWsResult wsResult;
@Resource
private CollectService collectService;
@Resource
private IPowerUserConverter converter;
@Resource
private ITaskOriginalMessageService taskOriginalMessageService;
@Override
public String userModify(String message) {
log.info("新增/修改用户数据:{}", message);
UserDTO userDTO = new UserDTO();
long id = 0;
try {
id = taskOriginalMessageService.insertTaskOriginalMessage(message, CollectTypeEnum.WS_XML_USER);
userDTO = converter.xmlToConvertUserDTO(message);
collectService.toInsertOrUpdateUser(userDTO);
return wsResult.ok(userDTO.getParams());
} catch (Exception e) {
log.error(e.getMessage(), e);
taskOriginalMessageService.updateTaskOriginalMessage(id);
userDTO.getParams().put("msg", e.getMessage());
return wsResult.fail(userDTO.getParams());
}
}
}

@ -0,0 +1,181 @@
package com.docus.server.ws.impl;
import com.docus.server.ws.IBasicService;
import com.docus.server.ws.IDeptServer;
import com.docus.server.ws.IReportServer;
import com.docus.server.ws.IUserServer;
import com.docus.server.ws.IWebServiceServer;
import com.docus.server.ws.WsCollect;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Slf4j
@Service
public class WebServiceServer implements IWebServiceServer {
@Resource
private IUserServer userServer;
@Resource
private IDeptServer deptServer;
@Resource
private IBasicService basicService;
@Resource
private IReportServer reportServer;
@Resource
private WsCollect wsCollect;
@Override
public String receiveHandNumbness(String handNumbness) {
return wsCollect.receiveHandNumbness(handNumbness);
}
@Override
public String receiveDept(String deptXml) {
return wsCollect.receiveDept(deptXml);
}
@Override
public String deptModify(String receiveDept) {
return deptServer.deptModify(receiveDept);
}
@Override
public String setTBasic(String str) {
return basicService.setTBasic(str);
}
@Override
public String updateTBasic(String str) {
return basicService.updateTBasic(str);
}
@Override
public String userModify(String receiveUser) {
return userServer.userModify(receiveUser);
}
@Override
public String pushICUReport(String icuReportMessage) {
return reportServer.pushICUReport(icuReportMessage);
}
@Override
public String pushAddInspectionReport(String inspectionReportMessage) {
return reportServer.pushAddInspectionReport(inspectionReportMessage);
}
@Override
public String pushUpdateInspectionReport(String inspectionReportMessage) {
return reportServer.pushUpdateInspectionReport(inspectionReportMessage);
}
@Override
public String querySdJxIndexTest(String xml) {
System.out.println("收到那个人想查报告的动机,参数为:" + xml);
return "<PRPA_HIP1179 xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ITSVersion=\"XML_1.0\" xmlns=\"urn:hl7-org:v3\" xsi:schemaLocation=\"urn:hl7-org:v3 ../multicacheschemas/PRPA_IN201306UV02.xsd\">\n" +
"\t<id root=\"2.16.156.10011.0\" extension=\"8D73520B-D489-4B70-8F4B-7B5C2D7961B5\"/>\n" +
"\t<creationTime value=\"20120101010101\"/>\n" +
"\t<interactionId root=\"2.16.840.1.113883.1.6\" extension=\"PRPA_HIP1179\"/>\n" +
"\t<processingCode code=\"P\"/>\n" +
"\t<processingModeCode/>\n" +
"\t<acceptAckCode code=\"AL\"/>\n" +
"\t<receiver typeCode=\"RCV\">\n" +
"\t\t<telecom/>\n" +
"\t\t<device classCode=\"DEV\" determinerCode=\"INSTANCE\">\n" +
"\t\t\t<id>\n" +
"\t\t\t\t<item root=\"2.16.156.10011.0.1.1\" extension=\"Orion-001\"/>\n" +
"\t\t\t</id>\n" +
"\t\t</device>\n" +
"\t</receiver>\n" +
"\t<sender typeCode=\"SND\">\n" +
"\t\t<telecom/>\n" +
"\t\t<device classCode=\"DEV\" determinerCode=\"INSTANCE\">\n" +
"\t\t\t<id>\n" +
"\t\t\t\t<item root=\"2.16.156.10011.0.1.2\" extension=\"\"/>\n" +
"\t\t\t</id>\n" +
"\t\t</device>\n" +
"\t</sender>\n" +
"\t<acknowledgement typeCode=\"AA\">\n" +
"\t\t<targetMessage>\n" +
"\t\t\t<id root=\"2.16.156.10011.0\" extension=\"22a0f9e0-4454-11dc-a6be-3603d6866807\"/>\n" +
"\t\t</targetMessage>\n" +
"\t\t<acknowledgementDetail>\n" +
"\t\t\t<text value=\"处理结果说明\"/>\n" +
"\t\t</acknowledgementDetail>\n" +
"\t</acknowledgement>\n" +
"\t<controlActProcess classCode=\"CACT\" moodCode=\"EVN\">\n" +
"\t\t<subject typeCode=\"SUBJ\">\n" +
"\t\t\t<!-- 交叉索引信息 -->\n" +
"\t\t\t<empiIndex>\n" +
"\t\t\t\t<patientIds>\n" +
"\t\t\t\t\t<!--patientId节点循环有多个-->\n" +
"\t\t\t\t\t<patientId>ceshi1</patientId>\n" +
"\t\t\t\t\t<patientId>ceshi2</patientId>\n" +
"\t\t\t\t\t<patientId>ceshi3</patientId>\n" +
"\t\t\t\t</patientIds>\n" +
"\t\t\t\t<idCards>\n" +
"\t\t\t\t\t<!-- type卡类型 value卡号 name患者姓名-->\n" +
"\t\t\t\t\t<idCard type=\"居民身份证\" value=\"xxx\" name=\"xxx\"/>\n" +
"\t\t\t\t</idCards>\n" +
"\t\t\t</empiIndex>\n" +
"\t\t</subject>\n" +
"\t</controlActProcess>\n" +
"</PRPA_HIP1179>\n";
}
@Override
public String querySdJxIndexNoResultTest(String xml) {
System.out.println("收到那个人想查报告的动机,参数为:" + xml);
return "<PRPA_HIP1179 xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ITSVersion=\"XML_1.0\" xmlns=\"urn:hl7-org:v3\" xsi:schemaLocation=\"urn:hl7-org:v3 ../multicacheschemas/PRPA_IN201306UV02.xsd\">\n" +
"\t<id root=\"2.16.156.10011.0\" extension=\"8D73520B-D489-4B70-8F4B-7B5C2D7961B5\"/>\n" +
"\t<creationTime value=\"20120101010101\"/>\n" +
"\t<interactionId root=\"2.16.840.1.113883.1.6\" extension=\"PRPA_HIP1179\"/>\n" +
"\t<processingCode code=\"P\"/>\n" +
"\t<processingModeCode/>\n" +
"\t<acceptAckCode code=\"AL\"/>\n" +
"\t<receiver typeCode=\"RCV\">\n" +
"\t\t<telecom/>\n" +
"\t\t<device classCode=\"DEV\" determinerCode=\"INSTANCE\">\n" +
"\t\t\t<id>\n" +
"\t\t\t\t<item root=\"2.16.156.10011.0.1.1\" extension=\"Orion-001\"/>\n" +
"\t\t\t</id>\n" +
"\t\t</device>\n" +
"\t</receiver>\n" +
"\t<sender typeCode=\"SND\">\n" +
"\t\t<telecom/>\n" +
"\t\t<device classCode=\"DEV\" determinerCode=\"INSTANCE\">\n" +
"\t\t\t<id>\n" +
"\t\t\t\t<item root=\"2.16.156.10011.0.1.2\" extension=\"\"/>\n" +
"\t\t\t</id>\n" +
"\t\t</device>\n" +
"\t</sender>\n" +
"\t<acknowledgement typeCode=\"AA\">\n" +
"\t\t<targetMessage>\n" +
"\t\t\t<id root=\"2.16.156.10011.0\" extension=\"22a0f9e0-4454-11dc-a6be-3603d6866807\"/>\n" +
"\t\t</targetMessage>\n" +
"\t\t<acknowledgementDetail>\n" +
"\t\t\t<text value=\"处理结果说明\"/>\n" +
"\t\t</acknowledgementDetail>\n" +
"\t</acknowledgement>\n" +
"\t<controlActProcess classCode=\"CACT\" moodCode=\"EVN\">\n" +
"\t\t<subject typeCode=\"SUBJ\">\n" +
"\t\t\t<!-- 交叉索引信息 -->\n" +
"\t\t\t<empiIndex>\n" +
"\t\t\t\t<patientIds>\n" +
"\t\t\t\t\t<!--patientId节点循环有多个-->\n" +
"\t\t\t\t</patientIds>\n" +
"\t\t\t\t<idCards>\n" +
"\t\t\t\t\t<!-- type卡类型 value卡号 name患者姓名-->\n" +
"\t\t\t\t\t<idCard type=\"居民身份证\" value=\"xxx\" name=\"xxx\"/>\n" +
"\t\t\t\t</idCards>\n" +
"\t\t\t</empiIndex>\n" +
"\t\t</subject>\n" +
"\t</controlActProcess>\n" +
"</PRPA_HIP1179>\n";
}
}

@ -1,72 +0,0 @@
package com.docus.server.ws.impl;
import com.docus.server.ws.IWebserviceServer;
import com.docus.server.ws.WsCollect;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Slf4j
@Service
public class WebserviceServer implements IWebserviceServer {
@Resource
private WsCollect wsCollect;
@Override
public String receiveHandNumbness(String handNumbness) {
return wsCollect.receiveHandNumbness(handNumbness);
}
@Override
public String receiveDept(String deptXml) {
return wsCollect.receiveDept(deptXml);
}
@Override
public String deptModify(String deptXml) {
return wsCollect.deptModify(deptXml);
}
@Override
public String setTBasic(String str) {
return null;
}
@Override
public String updateTBasic(String str) {
return null;
}
@Override
public String userModify(String receiveUser) {
return null;
}
@Override
public String pushICUReport(String icuReportMessage) {
return null;
}
@Override
public String pushAddInspectionReport(String inspectionReportMessage) {
return null;
}
@Override
public String pushUpdateInspectionReport(String inspectionReportMessage) {
return null;
}
@Override
public String querySdJxIndexTest(String xml) {
return null;
}
@Override
public String querySdJxIndexNoResultTest(String xml) {
return null;
}
}

@ -2,6 +2,8 @@ package com.docus.server.record.pojo.dto;
import lombok.Data;
import java.util.Map;
/**
* @BelongsProject: docus-webservice-sdry
* @BelongsPackage: com.docus.server.collection.webservice
@ -38,4 +40,9 @@ public class TBasicDTO {
private String wardCode;
private String wardName;
private String sdryIndex;
/**
*
*/
private Map<String, Object> params;
}

@ -12,7 +12,7 @@ public interface ITBasicService {
* @param dto
* @throws Exception
*/
void addTBasic(TBasicDTO dto) throws Exception;
void insertTBasic(TBasicDTO dto) throws Exception;
/**
*

@ -28,7 +28,7 @@ public class TBasicServiceImpl extends ServiceImpl<TBasicMapper, TBasic> impleme
@Override
@Transactional(rollbackFor = Exception.class)
public void addTBasic(TBasicDTO tBasicDTO) {
public void insertTBasic(TBasicDTO tBasicDTO) {
//判断jzh是否重复
Integer num = tBasicMapper.selectOne(tBasicDTO.getJzh());
if (num > 0) {
@ -116,7 +116,7 @@ public class TBasicServiceImpl extends ServiceImpl<TBasicMapper, TBasic> impleme
//判断jzh是否存在
String patientId = tBasicMapper.getPatientId(tBasicDTO.getJzh());
if (Func.isEmpty(patientId)) {
addTBasic(tBasicDTO);
insertTBasic(tBasicDTO);
return;
}

@ -2,7 +2,6 @@ package com.docus.server.sys.common.pojo.dto;
import lombok.Data;
import java.util.HashMap;
import java.util.Map;
/**
@ -11,10 +10,25 @@ import java.util.Map;
*/
@Data
public class DeptDTO {
/**
*
*/
private String deptCode;
/**
*
*/
private String deptName;
/**
* id-
*/
private String messageId;
/**
*
*/
private String message;
/**
*
*/
@ -26,31 +40,21 @@ public class DeptDTO {
private String operateType;
/**
*
*/
private String deptCode;
/**
*
* ID
*/
private String deptName;
private String authorId;
/**
*
*/
private String authorName;
/**
* ID
* xml
*/
private String authorId;
private String source;
/**
*
*
*/
private String errorMsg;
private Map<String, Object> params;
/**
*
@ -66,33 +70,5 @@ public class DeptDTO {
return deptModifyParam;
}
/**
*
*/
public Param addParam(String key, Object obj) {
return new Param(key, obj);
}
public Map<String, Object> param(String key, Object obj) {
return new Param(key, obj).param();
}
protected static final class Param {
private Map<String, Object> params = new HashMap<String, Object>();
public Param(String key, Object value) {
addParam(key, value);
}
public Param addParam(String key, Object value) {
this.params.put(key, value);
return this;
}
public Map<String, Object> param() {
return this.params;
}
}
}

@ -2,6 +2,8 @@ package com.docus.server.sys.common.pojo.dto;
import lombok.Data;
import java.util.Map;
/**
* @author Fang Ruichuan
* @date 2022-11-14 19:02
@ -53,7 +55,10 @@ public class UserDTO {
* ID
*/
private String authorId;
/**
*
*/
private Map<String, Object> params;
/**
*

@ -9,6 +9,7 @@ import com.docus.server.sys.common.pojo.entity.PowerDept;
import com.docus.server.sys.mapper.PowerDeptMapper;
import com.docus.server.sys.service.IPowerDeptService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
@ -28,6 +29,7 @@ public class PowerDeptServiceImpl extends ServiceImpl<PowerDeptMapper, PowerDept
deptDTOList.forEach(this::saveOrUpdatePowerDept);
}
@Transactional
@Override
public boolean saveOrUpdatePowerDept(DeptDTO deptDTO) {
PowerDept powerDept = baseMapper.getDeptByDeptCode(deptDTO.getDeptCode());
@ -43,6 +45,7 @@ public class PowerDeptServiceImpl extends ServiceImpl<PowerDeptMapper, PowerDept
return true;
}
@Transactional
@Override
public boolean delDeptByDeptCode(String deptCode) {
PowerDept powerDept = baseMapper.getDeptByDeptCode(deptCode);

Loading…
Cancel
Save