Commit f4520b24 by 宋振民

feat:新增科室时,全院账号自动匹配所有的科室

parent edde087d
...@@ -2,4 +2,5 @@ package com.hs.api.common; ...@@ -2,4 +2,5 @@ package com.hs.api.common;
public interface Constants { public interface Constants {
String TOKEN_KEY = "Authorization"; String TOKEN_KEY = "Authorization";
Long HOSPITAL_WIDE_CODE = 1L;
} }
...@@ -15,6 +15,8 @@ public interface DicOrgMapper { ...@@ -15,6 +15,8 @@ public interface DicOrgMapper {
List<DicOrg> selectAll(); List<DicOrg> selectAll();
List<SerDepartment> selectAllSerDept();
int updateByPrimaryKey(DicOrg record); int updateByPrimaryKey(DicOrg record);
List<DicOrg> selectByUser(@Param("userId") Long userId); List<DicOrg> selectByUser(@Param("userId") Long userId);
......
...@@ -61,6 +61,7 @@ public class SerDiseaseServiceImpl implements SerDiseaseService { ...@@ -61,6 +61,7 @@ public class SerDiseaseServiceImpl implements SerDiseaseService {
mdcName = StringUtil.isNullOrEmpty(mdcName) ? null : mdcName; mdcName = StringUtil.isNullOrEmpty(mdcName) ? null : mdcName;
docCode = StringUtil.isNullOrEmpty(docCode) ? null : docCode; docCode = StringUtil.isNullOrEmpty(docCode) ? null : docCode;
deptCode = StringUtil.isNullOrEmpty(deptCode) ? null : deptCode; deptCode = StringUtil.isNullOrEmpty(deptCode) ? null : deptCode;
medicalRecord = StringUtil.isNullOrEmpty(medicalRecord) ? null : medicalRecord;
String[] mdcNameList = null; String[] mdcNameList = null;
if (mdcName != null) { if (mdcName != null) {
mdcNameList = mdcName.split("\\s+"); mdcNameList = mdcName.split("\\s+");
......
package com.hs.api.service.Impl; package com.hs.api.service.Impl;
import com.hs.api.common.Constants;
import com.hs.api.mapper.DicOrgMapper; import com.hs.api.mapper.DicOrgMapper;
import com.hs.api.mapper.SysRoleMapper;
import com.hs.api.mapper.SysUserOrgRsMapper; import com.hs.api.mapper.SysUserOrgRsMapper;
import com.hs.api.model.DicOrg; import com.hs.api.model.DicOrg;
import com.hs.api.model.SerDepartment; import com.hs.api.model.SerDepartment;
import com.hs.api.model.SysRole;
import com.hs.api.model.SysUserOrgRs; import com.hs.api.model.SysUserOrgRs;
import com.hs.api.service.SysUserOrgRsService; import com.hs.api.service.SysUserOrgRsService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List; import java.util.List;
@Service @Service
...@@ -19,6 +23,8 @@ public class SysUserOrgRsServiceImpl implements SysUserOrgRsService { ...@@ -19,6 +23,8 @@ public class SysUserOrgRsServiceImpl implements SysUserOrgRsService {
private DicOrgMapper orgMapper; private DicOrgMapper orgMapper;
@Resource @Resource
private DicOrgMapper dicOrgMapper; private DicOrgMapper dicOrgMapper;
@Resource
private SysRoleMapper sysRoleMapper;
@Override @Override
public int add(SysUserOrgRs sysUserOrgRs) { public int add(SysUserOrgRs sysUserOrgRs) {
...@@ -58,9 +64,19 @@ public class SysUserOrgRsServiceImpl implements SysUserOrgRsService { ...@@ -58,9 +64,19 @@ public class SysUserOrgRsServiceImpl implements SysUserOrgRsService {
if (disease != null) { if (disease != null) {
list = orgMapper.selectDeptByDisease(userId, orgId, disease, date); list = orgMapper.selectDeptByDisease(userId, orgId, disease, date);
} else { } else {
list = orgMapper.selectDeptByUser(userId, orgId); SysRole role = sysRoleMapper.selectByUser(userId);
list = selectDeptByUserRole(userId, orgId, role.getRoleCode());
} }
return list; return list;
} }
@Override
public List<SerDepartment> selectDeptByUserRole(Long userId, Long orgId, Long roleCole) {
if(roleCole.equals(Constants.HOSPITAL_WIDE_CODE)) {
return dicOrgMapper.selectAllSerDept();
}else {
return orgMapper.selectDeptByUser(userId, orgId);
}
}
} }
...@@ -7,4 +7,6 @@ import java.util.List; ...@@ -7,4 +7,6 @@ import java.util.List;
public interface SysUserOrgRsService extends ServiceBase<SysUserOrgRs> { public interface SysUserOrgRsService extends ServiceBase<SysUserOrgRs> {
List<SerDepartment> getUserOrg(Long userId, String disease, String date); List<SerDepartment> getUserOrg(Long userId, String disease, String date);
List<SerDepartment> selectDeptByUserRole(Long userId, Long orgId, Long roleCode);
} }
...@@ -57,9 +57,10 @@ ...@@ -57,9 +57,10 @@
report_hos_ind_info rhi report_hos_ind_info rhi
LEFT JOIN report_hos_ind_info rhii ON rhi.IND_CODE = rhii.PARENT_IND_CODE LEFT JOIN report_hos_ind_info rhii ON rhi.IND_CODE = rhii.PARENT_IND_CODE
WHERE WHERE
rhi.state = 1 rhi.state = 1
AND (rhi.PARENT_IND_CODE = '' and rhi.page_id = #{pageCode,jdbcType=VARCHAR}
OR rhi.PARENT_IND_CODE IS NULL) AND (rhi.PARENT_IND_CODE = ''
OR rhi.PARENT_IND_CODE IS NULL)
ORDER BY ORDER BY
rhi.xh, rhi.xh,
rhii.xh rhii.xh
......
...@@ -74,6 +74,17 @@ ...@@ -74,6 +74,17 @@
from sys_subject from sys_subject
where ID = #{id,jdbcType=DECIMAL} where ID = #{id,jdbcType=DECIMAL}
</select> </select>
<select id="selectAllSerDept" resultMap="SummaryDept">
SELECT
o.ID,
o.ORG_CODE AS KSBM,
o.ORG_NAME AS KSMC,
o.ORG_SHORT_NAME AS KSJC
FROM
sys_subject o
WHERE
o.state =1 and parent_id<![CDATA[ <> ]]>0
</select>
<select id="selectAll" resultMap="BaseResultMap"> <select id="selectAll" resultMap="BaseResultMap">
select ID, select ID,
CREATE_DATE, CREATE_DATE,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment