| | |
| | | package com.smartor.service.impl; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import com.google.gson.Gson; |
| | | import com.ruoyi.common.core.domain.entity.SysDept; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.domain.entity.SysUserDept; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | |
| | | 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; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | private SysDept2Mapper sysDeptMapper; |
| | | @Autowired |
| | | private SysUser2Mapper sysUserMapper; |
| | | @Autowired |
| | | private SysUserDeptMapper sysUserDeptMapper; |
| | | @Autowired |
| | | private BaseOrganizationMapper baseOrganizationMapper; |
| | | @Autowired |
| | |
| | | @Value("${defaultPwd}") |
| | | private String defaultPwd; |
| | | |
| | | @Value("${noLongTask}") |
| | | private List<String> noLongTask; |
| | | |
| | | public Boolean generalInterface(Map dataMap) { |
| | | Map XiaoXiTou = (Map) dataMap.get("XiaoXiTou"); |
| | | String xiaoXiLX = XiaoXiTou.get("XiaoXiLX").toString(); |
| | |
| | | } |
| | | SysDept sysDept = new SysDept(); |
| | | sysDept.setOrgid(externalDept.getZuZhiJGID()); |
| | | //丽水无院区,默认值是 1 |
| | | sysDept.setCampusid("1"); |
| | | sysDept.setHisDeptId(externalDept.getKeShiID()); |
| | | sysDept.setHisParentId(externalDept.getFuKeSID()); |
| | | //通过his的父科室ID去找到科室ID,填充parentId |
| | |
| | | } |
| | | if (StringUtils.isNotEmpty(externalDept.getShiJianDM()) && externalDept.getShiJianDM().equals("1")) { |
| | | int i = sysDeptMapper.insertDept(sysDept); |
| | | log.info("ServiceExternalServiceImpl---addDeptInfo是否新增成功:{}", i); |
| | | log.info("ServiceExternalServiceImpl---addDeptInfo01是否新增成功:{}", i); |
| | | } else { |
| | | int i = sysDeptMapper.updateDept(sysDept); |
| | | log.info("ServiceExternalServiceImpl---addDeptInfo是否修改成功:{}", i); |
| | | log.info("ServiceExternalServiceImpl---addDeptInfo02是否修改成功:{}", i); |
| | | } |
| | | return true; |
| | | } |
| | |
| | | log.info("ServiceExternalServiceImpl---addUserInfo的新增的值为:{}", dataMap); |
| | | Map yeWuXX = (Map) dataMap.get("YeWuXX"); |
| | | Map<String, Object> yongHuXX = (Map<String, Object>) yeWuXX.get("YongHuXX"); |
| | | |
| | | ExternalUserInfo externalUserInfo = BeanUtil.mapToBean(yongHuXX, ExternalUserInfo.class, true); |
| | | if (ObjectUtils.isEmpty(externalUserInfo)) { |
| | | throw new BaseException("externalUserInfo是空的,没有数据!!!"); |
| | |
| | | SysUser sysUser = new SysUser(); |
| | | sysUser.setUserName(externalUserInfo.getYongHuDLM()); |
| | | sysUser.setOrgid(externalUserInfo.getZuZhiJGID()); |
| | | //丽水无院区,默认值是 1 |
| | | sysUser.setCampusid("1"); |
| | | //根据userName判断一下,是不是之前有新增 |
| | | SysUser sysUser1 = sysUserMapper.selectUserByUserName(externalUserInfo.getYongHuDLM()); |
| | | |
| | | SysUser sysUser1 = null; |
| | | List<SysUser> sysUserList = sysUserMapper.selectUserList(sysUser); |
| | | if (CollectionUtils.isNotEmpty(sysUserList)) { |
| | | sysUser1 = sysUserList.get(0); |
| | | if (sysUserList.size() > 1) sysUser1 = getUser(sysUserList); |
| | | } |
| | | sysUser.setGuid(externalUserInfo.getZuZhiJGID()); |
| | | sysUser.setNickName(externalUserInfo.getYongHuXM()); |
| | | sysUser.setUserType(""); |
| | | sysUser.setDeptId(null); |
| | | sysUser.setTitle(null); |
| | | |
| | | BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); |
| | | sysUser.setPassword(passwordEncoder.encode(defaultPwd)); |
| | | |
| | | sysUser.setHisUserId(externalUserInfo.getYongHuID()); |
| | | sysUser.setPhonenumber(externalUserInfo.getLianXiDH()); |
| | |
| | | } |
| | | sysUser.setBirthday(externalUserInfo.getChuShengRQ()); |
| | | if (ObjectUtils.isEmpty(sysUser1)) { |
| | | BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); |
| | | sysUser.setPassword(passwordEncoder.encode(defaultPwd)); |
| | | int i = sysUserMapper.insertUser(sysUser); |
| | | log.info("ServiceExternalServiceImpl---addDeptInfo是否新增成功:{}", i); |
| | | } else { |
| | | sysUser.setUserId(sysUser1.getUserId()); |
| | | int i = sysUserMapper.updateUser(sysUser); |
| | | log.info("ServiceExternalServiceImpl---addDeptInfo是否修改成功:{}", i); |
| | | log.info("ServiceExternalServiceImpl---addDeptInfo是否修改成功03:{}", i); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean addUserDeptInfo(Map dataMap) { |
| | | log.info("ServiceExternalServiceImpl---addUserDeptInfo的新增的值为:{}", dataMap); |
| | | Map yeWuXX = (Map) dataMap.get("YeWuXX"); |
| | | Map<String, Object> keShiYH = (Map<String, Object>) yeWuXX.get("KeShiYH"); |
| | | |
| | | ExternalUserDeptInfo externalUserDeptInfo = BeanUtil.mapToBean(keShiYH, ExternalUserDeptInfo.class, true); |
| | | if (ObjectUtils.isEmpty(externalUserDeptInfo)) { |
| | | throw new BaseException("externalUserDeptInfo是空的,没有数据!!!"); |
| | | } |
| | | |
| | | //获取当前用户Name对应的user信息 |
| | | SysUser sysUser = null; |
| | | SysUser sysUserVo = new SysUser(); |
| | | sysUserVo.setUserName(externalUserDeptInfo.getYongHuDLM()); |
| | | sysUserVo.setOrgid(externalUserDeptInfo.getZuZhiJGID()); |
| | | //丽水无院区,默认值是 1 |
| | | sysUserVo.setCampusid("1"); |
| | | //根据userName判断一下,是不是之前有新增 |
| | | List<SysUser> sysUserList = sysUserMapper.selectUserList(sysUserVo); |
| | | if (CollectionUtils.isNotEmpty(sysUserList)) { |
| | | sysUser = sysUserList.get(0); |
| | | } |
| | | |
| | | //获取当前科室hisDeptId对应的dept信息 |
| | | SysDept sysDept = null; |
| | | SysDept sysDeptVo = new SysDept(); |
| | | sysDeptVo.setOrgid(externalUserDeptInfo.getZuZhiJGID()); |
| | | //丽水无院区,默认值是 1 |
| | | sysDeptVo.setCampusid("1"); |
| | | sysDeptVo.setHisDeptId(externalUserDeptInfo.getKeShiID()); |
| | | List<SysDept> sysDepts = sysDeptMapper.selectDeptList(sysDeptVo); |
| | | if (CollectionUtils.isNotEmpty(sysDepts)) { |
| | | sysDept = sysDepts.get(0); |
| | | } |
| | | if(ObjectUtils.isEmpty(sysUser)){ |
| | | log.error("ServiceExternalServiceImpl---addUserDeptInfo 找不到对应的用户 username: {}", externalUserDeptInfo.getYongHuDLM()); |
| | | return false; |
| | | }else if(ObjectUtils.isEmpty(sysDept)){ |
| | | log.error("ServiceExternalServiceImpl---addUserDeptInfo 找不到对应的科室 hisDeptId: {}", externalUserDeptInfo.getKeShiID()); |
| | | return false; |
| | | }else { |
| | | SysUserDept sysUserDept = new SysUserDept(); |
| | | sysUserDept.setDelFlag(0L); |
| | | sysUserDept.setUserId(sysUser.getUserId()); |
| | | sysUserDept.setUserCode(sysUser.getUserCode()); |
| | | sysUserDept.setDeptType("2"); |
| | | sysUserDept.setGuid(externalUserDeptInfo.getZuZhiJGID()); |
| | | sysUserDept.setDeptId(sysDept.getDeptId()); |
| | | sysUserDept.setDeptCode(sysDept.getDeptCode()); |
| | | sysUserDept.setDeptName(sysDept.getDeptName()); |
| | | sysUserDept.setOrgid(externalUserDeptInfo.getZuZhiJGID()); |
| | | sysUserDept.setCampusid("1"); |
| | | |
| | | sysUserDept.setCreateBy(externalUserDeptInfo.getChuangJianRXM()); |
| | | sysUserDept.setCreateTime(externalUserDeptInfo.getChuangJianSJ()); |
| | | sysUserDept.setUpdateTime(externalUserDeptInfo.getXiuGaiSJ()); |
| | | sysUserDept.setUpdateBy(externalUserDeptInfo.getXiuGaiRXM()); |
| | | |
| | | if (StringUtils.isNotEmpty(externalUserDeptInfo.getShiJianDM()) && externalUserDeptInfo.getShiJianDM().equals("3")) { |
| | | sysUserDept.setDelFlag(1L); |
| | | } |
| | | SysUserDept sysUserDeptVo = new SysUserDept(); |
| | | sysUserDeptVo.setUserId(sysUser.getUserId()); |
| | | sysUserDeptVo.setDeptId(sysDept.getDeptId()); |
| | | sysUserDeptVo.setOrgid(externalUserDeptInfo.getZuZhiJGID()); |
| | | //丽水无院区,默认值是 1 |
| | | sysUserDeptVo.setCampusid("1"); |
| | | //根据userName判断一下,是不是之前有新增 |
| | | SysUserDept sysUserDeptOld = null; |
| | | List<SysUserDept> sysUserDeptList = sysUserDeptMapper.selectSysUserDeptList(sysUserDeptVo); |
| | | if (CollectionUtils.isNotEmpty(sysUserDeptList)) { |
| | | sysUserDeptOld = sysUserDeptList.get(0); |
| | | } |
| | | if (ObjectUtils.isEmpty(sysUserDeptOld)) { |
| | | int i = sysUserDeptMapper.insertSysUserDept(sysUserDept); |
| | | log.info("ServiceExternalServiceImpl---addUserDeptInfo是否新增成功:{}", i); |
| | | } else { |
| | | sysUserDept.setUserId(sysUserDeptOld.getUserId()); |
| | | int i = sysUserDeptMapper.updateSysUserDept(sysUserDept); |
| | | log.info("ServiceExternalServiceImpl---addUserDeptInfo是否修改成功03:{}", i); |
| | | } |
| | | //更新sys-user deptId |
| | | if(StringUtils.isNotEmpty(externalUserDeptInfo.getKeShiID())){ |
| | | sysUser.setDeptId(Long.valueOf(externalUserDeptInfo.getKeShiID())); |
| | | //查询用户科室关系 |
| | | SysUserDept sysUserDeptTemp = new SysUserDept(); |
| | | sysUserDeptTemp.setUserId(sysUser.getUserId()); |
| | | sysUserDeptTemp.setOrgid(externalUserDeptInfo.getZuZhiJGID()); |
| | | List<SysUserDept> sysUserDepts = sysUserDeptMapper.selectSysUserDeptList(sysUserDeptTemp); |
| | | List<String> userDepts = sysUserDepts.stream().map(SysUserDept::getDeptCode). |
| | | distinct().collect(Collectors.toList()); |
| | | //和queryHospUserInfoList采集的数据格式保持一致 |
| | | List<List<String>> userDeptsList = new ArrayList<>(); |
| | | if(!sysUserDeptList.isEmpty()){ |
| | | for(String userDept: userDepts){ |
| | | List<String> uDept = new ArrayList<>(); |
| | | uDept.add(userDept); |
| | | userDeptsList.add(uDept); |
| | | } |
| | | } |
| | | //将部门我病区放到指定字段中 |
| | | Gson gson = new Gson(); |
| | | sysUser.setHospInfo(gson.toJson(userDeptsList)); |
| | | |
| | | sysUserMapper.updateUser(sysUser); |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | private SysUser getUser(List<SysUser> sysUserList) { |
| | | SysUser sysUser = null; |
| | | if (CollectionUtils.isNotEmpty(sysUserList) && sysUserList.size() > 1) { |
| | | // 按create_time降序排序,获取最新的记录 |
| | | List<SysUser> sortedList = sysUserList.stream().sorted(Comparator.comparing(SysUser::getCreateTime).reversed()).collect(Collectors.toList()); |
| | | |
| | | // 第一条(最新的)赋值给sysUser1 |
| | | sysUser = sortedList.get(0); |
| | | |
| | | // 获取需要删除的ID(从第二条开始) |
| | | List<Long> idsToDelete = sortedList.stream().skip(1).map(SysUser::getUserId).collect(Collectors.toList()); |
| | | Long[] idArray = idsToDelete.toArray(new Long[0]); |
| | | // 批量删除其他记录 |
| | | if (!idsToDelete.isEmpty()) { |
| | | sysUserMapper.deleteUserByIds(idArray); |
| | | } |
| | | } |
| | | return sysUser; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean addOrganInfo(Map dataMap) { |
| | |
| | | baseOrganization.setUpdateTime(externalOrganInfo.getUpdateTime()); |
| | | baseOrganization.setUpdateBy(externalOrganInfo.getUpdateBy()); |
| | | baseOrganization.setOrgid(externalOrganInfo.getZuZhiJGID()); |
| | | //丽水无院区,默认值是 1 |
| | | baseOrganization.setCampusid("1"); |
| | | if (StringUtils.isNotEmpty(externalOrganInfo.getShiJianDM()) && externalOrganInfo.getShiJianDM().equals("1")) { |
| | | int i = baseOrganizationMapper.insertBaseOrganization(baseOrganization); |
| | | log.info("ServiceExternalServiceImpl---addOrganInfo是否新增成功:{}", i); |
| | |
| | | externalInHospPatientInfo.setZhuZhiYSID(externalInDeptPatientInfo.getZhuZhiYSID()); |
| | | externalInHospPatientInfo.setZhuZhiYSXM(externalInDeptPatientInfo.getZhuZhiYSXM()); |
| | | externalInHospPatientInfo.setRuYuanSJ(externalInDeptPatientInfo.getRuYuanSJ()); |
| | | externalInHospPatientInfo.setJingGuanYSID(externalInDeptPatientInfo.getJingGuanYSID()); |
| | | externalInHospPatientInfo.setJingGuanYSXM(externalInDeptPatientInfo.getJingGuanYSXM()); |
| | | externalInHospPatientInfo.setLianXiDH(ObjectUtils.isNotEmpty(BingRenXX.get("LianXiDH")) ? BingRenXX.get("LianXiDH").toString() : null); |
| | | externalInHospPatientInfo.setDangQianCWID(ObjectUtils.isNotEmpty(BingRenXX.get("DangQianCWID")) ? BingRenXX.get("DangQianCWID").toString() : null); |
| | | externalInHospPatientInfo.setDangQianCWMC(ObjectUtils.isNotEmpty(BingRenXX.get("DangQianCWMC")) ? BingRenXX.get("DangQianCWMC").toString() : null); |
| | |
| | | PatArchive patArchive = addPatArchive(externalInHospPatientInfo, externalInHospPatientAddrInfo, externalInHospPatientLiaisonInfo); |
| | | |
| | | |
| | | |
| | | |
| | | PatMedInhosp patMedInhosp = new PatMedInhosp(); |
| | | patMedInhosp.setInhospno(externalInHospPatientInfo.getBingAnHao()); |
| | | patMedInhosp.setSerialnum(externalInHospPatientInfo.getJiuZhenYWID()); |
| | |
| | | if (CollectionUtils.isNotEmpty(patMedInhospList)) { |
| | | patMedInhosp1.setUpdateTime(new Date()); |
| | | patMedInhosp1.setOrgid(ObjectUtils.isNotEmpty(BingRenXX) && ObjectUtils.isNotEmpty(BingRenXX.get("ZuZhiJGID")) ? BingRenXX.get("ZuZhiJGID").toString() : null); |
| | | //丽水无院区,默认值是 1 |
| | | patMedInhosp1.setCampusid("1"); |
| | | if (CollectionUtils.isNotEmpty(noLongTask) && noLongTask.contains(patMedInhosp1.getOrgid())) { |
| | | //不需要长期任务随访 |
| | | patMedInhosp1.setFuflag("1"); |
| | | } |
| | | int i = patMedInhospMapper.updatePatMedInhosp(patMedInhosp1); |
| | | if (i != 1) return false; |
| | | } else { |
| | |
| | | patMedInhosp1.setLeavehospitaldistrictname(ObjectUtils.isNotEmpty(BingRenXX.get("DangQianBQMC")) ? BingRenXX.get("DangQianBQMC").toString() : null); |
| | | patMedInhosp1.setLeavehospitaldistrictcode(ObjectUtils.isNotEmpty(BingRenXX.get("DangQianBQID")) ? BingRenXX.get("DangQianBQID").toString() : null); |
| | | patMedInhosp1.setOrgid(ObjectUtils.isNotEmpty(BingRenXX.get("ZuZhiJGID")) ? BingRenXX.get("ZuZhiJGID").toString() : null); |
| | | //丽水无院区,默认值是 1 |
| | | patMedInhosp1.setCampusid("1"); |
| | | patMedInhosp1.setPatno(ObjectUtils.isNotEmpty(BingRenXX.get("BingRenID")) ? BingRenXX.get("BingRenID").toString() : null); |
| | | patMedInhosp1.setInhospno(ObjectUtils.isNotEmpty(BingRenXX.get("BingAnHao")) ? BingRenXX.get("BingAnHao").toString() : null); |
| | | patMedInhosp1.setSerialnum(ObjectUtils.isNotEmpty(BingRenXX.get("JiuZhenYWID")) ? BingRenXX.get("JiuZhenYWID").toString() : null); |
| | |
| | | patMedInhosp1.setPatname(patArchive.getName()); |
| | | |
| | | patMedInhosp1.setCreateTime(new Date()); |
| | | if (CollectionUtils.isNotEmpty(noLongTask) && noLongTask.contains(patMedInhosp1.getOrgid())) { |
| | | //不需要长期任务随访 |
| | | patMedInhosp1.setFuflag("1"); |
| | | } |
| | | |
| | | int i = patMedInhospMapper.insertPatMedInhosp(patMedInhosp1); |
| | | if (i != 1) return false; |
| | | } |
| | |
| | | } |
| | | } |
| | | try { |
| | | patMedInhosp1.setFudate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(SuiFangJH.get("SuiFangRQ").toString())); |
| | | if (!Objects.isNull(SuiFangJH.get("SuiFangRQ"))) |
| | | patMedInhosp1.setFudate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(SuiFangJH.get("SuiFangRQ").toString())); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | if (CollectionUtils.isNotEmpty(patMedInhospList)) { |
| | | patMedInhosp1.setUpdateTime(new Date()); |
| | | patMedInhosp1.setOrgid(ObjectUtils.isNotEmpty(BingRenXX) && ObjectUtils.isNotEmpty(BingRenXX.get("ZuZhiJGID")) ? BingRenXX.get("ZuZhiJGID").toString() : null); |
| | | if (CollectionUtils.isNotEmpty(noLongTask) && noLongTask.contains(patMedInhosp1.getOrgid())) { |
| | | //不需要长期任务随访 |
| | | patMedInhosp1.setFuflag("1"); |
| | | } |
| | | int i = patMedInhospMapper.updatePatMedInhosp(patMedInhosp1); |
| | | if (i != 1) return false; |
| | | } else { |
| | |
| | | patMedInhosp1.setLeavehospitaldistrictname(ObjectUtils.isNotEmpty(BingRenXX.get("DangQianBQMC")) ? BingRenXX.get("DangQianBQMC").toString() : null); |
| | | patMedInhosp1.setLeavehospitaldistrictcode(ObjectUtils.isNotEmpty(BingRenXX.get("DangQianBQID")) ? BingRenXX.get("DangQianBQID").toString() : null); |
| | | patMedInhosp1.setOrgid(ObjectUtils.isNotEmpty(BingRenXX.get("ZuZhiJGID")) ? BingRenXX.get("ZuZhiJGID").toString() : null); |
| | | //丽水无院区,默认值是 1 |
| | | patMedInhosp1.setCampusid("1"); |
| | | patMedInhosp1.setPatno(ObjectUtils.isNotEmpty(BingRenXX.get("BingRenID")) ? BingRenXX.get("BingRenID").toString() : null); |
| | | patMedInhosp1.setInhospno(ObjectUtils.isNotEmpty(BingRenXX.get("BingAnHao")) ? BingRenXX.get("BingAnHao").toString() : null); |
| | | patMedInhosp1.setSerialnum(ObjectUtils.isNotEmpty(BingRenXX.get("JiuZhenYWID")) ? BingRenXX.get("JiuZhenYWID").toString() : null); |
| | |
| | | patMedInhosp1.setPatname(patArchive.getName()); |
| | | |
| | | patMedInhosp1.setCreateTime(new Date()); |
| | | if (CollectionUtils.isNotEmpty(noLongTask) && noLongTask.contains(patMedInhosp1.getOrgid())) { |
| | | //不需要长期任务随访 |
| | | patMedInhosp1.setFuflag("1"); |
| | | } |
| | | int i = patMedInhospMapper.insertPatMedInhosp(patMedInhosp1); |
| | | if (i != 1) return false; |
| | | } |
| | |
| | | patMedInhosp1.setLeavehospitaldistrictname(ObjectUtils.isNotEmpty(BingRenXX.get("DangQianBQMC")) ? BingRenXX.get("DangQianBQMC").toString() : null); |
| | | patMedInhosp1.setLeavehospitaldistrictcode(ObjectUtils.isNotEmpty(BingRenXX.get("DangQianBQID")) ? BingRenXX.get("DangQianBQID").toString() : null); |
| | | patMedInhosp1.setOrgid(ObjectUtils.isNotEmpty(BingRenXX.get("ZuZhiJGID")) ? BingRenXX.get("ZuZhiJGID").toString() : null); |
| | | //丽水无院区,默认值是 1 |
| | | patMedInhosp1.setCampusid("1"); |
| | | patMedInhosp1.setPatno(ObjectUtils.isNotEmpty(BingRenXX.get("BingRenID")) ? BingRenXX.get("BingRenID").toString() : null); |
| | | patMedInhosp1.setInhospno(ObjectUtils.isNotEmpty(BingRenXX.get("BingAnHao")) ? BingRenXX.get("BingAnHao").toString() : null); |
| | | patMedInhosp1.setSerialnum(ObjectUtils.isNotEmpty(BingRenXX.get("JiuZhenYWID")) ? BingRenXX.get("JiuZhenYWID").toString() : null); |
| | |
| | | patMedOuthosp.setOuthospno(externalInHospPatientInfo.getBingAnHao()); |
| | | patMedOuthosp.setSerialnum(externalInHospPatientInfo.getJiuZhenYWID()); |
| | | List<PatMedOuthosp> patMedOuthosps = patMedOuthospMapper.selectPatMedOuthospList(patMedOuthosp); |
| | | for (PatMedOuthosp patMedOuthosp1 : patMedOuthosps) { |
| | | PatArchive pa = patArchiveMapper.selectPatArchiveByPatid(patMedOuthosp1.getPatid()); |
| | | if (patArchive.getBirthdate() != null) { |
| | | Map<String, String> map = calculateAge(pa.getBirthdate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(), LocalDate.now()); |
| | | pa.setAge(ObjectUtils.isNotEmpty(map.get("age")) ? Long.valueOf(map.get("age")) : null); |
| | | pa.setAgeUnit(map.get("ageUnit")); |
| | | pa.setAge2(ObjectUtils.isNotEmpty(map.get("age2")) ? Long.valueOf(map.get("age2")) : null); |
| | | pa.setAgeUnit2(map.get("ageUnit2")); |
| | | patMedOuthosp1.setAge(pa.getAge() + pa.getAgeUnit() + pa.getAge2() + pa.getAgeUnit2()); |
| | | patMedOuthosp1.setSex(patArchive.getSex()); |
| | | patMedOuthosp1.setTelcode(patArchive.getTelcode()); |
| | | patMedOuthosp1.setIdcardno(patArchive.getIdcardno()); |
| | | } |
| | | } |
| | | |
| | | patMedOuthosp.setPatid(patArchive.getId()); |
| | | patMedOuthosp.setPatno(externalInHospPatientInfo.getBingAnHao()); |
| | |
| | | patMedOuthosp.setDeptcode(externalJZInfo.getJiuZhenKSID()); |
| | | patMedOuthosp.setAdmitdate(externalJZInfo.getJiuZhenRQ()); |
| | | patMedOuthosp.setOrgid(FaSongJGID); |
| | | //丽水无院区,默认值是 1 |
| | | patMedOuthosp.setCampusid("1"); |
| | | patMedOuthosp.setHospitalname(FaSongJGMC); |
| | | patMedOuthosp.setIdcardno(patArchive.getIdcardno()); |
| | | |
| | | //这个需要等HIS那边告诉取哪个字段,现在还是不对的 |
| | | patMedOuthosp.setFudate(externalJZInfo.getSfrq()); |
| | | |
| | | for (ExternalDiagnosisInfo externalDiagnosisInfo : externalDiagnosisInfoList) { |
| | | if (externalDiagnosisInfo.getZhenDuanLBMC().equals("主诊断")) { |
| | |
| | | patMedOuthosp.setDrcode(externalDiagnosisInfo.getZhenDuanYSID()); |
| | | patMedOuthosp.setDrname(externalDiagnosisInfo.getZhenDuanYSXM()); |
| | | patMedOuthosp.setIcd10code(externalDiagnosisInfo.getIcd10()); |
| | | patMedOuthosp.setFuflag("0"); |
| | | } |
| | | } |
| | | for (ExternalWZInfo externalWZInfo : ExternalWZInfoList) { |
| | |
| | | if (CollectionUtils.isNotEmpty(patMedOuthosps)) { |
| | | patMedOuthosp.setId(patMedOuthosps.get(0).getId()); |
| | | patMedOuthosp.setUpdateTime(new Date()); |
| | | if (CollectionUtils.isNotEmpty(noLongTask) && noLongTask.contains(patMedOuthosp.getOrgid())) { |
| | | //不需要长期任务随访,由医生自己去随访(丽水中医院首次提出) |
| | | patMedOuthosp.setFuflag("1"); |
| | | } |
| | | i = patMedOuthospMapper.updatePatMedOuthosp(patMedOuthosp); |
| | | } else { |
| | | patMedOuthosp.setCreateTime(new Date()); |
| | | patMedOuthosp.setUpdateTime(new Date()); |
| | | if (CollectionUtils.isNotEmpty(noLongTask) && noLongTask.contains(patMedOuthosp.getOrgid())) { |
| | | //不需要长期任务随访 |
| | | patMedOuthosp.setFuflag("1"); |
| | | } |
| | | i = patMedOuthospMapper.insertPatMedOuthosp(patMedOuthosp); |
| | | } |
| | | |
| | | // //先通过身份证和科室查询该患者是否有需要随访的(景宁提出来的) |
| | | // if (patMedOuthosp.getOrgid().equals("47255004333112711A1001") && StringUtils.isNotEmpty(patMedOuthosp.getIdcardno()) && StringUtils.isNotEmpty(patMedOuthosp.getDeptcode())) { |
| | | // ServiceSubtaskVO serviceSubtaskVO = new ServiceSubtaskVO(); |
| | | // serviceSubtaskVO.setSfzh(patMedOuthosp.getIdcardno()); |
| | | // serviceSubtaskVO.setDeptcode(patMedOuthosp.getDeptcode()); |
| | | // serviceSubtaskVO.setSendstate(2L); |
| | | // List<ServiceSubtask> serviceSubtaskList = serviceSubtaskMapper.selectServiceSubtaskList(serviceSubtaskVO); |
| | | // if (CollectionUtils.isNotEmpty(serviceSubtaskList)) { |
| | | // for (ServiceSubtask serviceSubtask : serviceSubtaskList) { |
| | | // serviceSubtask.setSendstate(6L); |
| | | // serviceSubtask.setRemark("患者已经回来复诊"); |
| | | // serviceSubtask.setUpdateTime(new Date()); |
| | | // serviceSubtaskMapper.updateServiceSubtask(serviceSubtask); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | if (i > 0) { |
| | | return true; |
| | | } |
| | |
| | | icd10.setIcdcode(externalDiseaseInfo.getIcD10()); |
| | | icd10.setDelFlag("0"); |
| | | icd10.setOrgid(FaSongJGID); |
| | | //丽水无院区,默认值是 1 |
| | | icd10.setCampusid("1"); |
| | | //通过icdCode查询一下,是否存在 |
| | | List<Icd10> icd10s = icd10Mapper.selectIcd10List(icd10); |
| | | icd10.setHisIcdid(externalDiseaseInfo.getJiBingID()); |
| | |
| | | ExternalWardArea externalWardArea = BeanUtil.mapToBean(bqxx, ExternalWardArea.class, true); |
| | | SysDept sysDept = new SysDept(); |
| | | sysDept.setOrgid(externalWardArea.getZuZhiJGID()); |
| | | //丽水无院区,默认值是 1 |
| | | sysDept.setCampusid("1"); |
| | | sysDept.setHisDeptId(externalWardArea.getBingQuID()); |
| | | |
| | | sysDept.setDeptName(externalWardArea.getBingQuMC()); |
| | |
| | | patMedOperation.setPatno(externalInHospPatientInfo.getBingRenID()); |
| | | patMedOperation.setPatname(externalInHospPatientInfo.getXingMing()); |
| | | patMedOperation.setOrgid(externalInHospPatientInfo.getZuZhiJGID()); |
| | | //丽水无院区,默认值是 1 |
| | | patMedOperation.setCampusid("1"); |
| | | patMedOperation.setSerialnum(externalInHospPatientInfo.getJiuZhenYWID()); |
| | | patMedOperation.setInhospno(externalInHospPatientInfo.getBingAnHao()); |
| | | patMedOperation.setHospitalname(externalInHospPatientInfo.getZuZhiJGMC()); |
| | |
| | | patMedOperationItem.setOpposition(externalOperationDetail.getShouShuBW()); |
| | | patMedOperationItem.setDelFlag("0"); |
| | | patMedOperationItem.setOrgid(patMedOperation.getOrgid()); |
| | | //丽水无院区,默认值是 1 |
| | | patMedOperationItem.setCampusid("1"); |
| | | if (externalOperationDetail.getZhuShouSBZ().equals("1") && addMianTableFalg == true) { |
| | | patMedOperation.setOpcode(externalOperationDetail.getShouShuMCID()); |
| | | patMedOperation.setOpdesc(externalOperationDetail.getShouShuMC()); |
| | |
| | | PatArchive patArchive = new PatArchive(); |
| | | //如果是刚出生的小孩子,是没有身份证的,怎么处理???????? |
| | | patArchive.setIdcardno(externalInHospPatientInfo.getZhengJianHM()); |
| | | //如果身份证为空的话,就用就诊卡号代替 |
| | | if (StringUtils.isEmpty(externalInHospPatientInfo.getZhengJianHM())) |
| | | patArchive.setIdcardno(externalInHospPatientInfo.getJiuZhenKH()); |
| | | patArchive.setOrgid(externalInHospPatientInfo.getZuZhiJGID()); |
| | | //丽水无院区,默认值是 1 |
| | | patArchive.setCampusid("1"); |
| | | List<PatArchive> patArchives = null; |
| | | if (ObjectUtils.isNotEmpty(patArchive.getIdcardno())) |
| | | patArchives = patArchiveMapper.selectPatArchiveList(patArchive); |
| | |
| | | patArchivecontact.setPatid(patArchive.getId()); |
| | | patArchivecontact.setContactname(external.getLianXiRXM()); |
| | | patArchivecontact.setOrgid(patArchive.getOrgid()); |
| | | //丽水无院区,默认值是 1 |
| | | patArchivecontact.setCampusid("1"); |
| | | List<PatArchivecontact> patArchivecontacts = patArchivecontactMapper.selectPatArchivecontactList(patArchivecontact); |
| | | patArchivecontact.setContactway(external.getLianXiRDH()); |
| | | patArchivecontact.setRelation(external.getGuanXiMC()); |
| | |
| | | //这里是床位名称还是床位编号???? |
| | | patMedInhosp.setBedNo(externalInHospPatientInfo.getDangQianCWMC()); |
| | | patMedInhosp.setOrgid(externalInHospPatientInfo.getZuZhiJGID()); |
| | | //丽水无院区,默认值是 1 |
| | | patMedInhosp.setCampusid("1"); |
| | | patMedInhosp.setHospitaldistrictid(externalInHospPatientInfo.getDangQianBQID()); |
| | | patMedInhosp.setGuid(externalInHospPatientInfo.getZuZhiJGID()); |
| | | patMedInhosp.setInhospstate("0"); |
| | |
| | | patMedInhosp.setDrcode(externalInHospPatientInfo.getZhuZhiYSID()); |
| | | patMedInhosp.setNurseId(externalInHospPatientInfo.getZeRenHSID()); |
| | | patMedInhosp.setNurseName(externalInHospPatientInfo.getZeRenHSXM()); |
| | | patMedInhosp.setManagementDoctor(externalInHospPatientInfo.getJingGuanYSXM()); |
| | | patMedInhosp.setManagementDoctorCode(externalInHospPatientInfo.getJingGuanYSID()); |
| | | } |
| | | if (ObjectUtils.isNotEmpty(externalInHospPatientDiagnoseInfo)) { |
| | | // patMedInhosp.setIcd10code(StringUtils.isNotEmpty(patMedInhosp.getIcd10code()) ? patMedInhosp.getIcd10code() + "," + externalInHospPatientDiagnoseInfo.getZhenDuanID() : externalInHospPatientDiagnoseInfo.getZhenDuanID()); |
| | |
| | | patMedInspection.setProjecttype(0); |
| | | } |
| | | patMedInspection.setOrgid(externalInHospPatientInfo.getZuZhiJGID()); |
| | | //丽水无院区,默认值是 1 |
| | | patMedInspection.setCampusid("1"); |
| | | patMedInspection.setInhospno(externalInHospPatientInfo.getBingAnHao()); |
| | | patMedInspection.setPatidHis(externalInHospPatientInfo.getBingRenID()); |
| | | patMedInspection.setPatname(externalInHospPatientInfo.getXingMing()); |
| | |
| | | if (CollectionUtils.isNotEmpty(patMedInspections)) { |
| | | patMedInspection.setUpdateDate(new Date()); |
| | | patMedInspection.setOrgid(ObjectUtils.isNotEmpty(xiaoXiTou) && ObjectUtils.isNotEmpty(xiaoXiTou.get("FaSongJGID")) ? xiaoXiTou.get("FaSongJGID").toString() : null); |
| | | //丽水无院区,默认值是 1 |
| | | patMedInspection.setCampusid("1"); |
| | | // 更新操作 |
| | | int i = patMedInspectionMapper.updatePatMedInspection(patMedInspection); |
| | | if (i != 1) return false; |
| | |
| | | PatMedInspection patMedInspection = new PatMedInspection(); |
| | | PatMedInspectionItem patMedInspectionItem = new PatMedInspectionItem(); |
| | | patMedInspection.setOrgid(BingRenXX.get("ZuZhiJGID").toString()); |
| | | //丽水无院区,默认值是 1 |
| | | patMedInspection.setCampusid("1"); |
| | | patMedInspection.setInhospno(BingRenXX.get("BingAnHao").toString()); |
| | | patMedInspection.setPatidHis(BingRenXX.get("BingRenID").toString()); |
| | | patMedInspection.setPatname(BingRenXX.get("XingMing").toString()); |
| | |
| | | } |
| | | //检查检验报告数据处理 |
| | | patMedInspectionItem.setOrgid(BingRenXX.get("ZuZhiJGID").toString()); |
| | | //丽水无院区,默认值是 1 |
| | | patMedInspectionItem.setCampusid("1"); |
| | | List<PatMedInspectionItem> patMedInspectionItems = patMedInspectionItemMapper.selectPatMedInspectionItemList(patMedInspectionItem); |
| | | if (ObjectUtils.isNotEmpty(JianChaBG)) { |
| | | patMedInspectionItem.setInspectionName(JianChaBG.get("JianChaHao").toString()); |
| | |
| | | case "JG_YH_JiBenXX": |
| | | log.info("用户信息入参类型为:{}", type); |
| | | return addUserInfo(dataMap); |
| | | case "JG_YH_KeShiYH": |
| | | log.info("科室用户信息入参类型为:{}", type); |
| | | return addUserDeptInfo(dataMap); |
| | | case "fu_task": |
| | | log.info("fu_task服务入参类型为:{}", type); |
| | | return addTaskInfo(dataMap); |
| | |
| | | log.info("药品产地价格入参类型为:{}", type); |
| | | return true; |
| | | case "JZ_MZ_WanChengJZ": |
| | | log.info("完成接诊入参类型为:{}", type); |
| | | log.info("(门急诊)完成接诊入参类型为:{}", type); |
| | | return addFinshJZInfo(dataMap); |
| | | case "JZ_ZY_RuYuanDJ": |
| | | log.info("入院登记入参类型为:{}", type); |