public bool IsDrugStore(Prescription.Controls.Entity.Prescription pres) { if (pres.Item_Id > 0 && pres.IsDrug == true) { string strsql = @"SELECT top 1 ActualQty FROM ViewBaseData_Med WHERE StockID ={0}"; strsql = string.Format(strsql, pres.Item_Id); object ret = oleDb.GetDataResult(strsql); decimal qty = ret == DBNull.Value ? 0 : Convert.ToDecimal(ret); if (pres.Amount > qty) { return(false); } } return(true); }
public List <Prescription.Controls.Entity.Prescription> GetPresTemplateRow(int type, int[] tpldetailIds) { if (tpldetailIds.Length == 0) { return(new List <Prescription.Controls.Entity.Prescription>()); } string strsql = ""; strsql = @"SELECT TOP 100 A.GroupID, A.FeeID,A.FeeName,A.FeeClass, A.Dosage,A.DosageUnit, A.Amount,A.Unit, A.FrequencyID,C.FrequencyName AS FrequencyName,C.ExecuteCode, A.ChannelID,B.CName AS ChannelName, A.Days Num, A.Days,A.Memo ,D.ClinPrice,D.Spec,D.Dosage DoseConvertNum,D.MatClass,D.SkinMethod IsAst FROM Clinic_SetMealDetail A LEFT JOIN Clinic_Channel B ON A.ChannelID = B.ID LEFT JOIN Clinic_Frequency C ON A.FrequencyID = C.ID LEFT JOIN ViewBaseData_Med D ON A.FeeID=D.StockID WHERE A.ID in ({0}) ORDER BY A.GroupID,A.OrderNum" ; strsql = string.Format(strsql, string.Join(",", Array.ConvertAll <int, string>(tpldetailIds, delegate(int v) { return(v.ToString()); }))); DataTable dt = oleDb.GetDataTable(strsql); List <Prescription.Controls.Entity.Prescription> list_Prescription = new List <Prescription.Controls.Entity.Prescription>(); for (int i = 0; i < dt.Rows.Count; i++) { Prescription.Controls.Entity.Prescription mPres = new Prescription.Controls.Entity.Prescription(); mPres.PresListId = 0; mPres.PresHeadId = 0; //mPres.OrderNo = i + 1;//行号 mPres.Item_Id = Convert.ToInt32(dt.Rows[i]["FeeID"]); mPres.Item_Name = dt.Rows[i]["FeeName"].ToString(); mPres.Item_Type = type;//1西药 2中药 3项目材料 mPres.StatItem_Code = ""; mPres.Sell_Price = ConvertDataExtend.ToDecimal(dt.Rows[i]["ClinPrice"], 0); mPres.Buy_Price = ConvertDataExtend.ToDecimal(dt.Rows[i]["ClinPrice"], 0); mPres.Item_Price = ConvertDataExtend.ToDecimal(dt.Rows[i]["ClinPrice"], 0); mPres.Standard = dt.Rows[i]["Spec"].ToString(); mPres.Usage_Amount = Convert.ToDecimal(dt.Rows[i]["Dosage"]); //剂量 mPres.Usage_Unit = dt.Rows[i]["DosageUnit"].ToString(); //剂量单位 mPres.Usage_Rate = ConvertDataExtend.ToDecimal(dt.Rows[i]["DoseConvertNum"], 1); //剂量系数 mPres.Dosage = Convert.ToInt32(dt.Rows[i]["Num"]); //付数 mPres.Usage_Id = Convert.ToInt32(dt.Rows[i]["ChannelID"]); mPres.Frequency_Id = Convert.ToInt32(dt.Rows[i]["FrequencyID"]); mPres.Days = Convert.ToInt32(dt.Rows[i]["Days"]); mPres.Amount = Convert.ToDecimal(dt.Rows[i]["Amount"].ToString()); //发药数量 mPres.Unit = dt.Rows[i]["Unit"].ToString(); //发药单位 mPres.Item_Amount = Convert.ToInt32(Convert.ToDecimal(dt.Rows[i]["Amount"])); //开药数量 mPres.Item_Unit = dt.Rows[i]["Unit"].ToString(); //开药单位 mPres.Item_Rate = 1; //系数 mPres.Group_Id = Convert.ToInt32(dt.Rows[i]["GroupID"]); //分组组号 mPres.SkinTest_Flag = ConvertDataExtend.ToInt32(dt.Rows[i]["IsAst"], 0); //皮试 mPres.SelfDrug_Flag = 0; //自备 mPres.Entrust = dt.Rows[i]["Memo"].ToString(); //嘱托 mPres.FootNote = ""; mPres.Tc_Flag = 0; //套餐 mPres.Usage_Name = dt.Rows[i]["ChannelName"].ToString(); //用法名称 mPres.Frequency_Name = dt.Rows[i]["FrequencyName"].ToString(); //频次名称 mPres.Frequency_Caption = dt.Rows[i]["ExecuteCode"].ToString(); //频次名称 int _execNum, _cycleDay; CardDataSourceFrequency.Calculate(dt.Rows[i]["ExecuteCode"].ToString(), out _execNum, out _cycleDay); mPres.Frequency_ExecNum = _execNum; //执行次数 mPres.Frequency_CycleDay = _cycleDay; //执行周期 mPres.CalculateAmount(null); list_Prescription.Add(mPres); } return(list_Prescription); //throw new NotImplementedException(); }
public List <Prescription.Controls.Entity.Prescription> GetPrescriptionData(int patListId, int presType) { string strsql = @"SELECT b.ID ListID,b.PrescriptionID,b.FeeID,b.FeeName,b.Price,b.Spec,b.Dosage,b.DosageUnit,b.Factor,b.Num,b.ChannelID,b.FrequencyID,b.Days,b.Amount,b.Unit,b.PresAmount,b.PresAmountUnit,b.PresFactor ,b.GroupID,b.IsAst,b.IsTake,b.Memo ,b.ListNO,0 OrderNO,b.IsCharged,b.IsCancel ,c.ChannelName,d.FrequencyName,d.ExecuteCode ,1 RoundingMode ,b.DoctorID,b.DeptCode,'' PresDoctorName,'' PresDeptName FROM Clinic_PrescriptionList a LEFT JOIN Clinic_PrescriptionDetail b ON a.ID=b.PrescriptionID LEFT JOIN Clinic_Channel AS c ON b.ChannelID = c.ID LEFT JOIN Clinic_Frequency AS d ON b.FrequencyID = d.ID WHERE a.PatientID={0} AND a.OrderClass={1} AND b.ID IS NOT NULL ORDER BY b.ListNO,b.GroupID"; strsql = string.Format(strsql, patListId, presType); DataTable dt = oleDb.GetDataTable(strsql); //int _orderNo = 1;//行号 List <Prescription.Controls.Entity.Prescription> list_Prescription = new List <Prescription.Controls.Entity.Prescription>(); for (int i = 0; i < dt.Rows.Count; i++) { Prescription.Controls.Entity.Prescription mPres = new Prescription.Controls.Entity.Prescription(); mPres.PresListId = Convert.ToInt32(dt.Rows[i]["ListID"]); mPres.PresHeadId = Convert.ToInt32(dt.Rows[i]["PrescriptionID"]); //mPres.OrderNo = i + 1;//行号 mPres.Item_Id = Convert.ToInt32(dt.Rows[i]["FeeID"]); mPres.Item_Name = dt.Rows[i]["FeeName"].ToString(); mPres.Item_Type = 1;// Convert.ToInt32(dt.Rows[i]["ItemClass"]);//1西药 2中药 3项目材料 mPres.StatItem_Code = ""; mPres.Sell_Price = Convert.ToDecimal(dt.Rows[i]["Price"]); mPres.Buy_Price = Convert.ToDecimal(dt.Rows[i]["Price"]); mPres.Item_Price = Convert.ToDecimal(dt.Rows[i]["Price"]); mPres.Standard = dt.Rows[i]["Spec"].ToString(); mPres.Usage_Amount = Convert.ToDecimal(dt.Rows[i]["Dosage"]); //剂量 mPres.Usage_Unit = dt.Rows[i]["DosageUnit"].ToString(); //剂量单位 mPres.Usage_Rate = Convert.ToDecimal(dt.Rows[i]["Factor"]); //剂量系数 mPres.Dosage = Convert.ToInt32(dt.Rows[i]["Num"]);; //付数 mPres.Usage_Id = Convert.ToInt32(dt.Rows[i]["ChannelID"]); mPres.Frequency_Id = Convert.ToInt32(dt.Rows[i]["FrequencyID"]); mPres.Days = Convert.ToInt32(dt.Rows[i]["Days"]); mPres.Amount = Convert.ToDecimal(dt.Rows[i]["Amount"].ToString()); //发药数量 mPres.Unit = dt.Rows[i]["Unit"].ToString(); //发药单位 mPres.Item_Amount = Convert.ToInt32(Convert.ToDecimal(dt.Rows[i]["PresAmount"])); //开药数量 mPres.Item_Unit = dt.Rows[i]["PresAmountUnit"].ToString(); //开药单位 mPres.Item_Rate = Convert.ToInt32(Convert.ToDecimal(dt.Rows[i]["PresFactor"])); //系数 mPres.Group_Id = Convert.ToInt32(dt.Rows[i]["GroupID"]); //分组组号 mPres.SkinTest_Flag = Convert.ToInt32(dt.Rows[i]["IsAst"]); //皮试 mPres.SelfDrug_Flag = Convert.ToInt32(dt.Rows[i]["IsTake"]); //自备 mPres.Entrust = dt.Rows[i]["Memo"].ToString(); //嘱托 mPres.FootNote = ""; mPres.Tc_Flag = 0; //套餐 mPres.PresNo = Convert.ToInt32(dt.Rows[i]["ListNO"]); //方号 mPres.Dept_Id = 0; //执行科室 mPres.Pres_Dept = Convert.ToInt32(dt.Rows[i]["DeptCode"]); mPres.Pres_DeptName = dt.Rows[i]["PresDeptName"].ToString(); mPres.Pres_Doc = Convert.ToInt32(dt.Rows[i]["DoctorID"]); mPres.Pres_DocName = dt.Rows[i]["PresDoctorName"].ToString(); if (Convert.ToInt32(dt.Rows[i]["IsCancel"]) == 1) { mPres.Status = PresStatus.退费状态; } else if (Convert.ToInt32(dt.Rows[i]["IsCharged"]) == 1) { mPres.Status = PresStatus.收费状态; } else { mPres.Status = PresStatus.保存状态; } //mPres.Pres_Date = Convert.ToDateTime(dt.Rows[i]["chargedTime"]); mPres.Usage_Name = dt.Rows[i]["ChannelName"].ToString(); //用法名称 mPres.Frequency_Name = dt.Rows[i]["FrequencyName"].ToString(); //频次名称 mPres.Frequency_Caption = dt.Rows[i]["ExecuteCode"].ToString(); //频次名称 int _execNum, _cycleDay; CardDataSourceFrequency.Calculate(dt.Rows[i]["ExecuteCode"].ToString(), out _execNum, out _cycleDay); mPres.Frequency_ExecNum = _execNum; //执行次数 mPres.Frequency_CycleDay = _cycleDay; //执行周期 mPres.CalculateItemMoney(); list_Prescription.Add(mPres); } return(list_Prescription); }
public Prescription.Controls.Entity.Prescription GetPresTemplateRow(int type, int itemId) { CardDataSourceDrugItem durgItem = GetDrugItem(itemId); if (durgItem == null) { throw new Exception("该项目已停用,不能开出!"); } Prescription.Controls.Entity.Prescription mPres = new Prescription.Controls.Entity.Prescription(); mPres.Item_Id = ConvertDataExtend.ToInt32(durgItem.ItemId, -1); mPres.Item_Name = ConvertDataExtend.ToString(durgItem.ItemName, ""); mPres.Item_Type = type;//Convert.ToInt32(durgItem.ItemType);//1西药 2中药 3项目材料 mPres.StatItem_Code = ConvertDataExtend.ToString(durgItem.StatItemCode, "");; mPres.Sell_Price = durgItem.SellPrice; mPres.Buy_Price = durgItem.BuyPrice; mPres.Item_Price = durgItem.SellPrice; mPres.Standard = durgItem.Standard; mPres.Usage_Amount = durgItem.default_Usage_Id; //剂量 mPres.Usage_Unit = durgItem.DoseUnitName; //剂量单位 mPres.Usage_Rate = durgItem.DoseConvertNum; //剂量系数 if (mPres.IsHerb) { mPres.Dosage = 1;//付数 } else { mPres.Dosage = 0; } mPres.Usage_Id = durgItem.default_Usage_Id; mPres.Frequency_Id = durgItem.default_Frequency_Id; mPres.Days = Convert.ToInt32(1); //mPres.Amount = 0;//发药数量 mPres.Unit = durgItem.UnPickUnit; //发药单位 mPres.Item_Amount = Convert.ToInt32(1); //开药数量 mPres.Item_Unit = durgItem.UnPickUnit; //开药单位 mPres.Item_Rate = Convert.ToInt32(1); //系数 mPres.SkinTest_Flag = durgItem.SkinTestFlag; //皮试 mPres.SelfDrug_Flag = Convert.ToInt32(0); //自备 mPres.Entrust = ""; //嘱托 mPres.FootNote = ""; mPres.Tc_Flag = 0;//套餐 mPres.Pres_Date = Convert.ToDateTime(DateTime.Now); mPres.Usage_Name = durgItem.default_Usage_Name; //用法名称 mPres.Frequency_Name = durgItem.default_Frequency_Name; //频次名称 string _caption = ""; CardDataSourceFrequency freq = GetFrequency().Find(x => x.FrequencyId == mPres.Usage_Id); if (freq != null) { _caption = freq.Caption; } //string _caption = CardDataSource.Tables["frequencydic"].Select("FrequencyId=" + mPres.Usage_Id)[0]["Caption"].ToString(); mPres.Frequency_Caption = _caption;//频次名称 int _execNum, _cycleDay; CardDataSourceFrequency.Calculate(_caption, out _execNum, out _cycleDay); mPres.Frequency_ExecNum = _execNum; //执行次数 mPres.Frequency_CycleDay = _cycleDay; //执行周期 mPres.IsFloat = true; //row["RoundingMode"] mPres.Usage_Amount = mPres.Usage_Amount <= 0 ? 1 : mPres.Usage_Amount; mPres.CalculateAmount(durgItem.UnPickUnit);//计算数量 和 金额 return(mPres); //throw new NotImplementedException(); }