liusheng
2025-03-26 fa132afa3a6942a48002c8e36e9ee47de13ee005
代码提交
已修改17个文件
488 ■■■■ 文件已修改
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceExternalController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/resources/application-druid.yml 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsServiceImpl.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/ExternalInHospPatientInfo.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/ExternalOperationDetail.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/PatArchive.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/PatArchiveOthreInfo.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/PatArchiveReq.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/PatArchivecontact.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/PatArchiveServiceImpl.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java 158 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml 70 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/PatArchivecontactMapper.xml 118 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceExternalController.java
@@ -50,7 +50,7 @@
            aBoolean = serviceExternalService.generalInterface(dataMap);
        } catch (Exception e) {
            e.printStackTrace();
            log.error("serviceExternal---addDeptInfo出异常了:{}", e.getMessage());
            log.error("serviceExternal---generalInterface出异常了:{}", e.getMessage());
            aBoolean = false;
        }
        return returnParam(aBoolean, dataMap);
ruoyi-admin/src/main/resources/application-druid.yml
@@ -18,16 +18,16 @@
#        password: Smartor.2023
#        driverClassName: com.mysql.cj.jdbc.Driver
        #        # 新华
#        url: jdbc:mysql://192.168.191.181:3308/smartor?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
#        username: smartor
#        password: Smartor.2023
#        driverClassName: com.mysql.cj.jdbc.Driver
      #        url: jdbc:mysql://192.168.191.181:3308/smartor?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
      #        username: smartor
      #        password: Smartor.2023
      #        driverClassName: com.mysql.cj.jdbc.Driver
        #        #  公司云
        url: jdbc:mysql://116.62.18.175:6002/smartor_lisui?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
        username: hxsoft
        password: Hxerp2000
        driverClassName: com.mysql.cj.jdbc.Driver
      #        #        #  公司云
              url: jdbc:mysql://116.62.18.175:6002/smartor_lisui?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
              username: hxsoft
              password: Hxerp2000
              driverClassName: com.mysql.cj.jdbc.Driver
      # 从库数据源
