Example #1
0
    private void AddNewUser()
    {
        int i = 0;

        System.Guid guid    = System.Guid.NewGuid();
        string      strGUID = System.Guid.NewGuid().ToString();

        GUIDLabel.Text = strGUID;
        string role = "";

        if (Role1.Checked)
        {
            role = "False";
        }
        if (Role2.Checked)
        {
            role = "True";
        }
        using (SqlConnection conn = new DB().GetConnection())
        {
            StringBuilder sb = new StringBuilder("insert into [Doctor]( GUID,DoctorName,Password,IDCard,Phone,EmployeeNum,DepartmentGUID,Department,HospitalGUID,IsAdmin)");
            sb.Append(" values ( @GUID,@DoctorName,@Password,@IDCard,@Phone,@EmployeeNum,@DepartmentGUID,@Department,@HospitalGUID,@IsAdmin) ");
            SqlCommand cmd = new SqlCommand(sb.ToString(), conn);
            cmd.Parameters.AddWithValue("@GUID", GUIDLabel.Text);
            cmd.Parameters.AddWithValue("@DoctorName", UserName.Text);
            cmd.Parameters.AddWithValue("@Password", Util.GetHash(Password.Text.Trim()));
            cmd.Parameters.AddWithValue("@IDCard", Util.AESEncrypt(IDCard.Text));
            cmd.Parameters.AddWithValue("@Phone", Phone.Text);
            cmd.Parameters.AddWithValue("@EmployeeNum", EmployeeNum.Text);
            cmd.Parameters.AddWithValue("@DepartmentGUID", DepartmentDDL.SelectedItem.Value);
            cmd.Parameters.AddWithValue("@Department", DepartmentDDL.SelectedItem.Text);
            cmd.Parameters.AddWithValue("@HospitalGUID", Session["HospitalGUID"].ToString());
            cmd.Parameters.AddWithValue("@IsAdmin", Util.AESEncrypt(role));
            conn.Open();
            i = cmd.ExecuteNonQuery();
            cmd.Dispose();
        }
        if (i == 1)
        {
            ErrorLabel.Text = "用户添加成功!";
            Response.Redirect("User_Man.aspx");
        }
        else
        {
            ErrorLabel.Text = "用户添加失败,请重试或重新打开页面!";
        }
    }
Example #2
0
    protected void InitBtn_Click(object sender, EventArgs e)
    {
        int i = 0;

        if (Licenses.Text != "")
        {
            string str = "GZKZYL_201";
            Licenses.Text = str + Licenses.Text;
        }
        using (SqlConnection conn = new DB().GetConnection())
        {
            string     sql = "Update [Hospital] set Licenses=@Licenses";
            SqlCommand cmd = new SqlCommand(sql, conn);
            cmd.Parameters.AddWithValue("@Licenses", Util.AESEncrypt(Licenses.Text));
            conn.Open();
            i = cmd.ExecuteNonQuery();
            conn.Close();
        }
        if (i == 1)
        {
            ErrorLabel.Text = "授权登录数更新成功!";
            Licenses.Text   = "";

            using (SqlConnection conn = new DB().GetConnection())
            {
                SqlCommand cmd = conn.CreateCommand();
                cmd.CommandText = "select * from Hospital where GUID=@HGUID";
                cmd.Parameters.AddWithValue("@HGUID", Session["HospitalGUID"]);
                conn.Open();
                SqlDataReader rd = cmd.ExecuteReader();
                if (rd.Read())
                {
                    Licensesnum.Text = Util.AESDecrypt(rd["Licenses"].ToString());
                    Licensesnum.Text = Licensesnum.Text.Substring(10, Licensesnum.Text.Length - 10);
                }
                rd.Close();
                conn.Close();
            }
        }
        else
        {
            ErrorLabel.Text = "授权登录数更新失败,请重试!";
        }
    }
Example #3
0
    private void InsertDatabase()
    {
        int i = 0;

        EndDT.Text = DateTime.Now.ToString();

        using (SqlConnection conn = new DB().GetConnection())
        {
            StringBuilder sb = new StringBuilder("Insert into T1 ( GUID,TestName,PatientGUID,StartDT,EndDT,RawScore,DoctorGUID) ");
            sb.Append(" values ( @GUID,@TestName,@PatientGUID,@StartDT,@EndDT,@RawScore,@DoctorGUID) ");
            SqlCommand cmd = new SqlCommand(sb.ToString(), conn);

            cmd.Parameters.AddWithValue("@GUID", GUID.Text);
            cmd.Parameters.AddWithValue("@TestName", TestName.Text);
            cmd.Parameters.AddWithValue("@PatientGUID", PatientGUID.Text);
            cmd.Parameters.AddWithValue("@StartDT", StartDT.Text);
            cmd.Parameters.AddWithValue("@EndDT", EndDT.Text);
            cmd.Parameters.AddWithValue("@RawScore", Util.AESEncrypt(Score.Text));
            cmd.Parameters.AddWithValue("@DoctorGUID", DoctorGUID.Text);

            conn.Open();
            i = cmd.ExecuteNonQuery();


            if (i == 1)
            {
                if (Session["Code"] == null)
                {
                    Response.Write(" <script> alert(\"成功提交!\");;window.location='R1.aspx?TGUID=" + GUID.Text + "&TNum=1'; </script> ");
                }
                else
                {
                    Response.Write(" <script> window.location='Login.aspx'; </script> "); //自评测试完成后回到登录页
                    DelectCode();                                                         //删除已完成的自评码
                }
            }
            else
            {
                Response.Write(" <script> alert(\"提交失败!请重试或关闭页面。\"); </script> ");
            }
        }
    }
Example #4
0
    protected void UpdateButton_Click(object sender, EventArgs e)
    {
        ErrorLabel.Text = "";
        if (IDCard1.Text != IDCard.Text)
        {
            ErrorLabel.Text = "旧身份证号输入错误!";
        }
        else if (IDCard2.Text != IDCard3.Text)
        {
            ErrorLabel.Text = "新身份证号两次输入不一致!";
        }
        else if (IDCard3.Text != "")
        {
            int i = 0;
            using (SqlConnection conn = new DB().GetConnection())
            {
                string     sql = "Update [Doctor] set IDCard=@IDCard where GUID = @DoctorGUID;";
                SqlCommand cmd = new SqlCommand(sql, conn);
                cmd.Parameters.AddWithValue("@DoctorGUID", DoctorGUID.Text);
                cmd.Parameters.AddWithValue("@IDCard", Util.AESEncrypt(IDCard3.Text));
                conn.Open();
                i = cmd.ExecuteNonQuery();
                conn.Close();
            }

            if (i == 1)
            {
                ErrorLabel.Text = "身份证号更新成功!";
            }
            else
            {
                ErrorLabel.Text = "身份证号更新失败,请重试!";
            }
        }
        else
        {
            ErrorLabel.Text = "身份证号不能为空!";
        }
    }
Example #5
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        ErrorLabel.Text = "";
        int    i    = 0;
        string role = "";

        if (Role1.Checked)
        {
            role = "False";
        }
        if (Role2.Checked)
        {
            role = "True";
        }
        using (SqlConnection conn = new DB().GetConnection())
        {
            string     sql = "Update [Doctor] set Phone=@Phone,EmployeeNum=@EmployeeNum,DepartmentGUID=@DepartmentGUID,Department=@Department,IsAdmin=@IsAdmin where GUID = @DoctorGUID;";
            SqlCommand cmd = new SqlCommand(sql, conn);
            cmd.Parameters.AddWithValue("@DoctorGUID", DoctorGUID.Text);
            cmd.Parameters.AddWithValue("@Phone", Phone.Text);
            cmd.Parameters.AddWithValue("@EmployeeNum", EmployeeNum.Text);
            cmd.Parameters.AddWithValue("@DepartmentGUID", DepartmentDDL.SelectedItem.Value);
            cmd.Parameters.AddWithValue("@Department", DepartmentDDL.SelectedItem.Text);
            cmd.Parameters.AddWithValue("@IsAdmin", Util.AESEncrypt(role));
            conn.Open();
            i = cmd.ExecuteNonQuery();
            conn.Close();
        }

        if (i == 1)
        {
            ErrorLabel.Text = "个人信息更新成功!";
        }
        else
        {
            ErrorLabel.Text = "个人信息更新失败,请重试!";
        }
    }
Example #6
0
    protected string GetUserToken(AuthUser user)
    {
        string text = JsonConvert.SerializeObject(Tuple.Create(user.Id, Guid.NewGuid(), user.LoginTime.GetTime()));

        return(Util.AESEncrypt(text, Encoding.UTF8.GetBytes(Configuration["login_aes:key"]), Encoding.UTF8.GetBytes(Configuration["login_aes:iv"])));
    }
Example #7
0
    private void InsertDatabase()
    {
        int i = 0;

        EndDT.Text = DateTime.Now.ToString();
        string  QTC, BP_ScoreExplain, BS_ScoreExplain, BF_ScoreExplain, HW_ScoreExplain, Waist_ScoreExplain = "";
        decimal HW_Score, Waist_Score, QTC_Score, BP_Score, BS_Score, BF_Score, SQ_Score, RawScore, RS1, RS2, RS3, RS4, RS5, RS6 = 0;
        double  R1, R5, C6, G6, L6, H6 = 0;
        int     R4, S4 = 0;

        if (Sex.Text == "男")
        {
            //Waist_Score腰围分数,QTC_Score心电图分数;
            QTC       = QTCBoy.SelectedItem.Text;
            QTC_Score = Convert.ToDecimal(QTCBoy.SelectedItem.Value);

            if (Convert.ToInt16(Waist.Text) <= 90)
            {
                Waist_Score = 1; Waist_ScoreExplain = "正常";
            }
            else if (Convert.ToInt16(Waist.Text) > 90 && Convert.ToInt16(Waist.Text) <= 101)
            {
                Waist_Score = 2; Waist_ScoreExplain = "增粗";
            }
            else
            {
                Waist_Score = 3; Waist_ScoreExplain = "过粗";
            }
        }

        else
        {
            QTC       = QTCGirl.SelectedItem.Text;
            QTC_Score = Convert.ToDecimal(QTCGirl.SelectedItem.Value);

            if (Convert.ToInt16(Waist.Text) <= 80)
            {
                Waist_Score = 1; Waist_ScoreExplain = "正常";
            }
            else if (Convert.ToInt16(Waist.Text) > 80 && Convert.ToInt16(Waist.Text) <= 87)
            {
                Waist_Score = 2; Waist_ScoreExplain = "加粗";
            }
            else
            {
                Waist_Score = 3; Waist_ScoreExplain = "过粗";
            }
        }

        //HW_Score体重指数
        double BeforeR1 = 0;

        R1 = Convert.ToDouble(Weight.Text) / ((Convert.ToDouble(Height.Text) / 100) * (Convert.ToDouble(Height.Text) / 100));
        R1 = Math.Round(R1, 1);

        using (SqlConnection conn = new DB().GetConnection())
        {
            SqlCommand cmd = conn.CreateCommand();
            cmd.CommandText = "select top 1* from T8  where PatientGUID=@PatientGUID order by StartDT desc";
            conn.Open();
            cmd.Parameters.AddWithValue("@PatientGUID", PatientGUID.Text);
            SqlDataReader rd = null;
            rd = cmd.ExecuteReader();
            if (rd.Read())
            {
                BeforeR1 = Convert.ToDouble(rd["Weight"].ToString()) / ((Convert.ToDouble(rd["Height"].ToString()) / 100) * (Convert.ToDouble(rd["Height"].ToString()) / 100));
            }
            else
            {
                BeforeR1 = R1;
            }
            rd.Close();
        }

        double cp;

        cp = (R1 - BeforeR1) / BeforeR1;

        if ((R1 >= 18.5 && R1 <= 24.9) || cp < 0.07)
        {
            HW_Score        = 1;
            HW_ScoreExplain = "正常";
        }
        else if ((R1 >= 25 && R1 < 29.9) || R1 < 18.5 || (cp > 0.07 && cp < 0.1))
        {
            HW_Score        = 2;
            HW_ScoreExplain = "超重/ 过轻";
        }
        else
        {
            HW_Score        = 3;
            HW_ScoreExplain = "肥胖";
        }

        //血压分数

        R4 = Convert.ToInt16(BP1.Text);
        S4 = Convert.ToInt16(BP2.Text);
        if ((R4 >= 90 && R4 <= 139) || S4 >= 60 && S4 <= 89)
        {
            BP_Score = 1; BP_ScoreExplain = "正常";
        }
        else if ((R4 >= 140 && R4 <= 159) || S4 >= 90 && S4 <= 99)
        {
            BP_Score = 2; BP_ScoreExplain = "高血压1期";
        }
        else if ((R4 >= 160 && R4 <= 179) || S4 >= 100 && S4 <= 109)
        {
            BP_Score = 3; BP_ScoreExplain = "高血压2期";
        }
        else if ((R4 >= 180) || S4 >= 110)
        {
            BP_Score = 4; BP_ScoreExplain = "高血压3期";
        }
        else
        {
            BP_Score = Convert.ToDecimal(BP3.SelectedItem.Value); BP_ScoreExplain = "低血压; " + BP3.SelectedItem.Text;
        }


        //BS_Score血糖分数/糖代谢
        R5 = Convert.ToDouble(BS1.Text);
        if (R5 >= 2.8 && R5 < 5.6)
        {
            BS_Score = 1; BS_ScoreExplain = "正常";
        }
        else if (R5 >= 5.6 && R5 <= 6.9)
        {
            BS_Score = 2; BS_ScoreExplain = "轻度异常";
        }
        else if (R5 > 6.9)
        {
            BS_Score = 3; BS_ScoreExplain = "明显异常";
        }
        else
        {
            BS_Score = Convert.ToDecimal(BS2.SelectedItem.Value); BS_ScoreExplain = "低血糖; " + BS2.SelectedItem.Text;
        }


        //BF_Score血脂分数

        C6 = Convert.ToDouble(TC.Text);
        G6 = Convert.ToDouble(TG.Text);
        L6 = Convert.ToDouble(HDLC.Text);
        H6 = Convert.ToDouble(LDLC.Text);

        if (C6 < 5.2 && L6 < 3.4 && H6 >= 1.0 && G6 < 1.7)
        {
            BF_Score = 1; BF_ScoreExplain = "正常水平";
        }
        else if ((C6 >= 5.2 && C6 < 6.2) || (L6 >= 3.4 && L6 < 4.1) || (G6 >= 1.7 && G6 < 2.3))
        {
            BF_Score = 2; BF_ScoreExplain = "边缘异常";
        }
        else
        {
            BF_Score = 3; BF_ScoreExplain = "异常";
        }


        //物质滥用分数
        SQ_Score = Convert.ToDecimal(SmokingFQ.SelectedItem.Value) + Convert.ToDecimal(SmokingDosage.SelectedItem.Value) + Convert.ToDecimal(DrinkFQ.SelectedItem.Value) + Convert.ToDecimal(DrinkDosage.SelectedItem.Value);

        //RawScore = RS1 + RS2 + RS3 + RS4 + RS5 + RS6 + RS7;

        RS1 = 100 - ((HW_Score - 1) / 2 * 100);
        RS2 = 100 - ((Waist_Score - 1) / 2 * 100);
        RS3 = 100 - ((BS_Score - 1) / 2 * 100);
        RS4 = 100 - ((BF_Score - 1) / 2 * 100);
        RS5 = ((100 - ((QTC_Score - 1) / 2 * 100)) + (100 - ((BP_Score - 1) / 3 * 100))) / 2;
        //  RS5 = 100 - ((QTC_Score - 1) / 2 * 100);
        //  RS5 = RS5 + (100 - ((QTC_Score - 1) / 3 * 100));
        //RS5 = RS5 / 2;
        RS6      = 100 - ((SQ_Score - 4) / 12 * 100);
        RawScore = RS1 + RS2 + RS3 + RS4 + RS5 + RS6;

        if (HBA1c.Text == "")
        {
            HBA1c.Text = "0";
        }
        if (LP.Text == "")
        {
            LP.Text = "0";
        }
        if (apoA.Text == "")
        {
            apoA.Text = "0";
        }
        if (apoB.Text == "")
        {
            apoB.Text = "0";
        }
        if (HR.Text == "")
        {
            HR.Text = "0";
        }

        //Response.Write(" <script> alert('增值: " + cp + "'); </script> ");
        //Response.Write(" <script> alert('现值值: " + R1 + "'); </script> ");
        // Response.Write(" <script> alert('体重指数_分数:" + RS1 + "'); </script> ");
        //Response.Write(" <script> alert('腰围分数:" + RS2 + "'); </script> ");
        //Response.Write(" <script> alert('心电图分数:" + RS3 + "'); </script> ");
        //Response.Write(" <script> alert('血压分数:" + RS4 + "'); </script> ");
        //Response.Write(" <script> alert('血糖分数:" + BS_Score + "'); </script> ");
        //Response.Write(" <script> alert('血脂分数:" + RS6 + "'); </script> ");
        //Response.Write(" <script> alert('物质滥用分数:" + RS7 + "'); </script> ");


        using (SqlConnection conn = new DB().GetConnection())
        {
            StringBuilder sb = new StringBuilder("Insert into T8 ( GUID,TestName,PatientGUID,StartDT,EndDT,RS1,RS2,RS3,RS4,RS5,RS6,RawScore,DoctorGUID,Height,Weight,HW_Score,HW_ScoreExplain,Waist,Waist_Score,Waist_ScoreExplain,HR,QTC,QTC_Score,QTC_Add,BP1,BP2,BP3,BP_Score,BP_ScoreExplain,BS1,BS2,BS_Score,BS_ScoreExplain,HBA1c,TC,TG,HDLC,LDLC,BF_Score,BF_ScoreExplain, LP,apoA,apoB,SmokingFQ,SmokingDosage,DrinkFQ,DrinkDosage,SQ_Score,Other)");
            sb.Append(" values ( @GUID,@TestName,@PatientGUID,@StartDT,@EndDT,@RS1,@RS2,@RS3,@RS4,@RS5,@RS6,@RawScore,@DoctorGUID,@Height,@Weight,@HW_Score,@HW_ScoreExplain,@Waist,@Waist_Score,@Waist_ScoreExplain,@HR,@QTC,@QTC_Score,@QTC_Add,@BP1,@BP2,@BP3,@BP_Score,@BP_ScoreExplain,@BS1,@BS2,@BS_Score,@BS_ScoreExplain,@HBA1c,@TC,@TG,@HDLC,@LDLC,@BF_Score,@BF_ScoreExplain,@LP,@apoA,@apoB,@SmokingFQ,@SmokingDosage,@DrinkFQ,@DrinkDosage,@SQ_Score,@Other)");

            SqlCommand cmd = new SqlCommand(sb.ToString(), conn);

            cmd.Parameters.AddWithValue("@GUID", GUID.Text);
            cmd.Parameters.AddWithValue("@TestName", TestName.Text);
            cmd.Parameters.AddWithValue("@PatientGUID", PatientGUID.Text);
            cmd.Parameters.AddWithValue("@StartDT", StartDT.Text);
            cmd.Parameters.AddWithValue("@EndDT", EndDT.Text);
            cmd.Parameters.AddWithValue("@HW_Score", Util.AESEncrypt(HW_Score.ToString()));
            cmd.Parameters.AddWithValue("@HW_ScoreExplain", HW_ScoreExplain);
            cmd.Parameters.AddWithValue("@Waist_Score", Util.AESEncrypt(Waist_Score.ToString()));
            cmd.Parameters.AddWithValue("@RS1", Util.AESEncrypt(RS1.ToString()));
            cmd.Parameters.AddWithValue("@RS2", Util.AESEncrypt(RS2.ToString()));
            cmd.Parameters.AddWithValue("@RS3", Util.AESEncrypt(RS3.ToString()));
            cmd.Parameters.AddWithValue("@RS4", Util.AESEncrypt(RS4.ToString()));
            cmd.Parameters.AddWithValue("@RS5", Util.AESEncrypt(RS5.ToString()));
            cmd.Parameters.AddWithValue("@RS6", Util.AESEncrypt(RS6.ToString()));

            cmd.Parameters.AddWithValue("@QTC_Score", Util.AESEncrypt(QTC_Score.ToString()));
            cmd.Parameters.AddWithValue("@BP_Score", Util.AESEncrypt(BP_Score.ToString()));
            cmd.Parameters.AddWithValue("@BS_Score", Util.AESEncrypt(BS_Score.ToString()));
            cmd.Parameters.AddWithValue("@BF_Score", Util.AESEncrypt(BF_Score.ToString()));
            cmd.Parameters.AddWithValue("@SQ_Score", Util.AESEncrypt(SQ_Score.ToString()));
            cmd.Parameters.AddWithValue("@RawScore", Util.AESEncrypt(RawScore.ToString()));
            cmd.Parameters.AddWithValue("@DoctorGUID", DoctorGUID.Text);
            cmd.Parameters.AddWithValue("@Height", Height.Text);
            cmd.Parameters.AddWithValue("@Weight", Weight.Text);
            cmd.Parameters.AddWithValue("@Waist", Waist.Text);
            cmd.Parameters.AddWithValue("@Waist_ScoreExplain", Waist_ScoreExplain);
            cmd.Parameters.AddWithValue("@HR", HR.Text);
            cmd.Parameters.AddWithValue("@QTC", QTC);
            cmd.Parameters.AddWithValue("@QTC_Add", QTC_Add.Text);
            cmd.Parameters.AddWithValue("@BP1", BP1.Text);
            cmd.Parameters.AddWithValue("@BP2", BP2.Text);
            cmd.Parameters.AddWithValue("@BP3", BP3.SelectedItem.Text);
            cmd.Parameters.AddWithValue("@BP_ScoreExplain", BP_ScoreExplain);
            cmd.Parameters.AddWithValue("@BS1", BS1.Text);
            cmd.Parameters.AddWithValue("@BS2", BS2.SelectedItem.Text);
            cmd.Parameters.AddWithValue("@BS_ScoreExplain", BS_ScoreExplain);
            cmd.Parameters.AddWithValue("@HBA1c", HBA1c.Text);
            cmd.Parameters.AddWithValue("@TC", TC.Text);
            cmd.Parameters.AddWithValue("@TG", TG.Text);
            cmd.Parameters.AddWithValue("@HDLC", HDLC.Text);
            cmd.Parameters.AddWithValue("@LDLC", LDLC.Text);
            cmd.Parameters.AddWithValue("@BF_ScoreExplain", BF_ScoreExplain);
            cmd.Parameters.AddWithValue("@LP", LP.Text);
            cmd.Parameters.AddWithValue("@apoA", apoA.Text);
            cmd.Parameters.AddWithValue("@apoB", apoB.Text);
            cmd.Parameters.AddWithValue("@SmokingFQ", SmokingFQ.SelectedItem.Text);
            cmd.Parameters.AddWithValue("@SmokingDosage", SmokingDosage.SelectedItem.Text);
            cmd.Parameters.AddWithValue("@DrinkFQ", DrinkFQ.SelectedItem.Text);
            cmd.Parameters.AddWithValue("@DrinkDosage", DrinkDosage.SelectedItem.Text);
            cmd.Parameters.AddWithValue("@Other", Other.Text);



            conn.Open();
            i = cmd.ExecuteNonQuery();


            if (i == 1)
            {
                if (Session["Code"] == null)
                {
                    Response.Write(" <script> alert(\"成功提交!\");;window.location='R8.aspx?TGUID=" + GUID.Text + "&TNum=8'; </script> ");
                }
                else
                {
                    Response.Write(" <script> window.location='Login.aspx'; </script> "); //自评测试完成后回到登录页
                    DelectCode();                                                         //删除已完成的自评码
                }
            }
            else
            {
                Response.Write(" <script> alert(\"提交失败!请重试或关闭页面。\"); </script> ");
            }
        }
    }
Example #8
0
    private void InsertDatabase()
    {
        int i = 0;

        EndDT.Text = DateTime.Now.ToString();


        using (SqlConnection conn = new DB().GetConnection())
        {
            StringBuilder sb = new StringBuilder("Insert into T20 ( GUID,TestName,PatientGUID,StartDT,EndDT,DoctorGUID,severity1,severity2,severity3,severity4,severity5,severity6,severity7,severity8,severity9,severity10,severity11,severity12,severity13,severity14,severity15,severity16,severity17,severity18,severity19,severity20,severity21,severity22,severity23,severity24,severity25,severity26,severity27,severity28,severity29,severity30,severity31,severity32,severity33,severity34,manage1,manage2,manage3,manage4,manage5,manage6,manage7,manage8,manage9,manage10,manage11,manage12,manage13,manage14,manage15,manage16,manage17,manage18,manage19,manage20,manage21,manage22,manage23,manage24,manage25,manage26,manage27,manage28,manage29,manage30,manage31,manage32,manage33,manage34,relation1,relation2,relation3,relation4,relation5,relation6,relation7,relation8,relation9,relation10,relation11,relation12,relation13,relation14,relation15,relation16,relation17,relation18,relation19,relation20,relation21,relation22,relation23,relation24,relation25,relation26,relation27,relation28,relation29,relation30,relation31,relation32,relation33,relation34,Name34,severity_RawScore,manage_RawScore,relation_RawScore,RawScore) ");
            sb.Append(" values ( @GUID,@TestName,@PatientGUID,@StartDT,@EndDT,@DoctorGUID,@severity1,@severity2,@severity3,@severity4,@severity5,@severity6,@severity7,@severity8,@severity9,@severity10,@severity11,@severity12,@severity13,@severity14,@severity15,@severity16,@severity17,@severity18,@severity19,@severity20,@severity21,@severity22,@severity23,@severity24,@severity25,@severity26,@severity27,@severity28,@severity29,@severity30,@severity31,@severity32,@severity33,@severity34,@manage1,@manage2,@manage3,@manage4,@manage5,@manage6,@manage7,@manage8,@manage9,@manage10,@manage11,@manage12,@manage13,@manage14,@manage15,@manage16,@manage17,@manage18,@manage19,@manage20,@manage21,@manage22,@manage23,@manage24,@manage25,@manage26,@manage27,@manage28,@manage29,@manage30,@manage31,@manage32,@manage33,@manage34,@relation1,@relation2,@relation3,@relation4,@relation5,@relation6,@relation7,@relation8,@relation9,@relation10,@relation11,@relation12,@relation13,@relation14,@relation15,@relation16,@relation17,@relation18,@relation19,@relation20,@relation21,@relation22,@relation23,@relation24,@relation25,@relation26,@relation27,@relation28,@relation29,@relation30,@relation31,@relation32,@relation33,@relation34,@Name34,@severity_RawScore,@manage_RawScore,@relation_RawScore,@RawScore) ");
            SqlCommand cmd = new SqlCommand(sb.ToString(), conn);
            int        severity_RawScore, manage_RawScore, relation_RawScore, RawScore = 0;
            severity_RawScore = Convert.ToInt16(severity1.Text) + Convert.ToInt16(severity2.Text) + Convert.ToInt16(severity3.Text) + Convert.ToInt16(severity4.Text) + Convert.ToInt16(severity5.Text) + Convert.ToInt16(severity6.Text) + Convert.ToInt16(severity7.Text) + Convert.ToInt16(severity8.Text) + Convert.ToInt16(severity9.Text) + Convert.ToInt16(severity10.Text) + Convert.ToInt16(severity11.Text) + Convert.ToInt16(severity12.Text) + Convert.ToInt16(severity13.Text) + Convert.ToInt16(severity14.Text) + Convert.ToInt16(severity15.Text) + Convert.ToInt16(severity16.Text) + Convert.ToInt16(severity17.Text) + Convert.ToInt16(severity18.Text) + Convert.ToInt16(severity19.Text) + Convert.ToInt16(severity20.Text) + Convert.ToInt16(severity21.Text) + Convert.ToInt16(severity22.Text) + Convert.ToInt16(severity23.Text) + Convert.ToInt16(severity24.Text) + Convert.ToInt16(severity25.Text) + Convert.ToInt16(severity26.Text) + Convert.ToInt16(severity27.Text) + Convert.ToInt16(severity28.Text) + Convert.ToInt16(severity29.Text) + Convert.ToInt16(severity30.Text) + Convert.ToInt16(severity31.Text) + Convert.ToInt16(severity32.Text) + Convert.ToInt16(severity33.Text) + Convert.ToInt16(severity34.Text);
            manage_RawScore   = Convert.ToInt16(manage1.Text) + Convert.ToInt16(manage2.Text) + Convert.ToInt16(manage3.Text) + Convert.ToInt16(manage4.Text) + Convert.ToInt16(manage5.Text) + Convert.ToInt16(manage6.Text) + Convert.ToInt16(manage7.Text) + Convert.ToInt16(manage8.Text) + Convert.ToInt16(manage9.Text) + Convert.ToInt16(manage10.Text) + Convert.ToInt16(manage11.Text) + Convert.ToInt16(manage12.Text) + Convert.ToInt16(manage13.Text) + Convert.ToInt16(manage14.Text) + Convert.ToInt16(manage15.Text) + Convert.ToInt16(manage16.Text) + Convert.ToInt16(manage17.Text) + Convert.ToInt16(manage18.Text) + Convert.ToInt16(manage19.Text) + Convert.ToInt16(manage20.Text) + Convert.ToInt16(manage21.Text) + Convert.ToInt16(manage22.Text) + Convert.ToInt16(manage23.Text) + Convert.ToInt16(manage24.Text) + Convert.ToInt16(manage25.Text) + Convert.ToInt16(manage26.Text) + Convert.ToInt16(manage27.Text) + Convert.ToInt16(manage28.Text) + Convert.ToInt16(manage29.Text) + Convert.ToInt16(manage30.Text) + Convert.ToInt16(manage31.Text) + Convert.ToInt16(manage32.Text) + Convert.ToInt16(manage33.Text) + Convert.ToInt16(manage34.Text);
            relation_RawScore = Convert.ToInt16(relation1.Text) + Convert.ToInt16(relation2.Text) + Convert.ToInt16(relation3.Text) + Convert.ToInt16(relation4.Text) + Convert.ToInt16(relation5.Text) + Convert.ToInt16(relation6.Text) + Convert.ToInt16(relation7.Text) + Convert.ToInt16(relation8.Text) + Convert.ToInt16(relation9.Text) + Convert.ToInt16(relation10.Text) + Convert.ToInt16(relation11.Text) + Convert.ToInt16(relation12.Text) + Convert.ToInt16(relation13.Text) + Convert.ToInt16(relation14.Text) + Convert.ToInt16(relation15.Text) + Convert.ToInt16(relation16.Text) + Convert.ToInt16(relation17.Text) + Convert.ToInt16(relation18.Text) + Convert.ToInt16(relation19.Text) + Convert.ToInt16(relation20.Text) + Convert.ToInt16(relation21.Text) + Convert.ToInt16(relation22.Text) + Convert.ToInt16(relation23.Text) + Convert.ToInt16(relation24.Text) + Convert.ToInt16(relation25.Text) + Convert.ToInt16(relation26.Text) + Convert.ToInt16(relation27.Text) + Convert.ToInt16(relation28.Text) + Convert.ToInt16(relation29.Text) + Convert.ToInt16(relation30.Text) + Convert.ToInt16(relation31.Text) + Convert.ToInt16(relation32.Text) + Convert.ToInt16(relation33.Text) + Convert.ToInt16(relation34.Text);
            RawScore          = severity_RawScore + manage_RawScore + relation_RawScore;
            cmd.Parameters.AddWithValue("@GUID", GUID.Text);
            cmd.Parameters.AddWithValue("@TestName", TestName.Text);
            cmd.Parameters.AddWithValue("@PatientGUID", PatientGUID.Text);
            cmd.Parameters.AddWithValue("@StartDT", StartDT.Text);
            cmd.Parameters.AddWithValue("@EndDT", EndDT.Text);
            cmd.Parameters.AddWithValue("@DoctorGUID", DoctorGUID.Text);
            cmd.Parameters.AddWithValue("@severity1", severity1.Text);
            cmd.Parameters.AddWithValue("@severity2", severity2.Text);
            cmd.Parameters.AddWithValue("@severity3", severity3.Text);
            cmd.Parameters.AddWithValue("@severity4", severity4.Text);
            cmd.Parameters.AddWithValue("@severity5", severity5.Text);
            cmd.Parameters.AddWithValue("@severity6", severity6.Text);
            cmd.Parameters.AddWithValue("@severity7", severity7.Text);
            cmd.Parameters.AddWithValue("@severity8", severity8.Text);
            cmd.Parameters.AddWithValue("@severity9", severity9.Text);
            cmd.Parameters.AddWithValue("@severity10", severity10.Text);
            cmd.Parameters.AddWithValue("@severity11", severity11.Text);
            cmd.Parameters.AddWithValue("@severity12", severity12.Text);
            cmd.Parameters.AddWithValue("@severity13", severity13.Text);
            cmd.Parameters.AddWithValue("@severity14", severity14.Text);
            cmd.Parameters.AddWithValue("@severity15", severity15.Text);
            cmd.Parameters.AddWithValue("@severity16", severity16.Text);
            cmd.Parameters.AddWithValue("@severity17", severity17.Text);
            cmd.Parameters.AddWithValue("@severity18", severity18.Text);
            cmd.Parameters.AddWithValue("@severity19", severity19.Text);
            cmd.Parameters.AddWithValue("@severity20", severity20.Text);
            cmd.Parameters.AddWithValue("@severity21", severity21.Text);
            cmd.Parameters.AddWithValue("@severity22", severity22.Text);
            cmd.Parameters.AddWithValue("@severity23", severity23.Text);
            cmd.Parameters.AddWithValue("@severity24", severity24.Text);
            cmd.Parameters.AddWithValue("@severity25", severity25.Text);
            cmd.Parameters.AddWithValue("@severity26", severity26.Text);
            cmd.Parameters.AddWithValue("@severity27", severity27.Text);
            cmd.Parameters.AddWithValue("@severity28", severity28.Text);
            cmd.Parameters.AddWithValue("@severity29", severity29.Text);
            cmd.Parameters.AddWithValue("@severity30", severity30.Text);
            cmd.Parameters.AddWithValue("@severity31", severity31.Text);
            cmd.Parameters.AddWithValue("@severity32", severity32.Text);
            cmd.Parameters.AddWithValue("@severity33", severity33.Text);
            cmd.Parameters.AddWithValue("@severity34", severity34.Text);
            cmd.Parameters.AddWithValue("@manage1", manage1.Text);
            cmd.Parameters.AddWithValue("@manage2", manage2.Text);
            cmd.Parameters.AddWithValue("@manage3", manage3.Text);
            cmd.Parameters.AddWithValue("@manage4", manage4.Text);
            cmd.Parameters.AddWithValue("@manage5", manage5.Text);
            cmd.Parameters.AddWithValue("@manage6", manage6.Text);
            cmd.Parameters.AddWithValue("@manage7", manage7.Text);
            cmd.Parameters.AddWithValue("@manage8", manage8.Text);
            cmd.Parameters.AddWithValue("@manage9", manage9.Text);
            cmd.Parameters.AddWithValue("@manage10", manage10.Text);
            cmd.Parameters.AddWithValue("@manage11", manage11.Text);
            cmd.Parameters.AddWithValue("@manage12", manage12.Text);
            cmd.Parameters.AddWithValue("@manage13", manage13.Text);
            cmd.Parameters.AddWithValue("@manage14", manage14.Text);
            cmd.Parameters.AddWithValue("@manage15", manage15.Text);
            cmd.Parameters.AddWithValue("@manage16", manage16.Text);
            cmd.Parameters.AddWithValue("@manage17", manage17.Text);
            cmd.Parameters.AddWithValue("@manage18", manage18.Text);
            cmd.Parameters.AddWithValue("@manage19", manage19.Text);
            cmd.Parameters.AddWithValue("@manage20", manage20.Text);
            cmd.Parameters.AddWithValue("@manage21", manage21.Text);
            cmd.Parameters.AddWithValue("@manage22", manage22.Text);
            cmd.Parameters.AddWithValue("@manage23", manage23.Text);
            cmd.Parameters.AddWithValue("@manage24", manage24.Text);
            cmd.Parameters.AddWithValue("@manage25", manage25.Text);
            cmd.Parameters.AddWithValue("@manage26", manage26.Text);
            cmd.Parameters.AddWithValue("@manage27", manage27.Text);
            cmd.Parameters.AddWithValue("@manage28", manage28.Text);
            cmd.Parameters.AddWithValue("@manage29", manage29.Text);
            cmd.Parameters.AddWithValue("@manage30", manage30.Text);
            cmd.Parameters.AddWithValue("@manage31", manage31.Text);
            cmd.Parameters.AddWithValue("@manage32", manage32.Text);
            cmd.Parameters.AddWithValue("@manage33", manage33.Text);
            cmd.Parameters.AddWithValue("@manage34", manage34.Text);
            cmd.Parameters.AddWithValue("@relation1", relation1.Text);
            cmd.Parameters.AddWithValue("@relation2", relation2.Text);
            cmd.Parameters.AddWithValue("@relation3", relation3.Text);
            cmd.Parameters.AddWithValue("@relation4", relation4.Text);
            cmd.Parameters.AddWithValue("@relation5", relation5.Text);
            cmd.Parameters.AddWithValue("@relation6", relation6.Text);
            cmd.Parameters.AddWithValue("@relation7", relation7.Text);
            cmd.Parameters.AddWithValue("@relation8", relation8.Text);
            cmd.Parameters.AddWithValue("@relation9", relation9.Text);
            cmd.Parameters.AddWithValue("@relation10", relation10.Text);
            cmd.Parameters.AddWithValue("@relation11", relation11.Text);
            cmd.Parameters.AddWithValue("@relation12", relation12.Text);
            cmd.Parameters.AddWithValue("@relation13", relation13.Text);
            cmd.Parameters.AddWithValue("@relation14", relation14.Text);
            cmd.Parameters.AddWithValue("@relation15", relation15.Text);
            cmd.Parameters.AddWithValue("@relation16", relation16.Text);
            cmd.Parameters.AddWithValue("@relation17", relation17.Text);
            cmd.Parameters.AddWithValue("@relation18", relation18.Text);
            cmd.Parameters.AddWithValue("@relation19", relation19.Text);
            cmd.Parameters.AddWithValue("@relation20", relation20.Text);
            cmd.Parameters.AddWithValue("@relation21", relation21.Text);
            cmd.Parameters.AddWithValue("@relation22", relation22.Text);
            cmd.Parameters.AddWithValue("@relation23", relation23.Text);
            cmd.Parameters.AddWithValue("@relation24", relation24.Text);
            cmd.Parameters.AddWithValue("@relation25", relation25.Text);
            cmd.Parameters.AddWithValue("@relation26", relation26.Text);
            cmd.Parameters.AddWithValue("@relation27", relation27.Text);
            cmd.Parameters.AddWithValue("@relation28", relation28.Text);
            cmd.Parameters.AddWithValue("@relation29", relation29.Text);
            cmd.Parameters.AddWithValue("@relation30", relation30.Text);
            cmd.Parameters.AddWithValue("@relation31", relation31.Text);
            cmd.Parameters.AddWithValue("@relation32", relation32.Text);
            cmd.Parameters.AddWithValue("@relation33", relation33.Text);
            cmd.Parameters.AddWithValue("@relation34", relation34.Text);
            cmd.Parameters.AddWithValue("@Name34", Name34.Text);
            cmd.Parameters.AddWithValue("@severity_RawScore", Util.AESEncrypt(severity_RawScore.ToString()));
            cmd.Parameters.AddWithValue("@manage_RawScore", Util.AESEncrypt(manage_RawScore.ToString()));
            cmd.Parameters.AddWithValue("@relation_RawScore", Util.AESEncrypt(relation_RawScore.ToString()));
            cmd.Parameters.AddWithValue("@RawScore", Util.AESEncrypt(RawScore.ToString()));



            conn.Open();
            i = cmd.ExecuteNonQuery();



            if (i == 1)
            {
                if (Session["Code"] == null)
                {
                    Response.Write(" <script> alert(\"成功提交!\");;window.location='R20.aspx?TGUID=" + GUID.Text + "&TNum=20'; </script> ");
                }
                else
                {
                    Response.Write(" <script> window.location='Login.aspx'; </script> "); //自评测试完成后回到登录页
                    DelectCode();                                                         //删除已完成的自评码
                }
            }
            else
            {
                Response.Write(" <script> alert(\"提交失败!请重试或关闭页面。\"); </script> ");
            }
        }
    }
