| | |
| | | log.info("selectDeptList的采集到的数量为:{}", sysDepts.size()); |
| | | // count = sysDept2Mapper.batchDept(sysDepts); |
| | | for (SysDept row : sysDepts) { |
| | | SysDept sysDeptTemp = sysDept2Mapper.selectDeptByCode(row.getDeptCode(), null); |
| | | // 科室和病区可能共用同一个 dept_code,必须按 dept_type + orgid 精确定位,否则 selectOne 会返回多条 |
| | | if (StringUtils.isEmpty(row.getDeptCode())) { |
| | | log.warn("selectDeptList跳过deptCode为空的记录:{}", row); |
| | | continue; |
| | | } |
| | | SysDept sysDeptTemp = sysDept2Mapper.selectDeptByCodeAndType(row.getDeptCode(), row.getOrgid(), row.getDeptType()); |
| | | if (sysDeptTemp != null && sysDeptTemp.getDeptName() != null) { |
| | | row.setDeptId(sysDeptTemp.getDeptId()); |
| | | count += sysDept2Mapper.updateDept(row); |
| | |
| | | |
| | | public SysDept selectDeptByCode(@Param("deptCode")String deptCode,@Param("orgid")String orgid); |
| | | |
| | | /** |
| | | * 按科室编码、机构、科室类型查询(科室和病区可能使用相同编码,必须带 deptType 精确定位) |
| | | */ |
| | | public SysDept selectDeptByCodeAndType(@Param("deptCode")String deptCode,@Param("orgid")String orgid,@Param("deptType")String deptType); |
| | | |
| | | public SysDept selectDeptByCodeAndCampus(@Param("deptCode")String deptCode,@Param("orgid")String orgid,@Param("campusid")String campusid); |
| | | |
| | | /** |
| | |
| | | <if test="orgid != null and orgid != ''"> |
| | | AND orgid = #{orgid} |
| | | </if> |
| | | order by d.dept_id |
| | | limit 1 |
| | | </select> |
| | | |
| | | <select id="selectDeptByCodeAndType" resultMap="SysDeptResult"> |
| | | <include refid="selectDeptVo"/> |
| | | where d.del_flag = '0' |
| | | and d.dept_code = #{deptCode} |
| | | <if test="orgid != null and orgid != ''"> |
| | | AND d.orgid = #{orgid} |
| | | </if> |
| | | <if test="deptType != null and deptType != ''"> |
| | | AND d.dept_type = #{deptType} |
| | | </if> |
| | | order by d.dept_id |
| | | limit 1 |
| | | </select> |
| | | |
| | | <select id="selectDeptByCodeAndCampus" parameterType="string" resultMap="SysDeptResult"> |