Commit 69accf28 by Suvalue

添加维度数值查询接口

parent bce74232
package com.bsoft.api.controller;
import com.bsoft.api.common.Result;
import com.bsoft.api.model.reqmodel.ReqDimValue;
import com.bsoft.api.model.respmodel.DimValue;
import com.bsoft.api.service.DicDimService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@Api(tags = "维度数值Api")
@RestController
public class DimController {
@Autowired
private DicDimService dicDimService;
/**
* 根据pageCode查询维度数值
* @return
* @throws Exception
*/
@PostMapping("dimValue")
// @Token
@ApiOperation("根据pageCode查询维度数值")
public Object getdimValueByPageCode(@RequestBody ReqDimValue reqDimValue) {
List<DimValue> dimValueList = dicDimService.getByPageCode(reqDimValue.getPageCode(), reqDimValue.getOrgId(), reqDimValue.getDate());
return Result.success(dimValueList);
}
}
......@@ -28,7 +28,7 @@ public class SerDiseaseController {
* @throws Exception
*/
@PostMapping("disease/level")
// @Token
@Token
@ApiOperation("根据等级查询疾病信息")
public Object getDiseaseByLevel(@RequestBody Disease.DiseaseLevel disease) throws InterruptedException {
List<DiseaseLevel> diseaseLevel = serDiseaseService.selectListByLevel(disease.getDate(),disease.getDiseaseId());
......
......@@ -22,7 +22,7 @@ public class SerDiseaseDocController {
private SerDiseaseDocService serDiseaseDocService;
@PostMapping("diseaseDoc")
@Token
// @Token
@ApiOperation("根据Code查询疾病关系信息")
public Object getDiseaseDoc(@RequestBody DiseaseDoc disease) throws InterruptedException {
List<SerDiseaseDocRs> list = serDiseaseDocService.getDiseaseDoc(disease.getDocCode(),disease.getMdcCode(),
......
......@@ -16,5 +16,7 @@ public interface DicDimMapper {
List<DicDim> selectByPageid(@Param("pageID") Integer pageID);
List<DicDim> selectByPageCode(@Param("pageCode") String pageCode);
int updateByPrimaryKey(DicDim record);
}
\ No newline at end of file
......@@ -15,6 +15,8 @@ public class DicDim {
private String dimField;
private Long dimType;
public Long getId() {
return id;
}
......@@ -62,4 +64,12 @@ public class DicDim {
public void setDimField(String dimField) {
this.dimField = dimField;
}
public Long getDimType() {
return dimType;
}
public void setDimType(Long dimType) {
this.dimType = dimType;
}
}
\ No newline at end of file
package com.bsoft.api.model;
import java.math.BigDecimal;
public class SerDimValue {
private BigDecimal id;
private Long orgId;
private String itemName;
private String itemValue;
private Long date;
private Long dimId;
public BigDecimal getId() {
return id;
}
public void setId(BigDecimal id) {
this.id = id;
}
public Long getOrgId() {
return orgId;
}
public void setOrgId(Long orgId) {
this.orgId = orgId;
}
public String getItemName() {
return itemName;
}
public void setItemName(String itemName) {
this.itemName = itemName;
}
public String getItemValue() {
return itemValue;
}
public void setItemValue(String itemValue) {
this.itemValue = itemValue;
}
public Long getDate() {
return date;
}
public void setDate(Long date) {
this.date = date;
}
public Long getDimId() {
return dimId;
}
public void setDimId(Long dimId) {
this.dimId = dimId;
}
public enum Dim_Type{
DATABASE(1, "需要从数据获取数据"),NODATA(0, "无所获取"),;
Dim_Type(int value, String desc){
this.value = value;
this.desc = desc;
}
private int value;
private String desc;
public int getValue() {
return value;
}
public String getDesc() {
return desc;
}
}
}
\ No newline at end of file
package com.bsoft.api.model.reqmodel;
import io.swagger.annotations.ApiModelProperty;
public class ReqDimValue {
@ApiModelProperty(value = "pageCode",required = true)
private String pageCode;
@ApiModelProperty("机构id")
private Long orgId;
@ApiModelProperty("时间")
private String date;
public String getPageCode() {
return pageCode;
}
public void setPageCode(String pageCode) {
this.pageCode = pageCode;
}
public Long getOrgId() {
return orgId;
}
public void setOrgId(Long orgId) {
this.orgId = orgId;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
}
package com.bsoft.api.model.respmodel;
import com.bsoft.api.model.DicDim;
import com.bsoft.api.model.SerDimValue;
import java.util.List;
public class DimValue {
private DicDim dicDim;
private List<SerDimValue> dimValues;
public DicDim getDicDim() {
return dicDim;
}
public void setDicDim(DicDim dicDim) {
this.dicDim = dicDim;
}
public List<SerDimValue> getDimValues() {
return dimValues;
}
public void setDimValues(List<SerDimValue> dimValues) {
this.dimValues = dimValues;
}
}
package com.bsoft.api.service;
import com.bsoft.api.model.DicDim;
import com.bsoft.api.model.respmodel.DimValue;
import java.util.List;
public interface DicDimService extends ServiceBase<DicDim> {
List<DimValue> getByPageCode(String pageCode,Long orgId,String date);
}
package com.bsoft.api.service.Impl;
import com.bsoft.api.mapper.DicDimMapper;
import com.bsoft.api.mapper.SerDimValueMapper;
import com.bsoft.api.model.DicDim;
import com.bsoft.api.model.SerDimValue;
import com.bsoft.api.model.respmodel.DimValue;
import com.bsoft.api.service.DicDimService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
@Service
public class DicDimServiceImpl implements DicDimService {
@Resource
private DicDimMapper dicDimMapper;
@Resource
private SerDimValueMapper serDimValueMapper;
@Override
public int add(DicDim dicDim) {
......@@ -44,4 +48,26 @@ public class DicDimServiceImpl implements DicDimService {
public int update(DicDim dicDim) {
return dicDimMapper.updateByPrimaryKey(dicDim);
}
@Override
public List<DimValue> getByPageCode(String pageCode, Long orgId, String date) {
List<DicDim> dicDimList = dicDimMapper.selectByPageCode(pageCode);
if(dicDimList!=null&&dicDimList.size()>0){
List<DimValue> dimValueList = new ArrayList<>();
for (DicDim dic:dicDimList) {
DimValue dimValue = new DimValue();
dimValue.setDicDim(dic);
if(dic.getDimType()== SerDimValue.Dim_Type.DATABASE.getValue()){
List<SerDimValue> serDimValueList = serDimValueMapper.selectByDimId(pageCode,orgId,dic.getId(),date);
dimValue.setDimValues(serDimValueList);
}
dimValueList.add(dimValue);
}
return dimValueList;
}
return null;
}
}
......@@ -18,6 +18,9 @@ public class SerDiseaseServiceImpl implements SerDiseaseService {
@Override
public List<DiseaseLevel> selectListByLevel(String date, Integer diseaseId){
SerDisease disease = serDiseaseMapper.selectByPrimaryKey(Long.valueOf(diseaseId));
if(disease==null){
return null;
}
//查询父级菜单对象
DiseaseLevel diseaseLevel = serDiseaseMapper.selectParentById(date,diseaseId);
List<DiseaseLevel> parentList = new ArrayList<>();
......
......@@ -8,7 +8,9 @@
<result column="STATE" jdbcType="DECIMAL" property="state" />
<result column="DIM_NAME" jdbcType="VARCHAR" property="dimName" />
<result column="DIM_FIELD" jdbcType="VARCHAR" property="dimField" />
<result column="DIM_TYPE" jdbcType="DECIMAL" property="dimType" />
</resultMap>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from LL.DIC_DIM
where ID = #{id,jdbcType=DECIMAL}
......@@ -18,9 +20,9 @@
select SEQ_DIC_DIM_ID.nextval from dual
</selectKey>
insert into LL.DIC_DIM (CREATE_DATE, CREATE_USERID, STATE,
DIM_NAME, DIM_FIELD)
DIM_NAME, DIM_FIELD,DIM_TYPE)
values (#{createDate,jdbcType=TIMESTAMP}, #{createUserid,jdbcType=DECIMAL}, #{state,jdbcType=DECIMAL},
#{dimName,jdbcType=VARCHAR}, #{dimField,jdbcType=VARCHAR})
#{dimName,jdbcType=VARCHAR}, #{dimField,jdbcType=VARCHAR},#{dimType,jdbcType=DECIMAL})
</insert>
<update id="updateByPrimaryKey" parameterType="com.bsoft.api.model.DicDim">
update LL.DIC_DIM
......@@ -28,20 +30,28 @@
CREATE_USERID = #{createUserid,jdbcType=DECIMAL},
STATE = #{state,jdbcType=DECIMAL},
DIM_NAME = #{dimName,jdbcType=VARCHAR},
DIM_FIELD = #{dimField,jdbcType=VARCHAR}
DIM_FIELD = #{dimField,jdbcType=VARCHAR},
DIM_TYPE=#{dimType,jdbcType=DECIMAL}
where ID = #{id,jdbcType=DECIMAL}
</update>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select ID, CREATE_DATE, CREATE_USERID, STATE, DIM_NAME, DIM_FIELD
select ID, CREATE_DATE, CREATE_USERID, STATE, DIM_NAME, DIM_FIELD,DIM_TYPE
from LL.DIC_DIM
where ID = #{id,jdbcType=DECIMAL}
</select>
<select id="selectAll" resultMap="BaseResultMap">
select ID, CREATE_DATE, CREATE_USERID, STATE, DIM_NAME, DIM_FIELD
select ID, CREATE_DATE, CREATE_USERID, STATE, DIM_NAME, DIM_FIELD,DIM_TYPE
from LL.DIC_DIM
</select>
<select id="selectByPageid" resultMap="BaseResultMap">
<select id="selectByPageid" resultMap="BaseResultMap">
select dd.* from SER_PAGE_DIM_RS spdr,DIC_DIM dd
where spdr.DIM_ID=dd.ID and spdr.PAGE_ID=#{pageID,jdbcType=DECIMAL}
</select>
</select>
<select id="selectByPageCode" resultMap="BaseResultMap">
SELECT d.*
from DIC_DIM d
LEFT JOIN(
SELECT DISTINCT pdr.DIM_ID FROM SER_PAGE_DIM_RS pdr LEFT JOIN SER_PAGE p ON pdr.PAGE_ID = p.ID AND p.PAGE_CODE =#{pageCode,jdbcType=VARCHAR}) d2
on d.ID=d2.DIM_ID
</select>
</mapper>
\ No newline at end of file
<?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">
<mapper namespace="com.bsoft.api.mapper.SerDimValueMapper">
<resultMap id="BaseResultMap" type="com.bsoft.api.model.SerDimValue">
<id column="ID" jdbcType="DECIMAL" property="id" />
<result column="ORG_ID" jdbcType="DECIMAL" property="orgId" />
<result column="ITEM_NAME" jdbcType="VARCHAR" property="itemName" />
<result column="ITEM_VALUE" jdbcType="VARCHAR" property="itemValue" />
<result column="DATE" jdbcType="DECIMAL" property="date" />
<result column="DIM_ID" jdbcType="DECIMAL" property="dimId" />
</resultMap>
<delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
delete from LL.SER_DIM_VALUE
where ID = #{id,jdbcType=DECIMAL}
</delete>
<insert id="insert" parameterType="com.bsoft.api.model.SerDimValue">
<selectKey keyProperty="id" order="AFTER" resultType="java.math.BigDecimal">
select SEQ_SER_DIM_VALUE_ID.nextval from dual
</selectKey>
insert into LL.SER_DIM_VALUE (ORG_ID, ITEM_NAME, ITEM_VALUE,
"DATE", DIM_ID)
values (#{orgId,jdbcType=DECIMAL}, #{itemName,jdbcType=VARCHAR}, #{itemValue,jdbcType=VARCHAR},
#{date,jdbcType=DECIMAL}, #{dimId,jdbcType=DECIMAL})
</insert>
<update id="updateByPrimaryKey" parameterType="com.bsoft.api.model.SerDimValue">
update LL.SER_DIM_VALUE
set ORG_ID = #{orgId,jdbcType=DECIMAL},
ITEM_NAME = #{itemName,jdbcType=VARCHAR},
ITEM_VALUE = #{itemValue,jdbcType=VARCHAR},
"DATE" = #{date,jdbcType=DECIMAL},
DIM_ID = #{dimId,jdbcType=DECIMAL}
where ID = #{id,jdbcType=DECIMAL}
</update>
<select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
select ID, ORG_ID, ITEM_NAME, ITEM_VALUE, "DATE", DIM_ID
from LL.SER_DIM_VALUE
where ID = #{id,jdbcType=DECIMAL}
</select>
<select id="selectAll" resultMap="BaseResultMap">
select ID, ORG_ID, ITEM_NAME, ITEM_VALUE, "DATE", DIM_ID
from LL.SER_DIM_VALUE
</select>
<select id="selectByDimId" resultMap="BaseResultMap">
SELECT dv.*
FROM SER_DIM_VALUE dv
LEFT JOIN ( SELECT DISTINCT pdr.DIM_ID FROM SER_PAGE_DIM_RS pdr LEFT JOIN SER_PAGE p ON pdr.PAGE_ID = p.ID AND p.PAGE_CODE = #{pageCode,jdbcType=VARCHAR}) d
ON dv.DIM_ID = d.DIM_ID
where 1=1
<if test="dimId!=null">
and dv.DIM_ID=#{dimId,jdbcType=DECIMAL}
</if>
<if test="orgId!=null">
and dv.ORG_ID=#{orgId,jdbcType=DECIMAL}
</if>
<if test="date!=null">
and dv."DATE"=#{date,jdbcType=VARCHAR}
</if>
</select>
</mapper>
\ No newline at end of file
......@@ -67,7 +67,7 @@
<table width="60%" class="table">
<thead>
<tr>
<th style="">编码</th>
<th>编码</th>
<th>名称</th>
<th>字段名</th>
</tr>
......
......@@ -40,14 +40,14 @@
<!-- 生成映射文件配置 -->
<sqlMapGenerator targetPackage="mapper" targetProject="src/main/resources"/>
<!-- 生成映射接口配置 -->
<!-- <javaClientGenerator targetPackage="com.bsoft.api.mapper" targetProject="src/main/java" type="XMLMAPPER"/>-->
<javaClientGenerator targetPackage="com.bsoft.api.mapper" targetProject="src/main/java" type="XMLMAPPER"/>
<!-- <table tableName="sys_user" schema="ll" >-->
<!-- &lt;!&ndash; 主键生成方式 &ndash;&gt;-->
<!-- <generatedKey column="id" sqlStatement="select SEQ_SYS_USER_ID.nextval from dual" identity="true" />-->
<!-- </table>-->
<table tableName="SER_DISEASE_DOC_RS" schema="ll" >
<generatedKey column="id" sqlStatement="select SEQ_SER_DISEASE_DOC_RS_ID.nextval from dual" identity="true" />
<table tableName="SER_DIM_VALUE" schema="ll" >
<generatedKey column="id" sqlStatement="select SEQ_SER_DIM_VALUE_ID.nextval from dual" identity="true" />
</table>
<!-- <table tableName="DIC_IND" schema="ll" >-->
<!-- <generatedKey column="id" sqlStatement="select SEQ_DIC_IND_ID.nextval from dual" identity="true" />-->
......
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