/// <summary> /// 获取卡余额 /// </summary> private void GetMoeny() { //获取诊疗号 string diagnoseId = SkyComm.DiagnoseID; //预交金 if (eCardSavingFacade == null) { eCardSavingFacade = new CardSavingFacade(); } string yje = string.Empty; if (SystemInfo.SystemConfigs["院内就诊卡模式"].DefaultValue.ToString() != "2") { yje = eCardSavingFacade.FindBalanceMoneyByDiagnoseID(diagnoseId).ToString("0.00"); } else { yje = eCardSavingFacade.FindBalanceMoneyByDiagnoseID_New(diagnoseId, SkyComm.eCardAuthorizationData.Tables[0].Rows[0]["ACCOUNT_ID"].ToString()).ToString("0.00"); } //门诊未结 //string wj = eCardAuthorizationFacade.FindClinicNoCheckoutMoney(diagnoseId).ToString("0.00"); //门诊未缴费 #region 查询未缴费的金额 QuerySolutionFacade query = new QuerySolutionFacade(); Hashtable ht = new Hashtable(); string wj = "0.00"; string strsql = " SELECT COALESCE(SUM(TOTALMONEY),0) TOTALMONEY FROM (" + " select SUM(C.TOTALMONEY) TOTALMONEY" + " from CLINICPHYSICIANRECIPE C" + " where C.DIAGNOSEID=:DIAGNOSEID AND RECIPESTATE = 0 and OPERATETIME >= :YPDATE " + " AND C.RECIPETYPE IN ('药品费','中草药','医材')" + " union all " + " SELECT SUM(D_SUMMARY_INFO.UNITPRICE * CLINICPHYSICIANRECIPE.AMOUNT * S_MEDORD_DETAIL.AMOUNT) AS TOTALMONEY" + " FROM CLINICPHYSICIANRECIPE,D_SUMMARY_INFO,S_MEDORD_DETAIL,S_MEDORD_MAIN " + " WHERE CLINICPHYSICIANRECIPE.RECIPECONTENT = S_MEDORD_DETAIL.MEDORDID AND S_MEDORD_DETAIL.ITEMID = D_SUMMARY_INFO.ITEMID AND" + " CLINICPHYSICIANRECIPE.DIAGNOSEID=:DIAGNOSEID AND RECIPESTATE = 0 AND" + " CLINICPHYSICIANRECIPE.RECIPETYPE <> '附加' AND CLINICPHYSICIANRECIPE.RECIPECONTENT = S_MEDORD_MAIN.MEDORDID " + " AND OPERATETIME >=:JZFDATE AND (ISCHANGEPRICE<> 1 OR ISCHANGEPRICE IS NULL)" + " union all " + " SELECT SUM(CLINICPHYSICIANRECIPE.UNITPRICE * CLINICPHYSICIANRECIPE.AMOUNT) AS TOTALMONEY" + " FROM CLINICPHYSICIANRECIPE " + " WHERE CLINICPHYSICIANRECIPE.DIAGNOSEID=:DIAGNOSEID AND RECIPESTATE = 0 AND" + " CLINICPHYSICIANRECIPE.RECIPETYPE <> '附加' " + " AND OPERATETIME >=:JZFDATE AND ISCHANGEPRICE = 1" + " union all " + " select SUM(CLINICPHYSICIANRECIPE.UNITPRICE * CLINICPHYSICIANRECIPE.AMOUNT) TOTALMONEY" + " from CLINICPHYSICIANRECIPE " + " where RECIPESTATE = 0 AND CLINICPHYSICIANRECIPE.RECIPETYPE = '附加' " + " AND CLINICPHYSICIANRECIPE.DIAGNOSEID=:DIAGNOSEID and OPERATETIME >=:JZFDATE ) AA "; string ypDate = SystemInfo.SystemConfigs["药品处方有效期"].DefaultValue; string jzfDate = SystemInfo.SystemConfigs["检治费处方有效期"].DefaultValue; CommonFacade commonFacade = new CommonFacade(); DateTime dtCurrent = commonFacade.GetServerDateTime(); ht.Add(":DIAGNOSEID", diagnoseId); ht.Add(":YPDATE", dtCurrent.Date.AddDays(Convert.ToInt32(ypDate) * -1)); ht.Add(":JZFDATE", dtCurrent.Date.AddDays(Convert.ToInt32(jzfDate) * -1)); try { lblNoPaymentCharge.Visible = false; decimal decNoCharge = 0; DataSet ds = query.ExeQuery(strsql, ht); if (ds.Tables[0].Rows.Count > 0) { decNoCharge = DecimalRound.Round(Convert.ToDecimal(ds.Tables[0].Rows[0]["TOTALMONEY"]), 2); } wj = decNoCharge.ToString(); lblwjf.Text = decNoCharge.ToString(); if (decNoCharge != 0) { lblNoPaymentCharge.Visible = true; } else { lblNoPaymentCharge.Visible = false; } } catch (Exception ex) { SkynetMessage.MsgInfo("获取未交费信息出错:" + ex.Message); } #endregion lblwjf.Text = wj + "元"; //余额 lblye.Text = SkyComm.cardBlance.ToString(); }
public string GetPatiantInfo() { CardAuthorizationFacade theCardAuthorizationFacade = new CardAuthorizationFacade(); SkyComm.eCardAuthorizationData = (CardAuthorizationData)theCardAuthorizationFacade.SelectPatientAndCardInfoByCardID(SkyComm.cardInfoStruct.CardNo); if (SkyComm.eCardAuthorizationData.Tables[0].Rows.Count == 0) { //SkyComm.ShowMessageInfo("卡号无效! 卡号:" + SkyComm.cardInfoStruct.CardNo); return("卡号无效!"); } string CardID = SkyComm.eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_CARDID].ToString(); if (!string.IsNullOrEmpty(CardID)) { if (Convert.ToInt32(SkyComm.eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_CIRCUIT_STATE]) == 1) { SkyComm.ShowMessageInfo("此卡已挂失不能使用!"); return("此卡已挂失不能使用!"); } if (Convert.ToInt32(SkyComm.eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_CIRCUIT_STATE]) == 2) { SkyComm.ShowMessageInfo("此卡已注销不能使用!"); return("此卡已注销不能使用!"); } DataSet dsType = new CardTypesFacade().FindByPrimaryKey(SkyComm.eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0]["TYPEID"].ToString()); if (dsType.Tables[0].Rows[0]["IS_FEECHARGING_CARD"].ToString() == "1") { return("此卡为不储值卡,不能使用!"); } } else { return("此卡信息不存在!"); } if (SkyComm.eCardAuthorizationData == null || SkyComm.eCardAuthorizationData.Tables[0].Rows.Count <= 0) { return("读取病人信息失败!"); } int IS_FEECHARGING_CARD = -1; IS_FEECHARGING_CARD = Convert.ToInt32(SkyComm.eCardAuthorizationData.Tables[0].Rows[0]["IS_FEECHARGING_CARD"]); SkyComm.cardInfoStruct.Is_FEECHARGING_CARD = IS_FEECHARGING_CARD; SkyComm.cardInfoStruct.CardTypeID = Convert.ToInt32(SkyComm.eCardAuthorizationData.Tables[0].Rows[0]["TYPEID"]); SkyComm.DiagnoseID = SkyComm.eCardAuthorizationData.Tables[0].Rows[0]["DIAGNOSEID"].ToString(); if (SystemInfo.SystemConfigs["院内就诊卡模式"].DefaultValue.ToString() != "2") { SkyComm.cardBlance = DecimalRound.Round(theCardAuthorizationFacade.FindCardBalance(SkyComm.DiagnoseID), 2); } else { SkyComm.cardBlance = DecimalRound.Round(theCardAuthorizationFacade.FindCardBalance_New(SkyComm.DiagnoseID, SkyComm.eCardAuthorizationData.Tables[0].Rows[0]["ACCOUNT_ID"].ToString()), 2); } CardSavingFacade cf = new CardSavingFacade(); if (SystemInfo.SystemConfigs["院内就诊卡模式"].DefaultValue.ToString() != "2") { SkyComm.cardallmoney = cf.FindBalanceMoneyByDiagnoseID(SkyComm.DiagnoseID); } else { SkyComm.cardallmoney = cf.FindBalanceMoneyByDiagnoseID_New(SkyComm.DiagnoseID, SkyComm.eCardAuthorizationData.Tables[0].Rows[0]["ACCOUNT_ID"].ToString()); } return(""); }