Browse Source

Merge branch 'master' into 'master'

新增传染病上传基本信息功能

See merge request lighter/web-server!155
huangshuhua 2 weeks ago
parent
commit
abce908ea7

+ 66 - 0
src/main/java/thyyxxk/webserver/controller/crbmanagement/CrbBaseController.java

@@ -0,0 +1,66 @@
+package thyyxxk.webserver.controller.crbmanagement;
+
+import com.alibaba.fastjson.JSONObject;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import thyyxxk.webserver.config.auth.PassToken;
+import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.crbmanagement.BaseDept;
+import thyyxxk.webserver.entity.crbmanagement.BaseUser;
+import thyyxxk.webserver.entity.crbmanagement.EmrPatientInfo;
+import thyyxxk.webserver.service.crbmanagement.CrbBaseService;
+
+import java.util.List;
+
+/**
+ * @ClassName CrbBaseController
+ * @Author hsh
+ * @Date 2025/7/25 0025 11:15
+ * @Version 1.0
+ * @Description 国家传染病上报前置机软件接口
+ **/
+@RestController
+@RequestMapping("/crbBase")
+public class CrbBaseController {
+
+    private final CrbBaseService service;
+
+
+    public CrbBaseController(CrbBaseService service) {
+        this.service = service;
+    }
+
+    @PassToken
+    @PostMapping("uploadBaseUser")
+    public ResultVo<JSONObject> uploadBaseUser(@RequestBody @Validated BaseUser baseUser){
+        return service.uploadBaseUser(baseUser);
+    }
+
+    @PassToken
+    @PostMapping("uploadBaseDept")
+    public ResultVo<JSONObject> uploadBaseDept(@RequestBody @Validated BaseDept baseDept){
+        return service.uploadBaseDept(baseDept);
+    }
+
+    @PassToken
+    @PostMapping("selectBaseUser")
+    public ResultVo<List<BaseUser>> selectBaseUser(@RequestBody @Validated BaseUser baseUser){
+        return service.selectBaseUser(baseUser);
+    }
+
+    @PassToken
+    @PostMapping("selectBaseDept")
+    public ResultVo<List<BaseDept>> selectBaseDept(@RequestBody @Validated BaseDept baseDept){
+        return service.selectBaseDept(baseDept);
+    }
+
+    @PassToken
+    @PostMapping("uploadEmrPatientInfo")
+    public ResultVo<JSONObject> uploadEmrPatientInfo(@RequestBody @Validated EmrPatientInfo emrPatientInfo){
+        return service.uploadEmrPatientInfo(emrPatientInfo);
+    }
+
+}

+ 37 - 0
src/main/java/thyyxxk/webserver/dao/his/crbmanagement/CrbBaseDao.java

@@ -0,0 +1,37 @@
+package thyyxxk.webserver.dao.his.crbmanagement;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import thyyxxk.webserver.entity.crbmanagement.BaseDept;
+import thyyxxk.webserver.entity.crbmanagement.BaseUser;
+
+import java.util.List;
+
+@Mapper
+public interface CrbBaseDao {
+
+    @Select(" select name from sys_parameters where code = #{code} ")
+    String selectOrgCodeByCode(@Param("code") String code);
+
+    @Select(" select rtrim(mi.code) as id, #{orgCode} as orgCode, rtrim(mi.name) as userName, rtrim(mi.dept_code) as deptCode, " +
+            " mi.code_rs as loginName, isnull(gw.id_card, rtrim(mi.social_no)) as idCard, '01' as idCardTypeCode, " +
+            " isnull(gw.tel, rtrim(mi.phone_no)) as tel, rtrim(mi.yb_code) as physicianNo, " +
+            " case when gw.name is null then '2' else '1' end as userTypeCode, " +
+            " convert(varchar(100), sysdatetime(), 20) as createTime  " +
+            " from a_employee_mi as mi " +
+            " left join gw_info as gw on mi.code = gw.code  " +
+            " where isnull(mi.del_flag, '0') = '0' and ${ew.sqlSegment} " +
+            " order by mi.code ")
+    List<BaseUser> selectBaseUser(@Param("orgCode") String orgCode, @Param(Constants.WRAPPER) QueryWrapper<?> qw);
+
+    @Select(" select rtrim(code) as deptCode, rtrim(name) as deptName, " +
+            " si_caty as targetDeptCode, si_caty_name as targetDeptName, " +
+            " convert(varchar(100), sysdatetime(), 20) as createTime " +
+            " from zd_unit_code where ${ew.sqlSegment} " +
+            " order by code ")
+    List<BaseDept> selectBaseDept(@Param(Constants.WRAPPER) QueryWrapper<?> qw);
+
+}

