|
@@ -10,6 +10,7 @@ using System.Data;
|
|
using WpfTest1.SQLite;
|
|
using WpfTest1.SQLite;
|
|
using WpfTest1.Toolkits;
|
|
using WpfTest1.Toolkits;
|
|
using LitJson;
|
|
using LitJson;
|
|
|
|
+using System.ComponentModel;
|
|
|
|
|
|
namespace WpfTest1
|
|
namespace WpfTest1
|
|
{
|
|
{
|
|
@@ -27,16 +28,23 @@ namespace WpfTest1
|
|
//double lowBp; //BP界面低压
|
|
//double lowBp; //BP界面低压
|
|
DateTime lastSettingLogin; //上一次在系统设置界面登陆的时间
|
|
DateTime lastSettingLogin; //上一次在系统设置界面登陆的时间
|
|
public Toolkits.Config cfg; //从数据库取配置的类
|
|
public Toolkits.Config cfg; //从数据库取配置的类
|
|
- #endregion
|
|
|
|
|
|
|
|
- #region 优化系统效率参数
|
|
|
|
Patient filterPatient;
|
|
Patient filterPatient;
|
|
|
|
+ Patient evaluationPatient;
|
|
|
|
+ Patient historyPatient;
|
|
|
|
+ Record filterReportForEvaluation;
|
|
|
|
+ bool flagEvaluationWithoutFilter = true;
|
|
List<QuestionAnswerPair> filterQuestionaire = new List<QuestionAnswerPair>();
|
|
List<QuestionAnswerPair> filterQuestionaire = new List<QuestionAnswerPair>();
|
|
List<QuestionAnswerPair> evaluationQuestionaire = new List<QuestionAnswerPair>();
|
|
List<QuestionAnswerPair> evaluationQuestionaire = new List<QuestionAnswerPair>();
|
|
List<UserSelection> filterUserSelection = new List<UserSelection>();
|
|
List<UserSelection> filterUserSelection = new List<UserSelection>();
|
|
- List<UserSelection> evaluation = new List<UserSelection>();
|
|
|
|
|
|
+ List<UserSelection> evaluationUserSelection = new List<UserSelection>();
|
|
|
|
+ string resultsFilter;
|
|
|
|
+ string resultsEvaluation;
|
|
int currentFilterCount = 0;
|
|
int currentFilterCount = 0;
|
|
-
|
|
|
|
|
|
+ int currentEvaluationCount = 0;
|
|
|
|
+ List<Record> recordsFromOnePatient;
|
|
|
|
+ BindingList<Record> bindingRecords;
|
|
|
|
+
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
public MainWindow()
|
|
public MainWindow()
|
|
@@ -47,8 +55,9 @@ namespace WpfTest1
|
|
//绑定三个selectUser的父类
|
|
//绑定三个selectUser的父类
|
|
//selectUserMeasure.setMainWindow(this);
|
|
//selectUserMeasure.setMainWindow(this);
|
|
selectUserPatientManagent.setMainWindow(this);
|
|
selectUserPatientManagent.setMainWindow(this);
|
|
- //selectUserHistory.setMainWindow(this);
|
|
|
|
-
|
|
|
|
|
|
+ selectUserfilter.setMainWindow(this);
|
|
|
|
+ selectUserevaluation.setMainWindow(this);
|
|
|
|
+ selectUserHistory.setMainWindow(this);
|
|
}
|
|
}
|
|
|
|
|
|
#region 初始化与系统调用部分
|
|
#region 初始化与系统调用部分
|
|
@@ -89,7 +98,7 @@ namespace WpfTest1
|
|
List<Question> questions = SQLite.SQLiteModel.getQuestions(type);
|
|
List<Question> questions = SQLite.SQLiteModel.getQuestions(type);
|
|
foreach (Question oneQuestion in questions)
|
|
foreach (Question oneQuestion in questions)
|
|
{
|
|
{
|
|
- List<Answer> answers = SQLite.SQLiteModel.getAnswersByQid(oneQuestion.q_id.ToString());
|
|
|
|
|
|
+ List<Answer> answers = SQLite.SQLiteModel.getAnswersByQid(oneQuestion.q_id);
|
|
QuestionAnswerPair temp = new QuestionAnswerPair(oneQuestion, answers);
|
|
QuestionAnswerPair temp = new QuestionAnswerPair(oneQuestion, answers);
|
|
oneQuestionaire.Add(temp);
|
|
oneQuestionaire.Add(temp);
|
|
}
|
|
}
|
|
@@ -270,6 +279,9 @@ namespace WpfTest1
|
|
private void buttonAbortFilter_Click(object sender, RoutedEventArgs e)
|
|
private void buttonAbortFilter_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
{
|
|
filterUserSelection.Clear();
|
|
filterUserSelection.Clear();
|
|
|
|
+ filterPatient = null;
|
|
|
|
+ resultsFilter = "";
|
|
|
|
+
|
|
currentFilterCount = 0;
|
|
currentFilterCount = 0;
|
|
buttonFilterPrevious.IsEnabled = false;
|
|
buttonFilterPrevious.IsEnabled = false;
|
|
buttonFilterNext.IsEnabled = false;
|
|
buttonFilterNext.IsEnabled = false;
|
|
@@ -341,6 +353,7 @@ namespace WpfTest1
|
|
{
|
|
{
|
|
labelFilterNumberofTotalQuestions.Content = filterQuestionaire.Count.ToString();
|
|
labelFilterNumberofTotalQuestions.Content = filterQuestionaire.Count.ToString();
|
|
labelFilterNumberofCurrentQuestion.Content = currentIndex.ToString();
|
|
labelFilterNumberofCurrentQuestion.Content = currentIndex.ToString();
|
|
|
|
+ labelFilterQuestionTitle.Content = filterQuestionaire[currentIndex - 1].question.q_title;
|
|
textBlockFilterQuetionContent.Text = filterQuestionaire[currentIndex - 1].question.q_content;
|
|
textBlockFilterQuetionContent.Text = filterQuestionaire[currentIndex - 1].question.q_content;
|
|
int countOptions = filterQuestionaire[currentIndex - 1].answers.Count;
|
|
int countOptions = filterQuestionaire[currentIndex - 1].answers.Count;
|
|
gridFilterSelection.Children.Clear();
|
|
gridFilterSelection.Children.Clear();
|
|
@@ -381,27 +394,507 @@ namespace WpfTest1
|
|
/// <param name="e">默认</param>
|
|
/// <param name="e">默认</param>
|
|
private void buttonSubmitFilter_Click(object sender, RoutedEventArgs e)
|
|
private void buttonSubmitFilter_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
{
|
|
- MessageBoxResult dr = MessageBox.Show("确定提交吗?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Question);
|
|
|
|
|
|
+ int inserted_r_id;
|
|
|
|
+ resultsFilter = JsonMapper.ToJson(filterUserSelection);
|
|
|
|
+ //MessageBox.Show(results);
|
|
|
|
+ try
|
|
|
|
+ {
|
|
|
|
+ inserted_r_id = SQLiteModel.insertRecord(1, filterPatient.p_id, loginDoctor.id, 0, DateTime.Now, 0, resultsFilter);
|
|
|
|
+ SQLiteModel.UpdatePatientDataWithLastDate(filterPatient.p_id, "p_last_filter_time", DateTime.Now);
|
|
|
|
+ }
|
|
|
|
+ catch (Exception err)
|
|
|
|
+ {
|
|
|
|
+ MessageBox.Show("储存筛查报告错误\r\n调试信息:" + err.Message + "\r\n" + err.StackTrace, "错误");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ MessageBoxResult dr = MessageBox.Show("保存筛查结果成功,是否生成报告?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Question);
|
|
if (dr == MessageBoxResult.OK)
|
|
if (dr == MessageBoxResult.OK)
|
|
{
|
|
{
|
|
- string results = JsonMapper.ToJson(filterUserSelection);
|
|
|
|
- //MessageBox.Show(results);
|
|
|
|
- try
|
|
|
|
|
|
+ Record targetRecord = SQLiteModel.getRecordByID(inserted_r_id);
|
|
|
|
+ ReportGenerater.generateReport(1, filterPatient, loginDoctor, targetRecord, cfg.organization_name);
|
|
|
|
+ SQLiteModel.plusOneCountOnRecordByRid(inserted_r_id);
|
|
|
|
+ tabFilter.SelectedIndex = 2;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ buttonAbortFilter_Click(sender, e);
|
|
|
|
+ }
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 返回至选择用户页
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="sender">默认</param>
|
|
|
|
+ /// <param name="e">默认</param>
|
|
|
|
+ private void buttonFilterBackToSelectUser_Click(object sender, RoutedEventArgs e)
|
|
|
|
+ {
|
|
|
|
+ buttonAbortFilter_Click(sender, e);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 返回至选择首页
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="sender">默认</param>
|
|
|
|
+ /// <param name="e">默认</param>
|
|
|
|
+ private void buttonFilterBackToHome_Click(object sender, RoutedEventArgs e)
|
|
|
|
+ {
|
|
|
|
+ buttonAbortFilter_Click(sender, e);
|
|
|
|
+ tabControlGeneral.SelectedIndex = 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
|
|
+ #region 评估功能
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 点击开始评估后触发的事件
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="sender">默认</param>
|
|
|
|
+ /// <param name="e">默认</param>
|
|
|
|
+ public void buttonEvaluationSelectPatient_Click(object sender, RoutedEventArgs e)
|
|
|
|
+ {
|
|
|
|
+ //基本逻辑如下:先找七天内与病例相匹配的筛查记录,如果有,那么要取出结果一题一题比对
|
|
|
|
+ //如果没有,那么应当把筛查题进行加载处理
|
|
|
|
+ try
|
|
|
|
+ {
|
|
|
|
+ var target = (DataRowView)this.selectUserevaluation.dataGrid.SelectedItem;
|
|
|
|
+ evaluationPatient = SQLite.SQLiteModel.getPatientById(target["p_id"].ToString());
|
|
|
|
+ }
|
|
|
|
+ catch (Exception err)
|
|
|
|
+ {
|
|
|
|
+ MessageBox.Show("请选择一个病例进行修改\r\n调试信息:" + err.Message + "\r\n" + err.StackTrace, "警告");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (evaluationPatient == null)
|
|
|
|
+ {
|
|
|
|
+ MessageBox.Show("数据库加载异常", "错误");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ try
|
|
|
|
+ {
|
|
|
|
+ loadQuestionaire(filterQuestionaire, "filter");
|
|
|
|
+ evaluationQuestionaire.Clear();
|
|
|
|
+ filterUserSelection.Clear();
|
|
|
|
+ evaluationUserSelection.Clear();
|
|
|
|
+ //这里尝试加载用户的筛查记录
|
|
|
|
+ filterReportForEvaluation = SQLiteModel.getLatestXTypeRecordInYDays(evaluationPatient.p_id, 1, 7);
|
|
|
|
+ if(filterReportForEvaluation == null)
|
|
{
|
|
{
|
|
- SQLiteModel.insertRecord(1, filterPatient.p_id, loginDoctor.id, 0, DateTime.Now, 0, results);
|
|
|
|
- SQLiteModel.UpdatePatientDataWithLastDate(filterPatient.p_id, "p_last_filter_time", DateTime.Now);
|
|
|
|
|
|
+ flagEvaluationWithoutFilter = true;
|
|
|
|
+ foreach (QuestionAnswerPair qa in filterQuestionaire)
|
|
|
|
+ {
|
|
|
|
+ filterUserSelection.Add(new UserSelection(qa.question.q_id, 0));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- catch (Exception err)
|
|
|
|
|
|
+ else
|
|
{
|
|
{
|
|
- MessageBox.Show("储存筛查报告错误\r\n调试信息:" + err.Message + "\r\n" + err.StackTrace, "错误");
|
|
|
|
- return;
|
|
|
|
|
|
+ var jsonUserSelections = filterReportForEvaluation.r_selection;
|
|
|
|
+ filterUserSelection = JsonMapper.ToObject<List<UserSelection>>(jsonUserSelections);
|
|
|
|
+ flagEvaluationWithoutFilter = false;
|
|
}
|
|
}
|
|
- MessageBox.Show("保存成功", "提示");
|
|
|
|
- buttonAbortFilter_Click(sender, e);
|
|
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ catch (Exception err)
|
|
|
|
+ {
|
|
|
|
+ MessageBox.Show("筛查题目加载失败\r\n调试信息:" + err.Message + "\r\n" + err.StackTrace, "错误");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (filterQuestionaire.Count == 0)
|
|
|
|
+ {
|
|
|
|
+ MessageBox.Show("筛查题目加载失败\r\n数据库中无有效问卷", "错误");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (flagEvaluationWithoutFilter)
|
|
|
|
+ {
|
|
|
|
+ MessageBox.Show("发现该病例一周内未进行初筛,评估过程中将自动进行初筛。","提示");
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ MessageBox.Show("发现该病例于"+ filterReportForEvaluation.r_time.ToString("yyyy-MM-dd HH:mm:ss") +"进行过初筛,评估过程中将使用此初筛结果。", "提示");
|
|
|
|
+ }
|
|
|
|
+ currentFilterCount = 1;
|
|
|
|
+ currentEvaluationCount = 1;
|
|
|
|
+ evaluationQuestionaire.Add(filterQuestionaire[currentFilterCount - 1]);
|
|
|
|
+ evaluationUserSelection.Add(filterUserSelection[currentFilterCount - 1]);
|
|
|
|
+ tabEvaluation.SelectedIndex += 1;
|
|
|
|
+ checkStatusEvaluation();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 加载currentIndex的评估题目功能
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="currentIndex">需要显示题目的题号</param>
|
|
|
|
+ private void loadQuestionViewEvaluation(int currentIndex)
|
|
|
|
+ {
|
|
|
|
+ labelQuestionNumberofCurrentQuestion.Content = currentIndex.ToString();
|
|
|
|
+ labelEvaluationQuestionTitle.Content = evaluationQuestionaire[currentIndex - 1].question.q_title;
|
|
|
|
+ textBlockEvaluationQuetionContent.Text = evaluationQuestionaire[currentIndex - 1].question.q_content;
|
|
|
|
+ int countOptions = evaluationQuestionaire[currentIndex - 1].answers.Count;
|
|
|
|
+ gridEvaluationSelection.Children.Clear();
|
|
|
|
+ for (int i = 0; i < countOptions; ++i)
|
|
|
|
+ {
|
|
|
|
+ RadioButton oneOption = new RadioButton();
|
|
|
|
+ oneOption.Height = 30;
|
|
|
|
+ oneOption.HorizontalAlignment = HorizontalAlignment.Left;
|
|
|
|
+ oneOption.VerticalAlignment = VerticalAlignment.Top;
|
|
|
|
+ oneOption.Margin = new Thickness(i / 5 * 200, i % 5 * 40, 0, 0);
|
|
|
|
+ if (evaluationUserSelection[currentIndex - 1].a_id == evaluationQuestionaire[currentIndex - 1].answers[i].a_id)
|
|
|
|
+ oneOption.IsChecked = true;
|
|
|
|
+ else
|
|
|
|
+ oneOption.IsChecked = false;
|
|
|
|
+ oneOption.Content = 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);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 检查当前答题状态,判断是否需要跳过该题和控制加载题目的功能,能够维护userselection和questionaire
|
|
|
|
+ /// </summary>
|
|
|
|
+ private void checkStatusEvaluation()
|
|
|
|
+ {
|
|
|
|
+ if(!flagEvaluationWithoutFilter && evaluationQuestionaire[currentEvaluationCount-1].question.q_type == 1)
|
|
|
|
+ {
|
|
|
|
+ //有预加载的筛查报告且当前问题是一道筛查题
|
|
|
|
+ Answer aTemp = SQLiteModel.getAnswerById(filterUserSelection[currentFilterCount - 1].a_id);
|
|
|
|
+ if (aTemp == null || aTemp.next_q_id == 0)
|
|
|
|
+ {
|
|
|
|
+ if(currentFilterCount == filterQuestionaire.Count)
|
|
|
|
+ {
|
|
|
|
+ //当前所有题目都已经做完了
|
|
|
|
+ buttonEvaluationNext.IsEnabled = false;
|
|
|
|
+ bool allQuestionAreSeleceted = true;
|
|
|
|
+ foreach (UserSelection us in evaluationUserSelection)
|
|
|
|
+ {
|
|
|
|
+ if (us.a_id == 0)
|
|
|
|
+ allQuestionAreSeleceted = false;
|
|
|
|
+ }
|
|
|
|
+ //经过检查可以提交
|
|
|
|
+ buttonSubmitEvaluation.IsEnabled = allQuestionAreSeleceted;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ //还有剩下的筛选题没有过
|
|
|
|
+ QuestionAnswerPair qaPairEvaluation = filterQuestionaire[currentFilterCount];
|
|
|
|
+ //当前元素后面的题目和选项都清空
|
|
|
|
+ for (int i = evaluationQuestionaire.Count - 1; i > currentEvaluationCount - 1; --i)
|
|
|
|
+ {
|
|
|
|
+ evaluationQuestionaire.RemoveAt(i);
|
|
|
|
+ evaluationUserSelection.RemoveAt(i);
|
|
|
|
+ }
|
|
|
|
+ evaluationQuestionaire.Add(qaPairEvaluation);
|
|
|
|
+ evaluationUserSelection.Add(filterUserSelection[currentFilterCount]);
|
|
|
|
+ //再刷新一次
|
|
|
|
+ ++currentFilterCount;
|
|
|
|
+ ++currentEvaluationCount;
|
|
|
|
+ checkStatusEvaluation();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ //否则还有评估题没做
|
|
|
|
+ Question aEvaluationQuestion = SQLiteModel.getQuestionById(aTemp.next_q_id);
|
|
|
|
+ List<Answer> answersToTheEvaluation = SQLiteModel.getAnswersByQid(aEvaluationQuestion.q_id);
|
|
|
|
+ QuestionAnswerPair qaPairEvaluation = new QuestionAnswerPair(aEvaluationQuestion, answersToTheEvaluation);
|
|
|
|
+ //当前元素后面的题目和选项都清空
|
|
|
|
+ for(int i= evaluationQuestionaire.Count - 1; i > currentEvaluationCount - 1; --i)
|
|
|
|
+ {
|
|
|
|
+ evaluationQuestionaire.RemoveAt(i);
|
|
|
|
+ evaluationUserSelection.RemoveAt(i);
|
|
|
|
+ }
|
|
|
|
+ evaluationQuestionaire.Add(qaPairEvaluation);
|
|
|
|
+ evaluationUserSelection.Add(new UserSelection(aEvaluationQuestion.q_id, 0));
|
|
|
|
+ //再刷新一次
|
|
|
|
+ ++currentEvaluationCount;
|
|
|
|
+ checkStatusEvaluation();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ //其他情况:没有预加载的筛选题或者有预加载的筛选题但是是一道评估题
|
|
|
|
+ loadQuestionViewEvaluation(currentEvaluationCount);
|
|
|
|
+ buttonEvaluationNext.IsEnabled = false;
|
|
|
|
+ buttonSubmitEvaluation.IsEnabled = false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 评估单选选项被选中的触发事件,主要是修改内存中的选择和判断下一题及提交按钮是否可用
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="sender">默认</param>
|
|
|
|
+ /// <param name="e">默认</param>
|
|
|
|
+ private void radioButtonEvaluation_Checked(object sender, RoutedEventArgs e)
|
|
|
|
+ {
|
|
|
|
+ //首先,记录该选择
|
|
|
|
+ RadioButton oneSelection = (RadioButton)sender;
|
|
|
|
+ evaluationUserSelection[currentEvaluationCount - 1].a_id = Convert.ToInt32(oneSelection.Name.Substring(3));
|
|
|
|
+ if (flagEvaluationWithoutFilter)
|
|
|
|
+ {
|
|
|
|
+ filterUserSelection[currentFilterCount - 1].a_id = Convert.ToInt32(oneSelection.Name.Substring(3));
|
|
|
|
+ }
|
|
|
|
+ //MessageBox.Show(filterUserSelection[currentFilterCount - 1].a_id.ToString());
|
|
|
|
+ Answer oneAnswer = SQLiteModel.getAnswerById(evaluationUserSelection[currentEvaluationCount - 1].a_id);
|
|
|
|
+ if(currentFilterCount == filterQuestionaire.Count && oneAnswer.next_q_id == 0)
|
|
|
|
+ {
|
|
|
|
+ //后面没有题目了,可以提交
|
|
|
|
+ buttonEvaluationNext.IsEnabled = false;
|
|
|
|
+ bool allQuestionAreSeleceted = true;
|
|
|
|
+ foreach (UserSelection us in evaluationUserSelection)
|
|
|
|
+ {
|
|
|
|
+ if (us.a_id == 0)
|
|
|
|
+ allQuestionAreSeleceted = false;
|
|
|
|
+ }
|
|
|
|
+ //经过检查可以提交
|
|
|
|
+ buttonSubmitEvaluation.IsEnabled = allQuestionAreSeleceted;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ //否则可以做下一题
|
|
|
|
+ buttonEvaluationNext.IsEnabled = true;
|
|
|
|
+ buttonSubmitEvaluation.IsEnabled = false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// (未实现)评估过程中点击上一题的触发事件
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="sender">默认</param>
|
|
|
|
+ /// <param name="e">默认</param>
|
|
|
|
+ private void buttonEvaluationPrevious_Click(object sender, RoutedEventArgs e)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 点击评估页下一题后触发的事件,主要是判断接下来加载哪一题
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="sender">默认</param>
|
|
|
|
+ /// <param name="e">默认</param>
|
|
|
|
+ private void buttonEvaluationNext_Click(object sender, RoutedEventArgs e)
|
|
|
|
+ {
|
|
|
|
+ //先看看后面有没有进退阶题目了
|
|
|
|
+ Answer oneAnswer = SQLiteModel.getAnswerById(evaluationUserSelection[currentEvaluationCount - 1].a_id);
|
|
|
|
+ if(oneAnswer.next_q_id!= 0)
|
|
|
|
+ {
|
|
|
|
+ //还有后续题目
|
|
|
|
+ Question aEvaluationQuestion = SQLiteModel.getQuestionById(oneAnswer.next_q_id);
|
|
|
|
+ List<Answer> answersToTheEvaluation = SQLiteModel.getAnswersByQid(aEvaluationQuestion.q_id);
|
|
|
|
+ QuestionAnswerPair qaPairEvaluation = new QuestionAnswerPair(aEvaluationQuestion, answersToTheEvaluation);
|
|
|
|
+ //当前元素后面的题目和选项都清空
|
|
|
|
+ for (int i = evaluationQuestionaire.Count - 1; i > currentEvaluationCount - 1; --i)
|
|
|
|
+ {
|
|
|
|
+ evaluationQuestionaire.RemoveAt(i);
|
|
|
|
+ evaluationUserSelection.RemoveAt(i);
|
|
|
|
+ }
|
|
|
|
+ evaluationQuestionaire.Add(qaPairEvaluation);
|
|
|
|
+ evaluationUserSelection.Add(new UserSelection(aEvaluationQuestion.q_id, 0));
|
|
|
|
+ //再刷新一次
|
|
|
|
+ ++currentEvaluationCount;
|
|
|
|
+ checkStatusEvaluation();
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ //否则跳到下一个筛选题上面
|
|
|
|
+ QuestionAnswerPair qaPairEvaluation = filterQuestionaire[currentFilterCount];
|
|
|
|
+ //当前元素后面的题目和选项都清空
|
|
|
|
+ for (int i = evaluationQuestionaire.Count - 1; i > currentEvaluationCount - 1; --i)
|
|
|
|
+ {
|
|
|
|
+ evaluationQuestionaire.RemoveAt(i);
|
|
|
|
+ evaluationUserSelection.RemoveAt(i);
|
|
|
|
+ }
|
|
|
|
+ evaluationQuestionaire.Add(qaPairEvaluation);
|
|
|
|
+ evaluationUserSelection.Add(filterUserSelection[currentFilterCount]);
|
|
|
|
+ //再刷新一次
|
|
|
|
+ ++currentFilterCount;
|
|
|
|
+ ++currentEvaluationCount;
|
|
|
|
+ checkStatusEvaluation();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 点击评估页提交后触发的事件
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="sender">默认</param>
|
|
|
|
+ /// <param name="e">默认</param>
|
|
|
|
+ private void buttonSubmitEvaluation_Click(object sender, RoutedEventArgs e)
|
|
|
|
+ {
|
|
|
|
+ int inserted_r_id;
|
|
|
|
+ resultsFilter = JsonMapper.ToJson(filterUserSelection);
|
|
|
|
+ resultsEvaluation = JsonMapper.ToJson(evaluationUserSelection);
|
|
|
|
+ try
|
|
|
|
+ {
|
|
|
|
+ if (flagEvaluationWithoutFilter)
|
|
|
|
+ {
|
|
|
|
+ int tempRId = SQLiteModel.insertRecord(1, evaluationPatient.p_id, loginDoctor.id, 0, DateTime.Now, 0, resultsFilter);
|
|
|
|
+ SQLiteModel.UpdatePatientDataWithLastDate(evaluationPatient.p_id, "p_last_filter_time", DateTime.Now);
|
|
|
|
+ filterReportForEvaluation.r_id = tempRId;
|
|
|
|
+ }
|
|
|
|
+ inserted_r_id = SQLiteModel.insertRecord(2, evaluationPatient.p_id, loginDoctor.id, filterReportForEvaluation.r_id, DateTime.Now, 0, resultsEvaluation);
|
|
|
|
+ }
|
|
|
|
+ catch (Exception err)
|
|
|
|
+ {
|
|
|
|
+ MessageBox.Show("储存筛查报告错误\r\n调试信息:" + err.Message + "\r\n" + err.StackTrace, "错误");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ MessageBoxResult dr = MessageBox.Show("保存成功,是否生成报告?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Question);
|
|
|
|
+ if (dr == MessageBoxResult.OK)
|
|
|
|
+ {
|
|
|
|
+ Record targetRecord = SQLiteModel.getRecordByID(inserted_r_id);
|
|
|
|
+ SQLiteModel.plusOneCountOnRecordByRid(inserted_r_id);
|
|
|
|
+ ReportGenerater.generateReport(2, evaluationPatient, loginDoctor, targetRecord, cfg.organization_name);
|
|
|
|
+ tabEvaluation.SelectedIndex = 2;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ buttonAbortEvaluation_Click(sender, e);
|
|
}
|
|
}
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 点击评估页中止评估后触发的事件
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="sender">默认</param>
|
|
|
|
+ /// <param name="e">默认</param>
|
|
|
|
+ private void buttonAbortEvaluation_Click(object sender, RoutedEventArgs e)
|
|
|
|
+ {
|
|
|
|
+ //清理相关变量
|
|
|
|
+ filterQuestionaire.Clear();
|
|
|
|
+ filterUserSelection.Clear();
|
|
|
|
+ evaluationQuestionaire.Clear();
|
|
|
|
+ evaluationUserSelection.Clear();
|
|
|
|
+ flagEvaluationWithoutFilter = true;
|
|
|
|
+ filterReportForEvaluation = null;
|
|
|
|
+ evaluationPatient = null;
|
|
|
|
+ resultsFilter = "";
|
|
|
|
+ resultsEvaluation = "";
|
|
|
|
+
|
|
|
|
+ currentFilterCount = 0;
|
|
|
|
+ currentEvaluationCount = 0;
|
|
|
|
+ //buttonFilterPrevious.IsEnabled = false;
|
|
|
|
+ buttonEvaluationNext.IsEnabled = false;
|
|
|
|
+ buttonSubmitEvaluation.IsEnabled = false;
|
|
|
|
+
|
|
|
|
+ tabEvaluation.SelectedIndex = 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 返回至选择用户页
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="sender">默认</param>
|
|
|
|
+ /// <param name="e">默认</param>
|
|
|
|
+ private void buttonEvaluationBackToSelectUser_Click(object sender, RoutedEventArgs e)
|
|
|
|
+ {
|
|
|
|
+ buttonAbortEvaluation_Click(sender, e);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 返回至选择首页
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="sender">默认</param>
|
|
|
|
+ /// <param name="e">默认</param>
|
|
|
|
+ private void buttonEvaluationBackToHome_Click(object sender, RoutedEventArgs e)
|
|
|
|
+ {
|
|
|
|
+ buttonAbortEvaluation_Click(sender, e);
|
|
|
|
+ tabControlGeneral.SelectedIndex = 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
|
|
+ #region 历史记录
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 点击选择病例查看其历史记录后触发的事件
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="sender">默认</param>
|
|
|
|
+ /// <param name="e">默认</param>
|
|
|
|
+ public void buttonHistorySelectPatient_Click(object sender, RoutedEventArgs e)
|
|
|
|
+ {
|
|
|
|
+ try
|
|
|
|
+ {
|
|
|
|
+ var target = (DataRowView)this.selectUserHistory.dataGrid.SelectedItem;
|
|
|
|
+ historyPatient = SQLiteModel.getPatientById(Convert.ToString(target["p_id"]));
|
|
|
|
+ recordsFromOnePatient = SQLiteModel.getRecordsByPid(Convert.ToInt32(target["p_id"]));
|
|
|
|
+ }
|
|
|
|
+ catch (Exception err)
|
|
|
|
+ {
|
|
|
|
+ MessageBox.Show("请选择一个病例进行修改\r\n调试信息:" + err.Message + "\r\n" + err.StackTrace, "警告");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (recordsFromOnePatient == null || historyPatient == null)
|
|
|
|
+ {
|
|
|
|
+ MessageBox.Show("数据库加载异常", "错误");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ try
|
|
|
|
+ {
|
|
|
|
+ bindingRecords = new BindingList<Record>(recordsFromOnePatient);
|
|
|
|
+ dataGridRecords.ItemsSource = bindingRecords;
|
|
|
|
+ }
|
|
|
|
+ catch(Exception err)
|
|
|
|
+ {
|
|
|
|
+ MessageBox.Show("数据库加载异常\r\n调试信息:\r\n"+err.StackTrace, "错误");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ tabHistoryRecords.SelectedIndex = 1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void buttonHistoryBackToSelectUser_Click(object sender, RoutedEventArgs e)
|
|
|
|
+ {
|
|
|
|
+ recordsFromOnePatient.Clear();
|
|
|
|
+ tabHistoryRecords.SelectedIndex = 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void buttonHistoryBackToHome_Click(object sender, RoutedEventArgs e)
|
|
|
|
+ {
|
|
|
|
+ recordsFromOnePatient.Clear();
|
|
|
|
+ tabHistoryRecords.SelectedIndex = 0;
|
|
|
|
+ tabControlGeneral.SelectedIndex = 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void buttonRegenerateReport_Click(object sender, RoutedEventArgs e)
|
|
|
|
+ {
|
|
|
|
+ Record targetRecord;
|
|
|
|
+ try
|
|
|
|
+ {
|
|
|
|
+ var target = this.dataGridRecords.SelectedItem as Record;
|
|
|
|
+ targetRecord = SQLiteModel.getRecordByID(Convert.ToInt32(target.r_id));
|
|
|
|
+ }
|
|
|
|
+ catch (Exception err)
|
|
|
|
+ {
|
|
|
|
+ MessageBox.Show("请选择一个记录进行生成\r\n" + err.StackTrace, "提示");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (targetRecord == null)
|
|
|
|
+ {
|
|
|
|
+ MessageBox.Show("数据库加载异常", "错误");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ try
|
|
|
|
+ {
|
|
|
|
+ ReportGenerater.generateReport(targetRecord.r_type, historyPatient, loginDoctor, targetRecord, cfg.organization_name);
|
|
|
|
+ SQLiteModel.plusOneCountOnRecordByRid(targetRecord.r_id);
|
|
|
|
+ }
|
|
|
|
+ catch(Exception err)
|
|
|
|
+ {
|
|
|
|
+ MessageBox.Show("报告生成异常\r\n调试信息:\r\n" + err.StackTrace, "错误");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ tabHistoryRecords.SelectedIndex = 2;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void dataGridRecords_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
|
|
|
+ {
|
|
|
|
+ buttonRegenerateReport_Click(sender, e);
|
|
|
|
+ }
|
|
|
|
+
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
#region 系统设置
|
|
#region 系统设置
|
|
@@ -803,10 +1296,27 @@ namespace WpfTest1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
|
|
+ private void buttonHomePageMeasureFunction_Click(object sender, RoutedEventArgs e)
|
|
|
|
+ {
|
|
|
|
+ Patient onePatient = SQLiteModel.getPatientById("1");
|
|
|
|
+ Record oneRecord = SQLiteModel.getRecordByID(7);
|
|
|
|
+ ReportGenerater.generateReport(2, onePatient, loginDoctor, oneRecord, cfg.organization_name);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void buttonHomePageHistoryRecord_Click(object sender, RoutedEventArgs e)
|
|
|
|
+ {
|
|
|
|
+ string filename = Constants.reportPath + "\\" + "8" + ".pdf";
|
|
|
|
+ System.Diagnostics.Process.Start(filename);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|