From b62db8c7d27b0236cb20d2269a629340506d9290 Mon Sep 17 00:00:00 2001 From: wyb <1977763549@qq.com> Date: Mon, 27 May 2024 09:15:03 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=9F=BA=E7=A1=80=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E6=9C=8D=E5=8A=A1=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=EF=BC=9B=E5=BC=80=E5=8F=91=E8=82=87=E5=BA=86=E7=AC=AC=E4=B8=80?= =?UTF-8?q?=E4=BA=BA=E5=8C=BB=E7=94=A8=E6=88=B7=EF=BC=8C=E7=A7=91=E5=AE=A4?= =?UTF-8?q?=EF=BC=8C=E6=82=A3=E8=80=85=E5=9F=BA=E7=A1=80=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/docus/server/AppRunBootstrap.java | 83 ++ .../java/com/docus/server/XxlJobConfig.java | 87 ++ .../archive/config/DocusServerUrlConfig.java | 22 + .../server/archive/entity/PowerDept.java | 62 ++ .../server/archive/entity/PowerUser.java | 116 +++ .../docus/server/archive/entity/TBasic.java | 116 +++ .../archive/mapper/PowerDeptMapper.java | 21 + .../archive/mapper/PowerUserMapper.java | 27 + .../server/archive/mapper/TBasicMapper.java | 24 + .../archive/rpc/DownPlatformService.java | 22 + .../archive/rpc/TaskDistributeService.java | 24 + .../archive/rpc/dto/PatientInfoDTO.java | 37 + .../server/archive/rpc/dto/ReportDownDto.java | 30 + .../archive/rpc/dto/ReportDownPatientDto.java | 19 + .../rpc/dto/ReportDownScanFileDto.java | 32 + .../archive/rpc/dto/ReportDownTwoDto.java | 29 + .../server/archive/rpc/dto/ReportDto.java | 97 ++ .../archive/rpc/dto/ReportHospitalTwoDto.java | 27 + .../archive/rpc/dto/ReportPatientTwoDto.java | 18 + .../archive/rpc/dto/ReportTaskTwoDto.java | 19 + .../rpc/impl/DownPlatformServiceImpl.java | 51 ++ .../rpc/impl/TaskDistributeServiceImpl.java | 48 + .../archive/rpc/vo/SdRyBloodReportVO.java | 27 + .../service/PatientInfoSyncService.java | 29 + .../ZqDyRyPatientInfoSyncServiceImpl.java | 133 +++ .../archive/utils/JaxWsDynamicClientUtil.java | 69 ++ .../server/archive/utils/PinYinUtil.java | 101 +++ .../docus/server/archive/utils/XmlUtil.java | 857 ++++++++++++++++++ src/main/resources/bin/install.bat | 33 + src/main/resources/bin/start.bat | 21 + src/main/resources/bin/stop.bat | 13 + src/main/resources/bin/update.bat | 19 + src/main/resources/bin/winsw.xml | 8 + src/main/resources/bootstrap.yml | 111 +++ src/main/resources/log4jdbc.log4j2.properties | 2 + src/main/resources/logback.xml | 77 ++ src/main/resources/mapper/PowerDeptMapper.xml | 44 + src/main/resources/mapper/PowerUser.xml | 57 ++ src/main/resources/mapper/TBasicMapper.xml | 58 ++ 39 files changed, 2670 insertions(+) create mode 100644 src/main/java/com/docus/server/AppRunBootstrap.java create mode 100644 src/main/java/com/docus/server/XxlJobConfig.java create mode 100644 src/main/java/com/docus/server/archive/config/DocusServerUrlConfig.java create mode 100644 src/main/java/com/docus/server/archive/entity/PowerDept.java create mode 100644 src/main/java/com/docus/server/archive/entity/PowerUser.java create mode 100644 src/main/java/com/docus/server/archive/entity/TBasic.java create mode 100644 src/main/java/com/docus/server/archive/mapper/PowerDeptMapper.java create mode 100644 src/main/java/com/docus/server/archive/mapper/PowerUserMapper.java create mode 100644 src/main/java/com/docus/server/archive/mapper/TBasicMapper.java create mode 100644 src/main/java/com/docus/server/archive/rpc/DownPlatformService.java create mode 100644 src/main/java/com/docus/server/archive/rpc/TaskDistributeService.java create mode 100644 src/main/java/com/docus/server/archive/rpc/dto/PatientInfoDTO.java create mode 100644 src/main/java/com/docus/server/archive/rpc/dto/ReportDownDto.java create mode 100644 src/main/java/com/docus/server/archive/rpc/dto/ReportDownPatientDto.java create mode 100644 src/main/java/com/docus/server/archive/rpc/dto/ReportDownScanFileDto.java create mode 100644 src/main/java/com/docus/server/archive/rpc/dto/ReportDownTwoDto.java create mode 100644 src/main/java/com/docus/server/archive/rpc/dto/ReportDto.java create mode 100644 src/main/java/com/docus/server/archive/rpc/dto/ReportHospitalTwoDto.java create mode 100644 src/main/java/com/docus/server/archive/rpc/dto/ReportPatientTwoDto.java create mode 100644 src/main/java/com/docus/server/archive/rpc/dto/ReportTaskTwoDto.java create mode 100644 src/main/java/com/docus/server/archive/rpc/impl/DownPlatformServiceImpl.java create mode 100644 src/main/java/com/docus/server/archive/rpc/impl/TaskDistributeServiceImpl.java create mode 100644 src/main/java/com/docus/server/archive/rpc/vo/SdRyBloodReportVO.java create mode 100644 src/main/java/com/docus/server/archive/service/PatientInfoSyncService.java create mode 100644 src/main/java/com/docus/server/archive/service/impl/ZqDyRyPatientInfoSyncServiceImpl.java create mode 100644 src/main/java/com/docus/server/archive/utils/JaxWsDynamicClientUtil.java create mode 100644 src/main/java/com/docus/server/archive/utils/PinYinUtil.java create mode 100644 src/main/java/com/docus/server/archive/utils/XmlUtil.java create mode 100644 src/main/resources/bin/install.bat create mode 100644 src/main/resources/bin/start.bat create mode 100644 src/main/resources/bin/stop.bat create mode 100644 src/main/resources/bin/update.bat create mode 100644 src/main/resources/bin/winsw.xml create mode 100644 src/main/resources/bootstrap.yml create mode 100644 src/main/resources/log4jdbc.log4j2.properties create mode 100644 src/main/resources/logback.xml create mode 100644 src/main/resources/mapper/PowerDeptMapper.xml create mode 100644 src/main/resources/mapper/PowerUser.xml create mode 100644 src/main/resources/mapper/TBasicMapper.xml diff --git a/src/main/java/com/docus/server/AppRunBootstrap.java b/src/main/java/com/docus/server/AppRunBootstrap.java new file mode 100644 index 0000000..48c1270 --- /dev/null +++ b/src/main/java/com/docus/server/AppRunBootstrap.java @@ -0,0 +1,83 @@ +package com.docus.server; + + +import cn.hutool.extra.spring.SpringUtil; +import com.docus.server.archive.entity.TBasic; +import com.docus.server.archive.mapper.TBasicMapper; +import com.docus.server.archive.utils.PinYinUtil; +import lombok.extern.slf4j.Slf4j; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.beans.BeanUtils; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.openfeign.EnableFeignClients; + +import java.util.Arrays; +import java.util.Date; +import java.util.Properties; + + +/** + * @author wyb + */ +@Slf4j +@SpringBootApplication(scanBasePackages ={"com.docus"}) +@MapperScan("com.docus.server.**.mapper") +@EnableFeignClients(basePackages = {"com.docus"}) +public class AppRunBootstrap { + public static void main(String[] args) { + Properties props = System.getProperties(); + props.setProperty("org.apache.cxf.stax.allowInsecureParser", "1"); + props.setProperty("UseSunHttpHandler", "true"); + System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl"); + + SpringApplication.run(AppRunBootstrap.class, args); + } + + static void testMysql(){ + TBasicMapper mapper = SpringUtil.getBean(TBasicMapper.class); + long currentTimeMillis = System.currentTimeMillis(); + TBasic tBasic1 = new TBasic(); + tBasic1.setPatientId("FS-TEST-1"); + tBasic1.setJzh("jzh"+ currentTimeMillis); + tBasic1.setInpatientNo(currentTimeMillis +""); + tBasic1.setAdmissTimes(1); + tBasic1.setName("佛山测试1"); + tBasic1.setNameSpell(PinYinUtil.getFirstSpell("佛山测试1")); + tBasic1.setSex("1"); + tBasic1.setSexName("男"); + tBasic1.setAdmissDate(new Date()); + tBasic1.setAdmissDept("221"); + tBasic1.setAdmissDeptName("神经内科"); + tBasic1.setBedNo("神经内科1-1"); + tBasic1.setAttending("wyb"); + tBasic1.setAttendingName("文永斌"); + tBasic1.setAge(50); + tBasic1.setAgeMonth(12); + tBasic1.setAgeDay(3); + tBasic1.setIdCard("xxxxxx"); + tBasic1.setTelphone("666"); + tBasic1.setDisDate(new Date()); + tBasic1.setDisDept("221"); + tBasic1.setDisDeptName("神经内科"); + tBasic1.setTotalCost("28.8"); + tBasic1.setIsDead(0); + tBasic1.setJzCardNo("kh1998"); + tBasic1.setFileSource(1); + tBasic1.setCreateTime(new Date()); + tBasic1.setUpdateTime(new Date()); + TBasic tBasic2 = new TBasic(); + BeanUtils.copyProperties(tBasic1,tBasic2); + tBasic2.setPatientId("FS-TEST-2"); + tBasic2.setAdmissTimes(2); + tBasic2.setJzh("jzh"+(currentTimeMillis+555)); + mapper.insertBatch(Arrays.asList(tBasic1,tBasic2)); + System.out.println("插入后:"+mapper.getByJzh(Arrays.asList(tBasic1.getJzh(),tBasic2.getJzh()))); + tBasic1.setIdCard("modify-1"); + tBasic2.setIdCard("modify-2"); + mapper.updateBatch(Arrays.asList(tBasic1,tBasic2)); + + System.out.println("修改后:"+mapper.getByJzh(Arrays.asList(tBasic1.getJzh(),tBasic2.getJzh()))); + + } +} diff --git a/src/main/java/com/docus/server/XxlJobConfig.java b/src/main/java/com/docus/server/XxlJobConfig.java new file mode 100644 index 0000000..d9edbfa --- /dev/null +++ b/src/main/java/com/docus/server/XxlJobConfig.java @@ -0,0 +1,87 @@ +package com.docus.server; +import com.xxl.job.core.executor.impl.XxlJobSpringExecutor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * @ProjectName: + * @Description: + * @Param 传输参数 + * @Return + * @Author: 曾文和 + * @CreateDate: 2021/5/7 16:23 + * @UpdateUser: 曾文和 + * @UpdateDate: 2021/5/7 16:23 + * @UpdateRemark: 更新说明 + * @Version: 1.0 + */ + + + +@Configuration +public class XxlJobConfig { + private Logger logger = LoggerFactory.getLogger(XxlJobConfig.class); + + @Value("${xxl.job.admin.addresses}") + private String adminAddresses; + + @Value("${xxl.job.accessToken}") + private String accessToken; + + @Value("${xxl.job.executor.appname}") + private String appname; + + @Value("${xxl.job.executor.address}") + private String address; + + @Value("${xxl.job.executor.ip}") + private String ip; + + @Value("${xxl.job.executor.port}") + private int port; + + @Value("${xxl.job.executor.logpath}") + private String logPath; + + @Value("${xxl.job.executor.logretentiondays}") + private int logRetentionDays; + + + @Bean + public XxlJobSpringExecutor xxlJobExecutor() { + logger.info(">>>>>>>>>>> xxl-job config init."); + XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor(); + xxlJobSpringExecutor.setAdminAddresses(adminAddresses); + xxlJobSpringExecutor.setAppname(appname); + xxlJobSpringExecutor.setAddress(address); + xxlJobSpringExecutor.setIp(ip); + xxlJobSpringExecutor.setPort(port); + xxlJobSpringExecutor.setAccessToken(accessToken); + xxlJobSpringExecutor.setLogPath(logPath); + xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays); + + return xxlJobSpringExecutor; + } + + /** + * 针对多网卡、容器内部署等情况,可借助 "spring-cloud-commons" 提供的 "InetUtils" 组件灵活定制注册IP; + * + * 1、引入依赖: + * + * org.springframework.cloud + * spring-cloud-commons + * ${version} + * + * + * 2、配置文件,或者容器启动变量 + * spring.cloud.inetutils.preferred-networks: 'xxx.xxx.xxx.' + * + * 3、获取IP + * String ip_ = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress(); + *//* + +*/ +} diff --git a/src/main/java/com/docus/server/archive/config/DocusServerUrlConfig.java b/src/main/java/com/docus/server/archive/config/DocusServerUrlConfig.java new file mode 100644 index 0000000..f427c38 --- /dev/null +++ b/src/main/java/com/docus/server/archive/config/DocusServerUrlConfig.java @@ -0,0 +1,22 @@ +package com.docus.server.archive.config; + +import lombok.Data; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +/** + * @author YongBin Wen + * @date 2024/3/29 14:00 + */ +@Component +@Data +public class DocusServerUrlConfig { + @Value("${docus.url.viewcollect-server}") + private String viewCollectServerUrl; + + @Value("${docus.url.downploadlatform-server}") + private String downloadPlatformServerUrl; + + @Value("${docus.url.taskdistribute-server}") + private String taskDistributeServerUrl; +} diff --git a/src/main/java/com/docus/server/archive/entity/PowerDept.java b/src/main/java/com/docus/server/archive/entity/PowerDept.java new file mode 100644 index 0000000..0f5dd4f --- /dev/null +++ b/src/main/java/com/docus/server/archive/entity/PowerDept.java @@ -0,0 +1,62 @@ +package com.docus.server.archive.entity; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 科室 + *

+ * + * @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; + +} diff --git a/src/main/java/com/docus/server/archive/entity/PowerUser.java b/src/main/java/com/docus/server/archive/entity/PowerUser.java new file mode 100644 index 0000000..21fcc70 --- /dev/null +++ b/src/main/java/com/docus/server/archive/entity/PowerUser.java @@ -0,0 +1,116 @@ +package com.docus.server.archive.entity; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 用户表 + *

+ * + * @author jiashi + * @since 2021-04-14 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@ApiModel(value = "PowerUser对象", description = "用户表") +public class PowerUser implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "用户id") + private Long userId; + + @ApiModelProperty(value = "登陆名") + private String userName; + + @ApiModelProperty(value = "用户密码") + private String userPwd; + + @ApiModelProperty(value = "密码修改(0:未修改,1:已修改)") + private Integer pwdChange; + + @ApiModelProperty(value = "性别 0 男 1 女") + private Integer userSex; + + @ApiModelProperty(value = "年龄") + private Integer userAge; + + @ApiModelProperty(value = "电话") + private String userTel; + + @ApiModelProperty(value = "邮箱") + private String userEmail; + + @ApiModelProperty(value = "微信信息") + private String wxBank; + + @ApiModelProperty(value = "职位") + private String userPosition; + + @ApiModelProperty(value = "角色") + private Long roleId; + + @ApiModelProperty(value = "部门id") + private String deptId; + + + @ApiModelProperty("头像路径") + private String userHead; + + @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 = "登录标志 默认为0为未登录 1登录") + private Integer loginFlag; + + @ApiModelProperty(value = "用户名称") + private String name; + + @ApiModelProperty(value = "权限科室 拥有对科室查阅权限") + private String powerDept; + + @ApiModelProperty(value = "权限 拥有对主管医生查阅权限") + private String powerAttending; + + @ApiModelProperty(value = "助记词") + private String mnemonicWords; + + + @ApiModelProperty("是否可用") + private Integer enabled; + + + @ApiModelProperty("账号状态 0:正常 1:锁定 2:冻结") + private Integer accountState; + + @ApiModelProperty("其他角色选择") + private String attRoleId; + + + @ApiModelProperty("微信公众号openid") + private String openId; + + @ApiModelProperty("是否第三方账号 0否 1是") + private Integer isThird; +} diff --git a/src/main/java/com/docus/server/archive/entity/TBasic.java b/src/main/java/com/docus/server/archive/entity/TBasic.java new file mode 100644 index 0000000..d276c50 --- /dev/null +++ b/src/main/java/com/docus/server/archive/entity/TBasic.java @@ -0,0 +1,116 @@ +package com.docus.server.archive.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 病案基本信息 + *

