1、服务器配置修改2、统计列表sql重写

gaoming_branch
ALW 3 years ago
parent 8f48d71706
commit bced244424

@ -33,6 +33,36 @@ public class V_Count {
private String endDate;
public Integer getDay2Num() {
return day2Num;
}
public void setDay2Num(Integer day2Num) {
this.day2Num = day2Num;
}
public Integer getDay3Num() {
return day3Num;
}
public void setDay3Num(Integer day3Num) {
this.day3Num = day3Num;
}
public Integer getDay7Num() {
return day7Num;
}
public void setDay7Num(Integer day7Num) {
this.day7Num = day7Num;
}
private Integer day2Num;
private Integer day3Num;
private Integer day7Num;
public String getDeptCode() {
return deptCode;

@ -28,7 +28,21 @@ public class V_CountServiceImpl implements V_CountService {
List<V_Count> counts = vCountMapper.selectByCol(record);
if(!CollectionUtils.isEmpty(counts)){
for(V_Count count :counts){
count.setUnfileNum(count.getOutNum() - count.getFileNum());
Integer outNum = count.getOutNum();
Integer fileNum = count.getFileNum();
Integer day2Num = count.getDay2Num();
Integer day3Num = count.getDay3Num();
Integer day7Num = count.getDay7Num();
java.text.NumberFormat numberformat=java.text.NumberFormat.getInstance();
numberformat.setMaximumFractionDigits(2);
String result1=numberformat.format((float)fileNum/(float)outNum*100);
String result2=numberformat.format((float)day2Num/(float)outNum*100);
String result3=numberformat.format((float)day3Num/(float)outNum*100);
String result7=numberformat.format((float)day7Num/(float)outNum*100);
count.setFileRate(result1);
count.setDay2Rate(result2);
count.setDay3Rate(result3);
count.setDay7Rate(result7);
}
}
return counts;

@ -10,7 +10,7 @@ dataBaseIp=200.100.104.40
#\u6570\u636E\u5E93\u540D\u79F0
dataBaseName=emr_record
#\u6570\u636E\u5E93\u5BC6\u7801
dataBasePassword=AbcXyz123
dataBasePassword=docus@702
jdbc.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
jdbc.url=jdbc\:sqlserver\://${dataBaseIp}:1433;databaseName=${dataBaseName}

@ -8,6 +8,9 @@
<result column="inNum" jdbcType="INTEGER" property="inNum" />
<result column="outNum" jdbcType="INTEGER" property="outNum" />
<result column="fileNum" jdbcType="INTEGER" property="fileNum" />
<result column="day2Num" jdbcType="INTEGER" property="day2Num" />
<result column="day3Num" jdbcType="INTEGER" property="day3Num" />
<result column="day7Num" jdbcType="INTEGER" property="day7Num" />
<result column="unfileNum" jdbcType="INTEGER" property="unfileNum" />
<result column="deathNum" jdbcType="INTEGER" property="deathNum" />
<result column="fileRate" jdbcType="NVARCHAR" property="fileRate" />
@ -17,177 +20,54 @@
<result column="startDate" jdbcType="NVARCHAR" property="startDate"/>
<result column="endDate" jdbcType="NVARCHAR" property="endDate"/>
</resultMap>
<sql id="Base_Column_List">
deptCode, deptName, inNum, outNum, fileNum, deathNum, fileRate,
day2Rate, day3Rate, day7Rate
</sql>
<select id="selectByCol" parameterType="com.emr.entity.V_Count" resultMap="BaseResultMap">
<![CDATA[
SELECT deptCode, deptName,ISNULL(outNum, 0) outNum, ISNULL(fileNum, 0) fileNum,ISNULL(deathNum, 0) deathNum, ISNULL(fileRate, '0') fileRate, ISNULL(day2Rate, '0') day2Rate, ISNULL(day3Rate, '0') day3Rate, ISNULL(day7Rate, '0') day7Rate FROM (select DISTINCT c.dept_name as deptCode,t8.Name as deptName,t1.outNum ,t2.fileNum ,t4.deathNum,
CASE
WHEN t1.outNum = 0 THEN
0
ELSE
ROUND(
CAST(t2.fileNum AS FLOAT) / (t1.outNum-ISNULL(t4.deathNum, 0)),
2
)
END fileRate,
CASE
WHEN (t5.Num - ISNULL(t4.deathNum, 0)) <= 0 THEN
0
ELSE
ROUND(
CAST(
(
t5.Num - ISNULL(t4.deathNum, 0)
) AS FLOAT
) / (
t2.fileNum - ISNULL(t4.deathNum, 0)
),
2
)
END day2Rate,
CASE
WHEN (t6.Num - ISNULL(t4.deathNum, 0)) <= 0 THEN
0
ELSE
ROUND(
CAST(
(
t6.Num - ISNULL(t4.deathNum, 0)
) AS FLOAT
) / (
t2.fileNum - ISNULL(t4.deathNum, 0)
),
2
)
END day3Rate,
CASE
WHEN t2.fileNum = 0 THEN
0
ELSE
ROUND(
CAST(t7.Num AS FLOAT) / (t2.fileNum),
2
)
END day7Rate
from archive_master as c
]]>
left join (select dept_name,COUNT(*) AS outNum from archive_master as s where YEAR(s.discharge_date_time) != '1801' and s.inp_no NOT like '%B' and s.inp_no NOT like '%C' and s.inp_no NOT like '%D'
<choose>
<when test="startDate != null and startDate != '' and endDate != null and endDate != ''">
and discharge_date_time between CONVERT(VARCHAR(10),#{startDate,jdbcType=NCHAR},120) and
#{endDate,jdbcType=NCHAR}+ ' 23:59:59'
</when>
<when test="startDate != null and startDate != ''">
and discharge_date_time >= CONVERT(VARCHAR(10),#{startDate,jdbcType=NCHAR},120)
</when>
<when test="endDate != null and endDate != ''">
and discharge_date_time &lt;= #{endDate,jdbcType=NCHAR}+ ' 23:59:59'
</when>
</choose>
group by dept_name) as t1 on c.dept_name= t1.dept_name
left join (select dept_name,COUNT(*) AS fileNum from archive_master as s where (s.ArchiveState = '128' OR (s.ArchiveState = '64' and s.T1 is not null and s.T1 != '' and s.T1 >= '1801-02-04 00:00:00')) and s.inp_no NOT like '%B' and s.inp_no NOT like '%C' and s.inp_no NOT like '%D'
<choose>
<when test="startDate != null and startDate != '' and endDate != null and endDate != ''">
and discharge_date_time between CONVERT(VARCHAR(10),#{startDate,jdbcType=NCHAR},120) and
#{endDate,jdbcType=NCHAR}+ ' 23:59:59'
</when>
<when test="startDate != null and startDate != ''">
and discharge_date_time >= CONVERT(VARCHAR(10),#{startDate,jdbcType=NCHAR},120)
</when>
<when test="endDate != null and endDate != ''">
and discharge_date_time &lt;= #{endDate,jdbcType=NCHAR}+ ' 23:59:59'
</when>
</choose>
group by dept_name) as t2 on c.dept_name= t2.dept_name
left join (select dept_name,COUNT(*) AS deathNum from archive_master as s where s.DISCHARGE_DISPOSITION=5 and s.inp_no NOT like '%B' and s.inp_no NOT like '%C' and s.inp_no NOT like '%D'
<choose>
<when test="startDate != null and startDate != '' and endDate != null and endDate != ''">
and discharge_date_time between CONVERT(VARCHAR(10),#{startDate,jdbcType=NCHAR},120) and
#{endDate,jdbcType=NCHAR}+ ' 23:59:59'
</when>
<when test="startDate != null and startDate != ''">
and discharge_date_time >= CONVERT(VARCHAR(10),#{startDate,jdbcType=NCHAR},120)
</when>
<when test="endDate != null and endDate != ''">
and discharge_date_time &lt;= #{endDate,jdbcType=NCHAR}+ ' 23:59:59'
</when>
</choose>
group by dept_name) as t4 on c.dept_name= t4.dept_name
left join (select dept_name,COUNT(*) AS Num from archive_master as s where s.ArchiveState = '128' and ( datediff( d, discharge_date_time, checked_datetime ) - ( SELECT COUNT(1) FROM emr_holiday_set WHERE date BETWEEN CONVERT ( VARCHAR (10), discharge_date_time, 120 ) AND checked_datetime AND flag = 2 )) &lt;= 2 and s.inp_no NOT like '%B' and s.inp_no NOT like '%C' and s.inp_no NOT like '%D'
<choose>
<when test="startDate != null and startDate != '' and endDate != null and endDate != ''">
and discharge_date_time between CONVERT(VARCHAR(10),#{startDate,jdbcType=NCHAR},120) and
#{endDate,jdbcType=NCHAR}+ ' 23:59:59'
</when>
<when test="startDate != null and startDate != ''">
and discharge_date_time >= CONVERT(VARCHAR(10),#{startDate,jdbcType=NCHAR},120)
</when>
<when test="endDate != null and endDate != ''">
and discharge_date_time &lt;= #{endDate,jdbcType=NCHAR}+ ' 23:59:59'
</when>
</choose>
group by dept_name) as t5 on c.dept_name= t5.dept_name
left join (select dept_name,COUNT(*) AS Num from archive_master as s where (s.ArchiveState = '128' OR (s.ArchiveState = '64' and s.T1 is not null and s.T1 != '' and s.T1 >= '1801-02-04 00:00:00')) and ( datediff( d, discharge_date_time, checked_datetime ) - ( SELECT COUNT(1) FROM emr_holiday_set WHERE date BETWEEN CONVERT ( VARCHAR (10), discharge_date_time, 120 ) AND checked_datetime AND flag = 2 )) &lt;= 3 and s.inp_no NOT like '%B' and s.inp_no NOT like '%C' and s.inp_no NOT like '%D'
<choose>
<when test="startDate != null and startDate != '' and endDate != null and endDate != ''">
and discharge_date_time between CONVERT(VARCHAR(10),#{startDate,jdbcType=NCHAR},120) and
#{endDate,jdbcType=NCHAR}+ ' 23:59:59'
</when>
<when test="startDate != null and startDate != ''">
and discharge_date_time >= CONVERT(VARCHAR(10),#{startDate,jdbcType=NCHAR},120)
</when>
<when test="endDate != null and endDate != ''">
and discharge_date_time &lt;= #{endDate,jdbcType=NCHAR}+ ' 23:59:59'
</when>
</choose>
group by dept_name) as t6 on c.dept_name= t6.dept_name
left join (select dept_name,COUNT(*) AS Num from archive_master as s where (s.ArchiveState = '128' OR (s.ArchiveState = '64' and s.T1 is not null and s.T1 != '' and s.T1 >= '1801-02-04 00:00:00')) and ( datediff( d, discharge_date_time, checked_datetime ) - ( SELECT COUNT(1) FROM emr_holiday_set WHERE date BETWEEN CONVERT ( VARCHAR (10), discharge_date_time, 120 ) AND checked_datetime AND flag = 2 )) &lt;= 7 and s.inp_no NOT like '%B' and s.inp_no NOT like '%C' and s.inp_no NOT like '%D'
<choose>
<when test="startDate != null and startDate != '' and endDate != null and endDate != ''">
and discharge_date_time between CONVERT(VARCHAR(10),#{startDate,jdbcType=NCHAR},120) and
#{endDate,jdbcType=NCHAR}+ ' 23:59:59'
</when>
<when test="startDate != null and startDate != ''">
and discharge_date_time >= CONVERT(VARCHAR(10),#{startDate,jdbcType=NCHAR},120)
</when>
<when test="endDate != null and endDate != ''">
and discharge_date_time &lt;= #{endDate,jdbcType=NCHAR}+ ' 23:59:59'
</when>
</choose>
group by dept_name) as t7 on c.dept_name= t7.dept_name
left join (SELECT code,Name FROM emr_dictionary where parent_id = 'dept_code') as t8 on c.dept_name=t8.code
) v_count where 1=1
<!--<if test="deptCode != null and deptCode!=''">-->
<!--and deptCode = #{deptCode,jdbcType=NVARCHAR}-->
<!--</if>-->
<choose>
<when test="sql != null and sql != ''">
${sql}
</when>
<otherwise>
<if test="deptCode != null and deptCode!=''">
and deptCode in
<foreach item="item" collection="deptCode.split(',')" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="deptName != null and deptName!=''">
and deptName in
<foreach item="item" collection="deptName.split(',')" open="(" separator="," close=")">
#{item}
</foreach>
and deptName is not null
</if>
</otherwise>
</choose>
<!--<if test="deptName != null and deptName!=''">-->
<!--and deptName = #{deptName,jdbcType=NVARCHAR}-->
<!--</if>-->
order by deptCode
SELECT
m.dept_name AS deptCode,
d.name AS deptName,
COUNT ( m.id ) outNum,
ISNULL( a.fileNum, 0 ) fileNum,
ISNULL( e.unfileNum, 0 ) unfileNum,
ISNULL( t.deathNum , 0 ) deathNum,
ISNULL( q.day2Num , 0 ) day2Num,
ISNULL( q1.day3Num , 0 ) day3Num,
ISNULL( q2.day7Num , 0 ) day7Num
FROM
archive_master m
LEFT JOIN emr_dictionary d ON d.code= m.dept_name AND d.parent_id= 'dept_code'
LEFT JOIN ( SELECT COUNT ( id ) AS fileNum, dept_name FROM archive_master WHERE ArchiveState = '128' GROUP BY dept_name ) a ON a.dept_name= m.dept_name
LEFT JOIN ( SELECT COUNT ( id ) AS unfileNum, dept_name FROM archive_master WHERE ArchiveState != '128' AND ArchiveState != '1024' AND discharge_date_time != '1801-02-03 00:00:00.000' GROUP BY dept_name ) e ON e.dept_name= m.dept_name
LEFT JOIN ( SELECT COUNT ( id ) AS deathNum, dept_name FROM archive_master WHERE DISCHARGE_DISPOSITION = '5' GROUP BY dept_name ) t ON t.dept_name= m.dept_name
LEFT JOIN (SELECT COUNT(id) day2Num,dept_name FROM archive_master WHERE discharge_date_time != '1801-02-03 00:00:00.000'
AND ArchiveState= '128' AND DATEDIFF(DAY, discharge_date_time, checked_datetime)-(SELECT COUNT(id) FROM emr_holiday_set WHERE [date]BETWEEN discharge_date_time AND checked_datetime AND flag=2 )&lt;=2 GROUP BY dept_name ) q ON q.dept_name=m.dept_name
LEFT JOIN (SELECT COUNT(id) day3Num,dept_name FROM archive_master WHERE discharge_date_time != '1801-02-03 00:00:00.000'
AND ArchiveState= '128' AND DATEDIFF(DAY, discharge_date_time, checked_datetime)-(SELECT COUNT(id) FROM emr_holiday_set WHERE [date]BETWEEN discharge_date_time AND checked_datetime AND flag=2 )&lt;=3 GROUP BY dept_name ) q1 ON q1.dept_name=m.dept_name
LEFT JOIN (SELECT COUNT(id) day7Num,dept_name FROM archive_master WHERE discharge_date_time != '1801-02-03 00:00:00.000'
AND ArchiveState= '128' AND DATEDIFF(DAY, discharge_date_time, checked_datetime)-(SELECT COUNT(id) FROM emr_holiday_set WHERE [date]BETWEEN discharge_date_time AND checked_datetime AND flag=2 )&lt;=7 GROUP BY dept_name ) q2 ON q2.dept_name=m.dept_name
<where>
1 = 1
AND m.discharge_date_time != '1801-02-03 00:00:00.000'
<if test="deptCode != null and deptCode != ''">
AND m.dept_name =#{deptCode}
</if>
<if test="startDate != null and startDate != '' and endDate != null and endDate != ''">
and m.discharge_date_time between CONVERT(VARCHAR(10),#{startDate,jdbcType=NCHAR},120) and
#{endDate,jdbcType=NCHAR}+ ' 23:59:59'
</if>
<if test="startDate != null and startDate != ''">
and m.discharge_date_time >= CONVERT(VARCHAR(10),#{startDate,jdbcType=NCHAR},120)
</if>
<if test="endDate != null and endDate != ''">
and m.discharge_date_time &lt;= #{endDate,jdbcType=NCHAR}+ ' 23:59:59'
</if>
</where>
GROUP BY
m.dept_name,
d.name ,
a.fileNum,
e.unfileNum,
t.deathNum,
q.day2Num,
q1.day3Num,
q2.day7Num
</select>
</mapper>

@ -86,10 +86,10 @@
<label>出院日期:</label>
<div class="input-group input-daterange">
<input type="text" class="input-sm form-control" name="start" id="startDate"
maxlength="10" autocomplete="off" value="${startDate}"/>
maxlength="10" />
<span class="input-group-addon">-</span>
<input type="text" class="input-sm form-control" name="end" id="endDate"
maxlength="10" autocomplete="off" value="${endDate}"/>
maxlength="10" />
</div>
</div>
<button type="button" class="btn btn-primary btn-sm divCss" id="searchBtn">查询</button>

@ -7,7 +7,7 @@ $(function () {
//日期控件
initDateInput('startDate', 'endDate');
//设置默认起止日期
setDate('startDate','endDate');
// setDate('startDate','endDate');
var url = window.location.href;
var index = url.substring(url.lastIndexOf('?') + 1).replace("num=", "");
/* if (index != null && index != "" && index.indexOf("excel") != -1) {
@ -718,7 +718,7 @@ function initTable() {
formatter: function (value, row, index) {
var val;
if (row.fileRate != null && row.fileRate != '') {
val = Math.round(row.fileRate * 100) + "%";
val = row.fileRate+ "%";
}
return val;
}
@ -731,7 +731,7 @@ function initTable() {
formatter: function (value, row, index) {
var val;
if (row.day2Rate != null && row.day2Rate != '') {
val = Math.round(row.day2Rate * 100) + "%";
val = row.day2Rate+ "%";
}
return val;
}
@ -744,7 +744,7 @@ function initTable() {
formatter: function (value, row, index) {
var val;
if (row.day3Rate != null && row.day3Rate != '') {
val = Math.round(row.day3Rate * 100) + "%";
val = row.day3Rate+ "%";
}
return val;
}
@ -757,7 +757,7 @@ function initTable() {
formatter: function (value, row, index) {
var val;
if (row.day7Rate != null && row.day7Rate != '') {
val = Math.round(row.day7Rate * 100) + "%";
val = row.day7Rate+ "%";
}
return val;
}

Loading…
Cancel
Save