超期天数sQl

master
hujl 4 years ago
parent 197b7cea51
commit 995a8469f1

@ -24,6 +24,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
@ -110,7 +111,46 @@ public class faultController {
/* long end = System.currentTimeMillis();
System.out.println("耗时:" + (end - start) / 1000 + "秒");*/
}
public boolean compare(String time1,String time2) throws ParseException {
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
Date a=sdf.parse(time1);
Date b=sdf.parse(time2);
//a早于b返回true
if(a.before(b)){
return true;
}else{
return false;
}
}
/**
*
* @param nowTime
* @param startTime
* @param endTime
* @return
* @author sunran
*/
public static boolean isEffectiveDate(Date nowTime, Date startTime, Date endTime) {
if (nowTime.getTime() == startTime.getTime()
|| nowTime.getTime() == endTime.getTime()) {
return true;
}
Calendar date = Calendar.getInstance();
date.setTime(nowTime);
Calendar begin = Calendar.getInstance();
begin.setTime(startTime);
Calendar end = Calendar.getInstance();
end.setTime(endTime);
if (date.after(begin) && date.before(end)) {
return true;
} else {
return false;
}
}
// @ResponseBody
// @RequestMapping(value = "/faultByArchiveId")

@ -109,7 +109,7 @@
bed_number,is_sign,signer,sign_time
</sql>
<select id="selectById" parameterType="java.lang.String" resultMap="BaseResultMap">
select
select
<include refid="Base_Column_List" />
from archive_master
where id = #{id,jdbcType=NVARCHAR}
@ -1024,19 +1024,19 @@
where id = #{id,jdbcType=NVARCHAR}
</delete>
<insert id="insert" parameterType="com.emr.entity.Archive_Master">
insert into archive_master (id, patient_id, inp_no,
visit_id, name, sex,
dept_name, discharge_date_time, ArchiveState,
admission_date_time, dept_admission_to, check_doctor,
check_datetime, checked_doctor, checked_datetime,
LockInfo, DOCTOR_IN_CHARGE, ID_NO,
insert into archive_master (id, patient_id, inp_no,
visit_id, name, sex,
dept_name, discharge_date_time, ArchiveState,
admission_date_time, dept_admission_to, check_doctor,
check_datetime, checked_doctor, checked_datetime,
LockInfo, DOCTOR_IN_CHARGE, ID_NO,
DISCHARGE_DISPOSITION, dept_code_lend,isscaned,first_instance)
values (#{id,jdbcType=NVARCHAR}, #{patientId,jdbcType=NVARCHAR}, #{inpNo,jdbcType=NVARCHAR},
#{visitId,jdbcType=NVARCHAR}, #{name,jdbcType=NVARCHAR}, #{sex,jdbcType=NVARCHAR},
#{deptName,jdbcType=NVARCHAR}, #{dischargeDateTime,jdbcType=NVARCHAR}, #{archivestate,jdbcType=NVARCHAR},
#{admissionDateTime,jdbcType=NVARCHAR}, #{deptAdmissionTo,jdbcType=NVARCHAR}, #{checkDoctor,jdbcType=NVARCHAR},
#{checkDatetime,jdbcType=NVARCHAR}, #{checkedDoctor,jdbcType=NVARCHAR}, #{checkedDatetime,jdbcType=NVARCHAR},
#{lockinfo,jdbcType=NVARCHAR}, #{doctorInCharge,jdbcType=NVARCHAR}, #{idNo,jdbcType=NVARCHAR},
values (#{id,jdbcType=NVARCHAR}, #{patientId,jdbcType=NVARCHAR}, #{inpNo,jdbcType=NVARCHAR},
#{visitId,jdbcType=NVARCHAR}, #{name,jdbcType=NVARCHAR}, #{sex,jdbcType=NVARCHAR},
#{deptName,jdbcType=NVARCHAR}, #{dischargeDateTime,jdbcType=NVARCHAR}, #{archivestate,jdbcType=NVARCHAR},
#{admissionDateTime,jdbcType=NVARCHAR}, #{deptAdmissionTo,jdbcType=NVARCHAR}, #{checkDoctor,jdbcType=NVARCHAR},
#{checkDatetime,jdbcType=NVARCHAR}, #{checkedDoctor,jdbcType=NVARCHAR}, #{checkedDatetime,jdbcType=NVARCHAR},
#{lockinfo,jdbcType=NVARCHAR}, #{doctorInCharge,jdbcType=NVARCHAR}, #{idNo,jdbcType=NVARCHAR},
#{dischargeDisposition,jdbcType=NVARCHAR}, #{deptCodeLend,jdbcType=NVARCHAR}, #{isscaned,jdbcType=NVARCHAR}, #{firstInstance,jdbcType=NVARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.emr.entity.Archive_Master">
@ -1579,112 +1579,112 @@
INNER JOIN Archive_Master_Following f on m.ID=f.master_id
where 1=1 AND f.following_type in('11','12')
<if test="inpNo != null and inpNo != ''">
and m.inp_no like '%'+#{inpNo,jdbcType=NCHAR}+'%'
and m.inp_no like '%'+#{inpNo,jdbcType=NCHAR}+'%'
</if>
<if test="visitId != null and visitId != ''">
and m.visit_id=#{visitId,jdbcType=NCHAR}
and m.visit_id=#{visitId,jdbcType=NCHAR}
</if>
<if test="name != null and name != ''">
and m.name like '%'+#{name,jdbcType=NCHAR}+'%'
and m.name like '%'+#{name,jdbcType=NCHAR}+'%'
</if>
<if test="archivestate != null and archivestate != ''">
and m.ArchiveState=#{archivestate,jdbcType=NVARCHAR}
and m.ArchiveState=#{archivestate,jdbcType=NVARCHAR}
</if>
<if test="handleName != null and handleName != ''">
and f.handle_name=#{handleName,jdbcType=NVARCHAR}
and f.handle_name=#{handleName,jdbcType=NVARCHAR}
</if>
<if test="followingContent != null and followingContent != ''">
and f.following_content=#{followingContent,jdbcType=NVARCHAR}
and f.following_content=#{followingContent,jdbcType=NVARCHAR}
</if>
<choose>
<when test="startDate != null and startDate != '' and endDate != null and endDate != ''">
and f.handle_time between CONVERT(VARCHAR(10),#{startDate,jdbcType=NCHAR},120) and
#{endDate,jdbcType=NCHAR}+ ' 23:59:59'
</when>
<when test="startDate != null and startDate != ''">
and f.handle_time >= CONVERT(VARCHAR(10),#{startDate,jdbcType=NCHAR},120)
</when>
<when test="endDate != null and endDate != ''">
and f.handle_time &lt;= #{endDate,jdbcType=NCHAR}+ ' 23:59:59'
</when>
<when test="startDate != null and startDate != '' and endDate != null and endDate != ''">
and f.handle_time between CONVERT(VARCHAR(10),#{startDate,jdbcType=NCHAR},120) and
#{endDate,jdbcType=NCHAR}+ ' 23:59:59'
</when>
<when test="startDate != null and startDate != ''">
and f.handle_time >= CONVERT(VARCHAR(10),#{startDate,jdbcType=NCHAR},120)
</when>
<when test="endDate != null and endDate != ''">
and f.handle_time &lt;= #{endDate,jdbcType=NCHAR}+ ' 23:59:59'
</when>
</choose>
ORDER BY f.handle_time desc
</select>
</select>
<!--留观病历查询-->
<select id="getObservationRecordList" resultType="com.emr.entity.Archive_Master">
SELECT
id,
patient_id,
inp_no,
visit_id,
NAME,
CONVERT ( nvarchar ( 19 ), admission_date_time, 23 ) admission_date_time,
CONVERT ( nvarchar ( 19 ), discharge_date_time, 23 ) discharge_date_time,
ArchiveState,
CASE
SELECT
id,
patient_id,
inp_no,
visit_id,
NAME,
CONVERT ( nvarchar ( 19 ), admission_date_time, 23 ) admission_date_time,
CONVERT ( nvarchar ( 19 ), discharge_date_time, 23 ) discharge_date_time,
ArchiveState,
CASE
WHEN death_flag = '1' THEN
'是' ELSE '否'
END death_flag
FROM
Archive_Master
WHERE
inp_no LIKE 'LG%'
AND ArchiveState != '已归档'
<if test="patientId != null and patientId != ''">
AND patient_id LIKE '%' + #{patientId} + '%'
</if>
<if test="inpNo != null and inpNo != ''">
AND inp_no LIKE '%' + #{inpNo} + '%'
</if>
<if test="visitId != null and visitId != ''">
AND visit_id = #{visitId}
</if>
<if test="name != null and name != ''">
AND name LIKE '%' + #{name} + '%'
</if>
<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>
<choose>
<when test="startDateTo != null and startDateTo != '' and endDateTo != null and endDateTo != ''">
and admission_date_time between CONVERT(VARCHAR(10),#{startDateTo,jdbcType=NCHAR},120) and
#{endDateTo,jdbcType=NCHAR}+ ' 23:59:59'
</when>
<when test="startDateTo != null and startDateTo != ''">
and admission_date_time >= CONVERT(VARCHAR(10),#{startDateTo,jdbcType=NCHAR},120)
</when>
<when test="endDateTo != null and endDateTo != ''">
and admission_date_time &lt;= #{endDateTo,jdbcType=NCHAR}+ ' 23:59:59'
</when>
</choose>
<if test="archivestate != null and archivestate != ''">
AND ArchiveState = #{archivestate}
</if>
<if test="deathFlag != null and deathFlag != ''">
AND death_flag = #{deathFlag}
</if>
WHEN death_flag = '1' THEN
'是' ELSE '否'
END death_flag
FROM
Archive_Master
WHERE
inp_no LIKE 'LG%'
AND ArchiveState != '已归档'
<if test="patientId != null and patientId != ''">
AND patient_id LIKE '%' + #{patientId} + '%'
</if>
<if test="inpNo != null and inpNo != ''">
AND inp_no LIKE '%' + #{inpNo} + '%'
</if>
<if test="visitId != null and visitId != ''">
AND visit_id = #{visitId}
</if>
<if test="name != null and name != ''">
AND name LIKE '%' + #{name} + '%'
</if>
<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>
<choose>
<when test="startDateTo != null and startDateTo != '' and endDateTo != null and endDateTo != ''">
and admission_date_time between CONVERT(VARCHAR(10),#{startDateTo,jdbcType=NCHAR},120) and
#{endDateTo,jdbcType=NCHAR}+ ' 23:59:59'
</when>
<when test="startDateTo != null and startDateTo != ''">
and admission_date_time >= CONVERT(VARCHAR(10),#{startDateTo,jdbcType=NCHAR},120)
</when>
<when test="endDateTo != null and endDateTo != ''">
and admission_date_time &lt;= #{endDateTo,jdbcType=NCHAR}+ ' 23:59:59'
</when>
</choose>
<if test="archivestate != null and archivestate != ''">
AND ArchiveState = #{archivestate}
</if>
<if test="deathFlag != null and deathFlag != ''">
AND death_flag = #{deathFlag}
</if>
</select>
<!--封存查询-->
<!--封存查询-->
<select id="selectStorageByCol" parameterType="com.emr.entity.Archive_Master_Vo" resultMap="BaseResultMap2">
select m.id ,m.inp_no,m.visit_id,m.name,ISNULL(f.name, m.dept_name) dept_name,m.discharge_date_time,m.ArchiveState,m.sex,m.ID_NO,
ISNULL(c.name, m.dept_admission_to) dept_admission_to
,m.admission_date_time,m.DISCHARGE_DISPOSITION,d.handle_time,d.handle_name,d.following_type
from(select * from Archive_Master where ArchiveState!='作废') m
LEFT JOIN(
select master_id ,handle_time ,handle_name,following_type from (
select ROW_NUMBER() over(partition by master_id order by handle_time desc) RowNum
,Archive_Master_Following.*
from Archive_Master_Following where 1=1 ) as t1 where 1=1 and RowNum = 1 and following_type='11'
select master_id ,handle_time ,handle_name,following_type from (
select ROW_NUMBER() over(partition by master_id order by handle_time desc) RowNum
,Archive_Master_Following.*
from Archive_Master_Following where 1=1 ) as t1 where 1=1 and RowNum = 1 and following_type='11'
) d
on m.id=d.master_id
LEFT JOIN (select code,name from emr_dictionary where parent_id=(select id from emr_dictionary where

@ -253,7 +253,7 @@
</choose>
</select>
<delete id="deleteById" parameterType="java.lang.Integer">
<delete id="deleteById" parameterType="java.lang.Integer">
delete from emr_fault_detail
where id = #{id,jdbcType=INTEGER}
</delete>
@ -273,12 +273,12 @@
</if>
</delete>
<insert id="insert" parameterType="com.emr.entity.Emr_Fault_Detail">
insert into emr_fault_detail (id, archive_detail_id, assort_id,
insert into emr_fault_detail (id, archive_detail_id, assort_id,
parent_id, content,price, score,
back_content, first_trial,state,recall_reason,creater,
create_time, updater, update_time
)
values (#{id,jdbcType=INTEGER}, #{archiveDetailId,jdbcType=NVARCHAR}, #{assortId,jdbcType=NVARCHAR},
values (#{id,jdbcType=INTEGER}, #{archiveDetailId,jdbcType=NVARCHAR}, #{assortId,jdbcType=NVARCHAR},
#{parentId,jdbcType=INTEGER}, #{content,jdbcType=NVARCHAR}, #{price,jdbcType=DECIMAL}, #{score,jdbcType=DECIMAL},
#{backContent,jdbcType=NVARCHAR}, #{firstTrial,jdbcType=NVARCHAR}, #{state,jdbcType=NVARCHAR}, #{recallReason,jdbcType=VARCHAR}, #{creater,jdbcType=NVARCHAR},
#{createTime,jdbcType=NCHAR}, #{updater,jdbcType=NVARCHAR}, #{updateTime,jdbcType=NCHAR}

@ -38,7 +38,7 @@
}
/*.table-striped > tbody > tr:nth-of-type(odd) {*/
/*background-color: #f9f9f9*/
/*background-color: #f9f9f9*/
/*}*/
.toolbarCss {
@ -60,41 +60,41 @@
</style>
</head>
<body>
<div style="margin-left:30px;margin-right:10px;height:auto">
<!--搜索-->
<form style="margin-top:20px;">
<div class="form-inline">
<div class="form-group divCss8">
<label for="inpNo">住院号:</label>
<input type="text" class="input-sm form-control" id="inpNo" placeholder="请输入住院号">
</div>
<div class="form-group divCss8">
<label for="visitId">住院次数:</label>
<input type="number" class="input-sm form-control" id="visitId" placeholder="请输入次数">
</div>
<div class="form-group divCss8">
<label for="name">姓名:</label>
<input type="text" class="input-sm form-control" id="name" placeholder="请输入姓名">
</div>
<div class="form-group divCss8">
<label>出院日期:</label>
<div class="input-daterange input-group" id="datepicker">
<input type="text" class="input-sm form-control" name="start" id="startDate"/>
<div style="margin-left:30px;margin-right:10px;height:auto">
<!--搜索-->
<form style="margin-top:20px;">
<div class="form-inline">
<div class="form-group divCss8">
<label for="inpNo">住院号:</label>
<input type="text" class="input-sm form-control" id="inpNo" placeholder="请输入住院号">
</div>
<div class="form-group divCss8">
<label for="visitId">住院次数:</label>
<input type="number" class="input-sm form-control" id="visitId" placeholder="请输入次数">
</div>
<div class="form-group divCss8">
<label for="name">姓名:</label>
<input type="text" class="input-sm form-control" id="name" placeholder="请输入姓名">
</div>
<div class="form-group divCss8">
<label>出院日期:</label>
<div class="input-daterange input-group" id="datepicker">
<input type="text" class="input-sm form-control" name="start" id="startDate"/>
<span class="input-group-addon">-</span>
<input type="text" class="input-sm form-control" name="end" id="endDate"/>
</div>
</div>
<div class="form-group divCss8" id="deptDiv" style="height: 18px;margin-top: -7px;">
<label >出院科室:</label>
<%--<select class="input-sm form-control" id="deptName">--%>
<%--<option value="">全部</option>--%>
<%--&lt;%&ndash;<option value="在院">在院</option>&ndash;%&gt;--%>
<%--&lt;%&ndash;<option value="未归档">未归档</option>&ndash;%&gt;--%>
<%--&lt;%&ndash;<option value="归档中">归档中</option>&ndash;%&gt;--%>
<%--&lt;%&ndash;<option value="初审">初审</option>&ndash;%&gt;--%>
<%--&lt;%&ndash;<option value="已认证">已认证</option>&ndash;%&gt;--%>
<%--&lt;%&ndash;<option value="已归档">已归档</option>&ndash;%&gt;--%>
</div>
<div class="form-group divCss8" id="deptDiv" style="height: 18px;margin-top: -7px;">
<label >出院科室:</label>
<%--<select class="input-sm form-control" id="deptName">--%>
<%--<option value="">全部</option>--%>
<%--&lt;%&ndash;<option value="在院">在院</option>&ndash;%&gt;--%>
<%--&lt;%&ndash;<option value="未归档">未归档</option>&ndash;%&gt;--%>
<%--&lt;%&ndash;<option value="归档中">归档中</option>&ndash;%&gt;--%>
<%--&lt;%&ndash;<option value="初审">初审</option>&ndash;%&gt;--%>
<%--&lt;%&ndash;<option value="已认证">已认证</option>&ndash;%&gt;--%>
<%--&lt;%&ndash;<option value="已归档">已归档</option>&ndash;%&gt;--%>
<%--</select>--%>
<select class="selectpicker bla bla bli" multiple data-live-search="true" name="deptName"
id="deptName" data-actions-box="true" data-deselect-all-text="取消全选" data-select-all-text="全选"
@ -125,10 +125,10 @@
<option value="">全部</option>
</select>--%>
<%--<div class="col-lg-3 form-group divCss8" ><label>缺陷选项:</label></div>--%>
<div id="mulDiv">
</div>
<%--<div class="col-lg-3 form-group divCss8" ><label>缺陷选项:</label></div>--%>
<div id="mulDiv">
</div>
</div>
<div class="form-group divCss">
<label for="archivestate">归档状态 :</label>
@ -149,27 +149,27 @@
</form>
</div>
<!--数据表格-->
<table id="table" class="table text-nowrap table-striped"></table>
<%--</div>--%>
<div id="toolbar" class="btn-group pull-right toolbarCss" >
<div class="columns columns-right btn-group pull-right" style="margin-top:0px;">
<div class="btn-group btn-info">
<select id="sel_exportoption" class="form-control">                
<option value="">导出当前页面数据</option>                
<option value="all">导出全部数据</option>                
<option value="selected">导出选中数据</option>
</select>
</div>
<button class=" btn btn-success" style="height: 34px" type="button" id="refreshBtn" name="refresh" aria-label="Refresh"
title="Refresh">
<i class="glyphicon glyphicon-refresh icon-refresh"></i>
</button>
<!--数据表格-->
<table id="table" class="table text-nowrap table-striped"></table>
<%--</div>--%>
<div id="toolbar" class="btn-group pull-right toolbarCss" >
<div class="columns columns-right btn-group pull-right" style="margin-top:0px;">
<div class="btn-group btn-info">
<select id="sel_exportoption" class="form-control">                
<option value="">导出当前页面数据</option>                
<option value="all">导出全部数据</option>                
<option value="selected">导出选中数据</option>
</select>
</div>
<button class=" btn btn-success" style="height: 34px" type="button" id="refreshBtn" name="refresh" aria-label="Refresh"
title="Refresh">
<i class="glyphicon glyphicon-refresh icon-refresh"></i>
</button>
</div>
</div>
</div>
@ -179,20 +179,20 @@
var tipLoad=1;
<%--function getDept() {--%>
<%--//获取科室列表--%>
<%--$.ajax({--%>
<%--url: "${path}/inHosp/getDept",--%>
<%--type: "POST",--%>
<%--data: {effective: 1, typecode: "dept_code"},--%>
<%--success: function (result) {--%>
<%--if (result != null) {--%>
<%--for (var i = 0; i < result.length; i++) {--%>
<%--$("#deptName").append("<option value=" + result[i].code + ">" + result[i].name + "</option>");--%>
<%--}--%>
<%--}--%>
<%--$(".selectpicker").selectpicker('refresh');--%>
<%--}--%>
<%--});--%>
<%--//获取科室列表--%>
<%--$.ajax({--%>
<%--url: "${path}/inHosp/getDept",--%>
<%--type: "POST",--%>
<%--data: {effective: 1, typecode: "dept_code"},--%>
<%--success: function (result) {--%>
<%--if (result != null) {--%>
<%--for (var i = 0; i < result.length; i++) {--%>
<%--$("#deptName").append("<option value=" + result[i].code + ">" + result[i].name + "</option>");--%>
<%--}--%>
<%--}--%>
<%--$(".selectpicker").selectpicker('refresh');--%>
<%--}--%>
<%--});--%>
<%--}--%>
<%--getDept();--%>
@ -217,7 +217,7 @@
}
function getFaultType() {
// console.log("=========getFaultType=========");
// console.log("=========getFaultType=========");
//获取科室列表
$.ajax({
url: "${path}/lastVerify/getFaultType",
@ -319,14 +319,14 @@
var limit= null;
var offset= params.offset;
//判断是否导出全部all
if ($("#sel_exportoption").val() == "all") {
offset=0;
limit=this.totalRows;
this.pageSize= limit;
if ($("#sel_exportoption").val() == "all") {
offset=0;
limit=this.totalRows;
this.pageSize= limit;
}else{
limit = currPageSize;
this.pageSize = currPageSize;
}
limit = currPageSize;
this.pageSize = currPageSize;
}
/*var url = window.location.href;
var deptName = url.substring(url.lastIndexOf('&') + 1).replace("depts=", "");
@ -451,9 +451,9 @@
//在院 未归档 归档中 初审 已归档 已认证 复审退回
var a ='';
if (value == "未归档") {
a = '<span style="color:#c0c0c0;"><i class="fa fa-times-circle-o" aria-hidden="true"></i>' + value + '</span>';
a = '<span style="color:#c0c0c0;"><i class="fa fa-times-circle-o" aria-hidden="true"></i>' + value + '</span>';
} else if (value == "已归档") {
a = '<span style="color:#030378"><i class="fa fa-check-circle-o" aria-hidden="true"></i>' + value + '</span>';
a = '<span style="color:#030378"><i class="fa fa-check-circle-o" aria-hidden="true"></i>' + value + '</span>';
} else if (value == "在院") {
a = '<span style="color:#bfa200"><i class="fa fa-check-circle-o" aria-hidden="true"></i>' + value + '</span>';
} else if (value == "归档中") {
@ -708,9 +708,9 @@
//2.初始化select的change事件
$("#sel_exportoption").change(function () {
$('#table').bootstrapTable('refreshOptions', {
exportDataType: $(this).val()
});
$('#table').bootstrapTable('refreshOptions', {
exportDataType: $(this).val()
});
});
$("#refreshBtn").click(function () {
//刷新

Loading…
Cancel
Save