| | |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.domain.entity.SysUserDept; |
| | | import com.ruoyi.common.core.domain.entity.SysUserRole; |
| | | import com.ruoyi.common.utils.DtoConversionUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.http.HttpUtils; |
| | | import com.smartor.domain.*; |
| | |
| | | import com.sun.org.apache.bcel.internal.generic.NEW; |
| | | 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; |
| | |
| | | log.info("-----------dataList接口响应结果:{}", dataList.size()); |
| | | for (Map<String, Object> dataItem : dataList) { |
| | | SysDept sysDept = new SysDept(); |
| | | sysDept.setOrgid("" + serviceSLTDDeptReqVO.getCampusIds().get(0)); |
| | | sysDept.setOrgid("" + getLongValue(dataItem, "orgId")); |
| | | sysDept.setCampusid("" + getLongValue(dataItem, "campusId")); |
| | | sysDept.setHisDeptId("" + getLongValue(dataItem, "deptId")); |
| | | sysDept.setHisParentId(getStringValue(dataItem, "parentDeptId")); |
| | | //通过his的父科室ID去找到科室ID,填充parentId |
| | |
| | | sysUser.setUpdateBy("admin"); |
| | | sysUser.setCreateBy("admin"); |
| | | sysUser.setCreateBy("admin"); |
| | | sysUser.setOrgid(reqVO.getCampusId().toString()); |
| | | sysUser.setOrgid("" + getLongValue(dataItem, "orgId")); |
| | | // sysUser.setCampusid("" + getLongValue(dataItem, "cmpusId")); |
| | | BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); |
| | | sysUser.setPassword(passwordEncoder.encode(userPwd)); |
| | | |
| | | SysUser sysUser1 = sysUser2Mapper.selectUserByUserName(sysUser.getUserName()); |
| | | if (ObjectUtils.isNotEmpty(sysUser1)) { |
| | | sysUser.setUserId(sysUser1.getUserId()); |
| | | sysUser2Mapper.updateUser(sysUser); |
| | | } else { |
| | | sysUser2Mapper.insertUser(sysUser); |
| | | } |
| | | |
| | | // 处理用户与部门的关系 |
| | | List personnelDepts = (List<?>) dataItem.get("personnelDepts"); |
| | | if (CollectionUtils.isEmpty(personnelDepts)) { |
| | | List businessDepts = (List<?>) dataItem.get("businessDepts"); |
| | | if (CollectionUtils.isEmpty(businessDepts)) { |
| | | continue; |
| | | } |
| | | |
| | | List<List<String>> deptInfoList = new ArrayList<>(); |
| | | List<List<String>> hospInfoList = new ArrayList<>(); |
| | | for (Object personnelDept : personnelDepts) { |
| | | if (personnelDept instanceof Map) { |
| | | Map<String, Object> personnelDeptMap = (Map<String, Object>) personnelDept; |
| | | log.info("------businessDepts是否有值:{}", businessDepts.size()); |
| | | for (Object businessDept : businessDepts) { |
| | | if (businessDept instanceof Map) { |
| | | Map<String, Object> businessDeptMap = (Map<String, Object>) businessDept; |
| | | log.info("------businessDeptMap是否有值:{}", businessDeptMap); |
| | | // Long hisDeptId = (Long) personnelDeptMap.get("deptId"); |
| | | String hisDeptId = getStringValue(personnelDeptMap, "deptId"); |
| | | String hisDeptId = getStringValue(businessDeptMap, "deptId"); |
| | | log.info("------hisDeptId是否有值:{}, reqVO.getOrgId()的值为:{}", hisDeptId, reqVO.getCampusId()); |
| | | //在这里,hisDeptId就是deptCode |
| | | SysDept sysDept = sysDeptMapper.selectDeptByCode(hisDeptId, reqVO.getCampusId().toString()); |
| | | SysDept sysDept = sysDeptMapper.selectDeptByCode(hisDeptId, reqVO.getOrgId()); |
| | | log.info("------hisDeptId是否有值:{}, reqVO.getCampusId()的值为:{}", hisDeptId, reqVO.getCampusId()); |
| | | if (Objects.isNull(sysDept)) continue; |
| | | SysUserDept sysUserDept = new SysUserDept(); |
| | | sysUserDept.setUserId(sysUser.getUserId()); |
| | |
| | | sysUserDept.setOrgid(sysDept.getOrgid()); |
| | | sysUserDept.setCreateTime(new Date()); |
| | | sysUserDept.setDelFlag(0L); |
| | | |
| | | //判断一下是不是已经存在了 |
| | | if (ObjectUtils.isNotEmpty(sysUser1) && ObjectUtils.isNotEmpty(sysDept)) { |
| | | SysUserDept sud = new SysUserDept(); |
| | | sud.setUserId(sysUser1.getUserId()); |
| | | sud.setDeptId(sysDept.getDeptId()); |
| | | List<SysUserDept> sysUserDepts = sysUserDeptMapper.selectSysUserDeptList(sud); |
| | | if (CollectionUtils.isNotEmpty(sysUserDepts)) { |
| | | sysUserDept.setId(sysUserDepts.get(0).getId()); |
| | | sysUserDeptMapper.updateSysUserDept(sysUserDept); |
| | | } |
| | | } else { |
| | | //不存在,则新增 |
| | | sysUserDeptMapper.insertSysUserDept(sysUserDept); |
| | | } |
| | | if (StringUtils.isNotEmpty(sysDept.getDeptType()) && sysDept.getDeptType().equals("1")) { |
| | | hospInfoList.add(Arrays.asList(sysDept.getDeptCode())); |
| | | } else if (StringUtils.isNotEmpty(sysDept.getDeptType()) && sysDept.getDeptType().equals("2")) { |
| | |
| | | sur.setUserId(sysUser.getUserId()); |
| | | sur.setRoleId(3L); |
| | | sur.setOrgid(sysUser.getOrgid()); |
| | | |
| | | //先查询一下,是否存在 |
| | | SysUserRole sysUserRole = sysUserRoleMapper.selectUserRoleByRoleIdAndUserId(sysUser.getUserId(), 3L); |
| | | if (ObjectUtils.isNotEmpty(sysUserRole)) continue; |
| | | |
| | | userRoleList.add(sur); |
| | | sysUserRoleMapper.batchUserRole(userRoleList); |
| | | |
| | | } |
| | | |
| | | return true; |
| | |
| | | if (Objects.isNull(dto)) continue; |
| | | PatArchive patArchive = processPatientArchive(dto, orgid); |
| | | PatMedOuthosp patMedOuthosp = buildPatMedOuthosp(dto, patArchive, orgid); |
| | | //查询当前新增的门急诊数据,是否在过渡表中是否存在,如果存在,就不往门急诊表里新增了 |
| | | PatMedOuthospProvisional pmop = DtoConversionUtils.sourceToTarget(patMedOuthosp, PatMedOuthospProvisional.class); |
| | | |
| | | |
| | | patMedOuthospMapper.insertPatMedOuthosp(patMedOuthosp); |
| | | } |
| | | return true; |
| | |
| | | patMedOuthosp.setMainsuit(dto.getDiagnosisName()); |
| | | patMedOuthosp.setHpi(null); |
| | | patMedOuthosp.setCreateTime(new Date()); |
| | | patMedOuthosp.setOrgid("" + orgid); |
| | | patMedOuthosp.setOrgid(dto.getOrgId()); |
| | | patMedOuthosp.setCampusid(dto.getCampusId()); |
| | | return patMedOuthosp; |
| | | } |
| | | |
| | |
| | | PatMedInhosp queryInhosp = new PatMedInhosp(); |
| | | queryInhosp.setPatno(patArchive.getPatientno()); |
| | | queryInhosp.setSerialnum(patMedInhosp.getSerialnum()); |
| | | queryInhosp.setOrgid("" + orgid); |
| | | queryInhosp.setOrgid(dto.getOrgId()); |
| | | queryInhosp.setCampusid(dto.getCampusId()); |
| | | queryInhosp.setInhospstate(cry); |
| | | log.info("----------------这里的入参为:{}", queryInhosp); |
| | | List<PatMedInhosp> existingInhosps = patMedInhospService.selectPatMedInhospList(queryInhosp); |
| | | |
| | | if (cry.equals("0") && CollectionUtils.isNotEmpty(existingInhosps)) { |
| | | //新增过的入院数据,不再处理 |
| | | return; |
| | | } |
| | | |
| | | log.info("----------------这里的返参为:{}", existingInhosps); |
| | | if (CollectionUtils.isNotEmpty(existingInhosps)) { |
| | |
| | | patMedInhosp.setDrcode("" + dto.getDoctorId()); |
| | | patMedInhosp.setSchemestatus("0".equals(cry) ? 1L : 2L); |
| | | patMedInhosp.setDelFlag("0"); |
| | | patMedInhosp.setOrgid("" + orgid); |
| | | patMedInhosp.setOrgid(dto.getOrgId()); |
| | | patMedInhosp.setCampusid(dto.getCampusId()); |
| | | return patMedInhosp; |
| | | } |
| | | |
| | |
| | | patArchive.setDelFlag("0"); |
| | | patArchive.setCreateTime(new Date()); |
| | | patArchive.setUpdateTime(new Date()); |
| | | patArchive.setOrgid("" + orgid); |
| | | patArchive.setOrgid("" + dto.getOrgId()); |
| | | patArchive.setCampusid(dto.getCampusId()); |
| | | return patArchive; |
| | | } |
| | | |
| | | private ServiceSLTDInhospResDTO convertToDTO(Map<String, Object> dataItem) { |
| | | ServiceSLTDInhospResDTO dto = new ServiceSLTDInhospResDTO(); |
| | | dto.setOrgId(getStringValue(dataItem, "orgId")); |
| | | dto.setCampusId(getStringValue(dataItem, "campusId")); |
| | | dto.setHealthcareRecordId(getLongValue(dataItem, "healthcareRecordId")); |
| | | dto.setHealthcareRecordNo(getStringValue(dataItem, "healthcareRecordNo")); |
| | | dto.setPatientId(getLongValue(dataItem, "patientId")); |