Commit 445c569b by Suvalue

预算编制修改

parent a6c18b8b
package com.bsoft.api.service.Impl;
import com.bsoft.api.common.exceptions.DBConfigurationError;
import com.bsoft.api.mapper.DicOrgMapper;
import com.bsoft.api.mapper.SerDiseaseMapper;
import com.bsoft.api.mapper.SysRoleMapper;
import com.bsoft.api.model.SerDepartment;
import com.bsoft.api.model.SerDisease;
import com.bsoft.api.model.SysRole;
import com.bsoft.api.model.respmodel.DiseaseLevel;
import com.bsoft.api.service.SerDiseaseService;
import com.bsoft.common.utils.StringUtil;
......@@ -15,12 +20,29 @@ import java.util.List;
public class SerDiseaseServiceImpl implements SerDiseaseService {
@Resource
private SerDiseaseMapper serDiseaseMapper;
@Resource
private SysRoleMapper sysRoleMapper;
@Resource
private DicOrgMapper dicOrgMapper;
@Override
public List<DiseaseLevel> selectListByIdorLevel(String date, String diseaseCode, Integer level, String docCode, String deptCode, Long userId) {
List<DiseaseLevel> list = new ArrayList<>();
docCode = StringUtil.isNullOrEmpty(docCode) ? null : docCode;
deptCode = StringUtil.isNullOrEmpty(deptCode) ? null : deptCode;
//判断用户角色
SysRole role = sysRoleMapper.selectByUser(userId);
if (role != null) {
if (role.getRoleCode().equals(2) && StringUtil.isNullOrBlank(deptCode)) {
//科室账号科室入参为空时自动分配科室
List<SerDepartment> deptList = dicOrgMapper.selectDeptByUser(userId, null);
if (deptList != null && deptList.size() > 0)
deptCode = deptList.get(0).getKsbm();
}
} else {
throw new DBConfigurationError("用户未分配角色!");
}
if (diseaseCode != null && diseaseCode != "") {
list = selectByCode(date, diseaseCode, docCode, deptCode, userId);
} else {
......
......@@ -130,19 +130,19 @@ public class SerProjValueServiceImpl implements SerProjValueService {
for (Map<String, Object> enumInfo : enumList) {
projType = new SummaryProjType();
projType.setProjTypeName(String.valueOf(enumInfo.get("description")));
values = serProjValueMapper.selectValue((Integer) enumInfo.get("value"), null,
values = serProjValueMapper.selectValue((Integer) enumInfo.get("value"), null,
null, summary.getDeptCode(), date, budgetType, orgCode);
if (values != null && values.size() > 0) {
for (SerProjValueResp value : values) {
valueSz = projValueSzMapper.selectByProj(value.getProjId(), date, summary.getDeptCode(), orgCode);
if (valueSz != null) {
value.setSz(valueSz.getSz());
value.setZxpl(valueSz.getZxpl());
valueSz = null;
}
}
projType.setProject(values);
}
// if (values != null && values.size() > 0) {
// for (SerProjValueResp value : values) {
// valueSz = projValueSzMapper.selectByProj(value.getProjId(), date, summary.getDeptCode(), orgCode);
// if (valueSz != null) {
// value.setSz(valueSz.getSz());
// value.setZxpl(valueSz.getZxpl());
// valueSz = null;
// }
// }
projType.setProject(values);
// }
summary.getProjTypeList().add(projType);
}
} else {
......
......@@ -86,12 +86,18 @@
d.PARENT_ID, d.`LEVEL`, d.ORG_ID, d.ORG_NAME
from SER_DISEASE d
join SER_DISEASE_DOC_RS rs on rs.MDC_CODE=d.MDC_CODE
join (select ZBZBM,KSBM,SUM(ZLS) as ZLS
from val_block_values_1_5_2
where TIME=#{date} and ZLS>0
group by ZBZBM,KSBM) val on val.ZBZBM = d.MDC_CODE and val.KSBM=rs.DEPT_CODE
<if test="deptCode!=null">
and val.KSBM=#{deptCode,jdbcType=VARCHAR}
join (select ZBZBM,KSBM,SUM(ZLS) as ZLS
from val_block_values_1_2_2
where TIME=#{date} and ZLS>0
and KSBM=#{deptCode,jdbcType=VARCHAR}
group by ZBZBM,KSBM) val on val.ZBZBM = d.MDC_CODE and val.KSBM=rs.DEPT_CODE
</if>
<if test="deptCode==null">
join (select ZBZBM,SUM(ZLS) as ZLS
from val_block_values_1_1_2
where TIME=#{date} and ZLS>0
group by ZBZBM) val on val.ZBZBM = d.MDC_CODE
</if>
where 1 = 1 and STATE=1
<if test="level!=null">
......@@ -100,15 +106,6 @@
<if test="deptCode!=null">
and rs.DEPT_CODE = #{deptCode,jdbcType=VARCHAR}
</if>
<if test="deptCode==null">
and EXISTS(select o2.ORG_CODE as DEPT_CODE
from SYS_USER_ORG_RS rs2
join DIC_ORG o2 on o2.id = rs2.ORG_ID and rs2.STATE = 1
where o2.STATE = 1
and rs2.USER_ID = #{userId,jdbcType=DECIMAL}
and o2.ORG_CODE = rs.DEPT_CODE
)
</if>
order by val.ZLS desc
</select>
<select id="selectByLevelNoZBZ" resultMap="DiseaseLevel">
......@@ -138,12 +135,18 @@
d.PARENT_ID, d.`LEVEL`, d.ORG_ID, d.ORG_NAME
from SER_DISEASE d
join SER_DISEASE_DOC_RS rs on rs.MDC_CODE=d.MDC_CODE
join (select ZBZBM,KSBM,SUM(ZLS) as ZLS
from val_block_values_1_5_2
where TIME=#{date} and ZLS>0
group by ZBZBM,KSBM) val on val.ZBZBM = d.MDC_CODE and val.KSBM=rs.DEPT_CODE
<if test="deptCode!=null">
and val.KSBM=#{deptCode,jdbcType=VARCHAR}
join (select ZBZBM,KSBM,SUM(ZLS) as ZLS
from val_block_values_1_2_2
where TIME=#{date} and ZLS>0
and KSBM=#{deptCode,jdbcType=VARCHAR}
group by ZBZBM,KSBM) val on val.ZBZBM = d.MDC_CODE and val.KSBM=rs.DEPT_CODE
</if>
<if test="deptCode==null">
join (select ZBZBM,SUM(ZLS) as ZLS
from val_block_values_1_1_2
where TIME=#{date} and ZLS>0
group by ZBZBM) val on val.ZBZBM = d.MDC_CODE
</if>
where 1 = 1 and STATE=1 and STATE=1
<if test="parentId!=null">
......@@ -152,26 +155,34 @@
<if test="deptCode!=null">
and rs.DEPT_CODE=#{deptCode,jdbcType=VARCHAR}
</if>
<if test="deptCode==null">
and EXISTS(select o2.ORG_CODE as DEPT_CODE
from SYS_USER_ORG_RS rs2
join DIC_ORG o2 on o2.id = rs2.ORG_ID and rs2.STATE = 1
where o2.STATE = 1
and rs2.USER_ID = #{userId,jdbcType=DECIMAL}
and o2.ORG_CODE = rs.DEPT_CODE
)
</if>
order by val.ZLS desc
</select>
<select id="selectByParentIdNoZbz" resultMap="DiseaseLevel">
select DISTINCT d.ID, d.CREATE_DATE, d.CREATE_USERID, d.`STATE`, d.MDC_CODE, d.MDC_NAME, d.`DATE`,d.MDC_NUM,
d.PARENT_ID, d.`LEVEL`, d.ORG_ID, d.ORG_NAME
from SER_DISEASE d
join SER_DISEASE_DOC_RS rs on rs.MDC_CODE=d.MDC_CODE
<if test="deptCode!=null">
join (select ZBZBM,KSBM,SUM(ZLS) as ZLS
from val_block_values_1_5_2
where TIME=#{date}
and KSBM=#{deptCode,jdbcType=VARCHAR}
group by ZBZBM,KSBM) val on val.ZBZBM = d.MDC_CODE and val.KSBM=rs.DEPT_CODE
</if>
<if test="deptCode==null">
join (select ZBZBM,SUM(ZLS) as ZLS
from val_block_values_1_3_2
where TIME=#{date}
group by ZBZBM) val on val.ZBZBM = d.MDC_CODE
</if>
where 1 = 1 and STATE=1 and STATE=1
<if test="parentId!=null">
and d.PARENT_ID = #{parentId,jdbcType=DECIMAL}
</if>
order by d.MDC_NUM
<if test="deptCode!=null">
and rs.DEPT_CODE=#{deptCode,jdbcType=VARCHAR}
</if>
order by val.ZLS desc
</select>
<select id="selectParentById" resultMap="DiseaseLevel">
select *
......
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