ws的user,dept,basic拆分实现
parent
f97417812d
commit
c895a92a5d
@ -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";
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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,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,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,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 2023年2月25日21: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 2023年2月25日21: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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue