public string getCalculate()
    {
        //回收率
        string strAddBack = "";
        //平均值
        string strAvgValue = "";
        //偏差
        string strOffSet = "";

        //如果是实验室加标
        if (Request["chkQcAdd"] != null && Request["chkQcAdd"] == "on")
        {
            //测定值
            string strAddResultEx = Request["ADD_RESULT_EX"].ToString();
            //加标量
            string strQcAdd = Request["QC_ADD"].ToString();
            //原始测定值
            string strResult = Request["result"].ToString();
            //计算回收率
            decimal AddBack = 0;
            if (strResult != "")
            {
                AddBack    = Math.Abs(decimal.Parse(strAddResultEx) - decimal.Parse(strResult)) / decimal.Parse(strQcAdd) * 100;
                strAddBack = Math.Round(AddBack, 1).ToString();
            }
        }
        //实验室明码平行
        if (Request["chkQcTwin"] != null && Request["chkQcTwin"] == "on")
        {
            string strResultId = Request["resultid"].ToString();
            string strValue1   = Request["TWIN_RESULT1"].ToString();
            string strValue2   = Request["TWIN_RESULT2"].ToString();
            //根据结果ID获取监测监测项目ID
            string strQcTwinValue = new TMisMonitorResultLogic().getQcTwinValue(strResultId, strValue1, strValue2);
            strAvgValue = strQcTwinValue.Split(',')[0];
            strOffSet   = strQcTwinValue.Split(',')[1];
        }
        return("{\"strAddBack\":\"" + strAddBack + "\",\"strAvgValue\":\"" + strAvgValue + "\",\"strOffSet\":\"" + strOffSet + "\"}");
    }