Example #9
0
    private void InsertDatabase()
    {
        int i = 0;

        EndDT.Text = DateTime.Now.ToString();

        decimal RawScore, RS1, RS2, RS3, RS4, RSAverage, A, B, C, D, RS = 0;
        double  RSRS = 0;

        RSRS = ((Convert.ToDouble(DDL1.SelectedValue) + Convert.ToDouble(DDL2.SelectedValue) + Convert.ToDouble(DDL3.SelectedValue) + Convert.ToDouble(DDL4.SelectedValue) + Convert.ToDouble(DDL5.SelectedValue) + Convert.ToDouble(DDL6.SelectedValue)) / 6);
        RS1  = Convert.ToDecimal(RSRS);

        RSRS = ((Convert.ToDouble(DDL7.SelectedValue) + Convert.ToDouble(DDL8.SelectedValue) + Convert.ToDouble(DDL9.SelectedValue) + Convert.ToDouble(DDL10.SelectedValue) + Convert.ToDouble(DDL11.SelectedValue) + Convert.ToDouble(DDL12.SelectedValue)) / 6);
        RS2  = Convert.ToDecimal(RSRS);

        RSRS = ((Convert.ToDouble(DDL13.SelectedValue) + Convert.ToDouble(DDL14.SelectedValue) + Convert.ToDouble(DDL15.SelectedValue) + Convert.ToDouble(DDL16.SelectedValue)) / 4);
        RS3  = Convert.ToDecimal(RSRS);

        RSRS = ((Convert.ToDouble(DDL17.SelectedValue) + Convert.ToDouble(DDL18.SelectedValue) + Convert.ToDouble(DDL19.SelectedValue) + Convert.ToDouble(DDL20.SelectedValue) + Convert.ToDouble(DDL21.SelectedValue) + Convert.ToDouble(DDL22.SelectedValue) + Convert.ToDouble(DDL23.SelectedValue)) / 7);
        RS4  = Convert.ToDecimal(RSRS);

        RSAverage = 10 - ((RS1 + RS2 + RS3 + RS4) / 4) * 2;
        RSAverage = Math.Round(RSAverage, 1);
        A         = Math.Round(RS2, 0);
        B         = Math.Round(RS3, 0);
        C         = Math.Round(RS1, 0);
        D         = Math.Round(RS4, 0);

        if (D == 0)
        {
            if (A == 0 && B == 0 && C == 0)
            {
                if (RS1 < Convert.ToDecimal(0.3) && RS2 < Convert.ToDecimal(0.3) && RS3 < Convert.ToDecimal(0.3))
                {
                    RS = 90;
                }
                else
                {
                    RS = 80;
                }
            }
            else if ((A == 1 && B <= 1 && C <= 1) || (B == 1 && A <= 1 && C <= 1) || (C == 1 && B <= 1 && A <= 1))
            {
                RS = 70;
            }
            else if ((A == 2 && B <= 2 && C <= 2) || (C == 2 && B <= 2 && A <= 2) || (A == 2 && C <= 2 && B <= 2))
            {
                RS = 60;
            }
            else if ((A == 3 && B < 3 && C < 3) || (C == 3 && B < 3 && A < 3) || (A == 3 && C < 3 && B < 3))
            {
                RS = 50;
            }
            else if ((A == 3 && B == 3 && C <= 3) || (C == 3 && B == 3 && A <= 3) || (A == 3 && C == 3 && B <= 3) || (A == 4 && B < 3 && C < 3) || (C == 4 && B < 3 && A < 3) || (A == 4 && C < 3 && B < 3))
            {
                RS = 40;
            }
            else if ((A == 4 && B == 3 && C <= 3) || (A == 4 && C == 3 && B <= 3) || (C == 4 && B == 3 && A <= 3))
            {
                RS = 30;
            }
            else if ((A == 4 && B == 4 && C <= 3) || (A == 4 && C == 4 && B <= 3) || (C == 4 && B == 4 && A <= 3))
            {
                RS = 20;
            }
            else if (A == 4 && B == 4 && C == 4)
            {
                RS = 15;
            }
            else if ((A == 4 && B == 4 && C > 4) || (A == 4 && C == 4 && B > 4) || (C == 4 && B == 4 && A > 4))
            {
                RS = 10;
            }
            else if ((A == 5 && B == 5 && C <= 4) || (A == 5 && C == 5 && B <= 4) || (C == 5 && B == 5 && A <= 4))
            {
                RS = 6;
            }
            else if (A == 5 && B == 5 && C == 5)
            {
                RS = 1;
            }
            else
            {
                RS = 0;
            }
        }
        else if (D == 1)
        {
            if ((A == 3 && B < 3 && C < 3) || (C == 3 && B < 3 && A < 3) || (A == 3 && C < 3 && B < 3))
            {
                RS = 50;
            }
            else if ((A == 3 && B == 3 && C <= 3) || (C == 3 && B == 3 && A <= 3) || (A == 3 && C == 3 && B <= 3) || (A == 4 && B < 3 && C < 3) || (C == 4 && B < 3 && A < 3) || (A == 4 && C < 3 && B < 3))
            {
                RS = 40;
            }
            else if ((A == 4 && B == 3 && C <= 3) || (A == 4 && C == 3 && B <= 3) || (C == 4 && B == 3 && A <= 3))
            {
                RS = 30;
            }
            else if ((A == 4 && B == 4 && C <= 3) || (A == 4 && C == 4 && B <= 3) || (C == 4 && B == 4 && A <= 3))
            {
                RS = 20;
            }
            else if (A == 4 && B == 4 && C == 4)
            {
                RS = 15;
            }
            else if ((A == 4 && B == 4 && C > 4) || (A == 4 && C == 4 && B > 4) || (C == 4 && B == 4 && A > 4))
            {
                RS = 10;
            }
            else if ((A == 5 && B == 5 && C <= 4) || (A == 5 && C == 5 && B <= 4) || (C == 5 && B == 5 && A <= 4))
            {
                RS = 6;
            }
            else if (A == 5 && B == 5 && C == 5)
            {
                RS = 1;
            }

            else
            {
                RS = 60;
            }
        }
        else if (D == 2)
        {
            if ((A == 3 && B == 3 && C <= 3) || (C == 3 && B == 3 && A <= 3) || (A == 3 && C == 3 && B <= 3) || (A == 4 && B < 3 && C < 3) || (C == 4 && B < 3 && A < 3) || (A == 4 && C < 3 && B < 3))
            {
                RS = 40;
            }
            else if ((A == 4 && B == 3 && C <= 3) || (A == 4 && C == 3 && B <= 3) || (C == 4 && B == 3 && A <= 3))
            {
                RS = 30;
            }
            else if ((A == 4 && B == 4 && C <= 3) || (A == 4 && C == 4 && B <= 3) || (C == 4 && B == 4 && A <= 3))
            {
                RS = 20;
            }
            else if (A == 4 && B == 4 && C == 4)
            {
                RS = 15;
            }
            else if ((A == 4 && B == 4 && C > 4) || (A == 4 && C == 4 && B > 4) || (C == 4 && B == 4 && A > 4))
            {
                RS = 10;
            }
            else if ((A == 5 && B == 5 && C <= 4) || (A == 5 && C == 5 && B <= 4) || (C == 5 && B == 5 && A <= 4))
            {
                RS = 6;
            }
            else if (A == 5 && B == 5 && C == 5)
            {
                RS = 1;
            }
            else
            {
                RS = 50;
            }
        }
        else if (D == 3)
        {
            if ((A == 4 && B == 4 && C <= 3) || (A == 4 && C == 4 && B <= 3) || (C == 4 && B == 4 && A <= 3))
            {
                RS = 20;
            }
            else if (A == 4 && B == 4 && C == 4)
            {
                RS = 15;
            }
            else if ((A == 4 && B == 4 && C > 4) || (A == 4 && C == 4 && B > 4) || (C == 4 && B == 4 && A > 4))
            {
                RS = 10;
            }
            else if ((A == 5 && B == 5 && C <= 4) || (A == 5 && C == 5 && B <= 4) || (C == 5 && B == 5 && A <= 4))
            {
                RS = 6;
            }
            else if (A == 5 && B == 5 && C == 5)
            {
                RS = 1;
            }
            else
            {
                RS = 30;
            }
        }
        else if (D == 4)
        {
            if (A == 4 && B == 4 && C == 4)
            {
                RS = 15;
            }
            else if ((A == 4 && B == 4 && C > 4) || (A == 4 && C == 4 && B > 4) || (C == 4 && B == 4 && A > 4))
            {
                RS = 10;
            }
            else if ((A == 5 && B == 5 && C <= 4) || (A == 5 && C == 5 && B <= 4) || (C == 5 && B == 5 && A <= 4))
            {
                RS = 6;
            }
            else if (A == 5 && B == 5 && C == 5)
            {
                RS = 1;
            }
            else
            {
                RS = 20;
            }
        }
        else
        {
            //if (A + B + C <= 4) { RS = 16; }
            //if (4 < A + B + C && A + B + C <= 8) { RS = 11; }
            //if (8 < A + B + C && A + B + C <= 13) { RS = 6; }
            //if (13 < A + B + C && A + B + C <= 18) { RS = 1; }

            if ((A == 5 && B == 5 && C <= 4) || (A == 5 && C == 5 && B <= 4) || (C == 5 && B == 5 && A <= 4))
            {
                RS = 6;
            }
            else if (A == 5 && B == 5 && C == 5)
            {
                RS = 1;
            }
            else
            {
                RS = 10;
            }
        }



        RawScore = RS + RSAverage;



        using (SqlConnection conn = new DB().GetConnection())
        {
            StringBuilder sb = new StringBuilder("Insert into T2 ( GUID,TestName,PatientGUID,StartDT,EndDT,RawScore,RS1,RS2,RS3,RS4,DoctorGUID,C1,C2,C3,C4,C5,C6,A1,A2,A3,A4,A5,A6,B1,B2,B3,B4,D1,D2,D3,D4,D5,D6,D7) ");
            sb.Append(" values ( @GUID,@TestName,@PatientGUID,@StartDT,@EndDT,@RawScore,@RS1,@RS2,@RS3,@RS4,@DoctorGUID,@C1,@C2,@C3,@C4,@C5,@C6,@A1,@A2,@A3,@A4,@A5,@A6,@B1,@B2,@B3,@B4,@D1,@D2,@D3,@D4,@D5,@D6,@D7) ");
            SqlCommand cmd = new SqlCommand(sb.ToString(), conn);

            cmd.Parameters.AddWithValue("@GUID", GUID.Text);
            cmd.Parameters.AddWithValue("@TestName", TestName.Text);
            cmd.Parameters.AddWithValue("@PatientGUID", PatientGUID.Text);
            cmd.Parameters.AddWithValue("@StartDT", StartDT.Text);
            cmd.Parameters.AddWithValue("@EndDT", EndDT.Text);
            cmd.Parameters.AddWithValue("@RawScore", Util.AESEncrypt(RawScore.ToString()));
            cmd.Parameters.AddWithValue("@RS1", Util.AESEncrypt(RS1.ToString()));
            cmd.Parameters.AddWithValue("@RS2", Util.AESEncrypt(RS2.ToString()));
            cmd.Parameters.AddWithValue("@RS3", Util.AESEncrypt(RS3.ToString()));
            cmd.Parameters.AddWithValue("@RS4", Util.AESEncrypt(RS4.ToString()));
            cmd.Parameters.AddWithValue("@C1", Util.AESEncrypt(Convert.ToDecimal(DDL1.SelectedValue).ToString()));
            cmd.Parameters.AddWithValue("@C2", Util.AESEncrypt(Convert.ToDecimal(DDL2.SelectedValue).ToString()));
            cmd.Parameters.AddWithValue("@C3", Util.AESEncrypt(Convert.ToDecimal(DDL3.SelectedValue).ToString()));
            cmd.Parameters.AddWithValue("@C4", Util.AESEncrypt(Convert.ToDecimal(DDL4.SelectedValue).ToString()));
            cmd.Parameters.AddWithValue("@C5", Util.AESEncrypt(Convert.ToDecimal(DDL5.SelectedValue).ToString()));
            cmd.Parameters.AddWithValue("@C6", Util.AESEncrypt(Convert.ToDecimal(DDL6.SelectedValue).ToString()));
            cmd.Parameters.AddWithValue("@A1", Util.AESEncrypt(Convert.ToDecimal(DDL7.SelectedValue).ToString()));
            cmd.Parameters.AddWithValue("@A2", Util.AESEncrypt(Convert.ToDecimal(DDL8.SelectedValue).ToString()));
            cmd.Parameters.AddWithValue("@A3", Util.AESEncrypt(Convert.ToDecimal(DDL9.SelectedValue).ToString()));
            cmd.Parameters.AddWithValue("@A4", Util.AESEncrypt(Convert.ToDecimal(DDL10.SelectedValue).ToString()));
            cmd.Parameters.AddWithValue("@A5", Util.AESEncrypt(Convert.ToDecimal(DDL11.SelectedValue).ToString()));
            cmd.Parameters.AddWithValue("@A6", Util.AESEncrypt(Convert.ToDecimal(DDL12.SelectedValue).ToString()));
            cmd.Parameters.AddWithValue("@B1", Util.AESEncrypt(Convert.ToDecimal(DDL13.SelectedValue).ToString()));
            cmd.Parameters.AddWithValue("@B2", Util.AESEncrypt(Convert.ToDecimal(DDL14.SelectedValue).ToString()));
            cmd.Parameters.AddWithValue("@B3", Util.AESEncrypt(Convert.ToDecimal(DDL15.SelectedValue).ToString()));
            cmd.Parameters.AddWithValue("@B4", Util.AESEncrypt(Convert.ToDecimal(DDL16.SelectedValue).ToString()));
            cmd.Parameters.AddWithValue("@D1", Util.AESEncrypt(Convert.ToDecimal(DDL17.SelectedValue).ToString()));
            cmd.Parameters.AddWithValue("@D2", Util.AESEncrypt(Convert.ToDecimal(DDL18.SelectedValue).ToString()));
            cmd.Parameters.AddWithValue("@D3", Util.AESEncrypt(Convert.ToDecimal(DDL19.SelectedValue).ToString()));
            cmd.Parameters.AddWithValue("@D4", Util.AESEncrypt(Convert.ToDecimal(DDL20.SelectedValue).ToString()));
            cmd.Parameters.AddWithValue("@D5", Util.AESEncrypt(Convert.ToDecimal(DDL21.SelectedValue).ToString()));
            cmd.Parameters.AddWithValue("@D6", Util.AESEncrypt(Convert.ToDecimal(DDL22.SelectedValue).ToString()));
            cmd.Parameters.AddWithValue("@D7", Util.AESEncrypt(Convert.ToDecimal(DDL23.SelectedValue).ToString()));


            cmd.Parameters.AddWithValue("@DoctorGUID", DoctorGUID.Text);

            conn.Open();
            i = cmd.ExecuteNonQuery();


            if (i == 1)
            {
                if (Session["Code"] == null)
                {
                    Response.Write(" <script> alert(\"成功提交!\");;window.location='R2.aspx?TGUID=" + GUID.Text + "&TNum=2'; </script> ");
                }
                else
                {
                    Response.Write(" <script> window.location='Login.aspx'; </script> "); //自评测试完成后回到登录页
                    DelectCode();                                                         //删除已完成的自评码
                }
            }
            else
            {
                Response.Write(" <script> alert(\"提交失败!请重试或关闭页面。\"); </script> ");
            }
        }
    }