public long lngOnlyGetSendWindowInfo(System.Security.Principal.IPrincipal p_objPrincipal, string m_strMedStoreid, out clsMedStoreWindowsVo m_objWindowsVo, bool m_blnWindowType) { m_objWindowsVo = null; long lngRegs = 0; //权限类 clsPrivilegeHandleService objPrivilege = new clsPrivilegeHandleService(); //检查是否有使用些函数的权限 lngRegs = objPrivilege.m_lngCheckCallPrivilege(p_objPrincipal, "com.digitalwave.iCare.middletier.HIS.clsWindowsCortrol", "lngGetSendWindowInfoByWindowid"); if (lngRegs < 0) //没有使用的权限 { return(-1); } string strSQL = ""; com.digitalwave.iCare.middletier.HIS.clsGetServerDate objDate = new clsGetServerDate(); string strDateTime = objDate.m_GetServerDate().ToString("yyyy-MM-dd"); try { com.digitalwave.iCare.middletier.HRPService.clsHRPTableService objHRPSvc = new clsHRPTableService(); System.Data.DataTable p_dtWindow = new System.Data.DataTable(); System.Data.IDataParameter[] paramArr = null; strSQL = @"select a.windowid_chr, a.windowname_vchr, a.medstoreid_chr, 0 as windowflag_int, sum(decode(c.sid_int, null, 0, 1)) as numcount, d.lastdate from t_bse_medstorewin a, (select b.sid_int, b.sendwindowid_chr from t_opr_recipesend b where b.createdate_chr = ? and b.medstoreid_chr = ? and b.called_int = 0 and b.pstatus_int in (1, 2)) c, (select max(b.senddate_dat) as lastdate, b.sendwindowid_chr from t_opr_recipesend b where b.createdate_chr = ? and b.medstoreid_chr = ? and b.pstatus_int = 3 group by b.sendwindowid_chr) d where a.windowid_chr = c.sendwindowid_chr(+) and a.windowid_chr = d.sendwindowid_chr(+) and a.medstoreid_chr = ? and a.windowtype_int = 0 and a.workstatus_int = 1 group by a.windowid_chr, a.windowname_vchr, a.medstoreid_chr, d.lastdate"; objHRPSvc.CreateDatabaseParameter(5, out paramArr); paramArr[0].Value = strDateTime; paramArr[1].Value = m_strMedStoreid; paramArr[2].Value = strDateTime; paramArr[3].Value = m_strMedStoreid; paramArr[4].Value = m_strMedStoreid; lngRegs = objHRPSvc.lngGetDataTableWithParameters(strSQL, ref p_dtWindow, paramArr); if (lngRegs > 0 && p_dtWindow.Rows.Count > 0) { if (m_blnWindowType == true) { p_dtWindow.DefaultView.Sort = "windowflag_int desc,numcount, lastdate"; } else { p_dtWindow.DefaultView.Sort = " windowflag_int,numcount, lastdate"; } p_dtWindow = p_dtWindow.DefaultView.ToTable(); DataRow drTemp = p_dtWindow.Rows[0]; if (m_objWindowsVo == null) { m_objWindowsVo = new clsMedStoreWindowsVo(); } m_objWindowsVo.m_strSendWindowID = drTemp["windowid_chr"].ToString(); m_objWindowsVo.m_strSendWindowName = drTemp["windowname_vchr"].ToString(); m_objWindowsVo.m_intSendWindowOrderNo = int.Parse(drTemp["numcount"].ToString()) + 1; p_dtWindow.Dispose(); p_dtWindow = null; drTemp = null; } else { m_objWindowsVo = null; } } catch (Exception objEx) { com.digitalwave.Utility.clsLogText objLogger = new clsLogText(); bool blnRes = objLogger.LogError(objEx); } return(lngRegs); }
public long lngGetWindowIDByStorage(System.Security.Principal.IPrincipal p_objPrincipal, string storageID, out clsMedStoreWindowsVo m_objWindowsVo, bool CheckScope, bool m_blnWindowType, bool m_blnWindowRelation) { m_objWindowsVo = null; long lngRegs = 0; //权限类 clsPrivilegeHandleService objPrivilege = new clsPrivilegeHandleService(); //检查是否有使用些函数的权限 lngRegs = objPrivilege.m_lngCheckCallPrivilege(p_objPrincipal, "com.digitalwave.iCare.middletier.HIS.clsWindowsCortrol", "lngGetWindowIDByStorage"); if (lngRegs < 0) //没有使用的权限 { return(-1); } string strSQL = ""; if (CheckScope) { strSQL = @"select a.windowid_chr, a.windowname_vchr, a.medstoreid_chr, 0 as windowflag_int, sum(decode(c.sid_int, null, 0, 1)) as numcount from t_bse_medstorewin a, (select b.sid_int, b.windowid_chr from t_opr_recipesend b where b.pstatus_int = 1 and b.medstoreid_chr = ? and b.createdate_chr = ?) c where a.windowid_chr = c.windowid_chr(+) and a.medstoreid_chr = ? and a.windowtype_int = 1 and a.workstatus_int = 1 group by a.windowid_chr, a.windowname_vchr, a.medstoreid_chr"; } else { strSQL = @"select a.windowid_chr, a.windowname_vchr, a.medstoreid_chr, 0 as windowflag_int, sum(decode(c.sid_int, null, 0, 1)) as numcount from t_bse_medstorewin a, (select b.sid_int, b.windowid_chr from t_opr_recipesend b where b.pstatus_int = 1 and b.medstoreid_chr = ? and b.createdate_chr = ?) c where a.windowid_chr = c.windowid_chr(+) and a.medstoreid_chr = ? and a.windowtype_int = 1 and a.winproperty_int = 0 and a.workstatus_int = 1 group by a.windowid_chr, a.windowname_vchr, a.medstoreid_chr"; } com.digitalwave.iCare.middletier.HIS.clsGetServerDate objDate = new clsGetServerDate(); string strDateTime = objDate.m_GetServerDate().ToString("yyyy-MM-dd"); try { com.digitalwave.iCare.middletier.HRPService.clsHRPTableService objHRPSvc = new clsHRPTableService(); System.Data.DataTable p_dtWindow = new System.Data.DataTable(); System.Data.IDataParameter[] paramArr = null; objHRPSvc.CreateDatabaseParameter(3, out paramArr); paramArr[0].Value = storageID; paramArr[1].Value = strDateTime; paramArr[2].Value = storageID; //获取当前药房所有配药窗口的配药队列 lngRegs = objHRPSvc.lngGetDataTableWithParameters(strSQL, ref p_dtWindow, paramArr); if (lngRegs > 0 && p_dtWindow.Rows.Count > 0) { DataView dv = p_dtWindow.DefaultView; if (m_blnWindowType == true) //对获取的表进行排序, { dv.Sort = " windowflag_int desc,numcount"; //将草药窗口而且队列最少的窗口排在前面 } else { dv.Sort = "windowflag_int ,numcount";//将成药窗口而且队列最少的窗口排在前面 } p_dtWindow = dv.ToTable(); int m_intCount = p_dtWindow.Rows.Count; DataRow dtRowTemp = null; for (int i = 0; i < m_intCount; i++) { dtRowTemp = p_dtWindow.Rows[i]; m_objWindowsVo = new clsMedStoreWindowsVo(); m_objWindowsVo.m_strWindowID = dtRowTemp["WINDOWID_CHR"].ToString(); m_objWindowsVo.m_strWindowName = dtRowTemp["windowname_vchr"].ToString(); m_objWindowsVo.m_intWindowOrderNo = int.Parse(dtRowTemp["numcount"].ToString()) + 1; if (m_blnWindowRelation == true) { this.lngGetSendWindowInfoByWindowid(p_objPrincipal, storageID, m_objWindowsVo.m_strWindowID, ref m_objWindowsVo); } else { this.lngGetSendWindowInfo(p_objPrincipal, storageID, CheckScope, ref m_objWindowsVo, m_blnWindowType); } if (m_objWindowsVo != null)//成功取到发药窗口信息 { break; } } dv = null; p_dtWindow.Dispose(); p_dtWindow = null; dtRowTemp = null; } else { m_objWindowsVo = null;//返回null到收费界面,作为取不到任何配药窗口信息的标识,请药房人员配好药房窗口设置; } } catch (Exception objEx) { com.digitalwave.Utility.clsLogText objLogger = new clsLogText(); bool blnRes = objLogger.LogError(objEx); } return(lngRegs); }
public long m_lngGetWorkStorage(System.Security.Principal.IPrincipal p_objPrincipal, string strOldStorageID, out string strNewStorageID) { long lngRes = 0; strNewStorageID = ""; clsPrivilegeHandleService objPrivilege = new clsPrivilegeHandleService(); lngRes = objPrivilege.m_lngCheckCallPrivilege(p_objPrincipal, "com.digitalwave.iCare.middletier.LIS.clsLisDeviceSvc", "m_lngAddNew"); if (lngRes < 0) { return(-1); } com.digitalwave.iCare.middletier.HRPService.clsHRPTableService objHRPSvc = new clsHRPTableService(); if (lngRes < 0) { return(lngRes); } com.digitalwave.iCare.middletier.HIS.clsGetServerDate objDate = new clsGetServerDate(); string strDateTime = objDate.m_GetServerDate().ToString("yyyy-MM-dd HH:mm:ss"); int weekDay_int = 0;//星期几 (1-周一\7-周日) clsGetServerDate getServerDate = new clsGetServerDate(); switch (getServerDate.m_GetServerDate().DayOfWeek.ToString()) { case "Monday": weekDay_int = 1; break; case "Tuesday": weekDay_int = 2; break; case "Wednesday": weekDay_int = 3; break; case "Thursday": weekDay_int = 4; break; case "Friday": weekDay_int = 5; break; case "Saturday": weekDay_int = 6; break; case "Sunday": weekDay_int = 7; break; } string strSQL = @"SELECT a.* FROM t_bse_deptduty a WHERE a.deptid_vchr =? and a.WEEKDAY_INT=?"; DataTable dtDuty = new DataTable(); try { System.Data.IDataParameter[] paramArr = null; objHRPSvc.CreateDatabaseParameter(2, out paramArr); paramArr[0].Value = strOldStorageID; paramArr[1].Value = weekDay_int; lngRes = objHRPSvc.lngGetDataTableWithParameters(strSQL, ref dtDuty, paramArr); } catch { } DateTime _serverDate = getServerDate.m_GetServerDate(); if (dtDuty.Rows.Count > 0) { if (dtDuty.Rows[0]["WORKTIME_VCHR"] != System.DBNull.Value && dtDuty.Rows[0]["WORKTIME_VCHR"].ToString() != "") { string _split = "|"; string[] objstr = dtDuty.Rows[0]["WORKTIME_VCHR"].ToString().Split(_split.ToCharArray()); for (int f2 = 0; f2 < objstr.Length; f2++) { _split = "-"; string[] objstr1 = objstr[f2].Split(_split.ToCharArray()); if (objstr1.Length == 2) { string date1 = _serverDate.Date.ToString("yyyy-MM-dd") + " " + objstr1[0]; string date2 = _serverDate.Date.ToString("yyyy-MM-dd") + " " + objstr1[1]; if (_serverDate >= DateTime.Parse(date1) && _serverDate <= DateTime.Parse(date2)) { strNewStorageID = strOldStorageID; return(1); } } } } } else { strNewStorageID = strOldStorageID; return(1); } strNewStorageID = dtDuty.Rows[0]["OBJECTDEPTID_VCHR"].ToString(); return(lngRes); }
public long m_lngGetGiveWindID(System.Security.Principal.IPrincipal p_objPrincipal, string TreatwinID, out string windowsID, out int WaitNO) { long lngRegs = 0; windowsID = ""; WaitNO = 1; clsPrivilegeHandleService objPrivilege = new clsPrivilegeHandleService(); lngRegs = objPrivilege.m_lngCheckCallPrivilege(p_objPrincipal, "com.digitalwave.iCare.middletier.LIS.clsLisDeviceSvc", "m_lngAddNew"); if (lngRegs < 0) { return(-1); } if (lngRegs < 0) { return(lngRegs); } com.digitalwave.iCare.middletier.HIS.clsGetServerDate objDate = new clsGetServerDate(); string strDateTime = objDate.m_GetServerDate().ToString("yyyyMMdd"); string strSQL = @"SELECT a.givewinid_chr, CASE WHEN b.intcount IS NULL THEN 0 ELSE b.intcount END AS intcount FROM (SELECT t1.* FROM (SELECT MIN (order_int) AS df, a.givewinid_chr FROM t_opr_medstorewinrlt a, t_bse_medstorewin b WHERE a.treatwinid_chr =? AND a.givewinid_chr = b.windowid_chr AND b.workstatus_int = 1 GROUP BY givewinid_chr) t1, (SELECT MIN (order_int) AS df FROM t_opr_medstorewinrlt a, t_bse_medstorewin b WHERE a.treatwinid_chr = ? AND a.givewinid_chr = b.windowid_chr AND b.workstatus_int = 1 GROUP BY treatwinid_chr) t2 where t1.df =t2.df) a, (SELECT max(ORDER_INT) AS intcount, windowid_chr FROM t_opr_medstorewinque where OUTPATRECIPEID_CHR like ? GROUP BY windowid_chr) b WHERE a.givewinid_chr = b.windowid_chr(+)"; try { com.digitalwave.iCare.middletier.HRPService.clsHRPTableService objHRPSvc = new clsHRPTableService(); System.Data.DataTable p_dtWindow = new System.Data.DataTable(); System.Data.IDataParameter[] paramArr = null; objHRPSvc.CreateDatabaseParameter(3, out paramArr); paramArr[0].Value = TreatwinID; paramArr[1].Value = TreatwinID; paramArr[2].Value = strDateTime + "%"; lngRegs = objHRPSvc.lngGetDataTableWithParameters(strSQL, ref p_dtWindow, paramArr); if (p_dtWindow.Rows.Count > 0) { windowsID = p_dtWindow.Rows[0]["GIVEWINID_CHR"].ToString(); WaitNO = int.Parse(p_dtWindow.Rows[0]["intcount"].ToString()) + 1; } } catch (Exception objEx) { com.digitalwave.Utility.clsLogText objLogger = new clsLogText(); bool blnRes = objLogger.LogError(objEx); } return(lngRegs); }
public long lngGetWindowIDByStorage(System.Security.Principal.IPrincipal p_objPrincipal, string storageID, out string windowsID, out int WaiteNO, bool CheckScope) { // windowsID = ""; // WaiteNO = 1; // long lngRegs = 0; // //权限类 // clsPrivilegeHandleService objPrivilege = new clsPrivilegeHandleService(); // //检查是否有使用些函数的权限 // lngRegs = objPrivilege.m_lngCheckCallPrivilege(p_objPrincipal, "com.digitalwave.iCare.middletier.HIS.clsReckoningReport", "lngGetWindowIDByStorage"); // if (lngRegs < 0) //没有使用的权限 // { // return -1; // } // string strSQL = ""; // if (CheckScope) // { // strSQL = @"select a.windowid_chr, a.medstoreid_chr, // decode (k.intcount, null, 0, k.intcount) as intcount1, // decode (k.intcount3, null, 0, k.intcount3) as intcount4 // from t_bse_medstorewin a, // (select intcount, intcount3, b.windowid_chr, b.medstoreid_chr // from (select max (order_int) as intcount, windowid_chr, // medstoreid_chr // from t_opr_medstorewinque // where medstoreid_chr = ? // and windowtype_int = 1 // and outpatrecipeid_chr like ? // group by medstoreid_chr, windowid_chr) b, // (select count (order_int) as intcount3, windowid_chr, // medstoreid_chr // from t_opr_medstorewinque // where medstoreid_chr = ? // and windowtype_int = 1 // and outpatrecipeid_chr like ? // group by medstoreid_chr, windowid_chr) c // where b.medstoreid_chr = c.medstoreid_chr // and b.windowid_chr = c.windowid_chr) k // where a.medstoreid_chr = ? // and a.windowtype_int = 1 // and a.workstatus_int = 1 // and a.medstoreid_chr = k.medstoreid_chr(+) // and a.windowid_chr = k.windowid_chr(+) //order by intcount4 //"; // } // else // { // strSQL = @"select a.windowid_chr, a.medstoreid_chr, // decode (k.intcount, null, 0, k.intcount) as intcount1, // decode (k.intcount3, null, 0, k.intcount3) as intcount4 // from t_bse_medstorewin a, // (select intcount, intcount3, b.windowid_chr, b.medstoreid_chr // from (select max (order_int) as intcount, windowid_chr, // medstoreid_chr // from t_opr_medstorewinque // where medstoreid_chr = ? // and windowtype_int = 1 // and outpatrecipeid_chr like ? // group by medstoreid_chr, windowid_chr) b, // (select count (order_int) as intcount3, windowid_chr, // medstoreid_chr // from t_opr_medstorewinque // where medstoreid_chr = ? // and windowtype_int = 1 // and outpatrecipeid_chr like ? // group by medstoreid_chr, windowid_chr) c // where b.medstoreid_chr = c.medstoreid_chr // and b.windowid_chr = c.windowid_chr) k // where a.medstoreid_chr = ? // and a.winproperty_int = 0 // and a.windowtype_int = 1 // and a.workstatus_int = 1 // and a.medstoreid_chr = k.medstoreid_chr(+) // and a.windowid_chr = k.windowid_chr(+) //order by intcount4"; // } // com.digitalwave.iCare.middletier.HIS.clsGetServerDate objDate = new clsGetServerDate(); // string strDateTime = objDate.m_GetServerDate().ToString("yyyyMMdd"); // try // { // com.digitalwave.iCare.middletier.HRPService.clsHRPTableService objHRPSvc = new clsHRPTableService(); // System.Data.DataTable p_dtWindow = new System.Data.DataTable(); // System.Data.IDataParameter[] paramArr = null; // objHRPSvc.CreateDatabaseParameter(5, out paramArr); // paramArr[0].Value = storageID.Trim(); // paramArr[1].Value = strDateTime.Trim() + "%"; // paramArr[2].Value = storageID.Trim(); // paramArr[3].Value = strDateTime.Trim() + "%"; // paramArr[4].Value = storageID.Trim(); // lngRegs = objHRPSvc.lngGetDataTableWithParameters(strSQL, ref p_dtWindow, paramArr); // if (p_dtWindow.Rows.Count > 0) // { // windowsID = p_dtWindow.Rows[0]["WINDOWID_CHR"].ToString(); // WaiteNO = int.Parse(p_dtWindow.Rows[0]["intcount1"].ToString()) + 1; // } // } // catch (Exception objEx) // { // com.digitalwave.Utility.clsLogText objLogger = new clsLogText(); // bool blnRes = objLogger.LogError(objEx); // } // return lngRegs; windowsID = ""; WaiteNO = 1; long lngRegs = 0; //权限类 clsPrivilegeHandleService objPrivilege = new clsPrivilegeHandleService(); //检查是否有使用些函数的权限 lngRegs = objPrivilege.m_lngCheckCallPrivilege(p_objPrincipal, "com.digitalwave.iCare.middletier.HIS.clsReckoningReport", "lngGetWindowIDByStorage"); if (lngRegs < 0) //没有使用的权限 { return(-1); } string strSQL = ""; com.digitalwave.iCare.middletier.HIS.clsGetServerDate objDate = new clsGetServerDate(); string strDateTime = objDate.m_GetServerDate().ToString("yyyyMMdd"); if (CheckScope) { strSQL = @"select a.windowid_chr, a.medstoreid_chr, decode (k.intcount, null, 0, k.intcount) as intcount1, decode (k.intcount3, null, 0, k.intcount3) as intcount4 from t_bse_medstorewin a, (select intcount, intcount3, b.windowid_chr, b.medstoreid_chr from (select max (order_int) as intcount, windowid_chr, medstoreid_chr from t_opr_medstorewinque where medstoreid_chr = '" + storageID.Trim() + @"' and windowtype_int = 1 and outpatrecipeid_chr like '" + strDateTime + @"%' group by medstoreid_chr, windowid_chr) b, (select count (order_int) as intcount3, windowid_chr, medstoreid_chr from t_opr_medstorewinque where medstoreid_chr = '" + storageID.Trim() + @"' and windowtype_int = 1 and outpatrecipeid_chr like '" + strDateTime + @"%' group by medstoreid_chr, windowid_chr) c where b.medstoreid_chr = c.medstoreid_chr and b.windowid_chr = c.windowid_chr) k where a.medstoreid_chr = '" + storageID.Trim() + @"' and a.windowtype_int = 1 and a.workstatus_int = 1 and a.medstoreid_chr = k.medstoreid_chr(+) and a.windowid_chr = k.windowid_chr(+) order by intcount4 "; } else { strSQL = @"select a.windowid_chr, a.medstoreid_chr, decode (k.intcount, null, 0, k.intcount) as intcount1, decode (k.intcount3, null, 0, k.intcount3) as intcount4 from t_bse_medstorewin a, (select intcount, intcount3, b.windowid_chr, b.medstoreid_chr from (select max (order_int) as intcount, windowid_chr, medstoreid_chr from t_opr_medstorewinque where medstoreid_chr = '" + storageID.Trim() + @"' and windowtype_int = 1 and outpatrecipeid_chr like '" + strDateTime + @"%' group by medstoreid_chr, windowid_chr) b, (select count (order_int) as intcount3, windowid_chr, medstoreid_chr from t_opr_medstorewinque where medstoreid_chr = '" + storageID.Trim() + @"' and windowtype_int = 1 and outpatrecipeid_chr like '" + strDateTime + @"%' group by medstoreid_chr, windowid_chr) c where b.medstoreid_chr = c.medstoreid_chr and b.windowid_chr = c.windowid_chr) k where a.medstoreid_chr = '" + storageID.Trim() + @"' and a.winproperty_int = 0 and a.windowtype_int = 1 and a.workstatus_int = 1 and a.medstoreid_chr = k.medstoreid_chr(+) and a.windowid_chr = k.windowid_chr(+) order by intcount4"; } try { com.digitalwave.iCare.middletier.HRPService.clsHRPTableService objHRPSvc = new clsHRPTableService(); System.Data.DataTable p_dtWindow = new System.Data.DataTable(); lngRegs = objHRPSvc.lngGetDataTableWithoutParameters(strSQL, ref p_dtWindow); if (p_dtWindow.Rows.Count > 0) { windowsID = p_dtWindow.Rows[0]["WINDOWID_CHR"].ToString(); WaiteNO = int.Parse(p_dtWindow.Rows[0]["intcount1"].ToString()) + 1; } } catch (Exception objEx) { com.digitalwave.Utility.clsLogText objLogger = new clsLogText(); bool blnRes = objLogger.LogError(objEx); } return(lngRegs); }