+ 36 - 0
src/main/java/thyyxxk/webserver/entity/crbmanagement/BaseDept.java

@@ -0,0 +1,36 @@
+package thyyxxk.webserver.entity.crbmanagement;
+
+import lombok.Data;
+
+/**
+ * @ClassName BaseDept
+ * @Author hsh
+ * @Date 2025/7/29 0029 10:57
+ * @Version 1.0
+ * @Description 院内科室信息之传染病上报
+ **/
+@Data
+public class BaseDept {
+
+    /**
+     * 院内科室代码
+     */
+    private String deptCode;
+    /**
+     * 院内科室名称
+     */
+    private String deptName;
+    /**
+     * 对应的前置软件科室代码
+     */
+    private String targetDeptCode;
+    /**
+     * 对应的前置软件科室名称
+     */
+    private String targetDeptName;
+    /**
+     * 创建时间
+     */
+    private String createTime;
+
+}

+ 60 - 0
src/main/java/thyyxxk/webserver/entity/crbmanagement/BaseUser.java

@@ -0,0 +1,60 @@
+package thyyxxk.webserver.entity.crbmanagement;
+
+import lombok.Data;
+
+/**
+ * @ClassName BaseUser
+ * @Author hsh
+ * @Date 2025/7/28 0028 15:13
+ * @Version 1.0
+ * @Description 医院信息系统用户信息之传染病上报
+ **/
+@Data
+public class BaseUser {
+
+    /*
+     * 用户 ID
+     */
+    private String id;
+    /*
+     * 所属机构
+     */
+    private String orgCode;
+    /*
+     * 所属科室
+     */
+    private String deptCode;
+    /*
+     * 姓名
+     */
+    private String userName;
+    /*
+     * 身份证件类别
+     */
+    private String idCardTypeCode;
+    /*
+     * 身份证件号码
+     */
+    private String idCard;
+    /*
+     * 联系电话
+     */
+    private String tel;
+    /*
+     * 医师执业资格证号
+     */
+    private String physicianNo;
+    /*
+     * 登录名
+     */
+    private String loginName;
+    /*
+     * 用户类型
+     */
+    private String userTypeCode;
+    /*
+     * 用户创建时间
+     */
+    private String createTime;
+
+}

+ 142 - 0
src/main/java/thyyxxk/webserver/entity/crbmanagement/EmrActivityInfo.java