@@ -218,3 +218,6 @@
#是否需要根据疾病建立出院患者随访
createIcd10Visit: false
#admin管理员userId
isAdmin: 1,2,3,4,5,6,7,8,9,10,11,12,13
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsServiceImpl.java
@@ -41,17 +41,17 @@
        if (StringUtils.isNull(user))
        {
            log.info("登录用户:{} 不存在.", username);
            throw new ServiceException("登录用户:" + username + " 不存在");
            throw new ServiceException("登录用户:" + split[0] + " 不存在,或机构不正确,请检查后重新登陆");
        }
        else if (UserStatus.DELETED.getCode().equals(user.getDelFlag()))
        {
            log.info("登录用户:{} 已被删除.", username);
            throw new ServiceException("对不起,您的账号:" + username + " 已被删除");
            throw new ServiceException("对不起,您的账号:" + split[0] + " 已被删除");
        }
        else if (UserStatus.DISABLE.getCode().equals(user.getStatus()))
        {
            log.info("登录用户:{} 已被停用.", username);
            throw new ServiceException("对不起,您的账号:" + username + " 已停用");
            throw new ServiceException("对不起,您的账号:" + split[0] + " 已停用");
        }else if(!user.getOrgid().equals(split[1])){
            log.info("登录用户:{} 不是本院帐号:{}", username,split[1]);
            throw new ServiceException("对不起,您的账号:" + split[0] + " 不是本院的");
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
@@ -220,7 +220,7 @@
    public void dealHisData2() {
        //将患者信息、出院、门诊数据全部采集
        // 指定的开始日期
        LocalDate endDate = LocalDate.of(2024, 9, 1);
        LocalDate endDate = LocalDate.of(2025, 3, 3);
        // 当前日期
        LocalDate currentDate = LocalDate.now();
        // 定义日期格式
@@ -600,7 +600,7 @@
        String filename = null;
        if (cry.equals("0")) filename = "入院信息" + System.currentTimeMillis();
        if (cry.equals("1")) filename = "出院信息" + System.currentTimeMillis();
        File file = new File("D:\\public\\华卓集成平台数据\\" + filename);
        File file = new File("D:\\public\\HIS数据采集\\" + filename);
        if (!file.exists()) {
            // 如果文件不存在,则创建新文件
            try {
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java
@@ -12,6 +12,7 @@
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.constant.UserConstants;
@@ -47,6 +48,10 @@
    @Autowired
    private SysRoleMenuMapper roleMenuMapper;
    @Value("${isAdmin}")
    private List<Long> isAdmin;
    /**
     * 根据用户查询系统菜单列表
     *
@@ -71,7 +76,7 @@
        if (SysUser.isAdmin(userId)) {
            menuList = menuMapper.selectMenuList(menu);
        } else {
            menu.getParams().put("userId" , userId);
            menu.getParams().put("userId", userId);
            menuList = menuMapper.selectMenuListByUserId(menu);
        }
        return menuList;
@@ -122,7 +127,8 @@
    @Override
    public List<SysMenu> selectMenuTreeByUserId(Long userId) {
        List<SysMenu> menus = null;
        if (SecurityUtils.isAdmin(userId)) {
//        if (SecurityUtils.isAdmin(userId)) {
        if (userId != null && isAdmin.contains(userId)) {
            menus = menuMapper.selectMenuTreeAll();
        } else {
            menus = menuMapper.selectMenuTreeByUserId(userId);
@@ -150,7 +156,7 @@
     */
    @Override
    public List<RouterVo> buildMenus(List<SysMenu> menus) {
        log.error("buildMenus的入参为:{}",menus);
        log.error("buildMenus的入参为:{}", menus);
        List<RouterVo> routers = new LinkedList<RouterVo>();
        for (SysMenu menu : menus) {
            RouterVo router = new RouterVo();
@@ -159,7 +165,7 @@
            router.setPath(getRouterPath(menu));
            router.setComponent(getComponent(menu));
            router.setQuery(menu.getQuery());
            router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1" , menu.getIsCache()), menu.getPath()));
            router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath()));
            List<SysMenu> cMenus = menu.getChildren();
            if (!cMenus.isEmpty() && cMenus.size() > 0 && UserConstants.TYPE_DIR.equals(menu.getMenuType())) {
                router.setAlwaysShow(true);
@@ -172,7 +178,7 @@
                children.setPath(menu.getPath());
                children.setComponent(menu.getComponent());
                children.setName(StringUtils.capitalize(menu.getPath()));
                children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1" , menu.getIsCache()), menu.getPath()));
                children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath()));
                children.setQuery(menu.getQuery());
                childrenList.add(children);
                router.setChildren(childrenList);
@@ -191,7 +197,7 @@
            }
            routers.add(router);
        }
        log.error("----------routers的入参为:{}",routers);
        log.error("----------routers的入参为:{}", routers);
        for (RouterVo routerVo : routers) {
            List<String> childName = new ArrayList<>();
            List<RouterVo> childrens = routerVo.getChildren();
@@ -478,6 +484,6 @@
     * @return 替换后的内链域名
     */
    public String innerLinkReplaceEach(String path) {
        return StringUtils.replaceEach(path, new String[]{Constants.HTTP, Constants.HTTPS, Constants.WWW, "."}, new String[]{"" , "" , "" , "/"});
        return StringUtils.replaceEach(path, new String[]{Constants.HTTP, Constants.HTTPS, Constants.WWW, "."}, new String[]{"", "", "", "/"});
    }
}
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
@@ -161,6 +161,7 @@
    public SysUser selectUserByUserName2(String userName) {
        String[] split = userName.split("&");
        SysUser sysUser = userMapper.selectUserByUserNameByCondition(split[0], split[1]);
        if (Objects.isNull(sysUser)) return sysUser;
        List<SysDept> sysDepts = null;
        if (StringUtils.isNotEmpty(split[0]) && split[0].equals("admin")) {
            SysDept dept = new SysDept();
smartor/src/main/java/com/smartor/domain/ExternalInHospPatientInfo.java
@@ -7,6 +7,7 @@
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
 * @author 接收第三方入院患者信息
@@ -66,10 +67,10 @@
    private String XingBieMC;
    @ApiModelProperty(value = "出生日期")
    private Date ChuShengRQ;
    private String ChuShengRQ;
    @ApiModelProperty(value = "年龄")
    private Long NianLing;
    private String NianLing;
    @ApiModelProperty(value = "年龄单位")
    private String NianLingDW;
@@ -162,4 +163,7 @@
    @ApiModelProperty(value = "产妇标志")
    private String ChanFuBZ;
    @ApiModelProperty(value = "联系人信息")
    List<ExternalInHospPatientLiaisonInfo> externalInHospPatientLiaisonInfos;
}
smartor/src/main/java/com/smartor/domain/ExternalOperationDetail.java
@@ -40,4 +40,13 @@
    @ApiModelProperty(value = "手术部位")
    private String ShouShuBW;
    @ApiModelProperty(value = "标准票友")
    private String BiaoZhunBM;
    @ApiModelProperty(value = "手术名称QZ")
    private String ShouShuMCQZ;
    @ApiModelProperty(value = "手术名称HZ")
    private String ShouShuMCHZ;
}
smartor/src/main/java/com/smartor/domain/PatArchive.java
@@ -255,6 +255,9 @@
    @ApiModelProperty("标签集合")
    private List<PatArchivetag> tagList;
    @ApiModelProperty("亲属集合")
    private List<PatArchivecontact> patArchivecontactList;
    /**
     * 标签
     */
@@ -363,4 +366,18 @@
    @Excel(name = "主要照护人年龄")
    private String casePersonAge;
    /**
     * 年龄
     */
    @ApiModelProperty("年龄")
    @Excel(name = " 第二年龄 ")
    private Long age2;
    /**
     * 年龄
     */
    @ApiModelProperty("年龄单位")
    @Excel(name = " 第二年龄单位 ")
    private String ageUnit2;
}
smartor/src/main/java/com/smartor/domain/PatArchiveOthreInfo.java
@@ -186,6 +186,18 @@
    @ApiModelProperty("年龄单位")
    @Excel(name = " 年龄单位 ")
    private String ageUnit;
    /**
     * 年龄
     */
    @ApiModelProperty("年龄")
    @Excel(name = " 年龄 ")
    private Long age2;
    /**
     * 年龄
     */
    @ApiModelProperty("年龄单位")
    @Excel(name = " 年龄单位 ")
    private String ageUnit2;
    /**
     * 建档时间
smartor/src/main/java/com/smartor/domain/PatArchiveReq.java
@@ -169,13 +169,24 @@
    /**
     * 病区编号
     */
    @ApiModelProperty(value = "病区编号")
    @ApiModelProperty(value = "离院病区编号")
    private List<String> leavehospitaldistrictcodes;
    /**
     * 科室编码
     */
    @ApiModelProperty(value = "离院科室编码")
    private List<String> leaveldeptcodes;
    /**
     * 病区编号
     */
    @ApiModelProperty(value = "病区编号")
    private List<String> hospitaldistrictcodes;
    /**
     * 科室编码
     */
    @ApiModelProperty(value = "科室编码")
    @Excel(name = " 科室编码 ")
    private List<String> leaveldeptcodes;
    private List<String> deptcodes;
}
smartor/src/main/java/com/smartor/domain/PatArchivecontact.java
@@ -28,10 +28,10 @@
    private Long id;
    /**
     * 联系方式ID
     * 关联患者ID
     */
    @Excel(name = " 联系方式ID ")
    @ApiModelProperty(value = "联系方式ID")
    @Excel(name = " 关联患者ID ")
    @ApiModelProperty(value = "关联患者ID")
    private Long patid;
    /**
smartor/src/main/java/com/smartor/service/impl/PatArchiveServiceImpl.java
@@ -7,10 +7,7 @@
import com.ruoyi.common.utils.DtoConversionUtils;
import com.ruoyi.common.utils.StringUtils;
import com.smartor.domain.*;
import com.smartor.mapper.BaseTagMapper;
import com.smartor.mapper.PatArchiveMapper;
import com.smartor.mapper.PatArchivetagMapper;
import com.smartor.mapper.ServiceSubtaskMapper;
import com.smartor.mapper.*;
import com.smartor.service.IPatArchiveService;
import com.smartor.service.IPatMedInhospService;
import com.smartor.service.IPatMedOuthospService;
@@ -62,7 +59,7 @@
    private IPatMedInhospService patMedInhospService;
    @Autowired
    private IPatMedOuthospService patMedOuthospService;
    private PatArchivecontactMapper patArchivecontactMapper;
    @Autowired
    private IPatMedPhysicalService patMedPhysicalService;
@@ -605,6 +602,12 @@
            patArchive1.setTagList(stringList.stream().collect(Collectors.toList()));
            patArchives.add(patArchive1);
        }
        //给患者联系人赋值
        for (PatArchive pa : patArchives) {
            PatArchivecontact patArchivecontact = new PatArchivecontact();
            patArchivecontact.setPatid(pa.getId());
            pa.setPatArchivecontactList(patArchivecontactMapper.selectPatArchivecontactList(patArchivecontact));
        }
        return patArchives;
    }
smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java
@@ -7,18 +7,21 @@
import com.smartor.domain.*;
import com.smartor.mapper.*;
import com.smartor.service.IServiceExternalService;
import com.smartor.service.IServiceSubtaskService;
import org.springframework.beans.factory.annotation.Value;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.Period;
import java.time.ZoneId;
import java.time.temporal.ChronoUnit;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@@ -42,6 +45,8 @@
    private BaseOrganizationMapper baseOrganizationMapper;
    @Autowired
    private PatArchiveMapper patArchiveMapper;
    @Autowired
    private PatArchivecontactMapper patArchivecontactMapper;
    @Autowired
    private PatMedInhospMapper patMedInhospMapper;
    @Autowired
@@ -218,6 +223,7 @@
            info.setGuanXiMC((String) map.get("GuanXiMC"));
            return info;
        }).collect(Collectors.toList());
        externalInHospPatientInfo.setExternalInHospPatientLiaisonInfos(epli2);
        List<ExternalInHospPatientDiagnoseInfo> hospPatientDiagnoseInfos2 = hospPatientDiagnoseInfos.stream().map(map -> {
            ExternalInHospPatientDiagnoseInfo info = new ExternalInHospPatientDiagnoseInfo();
@@ -244,7 +250,7 @@
        Map<String, Object> BingRenXX = (Map<String, Object>) yeWuXX.get("BingRenXX");
        ExternalInHospPatientInfo externalInHospPatientInfo = BeanUtil.mapToBean(BingRenXX, ExternalInHospPatientInfo.class, true);
        PatMedInhosp patMedInhosp = new PatMedInhosp();
        patMedInhosp.setInhospno(externalInHospPatientInfo.getZhuYuanHao());
        patMedInhosp.setInhospno(externalInHospPatientInfo.getBingAnHao());
        List<PatMedInhosp> patMedInhospList = patMedInhospMapper.selectPatMedInhospList(patMedInhosp);
        for (PatMedInhosp patMedInhosp1 : patMedInhospList) {
            String tagname = patMedInhospMapper.getTagnameBypatid(patMedInhosp1.getPatid());
@@ -311,7 +317,7 @@
        PatArchive patArchive = addPatArchive(externalInHospPatientInfo, externalInHospPatientAddrInfo, externalInHospPatientLiaisonInfo);
        PatMedInhosp patMedInhosp = new PatMedInhosp();
        patMedInhosp.setInhospno(externalInHospPatientInfo.getZhuYuanHao());
        patMedInhosp.setInhospno(externalInHospPatientInfo.getBingAnHao());
        List<PatMedInhosp> patMedInhospList = patMedInhospMapper.selectPatMedInhospList(patMedInhosp);
        for (PatMedInhosp patMedInhosp1 : patMedInhospList) {
            String tagname = patMedInhospMapper.getTagnameBypatid(patMedInhosp1.getPatid());
@@ -329,6 +335,11 @@
        patMedInhosp1.setOperator(JiuZhenXX.get("CaoZuoRXM").toString());
        patMedInhosp1.setOperatorId(JiuZhenXX.get("CaoZuoRID").toString());
        patMedInhosp1.setUpdateTime(new Date());
        patMedInhosp1.setDrname(ObjectUtils.isNotEmpty(JiuZhenXX.get("ZhuZhiYSXM")) ? JiuZhenXX.get("ZhuZhiYSXM").toString() : null);
        patMedInhosp1.setDrcode(ObjectUtils.isNotEmpty(JiuZhenXX.get("ZhuZhiYSID")) ? JiuZhenXX.get("ZhuZhiYSID").toString() : null);
        patMedInhosp1.setNurseName(ObjectUtils.isNotEmpty(JiuZhenXX.get("ZeRenHSXM")) ? JiuZhenXX.get("ZeRenHSXM").toString() : null);
        patMedInhosp1.setNurseId(ObjectUtils.isNotEmpty(JiuZhenXX.get("ZeRenHSID")) ? JiuZhenXX.get("ZeRenHSID").toString() : null);
        patMedInhosp1.setBedNo(ObjectUtils.isNotEmpty(JiuZhenXX.get("DangQianCWMC")) ? JiuZhenXX.get("DangQianCWMC").toString() : null);
        patMedInhosp1.setTelcode(patArchive.getTelcode());
        patMedInhosp1.setLeavehospitaldistrictcode(externalInHospPatientInfo.getDangQianBQID());
        patMedInhosp1.setLeavehospitaldistrictname(externalInHospPatientInfo.getDangQianBQMC());
@@ -346,7 +357,7 @@
        patMedInhosp1.setLeaveicd10code(StringUtils.isNotEmpty(patMedInhosp1.getLeaveicd10code()) ? patMedInhosp1.getLeaveicd10code() + "," + hospPatientDiagnoseInfos2.get(0).getZhenDuanID() : hospPatientDiagnoseInfos2.get(0).getZhenDuanID());
        patMedInhosp1.setLeavediagname(StringUtils.isNotEmpty(patMedInhosp1.getLeavediagname()) ? patMedInhosp1.getLeavediagname() + "," + hospPatientDiagnoseInfos2.get(0).getZhenDuanMC() : hospPatientDiagnoseInfos2.get(0).getZhenDuanMC());
        patMedInhosp1.setDiagname(StringUtils.isNotEmpty(patMedInhosp1.getLeavediagname()) ? patMedInhosp1.getLeavediagname() + "," + hospPatientDiagnoseInfos2.get(0).getZhenDuanMC() : hospPatientDiagnoseInfos2.get(0).getZhenDuanMC());
        patMedInhosp1.setIcd10code(StringUtils.isNotEmpty(patMedInhosp1.getLeavediagname()) ? patMedInhosp1.getLeavediagname() + "," + hospPatientDiagnoseInfos2.get(0).getZhenDuanMC() : hospPatientDiagnoseInfos2.get(0).getZhenDuanMC());
        //     patMedInhosp1.setIcd10code(StringUtils.isNotEmpty(patMedInhosp1.getLeavediagname()) ? patMedInhosp1.getLeavediagname() + "," + hospPatientDiagnoseInfos2.get(0).getZhenDuanMC() : hospPatientDiagnoseInfos2.get(0).getZhenDuanMC());
        patMedInhosp1.setInhospstate("1");
        if (CollectionUtils.isNotEmpty(patMedInhospList)) {
            patMedInhosp1.setUpdateTime(new Date());
@@ -362,7 +373,7 @@
            patMedInhosp1.setPatname(patArchive.getName());
            patMedInhosp1.setOrgid(BingRenXX.get("ZuZhiJGID").toString());
            patMedInhosp1.setPatno(BingRenXX.get("BingRenID").toString());
            patMedInhosp1.setInhospno(BingRenXX.get("ZhuYuanHao").toString());
            patMedInhosp1.setInhospno(BingRenXX.get("BingAnHao").toString());
            patMedInhosp1.setSerialnum(BingRenXX.get("BingAnHao").toString());
            patMedInhosp1.setCreateTime(new Date());
            int i = patMedInhospMapper.insertPatMedInhosp(patMedInhosp1);
@@ -378,7 +389,7 @@
        Map<String, Object> BingRenXX = (Map<String, Object>) yeWuXX.get("BingRenXX");
        ExternalInHospPatientInfo externalInHospPatientInfo = BeanUtil.mapToBean(BingRenXX, ExternalInHospPatientInfo.class, true);
        PatMedInhosp patMedInhosp = new PatMedInhosp();
        patMedInhosp.setInhospno(externalInHospPatientInfo.getZhuYuanHao());
        patMedInhosp.setInhospno(externalInHospPatientInfo.getBingAnHao());
        List<PatMedInhosp> patMedInhospList = patMedInhospMapper.selectPatMedInhospList(patMedInhosp);
        for (PatMedInhosp patMedInhosp1 : patMedInhospList) {
            String tagname = patMedInhospMapper.getTagnameBypatid(patMedInhosp1.getPatid());
@@ -602,7 +613,7 @@
        patMedOperation.setPatname(externalInHospPatientInfo.getXingMing());
        patMedOperation.setVisitid(null);
        patMedOperation.setSerialnum(externalInHospPatientInfo.getZhuYuanHao());
        patMedOperation.setInhospno(externalInHospPatientInfo.getZhuYuanHao());
        patMedOperation.setInhospno(externalInHospPatientInfo.getBingAnHao());
        patMedOperation.setHospitalname(externalInHospPatientInfo.getZuZhiJGMC());
        patMedOperation.setHospitalcode(externalInHospPatientInfo.getZuZhiJGID());
        patMedOperation.setDeptid(externalOperationInfo.getShouShuKSID());
@@ -625,13 +636,33 @@
                patMedOperation.setDelFlag("1");
                //同时去查询,是否在subtask中生成任务,如果生成出得立马删除
            }
            patMedOperation.setUpdateTime(new Date());
            patMedOperationMapper.updatePatMedOperation(patMedOperation);
        } else patMedOperationMapper.insertPatMedOperation(patMedOperation);
        } else {
            patMedOperation.setCreateTime(new Date());
            patMedOperationMapper.insertPatMedOperation(patMedOperation);
        }
        log.error("-----patMedOperation的主键id为:{}", patMedOperation.getId());
        if (ObjectUtils.isNotEmpty(ssxx)) {
            Map<String, Object> ShouShuMXList = (Map<String, Object>) ssxx.get("ShouShuMXList");
            List<ExternalOperationDetail> externalOperationDetails = BeanUtil.mapToBean(ShouShuMXList, List.class, true);
            List<HashMap<String, Object>> ShouShuMXList = (List<HashMap<String, Object>>) ssxx.get("ShouShuMXList");
            List<ExternalOperationDetail> externalOperationDetails = ShouShuMXList.stream().map(map -> {
                ExternalOperationDetail info = new ExternalOperationDetail();
                info.setShouShuMCID((String) map.get("ShouShuMCID"));
                info.setShouShuMC((String) map.get("ShouShuMC"));
                info.setZhuShouSBZ((String) map.get("ZhuShouSBZ"));
                info.setQieKouLBDM((String) map.get("QieKouLBDM"));
                info.setQieKouLBMC((String) map.get("QieKouLBMC"));
                info.setShouShuJBDM((String) map.get("ShouShuJBDM"));
                info.setShouShuJBMC((String) map.get("ShouShuJBMC"));
                info.setShouShuBW((String) map.get("ShouShuBW"));
                info.setBiaoZhunBM((String) map.get("BiaoZhunBM"));
                info.setShouShuMCQZ((String) map.get("ShouShuMCQZ"));
                info.setShouShuMCHZ((String) map.get("ShouShuMCHZ"));
                return info;
            }).collect(Collectors.toList());
            //addMianTableFalg是否需要将主手术的信息放到PatMedOperation表中(只有第一个主手术信息需要放,后面的都不需要放了,也就是说,第一个放完后,就要把这个flag改成false)
            Boolean addMianTableFalg = true;
            for (ExternalOperationDetail externalOperationDetail : externalOperationDetails) {
@@ -651,10 +682,11 @@
                    patMedOperation.setOpcode(externalOperationDetail.getShouShuMCID());
                    patMedOperation.setOpdesc(externalOperationDetail.getShouShuMC());
//                    patMedOperation.setOpid(externalOperationDetail.getShouShuJBDM());
                    patMedOperation.setUpdateTime(new Date());
                    patMedOperationMapper.updatePatMedOperation(patMedOperation);
                    addMianTableFalg = false;
                }
                patMedOperationItem.setCreateTime(new Date());
                patMedOperationItemMapper.insertPatMedOperationItem(patMedOperationItem);
            }
        }
@@ -663,12 +695,22 @@
    //新增患者基本信息
    private PatArchive addPatArchive(ExternalInHospPatientInfo externalInHospPatientInfo, ExternalInHospPatientAddrInfo externalInHospPatientAddrInfo, ExternalInHospPatientLiaisonInfo externalInHospPatientLiaisonInfo) {
        Date parse = null;
        String chuShengRQ = externalInHospPatientInfo.getChuShengRQ();
        if (StringUtils.isNotEmpty(chuShengRQ)) {
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
            try {
                parse = simpleDateFormat.parse(chuShengRQ);
            } catch (ParseException e) {
                e.printStackTrace();
            }
        }
        PatArchive patArchive = new PatArchive();
        patArchive.setIdcardno(externalInHospPatientInfo.getZhengJianHM());
        patArchive.setOrgid(externalInHospPatientInfo.getZuZhiJGID());
        List<PatArchive> patArchives = patArchiveMapper.selectPatArchiveList(patArchive);
        patArchive.setPatientno(externalInHospPatientInfo.getJiuZhenKH());
        patArchive.setBirthdate(externalInHospPatientInfo.getChuShengRQ());
        patArchive.setBirthdate(parse);
        patArchive.setPatidHis(externalInHospPatientInfo.getBingRenID());
        patArchive.setSourcefrom(1);
        patArchive.setPattype("2");
@@ -687,9 +729,16 @@
            patArchive.setPlaceOfResidence(por.replace("null", ""));
            patArchive.setBirthplace(por.replace("null", ""));
        }
        patArchive.setBirthdate(externalInHospPatientInfo.getChuShengRQ());
        patArchive.setAge(externalInHospPatientInfo.getNianLing());
        patArchive.setAgeUnit(externalInHospPatientInfo.getNianLingDW());
        if (ObjectUtils.isNotEmpty(parse)) {
            Map<String, String> map = calculateAge(parse.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(), LocalDate.now());
            patArchive.setAge(ObjectUtils.isNotEmpty(map.get("age")) ? Long.valueOf(map.get("age")) : null);
            patArchive.setAgeUnit(map.get("ageUnit"));
            patArchive.setAge2(ObjectUtils.isNotEmpty(map.get("age2")) ? Long.valueOf(map.get("age2")) : null);
            patArchive.setAgeUnit2(map.get("ageUnit2"));
        }
        patArchive.setTelcode(externalInHospPatientInfo.getLianXiDH());
        if (StringUtils.isEmpty(externalInHospPatientInfo.getLianXiDH()))
            patArchive.setTelcode(externalInHospPatientInfo.getLianXiRDH());
@@ -697,7 +746,7 @@
        patArchive.setGuid(externalInHospPatientInfo.getZuZhiJGID());
        if (ObjectUtils.isNotEmpty(externalInHospPatientLiaisonInfo))
            patArchive.setRelativetelcode(externalInHospPatientLiaisonInfo.getLianXiRDH());
        patArchive.setInhospno(externalInHospPatientInfo.getZhuYuanHao());
        patArchive.setInhospno(externalInHospPatientInfo.getBingAnHao());
        patArchive.setCreateTime(new Date());
        patArchive.setIdcardtype(externalInHospPatientInfo.getZhengJianLXMC());
        if (CollectionUtils.isNotEmpty(patArchives)) {
@@ -711,6 +760,26 @@
            }
        }
        patArchiveMapper.insertPatArchiveSingle(patArchive);
        //新属信息
        if (ObjectUtils.isNotEmpty(externalInHospPatientInfo.getExternalInHospPatientLiaisonInfos())) {
            for (ExternalInHospPatientLiaisonInfo external : externalInHospPatientInfo.getExternalInHospPatientLiaisonInfos()) {
                PatArchivecontact patArchivecontact = new PatArchivecontact();
                patArchivecontact.setPatid(patArchive.getId());
                patArchivecontact.setContactname(external.getLianXiRXM());
                patArchivecontact.setOrgid(patArchive.getOrgid());
                List<PatArchivecontact> patArchivecontacts = patArchivecontactMapper.selectPatArchivecontactList(patArchivecontact);
                patArchivecontact.setContactway(external.getLianXiRDH());
                patArchivecontact.setRelation(external.getGuanXiMC());
                if (CollectionUtils.isEmpty(patArchivecontacts))
                    patArchivecontactMapper.insertPatArchivecontact(patArchivecontact);
                else {
                    patArchivecontact.setId(patArchivecontacts.get(0).getId());
                    patArchivecontactMapper.updatePatArchivecontact(patArchivecontact);
                }
            }
        }
        return patArchive;
    }
@@ -718,7 +787,8 @@
    private Boolean addPadInhospInfo(ExternalInHospPatientInfo externalInHospPatientInfo, PatArchive patArchive, ExternalInHospPatientDiagnoseInfo externalInHospPatientDiagnoseInfo) {
        PatMedInhosp patMedInhosp = new PatMedInhosp();
        if (ObjectUtils.isNotEmpty(externalInHospPatientInfo)) {
            patMedInhosp.setInhospno(externalInHospPatientInfo.getZhuYuanHao());
            //医院那边说要用病案号,不要用住院号
            patMedInhosp.setInhospno(externalInHospPatientInfo.getBingAnHao());
            patMedInhosp.setSerialnum(externalInHospPatientInfo.getZhuYuanHao());
            patMedInhosp.setHospitalname(externalInHospPatientInfo.getZuZhiJGMC());
            patMedInhosp.setHospitalcode(externalInHospPatientInfo.getZuZhiJGID());
@@ -884,4 +954,56 @@
        return true;
    }
    public Map<String, String> calculateAge(LocalDate birthdate, LocalDate today) {
        if (birthdate == null || today.isBefore(birthdate)) {
            return null;
        }
        Map<String, String> ageMap = new HashMap<>();
        Period period = Period.between(birthdate, today);
        long totalDays = ChronoUnit.DAYS.between(birthdate, today);
        long totalMonths = ChronoUnit.MONTHS.between(birthdate, today);
        int years = period.getYears();
        int months = period.getMonths();
        int days = period.getDays();
        String ageUnit;
        Integer age;
        String ageUnit2 = null;
        Integer age2 = null;
        if (totalDays < 30) {
            // 小于 1 个月,按天计算
            ageUnit = "天";
            age = (int) totalDays;
            ageMap.put("age", age != null ? age.toString() : null);
            ageMap.put("ageUnit", ageUnit);
            ageMap.put("age2", null);
            ageMap.put("ageUnit2", null);
        } else if (totalMonths < 12) {
            // 小于 1 年,按月 + 天计算
            ageUnit = "月";
            age = (int) totalMonths;
            ageUnit2 = "天";
            age2 = days;
            ageMap.put("age", age != null ? age.toString() : null);
            ageMap.put("ageUnit", ageUnit);
            ageMap.put("age2", age2 != null ? age2.toString() : null);
            ageMap.put("ageUnit2", ageUnit2);
        } else {
            // 大于 1 年,按年 + 月计算
            ageUnit = "岁";
            age = years;
            ageUnit2 = "月";
            age2 = months;
            ageMap.put("age", age != null ? age.toString() : null);
            ageMap.put("ageUnit", ageUnit);
            ageMap.put("age2", age2 != null ? age2.toString() : null);
            ageMap.put("ageUnit2", ageUnit2);
        }
        return ageMap;
    }
}
smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
@@ -23,6 +23,7 @@
        <result property="idcardno" column="idcardno"/>
        <result property="birthdate" column="birthdate"/>
        <result property="age" column="age"/>
        <result property="age2" column="age2"/>
        <result property="sourcefrom" column="sourcefrom"/>
        <result property="archivetime" column="archivetime"/>
        <result property="archiveby" column="archiveby"/>
@@ -47,6 +48,7 @@
        <result property="bedNo" column="bedno"/>
        <result property="inhosptime" column="inhosptime"/>
        <result property="ageUnit" column="age_unit"/>
        <result property="ageUnit2" column="age_unit2"/>
        <result property="leavehospitaldistrictname" column="leavehospitaldistrictname"/>
        <result property="leavehospitaldistrictcode" column="leavehospitaldistrictcode"/>
        <result property="careFacilities" column="care_facilities"/>
@@ -80,6 +82,7 @@
        <result property="idcardno" column="idcardno"/>
        <result property="birthdate" column="birthdate"/>
        <result property="age" column="age"/>
        <result property="age2" column="age2"/>
        <result property="sourcefrom" column="sourcefrom"/>
        <result property="archivetime" column="archivetime"/>
        <result property="archiveby" column="archiveby"/>
@@ -105,6 +108,7 @@
        <result property="starttime" column="starttime"/>
        <result property="endtime" column="endtime"/>
        <result property="ageUnit" column="age_unit"/>
        <result property="ageUnit2" column="age_unit2"/>
        <result property="inhospno" column="inhospno"/>
        <result property="nurseId" column="nurse_id"/>
        <result property="nurseName" column="nurse_name"/>
@@ -122,12 +126,14 @@
               patientno,
               patid_his,
               age_unit,
               age_unit2,
               sd_flag,
               name,
               sex,
               idcardno,
               birthdate,
               age,
               age2,
               nation,
               native_place,
               place_of_residence,
@@ -179,6 +185,9 @@
            <if test="patidHis != null ">and patid_his = #{patidHis}</if>
            <if test="sdFlag != null ">and sd_flag = #{sdFlag}</if>
            <if test="ageUnit != null ">and age_unit = #{ageUnit}</if>
            <if test="age != null ">and age = #{age}</if>
            <if test="age2 != null ">and age2 = #{age2}</if>
            <if test="ageUnit2 != null ">and age_unit2 = #{ageUnit2}</if>
            <if test="notrequiredFlag != null ">and notrequired_flag = #{notrequiredFlag}</if>
            <if test="notrequiredreason != null ">and notrequiredreason = #{notrequiredreason}</if>
            <if test="careFacilities != null ">and care_facilities = #{careFacilities}</if>
@@ -197,6 +206,7 @@
        select
        a.id,
        a.age_unit,
        a.age_unit2,
        a.notrequired_flag,
        a.notrequiredreason,
        a.patientno,
@@ -208,6 +218,7 @@
        a.idcardtype,
        a.idcardno,
        a.age,
        a.age2,
        a.telcode,
        a.create_time,
        a.update_time,
@@ -262,6 +273,7 @@
            <if test="guid != null">guid,</if>
            <if test="birthdate != null">birthdate,</if>
            <if test="age != null">age,</if>
            <if test="age2 != null">age2,</if>
            <if test="sourcefrom != null">sourcefrom,</if>
            <if test="archivetime != null">archivetime,</if>
            <if test="archiveby != null">archiveby,</if>
@@ -278,6 +290,7 @@
            <if test="isupload != null">isupload,</if>
            <if test="uploadTime != null">upload_time,</if>
            <if test="ageUnit != null">age_unit,</if>
            <if test="ageUnit2 != null">age_unit2,</if>
            <if test="notrequiredFlag != null ">notrequired_flag,</if>
            <if test="notrequiredreason != null ">notrequiredreason,</if>
            <if test="careFacilities != null ">care_facilities,</if>
@@ -307,6 +320,7 @@
            <if test="guid != null">#{guid},</if>
            <if test="birthdate != null">#{birthdate},</if>
            <if test="age != null">#{age},</if>
            <if test="age2 != null">#{age2},</if>
            <if test="sourcefrom != null">#{sourcefrom},</if>
            <if test="archivetime != null">#{archivetime},</if>
            <if test="archiveby != null">#{archiveby},</if>
@@ -323,6 +337,7 @@
            <if test="isupload != null">#{isupload},</if>
            <if test="uploadTime != null">#{uploadTime},</if>
            <if test="ageUnit != null">#{ageUnit},</if>
            <if test="ageUnit2 != null">#{ageUnit2},</if>
            <if test="notrequiredFlag != null ">#{notrequiredFlag},</if>
            <if test="notrequiredreason != null ">#{notrequiredreason},</if>
            <if test="careFacilities != null ">#{careFacilities},</if>
@@ -338,15 +353,15 @@
    <insert id="insertPatArchive">
        insert into
        pat_archive(name,viptype,sex,idcardno,birthdate,place_of_residence,age,sourcefrom,archivetime,archiveby,telcode,relativetelcode,idcardtype,orgid,openid,dduserid,update_by,update_time
        ,create_by,create_time,isupload,upload_time,pattype,nation,birthplace,native_place,patientno,patid_his,sd_flag,age_unit,notrequired_flag,notrequiredreason,care_facilities,case_path,
        pat_archive(name,viptype,sex,idcardno,birthdate,place_of_residence,age,age2,sourcefrom,archivetime,archiveby,telcode,relativetelcode,idcardtype,orgid,openid,dduserid,update_by,update_time
        ,create_by,create_time,isupload,upload_time,pattype,nation,birthplace,native_place,patientno,patid_his,sd_flag,age_unit,age_unit2,notrequired_flag,notrequiredreason,care_facilities,case_path,
        degree_of_education,marital_status,income,medicare_type,care_person,case_person_age)
        values
        <foreach item="item" index="index" collection="list" separator=",">
            (#{item.name},#{item.viptype},#{item.sex},#{item.idcardno},#{item.birthdate},#{item.placeOfResidence},#{item.age},#{item.sourcefrom},#{item.archivetime},#{item.archiveby}
            (#{item.name},#{item.viptype},#{item.sex},#{item.idcardno},#{item.birthdate},#{item.placeOfResidence},#{item.age},#{item.age2},#{item.sourcefrom},#{item.archivetime},#{item.archiveby}
            ,#{item.telcode},#{item.archiveby},#{item.idcardtype},#{item.orgid},#{item.openid},#{item.dduserid},#{item.updateBy},
            #{item.updateTime},#{item.createBy},#{item.createTime},#{item.isupload},#{item.uploadTime},#{item.pattype},#{item.nation},#{item.birthplace},#{item.nativePlace},#{item.patientno},
            #{item.patidHis},#{item.sdFlag},#{item.ageUnit},#{item.notrequiredFlag},#{item.notrequiredreason}
            #{item.patidHis},#{item.sdFlag},#{item.ageUnit},#{item.ageUnit2},#{item.notrequiredFlag},#{item.notrequiredreason}
            ,#{item.careFacilities},#{item.casePath},#{item.degreeOfEducation},#{item.maritalStatus},#{item.income},#{item.medicareType},#{item.carePerson},#{item.casePersonAge})
        </foreach>
    </insert>
@@ -361,6 +376,7 @@
            <if test="placeOfResidence != null">place_of_residence = #{placeOfResidence},</if>
            <if test="birthplace != null">birthplace = #{birthplace},</if>
            <if test="age != null">age = #{age},</if>
            <if test="age2 != null">age2 = #{age2},</if>
            <if test="sourcefrom != null">sourcefrom = #{sourcefrom},</if>
            <if test="archivetime != null">archivetime = #{archivetime},</if>
            <if test="archiveby != null">archiveby = #{archiveby},</if>
@@ -381,6 +397,7 @@
            <if test="viptype != null">patid_his = #{patidHis},</if>
            <if test="viptype != null">sd_flag = #{sdFlag},</if>
            <if test="ageUnit != null">age_unit = #{ageUnit},</if>
            <if test="ageUnit2 != null">age_unit2 = #{ageUnit2},</if>
            <if test="notrequiredFlag != null ">notrequired_flag = #{notrequiredFlag},</if>
            <if test="notrequiredreason != null ">notrequiredreason = #{notrequiredreason},</if>
            <if test="careFacilities != null ">care_facilities = #{careFacilities},</if>
@@ -396,18 +413,20 @@
        where id = #{id}
    </update>
    <delete id="deletePatArchiveByPatid" parameterType="Long">
        delete
        from pat_archive
    <update id="deletePatArchiveByPatid" parameterType="Long">
        update pat_archive
        <trim prefix="SET" suffixOverrides=",">
            del_flag =1
        </trim>
        where id = #{id}
    </delete>
    </update>
    <delete id="deletePatArchiveByPatids" parameterType="String">
        delete from pat_archive where id in
    <update id="deletePatArchiveByPatids" parameterType="String">
        update pat_archive set del_flag =1 where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    </update>
    <select id="selectPatArchiveInfoByAllhosp" parameterType="com.smartor.domain.PatArchiveReq"
            resultMap="PatArchiveOthreInfoResult">
@@ -415,6 +434,7 @@
        SELECT
        a.id,
        a.age_unit,
        a.age_unit2,
        a.patid_his,
        a.notrequired_flag,
        a.notrequiredreason,
@@ -428,6 +448,7 @@
        a.birthplace,
        a.idcardno,
        a.birthdate,
        a.age2,
        a.age,
        a.sourcefrom,
        a.archivetime,
@@ -476,6 +497,7 @@
        select
        a.id,
        a.age_unit,
        a.age_unit2,
        a.inhospno,
        a.notrequired_flag,
        a.notrequiredreason,
@@ -495,6 +517,7 @@
        a.idcardno,
        a.birthdate,
        a.age,
        a.age2,
        a.sourcefrom,
        a.archivetime,
        a.archiveby,
@@ -577,6 +600,21 @@
                    #{leaveldeptcode}
                </foreach>
            </if>
            <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size()>0">
                AND d.hospitaldistrictcode IN
                <foreach collection="hospitaldistrictcodes" item="hospitaldistrictcode" open="(" separator=","
                         close=")">
                    #{hospitaldistrictcode}
                </foreach>
            </if>
            <if test="deptcodes != null and deptcodes.size() > 0">
                AND d.deptcode IN
                <foreach collection="deptcodes" item="deptcode" open="(" separator=","
                         close=")">
                    #{deptcode}
                </foreach>
            </if>
            <if test="pids != null">
                AND a.id NOT IN
                <foreach collection="pids" item="pid" open="(" separator="," close=")">
@@ -596,6 +634,7 @@
        select
        a.id,
        a.age_unit,
        a.age_unit2,
        a.patid_his,
        a.sd_flag,
        a.patientno,
@@ -614,6 +653,7 @@
        a.idcardno,
        a.birthdate,
        a.age,
        a.age2,
        a.viptype,
        a.sourcefrom,
        a.archivetime,
@@ -680,6 +720,7 @@
        select
        a.id,
        a.age_unit,
        a.age_unit2,
        a.name,
        a.notrequired_flag,
        a.notrequiredreason,
@@ -699,6 +740,7 @@
        a.idcardno,
        a.birthdate,
        a.age,
        a.age2,
        a.sourcefrom,
        a.archivetime,
        a.archiveby,
@@ -766,6 +808,7 @@
        distinct a.idcardno,
        a.id,
        a.age_unit,
        a.age_unit2,
        a.inhospno,
        a.notrequired_flag,
        a.notrequiredreason,
@@ -784,6 +827,7 @@
        a.birthplace,
        a.birthdate,
        a.age,
        a.age2,
        a.sourcefrom,
        a.archivetime,
        a.archiveby,
@@ -885,6 +929,7 @@
        distinct a.idcardno,
        a.id,
        a.age_unit,
        a.age_unit2,
        a.patid_his,
        a.sd_flag,
        a.patientno,
@@ -902,6 +947,7 @@
        a.birthplace,
        a.birthdate,
        a.age,
        a.age2,
        a.viptype,
        a.sourcefrom,
        a.archivetime,
@@ -969,6 +1015,7 @@
        distinct a.idcardno,
        a.id,
        a.age_unit,
        a.age_unit2,
        a.name,
        a.notrequired_flag,
        a.notrequiredreason,
@@ -987,6 +1034,7 @@
        a.viptype,
        a.birthdate,
        a.age,
        a.age2,
        a.sourcefrom,
        a.archivetime,
        a.archiveby,
smartor/src/main/resources/mapper/smartor/PatArchivecontactMapper.xml
@@ -1,56 +1,78 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.smartor.mapper.PatArchivecontactMapper">
    <resultMap type="com.smartor.domain.PatArchivecontact" id="PatArchivecontactResult">
        <result property="id"    column="id"    />
        <result property="patid"    column="patid"    />
        <result property="contactway"    column="contactway"    />
        <result property="relation"    column="relation"    />
        <result property="datasource"    column="datasource"    />
        <result property="isdefault"    column="isdefault"    />
        <result property="orgid"    column="orgid"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="isupload"    column="isupload"    />
        <result property="uploadTime"    column="upload_time"    />
        <result property="contactname"    column="contactname"    />
        <result property="pid"    column="pid"    />
        <result property="guid"    column="guid"    />
        <result property="id" column="id"/>
        <result property="patid" column="patid"/>
        <result property="contactway" column="contactway"/>
        <result property="relation" column="relation"/>
        <result property="datasource" column="datasource"/>
        <result property="isdefault" column="isdefault"/>
        <result property="orgid" column="orgid"/>
        <result property="delFlag" column="del_flag"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="isupload" column="isupload"/>
        <result property="uploadTime" column="upload_time"/>
        <result property="contactname" column="contactname"/>
        <result property="pid" column="pid"/>
        <result property="guid" column="guid"/>
    </resultMap>
    <sql id="selectPatArchivecontactVo">
        select id, patid, contactway, relation, datasource, isdefault, orgid, del_flag, update_by, update_time, create_by, create_time, isupload, upload_time, contactname, pid, guid from pat_archivecontact
        select id,
               patid,
               contactway,
               relation,
               datasource,
               isdefault,
               orgid,
               del_flag,
               update_by,
               update_time,
               create_by,
               create_time,
               isupload,
               upload_time,
               contactname,
               pid,
               guid
        from pat_archivecontact
    </sql>
    <select id="selectPatArchivecontactList" parameterType="com.smartor.domain.PatArchivecontact" resultMap="PatArchivecontactResult">
    <select id="selectPatArchivecontactList" parameterType="com.smartor.domain.PatArchivecontact"
            resultMap="PatArchivecontactResult">
        <include refid="selectPatArchivecontactVo"/>
        <where>
            <if test="patid != null "> and patid = #{patid}</if>
            <if test="contactway != null  and contactway != ''"> and contactway = #{contactway}</if>
            <if test="relation != null "> and relation = #{relation}</if>
            <if test="datasource != null "> and datasource = #{datasource}</if>
            <if test="isdefault != null "> and isdefault = #{isdefault}</if>
            <if test="orgid != null  and orgid != ''"> and orgid = #{orgid}</if>
            <if test="isupload != null "> and isupload = #{isupload}</if>
            <if test="uploadTime != null "> and upload_time = #{uploadTime}</if>
            <if test="contactname != null  and contactname != ''"> and contactname like concat('%', #{contactname}, '%')</if>
            <if test="pid != null "> and pid = #{pid}</if>
            <if test="guid != null  and guid != ''"> and guid = #{guid}</if>
        <where>
            del_flag=0
            <if test="patid != null ">and patid = #{patid}</if>
            <if test="contactway != null  and contactway != ''">and contactway = #{contactway}</if>
            <if test="relation != null ">and relation = #{relation}</if>
            <if test="datasource != null ">and datasource = #{datasource}</if>
            <if test="isdefault != null ">and isdefault = #{isdefault}</if>
            <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
            <if test="isupload != null ">and isupload = #{isupload}</if>
            <if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
            <if test="contactname != null  and contactname != ''">and contactname like concat('%', #{contactname},
                '%')
            </if>
            <if test="pid != null ">and pid = #{pid}</if>
            <if test="guid != null  and guid != ''">and guid = #{guid}</if>
        </where>
    </select>
    <select id="selectPatArchivecontactById" parameterType="Long" resultMap="PatArchivecontactResult">
        <include refid="selectPatArchivecontactVo"/>
        where id = #{id}
    </select>
    <insert id="insertPatArchivecontact" parameterType="com.smartor.domain.PatArchivecontact" useGeneratedKeys="true" keyProperty="id">
    <insert id="insertPatArchivecontact" parameterType="com.smartor.domain.PatArchivecontact" useGeneratedKeys="true"
            keyProperty="id">
        insert into pat_archivecontact
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="patid != null">patid,</if>
@@ -69,7 +91,7 @@
            <if test="contactname != null">contactname,</if>
            <if test="pid != null">pid,</if>
            <if test="guid != null">guid,</if>
         </trim>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="patid != null">#{patid},</if>
            <if test="contactway != null">#{contactway},</if>
@@ -87,7 +109,7 @@
            <if test="contactname != null">#{contactname},</if>
            <if test="pid != null">#{pid},</if>
            <if test="guid != null">#{guid},</if>
         </trim>
        </trim>
    </insert>
    <update id="updatePatArchivecontact" parameterType="com.smartor.domain.PatArchivecontact">
@@ -113,14 +135,18 @@
        where id = #{id}
    </update>
    <delete id="deletePatArchivecontactById" parameterType="Long">
        delete from pat_archivecontact where id = #{id}
    </delete>
    <update id="deletePatArchivecontactById" parameterType="Long">
        update pat_archivecontact
        <trim prefix="SET" suffixOverrides=",">
            del_flag =1
        </trim>
        where id = #{id}
    </update>
    <delete id="deletePatArchivecontactByIds" parameterType="String">
        delete from pat_archivecontact where id in
    <update id="deletePatArchivecontactByIds" parameterType="String">
        update pat_archivecontact set del_flag =1 where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>
    </update>
</mapper>
smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
@@ -189,18 +189,18 @@
            AND b.del_flag = 0
            AND a.idcardno IS NOT NULL
            <if test="startOutHospTime != null">
                AND TO_DATE(b.endtime,'YYYY-MM-DD') &gt;= TO_DATE(#{startOutHospTime},'YYYY-MM-DD')
                AND STR_TO_DATE(b.endtime,'%Y-%m-%d') &gt;= STR_TO_DATE(#{startOutHospTime},'%Y-%m-%d')
            </if>
            <if test="endOutHospTime != null">
                AND TO_DATE(b.endtime,'YYYY-MM-DD') &lt;= TO_DATE(#{endOutHospTime},'YYYY-MM-DD')
                AND STR_TO_DATE(b.endtime,'%Y-%m-%d') &lt;= STR_TO_DATE(#{endOutHospTime},'%Y-%m-%d')
            </if>
            <if test="tagname != null  and tagname != ''">and c.tagname like concat('%', #{tagname}, '%')</if>
            <if test="startInHospTime != null">
                AND TO_DATE(b.starttime, 'YYYY-MM-DD') >= TO_DATE(#{startInHospTime}, 'YYYY-MM-DD')
                AND STR_TO_DATE(b.starttime, '%Y-%m-%d') >= STR_TO_DATE(#{startInHospTime}, '%Y-%m-%d')
            </if>
            <if test="endInHospTime != null">
                AND TO_DATE(b.starttime, 'YYYY-MM-DD') &lt;= TO_DATE(#{startInHospTime}, 'YYYY-MM-DD')
                AND STR_TO_DATE(b.starttime, '%Y-%m-%d') &lt;= STR_TO_DATE(#{startInHospTime}, '%Y-%m-%d')
            </if>
            <if test="hospitalname != null  and hospitalname != ''">and hospitalname like concat('%', #{hospitalname},
                '%')