Răsfoiți Sursa

补全剩下所有的题目信息

+剩余题目信息补全
- 修改大部分题目由2选项变成12选项(考虑疼痛问题)
- 添加回答对应报告模板支持自定义模板名称功能
- 修改历史报告部分排序结果不正确问题
- 删除两个用不上的类
ZhuYifan 5 ani în urmă
părinte
comite
48cb6bed6e

+ 3 - 2
WpfTest1/MainWindow.xaml

@@ -255,9 +255,9 @@
                             <Label x:Name="labelQuestionNumberofCurrentQuestion" Content="XXX" HorizontalAlignment="Left" Margin="150,10,0,0" VerticalAlignment="Top" FontSize="18"/>
                             <Label x:Name="labelTi2E" Content="题" HorizontalAlignment="Left" Margin="190,10,0,0" VerticalAlignment="Top" FontSize="18"/>
                             <Label x:Name="labelEvaluationQuestionTitle" Content="[问题的标题,大约需要30个汉字,所以空间需要够]" HorizontalAlignment="Left" Margin="90,36,0,0" VerticalAlignment="Top" FontSize="30"/>
-                            <TextBlock x:Name="textBlockEvaluationQuetionContent" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="94,90,0,0" TextWrapping="Wrap" Text="Here is the question content." Height="240" Width="745" FontSize="18"/>
+                            <TextBlock x:Name="textBlockEvaluationQuetionContent" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="94,90,0,0" TextWrapping="Wrap" Text="Here is the question content." Height="310" Width="745" FontSize="18"/>
                             <Image x:Name="imageEvaluationQuestion" HorizontalAlignment="Left" Width="348" Height="430" Margin="850,90,0,0" VerticalAlignment="Top" />
-                            <Grid x:Name="gridEvaluationSelection" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="94,340,0,0" Width="745" Height="200" ></Grid>
+                            <Grid x:Name="gridEvaluationSelection" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="94,400,0,0" Width="745" Height="120" ></Grid>
                             <Button x:Name="buttonEvaluationPrevious" Content="上一题" HorizontalAlignment="Left" Margin="424,550,0,0" VerticalAlignment="Top" Width="130" Height="50" FontSize="18" IsEnabled="False" Click="buttonEvaluationPrevious_Click" />
                             <Button x:Name="buttonEvaluationNext" Content="下一题" HorizontalAlignment="Left" Margin="784,550,0,0" VerticalAlignment="Top" Width="130" Height="50" FontSize="18" IsEnabled="False" Click="buttonEvaluationNext_Click" />
                             <Button x:Name="buttonSubmitEvaluation" Content="提交" HorizontalAlignment="Left" Margin="604,550,0,0" VerticalAlignment="Top" Width="130" Height="50" FontSize="18" Background="#FF317602" Foreground="White" IsEnabled="False" Click="buttonSubmitEvaluation_Click"/>
@@ -344,6 +344,7 @@
                                     <Button x:Name="buttonDeleteAllPdfReport" Content="点击清空" HorizontalAlignment="Left" Margin="600,50,0,0" VerticalAlignment="Top" Width="124" Click="buttonDeleteFiles_Click"/>
                                 </Grid>
                             </GroupBox>
+                            <Button x:Name="buttonTest1" Visibility="Hidden" Content="测试:循环插入" HorizontalAlignment="Left" Margin="10,334,0,0" VerticalAlignment="Top" Width="200" Click="buttonTest1_Click"/>
                         </Grid>
                     </TabItem>
                 </TabControl>

+ 18 - 7
WpfTest1/MainWindow.xaml.cs

@@ -507,7 +507,7 @@ namespace WpfTest1
                 oneOption.Height = 30;
                 oneOption.HorizontalAlignment = HorizontalAlignment.Left;
                 oneOption.VerticalAlignment = VerticalAlignment.Top;
-                oneOption.Margin = new Thickness(i/5*200, i%5*40, 0, 0);
+                oneOption.Margin = new Thickness(i/6*300, i%6*30, 0, 0);
                 if(filterUserSelection[currentIndex-1].a_id == filterQuestionaire[currentIndex - 1].answers[i].a_id)
                     oneOption.IsChecked = true;
                 else
@@ -729,17 +729,17 @@ namespace WpfTest1
                 oneOption.Height = 30;
                 oneOption.HorizontalAlignment = HorizontalAlignment.Left;
                 oneOption.VerticalAlignment = VerticalAlignment.Top;