@@ -0,0 +1,142 @@
+package thyyxxk.webserver.entity.crbmanagement;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @ClassName EmrActivityInfo
+ * @Author hsh
+ * @Date 2025/7/30 0030 16:56
+ * @Version 1.0
+ * @Description 诊疗活动信息表之传染病上报
+ **/
+@Data
+public class EmrActivityInfo {
+
+    /**
+     * ID(诊疗活动记录在院内的唯一识别标识 必填)
+     */
+    private String id;
+    /**
+     * 患者基本信息ID(机构内患者基本信息唯一标识 必填)
+     */
+    private String patientId;
+    /**
+     * 诊疗活动类型代码(医生做出疾病诊断的业务活动环节名称代码 必填)
+     */
+    private String activityTypeCode;
+    /**
+     * 诊疗活动类型名称(关联的就诊活动类别名称 必填名称须与代码所对应的值域代码名称一致 必填)
+     */
+    private String activityTypeName;
+    /**
+     * 就诊流水号
+     * (诊疗活动发生在门(急)诊期间时,就诊流水号为门(急)诊号;
+     * 诊疗活动为住院期间时,就诊流水号为住院号;
+     * 请使用可以唯一标识患者一次诊疗活动的编号 必填)
+     */
+    private String serialNumber;
+    /**
+     * 诊疗活动发生日期时间(医生填写诊断的具体时间,精确到秒 必填,格式:yyyy-MM-dd HH:mm:ss)
+     */
+    private Date activityTime;
+    /**
+     * 患者姓名(患者真实姓名 必填)
+     */
+    private String patientName;
+    /**
+     * 身份证件类别代码(患者身份证件所属类别代码 必填)
+     */
+    private String idCardTypeCode;
+    /**
+     * 身份证件类别名称(患者身份证件所属类别名称 必填)
+     */
+    private String idCardTypeName;
+    /**
+     * 身份证件号码(患者的身份证件上的唯一法定标识符。新生儿无身份证件号码时,
+     * 身份证件类别应为其他法定有效证件,身份证件号码为出生日期 8 位数字 必填)
+     */
+    private String idCard;
+    /**
+     * 主诉
+     */
+    private String chiefComplaint;
+    /**
+     * 现病史/入院情况
+     */
+    private String presentIllnessHis;
+    /**
+     * 体格检查
+     */
+    private String physicalExamination;
+    /**
+     * 辅助检查
+     */
+    private String studiesSummaryResult;
+    /**
+     * 疾病诊断日期(医师做出疾病诊断的具体时间,精确到小时 必填,格式:yyyy-MM-dd HH:mm:ss)
+     */
+    private Date diagnoseTime;
+    /**
+     * 传染病诊断代码(传染病诊断名称代码 疾病诊断为传染病时必填,多个诊断使用||分隔)
+     */
+    private String diseaseCode;
+    /**
+     * 传染病诊断名称(传染病诊断名称 疾病诊断为传染病时必填,多个诊断使用||分隔,名称须与代码所对应的值域代码名称一致)
+     */
+    private String diseaseName;
+    /**
+     * 西医疾病诊断编码(疾病诊断在西医诊断在 ICD-10 编码体系中的编码 必填,多个诊断使用||分隔)
+     */
+    private String wmDiseaseCode;
+    /**
+     * 西医疾病诊断名称(疾病诊断在西医诊断在 ICD-10 编码体系中的编码 必填,多个诊断使用||分隔)
+     */
+    private String wmDiseaseName;
+    /**
+     * 中医病名代码
+     */
+    private String tcmDiseaseCode;
+    /**
+     * 中医病名名称
+     */
+    private String tcmDiseaseName;
+    /**
+     * 中医证候编码
+     */
+    private String tcmSyndromeCode;
+    /**
+     * 中医证候名称
+     */
+    private String tcmSyndromeName;
+    /**
+     * 诊断医生(必填)
+     */
+    private String fillDoctor;
+    /**
+     * 科室代码(做出疾病诊断的医疗机构院内科室代码 必填)
+     */
+    private String deptCode;
+    /**
+     * 科室名称(做出疾病诊断的医疗机构院内科室名称 必填)
+     */
+    private String deptName;
+    /**
+     * 医疗机构代码(做出疾病诊断的医疗机构代码 必填)
+     */
+    private String orgCode;
+    /**
+     * 医疗机构名称(必填)
+     */
+    private String orgName;
+    /**
+     * 操作人ID(操作人是指医院信息系统中实际操作数据的用户,操作人ID取值为《医院信息系统用户信息表》中“用户 ID ”的值域范围 必填)
+     */
+    private String operatorId;
+    /**
+     * 操作时间(必填,格式:yyyy-MM-dd HH:mm:ss)
+     */
+    private Date operatorTime;
+
+}

+ 145 - 0
src/main/java/thyyxxk/webserver/entity/crbmanagement/EmrPatientInfo.java

