//获取西药处方数据 public static DataTable GetPrescriptionData(int type, int patListId) { List <Prescription> _listPrescription = PrescripttionDataSource.GetPrescriptionData(patListId, type); CalculateSubtotal(ref _listPrescription); return(ConvertDataExtend.ToDataTableS <Prescription>(_listPrescription)); }
//得到药品处方数据 public static List <Entity.Prescription> GetPrescriptionData(int patListId, int presType) { if (PrescripttionDbHelper != null) { return(PrescripttionDbHelper.GetPrescriptionData(patListId, presType)); } else { string strsql = @"SELECT b.ID ListID,b.PrescriptionID,b.FeeID,b.FeeName,b.ItemClass,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,b.chargedTime ,c.ChannelName,d.FrequencyName,d.ExecuteCode ,(SELECT RoundingMode FROM hisdb..Dict_Medicine WHERE MedID=(SELECT MedID FROM hisdb..BASE_MedPrice WHERE StockID=b.FeeID) AND HospitalID={0}) RoundingMode ,b.DoctorID,b.DeptCode,hisproc.dbo.fnGetStaffName(b.DoctorID) PresDoctorName,hisproc.dbo.fnGetDeptNameHIS({0},b.DeptCode) PresDeptName FROM emrdb..DATA_PrescriptionList a LEFT JOIN emrdb..DATA_PrescriptionDetail b ON a.ID=b.PrescriptionID LEFT JOIN emrdb..BASE_Channel AS c ON b.ChannelID = c.ID LEFT JOIN emrdb..BASE_Frequency AS d ON b.FrequencyID = d.ID WHERE a.PatientID={1} AND a.OrderClass={2} ORDER BY b.ListNO,b.GroupID"; strsql = string.Format(strsql, 33, patListId, presType); DataTable dt = MidDbHelper.ExecuteDataTable(MidDbHelper.EmrHandle, strsql); //int _orderNo = 1;//行号 List <Entity.Prescription> list_Prescription = new List <Entity.Prescription>(); for (int i = 0; i < dt.Rows.Count; i++) { Entity.Prescription mPres = new 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 = 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 = Prescription.Controls.Entity.PresStatus.退费状态; } else if (Convert.ToInt32(dt.Rows[i]["IsCharged"]) == 1) { mPres.Status = Prescription.Controls.Entity.PresStatus.收费状态; } else { mPres.Status = Prescription.Controls.Entity.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); } }