/// <summary> /// 更新非药品信息,以非药品编码为主键 /// </summary> /// <param name="item">非药品实体</param> /// <returns>成功 1 失败 -1 ,未更新到数据 0</returns> public int UpdateUndrugItem(Undrug item) { string sql = null; //更新fin_com_undruginfo的SQL语句 if (this.Sql.GetSql("Fee.Item.UpdateItem", ref sql) == -1) { this.Err = "获得索引为:Fee.Item.UpdateItem的SQL语句失败!"; return(-1); } //格式化SQL语句 try { //取参数列表 string[] parms = GetItemParams(item); //替换SQL语句中的参数。 sql = string.Format(sql, parms); } catch (Exception e) { this.Err = e.Message; this.WriteErr(); return(-1); } return(this.ExecNoQuery(sql)); }
/// <summary> /// 非药品调价专用 ,时如果立即生效, 调用这个函数 他只更新非药品的 默认价 ,儿童价, 特诊价 /// </summary> /// <param name="item">价格变化后的非药品实体</param> /// <returns>成功 1 失败 -1 未更新到数据 0</returns> public int AdjustPrice(Undrug item) { string sql = null; //调价SQL语句 if (this.Sql.GetSql("Fee.Item.ItemPriceSave", ref sql) == -1) { this.Err = "获得索引为:Fee.Item.ItemPriceSave的SQL语句失败!"; return(-1); } //格式化SQL语句 try { //替换SQL语句中的参数。 sql = string.Format(sql, item.ID, item.Price, item.ChildPrice, item.SpecialPrice); } catch (Exception e) { this.Err = e.Message; this.WriteErr(); return(-1); } //{58010499-3CA3-4b9d-B537-BBF964F8EB8B} 根据本次调价项目更新包含了该明细项目的复合项目价格 if (this.ExecNoQuery(sql) == -1) { return(-1); } return(this.AdjustZTPrice(item)); }
/// <summary> /// 获取住院患者的项目信息,包括药品和非药品 /// </summary> /// <param name="InpatientNo"></param> /// <param name="beginTime"></param> /// <param name="endTime"></param> /// <returns></returns> public ArrayList GetItemList(string InpatientNo, string beginTime, string endTime) { string sql = string.Empty; if (Sql.GetSql("WinForms.Report.Finance.FinIpb.ucFinIpbPatientDayFee2.2", ref sql) == -1) { return(null); } sql = " " + string.Format(sql, InpatientNo, beginTime, endTime); ArrayList items = new ArrayList(); //用于返回非药品信息的数组 //执行当前Sql语句 if (this.ExecQuery(sql) == -1) { this.Err = this.Sql.Err; return(null); } try { //循环读取数据 while (this.Reader.Read()) { Undrug item = new Undrug(); item.ID = this.Reader[0].ToString(); //非药品编码 item.Name = this.Reader[1].ToString(); //非药品名称 item.Specs = this.Reader[2].ToString(); //规格 item.Qty = NConvert.ToDecimal(this.Reader[3].ToString()); //数量 item.PriceUnit = this.Reader[4].ToString(); //单位 item.Price = NConvert.ToDecimal(this.Reader[5].ToString()); //默认价代替总额(为了方便) items.Add(item); }//循环结束 //关闭Reader this.Reader.Close(); return(items); } catch (Exception e) { this.Err = "获得项目基本信息出错!" + e.Message; this.WriteErr(); //如果还没有关闭Reader 关闭之 if (!this.Reader.IsClosed) { this.Reader.Close(); } items = null; return(null); } }
/// <summary> /// 获得update或者insert非药品字典表的传入参数数组 /// </summary> /// <param name="undrug">非药品实体</param> /// <returns>参数数组</returns> private string[] GetItemParams(Undrug undrug) { string[] args = { undrug.ID, undrug.Name, undrug.SysClass.ID.ToString(), undrug.MinFee.ID.ToString(), undrug.UserCode, undrug.SpellCode, undrug.WBCode, undrug.GBCode, undrug.NationCode, undrug.Price.ToString(), undrug.PriceUnit, undrug.FTRate.EMCRate.ToString(), NConvert.ToInt32(undrug.IsFamilyPlanning).ToString(), "", undrug.Grade, NConvert.ToInt32(undrug.IsNeedConfirm).ToString(), Neusoft.FrameWork.Function.NConvert.ToInt32(undrug.ValidState).ToString(), undrug.Specs, undrug.ExecDept, undrug.MachineNO, undrug.CheckBody, undrug.OperationInfo.ID, undrug.OperationType.ID, undrug.OperationScale.ID, NConvert.ToInt32(undrug.IsCompareToMaterial).ToString(), undrug.Memo, undrug.Oper.ID, undrug.ChildPrice.ToString(), undrug.SpecialPrice.ToString(), undrug.SpecialFlag, undrug.SpecialFlag1, undrug.SpecialFlag2, undrug.SpecialFlag3, undrug.SpecialFlag4, "0", "0", undrug.DiseaseType.ID, undrug.SpecialDept.ID, NConvert.ToInt32(undrug.IsConsent).ToString(), undrug.MedicalRecord, undrug.CheckRequest, undrug.Notice, undrug.CheckApplyDept, NConvert.ToInt32(undrug.IsNeedBespeak).ToString(), undrug.ItemArea, undrug.ItemException, undrug.UnitFlag,/*[2007/01/19]后加的字段,单位标识46*/ undrug.ApplicabilityArea }; return(args); }
/// <summary> /// 根据非药品明细项目获取包含了该明细项目的复合项目列表 /// /// {58010499-3CA3-4b9d-B537-BBF964F8EB8B} 根据本次调价项目更新包含了该明细项目的复合项目价格 /// </summary> /// <param name="detailItem">非药品明细项目</param> /// <returns>成功返回1 失败返回-1</returns> protected List <Neusoft.FrameWork.Models.NeuObject> QueryZTListByDetailItem(Undrug detailItem) { string sql = string.Empty; //获得全部变更计划的SELECT语句 //取SELECT语句 if (this.Sql.GetSql("Fee.Item.QueryZTListByDetailItem", ref sql) == -1) { this.Err = "没有找到Fee.Item.QueryZTListByDetailItem字段!"; this.WriteErr(); return(null); } try { sql = string.Format(sql, detailItem.ID); if (this.ExecQuery(sql) == -1) { return(null); } List <Neusoft.FrameWork.Models.NeuObject> ztList = new List <Neusoft.FrameWork.Models.NeuObject>(); while (this.Reader.Read()) { Neusoft.FrameWork.Models.NeuObject tempObj = new Neusoft.FrameWork.Models.NeuObject(); tempObj.ID = this.Reader[0].ToString(); //复合项目编码 tempObj.Name = this.Reader[1].ToString(); //复合项目名称 ztList.Add(tempObj); } return(ztList); } catch (Exception ex) { this.Err = ex.Message; return(null); } finally { if (this.Reader != null && !this.Reader.IsClosed) { this.Reader.Close(); } } }
/// <summary> /// 通过项目数组获得数组脚标为0的元素,转换成非药品实体 /// </summary> /// <param name="items">非药品项目数组</param> /// <returns>成功返回非药品实体,失败返回null</returns> private Undrug GetItemFromArrayList(ArrayList items) { //如果获得数组为空,说明sql或者其他原因产生错误 if (items == null) { return(null); } //如果获得的数组元素数大于0,说明查找到了项目,理论上只能有一个元素 //所以取脚标为0的元素,转成Undrug实体 if (items.Count > 0) { Undrug tempUndrug = items[0] as Undrug; return(tempUndrug); } else //如果元素数等于0(不可能小于0),说明此编码的非药品项目不存在 { return(null); } }
/// <summary> /// 非药品调价时 根据调价的非药品更新相关的复合项目价格 /// /// {58010499-3CA3-4b9d-B537-BBF964F8EB8B} 根据本次调价项目更新包含了该明细项目的复合项目价格 /// </summary> /// <param name="adjustPriceItem">价格变化后的非药品实体</param> /// <returns>成功1 失败-1 </returns> public int AdjustZTPrice(Undrug adjustPriceItem) { if (adjustPriceItem.UnitFlag == "1") //复合项目不需要进行后续处理 { return(1); } List <Neusoft.FrameWork.Models.NeuObject> ztList = this.QueryZTListByDetailItem(adjustPriceItem); if (ztList == null) { return(-1); } foreach (Neusoft.FrameWork.Models.NeuObject ztInfo in ztList) { if (this.UpdateZTPrice(ztInfo.ID) == -1) { return(-1); } } return(1); }
/// <summary> /// 获得全部可用非药品信息和组合项目信息 /// </summary> /// <returns>成功:全部可用非药品信息和组合项目信息 失败: null</returns> public ArrayList GetAvailableListWithGroup() { string sql = null; //获得全部非药品信息的SELECT语句 ArrayList items = new ArrayList(); //用于返回非药品信息的数组 //取SELECT语句 if (this.Sql.GetSql("Fee.Item.Info.GetAvailableListWithGroup", ref sql) == -1) { this.Err = "没有找到索引为:Fee.Item.Undrug.Info.GetAvailableListWithGroup的Sql语句!"; return(null); } //如果执行查询SQL语句,那么返回null if (this.ExecQuery(sql) == -1) { return(null); } try { //循环获得数据 while (this.Reader.Read()) { Undrug item = new Undrug(); //临时非药品信息 item.ID = this.Reader[0].ToString(); item.Name = this.Reader[1].ToString(); item.SysClass.ID = this.Reader[2].ToString(); item.UserCode = this.Reader[3].ToString(); item.SpellCode = this.Reader[4].ToString(); item.WBCode = this.Reader[5].ToString(); item.Price = NConvert.ToDecimal(this.Reader[6].ToString()); item.PriceUnit = this.Reader[7].ToString(); item.IsNeedConfirm = Neusoft.FrameWork.Function.NConvert.ToBoolean(this.Reader[8].ToString()); item.ExecDept = this.Reader[9].ToString(); item.MachineNO = this.Reader[10].ToString(); item.CheckBody = this.Reader[11].ToString(); item.Memo = this.Reader[12].ToString(); item.DiseaseType.ID = this.Reader[13].ToString(); item.SpecialDept.ID = this.Reader[14].ToString(); item.MedicalRecord = this.Reader[15].ToString(); item.CheckRequest = this.Reader[16].ToString(); item.Notice = this.Reader[17].ToString(); item.Grade = this.Reader[18].ToString(); //-- 类别 items.Add(item); } //循环结束 this.Reader.Close(); } catch (Exception e) { this.Err = e.Message; this.WriteErr(); //如果Reader没有关闭,关闭之 if (!this.Reader.IsClosed) { this.Reader.Close(); } items = null; return(null); } return(items); }
/// <summary> /// 取非药品基本信息数组 /// </summary> /// <param name="sql">当前Sql语句</param> /// <returns>成功返回非药品数组 失败返回null</returns> private ArrayList GetItemsBySql(string sql) { ArrayList items = new ArrayList(); //用于返回非药品信息的数组 //执行当前Sql语句 if (this.ExecQuery(sql) == -1) { this.Err = this.Sql.Err; return(null); } try { //循环读取数据 while (this.Reader.Read()) { Undrug item = new Undrug(); item.ID = this.Reader[0].ToString(); //非药品编码 item.Name = this.Reader[1].ToString(); //非药品名称 item.SysClass.ID = this.Reader[2].ToString(); //系统类别 item.MinFee.ID = this.Reader[3].ToString(); //最小费用代码 item.UserCode = this.Reader[4].ToString(); //输入码 item.SpellCode = this.Reader[5].ToString(); //拼音码 item.WBCode = this.Reader[6].ToString(); //五笔码 item.GBCode = this.Reader[7].ToString(); //国家编码 item.NationCode = this.Reader[8].ToString(); //国际编码 item.Price = NConvert.ToDecimal(this.Reader[9].ToString()); //默认价 item.PriceUnit = this.Reader[10].ToString(); //计价单位 item.FTRate.EMCRate = NConvert.ToDecimal(this.Reader[11].ToString()); // 急诊加成比例 item.IsFamilyPlanning = NConvert.ToBoolean(this.Reader[12].ToString()); // 计划生育标记 item.User01 = this.Reader[13].ToString(); //特定诊疗项目 item.Grade = this.Reader[14].ToString(); //甲乙类标志 item.IsNeedConfirm = NConvert.ToBoolean(this.Reader[15].ToString()); //确认标志 1 需要确认 0 不需要确认 item.ValidState = this.Reader[16].ToString(); //有效性标识 在用 1 停用 0 废弃 2 item.Specs = this.Reader[17].ToString(); //规格 item.ExecDept = this.Reader[18].ToString(); //执行科室 item.MachineNO = this.Reader[19].ToString(); //设备编号 用 | 区分 item.CheckBody = this.Reader[20].ToString(); //默认检查部位或标本 item.OperationInfo.ID = this.Reader[21].ToString(); // 手术编码 item.OperationType.ID = this.Reader[22].ToString(); // 手术分类 item.OperationScale.ID = this.Reader[23].ToString(); //手术规模 item.IsCompareToMaterial = NConvert.ToBoolean(this.Reader[24].ToString()); //是否有物资项目与之对照(1有,0没有) item.Memo = this.Reader[25].ToString(); //备注 item.ChildPrice = NConvert.ToDecimal(this.Reader[26].ToString()); //儿童价 item.SpecialPrice = NConvert.ToDecimal(this.Reader[27].ToString()); //特诊价 item.SpecialFlag = this.Reader[28].ToString(); //省限制 item.SpecialFlag1 = this.Reader[29].ToString(); //市限制 item.SpecialFlag2 = this.Reader[30].ToString(); //自费项目 item.SpecialFlag3 = this.Reader[31].ToString(); // 特殊检查 item.SpecialFlag4 = this.Reader[32].ToString(); // 备用 item.DiseaseType.ID = this.Reader[35].ToString(); //疾病分类 item.SpecialDept.ID = this.Reader[36].ToString(); //专科名称 item.MedicalRecord = this.Reader[37].ToString(); // --病史及检查 item.CheckRequest = this.Reader[38].ToString(); //--检查要求 item.Notice = this.Reader[39].ToString(); //-- 注意事项 item.IsConsent = NConvert.ToBoolean(this.Reader[40].ToString()); item.CheckApplyDept = this.Reader[41].ToString(); //检查申请单名称 item.IsNeedBespeak = NConvert.ToBoolean(this.Reader[42].ToString()); //是否需要预约 item.ItemArea = this.Reader[43].ToString(); //项目范围 item.ItemException = this.Reader[44].ToString(); //项目约束 item.UnitFlag = this.Reader[45].ToString(); // []单位标识 item.ApplicabilityArea = this.Reader[46].ToString(); items.Add(item); } //循环结束 //关闭Reader this.Reader.Close(); return(items); } catch (Exception e) { this.Err = "获得非药品基本信息出错!" + e.Message; this.WriteErr(); //如果还没有关闭Reader 关闭之 if (!this.Reader.IsClosed) { this.Reader.Close(); } items = null; return(null); } }