Commit 4994743b by Suvalue

科室列表修改

parent 82360aa8
...@@ -4,11 +4,13 @@ import com.bsoft.api.common.Result; ...@@ -4,11 +4,13 @@ import com.bsoft.api.common.Result;
import com.bsoft.api.common.annotations.CurrentUser; import com.bsoft.api.common.annotations.CurrentUser;
import com.bsoft.api.common.annotations.Token; import com.bsoft.api.common.annotations.Token;
import com.bsoft.api.model.SerDepartment; import com.bsoft.api.model.SerDepartment;
import com.bsoft.api.model.reqmodel.Disease;
import com.bsoft.api.service.SysUserOrgRsService; import com.bsoft.api.service.SysUserOrgRsService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
...@@ -28,8 +30,8 @@ public class DeptController { ...@@ -28,8 +30,8 @@ public class DeptController {
@PostMapping("/dept/list") @PostMapping("/dept/list")
@Token @Token
@ApiOperation("查询科室列表") @ApiOperation("查询科室列表")
public Object getList(@ApiIgnore @CurrentUser Long userId) { public Object getList(@ApiIgnore @CurrentUser Long userId, @RequestBody Disease.DiseaseIDorLevel disease) {
List<SerDepartment> sysMenuList = sysUserOrgRsService.getUserOrg(userId); List<SerDepartment> sysMenuList = sysUserOrgRsService.getUserOrg(userId, disease.getDisease(), disease.getDate());
return Result.success(sysMenuList); return Result.success(sysMenuList);
} }
} }
...@@ -19,5 +19,8 @@ public interface DicOrgMapper { ...@@ -19,5 +19,8 @@ public interface DicOrgMapper {
List<DicOrg> selectByUser(@Param("userId") Long userId); List<DicOrg> selectByUser(@Param("userId") Long userId);
List<SerDepartment> selectDeptByUser(@Param("userId") Long userId,@Param("orgId") Long orgId); List<SerDepartment> selectDeptByUser(@Param("userId") Long userId, @Param("orgId") Long orgId);
List<SerDepartment> selectDeptByDisease(@Param("userId") Long userId, @Param("orgId") Long orgId,
@Param("disease") String disease, @Param("date") String date);
} }
\ No newline at end of file
...@@ -51,10 +51,15 @@ public class SysUserOrgRsServiceImpl implements SysUserOrgRsService { ...@@ -51,10 +51,15 @@ public class SysUserOrgRsServiceImpl implements SysUserOrgRsService {
} }
@Override @Override
public List<SerDepartment> getUserOrg(Long userId) { public List<SerDepartment> getUserOrg(Long userId, String disease, String date) {
List<DicOrg> orgList = dicOrgMapper.selectByUser(userId); List<DicOrg> orgList = dicOrgMapper.selectByUser(userId);
Long orgId = orgList != null && orgList.size() > 0 ? orgList.get(0).getId() : null; Long orgId = orgList != null && orgList.size() > 0 ? orgList.get(0).getId() : null;
List<SerDepartment> list = orgMapper.selectDeptByUser(userId,orgId); List<SerDepartment> list = null;
if (disease != null) {
list = orgMapper.selectDeptByUser(userId, orgId);
} else {
list = orgMapper.selectDeptByDisease(userId, orgId, disease, date);
}
return list; return list;
} }
......
...@@ -6,5 +6,5 @@ import com.bsoft.api.model.SysUserOrgRs; ...@@ -6,5 +6,5 @@ import com.bsoft.api.model.SysUserOrgRs;
import java.util.List; import java.util.List;
public interface SysUserOrgRsService extends ServiceBase<SysUserOrgRs> { public interface SysUserOrgRsService extends ServiceBase<SysUserOrgRs> {
List<SerDepartment> getUserOrg(Long userId); List<SerDepartment> getUserOrg(Long userId, String disease, String date);
} }
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bsoft.api.mapper.DicOrgMapper"> <mapper namespace="com.bsoft.api.mapper.DicOrgMapper">
<resultMap id="BaseResultMap" type="com.bsoft.api.model.DicOrg"> <resultMap id="BaseResultMap" type="com.bsoft.api.model.DicOrg">
<id column="ID" jdbcType="DECIMAL" property="id" /> <id column="ID" jdbcType="DECIMAL" property="id"/>
<result column="CREATE_DATE" jdbcType="TIMESTAMP" property="createDate" /> <result column="CREATE_DATE" jdbcType="TIMESTAMP" property="createDate"/>
<result column="CREATE_USERID" jdbcType="DECIMAL" property="createUserid" /> <result column="CREATE_USERID" jdbcType="DECIMAL" property="createUserid"/>
<result column="STATE" jdbcType="DECIMAL" property="state" /> <result column="STATE" jdbcType="DECIMAL" property="state"/>
<result column="ORG_CODE" jdbcType="VARCHAR" property="orgCode" /> <result column="ORG_CODE" jdbcType="VARCHAR" property="orgCode"/>
<result column="ORG_NAME" jdbcType="VARCHAR" property="orgName" /> <result column="ORG_NAME" jdbcType="VARCHAR" property="orgName"/>
<result column="ORG_NO" jdbcType="VARCHAR" property="orgNo" /> <result column="ORG_NO" jdbcType="VARCHAR" property="orgNo"/>
<result column="ORG_SHORT_NAME" jdbcType="VARCHAR" property="orgShortName" /> <result column="ORG_SHORT_NAME" jdbcType="VARCHAR" property="orgShortName"/>
<result column="ORG_GROUP" jdbcType="VARCHAR" property="orgGroup" /> <result column="ORG_GROUP" jdbcType="VARCHAR" property="orgGroup"/>
<result column="ORG_TYPE" jdbcType="VARCHAR" property="orgType" /> <result column="ORG_TYPE" jdbcType="VARCHAR" property="orgType"/>
<result column="ORG_ADDRESS" jdbcType="VARCHAR" property="orgAddress" /> <result column="ORG_ADDRESS" jdbcType="VARCHAR" property="orgAddress"/>
<result column="PARENT_ID" jdbcType="DECIMAL" property="parentId" /> <result column="PARENT_ID" jdbcType="DECIMAL" property="parentId"/>
</resultMap> </resultMap>
<resultMap id="SummaryDept" type="com.bsoft.api.model.SerDepartment"> <resultMap id="SummaryDept" type="com.bsoft.api.model.SerDepartment">
<id column="ID" jdbcType="DECIMAL" property="id" /> <id column="ID" jdbcType="DECIMAL" property="id"/>
<result column="CREATE_DATE" jdbcType="TIMESTAMP" property="createDate" /> <result column="CREATE_DATE" jdbcType="TIMESTAMP" property="createDate"/>
<result column="CREATE_USERID" jdbcType="DECIMAL" property="createUserid" /> <result column="CREATE_USERID" jdbcType="DECIMAL" property="createUserid"/>
<result column="STATE" jdbcType="DECIMAL" property="state" /> <result column="STATE" jdbcType="DECIMAL" property="state"/>
<result column="ORG_ID" jdbcType="VARCHAR" property="orgId" /> <result column="ORG_ID" jdbcType="VARCHAR" property="orgId"/>
<result column="KSBM" jdbcType="VARCHAR" property="ksbm" /> <result column="KSBM" jdbcType="VARCHAR" property="ksbm"/>
<result column="KSMC" jdbcType="VARCHAR" property="ksmc" /> <result column="KSMC" jdbcType="VARCHAR" property="ksmc"/>
<result column="KSJC" jdbcType="VARCHAR" property="ksjc" /> <result column="KSJC" jdbcType="VARCHAR" property="ksjc"/>
</resultMap> </resultMap>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from DIC_ORG delete
where ID = #{id,jdbcType=DECIMAL} from DIC_ORG
</delete> where ID = #{id,jdbcType=DECIMAL}
<insert id="insert" parameterType="com.bsoft.api.model.DicOrg"> </delete>
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long"> <insert id="insert" parameterType="com.bsoft.api.model.DicOrg">
SELECT LAST_INSERT_ID() <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
</selectKey> SELECT LAST_INSERT_ID()
insert into DIC_ORG (CREATE_DATE, CREATE_USERID, `STATE`, </selectKey>
ORG_CODE, ORG_NAME, ORG_NO, insert into DIC_ORG (CREATE_DATE, CREATE_USERID, `STATE`,
ORG_SHORT_NAME, ORG_GROUP, ORG_TYPE, ORG_CODE, ORG_NAME, ORG_NO,
ORG_ADDRESS, PARENT_ID) ORG_SHORT_NAME, ORG_GROUP, ORG_TYPE,
values (#{createDate,jdbcType=TIMESTAMP}, #{createUserid,jdbcType=DECIMAL}, #{state,jdbcType=DECIMAL}, ORG_ADDRESS, PARENT_ID)
#{orgCode,jdbcType=VARCHAR}, #{orgName,jdbcType=VARCHAR}, #{orgNo,jdbcType=VARCHAR}, values (#{createDate,jdbcType=TIMESTAMP}, #{createUserid,jdbcType=DECIMAL}, #{state,jdbcType=DECIMAL},
#{orgShortName,jdbcType=VARCHAR}, #{orgGroup,jdbcType=VARCHAR}, #{orgType,jdbcType=VARCHAR}, #{orgCode,jdbcType=VARCHAR}, #{orgName,jdbcType=VARCHAR}, #{orgNo,jdbcType=VARCHAR},
#{orgAddress,jdbcType=VARCHAR}, #{parentId,jdbcType=DECIMAL}) #{orgShortName,jdbcType=VARCHAR}, #{orgGroup,jdbcType=VARCHAR}, #{orgType,jdbcType=VARCHAR},
</insert> #{orgAddress,jdbcType=VARCHAR}, #{parentId,jdbcType=DECIMAL})
<update id="updateByPrimaryKey" parameterType="com.bsoft.api.model.DicOrg"> </insert>
update DIC_ORG <update id="updateByPrimaryKey" parameterType="com.bsoft.api.model.DicOrg">
set CREATE_DATE = #{createDate,jdbcType=TIMESTAMP}, update DIC_ORG
CREATE_USERID = #{createUserid,jdbcType=DECIMAL}, set CREATE_DATE = #{createDate,jdbcType=TIMESTAMP},
`STATE` = #{state,jdbcType=DECIMAL}, CREATE_USERID = #{createUserid,jdbcType=DECIMAL},
ORG_CODE = #{orgCode,jdbcType=VARCHAR}, `STATE` = #{state,jdbcType=DECIMAL},
ORG_NAME = #{orgName,jdbcType=VARCHAR}, ORG_CODE = #{orgCode,jdbcType=VARCHAR},
ORG_NO = #{orgNo,jdbcType=VARCHAR}, ORG_NAME = #{orgName,jdbcType=VARCHAR},
ORG_SHORT_NAME = #{orgShortName,jdbcType=VARCHAR}, ORG_NO = #{orgNo,jdbcType=VARCHAR},
ORG_GROUP = #{orgGroup,jdbcType=VARCHAR}, ORG_SHORT_NAME = #{orgShortName,jdbcType=VARCHAR},
ORG_TYPE = #{orgType,jdbcType=VARCHAR}, ORG_GROUP = #{orgGroup,jdbcType=VARCHAR},
ORG_ADDRESS = #{orgAddress,jdbcType=VARCHAR}, ORG_TYPE = #{orgType,jdbcType=VARCHAR},
PARENT_ID = #{parentId,jdbcType=DECIMAL} ORG_ADDRESS = #{orgAddress,jdbcType=VARCHAR},
where ID = #{id,jdbcType=DECIMAL} PARENT_ID = #{parentId,jdbcType=DECIMAL}
</update> where ID = #{id,jdbcType=DECIMAL}
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> </update>
select ID, CREATE_DATE, CREATE_USERID, `STATE`, ORG_CODE, ORG_NAME, ORG_NO, ORG_SHORT_NAME, <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
ORG_GROUP, ORG_TYPE, ORG_ADDRESS, PARENT_ID select ID,
from DIC_ORG CREATE_DATE,
where ID = #{id,jdbcType=DECIMAL} CREATE_USERID,
</select> `STATE`,
<select id="selectAll" resultMap="BaseResultMap"> ORG_CODE,
select ID, CREATE_DATE, CREATE_USERID, `STATE`, ORG_CODE, ORG_NAME, ORG_NO, ORG_SHORT_NAME, ORG_NAME,
ORG_GROUP, ORG_TYPE, ORG_ADDRESS, PARENT_ID ORG_NO,
from DIC_ORG ORG_SHORT_NAME,
</select> ORG_GROUP,
<select id="selectByUser" resultMap="BaseResultMap"> ORG_TYPE,
SELECT o.* ORG_ADDRESS,
FROM SYS_USER_ORG_RS uor,DIC_ORG o PARENT_ID
where uor.ORG_ID=o.ID and uor.USER_ID= #{userId,jdbcType=DECIMAL} from DIC_ORG
and uor.STATE = 1 and o.STATE = 1 and o.PARENT_ID = 0 where ID = #{id,jdbcType=DECIMAL}
</select> </select>
<select id="selectDeptByUser" resultMap="SummaryDept"> <select id="selectAll" resultMap="BaseResultMap">
select o.ID,o.ORG_CODE as KSBM,o.ORG_NAME as KSMC,o.ORG_SHORT_NAME as KSJC select ID,
from SYS_USER_ORG_RS rs CREATE_DATE,
join DIC_ORG o on o.id = rs.ORG_ID and rs.STATE = 1 CREATE_USERID,
where o.STATE = 1 `STATE`,
<if test="orgId!=null"> ORG_CODE,
and o.PARENT_ID = #{orgId,jdbcType=DECIMAL} ORG_NAME,
</if> ORG_NO,
and rs.USER_ID = #{userId,jdbcType=DECIMAL} ORG_SHORT_NAME,
</select> ORG_GROUP,
ORG_TYPE,
ORG_ADDRESS,
PARENT_ID
from DIC_ORG
</select>
<select id="selectByUser" resultMap="BaseResultMap">
SELECT o.*
FROM SYS_USER_ORG_RS uor,
DIC_ORG o
where uor.ORG_ID = o.ID
and uor.USER_ID = #{userId,jdbcType=DECIMAL}
and uor.STATE = 1
and o.STATE = 1
and o.PARENT_ID = 0
</select>
<select id="selectDeptByUser" resultMap="SummaryDept">
select o.ID,o.ORG_CODE as KSBM,o.ORG_NAME as KSMC,o.ORG_SHORT_NAME as KSJC
from SYS_USER_ORG_RS rs
join DIC_ORG o on o.id = rs.ORG_ID and rs.STATE = 1
where o.STATE = 1
<if test="orgId!=null">
and o.PARENT_ID = #{orgId,jdbcType=DECIMAL}
</if>
and rs.USER_ID = #{userId,jdbcType=DECIMAL}
</select>
<select id="selectDeptByDisease" resultMap="SummaryDept">
select DISTINCT o.ID,o.ORG_CODE as KSBM,o.ORG_NAME as KSMC,o.ORG_SHORT_NAME as KSJC
from SYS_USER_ORG_RS rs
join DIC_ORG o on o.id = rs.ORG_ID and rs.STATE = 1
join val_block_values_1_5_2 v on v.KSBM=o.ORG_CODE
where o.STATE = 1
<if test="orgId!=null">
and o.PARENT_ID = #{orgId,jdbcType=DECIMAL}
</if>
<if test="disease!=null and date!=null">
and v.zbzbm = #{disease}
and v.time = #{date}
</if>
and rs.USER_ID = #{userId,jdbcType=DECIMAL}
</select>
</mapper> </mapper>
\ No newline at end of file
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