+ * + * @author jiashi + * @since 2021-04-14 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@ApiModel(value = "TBasic对象", description = "病案基本信息") +public class TBasic implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "病案主键") + @TableId(value = "patient_id", type = IdType.ASSIGN_ID) + private String patientId; + + + @ApiModelProperty(value = "记账号") + private String jzh; + + @ApiModelProperty(value = "病案号") + private String inpatientNo; + + @ApiModelProperty(value = "住院次数") + private Integer admissTimes; + + @ApiModelProperty(value = "患者姓名") + private String name; + + @ApiModelProperty(value = "患者拼音首拼") + private String nameSpell; + + @ApiModelProperty(value = "性别代码") + private String sex; + + @ApiModelProperty(value = "性别名称") + private String sexName; + + @ApiModelProperty(value = "住院日期") + private Date admissDate; + + @ApiModelProperty(value = "住院科室") + private String admissDept; + + @ApiModelProperty(value = "住院科室名称") + private String admissDeptName; + + + @ApiModelProperty(value = "床号") + private String bedNo; + + @ApiModelProperty(value = "主管医生工号") + private String attending; + + @ApiModelProperty(value = "主管医生姓名") + private String attendingName; + + @ApiModelProperty(value = "年龄 岁") + private Integer age; + + @ApiModelProperty(value = "年龄 月") + private Integer ageMonth; + + @ApiModelProperty(value = "年龄 天") + private Integer ageDay; + + + @ApiModelProperty(value = "身份证") + private String idCard; + + @ApiModelProperty(value = "联系方式 手机号") + private String telphone; + + @ApiModelProperty(value = "出院日期") + private Date disDate; + + @ApiModelProperty(value = "出院科室") + private String disDept; + + @ApiModelProperty(value = "出院科室名称") + private String disDeptName; + + @ApiModelProperty(value = "患者本次住院总费用") + private String totalCost; + + @ApiModelProperty(value = "是否死亡 0 非死亡 1死亡") + private Integer isDead; + + @ApiModelProperty(value = "记账卡号") + private String jzCardNo; + + @ApiModelProperty(value = "创建时间") + private Date createTime; + + @ApiModelProperty(value = "修改时间") + private Date updateTime; + + @ApiModelProperty(value = "数据来源 1:需质控归档") + private Integer fileSource; + +} diff --git a/src/main/java/com/docus/server/archive/mapper/PowerDeptMapper.java b/src/main/java/com/docus/server/archive/mapper/PowerDeptMapper.java new file mode 100644 index 0000000..c24d461 --- /dev/null +++ b/src/main/java/com/docus/server/archive/mapper/PowerDeptMapper.java @@ -0,0 +1,21 @@ +package com.docus.server.archive.mapper; + + +import com.docus.server.archive.entity.PowerDept; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface PowerDeptMapper { + + + List list(); + + List findByDeptCodes(@Param("deptCodes") List deptCodes); + + int insertBatch(@Param("deptList") List deptList); + + int updateBatch(@Param("deptList")List powerDept); +} diff --git a/src/main/java/com/docus/server/archive/mapper/PowerUserMapper.java b/src/main/java/com/docus/server/archive/mapper/PowerUserMapper.java new file mode 100644 index 0000000..542a5bd --- /dev/null +++ b/src/main/java/com/docus/server/archive/mapper/PowerUserMapper.java @@ -0,0 +1,27 @@ +package com.docus.server.archive.mapper; + + +import com.docus.server.archive.entity.PowerUser; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface PowerUserMapper { + + + List list(); + + /** + * 根据用户工号查询用户信息 + * + * @param userNames 用户工号集合 + * @return 用户信息 + */ + List findByUserNames(@Param("userNames") List userNames); + + int insertBatch(@Param("userList") List userList); + + int updateBatch(@Param("userList") List userList); +} diff --git a/src/main/java/com/docus/server/archive/mapper/TBasicMapper.java b/src/main/java/com/docus/server/archive/mapper/TBasicMapper.java new file mode 100644 index 0000000..4b54005 --- /dev/null +++ b/src/main/java/com/docus/server/archive/mapper/TBasicMapper.java @@ -0,0 +1,24 @@ +package com.docus.server.archive.mapper; + + +import com.docus.server.archive.entity.TBasic; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface TBasicMapper { + + /** + * 根据记帐号查找基础数据 + * + * @param jzhList 记帐号 + * @return 基础数据 + */ + List getByJzh(@Param("jzhs") List jzhList); + + int insertBatch(@Param("basicList") List basicList); + + int updateBatch(@Param("basicList") List updateList); +} diff --git a/src/main/java/com/docus/server/archive/rpc/DownPlatformService.java b/src/main/java/com/docus/server/archive/rpc/DownPlatformService.java new file mode 100644 index 0000000..a87fabf --- /dev/null +++ b/src/main/java/com/docus/server/archive/rpc/DownPlatformService.java @@ -0,0 +1,22 @@ +package com.docus.server.archive.rpc; + +import com.docus.infrastructure.web.api.CommonResult; +import com.docus.server.archive.rpc.dto.ReportDownDto; + +/** + * 下载平台服务接口 + * + * @author jiashi + */ + +public interface DownPlatformService { + + + /** + * 下载服务文件上报 + * + * @param reportDownDto 下载服务上报参数 + * @return 结果 + */ + CommonResult report(ReportDownDto reportDownDto); +} diff --git a/src/main/java/com/docus/server/archive/rpc/TaskDistributeService.java b/src/main/java/com/docus/server/archive/rpc/TaskDistributeService.java new file mode 100644 index 0000000..a5f78cf --- /dev/null +++ b/src/main/java/com/docus/server/archive/rpc/TaskDistributeService.java @@ -0,0 +1,24 @@ +package com.docus.server.archive.rpc; + +import com.docus.infrastructure.web.api.CommonResult; +import com.docus.server.archive.rpc.dto.ReportDownTwoDto; + +/** + * 无视图任务服务 + * + * @author wyb + */ + +public interface TaskDistributeService { + + + /** + * 无视图-根据采集器类型获取任务信息 + * + * @param collectorId 采集器类型 + * @return 任务信息 + */ + CommonResult getNoViewTaskByCollectorId(String collectorId); + + CommonResult cancel(Long taskId); +} diff --git a/src/main/java/com/docus/server/archive/rpc/dto/PatientInfoDTO.java b/src/main/java/com/docus/server/archive/rpc/dto/PatientInfoDTO.java new file mode 100644 index 0000000..fb39a19 --- /dev/null +++ b/src/main/java/com/docus/server/archive/rpc/dto/PatientInfoDTO.java @@ -0,0 +1,37 @@ +package com.docus.server.archive.rpc.dto; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 患者基础信息 + * + * @author WYBDEV + */ +@Data +@JsonIgnoreProperties(ignoreUnknown = true) +@ApiModel(value = "患者信息") +public class PatientInfoDTO { + @ApiModelProperty(value = "病案主键") + private String patientId; + @ApiModelProperty(value = "住院号") + private String inpatientNo; + @ApiModelProperty(value = "住院次数") + private Integer admissTimes; + @ApiModelProperty(value = "入院日期 yyyy-MM-dd HH:mm:ss") + private String admissDate; + @ApiModelProperty(value = "入院科室名称") + private String admissDeptName; + @ApiModelProperty(value = "出院日期 yyyy-MM-dd HH:mm:ss") + private String disDate; + @ApiModelProperty(value = "出院科室名称") + private String disDeptName; + @ApiModelProperty(value = "记账号") + private String jzh; + @ApiModelProperty(value = "姓名") + private String name; + @ApiModelProperty(value = "住院id") + private String admissId; +} diff --git a/src/main/java/com/docus/server/archive/rpc/dto/ReportDownDto.java b/src/main/java/com/docus/server/archive/rpc/dto/ReportDownDto.java new file mode 100644 index 0000000..b2a390f --- /dev/null +++ b/src/main/java/com/docus/server/archive/rpc/dto/ReportDownDto.java @@ -0,0 +1,30 @@ +package com.docus.server.archive.rpc.dto; + + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +@Data +public class ReportDownDto { + @ApiModelProperty(value = "采集器id") + private String collectorid; + + @ApiModelProperty(value = "采集器ip") + private String ip; + + @ApiModelProperty(value = "分类id") + private String assortid; + + @ApiModelProperty(value = "患者信息") + private ReportDownPatientDto patient; + + @ApiModelProperty(value = "文件信息") + private List scanfiles; + + @ApiModelProperty(value = "扫描用户代码") + private String scanusercode; + @ApiModelProperty(value = "扫描用户名称") + private String scanusername; +} \ No newline at end of file diff --git a/src/main/java/com/docus/server/archive/rpc/dto/ReportDownPatientDto.java b/src/main/java/com/docus/server/archive/rpc/dto/ReportDownPatientDto.java new file mode 100644 index 0000000..acab171 --- /dev/null +++ b/src/main/java/com/docus/server/archive/rpc/dto/ReportDownPatientDto.java @@ -0,0 +1,19 @@ +package com.docus.server.archive.rpc.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class ReportDownPatientDto { + @ApiModelProperty(value = "记帐号") + private String jzh; + @ApiModelProperty(value = "住院次数,记帐号重复则加这个参数,无则Null") + private Integer admisstimes; + @ApiModelProperty(value = "病案主键,如有传则使用,无则使用jzh") + private String patientid; + @ApiModelProperty(value = "病案号") + private String inpatientno; + + @ApiModelProperty(value = "物理存储位置,有则传") + private String storagelocation; +} diff --git a/src/main/java/com/docus/server/archive/rpc/dto/ReportDownScanFileDto.java b/src/main/java/com/docus/server/archive/rpc/dto/ReportDownScanFileDto.java new file mode 100644 index 0000000..badffd9 --- /dev/null +++ b/src/main/java/com/docus/server/archive/rpc/dto/ReportDownScanFileDto.java @@ -0,0 +1,32 @@ +package com.docus.server.archive.rpc.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class ReportDownScanFileDto { + @ApiModelProperty(value = "任务id(如无效任务id,则不更新任务表数据)") + private Long taskid; + @ApiModelProperty(value = "文件标题") + private String filetitle; + @ApiModelProperty(value = "采集类型(文件来源 1:采集器;2:扫描生产软件)") + private int filesource; + @ApiModelProperty(value = "下载类型(1:服务器本地;2:ftp服务器;3:共享文件夹)") + private int filestoragetype; + @ApiModelProperty(value = "文件类型(1:url,2:base64,3:url base64,4:共享文件,5:本地文件base64)") + private int filetype=1; + @ApiModelProperty(value = "下载地址") + private String downurl; + // @ApiModelProperty(value = "档案信息") +// private String recordid; + @ApiModelProperty(value = "采集流水号") + private String serialnum; + + @ApiModelProperty(value = "排序日期") + private String sortdate; + + @ApiModelProperty(value = "是否作废 : 0:否 不作废,1:是 作废") + private int cancel=0; + + +} diff --git a/src/main/java/com/docus/server/archive/rpc/dto/ReportDownTwoDto.java b/src/main/java/com/docus/server/archive/rpc/dto/ReportDownTwoDto.java new file mode 100644 index 0000000..9e61e29 --- /dev/null +++ b/src/main/java/com/docus/server/archive/rpc/dto/ReportDownTwoDto.java @@ -0,0 +1,29 @@ +package com.docus.server.archive.rpc.dto; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +@Data +@JsonIgnoreProperties(ignoreUnknown = true) +public class ReportDownTwoDto { + @ApiModelProperty(value = "档案编号") + private String patientId; + @ApiModelProperty(value = "记账号") + private String jzh; + @ApiModelProperty(value = "档案类型") + private String recordType; + @ApiModelProperty(value = "档案时间") + private String createTime; + @ApiModelProperty(value = "患者信息") + private ReportPatientTwoDto patient =new ReportPatientTwoDto(); + @ApiModelProperty(value = "住院信息") + private List hospitals = new ArrayList<>(); + @ApiModelProperty(value = "任务信息") + private List tasks = new ArrayList<>(); + @ApiModelProperty(value = "母亲基础信息") + private PatientInfoDTO parent; +} diff --git a/src/main/java/com/docus/server/archive/rpc/dto/ReportDto.java b/src/main/java/com/docus/server/archive/rpc/dto/ReportDto.java new file mode 100644 index 0000000..0746218 --- /dev/null +++ b/src/main/java/com/docus/server/archive/rpc/dto/ReportDto.java @@ -0,0 +1,97 @@ +package com.docus.server.archive.rpc.dto; + + +import lombok.Data; + +/** + * 报告推送信息 + */ +@Data +public class ReportDto { + /** + * 住院号 + */ + private String inpatientNo; + /** + * 记账号/住院流水号 + */ + private String jzh; + /** + * 住院次数 + */ + private Integer admisstimes; + /** + * 采集来源系统 + */ + private String sysFlag; + /** + * 下载地址 + */ + private String downUrl; + /** + * 文件名 + */ + private String fileTitle; + /** + * 采集流水号/文件唯一id + */ + private String serialnum; + + /** + * 文件分类id + */ + private String assortId; + + /** + * 采集类型(文件来源 1:采集器;2:扫描生产软件) + */ + private String fileSource; + + /** + * 文件保存位置类型 1:服务器本地;2:ftp服务器;3:共享文件夹 + */ + private String filestoragetype; + + /** + * 下载对应任务id ,接收处理 + */ + private Long taskId; + + /** + * 业务病案主键 + */ + private String patientId; + + /** + * 下载路径类型 1:url,2:base64,3:url base64,4:共享文件,5:本地文件base64 + */ + private Integer downtype = 1; + + /** + * 患者本次就诊唯一键:患者id【12位】+就诊次 + * 数 + */ + private String visitSn; + + /** + * 患者id + */ + private String patientSn; + + + /** + * 检查报告单号,用于顺德人医推送 报告信息和报告地址的关联 + */ + private String reportSn; + + /** + * 如果多次上传是否合并文件标题 + */ + private boolean mergeFileTitle; + + + + public ReportDto() { + } + +} diff --git a/src/main/java/com/docus/server/archive/rpc/dto/ReportHospitalTwoDto.java b/src/main/java/com/docus/server/archive/rpc/dto/ReportHospitalTwoDto.java new file mode 100644 index 0000000..43f5871 --- /dev/null +++ b/src/main/java/com/docus/server/archive/rpc/dto/ReportHospitalTwoDto.java @@ -0,0 +1,27 @@ +package com.docus.server.archive.rpc.dto; + + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * + */ +@Data +public class ReportHospitalTwoDto { + + @ApiModelProperty(value = "患者id") + private String patientId; + @ApiModelProperty(value = "住院次数") + private Integer admissTimes; + @ApiModelProperty(value = "住院日期") + private String admissDate; + @ApiModelProperty(value = "出院日期") + private String disDate; + @ApiModelProperty(value = "出院科室名称") + private String disDeptName; + @ApiModelProperty(value = "出院科室名称") + private String admissDeptName; + @ApiModelProperty(value = "卡号") + private String admissId; +} diff --git a/src/main/java/com/docus/server/archive/rpc/dto/ReportPatientTwoDto.java b/src/main/java/com/docus/server/archive/rpc/dto/ReportPatientTwoDto.java new file mode 100644 index 0000000..708b1db --- /dev/null +++ b/src/main/java/com/docus/server/archive/rpc/dto/ReportPatientTwoDto.java @@ -0,0 +1,18 @@ +package com.docus.server.archive.rpc.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 上报打印 患者信息 + */ +@Data +public class ReportPatientTwoDto { + + @ApiModelProperty(value = "住院号/就诊号") + private String inpatientNo; + @ApiModelProperty(value = "患者姓名") + private String name; + @ApiModelProperty(value = "id号") + private String patientId; +} diff --git a/src/main/java/com/docus/server/archive/rpc/dto/ReportTaskTwoDto.java b/src/main/java/com/docus/server/archive/rpc/dto/ReportTaskTwoDto.java new file mode 100644 index 0000000..fa837fa --- /dev/null +++ b/src/main/java/com/docus/server/archive/rpc/dto/ReportTaskTwoDto.java @@ -0,0 +1,19 @@ +package com.docus.server.archive.rpc.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +/** + * + */ +@Data +public class ReportTaskTwoDto { + @ApiModelProperty(value = "采集器标识") + private String collectorId; + @ApiModelProperty(value = "任务id") + private Long taskId; + @ApiModelProperty(value = "患者id") + private String patientId; + +} diff --git a/src/main/java/com/docus/server/archive/rpc/impl/DownPlatformServiceImpl.java b/src/main/java/com/docus/server/archive/rpc/impl/DownPlatformServiceImpl.java new file mode 100644 index 0000000..d6ac2a8 --- /dev/null +++ b/src/main/java/com/docus/server/archive/rpc/impl/DownPlatformServiceImpl.java @@ -0,0 +1,51 @@ +package com.docus.server.archive.rpc.impl; + +import cn.hutool.http.HttpRequest; +import cn.hutool.http.HttpResponse; +import cn.hutool.http.HttpUtil; +import com.docus.core.util.Func; +import com.docus.infrastructure.web.api.CommonResult; +import com.docus.server.archive.config.DocusServerUrlConfig; +import com.docus.server.archive.rpc.DownPlatformService; +import com.docus.server.archive.rpc.dto.ReportDownDto; +import com.docus.server.archive.rpc.dto.ReportDownScanFileDto; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; + +/** + * 下载平台服务接口 + * + * @author jiashi + */ +@Component +@Slf4j +public class DownPlatformServiceImpl implements DownPlatformService { + + @Resource + private DocusServerUrlConfig serverUrlConfig; + + @Override + public CommonResult report(ReportDownDto reportDownDto) { + String downUrl = serverUrlConfig.getDownloadPlatformServerUrl() + "api/downplatform/report"; + String requestId = Func.randomUUID(); + String requestParam = Func.toJson(reportDownDto); + ReportDownScanFileDto report = reportDownDto.getScanfiles().get(0); + log.info("[{}]调用下载服务,地址:{} ,参数:taskid={}", requestId, downUrl, report.getTaskid()); + String respBody = post(downUrl, requestParam); + log.info("[{}]调用下载服务成功,响应参数:{}", requestId, respBody); + return Func.readJson(respBody, CommonResult.class); + } + + public String post(String url, String body) { + HttpRequest post = HttpUtil.createPost(url); + post.setConnectionTimeout(5 * 1000); + post.setReadTimeout(60 * 1000); + post.header("Content-Type", "application/json; charset=utf-8"); + post.body(body); + HttpResponse response = post.execute(); + return response.body(); + + } +} diff --git a/src/main/java/com/docus/server/archive/rpc/impl/TaskDistributeServiceImpl.java b/src/main/java/com/docus/server/archive/rpc/impl/TaskDistributeServiceImpl.java new file mode 100644 index 0000000..cfe851e --- /dev/null +++ b/src/main/java/com/docus/server/archive/rpc/impl/TaskDistributeServiceImpl.java @@ -0,0 +1,48 @@ +package com.docus.server.archive.rpc.impl; + +import cn.hutool.http.HttpUtil; +import com.docus.core.util.Func; +import com.docus.infrastructure.web.api.CommonResult; +import com.docus.server.archive.config.DocusServerUrlConfig; +import com.docus.server.archive.rpc.TaskDistributeService; +import com.docus.server.archive.rpc.dto.ReportDownTwoDto; +import com.fasterxml.jackson.core.type.TypeReference; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.Map; + +/** + * 无视图任务服务 + * + * @author wyb + */ +@Component +@Slf4j +public class TaskDistributeServiceImpl implements TaskDistributeService { + @Resource + private DocusServerUrlConfig serverUrlConfig; + + @Override + public CommonResult getNoViewTaskByCollectorId(String collectorId) { + String getTaskUrl = serverUrlConfig.getTaskDistributeServerUrl() + "api/noviewtask/GetTask?collectid=" + collectorId; + String result = HttpUtil.get(getTaskUrl); + return Func.readJson(result, new TypeReference>() { + }); + } + + + @Override + public CommonResult cancel(Long taskId) { + String taskCancelUrl = serverUrlConfig.getTaskDistributeServerUrl() + "api/collector/task/cancel"; + Map param = new HashMap<>(1); + param.put("taskId", taskId); + log.info("任务作废 地址{},参数:{}", taskCancelUrl, param); + String resp = HttpUtil.post(taskCancelUrl, Func.toJson(param)); + log.info("任务作废结果:{}", resp); + return Func.readJson(resp, new TypeReference>() { + }); + } +} diff --git a/src/main/java/com/docus/server/archive/rpc/vo/SdRyBloodReportVO.java b/src/main/java/com/docus/server/archive/rpc/vo/SdRyBloodReportVO.java new file mode 100644 index 0000000..4cf14fe --- /dev/null +++ b/src/main/java/com/docus/server/archive/rpc/vo/SdRyBloodReportVO.java @@ -0,0 +1,27 @@ +package com.docus.server.archive.rpc.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 顺德人医输血报告单 视图 + * + * @author WYBDEV + */ +@Data +@ApiModel("顺德人医血液报告单查询结果") +public class SdRyBloodReportVO { + @ApiModelProperty("文件id") + private String fileId; + @ApiModelProperty("住院号") + private String inpatientNo; + @ApiModelProperty("住院次数") + private Integer admissions; + @ApiModelProperty("保存文件名") + private String fileName; + @ApiModelProperty("文件描述标题") + private String fileDesc; + @ApiModelProperty("文件下载地址") + private String fileUrl; +} diff --git a/src/main/java/com/docus/server/archive/service/PatientInfoSyncService.java b/src/main/java/com/docus/server/archive/service/PatientInfoSyncService.java new file mode 100644 index 0000000..bd36567 --- /dev/null +++ b/src/main/java/com/docus/server/archive/service/PatientInfoSyncService.java @@ -0,0 +1,29 @@ +package com.docus.server.archive.service; + +import java.time.LocalDateTime; + +/** + * @author YongBin Wen + * @date 2024/3/27 16:25 + */ +public interface PatientInfoSyncService { + /** + * 根据出院时间同步 + * + * @param start 开始时间 + * @param end 结束日期 + * @date 2024/5/23 15:33 + * @author YongBin Wen + */ + void syncByDisDate(LocalDateTime start, LocalDateTime end); + + /** + * 根据最后修改时间同步 + * + * @param start 开始时间 + * @param end 结束日期 + * @date 2024/5/23 15:35 + * @author YongBin Wen + */ + void syncByModifyTime(LocalDateTime start, LocalDateTime end); +} diff --git a/src/main/java/com/docus/server/archive/service/impl/ZqDyRyPatientInfoSyncServiceImpl.java b/src/main/java/com/docus/server/archive/service/impl/ZqDyRyPatientInfoSyncServiceImpl.java new file mode 100644 index 0000000..5697cda --- /dev/null +++ b/src/main/java/com/docus/server/archive/service/impl/ZqDyRyPatientInfoSyncServiceImpl.java @@ -0,0 +1,133 @@ +package com.docus.server.archive.service.impl; + +import com.docus.core.util.Func; +import com.docus.infrastructure.redis.service.IdService; +import com.docus.server.archive.constans.SyncConstant; +import com.docus.server.archive.converter.ZqDyRyPatientInfoConverter; +import com.docus.server.archive.entity.TBasic; +import com.docus.server.archive.mapper.TBasicMapper; +import com.docus.server.archive.service.PatientInfoSyncService; +import com.docus.server.zqdyry.entity.ZqDyRyPatientInfoView; +import com.docus.server.zqdyry.mapper.ZqDyRyPatientInfoViewMapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.time.LocalDateTime; +import java.util.*; +import java.util.function.Function; +import java.util.stream.Collectors; + +/** + * @author YongBin Wen + * @date 2024/3/27 16:25 + */ +@Service("ZqDyRy" + SyncConstant.PATIENT_INFO_SYNC_SERVICE_SUFFIX) +@Slf4j +public class ZqDyRyPatientInfoSyncServiceImpl implements PatientInfoSyncService { + @Resource + private TBasicMapper tBasicMapper; + @Resource + private ZqDyRyPatientInfoViewMapper zqDyRyPatientInfoViewMapper; + @Resource + private IdService idService; + + @Override + public void syncByDisDate(LocalDateTime start, LocalDateTime end) { + log.error("肇庆第一人民医院未开发按照出院时间同步患者基础数据!"); + } + + @Override + public void syncByModifyTime(LocalDateTime start, LocalDateTime end) { + String startDateTime = Func.formatDateTime(start); + String endDateTime = Func.formatDateTime(end); + int size = 1000; + int pageNumber = 1; + while (true) { + int startRow = ((pageNumber - 1) * size) + 1; + int endRow = pageNumber * size; + List patientInfoViews = zqDyRyPatientInfoViewMapper.pageByModifyTime(startDateTime, endDateTime, startRow, endRow); + if (Func.isNotEmpty(patientInfoViews)) { + List basicList = patientInfoViews.stream() + .map(ZqDyRyPatientInfoConverter::convertPatientInfo) + .collect(Collectors.toList()); + saveOrUpdate(basicList); + } + if (Func.isEmpty(patientInfoViews) || patientInfoViews.size() < size) { + break; + } + pageNumber++; + } + } + + /** + * 根据修改的患者基础信息,根据JZH查询是否存在,并进行相应数据的修改和新增。注:肇庆之前的jzh模式为 住院号@住院次数 组成,需要用两种方式查询 + * + * @param iuBasicList 修改的患者基础信息 + */ + private void saveOrUpdate(List iuBasicList) { + Date nowDate = new Date(); + List iuJzhList1 = iuBasicList.stream() + .map(TBasic::getJzh) + .collect(Collectors.toList()); + List iuJzhList2 = iuBasicList.stream() + .map(e -> e.getInpatientNo().trim() + "@" + e.getAdmissTimes()) + .collect(Collectors.toList()); + List iuJzhList = new ArrayList<>(); + iuJzhList.addAll(iuJzhList1); + iuJzhList.addAll(iuJzhList2); + List existsBasicList = tBasicMapper.getByJzh(iuJzhList); + Map existsJzhBasicMap = existsBasicList.stream().collect(Collectors.toMap(TBasic::getJzh, Function.identity())); + + List insertBasicList = new ArrayList<>(); + List updateBasicList = new ArrayList<>(); + // todo 未完成的逻辑处理哪些更新,哪些新增 + for (TBasic iuBasic : iuBasicList) { + String maybeJzh = iuBasic.getJzh().trim() + "@" + iuBasic.getAdmissTimes(); + if (existsJzhBasicMap.containsKey(iuBasic.getJzh()) || existsJzhBasicMap.containsKey(maybeJzh)) { + TBasic basic1 = existsJzhBasicMap.get(iuBasic.getJzh()); + TBasic basic2 = existsJzhBasicMap.get(maybeJzh); + TBasic tBasic = Objects.isNull(basic1) ? basic2 : basic1; + tBasic.setName(iuBasic.getName()); + tBasic.setInpatientNo(iuBasic.getInpatientNo()); + tBasic.setAdmissTimes(iuBasic.getAdmissTimes()); + tBasic.setSex(iuBasic.getSex()); + tBasic.setSexName(iuBasic.getSexName()); + tBasic.setNameSpell(iuBasic.getNameSpell()); + tBasic.setJzh(iuBasic.getJzh()); + tBasic.setAdmissDate(iuBasic.getAdmissDate()); + tBasic.setAdmissDept(iuBasic.getAdmissDept()); + tBasic.setAdmissDeptName(iuBasic.getAdmissDeptName()); + tBasic.setBedNo(iuBasic.getBedNo()); + tBasic.setAttending(iuBasic.getAttending()); + tBasic.setAttendingName(iuBasic.getAttendingName()); + tBasic.setAge(iuBasic.getAge()); + tBasic.setAgeMonth(iuBasic.getAgeMonth()); + tBasic.setAgeDay(iuBasic.getAgeDay()); + tBasic.setIdCard(iuBasic.getIdCard()); + tBasic.setTelphone(iuBasic.getTelphone()); + tBasic.setDisDate(iuBasic.getDisDate()); + tBasic.setDisDept(iuBasic.getDisDept()); + tBasic.setDisDeptName(iuBasic.getDisDeptName()); + tBasic.setIsDead(iuBasic.getIsDead()); + tBasic.setTotalCost(iuBasic.getTotalCost()); + tBasic.setFileSource(iuBasic.getFileSource()); + tBasic.setUpdateTime(nowDate); + updateBasicList.add(tBasic); + continue; + } + iuBasic.setPatientId(String.valueOf(idService.getDateSeq())); + iuBasic.setCreateTime(nowDate); + iuBasic.setUpdateTime(nowDate); + insertBasicList.add(iuBasic); + } + + if (Func.isNotEmpty(insertBasicList)) { + tBasicMapper.insertBatch(insertBasicList); + } + if (Func.isNotEmpty(updateBasicList)) { + tBasicMapper.updateBatch(updateBasicList); + } + + } +} diff --git a/src/main/java/com/docus/server/archive/utils/JaxWsDynamicClientUtil.java b/src/main/java/com/docus/server/archive/utils/JaxWsDynamicClientUtil.java new file mode 100644 index 0000000..7c70783 --- /dev/null +++ b/src/main/java/com/docus/server/archive/utils/JaxWsDynamicClientUtil.java @@ -0,0 +1,69 @@ +package com.docus.server.archive.utils; + +import org.apache.cxf.endpoint.Client; +import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory; +import org.apache.cxf.transport.http.HTTPConduit; +import org.apache.cxf.transports.http.configuration.HTTPClientPolicy; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.xml.namespace.QName; +import java.util.Arrays; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +/** + * 使用JaxWsDynamicClientFactory 调用 webservice + * + * @author wyb + */ +public class JaxWsDynamicClientUtil { + + private static final JaxWsDynamicClientFactory CLIENT_FACTORY = JaxWsDynamicClientFactory.newInstance(); + private static final Map CLIENT_MAP = new ConcurrentHashMap<>(); + private static final Logger logger = LoggerFactory.getLogger(JaxWsDynamicClientUtil.class); + + public static String send(String wsdlUrl, String namespaceUri, String operationName, Object[] params) { + logger.info("wsdlUrl:" + wsdlUrl + " ,namespaceUri: " + namespaceUri + " ,operationName:" + operationName + ",param:" + Arrays.toString(params)); + try { + Client client = getClient(wsdlUrl); + Object[] result; + if (namespaceUri == null || namespaceUri.isEmpty()) { + result = client.invoke(operationName, params); + } else { + QName qName = new QName(namespaceUri, operationName); + result = client.invoke(qName, params); + } + logger.info("wsdlUrl:" + wsdlUrl + ",namespaceUri: " + namespaceUri + " ,operationName:" + operationName + ",param:" + Arrays.toString(params) + " 调用成功!"); + if (result == null || result[0] == null) { + return null; + } + return String.valueOf(result[0]); + } catch (Exception ex) { + logger.error("wsdlUrl:" + wsdlUrl + ",namespaceUri: " + namespaceUri + " ,operationName:" + operationName + ",param:" + Arrays.toString(params) + " 调用失败了!_"+ex.getMessage(), ex); + return null; + } + } + + public static Client getClient(String wsdlUrl) { + if (CLIENT_MAP.get(wsdlUrl) == null) { + synchronized (JaxWsDynamicClientUtil.class) { + if (CLIENT_MAP.get(wsdlUrl) == null) { + Client client = CLIENT_FACTORY.createClient(wsdlUrl); + setClientParam(client); + CLIENT_MAP.put(wsdlUrl, client); + } + } + } + return CLIENT_MAP.get(wsdlUrl); + } + + private static void setClientParam(Client client) { + HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy(); + httpClientPolicy.setConnectionTimeout(30 * 1000); + httpClientPolicy.setAllowChunking(false); + httpClientPolicy.setReceiveTimeout(30 * 1000); + HTTPConduit clientConduit = (HTTPConduit) client.getConduit(); + clientConduit.setClient(httpClientPolicy); + } +} diff --git a/src/main/java/com/docus/server/archive/utils/PinYinUtil.java b/src/main/java/com/docus/server/archive/utils/PinYinUtil.java new file mode 100644 index 0000000..a9895dc --- /dev/null +++ b/src/main/java/com/docus/server/archive/utils/PinYinUtil.java @@ -0,0 +1,101 @@ +package com.docus.server.archive.utils; + +import net.sourceforge.pinyin4j.PinyinHelper; +import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType; +import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat; +import net.sourceforge.pinyin4j.format.HanyuPinyinToneType; +import net.sourceforge.pinyin4j.format.HanyuPinyinVCharType; +import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination; + +/** + * 拼音工具类 + * + * @author + */ +public class PinYinUtil { + /** + * 将字符串中的中文转化为拼音,其他字符不变 + * + * @param inputString + * @return + */ + public static String getPinYin(String inputString) { + HanyuPinyinOutputFormat format = new HanyuPinyinOutputFormat(); + format.setCaseType(HanyuPinyinCaseType.LOWERCASE); + format.setToneType(HanyuPinyinToneType.WITHOUT_TONE); + format.setVCharType(HanyuPinyinVCharType.WITH_V); + + char[] input = inputString.trim().toCharArray(); + String output = ""; + + try { + for (int i = 0; i < input.length; i++) { + if (Character.toString(input[i]).matches("[\\u4E00-\\u9FA5]+")) { + String[] temp = PinyinHelper.toHanyuPinyinStringArray(input[i], format); + output += temp[0]; + } else { + output += Character.toString(input[i]); + } + } + } catch (BadHanyuPinyinOutputFormatCombination e) { + e.printStackTrace(); + } + return output; + } + /** + * 获取汉字串拼音首字母,英文字符不变 + * @param chinese 汉字串 + * @return 汉语拼音首字母 + */ + public static String getFirstSpell(String chinese) { + StringBuffer pybf = new StringBuffer(); + char[] arr = chinese.toCharArray(); + HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat(); + defaultFormat.setCaseType(HanyuPinyinCaseType.LOWERCASE); + defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE); + for (int i = 0; i < arr.length; i++) { + if (arr[i] > 128) { + try { + String[] temp = PinyinHelper.toHanyuPinyinStringArray(arr[i], defaultFormat); + if (temp != null) { + pybf.append(temp[0].charAt(0)); + } + } catch (BadHanyuPinyinOutputFormatCombination e) { + e.printStackTrace(); + } + } else { + pybf.append(arr[i]); + } + } + return pybf.toString().replaceAll("\\W", "").trim(); + } + + public static void main(String[] args) { + String spell = getFirstSpell("牛的"); + System.out.println(spell); + } + /** + * 获取汉字串拼音,英文字符不变 + * @param chinese 汉字串 + * @return 汉语拼音 + */ + public static String getFullSpell(String chinese) { + StringBuffer pybf = new StringBuffer(); + char[] arr = chinese.toCharArray(); + HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat(); + defaultFormat.setCaseType(HanyuPinyinCaseType.LOWERCASE); + defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE); + for (int i = 0; i < arr.length; i++) { + if (arr[i] > 128) { + try { + pybf.append(PinyinHelper.toHanyuPinyinStringArray(arr[i], defaultFormat)[0]); + } catch (BadHanyuPinyinOutputFormatCombination e) { + e.printStackTrace(); + } + } else { + pybf.append(arr[i]); + } + } + return pybf.toString(); + } +} diff --git a/src/main/java/com/docus/server/archive/utils/XmlUtil.java b/src/main/java/com/docus/server/archive/utils/XmlUtil.java new file mode 100644 index 0000000..01d528b --- /dev/null +++ b/src/main/java/com/docus/server/archive/utils/XmlUtil.java @@ -0,0 +1,857 @@ +/* + * Copyright (c) 2018-2028, DreamLu All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: DreamLu 卢春梦 (596392912@qq.com) + */ +package com.docus.server.archive.utils; + +import com.docus.core.util.Exceptions; +import com.docus.core.util.IoUtil; +import org.springframework.lang.Nullable; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +import javax.xml.namespace.QName; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.xpath.XPath; +import javax.xml.xpath.XPathConstants; +import javax.xml.xpath.XPathExpressionException; +import javax.xml.xpath.XPathFactory; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringReader; +import java.util.HashMap; +import java.util.Map; + +/** + * xpath解析xml + * + *
+ *     文档地址:
+ *     http://www.w3school.com.cn/xpath/index.asp
+ * 
+ * + * @author L.cm + */ +public class XmlUtil { + private final XPath path; + private final Document doc; + + private XmlUtil(InputSource inputSource) throws ParserConfigurationException, SAXException, IOException { + DocumentBuilderFactory dbf = getDocumentBuilderFactory(); + DocumentBuilder db = dbf.newDocumentBuilder(); + doc = db.parse(inputSource); + path = getXPathFactory().newXPath(); + } + + /** + * 创建工具类 + * + * @param inputSource inputSource + * @return XmlUtil + */ + private static XmlUtil create(InputSource inputSource) { + try { + return new XmlUtil(inputSource); + } catch (ParserConfigurationException | SAXException | IOException e) { + throw Exceptions.unchecked(e); + } + } + + /** + * 转换工具类 + * + * @param inputStream inputStream + * @return XmlUtil + */ + public static XmlUtil of(InputStream inputStream) { + InputSource inputSource = new InputSource(inputStream); + return create(inputSource); + } + + /** + * 转换工具类 + * + * @param xmlStr xmlStr + * @return XmlUtil + */ + public static XmlUtil of(String xmlStr) { + StringReader sr = new StringReader(xmlStr.trim()); + InputSource inputSource = new InputSource(sr); + XmlUtil xmlUtil = create(inputSource); + IoUtil.closeQuietly(sr); + return xmlUtil; + } + + /** + * 转换路径 + * + * @param expression 表达式 + * @param item 实体 + * @param returnType 返回类型 + * @return Object + */ + private Object evalXPath(String expression, @Nullable Object item, QName returnType) { + item = null == item ? doc : item; + try { + return path.evaluate(expression, item, returnType); + } catch (XPathExpressionException e) { + throw Exceptions.unchecked(e); + } + } + + /** + * 获取String + * + * @param expression 路径 + * @return {String} + */ + public String getString(String expression) { + return (String) evalXPath(expression, null, XPathConstants.STRING); + } + + /** + * 获取Boolean + * + * @param expression 路径 + * @return {String} + */ + public Boolean getBoolean(String expression) { + return (Boolean) evalXPath(expression, null, XPathConstants.BOOLEAN); + } + + /** + * 获取Number + * + * @param expression 路径 + * @return {Number} + */ + public Number getNumber(String expression) { + return (Number) evalXPath(expression, null, XPathConstants.NUMBER); + } + + /** + * 获取某个节点 + * + * @param expression 路径 + * @return {Node} + */ + public Node getNode(String expression) { + return (Node) evalXPath(expression, null, XPathConstants.NODE); + } + + /** + * 获取子节点 + * + * @param expression 路径 + * @return NodeList + */ + public NodeList getNodeList(String expression) { + return (NodeList) evalXPath(expression, null, XPathConstants.NODESET); + } + + + /** + * 获取String + * + * @param node 节点 + * @param expression 相对于node的路径 + * @return {String} + */ + public String getString(Object node, String expression) { + return (String) evalXPath(expression, node, XPathConstants.STRING); + } + + /** + * 获取 + * + * @param node 节点 + * @param expression 相对于node的路径 + * @return {String} + */ + public Boolean getBoolean(Object node, String expression) { + return (Boolean) evalXPath(expression, node, XPathConstants.BOOLEAN); + } + + /** + * 获取 + * + * @param node 节点 + * @param expression 相对于node的路径 + * @return {Number} + */ + public Number getNumber(Object node, String expression) { + return (Number) evalXPath(expression, node, XPathConstants.NUMBER); + } + + /** + * 获取某个节点 + * + * @param node 节点 + * @param expression 路径 + * @return {Node} + */ + public Node getNode(Object node, String expression) { + return (Node) evalXPath(expression, node, XPathConstants.NODE); + } + + /** + * 获取子节点 + * + * @param node 节点 + * @param expression 相对于node的路径 + * @return NodeList + */ + public NodeList getNodeList(Object node, String expression) { + return (NodeList) evalXPath(expression, node, XPathConstants.NODESET); + } + + /** + * 针对没有嵌套节点的简单处理 + * + * @return map集合 + */ + public Map toMap() { + Element root = doc.getDocumentElement(); + Map params = new HashMap<>(16); + + // 将节点封装成map形式 + NodeList list = root.getChildNodes(); + for (int i = 0; i < list.getLength(); i++) { + Node node = list.item(i); + if (node instanceof Element) { + params.put(node.getNodeName(), node.getTextContent()); + } + } + return params; + } + + private static volatile boolean preventedXXE = false; + + private static DocumentBuilderFactory getDocumentBuilderFactory() throws ParserConfigurationException { + DocumentBuilderFactory dbf = XmlHelperHolder.documentBuilderFactory; + if (!preventedXXE) { + synchronized (XmlUtil.class) { + if (!preventedXXE) { + preventXXE(dbf); + } + } + } + return dbf; + } + + /** + * preventXXE + * + * @param dbf + * @throws ParserConfigurationException + */ + private static void preventXXE(DocumentBuilderFactory dbf) throws ParserConfigurationException { + // This is the PRIMARY defense. If DTDs (doctypes) are disallowed, almost all XML entity attacks are prevented + // Xerces 2 only - http://xerces.apache.org/xerces2-j/features.html#disallow-doctype-decl + dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); + + // If you can't completely disable DTDs, then at least do the following: + // Xerces 1 - http://xerces.apache.org/xerces-j/features.html#external-general-entities + // Xerces 2 - http://xerces.apache.org/xerces2-j/features.html#external-general-entities + + // JDK7+ - http://xml.org/sax/features/external-general-entities + dbf.setFeature("http://xml.org/sax/features/external-general-entities", false); + + // Xerces 1 - http://xerces.apache.org/xerces-j/features.html#external-parameter-entities + // Xerces 2 - http://xerces.apache.org/xerces2-j/features.html#external-parameter-entities + + // JDK7+ - http://xml.org/sax/features/external-parameter-entities + dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false); + + // Disable external DTDs as well + dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); + + // and these as well, per Timothy Morgan's 2014 paper: "XML Schema, DTD, and Entity Attacks" + dbf.setXIncludeAware(false); + dbf.setExpandEntityReferences(false); + preventedXXE = true; + } + + private static XPathFactory getXPathFactory() { + return XmlHelperHolder.xPathFactory; + } + + /** + * 内部类单例 + */ + private static class XmlHelperHolder { + private static DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); + private static XPathFactory xPathFactory = XPathFactory.newInstance(); + } + private static String str; + static { + str=" \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 59 \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 205室 \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 耳鼻咽喉头颈外科 \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 2号楼16楼西区 \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 南方医科大学顺德医院 \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "
\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 突发特发性听觉丧失 \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "
\n" + + "
\n" + + " \n" + + " \n" + + "
\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 常规 \n" + + " \n" + + " \n" + + "
\n" + + "
\n" + + " \n" + + " \n" + + "
\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "
\n" + + "
\n" + + " \n" + + " \n" + + "
\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "
\n" + + "
\n" + + " \n" + + " \n" + + "
\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 治愈 \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 张存良 \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 耳鼻咽喉头颈外科 \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 突发特发性听觉丧失 \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 文本 \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 乳房病类 \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "
\n" + + "
\n" + + "
\n" + + "
\n" + + "
\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 治愈 \n" + + " \n" + + " O \n" + + " \n" + + " 0 \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 01 \n" + + " \n" + + " 出院医嘱 \n" + + " \n" + + "
\n"; + } + + public static void main(String[] args) { + XmlUtil a=XmlUtil.of(str); + Node node=null; + //id-消息流水号 + node = a.getNode("/PRPA_HIP0032/id/@extension"); + String serialId = node.toString(); + System.out.println(serialId); + //住院流水号 + node = a.getNode("/PRPA_HIP0032/controlActProcess/subject/encounterEvent/item/@extension"); + String jzh = node.toString(); + System.out.println(jzh); + //住院号标识 + node = a.getNode("/PRPA_HIP0032/controlActProcess/subject/encounterEvent/id/item/@extension"); + String inpatientNo = node.toString(); + System.out.println(inpatientNo); + //住院次数[] + node = a.getNode("/PRPA_HIP0032/controlActProcess/subject/encounterEvent/lengthOfStayQuantity[@unit='次']/@value"); + String admissTimes=node.toString(); + System.out.println(admissTimes); + //姓名 + node = a.getNode("/PRPA_HIP0032/controlActProcess/subject/encounterEvent/subject/patient/patientPerson/name/item/part/@value"); + String name = node.toString(); + System.out.println(name); + //入院日期时间 + node = a.getNode("/PRPA_HIP0032/controlActProcess/subject/encounterEvent/effectiveTime/low/@value"); + String admissDate = node.toString(); + System.out.println(admissDate); + //出院日期时间 + node = a.getNode("/PRPA_HIP0032/controlActProcess/subject/encounterEvent/effectiveTime/high/@value"); + String disDate = node.toString(); + System.out.println(disDate); + //入院诊断科室名称[] + node = a.getNode("/PRPA_HIP0032/controlActProcess/subject/encounterEvent/component[@displayName='入院诊断']/section/entry[@displayName='入院诊断-西医条目']/observation/performer/assignedEntity/representedOrganization/name"); + String admissDeptName = node.getTextContent(); + System.out.println(admissDeptName); + //出院诊断科室名称[] + node = a.getNode("/PRPA_HIP0032/controlActProcess/subject/encounterEvent/component[@displayName='出院诊断']/section/entry[@displayName='出院诊断-西医条目']/observation/performer/assignedEntity/representedOrganization/name"); + String disDeptName = node.getTextContent(); + System.out.println(disDeptName); + //主治医师[] + node = a.getNode("/PRPA_HIP0032/controlActProcess/subject/encounterEvent/authenticator[@displayName='主治医师']/assignedEntity/assignedPerson/name"); + String attendingName = node.getTextContent(); + System.out.println(attendingName); + } +} diff --git a/src/main/resources/bin/install.bat b/src/main/resources/bin/install.bat new file mode 100644 index 0000000..7a651bc --- /dev/null +++ b/src/main/resources/bin/install.bat @@ -0,0 +1,33 @@ +@echo off + +for /f "delims=" %%t in ('winsw.exe status') do set str=%%t +echo %str% + + + +if %str%==Started ( +echo "restart....." +winsw stop +PING 127.0.0.1 -n 10 -w 30000 >NUL +winsw start +) + + + +if %str%==Stopped ( +echo "start....." +winsw start +) + + +if %str%==NonExistent ( +echo "deploy and start....." +winsw install +winsw start +echo c +) + + + + + diff --git a/src/main/resources/bin/start.bat b/src/main/resources/bin/start.bat new file mode 100644 index 0000000..58c25cb --- /dev/null +++ b/src/main/resources/bin/start.bat @@ -0,0 +1,21 @@ +set java_opts=-Xms512m -Xmx512m +set key="java_opts" + + +rem 文件不存在,就跳过 +if not exist java-ops.ini goto end + +for /f "tokens=1,2 delims==" %%i in (java-ops.ini) do ( + if "%%i"==%key% set java_opts=%%j) +echo java_opts is : %java_opts% + +:end + +rem 启动java + +java %java_opts% -Dfile.encoding=utf-8 -jar -Dspring.profiles.active=@profile.name@ -Dloader.path=config,lib @project.build.finalName@.jar + + + + + diff --git a/src/main/resources/bin/stop.bat b/src/main/resources/bin/stop.bat new file mode 100644 index 0000000..98468a0 --- /dev/null +++ b/src/main/resources/bin/stop.bat @@ -0,0 +1,13 @@ +@echo off + +for /f "delims=" %%t in ('winsw.exe status') do set str=%%t +echo %str% + + + +if %str%==Started ( +winsw stop +@echo wait program stop ..... +PING 127.0.0.1 -n 30 -w 10000 >NUL +) + diff --git a/src/main/resources/bin/update.bat b/src/main/resources/bin/update.bat new file mode 100644 index 0000000..743b7e0 --- /dev/null +++ b/src/main/resources/bin/update.bat @@ -0,0 +1,19 @@ +@echo off + +set deployDir=%1\docus-collect-basic-data +if %deployDir%=="" set deployDir=d:\webroot\docus-collect-basic-data + +set curr_file=%cd% +cd /d %deployDir% +call stop.bat +cd %curr_file% +sc query docus-backup-sys |Find "RUNNING" && ping 127.0.0.1 -n 10 >nul +rd/s/q %deployDir%\lib +rd/s/q %deployDir%\dataConfig +rd/s/q %deployDir%\config +del /s/q %deployDir%\*.jar +xcopy /Y/E/I * %deployDir% + +cd /d %deployDir% +call install.bat + diff --git a/src/main/resources/bin/winsw.xml b/src/main/resources/bin/winsw.xml new file mode 100644 index 0000000..edf4acd --- /dev/null +++ b/src/main/resources/bin/winsw.xml @@ -0,0 +1,8 @@ + + docus-collect-basic-data + 生产-嘉时-基础信息数据采集服务 + 生产-嘉时-基础信息数据采集服务 + Automatic + %BASE%\start.bat + + \ No newline at end of file diff --git a/src/main/resources/bootstrap.yml b/src/main/resources/bootstrap.yml new file mode 100644 index 0000000..31906bd --- /dev/null +++ b/src/main/resources/bootstrap.yml @@ -0,0 +1,111 @@ +server: + port: 9000 + +spring: + application: + name: @artifactId@ + profiles: + active: test + datasource: + dynamic: + primary: master #设置默认的数据源,默认值为master + strict: false #是否用严格模式,如果启用在味匹配到指定数据源时抛出异常 + datasource: + master: + url: jdbc:log4jdbc:mysql://db.docus.cn:3306/docus_medicalrecord?autoReconnect=true&allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai + username: docus + password: docus702 + driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy + type: com.alibaba.druid.pool.DruidDataSource + # 初始化配置 + initial-size: 3 + # 最小连接数 + min-idle: 3 + # 最大连接数 + max-active: 15 + # 获取连接超 时时间 + max-wait: 5000 + # 连接有效性检测时间 + time-between-eviction-runs-millis: 90000 + # 最大空闲时间 + min-evictable-idle-time-millis: 1800000 + test-while-idle: true + test-on-borrow: false + test-on-return: false + validation-query: select 1 + zqdyry: + url: jdbc:oracle:thin:@10.20.28.15:1521:cdrdb + username: zqry_blgd + password: zqry_blgd666 + driver-class-name: oracle.jdbc.driver.OracleDriver + type: com.alibaba.druid.pool.DruidDataSource + # 初始化配置 + initial-size: 3 + # 最小连接数 + min-idle: 3 + # 最大连接数 + max-active: 10 + # 获取连接超 时时间 + max-wait: 5000 + # 连接有效性检测时间 + time-between-eviction-runs-millis: 90000 + # 最大空闲时间 + min-evictable-idle-time-millis: 1800000 + test-while-idle: true + test-on-borrow: false + test-on-return: false + validation-query: select 1 from dual + redis: + host: redis.docus.cn + password: JSdocus@702 + cloud: + nacos: + discovery: + server-addr: nacos.docus.cn + namespace: 34acdf7a-9fc6-4bbd-8aea-9a47c8007ad5 + config: + server-addr: ${spring.cloud.nacos.discovery.server-addr} + namespace: 34acdf7a-9fc6-4bbd-8aea-9a47c8007ad5 + file-extension: yml + shared-configs: + - comm.${spring.cloud.nacos.config.file-extension} + + + +docus: + sync-service-prefix: ZqDyRy + default-user-pwd: fd29cd53ec12616e5f36b77d4afffbff + url: + # 采集任务补偿地址 + viewcollect-server: http://localhost:9295/ + # 报告上报地址 + downploadlatform-server: http://localhost:9291/ + # 获取无视图模式采集任务地址 + taskdistribute-server: http://localhost:9296/ + + + dbtype: mysql + +mybatis-plus: + configuration: + map-underscore-to-camel-case: true + call-setters-on-nulls: true + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + global-config: + db-config: + field-strategy: NOT_EMPTY + db-type: MYSQL +xxl: + job: + accessToken: + admin: + addresses: http://job.docus.cn:8180/xxl-job-admin + executor: + appname: docus-collect-basic-data + address: + ip: + port: 19000 + logretentiondays: 30 + logpath: D:/xxl-job/docus-collect-basic-data + + diff --git a/src/main/resources/log4jdbc.log4j2.properties b/src/main/resources/log4jdbc.log4j2.properties new file mode 100644 index 0000000..5cb6f99 --- /dev/null +++ b/src/main/resources/log4jdbc.log4j2.properties @@ -0,0 +1,2 @@ +# If you use SLF4J. First, you need to tell log4jdbc-log4j2 that you want to use the SLF4J logger +log4jdbc.spylogdelegator.name=net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator \ No newline at end of file diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml new file mode 100644 index 0000000..8c0caf4 --- /dev/null +++ b/src/main/resources/logback.xml @@ -0,0 +1,77 @@ + + + docus-collect-basic-data + + + + + [%d{yyyy-MM-dd' 'HH:mm:ss.sss}] [%contextName] [%thread] [%X{traceId}] %-5level %logger{36} - %msg%n + + + + + + + [%d{yyyy-MM-dd' 'HH:mm:ss.sss}] [%C] [%t] [%X{traceId}] [%L] [%-5p] %m%n + utf-8 + + + + + ${log.path}%d.%i.log + + 500MB + + 30 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/mapper/PowerDeptMapper.xml b/src/main/resources/mapper/PowerDeptMapper.xml new file mode 100644 index 0000000..e018162 --- /dev/null +++ b/src/main/resources/mapper/PowerDeptMapper.xml @@ -0,0 +1,44 @@ + + + + + INSERT INTO docus_system.power_dept (dept_id, dept_code, dept_name, dict_id, + effective, create_date, creater, update_date, + updater, remark, sort, `type`) + VALUES + + (#{dept.deptId},#{dept.deptCode},#{dept.deptName},#{dept.dictId}, + #{dept.effective},#{dept.createDate},#{dept.creater},#{dept.updateDate}, + #{dept.updater},#{dept.remark},#{dept.sort},#{dept.type}) + + + + + + UPDATE docus_system.power_dept + SET dept_code=#{dept.deptCode}, dept_name=#{dept.deptName}, dict_id=#{dept.dictId}, + effective=#{dept.effective}, create_date=#{dept.createDate}, creater=#{dept.creater}, + update_date=#{dept.updateDate}, updater=#{dept.updater}, remark=#{dept.remark}, + sort=#{dept.sort}, `type`=#{dept.type} WHERE dept_id=#{dept.deptId}; + + + + + + + diff --git a/src/main/resources/mapper/PowerUser.xml b/src/main/resources/mapper/PowerUser.xml new file mode 100644 index 0000000..0dab088 --- /dev/null +++ b/src/main/resources/mapper/PowerUser.xml @@ -0,0 +1,57 @@ + + + + + INSERT INTO docus_system.power_user (user_id, user_name, user_pwd, user_sex, user_age, user_tel, user_email, + user_head, user_position, role_id, dept_id, effective, create_date, + creater, update_date, updater, remark, login_flag, name, power_dept, + power_attending, wx_bank, enabled, pwd_change, mnemonic_words, account_state, + att_role_id, open_id, is_third) + VALUES + + ( + #{user.userId},#{user.userName},#{user.userPwd},#{user.userSex},#{user.userAge},#{user.userTel},#{user.userEmail}, + #{user.userHead},#{user.userPosition},#{user.roleId},#{user.deptId},#{user.effective},#{user.createDate}, + #{user.creater},#{user.updateDate},#{user.updater},#{user.remark},#{user.loginFlag},#{user.name},#{user.powerDept}, + #{user.powerAttending},#{user.wxBank},#{user.enabled},#{user.pwdChange},#{user.mnemonicWords},#{user.accountState}, + #{user.attRoleId},#{user.openId},#{user.isThird} + ) + + + + + UPDATE docus_system.power_user + SET user_name=#{user.userName}, user_pwd=#{user.userPwd}, user_sex=#{user.userSex}, + user_age=#{user.userAge}, user_tel=#{user.userTel}, user_email=#{user.userEmail}, + user_head=#{user.userHead}, user_position=#{user.userPosition}, role_id=#{user.roleId}, + dept_id=#{user.deptId}, effective=#{user.effective}, create_date=#{user.createDate}, + creater=#{user.creater}, update_date=#{user.updateDate}, updater=#{user.updater}, remark=#{user.remark}, + login_flag=#{user.loginFlag}, name=#{user.name}, power_dept=#{user.powerDept} ,power_attending=#{user.powerAttending}, + wx_bank=#{user.wxBank},enabled=#{user.enabled}, pwd_change=#{user.pwdChange}, mnemonic_words=#{user.mnemonicWords}, + account_state=#{user.accountState}, att_role_id=#{user.attRoleId}, + open_id=#{user.openId}, is_third=#{user.isThird} + WHERE user_id=#{user.userId}; + + + + + + + diff --git a/src/main/resources/mapper/TBasicMapper.xml b/src/main/resources/mapper/TBasicMapper.xml new file mode 100644 index 0000000..4b1070b --- /dev/null +++ b/src/main/resources/mapper/TBasicMapper.xml @@ -0,0 +1,58 @@ + + + + + INSERT INTO `docus_medicalrecord`.`t_basic` + (`patient_id`, `admiss_times`, `inpatient_no`, `name`, `name_spell`, + `sex`, `sex_name`,`age`, `age_month`, `age_day`, `id_card`, `telphone`, + `admiss_date`,`admiss_dept`, `admiss_dept_name`, + `dis_date`,`dis_dept`, `dis_dept_name`, + `attending`, `attending_name`, + `is_dead`,`file_source`, + `jzh`,`bed_no`, `jz_card_no`, `total_cost`, + `create_time`, `update_time`) VALUES + + ( + #{basic.patientId},#{basic.admissTimes},#{basic.inpatientNo},#{basic.name},#{basic.nameSpell}, + #{basic.sex},#{basic.sexName},#{basic.age},#{basic.ageMonth},#{basic.ageDay},#{basic.idCard},#{basic.telphone}, + #{basic.admissDate},#{basic.admissDept},#{basic.admissDeptName}, + #{basic.disDate},#{basic.disDept},#{basic.disDeptName}, + #{basic.attending},#{basic.attendingName}, + #{basic.isDead},#{basic.fileSource}, + #{basic.jzh},#{basic.bedNo},#{basic.jzCardNo},#{basic.totalCost}, + #{basic.createTime},#{basic.updateTime} + ) + + + + + UPDATE `docus_medicalrecord`.`t_basic` + set inpatient_no=#{basic.inpatientNo},admiss_times=#{basic.admissTimes},name=#{basic.name},name_spell=#{basic.nameSpell}, + `sex`= #{basic.sex}, `sex_name`=#{basic.sexName},`age`=#{basic.age}, `age_month`=#{basic.ageMonth}, + `age_day`=#{basic.ageDay}, `id_card`=#{basic.idCard}, `telphone`=#{basic.telphone}, + `admiss_date`=#{basic.admissDate},`admiss_dept`=#{basic.admissDept}, `admiss_dept_name`=#{basic.admissDeptName}, + `dis_date`= #{basic.disDate},`dis_dept`=#{basic.disDept}, `dis_dept_name`=#{basic.disDeptName}, + `attending`= #{basic.attending}, `attending_name`=#{basic.attendingName}, + `is_dead`=#{basic.isDead},`file_source`=#{basic.fileSource}, + `jzh`= #{basic.jzh},`bed_no`=#{basic.bedNo}, `jz_card_no`=#{basic.jzCardNo}, `total_cost`=#{basic.totalCost}, + `create_time`= #{basic.createTime}, `update_time`=#{basic.updateTime} + WHERE patient_id= #{basic.patientId}; + + + + +