| | |
| | | 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; |
| | |
| | | private SysDept2Mapper sysDeptMapper; |
| | | @Autowired |
| | | private SysUser2Mapper sysUserMapper; |
| | | @Autowired |
| | | private SysUserDeptMapper sysUserDeptMapper; |
| | | @Autowired |
| | | private BaseOrganizationMapper baseOrganizationMapper; |
| | | @Autowired |
| | |
| | | } |
| | | SysDept sysDept = new SysDept(); |
| | | sysDept.setOrgid(externalDept.getZuZhiJGID()); |
| | | //丽水无院区,默认值是 1 |
| | | sysDept.setCampusid("1"); |
| | | sysDept.setHisDeptId(externalDept.getKeShiID()); |
| | | sysDept.setHisParentId(externalDept.getFuKeSID()); |
| | | //通过his的父科室ID去找到科室ID,填充parentId |
| | |
| | | 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 = null; |
| | | List<SysUser> sysUserList = sysUserMapper.selectUserList(sysUser); |
| | |
| | | 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; |
| | |
| | | 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); |
| | |
| | | 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"); |
| | |
| | | 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.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.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); |
| | |
| | | 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.setDeptcode(externalJZInfo.getJiuZhenKSID()); |
| | | patMedOuthosp.setAdmitdate(externalJZInfo.getJiuZhenRQ()); |
| | | patMedOuthosp.setOrgid(FaSongJGID); |
| | | //丽水无院区,默认值是 1 |
| | | patMedOuthosp.setCampusid("1"); |
| | | patMedOuthosp.setHospitalname(FaSongJGMC); |
| | | patMedOuthosp.setIdcardno(patArchive.getIdcardno()); |
| | | |
| | |
| | | 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()); |
| | |
| | | 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"); |
| | |
| | | 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); |