コード例 #1
0
        private ChargeInfo[] _budget(Prescription[] prescriptions)
        {
            int temp_costmasterid = MSAccessDb.GetMaxID("MZ_COSTMASTER", Tables.mz_costmaster.COSTMASTERID);
            int temp_costorderid  = MSAccessDb.GetMaxID("MZ_COSTORDER", Tables.mz_costorder.COSTORDERID);

            ChargeInfo[] chargeInfos = new ChargeInfo[prescriptions.Length];
            try
            {
                for (int prescCount = 0; prescCount < prescriptions.Length; prescCount++)
                {
                    List <Item> lstStatItems = MergePrescriptionByStatItemCode(ref prescriptions[prescCount]);

                    Prescription prescription = prescriptions[prescCount];
                    chargeInfos[prescCount] = new ChargeInfo( );
                    //保存结算头
                    HIS.Model.MZ_CostMaster chargeBill = new HIS.Model.MZ_CostMaster( );
                    #region ....
                    chargeBill.PatID        = Patient.PatID;
                    chargeBill.PatListID    = Patient.PatListID;
                    chargeBill.PresMasterID = prescription.PrescriptionID;
                    chargeBill.TicketNum    = "";
                    chargeBill.TicketCode   = "";
                    chargeBill.ChargeCode   = OperatorId.ToString( );
                    chargeBill.ChargeName   = DataReader.GetEmployeeNameById(OperatorId); //BindEntity<HIS.Model.BASE_EMPLOYEE_PROPERTY>.CreateInstanceDAL(oleDb).GetModel(OperatorId).NAME ;
                    chargeBill.Total_Fee    = prescription.Total_Fee;
                    chargeBill.Self_Fee     = 0;
                    chargeBill.Village_Fee  = 0;
                    chargeBill.Favor_Fee    = 0;
                    chargeBill.Pos_Fee      = 0;
                    chargeBill.Money_Fee    = 0;
                    chargeBill.Ticket_Flag  = 0;
                    //chargeBill.CostDate;//预结算不写结算时间
                    chargeBill.Record_Flag  = 9;//预结算记录状态置为9
                    chargeBill.OldID        = 0;
                    chargeBill.AccountID    = 0;
                    chargeBill.Hang_Flag    = (int)OPDOperationType.门诊收费;
                    chargeBill.Hurried_Flag = Patient.IsEmergency ? 1 : 0;
                    #endregion
                    //int ret1 = BindEntity<HIS.Model.MZ_CostMaster>.CreateInstanceDAL( oleDb ).Add( chargeBill );
                    chargeBill.CostMasterID = temp_costmasterid;
                    int ret1 = MSAccessDb.InsertRecord(chargeBill, Tables.mz_costmaster.COSTMASTERID);
                    temp_costmasterid++;

                    chargeBill.CostMasterID            = temp_costmasterid;
                    prescriptions[prescCount].ChargeID = temp_costmasterid;
                    //累加每张处方结算信息
                    chargeInfos[prescCount].ChargeID       = chargeBill.CostMasterID;
                    chargeInfos[prescCount].PrescriptionID = chargeBill.PresMasterID;
                    chargeInfos[prescCount].TotalFee       = chargeBill.Total_Fee;
                    chargeInfos[prescCount].SelfFee        = chargeBill.Self_Fee;
                    chargeInfos[prescCount].VillageFee     = chargeBill.Village_Fee;
                    chargeInfos[prescCount].FavorFee       = chargeBill.Favor_Fee;
                    if (ret1 > 0)
                    {
                        List <InvoiceItem> chargeItems = new List <InvoiceItem>( );
                        #region  大项目保存结算明细
                        foreach (object obj in lstStatItems)
                        {
                            Item item = (Item)obj;
                            HIS.Model.MZ_CostOrder chargeDetail = new HIS.Model.MZ_CostOrder( );
                            chargeDetail.CostID      = chargeBill.CostMasterID;
                            chargeDetail.ItemType    = item.Text;
                            chargeDetail.Total_Fee   = Convert.ToDecimal(item.Value);
                            chargeDetail.CostOrderID = temp_costorderid;
                            int ret2 = MSAccessDb.InsertRecord(chargeDetail, Tables.mz_costorder.COSTORDERID);
                            temp_costorderid++;
                            if (ret2 > 0)
                            {
                                InvoiceItem invoice = GetInvoiceByStatCode(chargeDetail.ItemType);
                                invoice.Cost = chargeDetail.Total_Fee;
                                chargeItems.Add(invoice);
                            }
                        }
                        #endregion
                        chargeInfos[prescCount].Items = chargeItems.ToArray( );
                    }
                }
            }
            catch (Exception err)
            {
                throw err;
            }
            //计算每张处方的打折金额
            for (int i = 0; i < chargeInfos.Length; i++)
            {
                chargeInfos[i].FavorFee = GetFavorCost(Patient.MediType, chargeInfos[i], prescriptions[i]);
            }
            return(chargeInfos);
        }
