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 {
......
......@@ -132,17 +132,17 @@ public class SerProjValueServiceImpl implements SerProjValueService {
projType.setProjTypeName(String.valueOf(enumInfo.get("description")));
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;
}
}
// 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
<if test="deptCode!=null">
join (select ZBZBM,KSBM,SUM(ZLS) as ZLS
from val_block_values_1_5_2
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 test="deptCode!=null">
and val.KSBM=#{deptCode,jdbcType=VARCHAR}
</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
<if test="deptCode!=null">
join (select ZBZBM,KSBM,SUM(ZLS) as ZLS
from val_block_values_1_5_2
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 test="deptCode!=null">
and val.KSBM=#{deptCode,jdbcType=VARCHAR}
</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 *
......
......@@ -2,31 +2,31 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bsoft.api.mapper.SerProjValueMapper">
<resultMap id="BaseResultMap" type="com.bsoft.api.model.SerProjValue">
<result column="CREATE_DATE" jdbcType="TIMESTAMP" property="createDate" />
<result column="CREATE_USERID" jdbcType="DECIMAL" property="createUserid" />
<result column="STATE" jdbcType="DECIMAL" property="state" />
<result column="PROJ_ID" jdbcType="DECIMAL" property="projId" />
<result column="QNZ" jdbcType="DECIMAL" property="qnz" />
<result column="WQQS" jdbcType="DECIMAL" property="wqqs" />
<result column="LS" jdbcType="DECIMAL" property="ls" />
<result column="MB" jdbcType="DECIMAL" property="mb" />
<result column="CSYSZ" jdbcType="DECIMAL" property="csysz" />
<result column="CSYSZ_TB" jdbcType="DECIMAL" property="csyszTb" />
<result column="YSZ" jdbcType="DECIMAL" property="ysz" />
<result column="YSZ_TB" jdbcType="DECIMAL" property="yszTb" />
<result column="SZ" jdbcType="DECIMAL" property="sz" />
<result column="ZXPL" jdbcType="DECIMAL" property="zxpl" />
<result column="DATE" jdbcType="DECIMAL" property="date" />
<result column="DEPT_CODE" jdbcType="VARCHAR" property="deptCode" />
<result column="SORT" jdbcType="DECIMAL" property="sort" />
<result column="VERSION" jdbcType="VARCHAR" property="version" />
<result column="QNZ_UNIT" jdbcType="VARCHAR" property="qnzUnit" />
<result column="CSYSZ_UNIT" jdbcType="VARCHAR" property="csyszUnit" />
<result column="YSZ_UNIT" jdbcType="VARCHAR" property="yszUnit" />
<result column="SZ_UNIT" jdbcType="VARCHAR" property="szUnit" />
<result column="WQQS_ZYPZ_JS" jdbcType="DECIMAL" property="wqqsZypzJs" />
<result column="DEPT_NAME" jdbcType="VARCHAR" property="deptName" />
<result column="HOSCODE" jdbcType="VARCHAR" property="hoscode" />
<result column="CREATE_DATE" jdbcType="TIMESTAMP" property="createDate"/>
<result column="CREATE_USERID" jdbcType="DECIMAL" property="createUserid"/>
<result column="STATE" jdbcType="DECIMAL" property="state"/>
<result column="PROJ_ID" jdbcType="DECIMAL" property="projId"/>
<result column="QNZ" jdbcType="DECIMAL" property="qnz"/>
<result column="WQQS" jdbcType="DECIMAL" property="wqqs"/>
<result column="LS" jdbcType="DECIMAL" property="ls"/>
<result column="MB" jdbcType="DECIMAL" property="mb"/>
<result column="CSYSZ" jdbcType="DECIMAL" property="csysz"/>
<result column="CSYSZ_TB" jdbcType="DECIMAL" property="csyszTb"/>
<result column="YSZ" jdbcType="DECIMAL" property="ysz"/>
<result column="YSZ_TB" jdbcType="DECIMAL" property="yszTb"/>
<result column="SZ2" jdbcType="DECIMAL" property="sz"/>
<result column="ZXPL2" jdbcType="DECIMAL" property="zxpl"/>
<result column="DATE" jdbcType="DECIMAL" property="date"/>
<result column="DEPT_CODE" jdbcType="VARCHAR" property="deptCode"/>
<result column="SORT" jdbcType="DECIMAL" property="sort"/>
<result column="VERSION" jdbcType="VARCHAR" property="version"/>
<result column="QNZ_UNIT" jdbcType="VARCHAR" property="qnzUnit"/>
<result column="CSYSZ_UNIT" jdbcType="VARCHAR" property="csyszUnit"/>
<result column="YSZ_UNIT" jdbcType="VARCHAR" property="yszUnit"/>
<result column="SZ_UNIT" jdbcType="VARCHAR" property="szUnit"/>
<result column="WQQS_ZYPZ_JS" jdbcType="DECIMAL" property="wqqsZypzJs"/>
<result column="DEPT_NAME" jdbcType="VARCHAR" property="deptName"/>
<result column="HOSCODE" jdbcType="VARCHAR" property="hoscode"/>
</resultMap>
<resultMap id="SerProjValueResp" extends="BaseResultMap" type="com.bsoft.api.model.respmodel.SerProjValueResp">
<result column="PROJ_NAME" jdbcType="VARCHAR" property="projName"/>
......@@ -34,7 +34,8 @@
<result column="PARENT" jdbcType="DECIMAL" property="parent"/>
</resultMap>
<delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
delete from SER_PROJ_VALUE
delete
from SER_PROJ_VALUE
where ID = #{id,jdbcType=DECIMAL}
</delete>
<insert id="insert" parameterType="com.bsoft.api.model.SerProjValue">
......@@ -83,20 +84,64 @@
where ID = #{id,jdbcType=DECIMAL}
</update>
<select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
select ID, CREATE_DATE, CREATE_USERID, `STATE`, PROJ_ID, QNZ, WQQS, LS, MB, CSYSZ,
CSYSZ_TB, YSZ, YSZ_TB, SZ, ZXPL, `DATE`, DEPT_CODE, SORT, VERSION, QNZ_UNIT, CSYSZ_UNIT,
YSZ_UNIT, SZ_UNIT, HOSCODE
select ID,
CREATE_DATE,
CREATE_USERID,
`STATE`,
PROJ_ID,
QNZ,
WQQS,
LS,
MB,
CSYSZ,
CSYSZ_TB,
YSZ,
YSZ_TB,
SZ,
ZXPL,
`DATE`,
DEPT_CODE,
SORT,
VERSION,
QNZ_UNIT,
CSYSZ_UNIT,
YSZ_UNIT,
SZ_UNIT,
HOSCODE
from SER_PROJ_VALUE
where ID = #{id,jdbcType=DECIMAL}
</select>
<select id="selectAll" resultMap="BaseResultMap">
select ID, CREATE_DATE, CREATE_USERID, `STATE`, PROJ_ID, QNZ, WQQS, LS, MB, CSYSZ,
CSYSZ_TB, YSZ, YSZ_TB, SZ, ZXPL, `DATE`, DEPT_CODE, SORT, VERSION, QNZ_UNIT, CSYSZ_UNIT,
YSZ_UNIT, SZ_UNIT, WQQS_ZYPZ_JS, DEPT_NAME, HOSCODE
select ID,
CREATE_DATE,
CREATE_USERID,
`STATE`,
PROJ_ID,
QNZ,
WQQS,
LS,
MB,
CSYSZ,
CSYSZ_TB,
YSZ,
YSZ_TB,
SZ,
ZXPL,
`DATE`,
DEPT_CODE,
SORT,
VERSION,
QNZ_UNIT,
CSYSZ_UNIT,
YSZ_UNIT,
SZ_UNIT,
WQQS_ZYPZ_JS,
DEPT_NAME,
HOSCODE
from SER_PROJ_VALUE
</select>
<select id="selectValue" resultMap="SerProjValueResp">
SELECT v.*,p.PROJ_NAME,p.IS_BUDGET,p.PARENT
SELECT v.*,p.PROJ_NAME,p.IS_BUDGET,p.PARENT,sz.SZ as SZ2,sz.ZXPL as ZXPL2
FROM SER_PROJ p
LEFT JOIN
(
......@@ -124,6 +169,10 @@
<if test="hosCode!=null">
AND v.HOSCODE = #{hosCode,jdbcType=VARCHAR}
</if>
left join ser_proj_value_sz sz on sz.PROJ_ID = m.PROJ_ID
AND sz.DEPT_CODE = v.DEPT_CODE
AND sz.`DATE` = #{date,jdbcType=DECIMAL}
AND sz.HOSCODE = v.HOSCODE
WHERE 1 = 1 and p.`STATE` = 1
<if test="projType!=null">
AND p.PROJ_TYPE = #{projType,jdbcType=DECIMAL}
......@@ -140,21 +189,23 @@
ORDER BY p.SORT
</select>
<delete id="deleteByDeptWithDate">
delete v from SER_PROJ_VALUE v
delete v
from SER_PROJ_VALUE v
JOIN SER_PROJ p ON p.ID = v.PROJ_ID
WHERE p.PROJ_TYPE = #{projType,jdbcType=DECIMAL}
AND p.IS_BUDGET&amp;1>0
AND v.`DATE` = LEFT(#{date,jdbcType=DECIMAL},4)
AND p.IS_BUDGET &amp; 1 > 0
AND v.`DATE` = LEFT(#{date,jdbcType=DECIMAL}, 4)
AND v.DEPT_CODE = #{dept,jdbcType=VARCHAR}
AND v.HOSCODE = #{orgCode,jdbcType=VARCHAR}
</delete>
<insert id="insertToHistory">
INSERT into ser_proj_value_history
select v.* from SER_PROJ_VALUE v
select v.*
from SER_PROJ_VALUE v
JOIN SER_PROJ p ON p.ID = v.PROJ_ID
WHERE p.PROJ_TYPE = #{projType,jdbcType=DECIMAL}
AND p.IS_BUDGET&amp;1>0
AND v.`DATE` = LEFT(#{date,jdbcType=DECIMAL},4)
AND p.IS_BUDGET &amp; 1 > 0
AND v.`DATE` = LEFT(#{date,jdbcType=DECIMAL}, 4)
AND v.DEPT_CODE = #{dept,jdbcType=VARCHAR}
AND v.HOSCODE = #{orgCode,jdbcType=VARCHAR}
</insert>
......
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