/// <summary> /// 返回未发药的处方 /// </summary> /// <param name="patlistid">病人列表ID</param> /// <returns></returns> public DataTable GetNotSendDurgPresDataTable() { try { IpresDao ipD = DaoFactory.GetObject <IpresDao>(typeof(PresDao)); ipD.oleDb = oleDb; DataTable dt = ipD.GetNotSendDurgPresDataTable(this.PatListID); List <ZY_PresOrder> zyPres = new List <ZY_PresOrder>(); for (int i = 0; i < dt.Rows.Count; i++) { ZY_PresOrder zyp1 = new ZY_PresOrder(); zyp1 = (ZY_PresOrder)HIS.SYSTEM.PubicBaseClasses.ApiFunction.DataTableToObject(dt, i, zyp1); zyp1.Sell_Price = Convert.ToDecimal(zyp1.Sell_Price.ToString("0.00")); zyp1.Tolal_Fee = Convert.ToDecimal(zyp1.Tolal_Fee.ToString("0.00")); zyp1.LoadData(); zyPres.Add(zyp1); } return(HIS.SYSTEM.PubicBaseClasses.ApiFunction.ObjToDataTable(zyPres)); } catch (System.Exception e) { throw new Exception(e.Message); } }
/// <summary> /// 结算病人 /// </summary> /// <param name="zyCostM">结算主表</param> /// <param name="zyCostOList">结算汇总记录</param> /// <param name="zyPatL">病人类表对象</param> /// <returns></returns> public void CostPat(ZY_CostMaster zyCostM, List <ZY_CostOrder> zyCostOList, ZY_PatList zyPatL) { try { if (OP_ZYConfigSetting.GetConfigValue("005") == 0) { string perfCode = ""; string strticketno = InvoiceManager.InvoiceManager.GetBillNumber(Convert.ToInt32(zyCostM.ChargeCode), false, out perfCode); zyCostM.TicketCode = perfCode + strticketno; } oleDb.BeginTransaction(); //中结处理预交金(以前所有正常预交金全识为中结状态,新增一条新的预交金) //添加一条结算信息 BindEntity <ZY_CostMaster> .CreateInstanceDAL(oleDb).Add(zyCostM); //添加结算汇总表 for (int i = 0; i < zyCostOList.Count; i++) { zyCostOList[i].CostID = zyCostM.CostMasterID; BindEntity <ZY_CostOrder> .CreateInstanceDAL(oleDb).Add(zyCostOList[i]); } //更新所有处方记录的结算ID IpresDao ipD = DaoFactory.GetObject <IpresDao>(typeof(PresDao)); ipD.oleDb = oleDb; ipD.AlterCostID(zyCostM.PatListID, zyCostM.CostMasterID, zyCostM.Ntype); if (zyCostM.Ntype != 1)//add zenghao { //更改住院病人登记表病人类型为4,5 出院结算 出院欠费结算 BindEntity <ZY_PatList> .CreateInstanceDAL(oleDb).Update(zyPatL); } //一起更新标识 string strWhere = "DELETE_FLAG = 0 and PATLISTID =" + zyPatL.PatListID; //string str1 = Tables.zy_chargelist.RECORD_FLAG + oleDb.EuqalTo() + "3";//不修改记录状态 string str2 = "DELETE_FLAG =" + zyCostM.CostMasterID; BindEntity <ZY_ChargeList> .CreateInstanceDAL(oleDb).Update(strWhere, str2); oleDb.CommitTransaction(); } catch (System.Exception e) { oleDb.RollbackTransaction(); throw new Exception(e.Message); } }
/// <summary> /// 得到病人发药处方 /// </summary> /// <param name="CureNo">住院号</param> /// <returns></returns> public DataTable GetSendGrugPres(string CureNo, string deptcode) { try { IpresDao ipD = DaoFactory.GetObject <IpresDao>(typeof(PresDao)); ipD.oleDb = oleDb; return(ipD.GetSendGrugPres(CureNo, deptcode)); } catch (System.Exception e) { throw new Exception(e.Message); } }
/// <summary> /// 得到病人发药总金额 /// </summary> /// <param name="patlistid">病人ID</param> /// <returns></returns> public decimal GetSendGrugPresTotalFee(int patlistid, string deptcode) { try { IpresDao ipD = DaoFactory.GetObject <IpresDao>(typeof(PresDao)); ipD.oleDb = oleDb; return(ipD.GetSendGrugPresTotalFee(patlistid, deptcode)); } catch (System.Exception e) { throw new Exception(e.Message); } }
/// <summary> /// 得到某天长期医嘱或临时医嘱的总费用 /// </summary> /// <param name="PresDate"></param> /// <param name="PresType"></param> /// <returns></returns> public decimal GetPresAllFee(DateTime PresDate, int PresType) { try { IpresDao ipD = DaoFactory.GetObject <IpresDao>(typeof(PresDao)); ipD.oleDb = oleDb; decimal dec = ipD.GetPresAllFee(PresDate, PresType, PatListID); return(Convert.ToDecimal(dec.ToString("0.00"))); } catch (System.Exception e) { return(0); throw new Exception(e.Message); } }
/// <summary> /// 病人结算费用 /// </summary> /// <param name="patlistid"></param> /// <returns></returns> public PatFee GetPatCostFee() { try { PatFee patFee = new PatFee(); IchargeListDao icLD = DaoFactory.GetObject <IchargeListDao>(typeof(ChargeListDao)); icLD.oleDb = oleDb; IpresDao ipD = DaoFactory.GetObject <IpresDao>(typeof(PresDao)); ipD.oleDb = oleDb; IcostDao icD = DaoFactory.GetObject <IcostDao>(typeof(CostDao)); icD.oleDb = oleDb; //得到中结后的累计预交金 patFee.chargeFee = Convert.ToDecimal(icLD.GetNoCostAll_Fee(this.PatListID).ToString("0.00")); //得到所有记账处方未结算的费用 patFee.costFee = Convert.ToDecimal(ipD.GetNoCostAll_Fee(this.PatListID).ToString("0.00")); //string patientCode = OP_PatientObject.GetPatInfo(patlistid).PatientCode; //优惠 patFee.faoverFee = 0;//Convert.ToDecimal(zy_chargelist.ZY_PresMaster_GetfaoverAll_Fee(patlistid, patientCode, patFee.costFee).ToString("0.00")); //农合 patFee.villageFee = Convert.ToDecimal(icD.GetvillageAll_Fee(this.PatListID).ToString("0.00")); //自付 patFee.selfFee = patFee.costFee - (patFee.faoverFee + patFee.villageFee); //余额 patFee.surplusFee = patFee.chargeFee - patFee.selfFee; //补收 patFee.receiveFee = patFee.surplusFee < 0 ? (0 - patFee.surplusFee) : 0; //应退 patFee.retreatFee = patFee.surplusFee >= 0 ? patFee.surplusFee : 0; patFee.surplusFee = Convert.ToDecimal(patFee.surplusFee.ToString("0.00")); patFee.receiveFee = Convert.ToDecimal(patFee.receiveFee.ToString("0.00")); patFee.retreatFee = Convert.ToDecimal(patFee.retreatFee.ToString("0.00")); return(patFee); } catch (System.Exception e) { throw new Exception(e.Message); } }
/// <summary> /// 得到病人发药处方 /// </summary> /// <param name="patlistid">病人ID</param> /// <returns></returns> public DataTable GetSendGrugPres(int patlistid, string deptcode) { try { IpresDao ipD = DaoFactory.GetObject <IpresDao>(typeof(PresDao)); ipD.oleDb = oleDb; if (deptcode == null || deptcode.Trim() == "") { return(ipD.GetSendGrugPres(patlistid)); } else { return(ipD.GetSendGrugPres(patlistid, deptcode)); } } catch (System.Exception e) { throw new Exception(e.Message); } }
/// <summary> /// 重打发票 /// </summary> /// <param name="CostMasterID">结算ID</param> /// <param name="TicketNO">发票号</param> /// <param name="CostCode">结算人代码</param> /// <param name="CostDate">结算日期</param> /// <returns></returns> public int Again_Ticket(int CostMasterID, string TicketNO, string CostCode, DateTime CostDate) { IcostDao icD = DaoFactory.GetObject <IcostDao>(typeof(CostDao)); icD.oleDb = oleDb; IpresDao ipD = DaoFactory.GetObject <IpresDao>(typeof(PresDao)); ipD.oleDb = oleDb; try { oleDb.BeginTransaction(); ZY_CostMaster zyCostM = BindEntity <ZY_CostMaster> .CreateInstanceDAL(oleDb).GetModel(CostMasterID); ZY_CostMaster zyCostMM = new ZY_CostMaster(); //1Copy zyCostMM = (ZY_CostMaster)zyCostM.Clone(); //zy_CostM.Update(zyCostM.CostMasterID, 1); string strwhere = "COSTMASTERID =" + CostMasterID; string fieldvalue = "RECORD_FLAG = 1"; BindEntity <ZY_CostMaster> .CreateInstanceDAL(oleDb).Update(strwhere, fieldvalue); //3add冲帐记录 zyCostM.Total_Fee = 0 - zyCostM.Total_Fee; zyCostM.Deptosit_Fee = 0 - zyCostM.Deptosit_Fee; zyCostM.Self_Fee = 0 - zyCostM.Self_Fee; zyCostM.Village_Fee = 0 - zyCostM.Village_Fee; zyCostM.Village_Fee = 0 - zyCostM.Village_Fee; zyCostM.Reality_Fee = 0 - zyCostM.Reality_Fee; zyCostM.Pos_Fee = 0 - zyCostM.Pos_Fee; zyCostM.Money_Fee = 0 - zyCostM.Money_Fee; zyCostM.Record_Flag = 2; zyCostM.OldID = zyCostM.CostMasterID; zyCostM.AccountID = 0;//add zenghao //zy_CostM.Add(zyCostM); BindEntity <ZY_CostMaster> .CreateInstanceDAL(oleDb).Add(zyCostM); //4add新的重打记录 zyCostMM.TicketNum = GetNewTicketNO(CostDate); zyCostMM.TicketCode = TicketNO; zyCostMM.ChargeCode = CostCode; zyCostMM.CostDate = CostDate; zyCostMM.AccountID = 0;//add zenghao BindEntity <ZY_CostMaster> .CreateInstanceDAL(oleDb).Add(zyCostMM); //更改处方结算标志 ipD.AlterCostID(CostMasterID, zyCostMM.CostMasterID); //5update 结算汇总记录 icD.UpdateCostMID(CostMasterID, zyCostMM.CostMasterID); oleDb.CommitTransaction(); return(zyCostMM.CostMasterID); } catch (System.Exception e) { oleDb.RollbackTransaction(); return(0); throw new Exception(e.Message); } }
/// <summary> /// 取消结算 /// </summary> /// <param name="zyCostM"></param> /// <returns></returns> public void CanelCostPat(ZY_CostMaster zyCostM) { try { oleDb.BeginTransaction(); //更改处方结算标志 IpresDao ipD = DaoFactory.GetObject <IpresDao>(typeof(PresDao)); ipD.oleDb = oleDb; IcostDao icD = DaoFactory.GetObject <IcostDao>(typeof(CostDao)); icD.oleDb = oleDb; IpatListDao ipLD = DaoFactory.GetObject <IpatListDao>(typeof(PatListDao)); ipLD.oleDb = oleDb; ipD.AlterCostID(zyCostM.CostMasterID, 0); //修改结算表的记录标识1,为被退(外面添加收费人代码和取消结算时间) icD.UpdateRecord_Flag(zyCostM.CostMasterID, 1); //删除所有结算汇总表的记录||update 新增对应多的付记录,不然在交款表按发票项目分类金额不对 string strWhere = "COSTID =" + zyCostM.CostMasterID; //BindEntity<ZY_CostOrder>.CreateInstanceDAL(oleDb).Delete(strWhere); update zenghao 20090826 List <ZY_CostOrder> zy_coList = BindEntity <ZY_CostOrder> .CreateInstanceDAL(oleDb).GetListArray(strWhere); //如果为取消中途结算,预交金的处理 //if (zyCostM.Ntype == 1)//? 出院结算取消也把ID修改回去 //{ strWhere = "DELETE_FLAG =" + zyCostM.CostMasterID; //string str1 = Tables.zy_chargelist.RECORD_FLAG + oleDb.EuqalTo() + "3"; string str2 = "DELETE_FLAG = 0"; BindEntity <ZY_ChargeList> .CreateInstanceDAL(oleDb).Update(strWhere, str2); //} //添加一条红冲记录,记录标识为2,红冲 zyCostM.Total_Fee = 0 - zyCostM.Total_Fee; zyCostM.Deptosit_Fee = 0 - zyCostM.Deptosit_Fee; zyCostM.Self_Fee = 0 - zyCostM.Self_Fee; zyCostM.Village_Fee = 0 - zyCostM.Village_Fee; zyCostM.Favor_Fee = 0 - zyCostM.Favor_Fee; zyCostM.Reality_Fee = 0 - zyCostM.Reality_Fee; zyCostM.Pos_Fee = 0 - zyCostM.Pos_Fee; zyCostM.Money_Fee = 0 - zyCostM.Money_Fee; zyCostM.WorkUnit_Fee = 0 - zyCostM.WorkUnit_Fee; zyCostM.NotWorkUnit_Fee = 0 - zyCostM.NotWorkUnit_Fee; zyCostM.Record_Flag = 2; zyCostM.OldID = zyCostM.CostMasterID; zyCostM.AccountID = 0; //add zenghao zyCostM.CostDate = HIS.SYSTEM.PubicBaseClasses.XcDate.ServerDateTime; BindEntity <ZY_CostMaster> .CreateInstanceDAL(oleDb).Add(zyCostM); //取消结算,结算明细表插付记录 for (int i = 0; i < zy_coList.Count; i++) { zy_coList[i].CostID = zyCostM.CostMasterID; zy_coList[i].Total_Fee = 0 - zy_coList[i].Total_Fee; BindEntity <ZY_CostOrder> .CreateInstanceDAL(oleDb).Add(zy_coList[i]); } //更改住院病人登记表病人类型为3,出院未结算 if (zyCostM.Ntype == 1)//如果是中途结算 { ipLD.AlterPatType(zyCostM.PatListID, 2); } else { ipLD.AlterPatType(zyCostM.PatListID, 3); } oleDb.CommitTransaction(); } catch (System.Exception e) { oleDb.RollbackTransaction(); throw new Exception(e.Message); } }