@@ -0,0 +1,145 @@
+package thyyxxk.webserver.entity.crbmanagement;
+
+import lombok.Data;
+
+/**
+ * @ClassName EmrPatientInfo
+ * @Author hsh
+ * @Date 2025/7/29 0029 11:32
+ * @Version 1.0
+ * @Description 患者基本信息表之传染病上报
+ **/
+@Data
+public class EmrPatientInfo {
+
+    private String id;
+    /**
+     * 患者姓名
+     */
+    private String patientName;
+    /**
+     * 身份证件类别代码
+     */
+    private String idCardTypeCode;
+    /**
+     * 身份证件类别名称
+     */
+    private String idCardTypeName;
+    /**
+     * 身份证件号码
+     */
+    private String idCard;
+    /**
+     * 性别代码
+     */
+    private String genderCode;
+    /**
+     * 性别名称
+     */
+    private String genderName;
+    /**
+     * 出生日期(格式:yyyy-MM-dd)
+     */
+    private String birthDate;
+    /**
+     * 国籍/地区 代码
+     */
+    private String nationalityCode;
+    /**
+     * 国籍/地区 名称
+     */
+    private String nationalityName;
+    /**
+     * 民族代码
+     */
+    private String nationCode;
+    /**
+     * 民族名称
+     */
+    private String nationName;
+    /**
+     * 户籍地址代码
+     */
+    private String permanentAddrCode;
+    /**
+     * 户籍地址名称
+     */
+    private String permanentAddrName;
+    /**
+     * 户籍详细地址
+     */
+    private String permanentAddrDetail;
+    /**
+     * 现住地区代码
+     */
+    private String currentAddrCode;
+    /**
+     * 现住地区名称
+     */
+    private String currentAddrName;
+    /**
+     * 现住详细地址
+     */
+    private String currentAddrDetail;
+    /**
+     * 工作单位/学校名称
+     */
+    private String workunit;
+    /**
+     * 婚姻状况代码
+     */
+    private String maritalStatusCode;
+    /**
+     * 婚姻状况名称
+     */
+    private String maritalStatusName;
+    /**
+     * 学历代码
+     */
+    private String educationCode;
+    /**
+     * 学历名称
+     */
+    private String educationName;
+    /**
+     * 人群分类代码
+     */
+    private String nultitudeTypeCode;
+    /**
+     * 人群分类名称
+     */
+    private String nultitudeTypeName;
+    /**
+     * 人群分类其他
+     */
+    private String nultitudeTypeOther;
+    /**
+     * 患者电话号码
+     */
+    private String tel;
+    /**
+     * 联系人/监护人姓名
+     */
+    private String contacts;
+    /**
+     * 联系人/监护人电话号码
+     */
+    private String contactsTel;
+    /**
+     * 医疗机构代码
+     */
+    private String orgCode;
+    /**
+     * 医疗机构名称
+     */
+    private String orgName;
+    /**
+     * 操作人ID
+     */
+    private String operatorId;
+    /**
+     * 操作时间
+     */
+    private String operationTime;
+
+}

+ 153 - 0
src/main/java/thyyxxk/webserver/service/crbmanagement/CrbBaseService.java

