/// <summary>
        /// 计算金额
        /// </summary>
        /// <param name="presType">0长期,1临时</param>
        /// <param name="colid">列号</param>
        /// <param name="rowid">行号</param>
        public void CalculateFee(int presType, int colid, int rowid)
        {
            DataTable dt = null;

            if (presType == 0)
            {
                dt = view.BindLongPresControlData;
            }
            else
            {
                dt = view.BindShortPresControlData;
            }
            if (XcConvert.IsNull(dt.Rows[rowid]["ItemName"], "").ToString().Trim() != "")
            {
                decimal price       = Convert.ToDecimal(dt.Rows[rowid]["Sell_PRICE"]);
                decimal RelationNum = Convert.ToDecimal(dt.Rows[rowid]["RelationNum"]);
                decimal binnum      = Convert.ToDecimal(XcConvert.IsNull(dt.Rows[rowid]["BigNum"], "0"));
                decimal smallnum    = Convert.ToDecimal(XcConvert.IsNull(dt.Rows[rowid]["SmallNum"], "0"));
                dt.Rows[rowid]["Amount"]    = Convert.ToDecimal(binnum * RelationNum + smallnum).ToString("0.000");
                dt.Rows[rowid]["Tolal_Fee"] = zyPresOrder.CalculateAllFee(binnum, smallnum, RelationNum, price); //Convert.ToDecimal((binnum * price) + (smallnum * price / RelationNum)).ToString("0.0000");//Convert.ToDecimal((binnum * RelationNum + smallnum) * price).ToString("0.0000");

                dt.Rows[rowid]["PresAmount"]  = 0;
                dt.Rows[rowid]["Record_Flag"] = -1;

                ZY_PresOrder zyPS = new ZY_PresOrder();
                zyPS = (ZY_PresOrder)HIS.SYSTEM.PubicBaseClasses.ApiFunction.DataTableToObject(dt, rowid, zyPS);
                ShowRowColor(zyPS, rowid, -1);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 刷新上传费用
        /// </summary>
        public void BrushUploadFee()
        {
            if (zy_PatList != null)
            {
                ZY_PresOrder zypo = new ZY_PresOrder();
                zypo.PatListID = zy_PatList.PatListID;
                dt1            = zypo.GetPresDataTableOld();

                dt2 = null;
                if (zy_PatList.patientInfo.ACCOUNTTYPE.Trim() == "农合")
                {
                    if (zy_PatList.patientInfo.MediCard != null && zy_PatList.patientInfo.MediCard != "")
                    {
                        IzyInterface nccmInterface = NccmFactory.Create();
                        if (nccmInterface != null)
                        {
                            nccmInterface.zyPatlist = zy_PatList;
                            dt2 = nccmInterface.DownloadzyPatFee(null);
                        }
                    }
                }
                view.dgvHisFee  = dt1;
                view.dgvNccmFee = dt2;
            }
        }
Exemplo n.º 3
0
        //记账、冲账农合费用上传
        private void Nccm_UploadFee()
        {
            try
            {
                if (zyPatlist.patientInfo.ACCOUNTTYPE.Trim() == "农合")
                {
                    if (zyPatlist.patientInfo.MediCard != null && zyPatlist.patientInfo.MediCard.Trim() != "")
                    {
                        IzyInterface nccmInterface = NccmFactory.Create();
                        if (nccmInterface != null)
                        {
                            nccmInterface.zyPatlist = zyPatlist;
                            //找出所有待上传的费用记录
                            ZY_PresOrder zypo = new ZY_PresOrder();
                            zypo.PatListID = zyPatlist.PatListID;
                            DataTable dt = zypo.GetPresDataTable();

                            Hashtable hashtable = new Hashtable();
                            hashtable.Add("FeeDetail", zyNccmInterface.ConvertFeeDetail(dt));
                            nccmInterface.UploadzyPatFee(hashtable);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message + "\n\n农合费用上传失败!");
            }
        }
Exemplo n.º 4
0
        //农合预算
        public void PreviewCharge()
        {
            try
            {
                //加载农合病人信息,为农合病人做准备
                if (zyPatlist.patientInfo.ACCOUNTTYPE.Trim() == "农合")
                {
                    if (zyPatlist.patientInfo.MediCard != null && zyPatlist.patientInfo.MediCard.Trim() != "")
                    {
                        IzyInterface nccmInterface = NccmFactory.Create();
                        if (nccmInterface != null)
                        {
                            nccmInterface.zyPatlist = zyPatlist;
                            //找出所有待上传的费用记录
                            ZY_PresOrder zypo = new ZY_PresOrder();
                            zypo.PatListID = zyPatlist.PatListID;
                            DataTable dt = zypo.GetPresDataTable();

                            Hashtable hashtable = new Hashtable();
                            hashtable.Add("FeeDetail", zyNccmInterface.ConvertFeeDetail(dt));
                            hashtable.Add("midWay", Ntype.ToString());

                            decimal _villageFee = nccmInterface.PreviewCharge(hashtable);
                            //Op_PatFee.SetvillageFee(ref patFee, villageFee);
                            villageFee = _villageFee;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                villageFee = 0;
                throw new Exception(e.Message);
            }
        }
        /// <summary>
        /// 新开
        /// </summary>
        /// <param name="PresType">0长期,1临时</param>
        /// <returns>行号</returns>
        public int AddRow(int PresType)
        {
            DataTable dt = null;

            if (PresType == 0)
            {
                dt = view.BindLongPresControlData;
            }
            else
            {
                dt = view.BindShortPresControlData;
            }
            int rowid;

            if (dt.Rows.Count > 0)
            {
                rowid = dt.Rows.Count - 1;
                if (dt.Rows[rowid]["ITEMNAME"].ToString().Trim() == "") //最后一行不为空才允许新增一行
                {
                    return(rowid);
                }
                else
                {
                    List <ZY_PresOrder> _zyPresOrderSon = new List <ZY_PresOrder>();
                    ZY_PresOrder        zyPresSon1      = new ZY_PresOrder();
                    zyPresSon1.XD          = false;
                    zyPresSon1.Record_Flag = -1;
                    _zyPresOrderSon.Add(zyPresSon1);
                    DataTable ddt = HIS.SYSTEM.PubicBaseClasses.ApiFunction.ObjToDataTable(_zyPresOrderSon);
                    dt.Rows.Add(ddt.Rows[0].ItemArray);
                    rowid = dt.Rows.Count - 1;
                    return(rowid);
                }
            }
            else
            {
                List <ZY_PresOrder> _zyPresOrderSon = new List <ZY_PresOrder>();
                ZY_PresOrder        zyPresSon1      = new ZY_PresOrder();
                zyPresSon1.XD          = false;
                zyPresSon1.Record_Flag = -1;
                _zyPresOrderSon.Add(zyPresSon1);

                if (PresType == 0)
                {
                    view.BindLongPresControlData = HIS.SYSTEM.PubicBaseClasses.ApiFunction.ObjToDataTable(_zyPresOrderSon);
                    dt = view.BindLongPresControlData;
                }
                else
                {
                    view.BindShortPresControlData = HIS.SYSTEM.PubicBaseClasses.ApiFunction.ObjToDataTable(_zyPresOrderSon);
                    dt = view.BindShortPresControlData;
                }
            }

            rowid = dt.Rows.Count - 1;
            return(rowid);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 住院病人费用上传
        /// </summary>
        /// <param name="hashtable"></param>
        /// <returns></returns>
        public bool UploadzyPatFee(System.Collections.Hashtable hashtable)
        {
            FeeDetail[] prescriptions = (FeeDetail[])hashtable["FeeDetail"];

            ZY_PresOrder zypo = new ZY_PresOrder();

            int[] presID = new int[prescriptions.Length];
            for (int i = 0; i < prescriptions.Length; i++)
            {
                presID[i] = Convert.ToInt32(prescriptions[i].item_sn);
            }
            zypo.UpdateComp(presID);//更新为上传标识

            BudgetFee hisData  = new BudgetFee();
            JoinArea  joinArea = new JoinArea();

            joinArea.code = JOIN_AREA_CODE;
            joinArea.name = JOIN_AREA_NAME;

            DataType dataType = new DataType();

            dataType.dataTypeName  = "住院数据";
            dataType.dataTypeValue = "2";

            ZyPatBaseData zyPat = new ZyPatBaseData();

            zyPat.idCard      = zyPatlist.patientInfo.PatNumber;//?
            zyPat.person_code = zyPatlist.patientInfo.PatCode;
            zyPat.hisID       = zyPatlist.Nccm_NO;
            zyPat.area_id     = JOIN_AREA_CODE;
            zyPat.medorg_code = MED_ORG_CODE;//?

            hisData.zyPat     = zyPat;
            hisData.feeDetail = prescriptions;
            hisData.uploadorg = MED_ORG_CODE;//"40086695143010101A2201";//?
            hisData.dataType  = dataType;
            hisData.joinArea  = joinArea;

            RecieveDetailFeeResult result = NccmInterfaces.UploadZYPatFee(hisData);

            if (result.resultId)
            {
                prescriptions = result.feeDetail;
                presID        = new int[prescriptions.Length];

                for (int i = 0; i < prescriptions.Length; i++)
                {
                    presID[i] = Convert.ToInt32(prescriptions[i].item_sn);
                }
                zypo.DelComp(presID);//更新上传失败的项目
                return(true);
            }
            else
            {
                throw new Exception("农合接口调用失败:" + result.resultString);
            }
        }
        /// <summary>
        /// 保存处方
        /// </summary>
        /// <param name="presType"></param>
        public void SavePresData(int presType)
        {
            DataTable dt = null;

            if (presType == 0)
            {
                dt = view.BindLongPresControlData;
            }
            else
            {
                dt = view.BindShortPresControlData;
            }


            List <ZY_PresOrder> zy_PresOrderList = new List <ZY_PresOrder>();
            bool b = false;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (Convert.ToInt32(XcConvert.IsNull(dt.Rows[i]["charge_flag"], "0")) == 1)
                {
                    continue;
                }
                if (Convert.ToInt32(dt.Rows[i]["Record_Flag"]) == -1 &&
                    XcConvert.IsNull(dt.Rows[i]["ItemName"], "").ToString().Trim() != "")
                {
                    ZY_PresOrder zypresorder = new ZY_PresOrder();
                    zypresorder = (ZY_PresOrder)HIS.SYSTEM.PubicBaseClasses.ApiFunction.DataTableToObject(dt, i, zypresorder);
                    if (i == 0 || Convert.ToInt32(dt.Rows[i]["Record_Flag"]) == -1)
                    {
                        zypresorder.Order_Flag = i;
                    }
                    else
                    {
                        zypresorder.Order_Flag   = Convert.ToInt32(dt.Rows[i - 1]["order_flag"]) + 1;
                        dt.Rows[i]["order_flag"] = zypresorder.Order_Flag;
                    }
                    zypresorder.PatID     = zy_Patlist.PatID;
                    zypresorder.PatListID = zy_Patlist.PatListID;
                    //[20100526.0.02]
                    zypresorder.PresDeptCode = dept.DeptID.ToString();
                    //zypresorder.PresDocCode = this.tbPresDoc.Text;
                    zypresorder.Record_Flag = 0;
                    zypresorder.PresDate    = view.PresDate;
                    //把插入的数据位数改为界面一样
                    zypresorder.Tolal_Fee  = Convert.ToDecimal(zypresorder.Tolal_Fee.ToString("0.00"));
                    zypresorder.order_type = presType;
                    zy_PresOrderList.Add(zypresorder);
                    b = true;
                }
            }
            if (b)
            {
                zyPresOrder.SavePres(zy_PresOrderList);
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// 根据病人ID得到待发药处方
        /// </summary>
        /// <param name="PatListID">病人ID</param>
        /// <param name="deptcode">药房代码</param>
        /// <param name="Total_fee">输出总金额</param>
        /// <returns></returns>
        public static DataTable GetPatPresInfo(int PatListID, string deptcode, out decimal Total_fee)
        {
            Total_fee = 0;
            ZY_PresOrder zypo = new ZY_PresOrder(oleDb);
            DataTable    dt   = zypo.GetSendGrugPres(PatListID, deptcode);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                Total_fee += Convert.ToDecimal(dt.Rows[i]["TOLAL_FEE"]);
            }
            return(dt);
        }
Exemplo n.º 9
0
        /// <summary>
        /// 接口明细转化为处方明细
        /// </summary>
        /// <param name="feeDetail">接口明细</param>
        /// <returns></returns>
        public static DataTable ConvertDT(FeeDetail[] feeDetail)
        {
            try
            {
                List <ZY_PresOrder> list = new List <ZY_PresOrder>();
                for (int i = 0; i < feeDetail.Length; i++)
                {
                    ZY_PresOrder zypresorder = new ZY_PresOrder();

                    //feeDetail.his_billno = dt.Rows[i]["CostMasterID"].ToString();//结算ID
                    zypresorder.CostMasterID = Convert.ToInt32(feeDetail[i].his_billno == "" ? "0" : feeDetail[i].his_billno);
                    //feeDetail.item_sn = dt.Rows[i]["PRESORDERID"].ToString();
                    zypresorder.PresOrderID = Convert.ToInt32(feeDetail[i].item_sn == "" ? "0" : feeDetail[i].item_sn);
                    //feeDetail.item_code = dt.Rows[i]["ITEMID"].ToString();
                    zypresorder.ItemID = Convert.ToInt32(feeDetail[i].item_code == "" ? "0" : feeDetail[i].item_code);
                    //feeDetail.item_class = dt.Rows[i]["PRESTYPE"].ToString().Trim() == "4" ? "2" : "1";
                    zypresorder.PresType = feeDetail[i].item_class;
                    //feeDetail.item_equal = "0";
                    //feeDetail.item_name = dt.Rows[i]["ITEMNAME"].ToString();
                    zypresorder.ItemName = feeDetail[i].item_name;
                    //feeDetail.item_use_time = DateTime.Now.ToString("yyyy-MM-dd");
                    //feeDetail.amount = Convert.ToDouble(dt.Rows[i]["TOLAL_FEE"]) / Convert.ToDouble(dt.Rows[i]["SELL_PRICE"]);//Convert.ToDouble(dt.Rows[i]["AMOUNT"]);
                    zypresorder.Amount = Convert.ToDecimal(feeDetail[i].amount);
                    //feeDetail.drugform = "";
                    //feeDetail.doctorTitle = dt.Rows[i]["PresDocCode"].ToString();
                    zypresorder.PresDocCode = feeDetail[i].doctorTitle;
                    //feeDetail.doctor = dt.Rows[i]["DocName"].ToString();
                    zypresorder.DocName = feeDetail[i].doctor;
                    //feeDetail.money = Convert.ToDouble(dt.Rows[i]["TOLAL_FEE"]);
                    zypresorder.Tolal_Fee = Convert.ToDecimal(feeDetail[i].money);
                    //feeDetail.price = Convert.ToDouble(dt.Rows[i]["SELL_PRICE"]);
                    zypresorder.Sell_Price = Convert.ToDecimal(feeDetail[i].price);
                    //feeDetail.center_item_code = dt.Rows[i]["NCMS_CODE"].ToString();
                    //feeDetail.comp_ratio = Convert.ToDouble(dt.Rows[i]["Comp_Money"]) / 100;
                    zypresorder.Comp_Money = Convert.ToDecimal(feeDetail[i].comp_ratio);
                    //feeDetail.specs = dt.Rows[i]["STANDARD"].ToString();
                    zypresorder.Standard = feeDetail[i].specs;
                    //feeDetail.unit = dt.Rows[i]["PACKUNIT"].ToString();
                    zypresorder.PackUnit = feeDetail[i].unit;
                    //feeDetail.nccm_comp_status = "0";
                    zypresorder.CostDate = Convert.ToDateTime(feeDetail[i].item_use_time);

                    list.Add(zypresorder);
                }
                return(HIS.SYSTEM.PubicBaseClasses.ApiFunction.ObjToDataTable(list));
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
        /// <summary>
        /// 记账
        /// </summary>
        /// <param name="presType"></param>
        /// <param name="rowid"></param>
        public void PresMark(int presType, int rowid)
        {
            if (rowid > -1)
            {
                DataTable dt = null;
                if (presType == 0)
                {
                    dt = view.BindLongPresControlData;
                }
                else
                {
                    dt = view.BindShortPresControlData;
                }

                List <int>      intlist     = new List <int>();
                List <string>   prestype    = new List <string>();
                List <string>   ChargeCodeL = new List <string>();
                List <DateTime> CostDateL   = new List <DateTime>();
                if (Convert.ToInt32(dt.Rows[rowid]["PresOrderID"]) != 0)
                {
                    if (Convert.ToInt32(dt.Rows[rowid]["Charge_Flag"]) != 1)
                    {
                        dt.Rows[rowid]["ChargeCode"] = user.EmployeeID.ToString();
                        dt.Rows[rowid]["CostDate"]   = XcDate.ServerDateTime;

                        intlist.Add(Convert.ToInt32(dt.Rows[rowid]["PresOrderID"]));
                        prestype.Add(dt.Rows[rowid]["PRESTYPE"].ToString());
                        ChargeCodeL.Add(user.EmployeeID.ToString());
                        CostDateL.Add(XcDate.ServerDateTime);
                        dt.Rows[rowid]["Charge_Flag"] = 1;
                        if (Convert.ToInt32(dt.Rows[rowid]["PRESTYPE"]) >= 4)
                        {
                            dt.Rows[rowid]["Drug_Flag"] = 1;
                        }
                        else
                        {
                            dt.Rows[rowid]["Drug_Flag"] = 0;
                        }
                        ZY_PresOrder zyPS = new ZY_PresOrder();
                        zyPS = (ZY_PresOrder)HIS.SYSTEM.PubicBaseClasses.ApiFunction.DataTableToObject(dt, rowid, zyPS);
                        ShowRowColor(zyPS, rowid, -1);
                        //2009-4-8 zy update 执行成功后提示
                        zyPresOrder.ChargePres(intlist, prestype, ChargeCodeL, CostDateL);
                        icM.PatListID = zy_Patlist.PatListID;
                        view.BindPatFeeControlData = icM.GetPatFee();
                    }
                }
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// 处方明细信息转化为接口明细
        /// </summary>
        /// <param name="dt">处方信息</param>
        /// <returns></returns>
        public static FeeDetail[] ConvertFeeDetail(DataTable dt)
        {
            try
            {
                ZY_PresOrder zypo = new ZY_PresOrder();

                List <FeeDetail> fees = new List <FeeDetail>();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    FeeDetail feeDetail = new FeeDetail();
                    feeDetail.his_billno = dt.Rows[i]["CostMasterID"].ToString();//结算ID
                    feeDetail.item_sn    = dt.Rows[i]["PRESORDERID"].ToString();
                    feeDetail.item_code  = dt.Rows[i]["ITEMID"].ToString();

                    feeDetail.item_class       = Convert.ToInt32(dt.Rows[i]["PRESTYPE"].ToString().Trim()) >= 4 ? "2" : "1";
                    feeDetail.item_equal       = "0";
                    feeDetail.item_name        = dt.Rows[i]["ITEMNAME"].ToString();
                    feeDetail.item_use_time    = DateTime.Now.ToString("yyyy-MM-dd");
                    feeDetail.amount           = Convert.ToDouble(dt.Rows[i]["TOLAL_FEE"]) / Convert.ToDouble(dt.Rows[i]["SELL_PRICE"]);//Convert.ToDouble(dt.Rows[i]["AMOUNT"]);
                    feeDetail.drugform         = "";
                    feeDetail.doctorTitle      = dt.Rows[i]["PresDocCode"].ToString();
                    feeDetail.doctor           = dt.Rows[i]["DocName"].ToString();
                    feeDetail.money            = Convert.ToDouble(dt.Rows[i]["TOLAL_FEE"]);
                    feeDetail.price            = Convert.ToDouble(dt.Rows[i]["SELL_PRICE"]);
                    feeDetail.center_item_code = dt.Rows[i]["NCMS_CODE"].ToString();
                    feeDetail.comp_ratio       = Convert.ToDouble(dt.Rows[i]["Comp_Money"]) / 100;
                    feeDetail.specs            = dt.Rows[i]["STANDARD"].ToString();
                    feeDetail.unit             = dt.Rows[i]["PACKUNIT"].ToString();
                    feeDetail.nccm_comp_status = "0";
                    feeDetail.feeType          = zypo.GetFPXM_Code(dt.Rows[i]["ITEMTYPE"].ToString());//费用类型
                    feeDetail.reverse_sn       = dt.Rows[i]["OLDID"].ToString() == "0" ? "" : dt.Rows[i]["OLDID"].ToString();
                    feeDetail.reverse_status   = feeDetail.reverse_sn == "" ? "0" : "2";
                    feeDetail.reverse_date     = DateTime.Now.ToString("yyyy-MM-dd");

                    fees.Add(feeDetail);
                }
                return(fees.ToArray());
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
        /// <summary>
        /// 得到临时账单
        /// </summary>
        private void GetShortPresData()
        {
            if (zy_Patlist != null)
            {
                view.BindShortPresControlData = zyPresOrder.GetPresDataTable(view.PresDate, 1);
                view.lbshortFee = zyPresOrder.GetPresAllFee(view.PresDate, 1).ToString();

                DataTable dt = view.BindShortPresControlData;
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    ZY_PresOrder zyPS = new ZY_PresOrder();
                    zyPS = (ZY_PresOrder)HIS.SYSTEM.PubicBaseClasses.ApiFunction.DataTableToObject(dt, i, zyPS);
                    ShowRowColor(zyPS, i, -1);
                }
                if (dt.Rows.Count > 0)
                {
                    view.PresDocCode = dt.Rows[dt.Rows.Count - 1]["PRESDOCCODE"].ToString();
                }
            }
        }
Exemplo n.º 13
0
        public FrmCostList()
        {
            InitializeComponent();
            _filterType           = HIS.SYSTEM.PubicBaseClasses.Constant.CustomFilterType;
            _searchType           = HIS.SYSTEM.PubicBaseClasses.Constant.CustomSearchType;
            base.HIS_DoubleClick += new lvPatList_DoubleClickEvent(FrmCostList_HIS_DoubleClick);

            zyPresOrder = new ZY_PresOrder();

            this.checkBox1.Checked        = true;
            this.checkBox2.Checked        = false;
            this.checkBox5.Checked        = false;
            this.cbPresType.Enabled       = false;
            this.cbPresType.SelectedIndex = 0;
            _dataSet = new DataSet();
            this.InitializeDataSet();

            this.dgFee.AutoGenerateColumns = false;
            this.dgFee.DataSource          = null;
        }
Exemplo n.º 14
0
        /// <summary>
        /// 农合病人修改
        /// </summary>
        private void NccmPatAlter()
        {
            try
            {
                //病人类型自费转农合(调入院接口和费用上传接口)
                if (zyPatlist.patientInfo.ACCOUNTTYPE == "农合")
                {
                    if (zyPatlist.Nccm_NO == null || zyPatlist.Nccm_NO == "")
                    {
                        NccmPatRegister();
                        //农合记账

                        IzyInterface nccmInterface = NccmFactory.Create();
                        if (nccmInterface != null)
                        {
                            nccmInterface.zyPatlist = zyPatlist;
                            ZY_PresOrder zypo = new ZY_PresOrder();
                            zypo.PatListID = zyPatlist.PatListID;
                            DataTable dt        = zypo.GetPresDataTable();
                            Hashtable hashtable = new Hashtable();
                            hashtable.Add("FeeDetail", zyNccmInterface.ConvertFeeDetail(dt));
                            nccmInterface.UploadzyPatFee(hashtable);
                        }
                    }
                }

                //病人类型农合转自费(调取消入院接口)
                if (zyPatlist.patientInfo.ACCOUNTTYPE != "农合")
                {
                    if (zyPatlist.Nccm_NO != null && zyPatlist.Nccm_NO != "")
                    {
                        NccmPatCancel();
                        zyPatlist.Nccm_NO = "";
                    }
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message + "\n\n农合病人修改调用[农合接口]失败!");
            }
        }
        //[20100513.1.02] 传入收入病人
        public FrmPresManagerController(IFrmPresManagerView _view, bool IsOper)
        {
            view        = _view;
            _dataSet    = new DataSet();
            zy_Patlist  = new ZY_PatList();
            zyPresOrder = new ZY_PresOrder();

            user = view.currentUser;
            dept = view.currentDept;
            //导入基础数据
            LoadINFO();

            BrushPatList(IsOper);



            view.cbDept_set = _dataSet.Tables["Dept"];

            zyPresOrder.PatListID = zy_Patlist.PatListID;
            icM = ObjectFactory.GetObject <IcostManager>(typeof(ZY_CostMaster));
        }
        //[20100513.1.02] 单个病人划价
        public FrmPresManagerController(IFrmPresManagerView _view, string CureNo)
        {
            view        = _view;
            _dataSet    = new DataSet();
            zy_Patlist  = new ZY_PatList();
            zyPresOrder = new ZY_PresOrder();

            user = view.currentUser;
            dept = view.currentDept;
            //导入基础数据
            LoadINFO();

            BrushPatList(true);

            view.cbDept_set = _dataSet.Tables["Dept"];

            zyPresOrder.PatListID = zy_Patlist.PatListID;
            icM = ObjectFactory.GetObject <IcostManager>(typeof(ZY_CostMaster));

            InPatKeyDown();
            GetPresData(0);
            GetPresData(1);
        }
        /// <summary>
        /// 设置网格显示颜色
        /// </summary>
        /// <param name="zyPS"></param>
        /// <param name="rowid"></param>
        /// <param name="colid"></param>
        private void ShowRowColor(ZY_PresOrder zyPS, int rowid, int colid)
        {
            switch (zyPS.Record_Flag)
            {
            case -1:
                view.presColor = new PresColor(rowid, -1, System.Drawing.Color.Black, System.Drawing.Color.White);
                break;

            case 0:
                System.Drawing.Color _forecolor = System.Drawing.Color.Blue;
                System.Drawing.Color _color     = System.Drawing.Color.WhiteSmoke;
                if (zyPS.Charge_Flag == 0 && zyPS.Drug_Flag == 0)
                {
                    _color = System.Drawing.Color.White;
                }
                else if (zyPS.Charge_Flag == 1 && zyPS.Drug_Flag == 0)
                {
                    _forecolor = System.Drawing.Color.Orange;
                }
                else if (zyPS.Charge_Flag == 1 && zyPS.Drug_Flag == 1)
                {
                    //_color = System.Drawing.Color.WhiteSmoke;
                    _forecolor = System.Drawing.Color.OrangeRed;
                }
                view.presColor = new PresColor(rowid, -1, _forecolor, _color);
                break;

            case 1:
                view.presColor = new PresColor(rowid, -1, System.Drawing.Color.Purple, System.Drawing.Color.WhiteSmoke);
                break;

            case 2:
                view.presColor = new PresColor(rowid, -1, System.Drawing.Color.Purple, System.Drawing.Color.WhiteSmoke);
                break;
            }
        }
Exemplo n.º 18
0
        private void _SinglePatUpdate()
        {
            try
            {
                ZY_PresOrder zypo = new ZY_PresOrder();
                zypo.PatListID = zy_PatList.PatListID;

                if (zy_PatList == null)
                {
                    view.rtbMessage = "没有指定病人!\n";
                    BackUpdateType();
                    return;
                }

                //加载农合病人信息,为农合病人做准备
                view.rtbMessage = "正在上传[" + zy_PatList.patientInfo.PatName + "]数据!\n";
                if (zy_PatList.patientInfo.MediCard != null && zy_PatList.patientInfo.MediCard.Trim() != "")
                {
                    //第一步:实例化接口对象
                    nccmInterface = NccmFactory.Create();
                    if (nccmInterface == null)
                    {
                        view.rtbMessage = "没有开启上传接口!\n";
                    }
                    else
                    {
                        //第二步:病人信息赋值
                        nccmInterface.zyPatlist = zy_PatList;
                        view.rtbMessage         = "根据[" + zy_PatList.patientInfo.PatName + "]医疗证号获取病人信息!\n";
                        //第三步:根据医疗证号获取最新的农合病人信息

                        view.rtbMessage = "获取[" + zy_PatList.patientInfo.PatName + "]病人信息成功!\n";
                        //第四步:提取病人上传的费用信息
                        DataTable dt = zypo.GetPresDataTable();
                        view.rtbMessage = "提取[" + zy_PatList.patientInfo.PatName + "]病人费用成功!\n";
                        if (dt.Rows.Count > 0)
                        {
                            //第五步:更改所有费用为上传标志
                            //int[] presID = new int[dt.Rows.Count];
                            //for (int i = 0; i < dt.Rows.Count; i++)
                            //{
                            //    presID[i] = Convert.ToInt32(dt.Rows[i]["PRESORDERID"]);
                            //}
                            //HIS.ZY_BLL.OP_PresManage.UpdateComp(presID);
                            //第六步:调用费用上传接口(上传失败的费用会更改上传标识)

                            Hashtable hashtable = new Hashtable();
                            hashtable.Add("FeeDetail", zyNccmInterface.ConvertFeeDetail(dt));

                            nccmInterface.UploadzyPatFee(hashtable);
                            view.rtbMessage = "上传[" + zy_PatList.patientInfo.PatName + "]成功!\n";
                        }
                    }
                }
                else
                {
                    view.rtbMessage = "没有指定病人或此病人不是符合类型的病人!\n";
                }
            }
            catch
            {
                view.rtbMessage = "上传失败!\n";
            }
            BackUpdateType();
        }
Exemplo n.º 19
0
        //冲账和取消冲账
        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            if (base.zy_PatList == null || base.zy_PatList.PatType.Trim() == "3" || base.zy_PatList.PatType.Trim() == "4" || base.zy_PatList.PatType.Trim() == "5")
            {
                MessageBox.Show("已出院病人,不能再冲帐操作!");
                return;
            }
            if (this.dgFee.DataSource != null && ((DataTable)this.dgFee.DataSource).Rows.Count > 0)
            {
                DataTable tb = ((DataTable)this.dgFee.DataSource).DefaultView.ToTable();
                for (int i = 0; i < ((DataTable)this.dgFee.DataSource).Rows.Count; i++)
                {
                    if ((bool)this.dgFee[0, i].Value)
                    {
                        ZY_PresOrder zypresorder = new ZY_PresOrder();
                        zypresorder = (ZY_PresOrder)HIS.SYSTEM.PubicBaseClasses.ApiFunction.DataTableToObject(tb, i, zypresorder);
                        //取消冲账记录和已结算的记录都不能操作
                        if (zypresorder.Record_Flag == 2 || zypresorder.Cost_Flag == 1)
                        {
                            continue;
                        }
                        //[20100514.1.03]
                        if (currentDept.DeptID.ToString() != zypresorder.PresDeptCode)
                        {
                            MessageBox.Show("不是本科室记的账不允许操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            continue;
                        }
                        //取消冲账
                        if (zypresorder.OldID != 0)
                        {
                            if (MessageBox.Show("确定要对[" + this.dgFee[3, i].Value.ToString() + "]取消冲账吗?", "询问", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.OK)
                            {
                                int presorderid = zypresorder.PresOrderID;

                                zypresorder.PresOrderID = 0;
                                zypresorder.Amount      = Convert.ToDecimal(0 - zypresorder.Amount);
                                zypresorder.Tolal_Fee   = Convert.ToDecimal(0 - zypresorder.Tolal_Fee);

                                int index = zypresorder.ItemName.IndexOf(" [");
                                if (index != -1)
                                {
                                    zypresorder.ItemName = zypresorder.ItemName.Substring(0, index);
                                }
                                //if (//zypresorder.PresType.Trim() == "3" ||
                                //    Convert.ToInt32(zypresorder.PresType) >= 4)
                                //{
                                //    zypresorder.Drug_Flag = 1;
                                //}
                                //else
                                //{
                                //    zypresorder.Drug_Flag = 0;
                                //}
                                zypresorder.Record_Flag = 2;
                                zypresorder.OldID       = presorderid;
                                zypresorder.PassID      = 0;
                                zypresorder.CostDate    = HIS.SYSTEM.PubicBaseClasses.XcDate.ServerDateTime;
                                zyPresOrder.BackPres(presorderid, zypresorder);
                                MessageBox.Show("取消冲账成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                        else//对原始费用冲账
                        {
                            string value = GWMHIS.BussinessLogicLayer.Forms.DlgInputBoxStatic.InputBox("输入  [" + this.dgFee[3, i].Value.ToString() + "]  冲账的数量", "费用冲账", Convert.ToDecimal(this.dgFee[6, i].Value).ToString(), true);

                            value = Convert.ToDecimal(value).ToString();
                            //this.dgFee[i, 5] = Convert.ToDecimal(this.dgFee[i, 5]) - Convert.ToDecimal(value);
                            if (value != null && value != "0")
                            {
                                decimal Count = Convert.ToDecimal(value);
                                //decimal RCount = Count % Convert.ToDecimal(tb.Rows[i]["RELATIONNUM"]);

                                List <ZY_PresOrder> zy_PresOrderList = new List <ZY_PresOrder>();
                                zypresorder.OldID       = zypresorder.PresOrderID;
                                zypresorder.PresOrderID = 0;
                                zypresorder.Amount      = Convert.ToDecimal(0 - Convert.ToDecimal(value));
                                decimal fee = zyPresOrder.CalculateAllFee(Count, Convert.ToDecimal(tb.Rows[i]["RELATIONNUM"]), Convert.ToDecimal(tb.Rows[i]["Sell_PRICE"]));
                                zypresorder.Tolal_Fee   = Convert.ToDecimal(Convert.ToDecimal(0 - fee).ToString("0.00"));
                                zypresorder.Record_Flag = 1;
                                zypresorder.PassID      = 0;
                                zypresorder.CostDate    = HIS.SYSTEM.PubicBaseClasses.XcDate.ServerDateTime;

                                int index = zypresorder.ItemName.IndexOf(" [");
                                if (index != -1)
                                {
                                    zypresorder.ItemName = zypresorder.ItemName.Substring(0, index);
                                }

                                decimal resultfee, arithmetical_compliment;
                                if (zypresorder.CheckBackPres(out resultfee, out arithmetical_compliment))
                                {
                                    if (arithmetical_compliment == 0)
                                    {
                                        zypresorder.Tolal_Fee = resultfee;
                                    }
                                    zy_PresOrderList.Add(zypresorder);
                                    zyPresOrder.BackPres(zy_PresOrderList);
                                    MessageBox.Show("冲账成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                }
                                else
                                {
                                    MessageBox.Show(tb.Rows[i]["ItemName"].ToString() + "冲帐数量过多!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                }
                            }
                        }
                    }
                }
                toolbrush_Click(null, null);
                //try
                //{
                //    //农合记账
                //    if (zy_PatList.PatientInfo.ACCOUNTTYPE.Trim() == "农合")
                //    {
                //        if (zy_PatList.PatientInfo.MediCard != null && zy_PatList.PatientInfo.MediCard.Trim() != "")
                //        {
                //            IZY_NccmInterface nccmInterface = NccmFactory.Create();
                //            if (nccmInterface != null)
                //            {
                //                nccmInterface.zy_Patlist = zy_PatList;
                //                DataTable dt = zyPresOrder.GetPresDataTable();
                //                nccmInterface.UploadZYPatFee(nccmInterface.ConvertFeeDetail(dt));
                //            }
                //        }
                //    }
                //}
                //catch (Exception err)
                //{
                //    MessageBox.Show(err.Message);
                //}
            }
        }
Exemplo n.º 20
0
        private int CostPat(int costType, FrmCostDiag fcd)
        {
            try
            {
                ZY_PresOrder zypo = new ZY_PresOrder();
                zypo.PatListID = zyPatlist.PatListID;

                if (zyConfig008 != 0)
                {
                    DataTable dt1 = zypo.GetNotSendDurgPresDataTable();

                    if (dt1.Rows.Count > 0)
                    {
                        throw new Exception("该病人还有未发药的费用!");
                    }
                }

                if (costType != 1)
                {
                    if (costType == 2)
                    {
                        zyPatlist.PatType = "4";
                    }
                    else if (costType == 3)
                    {
                        zyPatlist.PatType = "5";
                    }
                }

                ZY_CostMaster zy_CostM = new ZY_CostMaster();

                zy_CostM.PatID           = zyPatlist.PatID;
                zy_CostM.PatListID       = zyPatlist.PatListID;
                zy_CostM.Ntype           = costType;
                zy_CostM.Discharge_date  = XcDate.ServerDateTime.Date;
                zy_CostM.Discharge_bdate = zyPatlist.CureDate.Date;                            //入院日期
                zy_CostM.Discharge_edate = zyPatlist.OutDate;                                  //出院日期
                zy_CostM.TicketNum       = zyCostMaster.GetNewTicketNO(XcDate.ServerDateTime); //?
                zy_CostM.TicketCode      = IfrmCostDiagView.tbTicketNO;                        //fcd.TicketNo.Trim();
                zy_CostM.ChargeCode      = user.EmployeeID.ToString();


                zy_CostM.Ticket_Flag = (int)IfrmCostDiagView.Ptt;
                zy_CostM.CostDate    = XcDate.ServerDateTime;
                zy_CostM.Record_Flag = 0;
                //农合结算
                //decimal villageFee = HIS.ZY_BLL.OP_CostManage.NccmCheck_CostPat(zy_CostM, base.zy_PatList);
                //if (villageFee != 0)
                //    Op_PatFee.SetvillageFee(ref patFee, villageFee);

                zy_CostM.Total_Fee    = Convert.ToDecimal(patFee.costFee.ToString("0.00"));
                zy_CostM.Deptosit_Fee = Convert.ToDecimal(patFee.chargeFee.ToString("0.00"));
                zy_CostM.Self_Fee     = Convert.ToDecimal(patFee.selfFee.ToString("0.00"));
                zy_CostM.Village_Fee  = Convert.ToDecimal(patFee.villageFee.ToString("0.00"));
                zy_CostM.Favor_Fee    = Convert.ToDecimal(patFee.faoverFee.ToString("0.00"));
                zy_CostM.Pos_Fee      = IfrmCostDiagView.tbPos;
                zy_CostM.Money_Fee    = IfrmCostDiagView.tbFee;

                zy_CostM.Reality_Fee = zy_CostM.Pos_Fee + zy_CostM.Money_Fee;//实收金额=pos金额+现金金额

                zy_CostM.Village_Type = 3;
                if (_patType.Trim() == "01")
                {
                    zy_CostM.Village_Type = 3;
                }
                else if (_patType.Trim() == "02")
                {
                    zy_CostM.Village_Type = 2;
                }
                else if (_patType.Trim() == "03")
                {
                    zy_CostM.Village_Type = 0;
                }
                else if (_patType.Trim() == "04")
                {
                    zy_CostM.Village_Type = 1;
                }
                else if (_patType.Trim() == "05")
                {
                    zy_CostM.Village_Type = 3;
                }
                else if (_patType.Trim() == "06")
                {
                    zy_CostM.Village_Type = 3;
                }

                zy_CostM.PatType         = _patType;
                zy_CostM.WorkUnit        = WorkUnit;
                zy_CostM.WorkUnit_Fee    = workUnit_Fee;
                zy_CostM.NotWorkUnit_Fee = zy_CostM.Village_Fee - workUnit_Fee;
                zy_CostM.Ration_Fee      = Ration_Fee;
                zy_CostM.MoreRation_Fee  = Ration_Fee != 0 ? (Ration_Fee - zy_CostM.Village_Fee) : 0;
                zy_CostM.SelfDrug_Fee    = Convert.ToDecimal(IfrmCostView.selfDrugFee);
                //TicketNum = zy_CostM.TicketNum;//add zenghao 090209

                DataTable           dt        = zyCostMaster.GetPatBigItemOrderFee();
                List <ZY_CostOrder> zy_CostOL = new List <ZY_CostOrder>();

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    ZY_CostOrder zy_CostO = new ZY_CostOrder();
                    zy_CostO.PatID       = zyPatlist.PatID;
                    zy_CostO.PatListID   = zyPatlist.PatListID;
                    zy_CostO.TicketNum   = zy_CostM.TicketNum;
                    zy_CostO.TicketCode  = zy_CostM.TicketCode;
                    zy_CostO.BigItemCode = dt.Rows[i]["itemtype"].ToString();
                    zy_CostO.Total_Fee   = Convert.ToDecimal(Convert.ToDecimal(dt.Rows[i]["tolal_fee"]).ToString("0.00"));
                    zy_CostOL.Add(zy_CostO);
                }

                zyCostMaster.CostPat(zy_CostM, zy_CostOL, zyPatlist);
                return(zy_CostM.CostMasterID);
            }
            catch (Exception err)
            {
                throw new Exception(err.Message);
            }
        }
Exemplo n.º 21
0
        public override void InsertItemFee(int order_id, DateTime server_datetime, ZY_DOC_ORDERRECORD zy_doc_orderrecord)
        {
            DateTime ServerDateTime = server_datetime;
            int      employeeid     = base.Employeeid;
            int      orderid        = order_id;
            int      itemid;

            Model.ZY_PresOrder presorder = new ZY_PresOrder();
            //Model.ZY_PresMaster premaster = new ZY_PresMaster();
            string strwhere1 = "order_id=" + orderid;
            string string1   = "op_date=" + "'" + ServerDateTime + "'";
            string string2   = "oprerator=" + employeeid;

            BindEntity <ZY_DOC_ORDERRECORD> .CreateInstanceDAL(oleDb).Update(strwhere1, string1, string2);

            presorder.PatListID    = zy_doc_orderrecord.PATID;
            presorder.MarkDate     = zy_doc_orderrecord.TRANS_DATE;
            presorder.PresDate     = zy_doc_orderrecord.ORDER_BDATE;
            presorder.PresDocCode  = zy_doc_orderrecord.ORDER_DOC.ToString();
            presorder.PresDeptCode = zy_doc_orderrecord.PRES_DEPTID.ToString();
            presorder.ExecDeptCode = zy_doc_orderrecord.EXEC_DEPT.ToString();
            itemid             = zy_doc_orderrecord.ORDITEM_ID;
            presorder.ItemName = zy_doc_orderrecord.ORDER_CONTENT;
            presorder.order_id = zy_doc_orderrecord.ORDER_ID;
            presorder.group_id = zy_doc_orderrecord.GROUP_ID;
            string ordercontent = zy_doc_orderrecord.ORDER_CONTENT;

            presorder.order_type = 1;
            int     unit_type      = zy_doc_orderrecord.UNITTYPE;
            int     item_type      = zy_doc_orderrecord.ITEM_TYPE;
            string  frequency_time = zy_doc_orderrecord.FREQUENCY != "0" ? zy_doc_orderrecord.FREQUENCY : "1";
            decimal num            = zy_doc_orderrecord.AMOUNT;
            decimal pres_amount    = zy_doc_orderrecord.PRES_AMOUNT;
            string  strWhere4      = "patlistid=" + presorder.PatListID;
            string  str4           = "patid";

            presorder.PatID = Convert.ToInt32(BindEntity <HIS.Model.ZY_PatList> .CreateInstanceDAL(oleDb).GetFieldValue(str4, strWhere4));

            string strWhere6 = "name='" + frequency_time + "'";
            string str6      = "execnum";
            int    execNum;

            if (frequency_time == "1" || frequency_time == "" || frequency_time == null)
            {
                execNum = 1;
            }
            else
            {
                execNum = Convert.ToInt32(BindEntity <HIS.Model.Base_Frequency> .CreateInstanceDAL(oleDb).GetFieldValue(str6, strWhere6));
            }
            presorder.CostDate    = ServerDateTime;
            presorder.ChargeCode  = Convert.ToString(base.Employeeid);
            presorder.Charge_Flag = 1;
            string strWhere2 = "itemid=" + itemid + "  and order_type=" + item_type + " and drug_flag=0";

            string[] str2 = new string[7];
            str2[0] = "packunit";
            str2[1] = "leastunit";
            str2[2] = "packnum";
            str2[3] = "buy_price";
            str2[4] = "sell_price";
            str2[5] = "STATITEM_CODE";
            str2[6] = "server_item_id";
            DataTable dt2 = BindEntity <Views.vi_clinical_all_items> .CreateInstanceDAL(oleDb).GetList(strWhere2, str2);

            if (dt2.Rows.Count == 0)
            {
                throw new Exception("项目【" + ordercontent + "】未找到,该项目已不存在,请检查基础数据!");
            }
            presorder.ItemID      = Convert.ToInt32(dt2.Rows[0]["server_item_id"].ToString());
            presorder.PackUnit    = dt2.Rows[0]["packunit"].ToString();
            presorder.Unit        = dt2.Rows[0]["leastunit"].ToString();
            presorder.RelationNum = Convert.ToDecimal(dt2.Rows[0]["packnum"].ToString());
            presorder.Buy_Price   = Convert.ToDecimal(dt2.Rows[0]["buy_price"].ToString());
            presorder.Sell_Price  = Convert.ToDecimal(dt2.Rows[0]["sell_price"].ToString());
            presorder.ItemType    = dt2.Rows[0]["STATITEM_CODE"].ToString();
            presorder.Drug_Flag   = 1;
            presorder.PresType    = "4";
            presorder.Amount      = num * execNum;
            presorder.Tolal_Fee   = Convert.ToDecimal(presorder.Amount * presorder.Sell_Price);
            presorder.Tolal_Fee   = Convert.ToDecimal(presorder.Tolal_Fee.ToString("0.00"));
            BindEntity <ZY_PresOrder> .CreateInstanceDAL(oleDb).Add(presorder);

            //premaster.PatListID = presorder.PatListID;
            //premaster.PatID = presorder.PatID;
            //premaster.PresType = Convert.ToString(1);
            //BindEntity<ZY_PresMaster>.CreateInstanceDAL(oleDb).Add(premaster);
            //string strWhere7 = "presorderid=" + presorder.PresOrderID;
            //string updatefile = Tables.zy_presorder.PRESMASTERID + oleDb.EuqalTo() + premaster.PresMasterID;
            //BindEntity<HIS.Model.ZY_PresOrder>.CreateInstanceDAL(oleDb).Update(strWhere7, updatefile);
            return;
        }
Exemplo n.º 22
0
        /// <summary>
        /// 根据住院号得到待发药处方信息
        /// </summary>
        /// <param name="CureNo">住院号</param>
        /// <param name="deptcode">药房代码</param>
        /// <returns></returns>
        public static DataTable GetPatPresInfo(string CureNo, string deptcode)
        {
            ZY_PresOrder zypo = new ZY_PresOrder(oleDb);

            return(zypo.GetSendGrugPres(CureNo, deptcode));
        }
Exemplo n.º 23
0
        /// <summary>
        /// 根据病人ID得到待发药处方总金额
        /// </summary>
        /// <param name="PatListID"></param>
        /// <param name="deptcode"></param>
        /// <returns></returns>
        public static decimal GetPatPresInfoTotalFee(int PatListID, string deptcode)
        {
            ZY_PresOrder zypo = new ZY_PresOrder(oleDb);

            return(zypo.GetSendGrugPresTotalFee(PatListID, deptcode));
        }
Exemplo n.º 24
0
        /// <summary>
        /// 出院结算
        /// </summary>
        /// <param name="hashtable"></param>
        /// <returns></returns>
        public object Charge(System.Collections.Hashtable hashtable)
        {
            FeeDetail[] prescriptions = (FeeDetail[])hashtable["FeeDetail"];
            string      Is_midWay     = hashtable["midWay"].ToString();
            string      Nccm_NO       = hashtable["Nccm_NO"].ToString();

            ZY_PresOrder zypo = new ZY_PresOrder();

            int[] presID = new int[prescriptions.Length];
            for (int i = 0; i < prescriptions.Length; i++)
            {
                presID[i] = Convert.ToInt32(prescriptions[i].item_sn);
            }
            zypo.UpdateComp(presID);//更新为上传标识



            PatientComp patComp = new PatientComp();

            patComp.uploadorg = "1";

            DataClass dataClass = new DataClass();

            dataClass.dataClassValue = "2";//门诊是1,住院是2
            patComp.dataClass        = dataClass;

            JoinArea joinArea = new JoinArea();

            joinArea.code    = JOIN_AREA_CODE;
            joinArea.name    = JOIN_AREA_NAME;
            patComp.joinArea = joinArea;

            DataType dataType = new DataType();

            dataType.dataTypeName  = "门诊数据";
            dataType.dataTypeValue = "2";
            patComp.dataType       = dataType;


            ZyPatBaseData zyPat = new ZyPatBaseData();


            zyPat.area_id     = JOIN_AREA_CODE;
            zyPat.medorg_code = MED_ORG_CODE;
            zyPat.hisID       = zyPatlist.Nccm_NO;//zyPatlist.CureNo + zyPatlist.PatListID.ToString();
            zyPat.his_billno  = Nccm_NO;
            zyPat.person_code = zyPatlist.patientInfo.PatCode;
            zyPat.name        = zyPatlist.patientInfo.PatName;
            zyPat.sex         = zyPatlist.patientInfo.PatSex == "男" ? "1" : "2";

            zyPat.idCard      = zyPatlist.patientInfo.PatNumber;
            zyPat.family_code = zyPatlist.patientInfo.FamilyCode;
            zyPat.medcard_id  = zyPatlist.patientInfo.MediCard;

            zyPat.medorg_level  = ((HospitalInfo)hospitalInfo).hos_level;
            zyPat.is_midway     = Is_midWay;                     //1,中途2出院
            zyPat.visit_type    = "2";
            zyPat.comp_classs   = "2";                           //?
            zyPat.adm_date      = zyPatlist.CureDate.ToString(); //入院日期
            zyPat.status        = zyPatlist.CureState;           //?
            zyPat.maindiag_code = zyPatlist.DiseaseCode;
            zyPat.dis_date      = zyPatlist.OutDate.ToString();

            patComp.zyPat     = zyPat;
            patComp.zyDetail  = prescriptions;
            patComp.uploadorg = MED_ORG_CODE;

            CompResult CR = NccmInterfaces.OutZYPatientCharge(patComp);

            if (CR.resultId)
            {
                prescriptions = CR.feeDetail;
                presID        = new int[prescriptions.Length];

                for (int i = 0; i < prescriptions.Length; i++)
                {
                    presID[i] = Convert.ToInt32(prescriptions[i].item_sn);
                }
                zypo.DelComp(presID);//更新上传失败的项目

                return(Convert.ToDecimal(CR.compData[0].comp_money));
            }
            else
            {
                throw new Exception("农合接口调用失败:" + CR.resultString);
            }
        }
Exemplo n.º 25
0
        /// <summary>
        /// 根据病人ID得到待发药处方
        /// </summary>
        /// <param name="PatListID">病人ID</param>
        /// <param name="deptcode">药房代码</param>
        /// <returns></returns>
        public static DataTable GetPatPresInfo(int PatListID, string deptcode)
        {
            ZY_PresOrder zypo = new ZY_PresOrder(oleDb);

            return(zypo.GetSendGrugPres(PatListID, deptcode));
        }
Exemplo n.º 26
0
 public CostUpdateController(ICostUpdate _view)
 {
     view = _view;
     zypo = new ZY_PresOrder();
 }
Exemplo n.º 27
0
        /// <summary>
        /// 长期药品费用
        /// </summary>
        public override void InsertDrugFee(int order_id, DateTime server_datetime, ZY_DOC_ORDERRECORD zy_nurse_orderrecord)
        {
            int      orderid = order_id;
            int      itemid;
            DateTime ServerDateTime = server_datetime;

            Model.ZY_PresOrder presorder = new ZY_PresOrder();
            //Model.ZY_PresMaster premaster = new ZY_PresMaster();
            string string1 = "op_date=" + "'" + ServerDateTime + "'";
            string string2 = "oprerator=" + Employeeid;

            BindEntity <ZY_DOC_ORDERRECORD> .CreateInstanceDAL(oleDb).Update("order_id=" + orderid, string1, string2);

            presorder.PatListID    = Zy_doc_orderrecord.PATID;
            presorder.MarkDate     = Zy_doc_orderrecord.TRANS_DATE;
            presorder.PresDate     = Zy_doc_orderrecord.ORDER_BDATE;
            presorder.PresDocCode  = Zy_doc_orderrecord.ORDER_DOC.ToString();
            presorder.PresDeptCode = Zy_doc_orderrecord.PRES_DEPTID.ToString();
            presorder.ExecDeptCode = Zy_doc_orderrecord.EXEC_DEPT.ToString();
            itemid               = Zy_doc_orderrecord.ORDITEM_ID == 0 ? Zy_doc_orderrecord.MAKEDICID : Zy_doc_orderrecord.ORDITEM_ID;
            presorder.ItemName   = Zy_doc_orderrecord.ORDER_CONTENT;
            presorder.order_id   = Zy_doc_orderrecord.ORDER_ID;
            presorder.group_id   = Zy_doc_orderrecord.GROUP_ID;
            presorder.order_type = Zy_doc_orderrecord.ORDER_TYPE;
            string   ordercontent    = Zy_doc_orderrecord.ORDER_CONTENT;
            int      unit_type       = Zy_doc_orderrecord.UNITTYPE;
            int      item_type       = Zy_doc_orderrecord.ITEM_TYPE;
            string   frequency_time  = Zy_doc_orderrecord.FREQUENCY;
            int      first_time      = Zy_doc_orderrecord.FIRSET_TIMES;
            int      last_time       = Zy_doc_orderrecord.TEMINAL_TIMES;
            decimal  num             = Zy_doc_orderrecord.AMOUNT;
            decimal  pres_amount     = Zy_doc_orderrecord.PRES_AMOUNT;
            DateTime order_begindate = Zy_doc_orderrecord.ORDER_BDATE;
            DateTime order_enddate   = Zy_doc_orderrecord.EORDER_DATE;
            DateTime currenttime     = ServerDateTime;

            string strWhere4 = "patlistid=" + presorder.PatListID;
            string str4      = "patid";

            presorder.PatID = Convert.ToInt32(BindEntity <HIS.Model.ZY_PatList> .CreateInstanceDAL(oleDb).GetFieldValue(str4, strWhere4));

            string strWhere6 = "name='" + frequency_time + "'";
            string str6      = "execnum";

            int execNum;

            if (currenttime.ToString("yyyy-MM-dd") == order_begindate.ToString("yyyy-MM-dd") && currenttime.ToString("yyyy-MM-dd") == order_enddate.ToString("yyyy-MM-dd"))//11月22日加,解决如果长嘱当天开,当天停,以末次计数
            {
                execNum = last_time;
            }
            else if (currenttime.ToString("yyyy-MM-dd") == order_begindate.ToString("yyyy-MM-dd"))
            {
                execNum = first_time;
            }
            else if (currenttime.ToString("yyyy-MM-dd") == order_enddate.ToString("yyyy-MM-dd"))
            {
                execNum = last_time;
            }
            else
            {
                if (frequency_time == "1" || frequency_time == "" || frequency_time == null)
                {
                    execNum = 1;
                }
                else
                {
                    execNum = Convert.ToInt32(BindEntity <HIS.Model.Base_Frequency> .CreateInstanceDAL(oleDb).GetFieldValue(str6, strWhere6));
                }
            }
            presorder.CostDate    = ServerDateTime;
            presorder.ChargeCode  = Convert.ToString(base.Employeeid);
            presorder.Charge_Flag = 1;
            //取消判断库存 2011.1.14 heyan
            string strWhere3 = "itemid=" + itemid + " and drug_flag=1 and order_type=" + item_type + "";// and storenum>0 and EXECDEPTCODE=" + zy_nurse_orderrecord.EXEC_DEPT + ""; //update by heyan 2010.12.3 医嘱发送时库存为0的不能发送

            string[] str3 = new string[9];
            str3[0] = "packunit";
            str3[1] = "leastunit";
            str3[2] = "packnum";
            str3[3] = "dosenum";
            str3[4] = "buy_price";
            str3[5] = "sell_price";
            str3[6] = "float_flag";
            str3[7] = "standard";
            str3[8] = "STATITEM_CODE";
            DataTable dt3 = BindEntity <Views.vi_clinical_all_items> .CreateInstanceDAL(oleDb).GetList(strWhere3, str3);

            if (zy_nurse_orderrecord.STATUS_FALG != 4 && dt3.Rows.Count == 0) // update by heyan 2010.12.25 停嘱的不判断库存
            {
                throw new Exception("药品【" + ordercontent + "】未找到,该药品可能已停用或已删除或库存为0,请检查药品字典!");
            }
            presorder.ItemID      = itemid;
            presorder.PackUnit    = dt3.Rows[0]["packunit"].ToString();
            presorder.Unit        = dt3.Rows[0]["leastunit"].ToString();
            presorder.RelationNum = Convert.ToDecimal(dt3.Rows[0]["packnum"].ToString());
            presorder.Drug_Flag   = 0;
            presorder.Buy_Price   = Convert.ToDecimal(dt3.Rows[0]["buy_price"].ToString());
            presorder.Sell_Price  = Convert.ToDecimal(dt3.Rows[0]["sell_price"].ToString());
            presorder.PresType    = Zy_doc_orderrecord.ITEM_TYPE.ToString();//dt1.Rows[0]["item_type"].ToString();
            presorder.Standard    = dt3.Rows[0]["standard"].ToString();
            presorder.ItemType    = dt3.Rows[0]["STATITEM_CODE"].ToString();
            decimal dose_num   = Convert.ToDecimal(dt3.Rows[0]["dosenum"].ToString());
            int     pack_num   = Convert.ToInt32(dt3.Rows[0]["packnum"].ToString());
            bool    float_flag = Convert.ToInt32(dt3.Rows[0]["float_flag"].ToString()) == 1 ? true : false;

            presorder.Amount = DrugAmoutCalculation.getlongAmout(float_flag, unit_type, item_type, execNum, dose_num, pack_num, first_time, last_time, num, pres_amount, presorder.PresDate, order_enddate, presorder.CostDate);
            int tempnum = Convert.ToInt32((presorder.Amount - (presorder.Amount % pack_num)) / pack_num);

            presorder.Tolal_Fee = tempnum * presorder.Sell_Price + ((presorder.Amount % pack_num) / pack_num) * presorder.Sell_Price;
            //插入费用表数据和结算表数据
            presorder.Tolal_Fee = Convert.ToDecimal(presorder.Tolal_Fee.ToString("0.00"));
            BindEntity <ZY_PresOrder> .CreateInstanceDAL(oleDb).Add(presorder);

            //premaster.PatListID = presorder.PatListID;
            //premaster.PatID = presorder.PatID;
            //premaster.PresType = Convert.ToString(0);
            //BindEntity<ZY_PresMaster>.CreateInstanceDAL(oleDb).Add(premaster);
            //string strWhere7 = "presorderid=" + presorder.PresOrderID;
            //string updatefile = Tables.zy_presorder.PRESMASTERID + oleDb.EuqalTo() + premaster.PresMasterID;
            //BindEntity<HIS.Model.ZY_PresOrder>.CreateInstanceDAL(oleDb).Update(strWhere7, updatefile);
            return;
        }
Exemplo n.º 28
0
        /// <summary>
        /// 长期医嘱用法联动费用
        /// </summary>
        public void InsertDrugUsageFee(int order_id, int group_id, string order_usage, DateTime server_time, ZY_DOC_ORDERRECORD zy_nurse_orderrecord)
        {
            int       orderid    = order_id;
            int       groupid    = group_id;
            string    orderusage = order_usage;
            DateTime  servertime = server_time;
            string    strWhere   = "use_name=" + "'" + orderusage + "'";
            DataTable dt         = BindEntity <object> .CreateInstanceDAL(oleDb, Views.VI_USEAGE_FEE).GetList(strWhere, "item_id", "num");

            try
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i][0].ToString() != "")
                    {
                        int item_id = Convert.ToInt32(dt.Rows[i][0].ToString());
                        int num     = Convert.ToInt32(dt.Rows[i][1].ToString());
                        Model.ZY_PresOrder presorder = new ZY_PresOrder();
                        //Model.ZY_PresMaster premaster = new ZY_PresMaster();

                        presorder.PatListID    = zy_nurse_orderrecord.PATID;
                        presorder.MarkDate     = zy_nurse_orderrecord.TRANS_DATE;
                        presorder.PresDate     = zy_nurse_orderrecord.ORDER_BDATE;
                        presorder.PresDocCode  = zy_nurse_orderrecord.ORDER_DOC.ToString();
                        presorder.PresDeptCode = zy_nurse_orderrecord.PRES_DEPTID.ToString();
                        presorder.ExecDeptCode = zy_nurse_orderrecord.PRES_DEPTID.ToString();//update by heyan 2010.10.8 联动项目的执行科室为开方科室
                        presorder.order_id     = zy_nurse_orderrecord.ORDER_ID;
                        presorder.group_id     = zy_nurse_orderrecord.GROUP_ID;
                        presorder.order_type   = zy_nurse_orderrecord.ORDER_TYPE;
                        DateTime order_bdate    = zy_nurse_orderrecord.ORDER_BDATE;
                        DateTime order_edate    = zy_nurse_orderrecord.EORDER_DATE;
                        string   frequency_time = zy_nurse_orderrecord.FREQUENCY;
                        int      firset_times   = zy_nurse_orderrecord.FIRSET_TIMES;
                        int      teminal_times  = Convert.ToInt32(XcConvert.IsNull(zy_nurse_orderrecord.TEMINAL_TIMES, "0"));
                        DateTime currenttime    = servertime;
                        string   strWhere2      = "patlistid=" + presorder.PatListID;
                        string   str2           = "patid";
                        presorder.PatID = Convert.ToInt32(BindEntity <HIS.Model.ZY_PatList> .CreateInstanceDAL(oleDb).GetFieldValue(str2, strWhere2));
                        string strWhere3 = "name='" + frequency_time + "'";
                        string str3      = "execnum";
                        int    execNum;
                        if (currenttime.ToString("yyyy-MM-dd") == order_bdate.ToString("yyyy-MM-dd") && currenttime.ToString("yyyy-MM-dd") == order_edate.ToString("yyyy-MM-dd"))//11月22日加,解决如果长嘱当天开,当天停,以末次计数
                        {
                            execNum = teminal_times;
                        }
                        else if (currenttime.ToString("yyyy-MM-dd") == order_bdate.ToString("yyyy-MM-dd"))
                        {
                            execNum = firset_times;
                        }
                        else if (currenttime.ToString("yyyy-MM-dd") == order_edate.ToString("yyyy-MM-dd"))
                        {
                            execNum = teminal_times;
                        }
                        else
                        {
                            if (frequency_time == "1" || frequency_time == "" || frequency_time == null)
                            {
                                execNum = 1;
                            }
                            else
                            {
                                execNum = Convert.ToInt32(BindEntity <HIS.Model.Base_Frequency> .CreateInstanceDAL(oleDb).GetFieldValue(str3, strWhere3));
                            }
                        }
                        string   strWhere4 = "server_item_id=" + item_id + " and drug_flag=0";
                        string[] str4      = new string[9];
                        str4[0] = "packunit";
                        str4[1] = "leastunit";
                        str4[2] = "packnum";
                        str4[3] = "buy_price";
                        str4[4] = "sell_price";
                        str4[5] = "standard";
                        str4[6] = "server_item_id";
                        str4[7] = "statitem_code";
                        str4[8] = "ItemName";
                        DataTable dt4 = BindEntity <object> .CreateInstanceDAL(oleDb, Views.VI_CLINICAL_ALL_ITEMS).GetList(strWhere4, str4);

                        presorder.PackUnit    = dt4.Rows[0]["packunit"].ToString();
                        presorder.Unit        = dt4.Rows[0]["leastunit"].ToString();
                        presorder.RelationNum = Convert.ToDecimal(dt4.Rows[0]["packnum"].ToString());
                        presorder.Buy_Price   = Convert.ToDecimal(dt4.Rows[0]["buy_price"].ToString());
                        presorder.Sell_Price  = Convert.ToDecimal(dt4.Rows[0]["sell_price"].ToString());
                        presorder.Standard    = dt4.Rows[0]["standard"].ToString();
                        presorder.PresType    = Convert.ToString(4);
                        presorder.ItemID      = Convert.ToInt32(dt4.Rows[0]["server_item_id"].ToString());
                        presorder.ItemType    = dt4.Rows[0]["statitem_code"].ToString();
                        string strWhere6 = "item_id=" + item_id;
                        object obj       = BindEntity <BASE_SERVICE_ITEMS> .CreateInstanceDAL(oleDb).GetFieldValue("item_name", strWhere6);

                        presorder.ItemName    = obj.ToString();
                        presorder.Amount      = execNum * num;
                        presorder.CostDate    = servertime;
                        presorder.ChargeCode  = Convert.ToString(base.Employeeid);
                        presorder.Charge_Flag = 1;
                        presorder.Drug_Flag   = 1;
                        presorder.Tolal_Fee   = presorder.Amount * presorder.Sell_Price;
                        presorder.Tolal_Fee   = Convert.ToDecimal(presorder.Tolal_Fee.ToString("0.00"));
                        BindEntity <ZY_PresOrder> .CreateInstanceDAL(oleDb).Add(presorder);

                        //premaster.PatListID = presorder.PatListID;
                        //premaster.PatID = presorder.PatID;
                        //premaster.PresType = Convert.ToString(1);
                        //BindEntity<ZY_PresMaster>.CreateInstanceDAL(oleDb).Add(premaster);

                        //string strWhere5 = "presorderid=" + presorder.PresOrderID;
                        //string updatefile = Tables.zy_presorder.PRESMASTERID + oleDb.EuqalTo() + premaster.PresMasterID;
                        //BindEntity<HIS.Model.ZY_PresOrder>.CreateInstanceDAL(oleDb).Update(strWhere5, updatefile);
                    }
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
        /// <summary>
        /// 长期导入医嘱
        /// </summary>
        /// <param name="presType"></param>
        public string PresLoad(int presType)
        {
            string    loadMessage = null;
            DataTable dt          = zyPresOrder.GetPresDataTable(view.PresDate.AddDays(-1));

            DataTable CurData = null;

            if (presType == 0)
            {
                CurData = view.BindLongPresControlData;
            }
            else
            {
                CurData = view.BindShortPresControlData;
            }
            if (CurData.Rows.Count <= 0)
            {
                List <ZY_PresOrder> _zyPresOrderSon = new List <ZY_PresOrder>();
                ZY_PresOrder        zyPresSon1      = new ZY_PresOrder();
                zyPresSon1.XD          = false;
                zyPresSon1.Record_Flag = -1;
                _zyPresOrderSon.Add(zyPresSon1);
                if (presType == 0)
                {
                    view.BindLongPresControlData = HIS.SYSTEM.PubicBaseClasses.ApiFunction.ObjToDataTable(_zyPresOrderSon);
                    CurData = view.BindLongPresControlData;
                }
                else
                {
                    view.BindShortPresControlData = HIS.SYSTEM.PubicBaseClasses.ApiFunction.ObjToDataTable(_zyPresOrderSon);
                    CurData = view.BindShortPresControlData;
                }
                CurData.Rows.Clear();
            }

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                dt.Rows[i]["PresOrderID"] = 0;

                dt.Rows[i]["PatID"]     = 0;
                dt.Rows[i]["PatListID"] = 0;
                if (CurData.Rows.Count > 0)
                {
                    dt.Rows[i]["PresMasterID"] = CurData.Rows[CurData.Rows.Count - 1]["PresMasterID"];
                }
                else
                {
                    dt.Rows[i]["PresMasterID"] = 0;
                }
                dt.Rows[i]["PresDate"]     = DBNull.Value;
                dt.Rows[i]["MarkDate"]     = DBNull.Value;
                dt.Rows[i]["CostDate"]     = DBNull.Value;
                dt.Rows[i]["Charge_Flag"]  = 0;
                dt.Rows[i]["Drug_Flag"]    = 0;
                dt.Rows[i]["Delete_Flag"]  = 0;
                dt.Rows[i]["OldID"]        = 0;
                dt.Rows[i]["CostMasterID"] = 0;
                dt.Rows[i]["Cost_Flag"]    = 0;
                dt.Rows[i]["PassID"]       = 0;

                dt.Rows[i]["ROWNO"]       = CurData.Rows.Count + 1;
                dt.Rows[i]["RECORD_FLAG"] = -1;

                for (int k = 0; k < _dataSet.Tables["ITEM_DICTIONARY"].Rows.Count; k++)
                {
                    //if (_dataSet.Tables["ITEM_DICTIONARY"].Rows[k]["ITEMID"].ToString().Trim() == dt.Rows[i]["ITEMID"].ToString().Trim()
                    //    && _dataSet.Tables["ITEM_DICTIONARY"].Rows[k]["EXECDEPTCODE"].ToString().Trim() == dt.Rows[i]["EXECDEPTCODE"].ToString().Trim())
                    //{
                    if (_dataSet.Tables["ITEM_DICTIONARY"].Rows[k]["ITEMID"].ToString().Trim() == dt.Rows[i]["ITEMID"].ToString().Trim() &&
                        ((Convert.ToInt32(dt.Rows[i]["PRESTYPE"]) < 4 && (_dataSet.Tables["ITEM_DICTIONARY"].Rows[k]["PresType"].ToString().Trim() == "1" ||
                                                                          _dataSet.Tables["ITEM_DICTIONARY"].Rows[k]["PresType"].ToString().Trim() == "2" ||
                                                                          _dataSet.Tables["ITEM_DICTIONARY"].Rows[k]["PresType"].ToString().Trim() == "3")) ||
                         (Convert.ToInt32(dt.Rows[i]["PRESTYPE"]) == 4 &&
                          _dataSet.Tables["ITEM_DICTIONARY"].Rows[k]["PresType"].ToString().Trim() == "4") ||
                         (Convert.ToInt32(dt.Rows[i]["PRESTYPE"]) == 5 &&
                          _dataSet.Tables["ITEM_DICTIONARY"].Rows[k]["PresType"].ToString().Trim() == "5")

                        ))
                    {
                        dt.Rows[i]["ITEMTYPE"]    = _dataSet.Tables["ITEM_DICTIONARY"].Rows[k]["ITEMTYPE"];
                        dt.Rows[i]["PRESTYPE"]    = _dataSet.Tables["ITEM_DICTIONARY"].Rows[k]["PRESTYPE"];
                        dt.Rows[i]["ITEMNAME"]    = _dataSet.Tables["ITEM_DICTIONARY"].Rows[k]["ITEMNAME"];
                        dt.Rows[i]["STANDARD"]    = _dataSet.Tables["ITEM_DICTIONARY"].Rows[k]["STANDARD"];
                        dt.Rows[i]["UNIT"]        = _dataSet.Tables["ITEM_DICTIONARY"].Rows[k]["UNIT"];
                        dt.Rows[i]["RELATIONNUM"] = _dataSet.Tables["ITEM_DICTIONARY"].Rows[k]["RELATIONNUM"];
                        dt.Rows[i]["BUY_PRICE"]   = _dataSet.Tables["ITEM_DICTIONARY"].Rows[k]["BUY_PRICE"];
                        dt.Rows[i]["SELL_PRICE"]  = _dataSet.Tables["ITEM_DICTIONARY"].Rows[k]["SELL_PRICE"];
                        dt.Rows[i]["PACKUNIT"]    = _dataSet.Tables["ITEM_DICTIONARY"].Rows[k]["PACKUNIT"];
                        decimal binnum      = Convert.ToDecimal(XcConvert.IsNull(dt.Rows[i]["BigNum"], "0"));
                        decimal price       = Convert.ToDecimal(dt.Rows[i]["Sell_PRICE"]);
                        decimal smallnum    = Convert.ToDecimal(XcConvert.IsNull(dt.Rows[i]["SmallNum"], "0"));
                        decimal RelationNum = Convert.ToDecimal(dt.Rows[i]["RelationNum"]);

                        decimal _amount = Convert.ToDecimal(_dataSet.Tables["ITEM_DICTIONARY"].Rows[k]["STORENUM"]);
                        decimal amount  = binnum * RelationNum + smallnum;
                        if (_amount < amount)//导入时库存量不足时
                        {
                            //binnum = (_amount - (_amount % RelationNum)) / RelationNum;
                            //smallnum = _amount % RelationNum;
                            //loadMessage += "[" + dt.Rows[i]["ITEMNAME"] + "]" + "库存已经不足,由原来的" + dt.Rows[i]["BigNum"].ToString() + dt.Rows[i]["PACKUNIT"].ToString() + dt.Rows[i]["SmallNum"].ToString() + dt.Rows[i]["UNIT"].ToString() + "更改为" + binnum.ToString() + dt.Rows[i]["PACKUNIT"].ToString() + smallnum.ToString() + dt.Rows[i]["UNIT"].ToString() + "\n";
                            //dt.Rows[i]["BigNum"] = Convert.ToInt32(binnum);
                            //dt.Rows[i]["SmallNum"] = Convert.ToInt32(smallnum);
                            loadMessage += "[" + dt.Rows[i]["ITEMNAME"] + "]" + "\t库存已经不足\n";
                        }

                        dt.Rows[i]["TOLAL_FEE"] = Convert.ToDecimal((binnum * price) + (smallnum * price / RelationNum)).ToString("0.0000");

                        break;
                    }
                    if (k == _dataSet.Tables["ITEM_DICTIONARY"].Rows.Count - 1)
                    {
                        loadMessage += "[" + dt.Rows[i]["ITEMNAME"] + "]\t已经停止使用或没有库存\n";
                        //dt.Rows[i]["BigNum"] = 0;
                        //dt.Rows[i]["SmallNum"] = 0;
                        //dt.Rows[i]["Amount"] = 0;
                        //dt.Rows[i]["TOLAL_FEE"] = 0;
                    }
                }

                CurData.Rows.Add(dt.Rows[i].ItemArray);
            }
            //2009-4-8 zh update 执行成功后提示
            if (dt.Rows.Count <= 0)
            {
                throw new Exception("没有可以导入的医嘱!");
            }
            return(loadMessage);
        }
        /// <summary>
        /// 赋值
        /// </summary>
        /// <param name="PresType">0长期,1临时</param>
        /// <param name="rowid">行号</param>
        /// <param name="dr">列</param>
        /// <returns>列号</returns>
        public int SelectCardBindData(int PresType, int rowid, DataRow dr)
        {
            DataTable dt = null;

            if (PresType == 0)
            {
                dt = view.BindLongPresControlData;
            }
            else
            {
                dt = view.BindShortPresControlData;
            }
            string presType = XcConvert.IsNull(dr["PresType"], "-1").Trim();

            //模板
            if (presType == "6")
            {
                int       feeType = Convert.ToInt32(dr["ITEMTYPE"]);//0 药品模板 ;1项目模板
                DataTable tempDt  = zyPresOrder.GetPresTemplateData(Convert.ToInt32(dr["ITEMID"]));
                //循环模板
                for (int i = 0; i < tempDt.Rows.Count; i++)
                {
                    dr["ITEMID"] = tempDt.Rows[i]["ITEM_ID"];
                    presType     = Convert.ToInt32(tempDt.Rows[i]["COMPLEX_ID"]) == 0 ? "4" : "5";
                    for (int k = 0; k < _dataSet.Tables["ITEM_DICTIONARY"].Rows.Count; k++)
                    {
                        //ITEMID && feeType == 0   PresType(1,2,3)
                        //ITEMID && feeType == 0   PresType(4,5)
                        if (_dataSet.Tables["ITEM_DICTIONARY"].Rows[k]["ITEMID"].ToString().Trim() == tempDt.Rows[i]["ITEM_ID"].ToString().Trim() &&
                            ((feeType == 0 && (_dataSet.Tables["ITEM_DICTIONARY"].Rows[k]["PresType"].ToString().Trim() == "1" ||
                                               _dataSet.Tables["ITEM_DICTIONARY"].Rows[k]["PresType"].ToString().Trim() == "2" ||
                                               _dataSet.Tables["ITEM_DICTIONARY"].Rows[k]["PresType"].ToString().Trim() == "3")) ||
                             (feeType == 1 &&
                              _dataSet.Tables["ITEM_DICTIONARY"].Rows[k]["PresType"].ToString().Trim() == presType)))
                        {
                            dr["ITEMTYPE"]     = _dataSet.Tables["ITEM_DICTIONARY"].Rows[k]["ITEMTYPE"];
                            dr["ITEMNAME"]     = _dataSet.Tables["ITEM_DICTIONARY"].Rows[k]["ITEMNAME"];
                            dr["STANDARD"]     = _dataSet.Tables["ITEM_DICTIONARY"].Rows[k]["STANDARD"];
                            dr["SELL_PRICE"]   = _dataSet.Tables["ITEM_DICTIONARY"].Rows[k]["SELL_PRICE"];
                            dr["PACKUNIT"]     = _dataSet.Tables["ITEM_DICTIONARY"].Rows[k]["PACKUNIT"];
                            dr["UNIT"]         = _dataSet.Tables["ITEM_DICTIONARY"].Rows[k]["UNIT"];
                            dr["EXECDEPTCODE"] = _dataSet.Tables["ITEM_DICTIONARY"].Rows[k]["EXECDEPTCODE"];
                            dr["EXECDEPTNAME"] = _dataSet.Tables["ITEM_DICTIONARY"].Rows[k]["EXECDEPTNAME"];
                            dr["PresType"]     = _dataSet.Tables["ITEM_DICTIONARY"].Rows[k]["PresType"];
                            dr["Buy_Price"]    = _dataSet.Tables["ITEM_DICTIONARY"].Rows[k]["Buy_Price"];
                            dr["RELATIONNUM"]  = _dataSet.Tables["ITEM_DICTIONARY"].Rows[k]["RELATIONNUM"];
                            dr["scale"]        = _dataSet.Tables["ITEM_DICTIONARY"].Rows[k]["scale"];
                            dr["STORENUM"]     = _dataSet.Tables["ITEM_DICTIONARY"].Rows[k]["STORENUM"];
                            break;
                        }
                    }
                    this.SelectCardEqualsData(dt, rowid, dr, Convert.ToDecimal(tempDt.Rows[i]["AMOUNT"]));
                    rowid = this.AddRow(PresType);
                }
            }//其他费用项目
            else
            {
                if (Convert.ToInt32(dr["STORENUM"]) > 0)
                {
                    this.SelectCardEqualsData(dt, rowid, dr, 0);
                }
                else
                {
                    throw new Exception("该药品[" + dr["ITEMNAME"].ToString() + "]无库存!");
                }
            }
            ZY_PresOrder zyPS = new ZY_PresOrder();

            zyPS = (ZY_PresOrder)HIS.SYSTEM.PubicBaseClasses.ApiFunction.DataTableToObject(dt, rowid, zyPS);
            ShowRowColor(zyPS, rowid, -1);
            return(rowid);
        }