diff --git a/src/main/webapp/index.jsp b/src/main/webapp/index.jsp
index dbe451c..22c27c1 100644
--- a/src/main/webapp/index.jsp
+++ b/src/main/webapp/index.jsp
@@ -151,7 +151,7 @@
diff --git a/src/main/webapp/static/js/recordManage/templateSearch/customSearchIframeqf.js b/src/main/webapp/static/js/recordManage/templateSearch/customSearchIframeqf.js
index cb6284e..45c7bd4 100644
--- a/src/main/webapp/static/js/recordManage/templateSearch/customSearchIframeqf.js
+++ b/src/main/webapp/static/js/recordManage/templateSearch/customSearchIframeqf.js
@@ -55,6 +55,8 @@ function getSql() {
var onNames = '';
//公共表名
var basicTable = '';
+ //查询字段数组
+ var selectArray = new Array();
var array = new Array();
//选中个数
var checks = 0;
@@ -120,12 +122,18 @@ function getSql() {
val = 't_dictionary_10.NAME AS diagType';
dictionaryConvertStr += " LEFT JOIN dbo.emr_dictionary AS t_dictionary_10 ON t_diag.diag_type = t_dictionary_10.CODE AND t_dictionary_10.parent_id = 'dis_diag_type'";
}
- //拼接select语句
- selectNames += val + ",";
+ if (push_unique(val, selectArray)){
+ selectArray.push(val);
+ }
if ($(this).is(':checked')) {
checks++;
}
})
+ //拼接select语句
+ for (var i = 0; i < selectArray.length; i++){
+ //拼接select语句
+ selectNames += selectArray[i] + ",";
+ }
//where语句字符串
var whereNames = ' where ';
//拼接条件前括号
@@ -141,6 +149,7 @@ function getSql() {
var age = '';
var age_month = '';
var age_day = '';
+ var inpatientNo = '';
$("#block").children().find('div').each(function () {
var val = $(this).children().val();
var className = $(this).children().attr('class');
@@ -168,7 +177,9 @@ function getSql() {
whereNames += "between '" + val + "' and '" + select22Val + "') ";
} else {
//数字
- if(age != '' && age == commomtable+'.age'){
+ if(inpatientNo != '' && inpatientNo == commomtable+'.inpatient_no'){
+ whereNames += "between '" + val + "' and '" + select22Val + "'))";
+ } else if(age != '' && age == commomtable+'.age'){
whereNames += "between " + val + " and " + (select22Val-1) + " OR ("+commomtable+".age = "+select22Val+" AND "+commomtable+".age_month = 0 AND "+commomtable+".age_day = 0))) ";
}else if(age_month != '' && age_month == commomtable+'.age_month'){
whereNames += "between " + val + " and " + (select22Val-1) + " AND "+commomtable+".age = 0 OR ("+commomtable+".age = 0 AND "+commomtable+".age_month = "+select22Val+" AND "+commomtable+".age_day = 0))) ";
@@ -195,10 +206,15 @@ function getSql() {
age_day = val;
whereNames += "(";
}
+ if (val == commomtable+'.inpatient_no') {
+ inpatientNo = val;
+ whereNames += "(";
+ }
if (val == 'and') {
age = '';
age_month = '';
age_day = '';
+ inpatientNo = '';
}
whereNames += val + ' ';
}
@@ -264,6 +280,22 @@ function getSql() {
$("#sql").val("");
}
}
+
+/**
+ * 排重
+ * @param val
+ * @param selectArray
+ * @returns {boolean}
+ */
+function push_unique(val, selectArray) {
+ var i = selectArray.length;
+ while (i--) {
+ if (selectArray[i] === val) {
+ return false; // 返回的这个 i 就是元素的索引下标,
+ }
+ }
+ return true;
+}
//搜索功能
function search(){
var blockVal = $("#block").text();