// * 20100604.2.03 组合项目应用到医嘱项目时,组合项目明细也自动应用。 /// <summary> /// 如果是组合项目,自动把组合项目明细应用到医嘱项目。医嘱类型和医技类型和组合项目一样,如果已经存在,则不修改, /// </summary> /// <param name="order"></param> private void AddComplexDetail(OrderItem order) { string strWhere = Tables.base_complex_detail.COMPLEX_ID + oleDb.EuqalTo() + order.ITEM_ID; List <Model.BASE_COMPLEX_DETAIL> details = BindEntity <Model.BASE_COMPLEX_DETAIL> .CreateInstanceDAL(oleDb).GetListArray(strWhere); try { foreach (Model.BASE_COMPLEX_DETAIL detail in details) { Base_Order_Items item = new Base_Order_Items(); item.Book_Date = order.BOOK_DATE; item.Bz = order.BZ; item.Default_Usage = order.DEFAULT_USAGE; item.Medical_Class = order.MEDICAL_CLASS; item.Order_Type = order.ORDER_TYPE; Model.BASE_SERVICE_ITEMS seveice = BindEntity <Model.BASE_SERVICE_ITEMS> .CreateInstanceDAL(oleDb).GetModel(Tables.base_service_items.ITEM_ID + oleDb.EuqalTo() + detail.SERVICE_ITEM_ID); item.Item_Id = seveice.ITEM_ID; item.Order_Name = seveice.ITEM_NAME; item.Order_Unit = seveice.ITEM_UNIT; item.Py_Code = seveice.PY_CODE; item.Wb_Code = seveice.WB_CODE; item.Tc_Flag = 0; if (CheckItem(item)) { continue; } BindEntity <Base_Order_Items> .CreateInstanceDAL(oleDb).Add(item); } } catch (Exception err) { throw new Exception("新增医嘱组合项目明细发生错误!"); } }
/// <summary> /// 保存处方明细 /// </summary> /// <param name="Patient"></param> /// <param name="mz_presmaster"></param> /// <param name="base_service_item"></param> /// <returns></returns> private static Model.MZ_PresOrder SavePresOrder(RegPatient Patient, Model.MZ_PresMaster mz_presmaster, Model.BASE_SERVICE_ITEMS base_service_item) { Model.MZ_PresOrder mz_presorder = new HIS.Model.MZ_PresOrder(); mz_presorder.Amount = 1; mz_presorder.BigItemCode = base_service_item.STATITEM_CODE; mz_presorder.Buy_Price = base_service_item.PRICE; mz_presorder.ItemID = base_service_item.ITEM_ID; mz_presorder.ItemName = base_service_item.ITEM_NAME; mz_presorder.ItemType = "00"; mz_presorder.PatID = Patient.PatID; mz_presorder.PatListID = Patient.PatListID; mz_presorder.PresAmount = 1; mz_presorder.PresMasterID = mz_presmaster.PresMasterID; mz_presorder.RelationNum = 1; mz_presorder.Sell_Price = base_service_item.PRICE; mz_presorder.Unit = base_service_item.ITEM_UNIT; mz_presorder.Tolal_Fee = mz_presorder.Amount * mz_presorder.PresAmount * mz_presorder.Sell_Price; BindEntity <Model.MZ_PresOrder> .CreateInstanceDAL(oleDb).Add(mz_presorder); return(mz_presorder); }
/// <summary> /// 挂号的预处理 /// </summary> /// <param name="Patient"></param> /// <returns></returns> public override ChargeInfo Budget(RegPatient Patient) { //保存就诊记录 Model.MZ_PatList mz_patlist = SavePatList(Patient); Patient.PatListID = mz_patlist.PatListID; //查找所需费用项目 List <Model.MZ_REG_ITEM_FEE> listRegFee = BindEntity <Model.MZ_REG_ITEM_FEE> .CreateInstanceDAL(oleDb).GetListArray(BLL.Tables.mz_reg_item_fee.TYPE_CODE + "='" + Patient.RegTypeCode.Trim() + "'"); //写入处方表 Model.MZ_PresMaster mz_presmaster = SavePresMaster(Patient); Hashtable htCostOrder = new Hashtable(); Model.MZ_CostOrder mz_costorder = null; foreach (Model.MZ_REG_ITEM_FEE mz_reg_item_fee in listRegFee) { Model.BASE_SERVICE_ITEMS base_service_item = BindEntity <Model.BASE_SERVICE_ITEMS> .CreateInstanceDAL(oleDb).GetModel(mz_reg_item_fee.ITEM_ID); if (base_service_item == null) { throw new OperatorException("找不到项目编号为" + mz_reg_item_fee.ITEM_ID.ToString() + "的项目"); } //保存明细 Model.MZ_PresOrder mz_presorder = SavePresOrder(Patient, mz_presmaster, base_service_item); mz_presmaster.Total_Fee += mz_presorder.Tolal_Fee; if (htCostOrder.Contains(base_service_item.STATITEM_CODE)) { ((Model.MZ_CostOrder)htCostOrder[base_service_item.STATITEM_CODE]).Total_Fee += mz_presorder.Tolal_Fee; } else { mz_costorder = new HIS.Model.MZ_CostOrder(); mz_costorder.ItemType = base_service_item.STATITEM_CODE; mz_costorder.Total_Fee = mz_presorder.Tolal_Fee; htCostOrder.Add(base_service_item.STATITEM_CODE, mz_costorder); } } //写结算记录 Model.MZ_CostMaster mz_costmaster = SaveCostMaster(Patient, mz_presmaster); InvoiceItem[] invoiceItems = new InvoiceItem[htCostOrder.Count]; int count = 0; foreach (object item in htCostOrder) { mz_costorder = (Model.MZ_CostOrder)((DictionaryEntry)item).Value; mz_costorder.CostID = mz_costmaster.CostMasterID; BindEntity <Model.MZ_CostOrder> .CreateInstanceDAL(oleDb).Add(mz_costorder); Model.BASE_STAT_ITEM base_stat_item = BindEntity <Model.BASE_STAT_ITEM> .CreateInstanceDAL(oleDb).GetModel(BLL.Tables.base_stat_item.CODE + "='" + mz_costorder.ItemType.Trim() + "'"); Model.BASE_STAT_MZFP base_stat_mzfp = BindEntity <Model.BASE_STAT_MZFP> .CreateInstanceDAL(oleDb).GetModel(BLL.Tables.base_stat_mzfp.CODE + "='" + base_stat_item.MZFP_CODE.Trim() + "'"); invoiceItems[count].ItemName = base_stat_mzfp.ITEM_NAME; invoiceItems[count].ItemCode = base_stat_mzfp.CODE; invoiceItems[count].Cost = mz_costorder.Total_Fee; count++; } //回写处方的总金额和结算号 BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).Update(BLL.Tables.mz_presmaster.PRESMASTERID + "=" + mz_presmaster.PresMasterID, BLL.Tables.mz_presmaster.TOTAL_FEE + "=" + mz_presmaster.Total_Fee, BLL.Tables.mz_presmaster.COSTMASTERID + "=" + mz_costmaster.CostMasterID); ChargeInfo regInfo = new ChargeInfo(); regInfo.ChargeID = mz_costmaster.CostMasterID; regInfo.ChargeDate = mz_costmaster.CostDate; regInfo.TotalFee = mz_costmaster.Total_Fee; regInfo.PrescriptionID = mz_presmaster.PresMasterID; regInfo.Items = invoiceItems; return(regInfo); }