/// <summary> /// 循环写进费用明细表 /// </summary> public bool AddExamChargeList(List <System.Data.DataTable> Now_DT_VS_Group, int ChargeItemNo, IModel iWorklist, decimal chargeRatio) { BExamChargeList bExamChargeList = new BExamChargeList(); MWorkList mWorkList = (MWorkList)iWorklist; int i, j; for (i = 0; i < Now_DT_VS_Group.Count; i++) { if (Now_DT_VS_Group[i] != null) { Hashtable ht = new Hashtable(); for (j = 0; j < Now_DT_VS_Group[i].Rows.Count; j++) { MExamChargeList mExamChargeList = new MExamChargeList(); mExamChargeList.AMOUNT = Convert.ToInt32(Now_DT_VS_Group[i].Rows[j]["AMOUNT"].ToString()); mExamChargeList.CHARGE = Convert.ToDecimal(Now_DT_VS_Group[i].Rows[j]["COSTS"].ToString()) * chargeRatio; mExamChargeList.CHARGE_CLASS_NAME = Now_DT_VS_Group[i].Rows[j]["CLASS_NAME"].ToString(); mExamChargeList.CHARGE_ITEM_CLASS = Now_DT_VS_Group[i].Rows[j]["ITEM_CLASS"].ToString(); mExamChargeList.CHARGE_ITEM_CODE = Now_DT_VS_Group[i].Rows[j]["ITEM_CODE"].ToString(); mExamChargeList.CHARGE_ITEM_NO = j + 1; mExamChargeList.CHARGE_ITEM_SPEC = Now_DT_VS_Group[i].Rows[j]["ITEM_SPEC"].ToString(); mExamChargeList.COST = Convert.ToDecimal(Now_DT_VS_Group[i].Rows[j]["COSTS"].ToString()); mExamChargeList.PRICE = Convert.ToDecimal(Now_DT_VS_Group[i].Rows[j]["PRICE"].ToString()); mExamChargeList.EXAM_NO = mWorkList.EXAM_ACCESSION_NUM; mExamChargeList.EXAM_CONFIRM_TIME = DateTime.Now; mExamChargeList.EXAM_ITEM_CODE = Now_DT_VS_Group[i].Rows[j]["EXAM_ITEM_CODE"].ToString(); mExamChargeList.ITEM_NO = ChargeItemNo; mExamChargeList.PATIENT_ID = mWorkList.PATIENT_ID; mExamChargeList.UNITS = Now_DT_VS_Group[i].Rows[j]["UNITS"].ToString(); mExamChargeList.CHARGE_ITEM_NAME = Now_DT_VS_Group[i].Rows[j]["ITEM_NAME"].ToString(); mExamChargeList.EXAM_ITEM_NO = i + 1; ChargeItemNo++; if (bExamChargeList.Exists(mExamChargeList)) { break; } ht.Add(j, mExamChargeList); } if (ht.Count > 0) { j = bExamChargeList.AddMore(ht); } else { return(true); } if (j < 0) { return(false); } } } return(true); }
/// <summary> /// 更新检查费用明细表记录 /// </summary> /// <param name="iWorklist"></param> /// <param name="Now_DT_VS_Old"></param> /// <param name="Now_DT_VS_Group"></param> /// <param name="chargeRatio"></param> /// <returns></returns> public bool SetExamChargeList(IModel iWorklist, System.Data.DataTable Now_DT_VS_Old, List <System.Data.DataTable> Now_DT_VS_Group, decimal chargeRatio) { MWorkList mWorkList = (MWorkList)iWorklist; int i = 0, j = 0; BExamChargeList bExamChargeList = new BExamChargeList(); j = bExamChargeList.Delete(" where EXAM_NO ='" + mWorkList.EXAM_ACCESSION_NUM + "'"); if (j < 0) { return(false); } for (i = 0; i < Now_DT_VS_Group.Count; i++) { if (Now_DT_VS_Group[i] != null) { Hashtable ht = new Hashtable(); for (j = 0; j < Now_DT_VS_Group[i].Rows.Count; j++) { MExamChargeList mExamChargeList = new MExamChargeList(); mExamChargeList.AMOUNT = Convert.ToInt32(Now_DT_VS_Group[i].Rows[j]["AMOUNT"].ToString()); mExamChargeList.CHARGE = Convert.ToDecimal(Now_DT_VS_Group[i].Rows[j]["COSTS"].ToString()) * chargeRatio; mExamChargeList.CHARGE_CLASS_NAME = Now_DT_VS_Group[i].Rows[j]["CLASS_NAME"].ToString(); mExamChargeList.CHARGE_ITEM_CLASS = Now_DT_VS_Group[i].Rows[j]["ITEM_CLASS"].ToString(); mExamChargeList.CHARGE_ITEM_CODE = Now_DT_VS_Group[i].Rows[j]["ITEM_CODE"].ToString(); mExamChargeList.CHARGE_ITEM_NO = j + 1; mExamChargeList.CHARGE_ITEM_SPEC = Now_DT_VS_Group[i].Rows[j]["ITEM_SPEC"].ToString(); mExamChargeList.COST = Convert.ToDecimal(Now_DT_VS_Group[i].Rows[j]["COSTS"].ToString()); mExamChargeList.PRICE = Convert.ToDecimal(Now_DT_VS_Group[i].Rows[j]["PRICE"].ToString()); mExamChargeList.EXAM_NO = mWorkList.EXAM_ACCESSION_NUM; mExamChargeList.EXAM_CONFIRM_TIME = DateTime.Now; mExamChargeList.EXAM_ITEM_CODE = Now_DT_VS_Group[i].Rows[j]["EXAM_ITEM_CODE"].ToString(); mExamChargeList.ITEM_NO = 0; mExamChargeList.PATIENT_ID = mWorkList.PATIENT_ID; mExamChargeList.UNITS = Now_DT_VS_Group[i].Rows[j]["UNITS"].ToString(); mExamChargeList.CHARGE_ITEM_NAME = Now_DT_VS_Group[i].Rows[j]["ITEM_NAME"].ToString(); mExamChargeList.EXAM_ITEM_NO = i; ht.Add(j, mExamChargeList); } if (ht.Count > 0) { j = bExamChargeList.AddMore(ht); } if (j < 0) { return(false); } } } Now_DT_VS_Old.Rows.Clear();//清空旧选中检查项目与价表项目的对照表 for (i = 0; i < Now_DT_VS_Group.Count; i++) { if (Now_DT_VS_Group[i] != null) { for (j = 0; j < Now_DT_VS_Group[i].Rows.Count; j++) { Now_DT_VS_Old.Rows.Add(new object[] { Now_DT_VS_Group[i].Rows[j]["CLASS_NAME"].ToString(), Now_DT_VS_Group[i].Rows[j]["ITEM_CLASS"].ToString(), Now_DT_VS_Group[i].Rows[j]["ITEM_NAME"].ToString(), Now_DT_VS_Group[i].Rows[j]["ITEM_SPEC"].ToString(), Now_DT_VS_Group[i].Rows[j]["AMOUNT"].ToString(), Now_DT_VS_Group[i].Rows[j]["UNITS"].ToString(), Now_DT_VS_Group[i].Rows[j]["PRICE"].ToString(), Now_DT_VS_Group[i].Rows[j]["EXAM_ITEM_CODE"].ToString(), Now_DT_VS_Group[i].Rows[j]["ITEM_CODE"].ToString(), Now_DT_VS_Group[i].Rows[j]["COSTS"].ToString(), Now_DT_VS_Group[i].Rows[j]["CHARGES"].ToString(), Now_DT_VS_Group[i].Rows[j]["CHARGE_ITEM_NO"].ToString() }); } } } return(true); }