-                oneOption.Margin = new Thickness(i / 5 * 200, i % 5 * 40, 0, 0);
+                oneOption.Margin = new Thickness(i / 4 * 280, i % 4 * 30, 0, 0);
                 if (evaluationUserSelection[currentIndex - 1].a_id == evaluationQuestionaire[currentIndex - 1].answers[i].a_id)
                     oneOption.IsChecked = true;
                 else
                     oneOption.IsChecked = false;
                 oneOption.Content = String.Format("[选项{0}]:{1}", i + 1, evaluationQuestionaire[currentIndex - 1].answers[i].a_content);
-               oneOption.Checked += radioButtonEvaluation_Checked;
-               oneOption.GroupName = "evaluationOption";
-               oneOption.FontSize = 18;
-               oneOption.Name = "rbe" + evaluationQuestionaire[currentIndex - 1].answers[i].a_id.ToString();
-               gridEvaluationSelection.Children.Add(oneOption);
+                oneOption.Checked += radioButtonEvaluation_Checked;
+                oneOption.GroupName = "evaluationOption";
+                oneOption.FontSize = 18;
+                oneOption.Name = "rbe" + evaluationQuestionaire[currentIndex - 1].answers[i].a_id.ToString();
+                gridEvaluationSelection.Children.Add(oneOption);
             }
         }
 
@@ -1437,5 +1437,16 @@ namespace WpfTest1
         #endregion
 
         #endregion
+
+        #region 测试功能
+        private void buttonTest1_Click(object sender, RoutedEventArgs e)
+        {
+            int res_flag = SQLiteModel.loopInsertAnswers();
+            if(res_flag == 0)
+            {
+                MessageBox.Show("操作成功");
+            }
+        }
+        #endregion
     }
 }

+ 0 - 15
WpfTest1/SQLite/CommonWords.cs

@@ -1,15 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace WpfTest1.SQLite
-{
-    public class CommonWords
-    {
-        public int id { get; set; }
-        public string content { get; set; }
-        public string describe { get; set; }
-    }
-}

+ 0 - 31
WpfTest1/SQLite/Run.cs

@@ -1,31 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace WpfTest1.SQLite
-{
-    class RunOld
-    {
-        public void RunProgress(int range, SetProgressValueEventHandler setProgressBar)
-        {
-            try
-            {
-                for (int i = 0; i < range; i++)
-                {
-                    Thread.Sleep(100);
-                    //int p = 10 / (i - 10);//此处为了验证程序错误响应处理,当i=10时触发异常
-                    setProgressBar(i * 100 / range);
-                }
-                setProgressBar(100);//耗时任务结束,进度条达到100;
-            }
-            catch (System.Exception ex)
-            {
-                System.Console.WriteLine(ex.Message);
-                setProgressBar(101);//处理任务失败,向进度窗口传递消息传递值大于100或小于0的数
-            }
-        }
-    }
-}

+ 28 - 1
WpfTest1/SQLite/SQLiteModel.cs

@@ -424,6 +424,33 @@ namespace WpfTest1.SQLite
             }
             return null;
         }
+
+        public static int loopInsertAnswers()
+        {
+            int start_a_id = 182;
+            for(int i = 1; i <= 6; ++i)
+            {
+                int new_i = 9 + (i - 1) * 3;
+                for(int j = 1; j <= 10; ++j)
+                {
+                    string sql = "INSERT INTO Answer_template(a_id,q_id,a_content,a_value,a_description_text)" +
+                                       "values(@a_id,@q_id,@a_content,@a_value,@a_description_text)";
+                    SQLiteHelper db = new SQLiteHelper(dbPath);
+                    SQLiteParameter[] parameters = new SQLiteParameter[]{
+                                                               new SQLiteParameter("@a_id",start_a_id),
+                                                               new SQLiteParameter("@q_id",new_i),
+                                                               new SQLiteParameter("@a_content","疼痛:"+j+"分"),
+                                                               new SQLiteParameter("@a_value",2.ToString()),
+                                                               //new SQLiteParameter("@next_q_id",),
+                                                               new SQLiteParameter("@a_description_text",(27+(i-1)*6).ToString()+".pdf")
+                                                               };
+                    db.ExecuteNonQuery(sql, parameters);
+                    ++start_a_id;
+                }
+            }
+            return 0;
+        }
+
         #endregion
 
         #region Record表相关操作
@@ -503,7 +530,7 @@ namespace WpfTest1.SQLite
         /// <param name="r_id">记录ID</param>
         public static List<Record> getRecordsByPid(int p_id)
         {
-            string sql = "SELECT * FROM Record WHERE p_id=@p_id";
+            string sql = "SELECT * FROM Record WHERE p_id=@p_id order by r_time desc";
             SQLiteHelper db = new SQLiteHelper(dbPath);
             SQLiteParameter[] parameters = new SQLiteParameter[]{
                                                                new SQLiteParameter("@p_id",p_id),

+ 2 - 2
WpfTest1/Toolkits/Constants.cs

@@ -12,9 +12,9 @@ namespace WpfTest1.Toolkits
         //软件名称
         public static string softwareName = "劳拉系统";
         //编译版本
-        public static string version = "0.1.0.1";
+        public static string version = "0.1.1.1";
         //编译日期
-        public static string compileDate = "20200311";
+        public static string compileDate = "20200331";
         //加密狗验证所使用的pid
         public static string registerPid = "3DE6BA91";
         //加密狗验证所使用的uid

+ 9 - 5
WpfTest1/Toolkits/ReportGenerater.cs

@@ -90,7 +90,8 @@ namespace WpfTest1.Toolkits
             
             var jsonUserSelections = oneRecord.r_selection;
             List<SQLite.UserSelection> uss = JsonMapper.ToObject<List<SQLite.UserSelection>>(jsonUserSelections);
-            foreach(SQLite.UserSelection us in uss)
+            bool pdfMergeFlag = false;
+            foreach (SQLite.UserSelection us in uss)
             {
                 SQLite.Question qTemp = SQLite.SQLiteModel.getQuestionById(us.q_id);
                 SQLite.Answer aTemp = SQLite.SQLiteModel.getAnswerById(us.a_id);
@@ -103,7 +104,7 @@ namespace WpfTest1.Toolkits
                 else
                 {
                     //判断PDF模板(0,1,2分)是否存在,如存在则直接调用模板
-                    string templateName = Constants.template + "\\" + aTemp.a_id.ToString() + ".pdf";
+                    string templateName = Constants.template + "\\" + aTemp.a_description_img;
                     if (File.Exists(templateName))
                     {
                         PdfReader readerTemp = new PdfReader(templateName);
@@ -112,15 +113,17 @@ namespace WpfTest1.Toolkits
                         int iPageNum = readerTemp.NumberOfPages;
                         for (int j = 1; j <= iPageNum; j++)
                         {
-                            //document.NewPage();
+                            document.NewPage();
                             newPage = writer.GetImportedPage(readerTemp, j);
                             cb.AddTemplate(newPage, 0, 0);
                         }
+                        pdfMergeFlag = true;
                     }
                     else
                     {
-                        //document.NewPage();
-                        var questionTitle = new Paragraph(String.Format("{0}:{1}", qTemp.q_title, aTemp.a_content), new Font(baseFont, 13, Font.NORMAL, BaseColor.BLACK));
+                        if(pdfMergeFlag)
+                            document.NewPage();
+                        var questionTitle = new Paragraph(String.Format("{0}:{1}(该动作合计{2}分)", qTemp.q_title, aTemp.a_content, aTemp.a_value), new Font(baseFont, 13, Font.NORMAL, BaseColor.BLACK));
                         document.Add(questionTitle);
                         if (aTemp.a_description_text != "")
                         {
@@ -132,6 +135,7 @@ namespace WpfTest1.Toolkits
                             var suggestion = new Paragraph(String.Format("建议:\n    {0}", aTemp.a_suggestion_text), new Font(baseFont, 13, Font.NORMAL, BaseColor.BLACK));
                             document.Add(suggestion);
                         }
+                        pdfMergeFlag = false;
                     }
                     
                 }

+ 0 - 2
WpfTest1/WpTest.csproj

@@ -200,7 +200,6 @@
     <Compile Include="SQLite\UserSelection.cs" />
     <Compile Include="SQLite\QuestionAnswerPair.cs" />
     <Compile Include="SQLite\Question.cs" />
-    <Compile Include="SQLite\Run.cs" />
     <Compile Include="Toolkits\Config.cs" />
     <Compile Include="Exceptions\ExpressionCalculateExpression.cs" />
     <Compile Include="Exceptions\ExpressionFindFailedException.cs" />
@@ -226,7 +225,6 @@
     <Compile Include="selectUser.xaml.cs">
       <DependentUpon>selectUser.xaml</DependentUpon>
     </Compile>
-    <Compile Include="SQLite\CommonWords.cs" />
     <Compile Include="SQLite\doctor.cs" />
     <Compile Include="SQLite\Expression.cs" />
     <Compile Include="SQLite\Patient.cs" />