コード例 #2
0
ファイル: OutPatient.cs プロジェクト: yendux/BlueCloudHIS1.2
        /// <summary>
        /// 获取病人处方
        /// </summary>
        /// <param name="status"></param>
        /// <param name="IsCharge">是否收费处检索</param>
        /// <param name="beginDate">开始时间</param>
        /// <param name="endDate">结束时间</param>
        /// <param name="InvoiceNo">发票号</param>
        /// <param name="ExecDeptCode">执行科室ID</param>
        /// <returns>处方信息</returns>
        public Prescription[] GetPrescriptions(PresStatus status, bool IsCharge, string beginDate, string endDate, string InvoiceNo, int ExecDeptCode)
        {
            string condiction = "";

            switch (status)
            {
            case PresStatus.全部:
                condiction = " PatListID = " + this.PatListID + " AND Record_Flag in (0,1)";
                break;

            case PresStatus.未收费:
                condiction = " PatListID = " + this.PatListID + " AND Charge_Flag = 0 AND Record_Flag = 0 AND Drug_Flag = 0";
                break;

            case PresStatus.已收费未发药:
            case PresStatus.已收费已退药:
                condiction = " PatListID = " + this.PatListID + " AND Charge_Flag = 1 AND Record_Flag = 0 And Drug_Flag = 0";
                break;

            case PresStatus.已收费已发药:
                condiction = " PatListID = " + this.PatListID + " AND Charge_Flag = 1 AND Record_Flag = 0 And Drug_Flag = 1";
                break;
            }
            if (!IsCharge)
            {
                condiction = condiction + " and PRESTYPE in ('1','2','3') ";
            }

            if (ExecDeptCode != 0)
            {
                condiction = condiction + " and ExecDeptCode = '" + ExecDeptCode.ToString() + "'";
            }

            if (InvoiceNo.Trim( ) == "")
            {
                if (beginDate.Trim( ) != "")
                {
                    condiction = condiction + " and PresDate>=#" + beginDate + "#";
                }
                if (endDate.Trim( ) != "")
                {
                    condiction = condiction + " and PresDate<=#" + endDate + "#";
                }
            }

            if (InvoiceNo.Trim( ) != "")
            {
                condiction = condiction + " and COSTMASTERID in (select COSTMASTERID from MZ_COSTMASTER where TICKETNUM='" + InvoiceNo + "' and RECORD_FLAG IN (0,1))";
            }

            condiction = condiction + " and hand_flag = " + (int)OPDOperationType.门诊收费 + " order by presmasterid";

            //得到实体列表
            List <HIS.Model.MZ_PresMaster> presMastList = MSAccessDb.GetListArray <MZ_PresMaster>("MZ_PRESMASTER", condiction);

            //定义返回的处方
            Prescription[] prescriptions = new Prescription[presMastList.Count];
            for (int i = 0; i < presMastList.Count; i++)
            {
                #region 读取处方头
                prescriptions[i].Charge_Flag    = presMastList[i].Charge_Flag;
                prescriptions[i].ChargeCode     = presMastList[i].ChargeCode;
                prescriptions[i].ChargeID       = presMastList[i].CostMasterID;
                prescriptions[i].Drug_Flag      = presMastList[i].Drug_Flag;
                prescriptions[i].ExecDeptCode   = presMastList[i].ExecDeptCode;
                prescriptions[i].ExecDocCode    = presMastList[i].ExecDocCode;
                prescriptions[i].OldPresID      = presMastList[i].OldID;
                prescriptions[i].PresCostCode   = presMastList[i].PresCostCode;
                prescriptions[i].PrescriptionID = presMastList[i].PresMasterID;
                prescriptions[i].PrescType      = presMastList[i].PresType;
                prescriptions[i].PresDeptCode   = presMastList[i].PresDocCode;
                prescriptions[i].PresDocCode    = presMastList[i].PresDocCode;
                prescriptions[i].Record_Flag    = presMastList[i].Record_Flag;
                prescriptions[i].TicketCode     = presMastList[i].TicketCode;
                prescriptions[i].TicketNum      = presMastList[i].TicketNum;
                prescriptions[i].Total_Fee      = presMastList[i].Total_Fee;
                prescriptions[i].VisitNo        = this.VisitNo;
                #endregion
                //HIS.DAL.MZ_PresOrder mz_presorder = new HIS.DAL.MZ_PresOrder( );
                //mz_presorder._oleDB = oleDb;
                List <HIS.Model.MZ_PresOrder> presDetailList = MSAccessDb.GetListArray <MZ_PresOrder>("MZ_PRESORDER", " PresMasterID = " + presMastList[i].PresMasterID + " order by order_flag");
                //写明细
                PrescriptionDetail[] details = new PrescriptionDetail[presDetailList.Count];
                for (int j = 0; j < presDetailList.Count; j++)
                {
                    #region 明细
                    details[j].Amount      = presDetailList[j].Amount;
                    details[j].BigitemCode = presDetailList[j].BigItemCode;
                    details[j].Buy_price   = presDetailList[j].Buy_Price;
                    details[j].ComplexId   = presDetailList[j].CaseID;
                    details[j].DetailId    = presDetailList[j].PresOrderID;
                    details[j].ItemId      = presDetailList[j].ItemID;
                    details[j].Itemname    = presDetailList[j].ItemName;
                    details[j].ItemType    = presDetailList[j].ItemType;
                    details[j].Order_Flag  = presDetailList[j].Order_Flag;
                    details[j].PassId      = presDetailList[j].PassID;
                    details[j].PresAmount  = presDetailList[j].PresAmount;
                    details[j].PresctionId = presDetailList[j].PresMasterID;
                    details[j].RelationNum = presDetailList[j].RelationNum;
                    details[j].Sell_price  = presDetailList[j].Sell_Price;
                    details[j].Standard    = presDetailList[j].Standard;
                    details[j].Tolal_Fee   = presDetailList[j].Tolal_Fee;
                    details[j].Unit        = presDetailList[j].Unit;
                    details[j].Drug_Flag   = prescriptions[i].Drug_Flag;
                    #endregion
                }
                prescriptions[i].PresDetails = details;
            }

            return(prescriptions);
        }
コード例 #3
0
ファイル: OutPatient.cs プロジェクト: yendux/BlueCloudHIS1.2
        /// <summary>
        /// 根据发票号获取处方
        /// </summary>
        /// <returns>处方信息</returns>
        public Prescription[] GetPrescriptionByInvoiceSerialNo(string InvoiceSerialNo)
        {
            string condiction = "";

            condiction = " PatListID = " + this.PatListID + " AND Charge_Flag = 1 AND Record_Flag = 0 And TicketNum='" + InvoiceSerialNo + "' and hand_flag=" + (int)OPDOperationType.门诊收费;
            condiction = condiction + " order by presmasterid";

            //得到实体列表
            List <HIS.Model.MZ_PresMaster> presMastList = MSAccessDb.GetListArray <MZ_PresMaster>("MZ_PRESMASTER", condiction);

            if (presMastList.Count == 0)
            {
                throw new Exception("找不到发票信息!\r\n1、请确认发票号是否正确。\r\n2、请确认该发票是否已退费。");
            }
            if (presMastList.Count > 1)
            {
                //判断发票里是否有药品
                foreach (MZ_PresMaster mz_presmaster in presMastList)
                {
                    if (mz_presmaster.Drug_Flag == 1)
                    {
                        throw new Exception("该发票内有药品并且还未退药,要退费请先进行退药操作!");
                    }
                }
            }
            else
            {
                if (presMastList[0].Drug_Flag == 1)
                {
                    throw new Exception("该发票已经发药,要退费请先进行退药操作!");
                }
            }

            //定义返回的处方
            Prescription[] prescriptions = new Prescription[presMastList.Count];
            for (int i = 0; i < presMastList.Count; i++)
            {
                #region 读取处方头
                prescriptions[i].Charge_Flag    = presMastList[i].Charge_Flag;
                prescriptions[i].ChargeCode     = presMastList[i].ChargeCode;
                prescriptions[i].ChargeID       = presMastList[i].CostMasterID;
                prescriptions[i].Drug_Flag      = presMastList[i].Drug_Flag;
                prescriptions[i].ExecDeptCode   = presMastList[i].ExecDeptCode;
                prescriptions[i].ExecDocCode    = presMastList[i].ExecDocCode;
                prescriptions[i].OldPresID      = presMastList[i].OldID;
                prescriptions[i].PresCostCode   = presMastList[i].PresCostCode;
                prescriptions[i].PrescriptionID = presMastList[i].PresMasterID;
                prescriptions[i].PrescType      = presMastList[i].PresType;
                prescriptions[i].PresDeptCode   = presMastList[i].PresDocCode;
                prescriptions[i].PresDocCode    = presMastList[i].PresDocCode;
                prescriptions[i].Record_Flag    = presMastList[i].Record_Flag;
                prescriptions[i].TicketCode     = presMastList[i].TicketCode;
                prescriptions[i].TicketNum      = presMastList[i].TicketNum;
                prescriptions[i].Total_Fee      = presMastList[i].Total_Fee;
                #endregion
                //HIS.DAL.MZ_PresOrder mz_presorder = new HIS.DAL.MZ_PresOrder( );
                //mz_presorder._oleDB = oleDb;
                List <HIS.Model.MZ_PresOrder> presDetailList = MSAccessDb.GetListArray <MZ_PresOrder>("MZ_PRESORDER", " PresMasterID = " + presMastList[i].PresMasterID + " order by order_flag");
                //写明细
                PrescriptionDetail[] details = new PrescriptionDetail[presDetailList.Count];
                for (int j = 0; j < presDetailList.Count; j++)
                {
                    #region 明细
                    details[j].Amount      = presDetailList[j].Amount;
                    details[j].BigitemCode = presDetailList[j].BigItemCode;
                    details[j].Buy_price   = presDetailList[j].Buy_Price;
                    details[j].ComplexId   = presDetailList[j].CaseID;
                    details[j].DetailId    = presDetailList[j].PresOrderID;
                    details[j].ItemId      = presDetailList[j].ItemID;
                    details[j].Itemname    = presDetailList[j].ItemName;
                    details[j].ItemType    = presDetailList[j].ItemType;
                    details[j].Order_Flag  = presDetailList[j].Order_Flag;
                    details[j].PassId      = presDetailList[j].PassID;
                    details[j].PresAmount  = presDetailList[j].PresAmount;
                    details[j].PresctionId = presDetailList[j].PresMasterID;
                    details[j].RelationNum = presDetailList[j].RelationNum;
                    details[j].Sell_price  = presDetailList[j].Sell_Price;
                    details[j].Standard    = presDetailList[j].Standard;
                    details[j].Tolal_Fee   = presDetailList[j].Tolal_Fee;
                    details[j].Unit        = presDetailList[j].Unit;
                    #endregion
                }
                prescriptions[i].PresDetails = details;
            }

            return(prescriptions);
        }
コード例 #4
0
ファイル: FrmUnCharge.cs プロジェクト: yendux/BlueCloudHIS1.2
        /// <summary>
        /// 得到录入退费数量后的新处方
        /// </summary>
        /// <returns></returns>
        private Prescription[] GetPrescriptionRemanentFromGrid(bool allPrescription)
        {
            bool noreturnValue = true; //没有退数量

            int prescCount = 0;

            prescCount = GetPrescriptionNumber( );

            int currentRow = 0;

            Prescription[] prescriptions = new Prescription[prescCount];

            #region 得到处方,如果是没有选择的处方
            int start, end, subRow;  //定义处方的开始行,结束行和小计行
            int presIndex = 0;
            for (presIndex = 0; presIndex < prescCount; presIndex++)
            {
                prescriptions[presIndex] = new Prescription( );
                //处方头
                prescriptions[presIndex].PatientID    = currentPatient.PatID;
                prescriptions[presIndex].RegisterID   = currentPatient.PatListID;
                prescriptions[presIndex].PresCostCode = _EmployeeID.ToString( );
                prescriptions[presIndex].PresDeptCode = currentPatient.CureDeptCode;
                prescriptions[presIndex].PresDocCode  = currentPatient.CureEmpCode;
                prescriptions[presIndex].Record_Flag  = 0;
                prescriptions[presIndex].Charge_Flag  = 0;
                prescriptions[presIndex].Drug_Flag    = 0;
                prescriptions[presIndex].Total_Fee    = 0;
                prescriptions[presIndex].PresDate     = DateTime.Now;

                GetPrescriptionStartRowAndEndRow(currentRow, out start, out end, out subRow);
                if (!allPrescription)
                {
                    if (Convert.ToInt32(dgvPresc["Selected", start].Value) == 0)
                    {
                        prescriptions[presIndex].PresDetails = null;
                        currentRow = subRow + 1;
                        continue;
                    }
                }
                prescriptions[presIndex].PresDetails = new PrescriptionDetail[end - start + 1];
                int detailIndex = 0;
                for (int i = start; i <= end; i++)
                {
                    if (dgvPresc["Selected", start].Value == null || Convert.ToBoolean(dgvPresc["Selected", start].Value) == false)
                    {
                        prescriptions[presIndex].PresDetails = null;
                        break;
                    }
                    int drug_flag = Convert.ToInt32(dgvPresc["DRUG_FLAG", i].Value);
                    prescriptions[presIndex].Drug_Flag = drug_flag;//***发药标志

                    prescriptions[presIndex].PrescriptionID = Convert.ToInt32(dgvPresc["PrescID", i].Value);
                    prescriptions[presIndex].ExecDeptCode   = dgvPresc["EXEC_DEPT", i].Tag.ToString( );//处方头记录执行科室
                    #region prescription.PrescType
                    switch (dgvPresc["STATITEM_CODE", i].Value.ToString( ).Trim( ))
                    {
                    case "01":
                        prescriptions[presIndex].PrescType = "1";
                        break;

                    case "02":
                        prescriptions[presIndex].PrescType = "2";
                        break;

                    case "03":
                        prescriptions[presIndex].PrescType = "3";
                        break;

                    default:
                        prescriptions[presIndex].PrescType = "-1";
                        break;
                    }
                    #endregion
                    prescriptions[presIndex].PresDetails[detailIndex].PresctionId = prescriptions[presIndex].PrescriptionID;

                    int packNumOld = Convert.ToInt32(dgvPresc["PACK_NUM", i].Value);
                    int baseNumOld = Convert.ToInt32(dgvPresc["BASE_NUM", i].Value);
                    int packNumRet = Convert.ToInt32(dgvPresc["ReturnPackNum", i].Value);
                    int baseNumRet = Convert.ToInt32(dgvPresc["ReturnBaseNum", i].Value);
                    if (packNumRet > 0 || baseNumRet > 0)
                    {
                        noreturnValue = false;
                    }
                    int     packNum     = packNumOld - packNumRet; //现 = 原 - 退
                    int     baseNum     = baseNumOld - baseNumRet;
                    decimal relationNum = Convert.ToDecimal(dgvPresc["HJXS", i].Value);
                    int     amountNum   = Convert.ToInt32(dgvPresc["PresAmount", i].Value);
                    decimal sumNum      = Convert.ToDecimal(packNum * relationNum + baseNum);
                    prescriptions[presIndex].PresDetails[detailIndex].Amount      = sumNum;
                    prescriptions[presIndex].PresDetails[detailIndex].BigitemCode = dgvPresc["STATITEM_CODE", i].Value.ToString( );
                    prescriptions[presIndex].PresDetails[detailIndex].Buy_price   = Convert.ToDecimal(dgvPresc["Price", i].Value);
                    prescriptions[presIndex].PresDetails[detailIndex].ComplexId   = Convert.ToInt32(dgvPresc["Complex_Id", i].Value);
                    prescriptions[presIndex].PresDetails[detailIndex].DetailId    = Convert.ToInt32(dgvPresc["DetailID", i].Value);
                    prescriptions[presIndex].PresDetails[detailIndex].ItemId      = Convert.ToInt32(dgvPresc["Item_ID", i].Value);
                    prescriptions[presIndex].PresDetails[detailIndex].Itemname    = dgvPresc["Item_Name", i].Value.ToString( );
                    #region prescription.PresDetails[detailIndex].ItemType
                    switch (dgvPresc["STATITEM_CODE", i].Value.ToString( ).Trim( ))
                    {
                    case "01":
                        prescriptions[presIndex].PresDetails[detailIndex].ItemType = "01";
                        break;

                    case "02":
                        prescriptions[presIndex].PresDetails[detailIndex].ItemType = "02";
                        break;

                    case "03":
                        prescriptions[presIndex].PresDetails[detailIndex].ItemType = "03";
                        break;

                    default:
                        prescriptions[presIndex].PresDetails[detailIndex].ItemType = "00";
                        break;
                    }
                    #endregion
                    prescriptions[presIndex].PresDetails[detailIndex].Order_Flag  = detailIndex + 1;
                    prescriptions[presIndex].PresDetails[detailIndex].PresAmount  = Convert.ToInt32(dgvPresc["PresAmount", i].Value);
                    prescriptions[presIndex].PresDetails[detailIndex].RelationNum = Convert.ToDecimal(dgvPresc["HJXS", i].Value);
                    prescriptions[presIndex].PresDetails[detailIndex].Sell_price  = Convert.ToDecimal(dgvPresc["Price", i].Value);
                    prescriptions[presIndex].PresDetails[detailIndex].Standard    = dgvPresc["Standard", i].Value.ToString( );
                    prescriptions[presIndex].PresDetails[detailIndex].Tolal_Fee   = Convert.ToDecimal(dgvPresc["TotalCost", i].Value);
                    prescriptions[presIndex].PresDetails[detailIndex].Unit        = dgvPresc["Pack_Unit", i].Value.ToString( );
                    if (Convert.ToInt16(dgvPresc["Modified", i].Value) == 1)
                    {
                        prescriptions[presIndex].PresDetails[detailIndex].Modified = true;
                        prescriptions[presIndex].Modified = true;
                    }
                    else
                    {
                        prescriptions[presIndex].PresDetails[detailIndex].Modified = false;
                    }
                    prescriptions[presIndex].Total_Fee += prescriptions[presIndex].PresDetails[detailIndex].Tolal_Fee;
                    detailIndex++;
                }

                currentRow = subRow + 1;
            }
            #endregion
            if (noreturnValue)
            {
                return(null);
            }
            else
            {
                return(prescriptions);
            }
        }