Commit 048c3c81 by Suvalue

住院门诊数据接口修改

parent 33d05fde
package com.bsoft.api.model.respmodel; package com.bsoft.api.model.respmodel;
import com.bsoft.api.model.SerProjValue; import com.bsoft.api.model.SerProjValue;
import lombok.Data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List;
@Data
public class SerProjValueResp extends SerProjValue { public class SerProjValueResp extends SerProjValue {
private String projName; private String projName;
private BigDecimal isBudget; private BigDecimal isBudget;
private BigDecimal parent;
public String getProjName() { private List<SerProjValueResp> childs;
return projName;
}
public void setProjName(String projName) {
this.projName = projName;
}
public BigDecimal getIsBudget() {
return isBudget;
}
public void setIsBudget(BigDecimal isBudget) {
this.isBudget = isBudget;
}
} }
...@@ -9,6 +9,7 @@ import com.bsoft.api.mapper.SerProjMapper; ...@@ -9,6 +9,7 @@ import com.bsoft.api.mapper.SerProjMapper;
import com.bsoft.api.mapper.SerProjValueMapper; import com.bsoft.api.mapper.SerProjValueMapper;
import com.bsoft.api.model.SerPageValueConfig; import com.bsoft.api.model.SerPageValueConfig;
import com.bsoft.api.model.SerProjValue; import com.bsoft.api.model.SerProjValue;
import com.bsoft.api.model.SysMenu;
import com.bsoft.api.model.reqmodel.AddBudgetValue; import com.bsoft.api.model.reqmodel.AddBudgetValue;
import com.bsoft.api.model.reqmodel.BudgetValue; import com.bsoft.api.model.reqmodel.BudgetValue;
import com.bsoft.api.model.respmodel.*; import com.bsoft.api.model.respmodel.*;
...@@ -19,6 +20,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -19,6 +20,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
@Service @Service
public class SerProjValueServiceImpl implements SerProjValueService { public class SerProjValueServiceImpl implements SerProjValueService {
...@@ -39,6 +41,8 @@ public class SerProjValueServiceImpl implements SerProjValueService { ...@@ -39,6 +41,8 @@ public class SerProjValueServiceImpl implements SerProjValueService {
if(enumList != null && enumList.size() > 0){ if(enumList != null && enumList.size() > 0){
ProjectValue projectValue = null; ProjectValue projectValue = null;
List<ProjectInfo> projectInfo = null; List<ProjectInfo> projectInfo = null;
List<SerProjValueResp> values = null;
List<SerProjValueResp> resultValues = null;
for(Map<String,Object> enumInfo : enumList){ for(Map<String,Object> enumInfo : enumList){
projectValue = new ProjectValue(); projectValue = new ProjectValue();
projectValue.setTypeId((Integer)enumInfo.get("value")); projectValue.setTypeId((Integer)enumInfo.get("value"));
...@@ -46,10 +50,11 @@ public class SerProjValueServiceImpl implements SerProjValueService { ...@@ -46,10 +50,11 @@ public class SerProjValueServiceImpl implements SerProjValueService {
projectInfo = serProjMapper.selectState(projectType,(Integer)enumInfo.get("value")); projectInfo = serProjMapper.selectState(projectType,(Integer)enumInfo.get("value"));
if(projectInfo != null && projectInfo.size() > 0){ if(projectInfo != null && projectInfo.size() > 0){
for(ProjectInfo projInfo : projectInfo){ for(ProjectInfo projInfo : projectInfo){
List<SerProjValueResp> values = serProjValueMapper.selectValue(projectType,(Integer)enumInfo.get("value"), values = serProjValueMapper.selectValue(projectType,(Integer)enumInfo.get("value"),
projInfo.getExponentId(),deptCode,date,null); projInfo.getExponentId(),deptCode,date,null);
if(values != null && values.size() > 0) resultValues = getLevelData(values,BigDecimal.valueOf(PROJ_TOP_PARENT_ID));
projInfo.setProjectValues(values); if(resultValues != null && resultValues.size() > 0)
projInfo.setProjectValues(resultValues);
} }
} }
projectValue.setProject(projectInfo); projectValue.setProject(projectInfo);
...@@ -135,4 +140,17 @@ public class SerProjValueServiceImpl implements SerProjValueService { ...@@ -135,4 +140,17 @@ public class SerProjValueServiceImpl implements SerProjValueService {
} }
private List<SerProjValueResp> getLevelData(List<SerProjValueResp> list,BigDecimal parentcode) {
List<SerProjValueResp> resultList = new ArrayList<>();
for(SerProjValueResp data : list){
if(data.getParent().equals(parentcode)){
List<SerProjValueResp> childList = getLevelData(list,data.getProjId());
childList = childList.stream().sorted(Comparator.comparing(SerProjValueResp::getSort)).collect(Collectors.toList());
data.setChilds(childList);
resultList.add(data);
}
}
return resultList;
}
} }
...@@ -5,6 +5,9 @@ import com.bsoft.api.model.reqmodel.AddBudgetValue; ...@@ -5,6 +5,9 @@ import com.bsoft.api.model.reqmodel.AddBudgetValue;
import java.util.Map; import java.util.Map;
public interface SerProjValueService { public interface SerProjValueService {
//顶级项目的父级id
final static Integer PROJ_TOP_PARENT_ID =0;
Object getValue(Integer projectType,Integer date,String deptCode) throws Throwable; Object getValue(Integer projectType,Integer date,String deptCode) throws Throwable;
boolean save(AddBudgetValue request); boolean save(AddBudgetValue request);
......
...@@ -5,7 +5,7 @@ jdbc.password=123456 ...@@ -5,7 +5,7 @@ jdbc.password=123456
jdbc.driverClass=com.mysql.jdbc.Driver jdbc.driverClass=com.mysql.jdbc.Driver
spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
spring.datasource.username=scml_zp spring.datasource.username=scml_zp_cs
spring.datasource.password=123 spring.datasource.password=123
spring.datasource.url=jdbc:oracle:thin:@192.168.18.171:1521:his spring.datasource.url=jdbc:oracle:thin:@192.168.18.171:1521:his
......
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
where ID = #{id,jdbcType=DECIMAL} where ID = #{id,jdbcType=DECIMAL}
</select> </select>
<select id="selectAll" resultMap="BaseResultMap"> <select id="selectAll" resultMap="BaseResultMap">
<select id="selectAll" resultMap="BaseResultMap">
select ID, CREATE_DATE, CREATE_USERID, STATE, BLOCK_ID, PAGE_ID,WHERE_CLAUSE select ID, CREATE_DATE, CREATE_USERID, STATE, BLOCK_ID, PAGE_ID,WHERE_CLAUSE
from SER_PAGE_BLOCK_RS from SER_PAGE_BLOCK_RS
</select> </select>
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
<resultMap id="SerProjValueResp" extends="BaseResultMap" type="com.bsoft.api.model.respmodel.SerProjValueResp"> <resultMap id="SerProjValueResp" extends="BaseResultMap" type="com.bsoft.api.model.respmodel.SerProjValueResp">
<result column="PROJ_NAME" jdbcType="VARCHAR" property="projName"/> <result column="PROJ_NAME" jdbcType="VARCHAR" property="projName"/>
<result column="IS_BUDGET" jdbcType="DECIMAL" property="isBudget"/> <result column="IS_BUDGET" jdbcType="DECIMAL" property="isBudget"/>
<result column="PARENT" jdbcType="DECIMAL" property="parent"/>
</resultMap> </resultMap>
<delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal"> <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
delete from SER_PROJ_VALUE delete from SER_PROJ_VALUE
...@@ -93,7 +94,7 @@ ...@@ -93,7 +94,7 @@
from SER_PROJ_VALUE from SER_PROJ_VALUE
</select> </select>
<select id="selectValue" resultMap="SerProjValueResp"> <select id="selectValue" resultMap="SerProjValueResp">
SELECT v.*,p.PROJ_NAME,p.IS_BUDGET SELECT v.*,p.PROJ_NAME,p.IS_BUDGET,p.PARENT
FROM SER_PROJ p FROM SER_PROJ p
LEFT JOIN LEFT JOIN
( (
...@@ -115,7 +116,7 @@ ...@@ -115,7 +116,7 @@
<if test="date!=null"> <if test="date!=null">
AND v."DATE" = #{date,jdbcType=DECIMAL} AND v."DATE" = #{date,jdbcType=DECIMAL}
</if> </if>
WHERE 1 = 1 WHERE 1 = 1 and p."STATE" = 1
<if test="projType!=null"> <if test="projType!=null">
AND p.PROJ_TYPE = #{projType,jdbcType=DECIMAL} AND p.PROJ_TYPE = #{projType,jdbcType=DECIMAL}
</if> </if>
...@@ -129,5 +130,5 @@ ...@@ -129,5 +130,5 @@
AND p.IS_BUDGET = #{isBudget,jdbcType=DECIMAL} AND p.IS_BUDGET = #{isBudget,jdbcType=DECIMAL}
</if> </if>
ORDER BY p.SORT ORDER BY p.SORT
</select> </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