public List <PrescriptionDetail> GetPrescriptionDetails(string cardNo, string startDate, string endDate)
        {
            string    sqlMzhj = $"select * from (select 发票流水号,日期,卡号,病人姓名,科室ID,医师,YF_ID,名称,单位,数量,用法,用量 from 划价临时库 where 材质分类 in ('西药','中成药','中草药','中药颗粒','中药饮片') and 科室ID<>0 and 发票流水号<>'-1' union select 发票流水号,日期,卡号,病人姓名,科室ID,医师,YF_ID,名称,单位,数量,用法,用量 from 划价流水帐 where 材质分类 in ('西药','中成药','中草药','中药颗粒','中药饮片') and 科室ID<>0 and 发票流水号<>'-1') as Mzhj where 卡号='{cardNo}' and 日期 between '{startDate}' and '{endDate}'";
            DataTable dtMzhj  = SqlCommon.ExecuteSqlToDataSet(SqlCommon.GetConnectionStringFromConnectionStrings("HisConnectionString"), sqlMzhj).Tables[0];

            List <PrescriptionDetail> prescriptionDetails = new List <PrescriptionDetail>();


            if (dtMzhj != null && dtMzhj.Rows.Count > 0)
            {
                for (int i = 0; i < dtMzhj.Rows.Count; i++)
                {
                    PrescriptionDetail prescriptionDetail = new PrescriptionDetail
                    {
                        MedicineNO    = dtMzhj.Rows[i]["YF_ID"].ToString(),
                        MedicineName  = dtMzhj.Rows[i]["名称"].ToString(),
                        MedicineCount = Convert.ToDouble(dtMzhj.Rows[i]["数量"]).ToString("0.00"),
                        MedicineUnit  = dtMzhj.Rows[i]["单位"].ToString(),
                        Usage         = dtMzhj.Rows[i]["用法"].ToString() + dtMzhj.Rows[i]["用量"].ToString(),
                    };
                    prescriptionDetails.Add(prescriptionDetail);
                }
            }

            return(prescriptionDetails);
        }
        public async Task <IActionResult> PutPrescriptionDetail(int id, PrescriptionDetail prescriptionDetail)
        {
            if (id != prescriptionDetail.PrescriptionDetailId)
            {
                return(BadRequest());
            }

            _context.Entry(prescriptionDetail).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PrescriptionDetailExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemplo n.º 3
0
        private void buttonPrescpitionDelete_Click(object sender, EventArgs e)
        {
            if (dataViewPrescription.SelectedRows.Count > 0)
            {
                int          prescriptionID = Convert.ToInt32(dataViewPrescription.SelectedRows[0].Cells[0].Value);
                DialogResult dialogResult   = MessageBox.Show("Xác nhận xóa toa thuốc", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (dialogResult == DialogResult.Yes)
                {
                    try
                    {
                        if (PrescriptionDetail.DeletePrescriptionDetail(prescriptionID) > 0 && Prescription.DeletePrescription(prescriptionID) > 0)
                        {
                            MessageBox.Show("Xóa toa thuốc thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    catch
                    {
                        MessageBox.Show("Lỗi dữ liệu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }

                refreshDataViewPrescription();
                refreshDataViewPrescriptionDetail();
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 计算处方金额
        /// </summary>
        /// <returns></returns>
        private decimal CalcutePrescriptionCost(int currentRowIndex)
        {
            int start, end, subRow;

            GetPrescriptionStartRowAndEndRow(currentRowIndex, out start, out end, out subRow);
            if (dgvPresc["NO1", end].Tag != null && dgvPresc["NO1", end].Tag.ToString( ) == "1")
            {
                end = end - 1;
            }
            decimal            subTotal  = 0;
            List <IPresDetail> lstDetail = new List <IPresDetail>();

            for (int i = start; i <= end; i++)
            {
                if (dgvPresc["TotalCost", i].Value != null)
                {
                    PrescriptionDetail detail = new PrescriptionDetail();
                    detail.BigitemCode = dgvPresc[STATITEM_CODE.Name, i].Value.ToString().Trim();
                    detail.Tolal_Fee   = Convert.ToDecimal(dgvPresc[TotalCost.Name, i].Value);
                    lstDetail.Add(detail);
                }
            }

            subTotal = (new PrescMoneyCalculate()).GetPrescriptionTotalMoney(lstDetail);
            return(subTotal);
        }
Exemplo n.º 5
0
 /* public List<ePrescriptionDetail> getAllPrescriptionDetail()
  * {
  *   List<ePrescriptionDetail> ls = new List<ePrescriptionDetail>();
  *   foreach (PrescriptionDetail record in presdal.getAllPrescriptionDetail())
  *   {
  *       ePrescriptionDetail temp = new ePrescriptionDetail();
  *       temp.Day = record.Day;
  *       temp.Description = record.Description;
  *       temp.Dosage = record.Dosage;
  *       temp.DrugID = record.DrugID;
  *       temp.ExaminationResultID = record.ExaminationResultID;
  *       temp.PrescriptionDetailID = record.PrescriptionDetailID;
  *       temp.Price =Convert.ToDouble( record.Price);
  *       temp.Quantity = record.Quantity;
  *       temp.Usage = record.Usage;
  *
  *       ls.Add(temp);
  *   }
  *   return ls;
  * }
  */
 public bool insertPrescriptionDetail(List <ePrescriptionDetail> e)
 {
     try
     {
         foreach (ePrescriptionDetail i in e)
         {
             PrescriptionDetail temp = new PrescriptionDetail();
             temp.Day                  = i.Day;
             temp.Description          = i.Description;
             temp.Dosage               = i.Dosage;
             temp.DrugID               = i.DrugID;
             temp.ExaminationResultID  = i.ExaminationResultID;
             temp.PrescriptionDetailID = i.PrescriptionDetailID;
             temp.Price                = drugdal.getOneDrug(i.DrugID).Price;
             temp.Quantity             = i.Quantity;
             temp.Usage                = i.Usage;
             presdal.insertPrescriptionDetail(temp);
         }
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Exemplo n.º 6
0
        protected void UpdateButton_Click(object sender, EventArgs e)
        {
            if (IsValid)
            {
                System.Threading.Thread.Sleep(3000);
                var editedRowIndex = PrescriptionDetailList.EditIndex;
                var lblId          = PrescriptionDetailList.Rows[editedRowIndex].FindControl("EditId") as Label;
                var txtbPID        = PrescriptionDetailList.Rows[editedRowIndex].FindControl("EditPID") as TextBox;
                var txtbDName      = PrescriptionDetailList.Rows[editedRowIndex].FindControl("EditDName") as TextBox;
                var txtbQuantity   = PrescriptionDetailList.Rows[editedRowIndex].FindControl("EditQuantity") as TextBox;
                var txtbDPD        = PrescriptionDetailList.Rows[editedRowIndex].FindControl("EditDPD") as TextBox;
                var txtDescription = PrescriptionDetailList.Rows[editedRowIndex].FindControl("EditInstruction") as TextBox;

                var id          = long.Parse(lblId.Text);
                var pid         = long.Parse(txtbPID.Text);
                var drug        = GetDrugID(txtbDName.Text)[0];
                var quantity    = Convert.ToInt32(txtbQuantity.Text);
                var dpd         = Convert.ToInt32(txtbDPD.Text);
                var instruction = txtDescription.Text;

                var prescriptionDetails = new PrescriptionDetail()
                {
                    prescriptionDetailId = id, prescriptionId = pid, drugId = drug, quantity = quantity, dosePerDay = dpd, specialInstruction = instruction
                };
                _dataContext.PrescriptionDetails.Attach(prescriptionDetails);
                _dataContext.Refresh(RefreshMode.KeepCurrentValues, prescriptionDetails);
                _dataContext.SubmitChanges();
                PrescriptionDetailList.EditIndex = -1;

                //Use For Debug passed value
                //Debug.WriteLine("id: " + id);
                //Debug.WriteLine("DName: " + doctorId);
                //Debug.WriteLine("Date: " + date);
            }
        }
Exemplo n.º 7
0
        public IActionResult Put([FromODataUri] Guid key, PrescriptionDetail prescriptiondetail)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            using (var trans = context.Database.BeginTransaction())
            {
                try
                {
                    if (context.PrescriptionDetails.Find(key) == null)
                    {
                        return(NotFound());
                    }
                    //context = new ApplicationDbContext(context.Options);
                    var local = context.PrescriptionDetails.Local.FirstOrDefault(it => it.PrescriptionDetailID.Equals(key));
                    if (local != null)
                    {
                        context.Entry(local).State = EntityState.Detached;
                    }


                    context.Entry(prescriptiondetail).State = EntityState.Modified;
                    context.SaveChanges();
                    trans.Commit();
                    return(Ok(prescriptiondetail));
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    return(BadRequest(ex));
                }
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// 按发票获取退药明细列表
        /// </summary>
        /// <param name="InvoiceNum">发票号</param>
        /// <returns></returns>
        public List <HIS.Interface.Structs.PrescriptionDetail> GetReturnDrugList(string InvoiceNum)
        {
            try
            {
                string strWhere = "";
                strWhere += BLL.Tables.yf_drorder.INVOICENUM + oleDb.EuqalTo() + InvoiceNum
                            + oleDb.And() + BLL.Tables.yf_drorder.DRUGOC_FLAG + oleDb.EuqalTo() + 0;
                List <YP_DROrder> orderList = BindEntity <HIS.Model.YP_DROrder> .CreateInstanceDAL(oleDb,
                                                                                                   BLL.Tables.YF_DRORDER).GetListArray(strWhere);

                List <PrescriptionDetail> presOrderList = new List <PrescriptionDetail>();
                foreach (YP_DROrder order in orderList)
                {
                    PrescriptionDetail presOrder = new PrescriptionDetail();
                    presOrder.Amount      = order.DrugOCNum;
                    presOrder.Buy_price   = order.TradePrice;
                    presOrder.DetailId    = order.OrderRecipeID;
                    presOrder.ItemId      = order.MakerDicID;
                    presOrder.Tolal_Fee   = order.RetailFee;
                    presOrder.Sell_price  = order.RetailPrice;
                    presOrder.RelationNum = order.UnitNum;
                    presOrderList.Add(presOrder);
                }
                return(presOrderList);
            }
            catch (Exception error)
            {
                throw error;
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// 得到冲正的处方
        /// </summary>
        /// <param name="orgPrescriptionId">被冲处方的ID</param>
        /// <returns></returns>
        private Prescription GetDisChargePrescription(int orgPrescriptionId)
        {
            Prescription _prescription = new Prescription();

            #region ...
            HIS.Model.MZ_PresMaster model_mz_presmaster = new HIS.Model.MZ_PresMaster();
            //红冲的处方头
            model_mz_presmaster = HIS.SYSTEM.Core.BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).GetModel("OLDID=" + orgPrescriptionId);

            if (model_mz_presmaster == null)
            {
                throw new OperatorException("没有找到冲正的处方记录!");
            }
            _prescription.Charge_Flag    = model_mz_presmaster.Charge_Flag;
            _prescription.ChargeCode     = model_mz_presmaster.ChargeCode;
            _prescription.ChargeID       = model_mz_presmaster.CostMasterID;
            _prescription.Drug_Flag      = model_mz_presmaster.Drug_Flag;
            _prescription.ExecDeptCode   = model_mz_presmaster.ExecDeptCode;
            _prescription.ExecDocCode    = model_mz_presmaster.ExecDocCode;
            _prescription.OldPresID      = model_mz_presmaster.OldID;
            _prescription.PresCostCode   = model_mz_presmaster.PresCostCode;
            _prescription.PrescriptionID = model_mz_presmaster.PresMasterID;
            _prescription.PrescType      = model_mz_presmaster.PresType;
            _prescription.PresDeptCode   = model_mz_presmaster.PresDocCode;
            _prescription.PresDocCode    = model_mz_presmaster.PresDocCode;
            _prescription.Record_Flag    = model_mz_presmaster.Record_Flag;
            _prescription.TicketCode     = model_mz_presmaster.TicketCode;
            _prescription.TicketNum      = model_mz_presmaster.TicketNum;
            _prescription.Total_Fee      = model_mz_presmaster.Total_Fee;

            List <HIS.Model.MZ_PresOrder> orders = HIS.SYSTEM.Core.BindEntity <Model.MZ_PresOrder> .CreateInstanceDAL(oleDb).GetListArray("PresmasterID=" + model_mz_presmaster.PresMasterID);

            PrescriptionDetail[] details = new PrescriptionDetail[orders.Count];
            for (int j = 0; j < orders.Count; j++)
            {
                #region 明细
                details[j].Amount      = orders[j].Amount;
                details[j].BigitemCode = orders[j].BigItemCode;
                details[j].Buy_price   = orders[j].Buy_Price;
                details[j].ComplexId   = orders[j].CaseID;
                details[j].DetailId    = orders[j].PresOrderID;
                details[j].ItemId      = orders[j].ItemID;
                details[j].Itemname    = orders[j].ItemName;
                details[j].ItemType    = orders[j].ItemType;
                details[j].Order_Flag  = orders[j].Order_Flag;
                details[j].PassId      = orders[j].PassID;
                details[j].PresAmount  = orders[j].PresAmount;
                details[j].PresctionId = orders[j].PresMasterID;
                details[j].RelationNum = orders[j].RelationNum;
                details[j].Sell_price  = orders[j].Sell_Price;
                details[j].Standard    = orders[j].Standard;
                details[j].Tolal_Fee   = orders[j].Tolal_Fee;
                details[j].Unit        = orders[j].Unit;
                #endregion
            }
            _prescription.PresDetails = details;
            #endregion
            return(_prescription);
        }
Exemplo n.º 10
0
        public bool Add(PrescriptionDetail model)
        {
            string query = "INSERT INTO PrescriptionDetail " +
                           "values(@PrescriptionId,@DrugId,@Quantity,@Morning,@Noon,@Afternoon,@Evening,@IsLunch,@ToUse)";

            SqlParameter[] sqlParameters = new SqlParameter[9];
            sqlParameters[0] = new SqlParameter("@PrescriptionId", SqlDbType.Int)
            {
                Value = model.PrescriptionId
            };
            sqlParameters[1] = new SqlParameter("@DrugId", SqlDbType.Int)
            {
                Value = model.DrugId
            };
            sqlParameters[2] = new SqlParameter("@Quantity", SqlDbType.Int)
            {
                Value = model.Quantity
            };
            sqlParameters[3] = new SqlParameter("@Morning", SqlDbType.Int)
            {
                Value = model.Morning
            };
            sqlParameters[4] = new SqlParameter("@Noon", SqlDbType.Int)
            {
                Value = model.Noon
            };
            sqlParameters[5] = new SqlParameter("@Afternoon", SqlDbType.Int)
            {
                Value = model.Afternoon
            };
            sqlParameters[6] = new SqlParameter("@Evening", SqlDbType.Int)
            {
                Value = model.Evening
            };
            sqlParameters[7] = new SqlParameter("@IsLunch", SqlDbType.Bit)
            {
                Value = model.IsLunch
            };
            sqlParameters[8] = new SqlParameter("@ToUse", SqlDbType.NVarChar)
            {
                Value = model.ToUse
            };

            try
            {
                conn.ExecuteInsertQuery(query, sqlParameters);
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 11
0
 public bool insertPrescriptionDetail(PrescriptionDetail e)
 {
     try
     {
         presdal.insertPrescription(e);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Exemplo n.º 12
0
        //Reload dateViewPrescriptionDetail
        private void dataViewPrescription_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dataViewPrescription.SelectedRows.Count > 0)
            {
                // Get PrescriptionDetail's datatable
                int       prescriptionID          = Convert.ToInt32(dataViewPrescription.SelectedRows[0].Cells[0].Value);
                DataTable prescriptionDetailTable = PrescriptionDetail.GetListPrescriptionDetail(prescriptionID);

                // Set data source to dataview for searching
                dataViewPrescriptionDetail.DataSource = prescriptionDetailTable;
            }
        }
        public void updatePrescriptionDetail(PrescriptionDetail PrescriptionDetail)
        {
            var record = db.PrescriptionDetails.Where(x => x.PrescriptionDetailID == PrescriptionDetail.PrescriptionDetailID).FirstOrDefault();

            record.ExaminationResultID = PrescriptionDetail.ExaminationResultID;
            record.DrugID      = PrescriptionDetail.DrugID;
            record.Day         = PrescriptionDetail.Day;
            record.Description = PrescriptionDetail.Description;
            record.Quantity    = PrescriptionDetail.Quantity;
            record.Dosage      = PrescriptionDetail.Dosage;
            record.Usage       = PrescriptionDetail.Usage;
            record.Price       = PrescriptionDetail.Price;
            db.SubmitChanges();
        }
Exemplo n.º 14
0
 private void buttonOk_Click(object sender, EventArgs e)
 {
     try
     {
         Prescription newPrescription = new Prescription();
         newPrescription.Date      = dateCreate.Value;
         newPrescription.PatientID = int.Parse(textBoxPatientID.Text);
         newPrescription.StaffID   = int.Parse(textBoxStaffID.Text);
         if (this.UserAction == "edit")
         {
             newPrescription.PrescriptionID = Convert.ToInt32(textBoxPrescriptionID.Text);
             DialogResult dialogResult = MessageBox.Show("Xác nhận cập nhập thông tin toa thuốc", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
             if (dialogResult == DialogResult.OK)
             {
                 if (Prescription.UpdatePrescription(newPrescription) > 0)
                 {
                     PrescriptionDetail.DeletePrescriptionDetail(newPrescription.PrescriptionID);
                     for (int i = 0; i < listDP.Count; i++)
                     {
                         PrescriptionDetail newPD = listDP[i];
                         newPD.PrescriptionID = Convert.ToInt32(textBoxPrescriptionID.Text);
                         PrescriptionDetail.InsertPrescriptionDetail(newPD);
                     }
                     listDP.Clear();
                     MessageBox.Show("Cập nhập thông tin toa thuốc thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
             }
         }
         else
         {
             newPrescription.PrescriptionID = 0;
             if (Prescription.InsertPrescription(newPrescription) > 0)
             {
                 int prescriptionID = Prescription.GetPrescriptionInsertedID();
                 for (int i = 0; i < listDP.Count; i++)
                 {
                     listDP[i].PrescriptionID = prescriptionID;
                     PrescriptionDetail.InsertPrescriptionDetail(listDP[i]);
                 }
                 MessageBox.Show("Thêm toa thuốc thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 listDP.Clear();
             }
         }
     }
     catch
     {
         MessageBox.Show("Lỗi dữ liệu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     this.Close();
 }
Exemplo n.º 15
0
        private PrescriptionDetail GetPrescriptionDetailFromDataRow(DataRow row)
        {
            PrescriptionDetail prescriptionDetail = new PrescriptionDetail();

            prescriptionDetail.Id             = int.Parse(row["Id"].ToString());
            prescriptionDetail.IsLunch        = bool.Parse(row["IsLunch"].ToString());
            prescriptionDetail.Morning        = int.Parse(row["Morning"].ToString());
            prescriptionDetail.Noon           = int.Parse(row["Noon"].ToString());
            prescriptionDetail.PrescriptionId = int.Parse(row["PrescriptionId"].ToString());
            prescriptionDetail.Quantity       = int.Parse(row["Quantity"].ToString());
            prescriptionDetail.ToUse          = row["ToUse"].ToString();
            prescriptionDetail.Afternoon      = int.Parse(row["Afternoon"].ToString());
            prescriptionDetail.DrugId         = int.Parse(row["DrugId"].ToString());
            prescriptionDetail.Evening        = int.Parse(row["Evening"].ToString());
            return(prescriptionDetail);
        }
Exemplo n.º 16
0
        /// <summary>
        /// Handles the SelectedIndexChanged event of the cboFigure control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void cboFigure_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (_isSkipUpdatingFigure)
            {
                return;
            }

            var removeList = _prescriptionDetailList.Where(x => x.FigureDetailId != null).ToList();

            foreach (var item in removeList)
            {
                _prescriptionDetailList.Remove(item);
            }


            var comboboxEx    = (ComboBoxEx)sender;
            var figureId      = (int)comboboxEx.SelectedValue;
            var figureDetails = this._figureDetailRepo.GetByFigure(figureId);

            foreach (var figureDetail in figureDetails)
            {
                var prescriptionDetail = new PrescriptionDetail()
                {
                    FigureDetailId = figureDetail.Id,
                    MedicineId     = figureDetail.MedicineId,
                    //Medicine = figureDetail.Medicine,
                    VolumnPerDay = figureDetail.Volumn,
                    Day          = this.Day,
                    Amount       = DefaultVolumn * figureDetail.Volumn,
                    Version      = 0
                };
                try
                {
                    prescriptionDetail.InventoryVolumn = _medicineRepo.GetInventoryVolumeWareHouseByMedicineId(AppContext.CurrentClinic.Id, prescriptionDetail.MedicineId);
                }
                catch (Exception ex)
                {
                    prescriptionDetail.InventoryVolumn = 0;
                }
                _prescriptionDetailList.Insert(0, prescriptionDetail);
            }

            this.bdsPrescriptionDetail.DataSource = _prescriptionDetailList;
            // this.bdsPrescriptionDetail.EndEdit();
            ReupdateNo();
        }
Exemplo n.º 17
0
        /// <summary>
        /// 计算指定行处的处方的总金额
        /// </summary>
        /// <param name="rowIndex"></param>
        private decimal _calculatePrescriptionFee(int rowIndex)
        {
            DataTable tbPresc = (DataTable)formView.Prescriptions;

            if (tbPresc.Rows.Count == 0)
            {
                return(0);
            }
            int start, end, subRowTotal;

            GetPrescriptionSectionStartRow(rowIndex, out start, out end, out subRowTotal);

            //计算当前处方金额
            List <PrescriptionDetail> details = new List <PrescriptionDetail>( );

            for (int i = start; i <= end; i++)
            {
                if (Convert.ToInt32(tbPresc.Rows[i][COL_ITEM_ID]) == 0)
                {
                    continue;
                }
                PrescriptionDetail detail = new PrescriptionDetail( );
                detail.BigitemCode = tbPresc.Rows[i][COL_BIGITEMCODE].ToString( ).Trim( );
                detail.Tolal_Fee   = Convert.ToDecimal(tbPresc.Rows[i][COL_TOTAL_FEE]);
                details.Add(detail);
            }
            Prescription pres = new Prescription( );

            pres.PresDetails = details.ToArray( );
            decimal   roundingMoney;
            Hashtable htBigitemItem;
            //decimal prescTotal = BaseDataController.CalculatePrescriptionTotalFee( pres , out htBigitemItem , out roundingMoney );
            List <IPresDetail> lstDetail = new List <IPresDetail>();

            for (int i = 0; i < pres.PresDetails.Length; i++)
            {
                lstDetail.Add(pres.PresDetails[i]);
            }


            decimal prescTotal = (new PrescMoneyCalculate()).GetPrescriptionTotalMoney(lstDetail, out htBigitemItem, out roundingMoney);

            return(prescTotal);
        }
Exemplo n.º 18
0
        private void refreshDataViewPrescriptionDetail()
        {
            if (dataViewPrescription.SelectedRows.Count > 0)
            {
                try
                {
                    // Get PrescriptionDetail's datatable
                    int       prescriptionID          = Convert.ToInt32(dataViewPrescription.Rows[0].Cells[0].Value);
                    DataTable prescriptionDetailTable = PrescriptionDetail.GetListPrescriptionDetail(prescriptionID);

                    // Set data source to dataview for searching
                    dataViewPrescriptionDetail.DataSource = prescriptionDetailTable.DefaultView;
                }
                catch
                {
                    MessageBox.Show("Lỗi dữ liệu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Exemplo n.º 19
0
 private void buttonInsert_Click(object sender, EventArgs e)
 {
     if (!superValidator1.Validate())
     {
         return;
     }
     if (listMedicine.Count > 0)
     {
         int selectedIndex = comboBoxMedicine.SelectedIndex;
         if (int.Parse(textBoxInputQuantity.Text) > listMedicine[selectedIndex].Quantity)
         {
             MessageBox.Show("Số lượng thuốc không đáp ứng đủ nhu cầu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         else
         {
             PrescriptionDetail newPD = new PrescriptionDetail(listMedicine[selectedIndex].MedicineID, 0, int.Parse(textBoxInputQuantity.Text), textBoxInputInstruction.Text);
             if (DidPrescriptionHaveMedicine(newPD.MedicineID))
             {
                 for (int i = 0; i < listDP.Count; i++)
                 {
                     if (newPD.MedicineID == listDP[i].MedicineID)
                     {
                         listDP[i].Instruction = textBoxInputInstruction.Text;
                         listDP[i].Quantity    = int.Parse(textBoxInputQuantity.Text);
                         listSelectedMedicine_SelectedIndexChanged(sender, e);
                         textBoxInputInstruction.Text = "";
                         textBoxInputQuantity.Text    = "";
                         break;
                     }
                 }
             }
             else
             {
                 listDP.Add(newPD);
                 listSelectedMedicine.Items.Add(listMedicine[selectedIndex].MedicineName);
                 listSelectedMedicine.SelectedIndex = listSelectedMedicine.Items.Count - 1;
                 textBoxInputInstruction.Text       = "";
                 textBoxInputQuantity.Text          = "";
             }
         }
     }
 }
Exemplo n.º 20
0
        /// <summary>
        /// Handles the SelectedIndexChanged event of the cboFigure control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void CboFigureSelectedIndexChanged(object sender, EventArgs e)
        {
            if (_isSkipUpdatingFigure)
            {
                return;
            }

            var removeList = _prescriptionDetailList.Where(x => x.FigureDetailId != null).ToList();

            foreach (var item in removeList)
            {
                _prescriptionDetailList.Remove(item);
            }

            var comboboxEx    = (ComboBoxEx)sender;
            var figureId      = (int)comboboxEx.SelectedValue;
            var figureDetails = this._figureDetailRepo.GetByFigure(figureId);

            foreach (var figureDetail in figureDetails)
            {
                var prescriptionDetail = new PrescriptionDetail()
                {
                    FigureDetailId = figureDetail.Id,
                    MedicineId     = figureDetail.MedicineId,
                    VolumnPerDay   = figureDetail.Volumn,
                    TradeName      = figureDetail.Medicine.TradeName,
                    MedicineName   = figureDetail.Medicine.Name,
                    UnitName       = figureDetail.Medicine.Define.Name,
                    Day            = this.Day,
                    Amount         = DefaultVolumn * figureDetail.Volumn,
                    Version        = 0
                };
                prescriptionDetail.InventoryVolumn = _medicineRepo.GetInventoryVolumeWareHouseByMedicineId(AppContext.CurrentClinic.Id, prescriptionDetail.MedicineId);
                _prescriptionDetailList.Insert(0, prescriptionDetail);
            }

            this.bdsPrescriptionDetail.DataSource = _prescriptionDetailList;
            this.bdsPrescriptionDetail.ResetBindings(false);
            this.dataGridViewX1.Update();
        }
Exemplo n.º 21
0
        //Submit Add Form
        protected void AddPrescriptionDetailButton_Click(object sender, EventArgs e)
        {
            Button btn   = (Button)sender;
            String btnId = btn.ID;

            if (btnId.Equals("AddPrescriptionDetailButton"))
            {
                if (IsValid)
                {
                    System.Threading.Thread.Sleep(3000);
                    var presId = long.Parse(PresIdDropDown.SelectedItem.Text);
                    var drug   = GetDrugID(DrugTextBox.Text)[0];
                    //Rememeber
                    var quantity    = Convert.ToInt32(QuantityTextBox.Text);
                    var dose        = Convert.ToInt32(DPDTextBox.Text);
                    var instruction = InstructionTextBox.Text;

                    var prescriptionDetail = new PrescriptionDetail()
                    {
                        prescriptionId = presId, drugId = drug, quantity = quantity, dosePerDay = dose, specialInstruction = instruction
                    };
                    _dataContext.PrescriptionDetails.InsertOnSubmit(prescriptionDetail);
                    _dataContext.SubmitChanges();
                    PrescriptionDetailList.DataBind();

                    //Use for testing
                    //Debug.WriteLine("presID: " + presId);
                    //Debug.WriteLine("presID: " + drug);
                    //Debug.WriteLine("presID: " + quantity);
                    //Debug.WriteLine("presID: " + dose);
                    //Debug.WriteLine("presID: " + instruction);

                    ResetInputField();
                }
            }
            else if (btnId.Equals("ResetPrescriptionDetailButton"))
            {
                ResetInputField();
            }
        }
Exemplo n.º 22
0
 public bool updatePrescriptionDetail(ePrescriptionDetail e)
 {
     try
     {
         PrescriptionDetail temp = new PrescriptionDetail();
         temp.Day                  = e.Day;
         temp.Description          = e.Description;
         temp.Dosage               = e.Dosage;
         temp.DrugID               = e.DrugID;
         temp.ExaminationResultID  = e.ExaminationResultID;
         temp.PrescriptionDetailID = e.PrescriptionDetailID;
         temp.Price                = Convert.ToDecimal(e.Price);
         temp.Quantity             = e.Quantity;
         temp.Usage                = e.Usage;
         presdal.updatePrescriptionDetail(temp);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Exemplo n.º 23
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            var     presDetail = gridControl1.DataSource as DataTable;
            var     result     = preDetailBusiness.DeteleByPrescriptionID(prescriptionID);
            decimal amount     = 0;

            foreach (DataRow item in presDetail.Rows)
            {
                var preDetail = new PrescriptionDetail
                {
                    HowToUse       = (string)item["HowToUse"],
                    MedicineID     = (int)item["MedicineID"],
                    Quantity       = (int)item["Quantity"],
                    PrescriptionID = prescriptionID,
                    MedicineFee    = medicineBusiness.GetByMedicineID((int)item["MedicineID"]).Price *(int)item["Quantity"]
                };
                result = result && preDetailBusiness.Insert(preDetail) > 0;
                if (!result)
                {
                    break;
                }
                amount += preDetail.MedicineFee;
            }

            var prescription = prescriptionBusiness.GetByPrescriptionID(prescriptionID);

            prescription.Amount = amount;
            result = result && prescriptionBusiness.Update(prescription);

            if (result)
            {
                XtraMessageBox.Show(this, "Lưu thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                XtraMessageBox.Show(this, "Có lỗi trong quá trình lưu", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 24
0
        /// <summary>
        /// 通过发票号获取退药列表
        /// </summary>
        /// <param name="InvoiceNum"></param>
        /// <returns></returns>
        public static List <PrescriptionDetail> GetDrugReturnValueList(string InvoiceNum)
        {
            HIS.Interface.YP_Data yp_data = new HIS.Interface.YP_Data( );
            List <HIS.Interface.Structs.PrescriptionDetail> lstYP    = yp_data.GetReturnDrugList(InvoiceNum);
            List <HIS.Interface.Structs.PrescriptionDetail> lstRetYP = new List <PrescriptionDetail>( );

            foreach (HIS.Interface.Structs.PrescriptionDetail detail in lstYP)
            {
                PrescriptionDetail _detail = new PrescriptionDetail( );
                _detail.DetailId    = detail.DetailId;
                _detail.Amount      = detail.Amount;
                _detail.BigitemCode = detail.BigitemCode;
                _detail.Buy_price   = detail.Buy_price;
                _detail.ItemId      = detail.ItemId;
                _detail.PresctionId = detail.PresctionId;
                _detail.RelationNum = detail.RelationNum;
                _detail.Sell_price  = detail.Sell_price;
                _detail.Tolal_Fee   = detail.Tolal_Fee;

                lstRetYP.Add(_detail);
            }
            return(lstRetYP);
        }
Exemplo n.º 25
0
        public IActionResult Post(PrescriptionDetail prescriptiondetail)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            using (var trans = context.Database.BeginTransaction())
            {
                try
                {
                    context.PrescriptionDetails.Add(prescriptiondetail);
                    context.SaveChanges();
                    trans.Commit();
                    return(Ok(prescriptiondetail));
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    return(BadRequest(ex));
                }
            }
        }
Exemplo n.º 26
0
        private void SetPDetailForUpdate(Prescription pDetail)
        {
            textBoxPrescriptionID.Text = pDetail.PrescriptionID.ToString();
            textBoxPatientID.Text      = pDetail.PatientID.ToString();
            textBoxStaffID.Text        = pDetail.StaffID.ToString();
            dateCreate.Value           = pDetail.Date;

            DataTable dtMedicine = Medicine.GetListMedicine();

            for (int i = 0; i < dtMedicine.Rows.Count; i++)
            {
                Medicine newMedicine = Medicine.GetMedicine(Convert.ToInt32(dtMedicine.Rows[i][0]));
                listMedicine.Add(newMedicine);
                comboBoxMedicine.Items.Add(newMedicine.MedicineName);
                comboBoxMedicine.AutoCompleteCustomSource.Add(newMedicine.MedicineName);
            }
            comboBoxMedicine.SelectedIndex = 0;

            DataTable dtPD = PrescriptionDetail.GetListPrescriptionDetail(pDetail.PrescriptionID);

            for (int i = 0; i < dtPD.Rows.Count; i++)
            {
                PrescriptionDetail newDP = new PrescriptionDetail();
                newDP.PrescriptionID = Convert.ToInt32(dtPD.Rows[i][0]);
                newDP.MedicineID     = Convert.ToInt32(dtPD.Rows[i][1]);
                newDP.Quantity       = Convert.ToInt16(dtPD.Rows[i][2]);
                newDP.Instruction    = dtPD.Rows[i][3].ToString();
                listDP.Add(newDP);
                Medicine newMedicine = Medicine.GetMedicine(newDP.MedicineID);
                listSelectedMedicine.Items.Add(newMedicine.MedicineName);
            }
            if (listSelectedMedicine.Items.Count > 0)
            {
                listSelectedMedicine.SelectedIndex = 0;
            }
        }
Exemplo n.º 27
0
        public PrescriptionDetail UpdatePrescriptionDetail(UpdatePrescriptionDetailCommand command)
        {
            // Cria a instâcia do usuário
            var domain = new PrescriptionDetail(command.Id, command.Dosage, command.Group, command.Posology, command.Information, command.Note, command.PrescriptionId, command.NutraceuticalId);

            // Tenta ações e regras de negócio no domínio
            //domain.Register();

            // Salva as alterações da tabela no contexto do banco de dados
            _repository.UpdatePrescriptionDetail(domain);

            // Chama o commit
            if (Commit())
            {
                // Dispara o evento de usuário registrado
                DomainEvent.Raise(new OnPrescriptionDetailRegisteredEvent(domain));

                // Retorna o usuário
                return(domain);
            }

            // Se não comitou, retorna nulo
            return(null);
        }
Exemplo n.º 28
0
        /// <summary>
        /// Updates the specified prescription.
        /// </summary>
        /// <param name="prescription">The prescription.</param>
        public void Update(Prescription prescription)
        {
            try
            {
                var originalPres = this.Context.Prescription.FirstOrDefault(x => x.Id == prescription.Id);
                if (originalPres == null)
                {
                    throw new Exception("Không tồn tại dữ liệu trong CSDL.");
                }

                var prescriptionList = this.Context.PrescriptionDetails.Where(x => x.PrescriptionId == prescription.Id).ToList();

                originalPres.RecheckDate = prescription.RecheckDate;
                originalPres.Note        = prescription.Note;
                originalPres.DoctorId    = prescription.DoctorId;
                originalPres.Doctor      = null;
                originalPres.FigureId    = prescription.FigureId;
                originalPres.Version++;


                foreach (var orginItem in prescriptionList)
                {
                    var item = prescription.PrescriptionDetails.FirstOrDefault(x => x.Id == orginItem.Id);
                    if (item == null)
                    {
                        this.Context.PrescriptionDetails.Remove(orginItem);
                    }
                    else
                    {
                        orginItem.MedicineId     = item.MedicineId;
                        orginItem.Day            = item.Day;
                        orginItem.Description    = item.Description;
                        orginItem.Amount         = item.Amount;
                        orginItem.FigureDetailId = item.FigureDetailId;
                        orginItem.VolumnPerDay   = item.VolumnPerDay;
                    }
                }

                foreach (var orginItem in prescription.PrescriptionDetails)
                {
                    var item = originalPres.PrescriptionDetails.FirstOrDefault(x => x.Id == orginItem.Id);
                    if (item != null)
                    {
                        continue;
                    }
                    var newItem = new PrescriptionDetail
                    {
                        Amount         = orginItem.Amount,
                        Day            = orginItem.Day,
                        Description    = orginItem.Description,
                        FigureDetailId = orginItem.FigureDetailId,
                        MedicineId     = orginItem.MedicineId,
                        PrescriptionId = orginItem.PrescriptionId,
                        Version        = 0
                    };
                    originalPres.PrescriptionDetails.Add(newItem);
                }

                originalPres.LastUpdatedDate = DateTime.Now;


                this.Context.SaveChanges();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Exemplo n.º 29
0
        /// <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 = BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).GetListArray(condiction);

            if (presMastList.Count == 0)
            {
                throw new Exception("找不到发票信息!\r\n1、请确认发票号是否正确。\r\n2、请确认该发票是否已退费。");
            }
            if (presMastList.Count > 1)
            {
                //判断发票里是否有药品
                foreach (Model.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 = BindEntity <Model.MZ_PresOrder> .CreateInstanceDAL(oleDb).GetListArray(" 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);
        }
Exemplo n.º 30
0
        /// <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;
            }
            condiction += " and docpresid=0 ";
            if (!IsCharge)
            {
                condiction = condiction + " and PRESTYPE in ('0','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 = BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).GetListArray(condiction);

            //定义返回的处方
            Prescription[] prescriptions = new Prescription[presMastList.Count];
            for (int i = 0; i < presMastList.Count; i++)
            {
                #region 读取处方头
                prescriptions[i]                = new Prescription();
                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].PresDeptCode;
                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

                List <HIS.Model.MZ_PresOrder> presDetailList = BindEntity <Model.MZ_PresOrder> .CreateInstanceDAL(oleDb).GetListArray(" 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]             = new PrescriptionDetail();
                    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;
            }

            bool readDocPres = false;
            if (Convert.ToInt32(HIS.MZ_BLL.OPDParamter.Parameters["017"]) == 1)
            {
                readDocPres = true;
            }

            if (readDocPres)
            {
                MZClinicInterface clinicInterface = new MZClinicInterface();
                if (status == PresStatus.未收费)
                {
                    List <Prescription> lstPrescription = new List <Prescription>();
                    for (int i = 0; i < prescriptions.Length; i++)
                    {
                        lstPrescription.Add(prescriptions[i]);
                    }
                    try
                    {
                        //Prescription[] docPrescs = HIS.MZDoc_BLL.OP_Prescription.GetPrescriptions(base.PatListID);
                        HIS.Interface.Structs.Prescription[] docPrescs = clinicInterface.GetPrescriptions(base.PatListID);
                        for (int i = 0; i < docPrescs.Length; i++)
                        {
                            docPrescs[i].Modified       = true;
                            docPrescs[i].DocPresId      = docPrescs[i].PrescriptionID;
                            docPrescs[i].PrescriptionID = 0;
                            for (int j = 0; j < docPrescs[i].PresDetails.Length; j++)
                            {
                                docPrescs[i].PresDetails[j].DocPrescDetailId = docPrescs[i].PresDetails[j].DetailId;
                                docPrescs[i].PresDetails[j].DetailId         = 0;
                            }
                            lstPrescription.Add(docPrescs[i]);
                        }
                    }
                    catch (Exception err)
                    {
                        ErrorWriter.WriteLog(err.Message);
                        throw new Exception("读取医生未收费处方发生错误!");
                    }

                    prescriptions = lstPrescription.ToArray();
                }
            }
            return(prescriptions);
        }