顺德人医科室接收,webservice
parent
2e846b93a2
commit
8e411b2ded
@ -0,0 +1,39 @@
|
|||||||
|
package com.docus.server.collection.dto;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wen yongbin
|
||||||
|
* @date 2023年2月26日00:21:00
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class DeptModifyParam {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 科室主键id
|
||||||
|
*/
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 科室代码
|
||||||
|
*/
|
||||||
|
private String deptCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 科室名称
|
||||||
|
*/
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作人名称
|
||||||
|
*/
|
||||||
|
private String authorName;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作人ID
|
||||||
|
*/
|
||||||
|
private String authorId;
|
||||||
|
}
|
@ -0,0 +1,65 @@
|
|||||||
|
package com.docus.server.collection.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 科室
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author jiashi
|
||||||
|
* @since 2021-04-15
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@ApiModel(value = "PowerDept对象", description = "科室")
|
||||||
|
public class PowerDept implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "科室id")
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "科室代码")
|
||||||
|
private String deptCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "科室名称")
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "字典id")
|
||||||
|
private Integer dictId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否有效")
|
||||||
|
private Integer effective;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
private Date createDate;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建人")
|
||||||
|
private String creater;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "更新时间")
|
||||||
|
private Date updateDate;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "更新人")
|
||||||
|
private String updater;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "临床科室排序")
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "0:非临床科室,1:临床科室")
|
||||||
|
private Integer type;
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
package com.docus.server.collection.mapper;
|
||||||
|
|
||||||
|
import com.docus.server.collection.dto.DeptModifyParam;
|
||||||
|
import com.docus.server.collection.dto.UserModifyParam;
|
||||||
|
import com.docus.server.collection.entity.PowerDept;
|
||||||
|
import com.docus.server.collection.entity.PowerUser;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 科室表 mapper
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author wen yongbin
|
||||||
|
* @since 2023年2月25日22:28:58
|
||||||
|
*/
|
||||||
|
public interface PowerDeptMapper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据科室编码查询科室信息
|
||||||
|
* @param deptCode 科室编码
|
||||||
|
* @return 科室信息
|
||||||
|
*/
|
||||||
|
PowerDept getDeptByDeptCode(@Param("deptCode") String deptCode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新用户信息
|
||||||
|
* @param deptModifyParam 科室操作参数
|
||||||
|
* @return 数据库更新信息
|
||||||
|
*/
|
||||||
|
int updateDept(@Param("dept") DeptModifyParam deptModifyParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加新科室
|
||||||
|
* @param deptModifyParam 科室操作参数
|
||||||
|
* @return 数据库添加信息
|
||||||
|
*/
|
||||||
|
int addDept(@Param("dept") DeptModifyParam deptModifyParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据科室编码删除科室信息
|
||||||
|
* @param deptCode 科室编码
|
||||||
|
* @return 数据库删除信息
|
||||||
|
*/
|
||||||
|
int delDeptByDeptCode(@Param("deptCode") String deptCode);
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
package com.docus.server.collection.service;
|
||||||
|
|
||||||
|
import com.docus.server.collection.dto.DeptDto;
|
||||||
|
import com.docus.server.collection.dto.UserDto;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户服务
|
||||||
|
*/
|
||||||
|
public interface IPowerDeptService {
|
||||||
|
/**
|
||||||
|
* 科室注册
|
||||||
|
*
|
||||||
|
* @param deptDto 用户注册参数
|
||||||
|
* @return 处理结果
|
||||||
|
*/
|
||||||
|
boolean register(DeptDto deptDto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据科室编号删除科室
|
||||||
|
*
|
||||||
|
* @param deptCode 科室编码
|
||||||
|
* @return 删除结果
|
||||||
|
*/
|
||||||
|
boolean delDeptByDeptCode(String deptCode);
|
||||||
|
}
|
@ -0,0 +1,53 @@
|
|||||||
|
package com.docus.server.collection.service.impl;
|
||||||
|
|
||||||
|
import com.docus.core.util.Func;
|
||||||
|
import com.docus.infrastructure.redis.service.IdService;
|
||||||
|
import com.docus.server.collection.config.UserSyncConfig;
|
||||||
|
import com.docus.server.collection.dto.DeptDto;
|
||||||
|
import com.docus.server.collection.dto.DeptModifyParam;
|
||||||
|
import com.docus.server.collection.dto.UserModifyParam;
|
||||||
|
import com.docus.server.collection.entity.PowerDept;
|
||||||
|
import com.docus.server.collection.entity.PowerUser;
|
||||||
|
import com.docus.server.collection.mapper.PowerDeptMapper;
|
||||||
|
import com.docus.server.collection.service.IPowerDeptService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 科室服务实现
|
||||||
|
*
|
||||||
|
* @author wyb
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class PowerDeptServiceImpl implements IPowerDeptService {
|
||||||
|
@Resource
|
||||||
|
private PowerDeptMapper powerDeptMapper;
|
||||||
|
@Resource
|
||||||
|
private IdService idService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean register(DeptDto deptDto) {
|
||||||
|
PowerDept powerDept = powerDeptMapper.getDeptByDeptCode(deptDto.getDeptCode());
|
||||||
|
DeptModifyParam deptModifyParam = deptDto.transDeptAddParam();
|
||||||
|
if (Func.isEmpty(powerDept)) {
|
||||||
|
long deptId = idService.getDateSeq();
|
||||||
|
deptModifyParam.setDeptId(deptId);
|
||||||
|
powerDeptMapper.addDept(deptModifyParam);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
deptModifyParam.setDeptId(powerDept.getDeptId());
|
||||||
|
powerDeptMapper.updateDept(deptModifyParam);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean delDeptByDeptCode(String deptCode) {
|
||||||
|
PowerDept powerDept = powerDeptMapper.getDeptByDeptCode(deptCode);
|
||||||
|
if (Func.isEmpty(powerDept)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
powerDeptMapper.delDeptByDeptCode(deptCode);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,187 @@
|
|||||||
|
package com.docus.server.collection.webservice.impl;
|
||||||
|
|
||||||
|
import com.docus.core.util.DateUtil;
|
||||||
|
import com.docus.core.util.Func;
|
||||||
|
import com.docus.infrastructure.core.exception.BaseException;
|
||||||
|
import com.docus.server.collection.dto.DeptDto;
|
||||||
|
import com.docus.server.collection.service.IPowerDeptService;
|
||||||
|
import com.docus.server.collection.util.IdUtil;
|
||||||
|
import com.docus.server.collection.util.XmlUtil;
|
||||||
|
import com.docus.server.collection.webservice.IDeptServer;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.w3c.dom.Node;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.jws.WebService;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wen yongbin
|
||||||
|
* @date 2023年2月25日21:56:33
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@WebService
|
||||||
|
@Slf4j
|
||||||
|
public class DeptServerImpl implements IDeptServer {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
IPowerDeptService powerDeptService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String deptModify(String receiveUser) {
|
||||||
|
log.info("新增/修改科室数据:{}", receiveUser);
|
||||||
|
boolean registerResult = false;
|
||||||
|
DeptDto deptDto;
|
||||||
|
String msgId = "";
|
||||||
|
String receiver = "";
|
||||||
|
try {
|
||||||
|
deptDto = strToDeptDto(receiveUser);
|
||||||
|
msgId = deptDto.getMessageId();
|
||||||
|
receiver = deptDto.getReceiver();
|
||||||
|
} catch (BaseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
return failedMessage(e.getMessage(), msgId, receiver);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
return failedMessage("消息解析失败!", msgId, receiver);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
String operateType = deptDto.getOperateType();
|
||||||
|
String delType = "D";
|
||||||
|
// 判断操作类型
|
||||||
|
if (Func.isNotEmpty(operateType) && operateType.contains(delType)) {
|
||||||
|
registerResult = powerDeptService.delDeptByDeptCode(deptDto.getDeptCode());
|
||||||
|
} else {
|
||||||
|
registerResult = powerDeptService.register(deptDto);
|
||||||
|
}
|
||||||
|
} catch (BaseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
return failedMessage(e.getMessage(), msgId, receiver);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (registerResult) {
|
||||||
|
return successMessage("操作成功!", msgId, receiver);
|
||||||
|
}
|
||||||
|
return failedMessage("系统出错啦!", msgId, receiver);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接收科室参数解析 DeptDto 参数
|
||||||
|
*
|
||||||
|
* @param receiveUser 接收到的科室参数
|
||||||
|
* @return UserDto
|
||||||
|
*/
|
||||||
|
public DeptDto strToDeptDto(String receiveUser) {
|
||||||
|
DeptDto deptDto = new DeptDto();
|
||||||
|
XmlUtil xmlParseUtil = XmlUtil.of(receiveUser);
|
||||||
|
Node msgIdNode = xmlParseUtil.getNode("/PRVS_IN000002UV01/id/@extension");
|
||||||
|
deptDto.setMessageId(msgIdNode.getNodeValue());
|
||||||
|
Node receiverNode = xmlParseUtil.getNode("/PRVS_IN000002UV01/receiver/device/id/item/@extension");
|
||||||
|
deptDto.setReceiver(receiverNode.getNodeValue());
|
||||||
|
Node operateTypeNode = xmlParseUtil.getNode("/PRVS_IN000002UV01/controlActProcess/subject/registrationRequest/subject1/valueSet/valueSetItems/@operateType");
|
||||||
|
deptDto.setOperateType(operateTypeNode.getNodeValue());
|
||||||
|
Node deptCodeNode = xmlParseUtil.getNode("/PRVS_IN000002UV01/controlActProcess/subject/registrationRequest/subject1/valueSet/valueSetItems/DEPT_CODE/@value");
|
||||||
|
deptDto.setDeptCode(deptCodeNode.getNodeValue());
|
||||||
|
Node deptNameNode = xmlParseUtil.getNode("/PRVS_IN000002UV01/controlActProcess/subject/registrationRequest/subject1/valueSet/valueSetItems/DEPT_NAME/@value");
|
||||||
|
deptDto.setDeptName(deptNameNode.getNodeValue());
|
||||||
|
Node authorIdNode = xmlParseUtil.getNode("/PRVS_IN000002UV01/controlActProcess/subject/registrationRequest/author/assignedEntity/id/item/@extension");
|
||||||
|
deptDto.setAuthorId(authorIdNode.getNodeValue());
|
||||||
|
Node authorNameNode = xmlParseUtil.getNode("/PRVS_IN000002UV01/controlActProcess/subject/registrationRequest/author/assignedEntity/assignedPerson/name/item/part/@value");
|
||||||
|
deptDto.setAuthorName(authorNameNode.getNodeValue());
|
||||||
|
return deptDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param message 成功消息提示
|
||||||
|
* @param msgId 消息id
|
||||||
|
* @param receiver 接收方
|
||||||
|
* @return 成功消息
|
||||||
|
*/
|
||||||
|
private String successMessage(String message, String msgId, String receiver) {
|
||||||
|
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=\""+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=\""+msgId+"\"/>\n" +
|
||||||
|
"\t\t</targetMessage>\n" +
|
||||||
|
"\t\t<acknowledgementDetail>\n" +
|
||||||
|
"\t\t\t<text value=\""+message+"\"/>\n" +
|
||||||
|
"\t\t</acknowledgementDetail>\n" +
|
||||||
|
"\t</acknowledgement>\n" +
|
||||||
|
"</MCCI_IN000002UV01>";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param message 失败消息提示
|
||||||
|
* @param msgId 消息id
|
||||||
|
* @param receiver 接收方
|
||||||
|
* @return 失败消息
|
||||||
|
*/
|
||||||
|
private String failedMessage(String message, String msgId, String receiver) {
|
||||||
|
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=\""+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=\""+msgId+"\"/>\n" +
|
||||||
|
"\t\t</targetMessage>\n" +
|
||||||
|
"\t\t<acknowledgementDetail>\n" +
|
||||||
|
"\t\t\t<text value=\""+message+"\"/>\n" +
|
||||||
|
"\t\t</acknowledgementDetail>\n" +
|
||||||
|
"\t</acknowledgement>\n" +
|
||||||
|
"</RCMR_IN000030UV01>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.docus.server.collection.mapper.PowerDeptMapper">
|
||||||
|
<insert id="addDept">
|
||||||
|
INSERT INTO `docus_system`.`power_dept`(`dept_id`,
|
||||||
|
`dept_code`,
|
||||||
|
`dept_name`,
|
||||||
|
`create_date`,
|
||||||
|
`creater`,
|
||||||
|
`update_date`,
|
||||||
|
`updater`)
|
||||||
|
VALUES (#{dept.deptId},#{dept.deptCode},#{dept.deptName},now(),#{dept.authorName},now(),#{dept.authorName})
|
||||||
|
</insert>
|
||||||
|
<update id="updateDept">
|
||||||
|
update `docus_system`.`power_dept` set
|
||||||
|
`dept_name`=#{dept.deptName},
|
||||||
|
`updater`=#{dept.authorName},
|
||||||
|
`update_date`=now()
|
||||||
|
where `dept_code`=#{dept.deptCode}
|
||||||
|
</update>
|
||||||
|
<delete id="delDeptByDeptCode">
|
||||||
|
delete from `docus_system`.`power_dept` where `dept_code` = #{deptCode}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<select id="getDeptByDeptCode" resultType="com.docus.server.collection.entity.PowerDept">
|
||||||
|
SELECT `dept_id`,`dept_code`,`dept_name` FROM `docus_system`.`power_dept`
|
||||||
|
WHERE `dept_code` = #{deptCode} LIMIT 1
|
||||||
|
</select>
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue