Commit f4520b24 by 宋振民

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

parent edde087d
......@@ -2,4 +2,5 @@ package com.hs.api.common;
public interface Constants {
String TOKEN_KEY = "Authorization";
Long HOSPITAL_WIDE_CODE = 1L;
}
......@@ -15,6 +15,8 @@ public interface DicOrgMapper {
List<DicOrg> selectAll();
List<SerDepartment> selectAllSerDept();
int updateByPrimaryKey(DicOrg record);
List<DicOrg> selectByUser(@Param("userId") Long userId);
......
......@@ -61,6 +61,7 @@ public class SerDiseaseServiceImpl implements SerDiseaseService {
mdcName = StringUtil.isNullOrEmpty(mdcName) ? null : mdcName;
docCode = StringUtil.isNullOrEmpty(docCode) ? null : docCode;
deptCode = StringUtil.isNullOrEmpty(deptCode) ? null : deptCode;
medicalRecord = StringUtil.isNullOrEmpty(medicalRecord) ? null : medicalRecord;
String[] mdcNameList = null;
if (mdcName != null) {
mdcNameList = mdcName.split("\\s+");
......
package com.hs.api.service.Impl;
import com.hs.api.common.Constants;
import com.hs.api.mapper.DicOrgMapper;
import com.hs.api.mapper.SysRoleMapper;
import com.hs.api.mapper.SysUserOrgRsMapper;
import com.hs.api.model.DicOrg;
import com.hs.api.model.SerDepartment;
import com.hs.api.model.SysRole;
import com.hs.api.model.SysUserOrgRs;
import com.hs.api.service.SysUserOrgRsService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@Service
......@@ -19,6 +23,8 @@ public class SysUserOrgRsServiceImpl implements SysUserOrgRsService {
private DicOrgMapper orgMapper;
@Resource
private DicOrgMapper dicOrgMapper;
@Resource
private SysRoleMapper sysRoleMapper;
@Override
public int add(SysUserOrgRs sysUserOrgRs) {
......@@ -58,9 +64,19 @@ public class SysUserOrgRsServiceImpl implements SysUserOrgRsService {
if (disease != null) {
list = orgMapper.selectDeptByDisease(userId, orgId, disease, date);
} else {
list = orgMapper.selectDeptByUser(userId, orgId);
SysRole role = sysRoleMapper.selectByUser(userId);
list = selectDeptByUserRole(userId, orgId, role.getRoleCode());
}
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;
public interface SysUserOrgRsService extends ServiceBase<SysUserOrgRs> {
List<SerDepartment> getUserOrg(Long userId, String disease, String date);
List<SerDepartment> selectDeptByUserRole(Long userId, Long orgId, Long roleCode);
}
......@@ -57,9 +57,10 @@
report_hos_ind_info rhi
LEFT JOIN report_hos_ind_info rhii ON rhi.IND_CODE = rhii.PARENT_IND_CODE
WHERE
rhi.state = 1
AND (rhi.PARENT_IND_CODE = ''
OR rhi.PARENT_IND_CODE IS NULL)
rhi.state = 1
and rhi.page_id = #{pageCode,jdbcType=VARCHAR}
AND (rhi.PARENT_IND_CODE = ''
OR rhi.PARENT_IND_CODE IS NULL)
ORDER BY
rhi.xh,
rhii.xh
......
......@@ -74,6 +74,17 @@
from sys_subject
where ID = #{id,jdbcType=DECIMAL}
</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,
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