Commit 79c20ae4 by Suvalue

登录时返回机构信息,根据疾病id查询疾病树状图

parent e8504622
package com.bsoft.api.controller; package com.bsoft.api.controller;
import com.bsoft.api.model.respmodel.IndInfo;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -18,20 +17,8 @@ public class IndController { ...@@ -18,20 +17,8 @@ public class IndController {
public ModelAndView index(Model model, String filter){ public ModelAndView index(Model model, String filter){
model.addAttribute("title", "指标搜索"); model.addAttribute("title", "指标搜索");
// TODO 查询指标数据
List<IndInfo> list = new ArrayList<IndInfo>(){
{
add(new IndInfo(){
{
setCode("1");
setName("指标1");
setFieldName("ZB");
}
});
}
};
model.addAttribute("indList", list); model.addAttribute("indList", null);
model.addAttribute("filter", filter==null?"":filter); model.addAttribute("filter", filter==null?"":filter);
ModelAndView mav = new ModelAndView("ind", "indModel", model); ModelAndView mav = new ModelAndView("ind", "indModel", model);
......
...@@ -4,6 +4,7 @@ import com.bsoft.api.common.Result; ...@@ -4,6 +4,7 @@ import com.bsoft.api.common.Result;
import com.bsoft.api.common.annotations.Token; import com.bsoft.api.common.annotations.Token;
import com.bsoft.api.model.SerDisease; import com.bsoft.api.model.SerDisease;
import com.bsoft.api.model.reqmodel.Disease; import com.bsoft.api.model.reqmodel.Disease;
import com.bsoft.api.model.respmodel.DiseaseLevel;
import com.bsoft.api.service.SerDiseaseService; import com.bsoft.api.service.SerDiseaseService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -27,27 +28,18 @@ public class SerDiseaseController { ...@@ -27,27 +28,18 @@ public class SerDiseaseController {
* @throws Exception * @throws Exception
*/ */
@PostMapping("disease/level") @PostMapping("disease/level")
@Token // @Token
@ApiOperation("根据等级查询疾病信息") @ApiOperation("根据等级查询疾病信息")
public Object getDiseaseByLevel(@RequestBody Disease.DiseaseLevel disease) throws InterruptedException { public Object getDiseaseByLevel(@RequestBody Disease.DiseaseLevel disease) throws InterruptedException {
return Result.success(new ArrayList<com.bsoft.api.model.respmodel.DiseaseLevel>(){ List<DiseaseLevel> diseaseLevel = serDiseaseService.selectListByLevel(disease.getDate(),disease.getDiseaseId());
{ return Result.success(diseaseLevel);
add(new com.bsoft.api.model.respmodel.DiseaseLevel(){{
setDiseaseLevelList(new ArrayList<com.bsoft.api.model.respmodel.DiseaseLevel>(){
{
add(new com.bsoft.api.model.respmodel.DiseaseLevel());
}
});
}});
}
} );
} }
@PostMapping("disease/name") @PostMapping("disease/name")
@Token @Token
@ApiOperation("根据疾病名称查询疾病信息") @ApiOperation("根据疾病名称查询疾病信息")
public Object getDiseaseByMdcName(@RequestBody Disease.DiseaseName disease) throws InterruptedException { public Object getDiseaseByMdcName(@RequestBody Disease.DiseaseName disease) throws InterruptedException {
List<SerDisease> list = serDiseaseService.selectByMdcName(disease.getDate().toString(),disease.getMdcName()); List<SerDisease> list = serDiseaseService.selectByMdcName(disease.getDate(),disease.getMdcName());
return Result.success(list); return Result.success(list);
} }
...@@ -55,7 +47,7 @@ public class SerDiseaseController { ...@@ -55,7 +47,7 @@ public class SerDiseaseController {
@Token @Token
@ApiOperation("查询特定等级下所有数据") @ApiOperation("查询特定等级下所有数据")
public Object getDiseaseByLevelSon(@RequestBody Disease.DiseaseLevelSon disease) throws InterruptedException { public Object getDiseaseByLevelSon(@RequestBody Disease.DiseaseLevelSon disease) throws InterruptedException {
List<SerDisease> list = serDiseaseService.selectByLevel(disease.getDate().toString(),disease.getLevel().intValue()); List<SerDisease> list = serDiseaseService.selectByLevel(disease.getDate(),disease.getLevel().intValue());
return Result.success(list); return Result.success(list);
} }
......
package com.bsoft.api.mapper; package com.bsoft.api.mapper;
import com.bsoft.api.model.DicOrg; import com.bsoft.api.model.DicOrg;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
public interface DicOrgMapper { public interface DicOrgMapper {
...@@ -12,5 +14,7 @@ public interface DicOrgMapper { ...@@ -12,5 +14,7 @@ public interface DicOrgMapper {
List<DicOrg> selectAll(); List<DicOrg> selectAll();
List<DicOrg> selectByUser(@Param("userId") Long userId);
int updateByPrimaryKey(DicOrg record); int updateByPrimaryKey(DicOrg record);
} }
\ No newline at end of file
package com.bsoft.api.mapper; package com.bsoft.api.mapper;
import com.bsoft.api.model.SerDisease; import com.bsoft.api.model.SerDisease;
import com.bsoft.api.model.respmodel.DiseaseLevel;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
...@@ -19,6 +20,10 @@ public interface SerDiseaseMapper { ...@@ -19,6 +20,10 @@ public interface SerDiseaseMapper {
List<SerDisease> selectByLevel(@Param("date") String date,@Param("level") Integer level); List<SerDisease> selectByLevel(@Param("date") String date,@Param("level") Integer level);
DiseaseLevel selectParentById(@Param("date") String date, @Param("diseaseId") Integer diseaseId);
List<DiseaseLevel> selectSonById(@Param("date") String date, @Param("diseaseId") Integer diseaseId);
int updateByPrimaryKey(SerDisease record); int updateByPrimaryKey(SerDisease record);
} }
...@@ -9,36 +9,28 @@ public class Disease { ...@@ -9,36 +9,28 @@ public class Disease {
* 等级查询疾病实体 * 等级查询疾病实体
*/ */
public static class DiseaseLevel { public static class DiseaseLevel {
@ApiModelProperty(value = "等级",required = true)
private BigDecimal level; @ApiModelProperty(value = "疾病ID",required = true)
private Integer diseaseId;
@ApiModelProperty(value = "时间",required = true) @ApiModelProperty(value = "时间",required = true)
private BigDecimal date; private String date;
@ApiModelProperty("编码")
private String mdcCode;
public BigDecimal getLevel() { public Integer getDiseaseId() {
return level; return diseaseId;
} }
public void setLevel(BigDecimal level) { public void setDiseaseId(Integer diseaseId) {
this.level = level; this.diseaseId = diseaseId;
} }
public BigDecimal getDate() { public String getDate() {
return date; return date;
} }
public void setDate(BigDecimal date) { public void setDate(String date) {
this.date = date; this.date = date;
} }
public String getMdcCode() {
return mdcCode;
}
public void setMdcCode(String mdcCode) {
this.mdcCode = mdcCode;
}
} }
/** /**
...@@ -47,15 +39,15 @@ public class Disease { ...@@ -47,15 +39,15 @@ public class Disease {
public static class DiseaseName { public static class DiseaseName {
@ApiModelProperty(value = "时间",required = true) @ApiModelProperty(value = "时间",required = true)
private BigDecimal date; private String date;
@ApiModelProperty("疾病名称") @ApiModelProperty("疾病名称")
private String mdcName; private String mdcName;
public BigDecimal getDate() { public String getDate() {
return date; return date;
} }
public void setDate(BigDecimal date) { public void setDate(String date) {
this.date = date; this.date = date;
} }
...@@ -75,13 +67,13 @@ public class Disease { ...@@ -75,13 +67,13 @@ public class Disease {
@ApiModelProperty(value = "等级",required = true) @ApiModelProperty(value = "等级",required = true)
private BigDecimal level; private BigDecimal level;
@ApiModelProperty(value = "时间",required = true) @ApiModelProperty(value = "时间",required = true)
private BigDecimal date; private String date;
public BigDecimal getDate() { public String getDate() {
return date; return date;
} }
public void setDate(BigDecimal date) { public void setDate(String date) {
this.date = date; this.date = date;
} }
public BigDecimal getLevel() { public BigDecimal getLevel() {
......
package com.bsoft.api.service.Impl; package com.bsoft.api.service.Impl;
import com.bsoft.api.common.utils.TokenUtil; import com.bsoft.api.common.utils.TokenUtil;
import com.bsoft.api.mapper.DicOrgMapper;
import com.bsoft.api.mapper.SysUserMapper; import com.bsoft.api.mapper.SysUserMapper;
import com.bsoft.api.model.SysUser; import com.bsoft.api.model.SysUser;
import com.bsoft.api.service.LoginService; import com.bsoft.api.service.LoginService;
...@@ -21,6 +22,8 @@ public class LoginServiceImpl implements LoginService { ...@@ -21,6 +22,8 @@ public class LoginServiceImpl implements LoginService {
@Resource @Resource
private SysUserMapper sysUserMapper; private SysUserMapper sysUserMapper;
@Resource
private DicOrgMapper dicOrgMapper;
@Override @Override
public LoginInfo login(String logName, String password,String ip) { public LoginInfo login(String logName, String password,String ip) {
...@@ -38,6 +41,8 @@ public class LoginServiceImpl implements LoginService { ...@@ -38,6 +41,8 @@ public class LoginServiceImpl implements LoginService {
user.setPassword(null); user.setPassword(null);
loginInfo.setToken(token); loginInfo.setToken(token);
loginInfo.setUser(user); loginInfo.setUser(user);
//查询用户机构
loginInfo.setOrg(dicOrgMapper.selectByUser(user.getId()));
} }
return loginInfo; return loginInfo;
} }
......
...@@ -2,9 +2,12 @@ package com.bsoft.api.service.Impl; ...@@ -2,9 +2,12 @@ package com.bsoft.api.service.Impl;
import com.bsoft.api.mapper.SerDiseaseMapper; import com.bsoft.api.mapper.SerDiseaseMapper;
import com.bsoft.api.model.SerDisease; import com.bsoft.api.model.SerDisease;
import com.bsoft.api.model.reqmodel.Disease;
import com.bsoft.api.model.respmodel.DiseaseLevel;
import com.bsoft.api.service.SerDiseaseService; import com.bsoft.api.service.SerDiseaseService;
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
...@@ -13,6 +16,44 @@ public class SerDiseaseServiceImpl implements SerDiseaseService { ...@@ -13,6 +16,44 @@ public class SerDiseaseServiceImpl implements SerDiseaseService {
private SerDiseaseMapper serDiseaseMapper; private SerDiseaseMapper serDiseaseMapper;
@Override @Override
public List<DiseaseLevel> selectListByLevel(String date, Integer diseaseId){
SerDisease disease = serDiseaseMapper.selectByPrimaryKey(Long.valueOf(diseaseId));
//查询父级菜单对象
DiseaseLevel diseaseLevel = serDiseaseMapper.selectParentById(date,diseaseId);
List<DiseaseLevel> parentList = new ArrayList<>();
//查询同级菜单列表
List<SerDisease> serDiseaseList = serDiseaseMapper.selectByLevel(date,disease.getLevel().intValue());
List<DiseaseLevel> diseaseLevelList = new ArrayList<>();
for (SerDisease serDiseases: serDiseaseList) {
DiseaseLevel diseaseLevel1 = new DiseaseLevel();
//查询子级菜单列表
if(serDiseases.getId().intValue()==diseaseId){
List<DiseaseLevel> diseaseLevelList1 = serDiseaseMapper.selectSonById(date,diseaseId);
diseaseLevel1.setDiseaseLevelList(diseaseLevelList1);
}
diseaseLevel1.setDate(serDiseases.getDate());
diseaseLevel1.setId(serDiseases.getId());
diseaseLevel1.setLevel(serDiseases.getLevel());
diseaseLevel1.setMdcCode(serDiseases.getMdcCode());
diseaseLevel1.setMdcName(serDiseases.getMdcName());
diseaseLevel1.setMdcNum(serDiseases.getMdcNum());
diseaseLevel1.setOrgId(serDiseases.getOrgId());
diseaseLevel1.setOrgName(serDiseases.getOrgName());
diseaseLevel1.setParentId(serDiseases.getParentId());
diseaseLevel1.setState(serDiseases.getState());
diseaseLevelList.add(diseaseLevel1);
}
if(diseaseLevel!=null){
diseaseLevel.setDiseaseLevelList(diseaseLevelList);
parentList.add(diseaseLevel);
return parentList;
}else {
return diseaseLevelList;
}
}
@Override
public List<SerDisease> selectByMdcName(String date, String mdcName) { public List<SerDisease> selectByMdcName(String date, String mdcName) {
return serDiseaseMapper.selectByMdcName(date,mdcName); return serDiseaseMapper.selectByMdcName(date,mdcName);
} }
...@@ -20,5 +61,7 @@ public class SerDiseaseServiceImpl implements SerDiseaseService { ...@@ -20,5 +61,7 @@ public class SerDiseaseServiceImpl implements SerDiseaseService {
@Override @Override
public List<SerDisease> selectByLevel(String date, Integer level) { public List<SerDisease> selectByLevel(String date, Integer level) {
return serDiseaseMapper.selectByLevel(date,level); return serDiseaseMapper.selectByLevel(date,level);
} }
} }
package com.bsoft.api.service; package com.bsoft.api.service;
import com.bsoft.api.model.DicOrg;
import com.bsoft.api.model.SysUser; import com.bsoft.api.model.SysUser;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.util.List;
public interface LoginService { public interface LoginService {
...@@ -17,13 +20,19 @@ public interface LoginService { ...@@ -17,13 +20,19 @@ public interface LoginService {
private String token; private String token;
@ApiModelProperty("用户信息") @ApiModelProperty("用户信息")
private SysUser user; private SysUser user;
@ApiModelProperty("用户机构信息")
private List<DicOrg> org;
public LoginInfo() { public LoginInfo() {
} }
public LoginInfo(String token, SysUser user) { public LoginInfo(String token, SysUser user,List<DicOrg> org) {
this.token = token; this.token = token;
this.user = user; this.user = user;
this.org=org;
} }
public String getToken() { public String getToken() {
...@@ -41,5 +50,13 @@ public interface LoginService { ...@@ -41,5 +50,13 @@ public interface LoginService {
public void setUser(SysUser user) { public void setUser(SysUser user) {
this.user = user; this.user = user;
} }
public List<DicOrg> getOrg() {
return org;
}
public void setOrg(List<DicOrg> org) {
this.org = org;
}
} }
} }
package com.bsoft.api.service; package com.bsoft.api.service;
import com.bsoft.api.model.SerDisease; import com.bsoft.api.model.SerDisease;
import com.bsoft.api.model.respmodel.DiseaseLevel;
import java.util.List; import java.util.List;
...@@ -8,4 +9,5 @@ public interface SerDiseaseService { ...@@ -8,4 +9,5 @@ public interface SerDiseaseService {
List<SerDisease> selectByMdcName(String date,String mdcName); List<SerDisease> selectByMdcName(String date,String mdcName);
List<SerDisease> selectByLevel(String date,Integer level); List<SerDisease> selectByLevel(String date,Integer level);
List<DiseaseLevel> selectListByLevel(String date,Integer diseaseId);
} }
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
<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>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from LL.DIC_ORG delete from LL.DIC_ORG
where ID = #{id,jdbcType=DECIMAL} where ID = #{id,jdbcType=DECIMAL}
...@@ -61,4 +62,9 @@ ...@@ -61,4 +62,9 @@
ORG_GROUP, ORG_TYPE, ORG_ADDRESS, PARENT_ID ORG_GROUP, ORG_TYPE, ORG_ADDRESS, PARENT_ID
from LL.DIC_ORG from LL.DIC_ORG
</select> </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}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -15,6 +15,18 @@ ...@@ -15,6 +15,18 @@
<result column="ORG_ID" jdbcType="DECIMAL" property="orgId" /> <result column="ORG_ID" jdbcType="DECIMAL" property="orgId" />
<result column="ORG_NAME" jdbcType="VARCHAR" property="orgName" /> <result column="ORG_NAME" jdbcType="VARCHAR" property="orgName" />
</resultMap> </resultMap>
<resultMap id="DiseaseLevel" type="com.bsoft.api.model.respmodel.DiseaseLevel">
<id column="ID" jdbcType="DECIMAL" property="id" />
<result column="STATE" jdbcType="DECIMAL" property="state" />
<result column="MDC_CODE" jdbcType="VARCHAR" property="mdcCode" />
<result column="MDC_NAME" jdbcType="VARCHAR" property="mdcName" />
<result column="DATE" jdbcType="DECIMAL" property="date" />
<result column="MDC_NUM" jdbcType="DECIMAL" property="mdcNum" />
<result column="PARENT_ID" jdbcType="DECIMAL" property="parentId" />
<result column="LEVEL" jdbcType="DECIMAL" property="level" />
<result column="ORG_ID" jdbcType="DECIMAL" property="orgId" />
<result column="ORG_NAME" jdbcType="VARCHAR" property="orgName" />
</resultMap>
<delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal"> <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
delete from LL.SER_DISEASE delete from LL.SER_DISEASE
...@@ -48,9 +60,9 @@ ...@@ -48,9 +60,9 @@
ORG_NAME = #{orgName,jdbcType=VARCHAR} ORG_NAME = #{orgName,jdbcType=VARCHAR}
where ID = #{id,jdbcType=DECIMAL} where ID = #{id,jdbcType=DECIMAL}
</update> </update>
<select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" resultMap="BaseResultMap">
select ID, CREATE_DATE, CREATE_USERID, STATE, MDC_CODE, MDC_NAME, DATE, MDC_NUM, select ID, CREATE_DATE, CREATE_USERID, STATE, MDC_CODE, MDC_NAME, "DATE", MDC_NUM,
PARENT_ID, LEVEL, ORG_ID, ORG_NAME PARENT_ID, "LEVEL", ORG_ID, ORG_NAME
from LL.SER_DISEASE from LL.SER_DISEASE
where ID = #{id,jdbcType=DECIMAL} where ID = #{id,jdbcType=DECIMAL}
</select> </select>
...@@ -63,7 +75,7 @@ ...@@ -63,7 +75,7 @@
select ID, CREATE_DATE, CREATE_USERID, STATE, MDC_CODE, MDC_NAME, "DATE", MDC_NUM, select ID, CREATE_DATE, CREATE_USERID, STATE, MDC_CODE, MDC_NAME, "DATE", MDC_NUM,
PARENT_ID,"LEVEL", ORG_ID, ORG_NAME PARENT_ID,"LEVEL", ORG_ID, ORG_NAME
from LL.SER_DISEASE from LL.SER_DISEASE
where 1 = 1 where 1 = 1 and STATE=1
<if test="date!=null"> <if test="date!=null">
and "DATE" = #{date,jdbcType=VARCHAR} and "DATE" = #{date,jdbcType=VARCHAR}
</if> </if>
...@@ -75,7 +87,7 @@ ...@@ -75,7 +87,7 @@
select ID, CREATE_DATE, CREATE_USERID, STATE, MDC_CODE, MDC_NAME, "DATE", MDC_NUM, select ID, CREATE_DATE, CREATE_USERID, STATE, MDC_CODE, MDC_NAME, "DATE", MDC_NUM,
PARENT_ID,"LEVEL", ORG_ID, ORG_NAME PARENT_ID,"LEVEL", ORG_ID, ORG_NAME
from LL.SER_DISEASE from LL.SER_DISEASE
where 1 = 1 where 1 = 1 and STATE=1
<if test="date!=null"> <if test="date!=null">
and "DATE" = #{date,jdbcType=VARCHAR} and "DATE" = #{date,jdbcType=VARCHAR}
</if> </if>
...@@ -83,4 +95,26 @@ ...@@ -83,4 +95,26 @@
and "LEVEL" = #{level,jdbcType=DECIMAL} and "LEVEL" = #{level,jdbcType=DECIMAL}
</if> </if>
</select> </select>
<select id="selectParentById" resultMap="DiseaseLevel">
select *
from SER_DISEASE
where 1 = 1 and STATE=1
<if test="date!=null">
and "DATE" = #{date,jdbcType=VARCHAR}
</if>
<if test="diseaseId!=null">
and id=(select PARENT_ID from SER_DISEASE where id = #{diseaseId,jdbcType=DECIMAL} )
</if>
</select>
<select id="selectSonById" resultMap="DiseaseLevel">
select *
from SER_DISEASE
where 1 = 1 and STATE=1
<if test="date!=null">
and "DATE" = #{date,jdbcType=VARCHAR}
</if>
<if test="diseaseId!=null">
and PARENT_ID=#{diseaseId,jdbcType=DECIMAL}
</if>
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -25,9 +25,9 @@ ...@@ -25,9 +25,9 @@
<td colspan="2">无数据</td> <td colspan="2">无数据</td>
</tr> </tr>
<tr th:each="ind : ${indModel.indList}"> <tr th:each="ind : ${indModel.indList}">
<td th:text="${ind.code}"></td> <td th:text="${ind.indCode}"></td>
<td th:text="${ind.name}"></td> <td th:text="${ind.indName}"></td>
<td th:text="${ind.fieldName}"></td> <td th:text="${ind.computeMode}"></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
......
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