/// <summary> /// 根据条件查询病人列表 /// </summary> /// <param name="patientSearchInfo">病人查询信息</param> /// <returns></returns> public DataTable Search_PatList(HIS.MZDoc_BLL.Public.PatientSearchInfo patientSearchInfo)// string cardNo, string visitNo, string patName, int deptId, int docId, DateTime beginTime, DateTime endTime) { string strsql = @"select distinct a.* ,b.name as DeptName, c.name as DocName ,d.PRES_DEPT,d.PRES_DOC from ( select * from mz_patlist where " + Tables.mz_patlist.MEDICARD + _oleDb.Like() + "'%" + patientSearchInfo.CardNo + "%'" + _oleDb.And() + Tables.mz_patlist.VISITNO + _oleDb.Like() + "'%" + patientSearchInfo.VisitNo + "%'" + _oleDb.And() + Tables.mz_patlist.PATNAME + _oleDb.Like() + "'%" + patientSearchInfo.PatName + "%'" + _oleDb.And() + Tables.mz_patlist.DISEASENAME + _oleDb.Like() + "'%" + patientSearchInfo.Diagnosis + "%'" + _oleDb.And() + HIS.BLL.Tables.mz_patlist.VISITNO + _oleDb.NotEqualTo() + "''" + _oleDb.And() + Tables.mz_patlist.CUREDATE + _oleDb.Between() + "'" + patientSearchInfo.BeginTime.Date + "'" + _oleDb.And() + "'" + patientSearchInfo.EndTime.Date.AddDays(1) + "'" + _oleDb.And() + " workid=" + workid + ")a " + " inner join (select * from mz_doc_preshead where (" + Tables.mz_doc_preshead.PRES_DEPT + _oleDb.EuqalTo() + patientSearchInfo.DeptId + _oleDb.Or() + patientSearchInfo.DeptId + _oleDb.EuqalTo() + "-1)" + _oleDb.And() + "(" + Tables.mz_doc_preshead.PRES_DOC + _oleDb.EuqalTo() + patientSearchInfo.DocId + _oleDb.Or() + patientSearchInfo.DocId + _oleDb.EuqalTo() + "-1)" + _oleDb.And() + Tables.mz_doc_preshead.PRES_FLAG + _oleDb.LessThan() + "2" + _oleDb.And() + " workid=" + workid + " ) d on a.patlistid=d.patlistid " + "left join base_dept_property b on d.PRES_DEPT=b.dept_id " + "left join base_employee_property c on d.PRES_DOC=c.employee_id " + "inner join mz_doc_preslist e on d.presheadid=e.presheadid and e.DELETE_BIT=0 where a.workid=" + workid; // string strsql = @"select distinct a.* ,b.name as DeptName, c.name as DocName ,d.PRES_DEPT,d.PRES_DOC // from // ( select * from mz_patlist where "; // if (patientSearchInfo.CardNo.Trim() != "") // { // strsql += Tables.mz_patlist.MEDICARD + _oleDb.Like() + "'%" + patientSearchInfo.CardNo + "%'" + _oleDb.And(); // } // if (patientSearchInfo.VisitNo.Trim() != "") // { // strsql += Tables.mz_patlist.VISITNO + _oleDb.Like() + "'%" + patientSearchInfo.VisitNo + "%'" + _oleDb.And(); // } // if (patientSearchInfo.PatName.Trim() != "") // { // strsql += Tables.mz_patlist.PATNAME + _oleDb.Like() + "'%" + patientSearchInfo.PatName + "%'" + _oleDb.And(); // } // if (patientSearchInfo.Diagnosis.Trim() != "") // { // strsql += Tables.mz_patlist.DISEASENAME + _oleDb.Like() + "'%" + patientSearchInfo.Diagnosis + "%'" + _oleDb.And(); // } // strsql += HIS.BLL.Tables.mz_patlist.VISITNO + _oleDb.NotEqualTo() + "''" // + _oleDb.And() + Tables.mz_patlist.CUREDATE + _oleDb.Between() + "'" + patientSearchInfo.BeginTime.Date + "'" + _oleDb.And() + "'" + patientSearchInfo.EndTime.Date.AddDays(1) + "'" // + _oleDb.And() + " workid=" + workid + ")a " // + " inner join (select * from mz_doc_preshead where (" // + Tables.mz_doc_preshead.PRES_DEPT + _oleDb.EuqalTo() + patientSearchInfo.DeptId + _oleDb.Or() + patientSearchInfo.DeptId + _oleDb.EuqalTo() + "-1)" // + _oleDb.And() + "(" + Tables.mz_doc_preshead.PRES_DOC + _oleDb.EuqalTo() + patientSearchInfo.DocId + _oleDb.Or() + patientSearchInfo.DocId + _oleDb.EuqalTo() + "-1)" // + _oleDb.And() + Tables.mz_doc_preshead.PRES_FLAG + _oleDb.LessThan() + "2" + _oleDb.And() + " workid=" + workid + " ) d on a.patlistid=d.patlistid " // + "left join base_dept_property b on d.PRES_DEPT=b.dept_id " // + "left join base_employee_property c on d.PRES_DOC=c.employee_id " // + "inner join mz_doc_preslist e on d.presheadid=e.presheadid and e.DELETE_BIT=0 where a.workid=" + workid; return(_oleDb.GetDataTable(strsql)); }