Ejemplo n.º 2
0
    public string getCalculate()
    {
        //空白平均值
        string strEmptyValue = "";
        string strEmptyCount = "";
        //标准样平均值
        string strSrcValue = "";
        string strSrcCount = "";
        //回收率
        string strAddBack = "";
        //平均值
        string strAvgValue = "";
        //偏差
        string strOffSet = "";

        //如果是实验室空白
        if (Request["chkQcEmpty"] != null && Request["chkQcEmpty"] == "on")
        {
            //空白个数值
            string strValue1 = Request["QC_EMPTY_IN_VALUE1"].ToString().Trim();
            string strValue2 = Request["QC_EMPTY_IN_VALUE2"].ToString().Trim();
            string strValue3 = Request["QC_EMPTY_IN_VALUE3"].ToString().Trim();
            //空白个数
            strEmptyCount = (int.Parse(strValue1 == "" ? "0" : "1") + int.Parse(strValue2 == "" ? "0" : "1") + int.Parse(strValue3 == "" ? "0" : "1")).ToString();

            //计算平均值
            if (strEmptyCount != "0")
            {
                strEmptyValue = ((decimal.Parse(strValue1 == "" ? "0" : strValue1) + decimal.Parse(strValue2 == "" ? "0" : strValue2) + decimal.Parse(strValue3 == "" ? "0" : strValue3)) / int.Parse(strEmptyCount)).ToString();
            }

            //huangjinjun add
            decimal dAvgSaveValue = Math.Round((decimal.Parse(strEmptyValue)), strValue1.Split('.').Length, MidpointRounding.ToEven);
            strEmptyValue = dAvgSaveValue.ToString();
        }
        //如果是标准样
        if (Request["chkQcSt"] != null && Request["chkQcSt"] == "on")
        {
            //标准样个数值
            string strValue1 = Request["SRC_IN_VALUE1"].ToString().Trim();
            string strValue2 = Request["SRC_IN_VALUE2"].ToString().Trim();
            string strValue3 = Request["SRC_IN_VALUE3"].ToString().Trim();
            //标准样个数
            strSrcCount = (int.Parse(strValue1 == "" ? "0" : "1") + int.Parse(strValue2 == "" ? "0" : "1") + int.Parse(strValue3 == "" ? "0" : "1")).ToString();

            //计算平均值
            if (strSrcCount != "0")
            {
                strSrcValue = ((decimal.Parse(strValue1 == "" ? "0" : strValue1) + decimal.Parse(strValue2 == "" ? "0" : strValue2) + decimal.Parse(strValue3 == "" ? "0" : strValue3)) / int.Parse(strSrcCount)).ToString();
            }
        }

        //如果是实验室加标
        if (Request["chkQcAdd"] != null && Request["chkQcAdd"] == "on")
        {
            //测定值
            string strAddResultEx = Request["ADD_RESULT_EX"].ToString();
            //加标量
            string strQcAdd = Request["QC_ADD"].ToString();
            //原始测定值
            string strResult = Request["ADD_RESULT"].ToString();
            //计算回收率
            decimal AddBack = 0;
            if (strResult != "" && strResult != "0" && strQcAdd != "")
            {
                AddBack    = Math.Abs(decimal.Parse(strAddResultEx) - decimal.Parse(strResult)) / decimal.Parse(strQcAdd) * 100;
                strAddBack = Math.Round(AddBack, 1).ToString();
            }
        }
        //实验室明码平行
        if (Request["chkQcTwin"] != null && Request["chkQcTwin"] == "on")
        {
            string strResultId = Request["hidTwinSampleCode"].ToString();
            string strValue1   = Request["TWIN_RESULT1"].ToString();
            string strValue2   = Request["TWIN_RESULT2"].ToString();
            if (strResultId != "" && strValue1 != "" && strValue2 != "")
            {
                //根据结果ID获取监测监测项目ID
                string strQcTwinValue = new TMisMonitorResultLogic().getQcTwinValueEx(strResultId, strValue1, strValue2);
                strAvgValue = strQcTwinValue.Split(',')[0];
                strOffSet   = strQcTwinValue.Split(',')[1];
            }
        }
        return("{\"strAddBack\":\"" + strAddBack + "\",\"strAvgValue\":\"" + strAvgValue + "\",\"strOffSet\":\"" + strOffSet + "\",\"strEmptyCount\":\"" + strEmptyCount + "\",\"strEmptyValue\":\"" + strEmptyValue + "\",\"strSrcCount\":\"" + strSrcCount + "\",\"strSrcValue\":\"" + strSrcValue + "\"}");
    }
    public string getCalculate()
    {
        string objStr = "";
        //空白平均值
        string strEmptyValue = "";
        string strEmptyCount = "";
        //标准样平均值
        string strSrcValue = "";
        string strSrcCount = "";
        //回收率
        string strAddBack = "";
        //平均值
        string strAvgValue = "";
        //偏差
        string strOffSet = "";

        //如果是实验室空白
        if (this.hidQC_TYPE.Value == "5")
        {
            //空白个数值
            string strValue1 = Request["QC_EMPTY_IN_VALUE1"].ToString().Trim();
            string strValue2 = Request["QC_EMPTY_IN_VALUE2"].ToString().Trim();
            string strValue3 = Request["QC_EMPTY_IN_VALUE3"].ToString().Trim();
            //空白个数
            strEmptyCount = (int.Parse(strValue1 == "" ? "0" : "1") + int.Parse(strValue2 == "" ? "0" : "1") + int.Parse(strValue3 == "" ? "0" : "1")).ToString();

            //计算平均值
            if (strEmptyCount != "0")
            {
                strEmptyValue = ((decimal.Parse(strValue1 == "" ? "0" : strValue1) + decimal.Parse(strValue2 == "" ? "0" : strValue2) + decimal.Parse(strValue3 == "" ? "0" : strValue3)) / int.Parse(strEmptyCount)).ToString();
            }

            objStr = "{\"strEmptyCount\":\"" + strEmptyCount + "\",\"strEmptyValue\":\"" + strEmptyValue + "\"}";
        }
        //如果是标准样
        if (this.hidQC_TYPE.Value == "8")
        {
            //标准样个数值
            string strValue1 = Request["SRC_IN_VALUE1"].ToString().Trim();
            string strValue2 = Request["SRC_IN_VALUE2"].ToString().Trim();
            string strValue3 = Request["SRC_IN_VALUE3"].ToString().Trim();
            //标准样个数
            strSrcCount = (int.Parse(strValue1 == "" ? "0" : "1") + int.Parse(strValue2 == "" ? "0" : "1") + int.Parse(strValue3 == "" ? "0" : "1")).ToString();

            //计算平均值
            if (strSrcCount != "0")
            {
                strSrcValue = ((decimal.Parse(strValue1 == "" ? "0" : strValue1) + decimal.Parse(strValue2 == "" ? "0" : strValue2) + decimal.Parse(strValue3 == "" ? "0" : strValue3)) / int.Parse(strSrcCount)).ToString();
            }

            objStr = "{\"strSrcCount\":\"" + strSrcCount + "\",\"strSrcValue\":\"" + strSrcValue + "\"}";
        }

        //如果是实验室加标
        if (this.hidQC_TYPE.Value == "6")
        {
            //测定值
            string strAddResultEx = Request["ADD_RESULT_EX"].ToString();
            //加标量
            string strQcAdd = Request["QC_ADD"].ToString();
            //原始测定值
            string strResult = Request["ADD_RESULT"].ToString();
            //计算回收率
            decimal AddBack = 0;
            if (strResult != "" && strResult != "0" && strQcAdd != "")
            {
                AddBack    = Math.Abs(decimal.Parse(strAddResultEx) - decimal.Parse(strResult)) / decimal.Parse(strQcAdd) * 100;
                strAddBack = Math.Round(AddBack, 1).ToString();
            }

            objStr = "{\"strAddBack\":\"" + strAddBack + "\"}";
        }
        //实验室明码平行
        if (this.hidQC_TYPE.Value == "7")
        {
            string strResultId = Request["hidSrcResultID"].ToString();
            string strValue1   = Request["TWIN_RESULT1"].ToString();
            string strValue2   = Request["TWIN_RESULT2"].ToString();
            if (strResultId != "" && strValue1 != "" && strValue2 != "")
            {
                //根据结果ID获取监测监测项目ID
                string strQcTwinValue = new TMisMonitorResultLogic().getQcTwinValueEx(strResultId, strValue1, strValue2);
                strAvgValue = strQcTwinValue.Split(',')[0];
                strOffSet   = strQcTwinValue.Split(',')[1];
            }

            objStr = "{\"strAvgValue\":\"" + strAvgValue + "\",\"strOffSet\":\"" + strOffSet + "\"}";
        }
        return(objStr);
    }