Exemple #1
0
        /// <summary>
        /// 保存时检查医嘱的有效性
        /// </summary>
        /// <param name="colid"></param>
        /// <param name="rowid"></param>
        /// <param name="itemname">错误费用名称</param>
        /// <returns></returns>
        public static WrongDecline CheckModelOrderData(List <HIS.Model.ZY_DOC_ORDERMODELLIST_E> list)
        {
            WrongDecline wrong = new WrongDecline();
            int          count = list.Count;

            #region 数据合理性判断
            if (count == 0)
            {
                wrong.SetData(0, 0, "0");
                return(wrong);
            }
            for (int i = 0; i < count; i++)
            {
                //已保存的和说明性医嘱不作判断
                if (list[i].FLAG == 1 || list[i].ITEM_TYPE == 7)
                {
                    continue;
                }
                if (list[i].AMOUNT == 0 || list[i].PRESAMOUNT == 0)
                {
                    wrong.SetData(3, i, "C01", list[i].ITEM_NAME);
                    return(wrong);
                }
                if (list[i].AMOUNT <= 0 && list[i].PRESAMOUNT < 0)
                {
                    wrong.SetData(3, i, "C02", list[i].ITEM_NAME);
                    return(wrong);
                }
                if (list[i].ITEM_TYPE < 4 && list[i].ITEM_TYPE > 0)
                {
                    int unittype = list[i].UNITTYPE;
                    #region 是否非法单位
                    if (!IsRightUnit(list[i].UNIT, out unittype, list[i].ITEM_ID, list[i].ITEM_TYPE))
                    {
                        wrong.SetData(4, i, "C03");
                        return(wrong);
                    }
                    list[i].UNITTYPE = unittype;
                    #endregion

                    #region 是否非法用法

                    if (!IsGroupFirstRow(list, i))
                    {
                        continue;
                    }
                    if (!IsRightUsage(list[i].ORDER_USAGE))
                    {
                        wrong.SetData(5, i, "C04");
                        return(wrong);
                    }
                    #endregion

                    #region 是否非法频率
                    if (list[i].ORDER_FRENQUECY == "" || list[i].ORDER_FRENQUECY == null)
                    {
                        wrong.SetData(6, i, "C05");
                        return(wrong);
                    }
                    if (!IsRightFrequcy(list[i].ORDER_FRENQUECY))
                    {
                        wrong.SetData(6, i, "C06");
                        return(wrong);
                    }
                    #endregion
                }
            }
            wrong.SetData(0, 0, "0");
            return(wrong);

            #endregion
        }
Exemple #2
0
        public static WrongDecline OrderChecks(List <HIS.Model.zy_doc_orderrecord_son> records, OrderType ordertype)
        {
            WrongDecline wrong = new WrongDecline();

            if (records == null)
            {
                wrong.SetData(0, 0, "0");
                return(wrong);
            }
            int count = records.Count;

            #region 数据合理性判断
            if (count == 0)
            {
                wrong.SetData(0, 0, "0");
                return(wrong);
            }
            for (int i = 0; i < count; i++)
            {
                if (records[i].ORDER_CONTENT == null || records[i].ORDER_CONTENT == "")
                {
                    records[i].DELETE_FLAG = 1;
                    continue;
                }
                if (records[i].STATUS_FALG > 1)//已经发送的不再判断,医嘱内容为空的直接删除
                {
                    continue;
                }
                if (records[i].ITEM_TYPE == 10 || records[i].ITEM_TYPE == 7)
                {
                    continue;
                }
                if (records[i].Usage == "皮试" || records[i].Usage == "皮试用")
                {
                    continue;
                }
                records[i].AMOUNT = Convert.ToDecimal(records[i].AMOUNT.ToString("0.000"));
                if (ordertype == OrderType.临时医嘱)
                {
                    if (records[i].ITEM_TYPE < 4)
                    {
                        int unittype = records[i].UNITTYPE;
                        #region 是否非法单位
                        if (!IsRightUnit(records[i].UNIT, out unittype, records[i].MAKEDICID, records[i].ITEM_TYPE))
                        {
                            wrong.SetData(4, i, "C03");
                            return(wrong);
                        }
                        records[i].UNITTYPE = unittype;
                        #endregion
                    }
                    if (records[i].AMOUNT == 0 || records[i].PRES_AMOUNT == 0)
                    {
                        wrong.SetData(3, i, "C01", records[i].ORDER_CONTENT);
                        return(wrong);
                    }
                }
                if (ordertype == OrderType.长期医嘱)
                {
                    if (records[i].AMOUNT == 0)
                    {
                        wrong.SetData(3, i, "C01", records[i].ORDER_CONTENT);
                        return(wrong);
                    }
                }
                if (records[i].AMOUNT <= 0 || records[i].PRES_AMOUNT < 0)
                {
                    wrong.SetData(3, i, "C02", records[i].ORDER_CONTENT);
                    return(wrong);
                }
                #endregion
                if (!IsGroupFirstRow(records, i)) //只要每组的第一行作判断
                {
                    continue;
                }
                //项目也要判断用法和频次是否合法  2010.3.29
                if (records[i].ITEM_TYPE > 3 || records[i].ITEM_TYPE == 0)
                {
                    if (records[i].Usage == "" || records[i].Frency == "" || records[i].Usage == null || records[i].Frency == null)// dt.Rows[i]["Usage"].ToString() == "" || dt.Rows[i]["Frency"].ToString().Trim() == "")
                    {
                        continue;
                    }
                }
                #region 是否非法用法
                if (!IsRightUsage(records[i].Usage))
                {
                    wrong.SetData(5, i, "C04");
                    return(wrong);
                }
                #endregion

                #region 是否非法频率
                if (ordertype == OrderType.长期医嘱 && records[i].Frency == null) //临嘱可以不写频率 (后来修改)
                {
                    wrong.SetData(6, i, "C05");
                    return(wrong);
                }
                if (!IsRightFrequcy(records[i].Frency))
                {
                    wrong.SetData(6, i, "C06");
                    return(wrong);
                }
                #endregion
            }
            wrong.SetData(0, 0, "0");
            return(wrong);
        }