@@ -0,0 +1,153 @@
+package thyyxxk.webserver.service.crbmanagement;
+
+import cn.hutool.core.date.DateUtil;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import thyyxxk.webserver.config.exception.ExceptionEnum;
+import thyyxxk.webserver.dao.his.crbmanagement.CrbBaseDao;
+import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.crbmanagement.BaseDept;
+import thyyxxk.webserver.entity.crbmanagement.BaseUser;
+import thyyxxk.webserver.entity.crbmanagement.EmrPatientInfo;
+import thyyxxk.webserver.service.externalhttp.CrbUploadService;
+import thyyxxk.webserver.utils.ResultVoUtil;
+
+import javax.annotation.Resource;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @ClassName CrbBaseService
+ * @Author hsh
+ * @Date 2025/7/28 0028 14:50
+ * @Version 1.0
+ * @Description 国家传染病上报前置机软件接口
+ **/
+@Service
+@Slf4j
+public class CrbBaseService {
+
+    @Resource
+    private CrbBaseDao dao;
+
+    @Resource
+    private CrbUploadService crbUploadService;
+
+    @Value("${si-crb-url}")
+    private String siCrbUrl;
+
+
+    /**
+     * @Description 医院信息系统用户信息表数据上传
+     * @Author hsh
+     * @param baseUser 系统用户信息表数据
+     * @return JSONObject
+     * @Date 2025/7/30 0030 10:34
+     */
+    public ResultVo<JSONObject> uploadBaseUser(BaseUser baseUser) {
+        String orgCode = dao.selectOrgCodeByCode("orgCode");
+        if(StringUtils.isBlank(baseUser.getOrgCode())){
+            baseUser.setOrgCode(orgCode);
+        }
+        baseUser.setCreateTime(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:dd"));
+        JSONObject object = crbUploadService.uploadBaseUser(siCrbUrl, baseUser);
+        boolean f = (boolean) object.get("result");
+        if(!f){
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, errInfoTips(object));
+        }
+        return ResultVoUtil.success(object);
+    }
+
+    /**
+     * @Description 医院信息系统科室信息数据上传
+     * @Author hsh
+     * @param baseDept 科室信息数据
+     * @return JSONObject
+     * @Date 2025/7/30 0030 16:06
+     */
+    public ResultVo<JSONObject> uploadBaseDept(BaseDept baseDept) {
+        baseDept.setCreateTime(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:dd"));
+        JSONObject object = crbUploadService.uploadBaseDept(siCrbUrl, baseDept);
+        boolean f = (boolean) object.get("result");
+        if(!f){
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, errInfoTips(object));
+        }
+        return ResultVoUtil.success(object);
+    }
+
+    /**
+     * @Description 获取医院信息系统用户信息(所有参与诊疗活动的用户)
+     * @Author hsh
+     * @param baseUser 参数
+     * @return list
+     * @Date 2025/7/29 0029 11:10
+     */
+    public ResultVo<List<BaseUser>> selectBaseUser(BaseUser baseUser) {
+        String orgCode = dao.selectOrgCodeByCode("orgCode");
+        QueryWrapper<BaseUser> qw = new QueryWrapper<>();
+        qw.like("mi.name", baseUser.getUserName());
+        if(StringUtils.isNotEmpty(baseUser.getLoginName())){
+            qw.eq("mi.code_rs", baseUser.getLoginName());
+        }
+        if(StringUtils.isNotEmpty(baseUser.getIdCard())){
+            qw.eq("mi.social_no", baseUser.getIdCard());
+        }
+        return ResultVoUtil.success(dao.selectBaseUser(orgCode, qw));
+    }
+
+    /**
+     * @Description 获取全部院内科室信息
+     * @Author hsh
+     * @param baseDept 参数
+     * @return list 院内科室信息
+     * @Date 2025/7/29 0029 11:09
+     */
+    public ResultVo<List<BaseDept>> selectBaseDept(BaseDept baseDept) {
+        QueryWrapper<BaseDept> qw = new QueryWrapper<>();
+        qw.like("name", baseDept.getDeptName());
+        if(StringUtils.isNotEmpty(baseDept.getDeptCode())){
+            qw.eq("code", baseDept.getDeptCode());
+        }
+        if(StringUtils.isNotEmpty(baseDept.getTargetDeptCode())){
+            qw.eq("si_caty", baseDept.getTargetDeptCode());
+        }
+        if(StringUtils.isNotEmpty(baseDept.getTargetDeptName())){
+            qw.like("si_caty_name", baseDept.getTargetDeptName());
+        }
+        return ResultVoUtil.success(dao.selectBaseDept(qw));
+    }
+
+    /**
+     * @Description 患者基本信息表数据上传
+     * @Author hsh
+     * @param emrPatientInfo 患者基本信息表数据
+     * @return JSONObject
+     * @Date 2025/7/30 0030 16:51
+     */
+    public ResultVo<JSONObject> uploadEmrPatientInfo(EmrPatientInfo emrPatientInfo) {
+        JSONObject object = crbUploadService.uploadEmrPatientInfo(siCrbUrl, emrPatientInfo);
+        boolean f = (boolean) object.get("result");
+        if(!f){
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, errInfoTips(object));
+        }
+        return ResultVoUtil.success(object);
+    }
+
+    /**
+     * @Description 错误提示信息返回
+     * @Author hsh
+     * @param object 返回json
+     * @return String 错误提示信息
+     * @Date 2025/7/30 0030 16:47
+     */
+    private String errInfoTips(JSONObject object) {
+        String errorName = object.getString("errorName");
+        String desc = object.getString("desc");
+        return errorName + ": " + desc;
+    }
+    
+}

+ 24 - 0
src/main/java/thyyxxk/webserver/service/externalhttp/CrbUploadService.java

@@ -0,0 +1,24 @@
+package thyyxxk.webserver.service.externalhttp;
+
+import com.alibaba.fastjson.JSONObject;
+import com.dtflys.forest.annotation.JSONBody;
+import com.dtflys.forest.annotation.Post;
+import com.dtflys.forest.annotation.Var;
+import thyyxxk.webserver.entity.crbmanagement.BaseDept;
+import thyyxxk.webserver.entity.crbmanagement.BaseUser;
+import thyyxxk.webserver.entity.crbmanagement.EmrPatientInfo;
+
+public interface CrbUploadService {
+
+    @Post("{url}/hclient/emr/receive/baseUser")
+    JSONObject uploadBaseUser(@Var("url") String url, @JSONBody BaseUser baseUser);
+
+    @Post("{url}/hclient/emr/receive/baseDept")
+    JSONObject uploadBaseDept(@Var("url") String url, @JSONBody BaseDept baseDept);
+
+    @Post("{url}/hclient/emr/receive/baseDept")
+    JSONObject uploadEmrPatientInfo(@Var("url") String url, @JSONBody EmrPatientInfo emrPatientInfo);
+
+
+
+}