private void patientsQustionnareToolStripMenuItem_Click(object sender, EventArgs e) { trn_ques_patient quesPatient = paRegis.trn_ques_patients.FirstOrDefault(); cdc.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, quesPatient); subjectiveUC1.RefreshBindings(); }
public bool RetrieveLabToEmrCheckupWithQuestionnaire(int tpr_id, LabClass.QuestionnaireResult questionnaire, string user) { try { using (InhCheckupDataContext cdc = new InhCheckupDataContext()) { DateTime dateNow = Class.globalCls.GetServerDateTime(); var pregis = cdc.trn_patient_regis.Where(x => x.tpr_id == tpr_id).FirstOrDefault(); var ques = pregis.trn_ques_patients.FirstOrDefault(); if (ques == null) { ques = new trn_ques_patient { tqp_create_by = user, tqp_create_date = dateNow }; pregis.trn_ques_patients.Add(ques); } ques.tqp_his_smok = questionnaire.smoke; ques.tqp_fwm_pregnancy = questionnaire.pregnancy; ques.tqp_ill_med_diab = questionnaire.diabetes; ques.tqp_update_by = user; ques.tqp_update_date = dateNow; cdc.SubmitChanges(); } return(RetrieveLabToEmrCheckup(tpr_id, user)); } catch (Exception ex) { Class.globalCls.MessageError("InsertLabCls", "RetrieveLabToEmrCheckupWithQuestionnaire", ex.Message); throw ex; } return(false); }
private void chkBox_CheckedChanged(object sender, EventArgs e) { CheckBox chkBox = (CheckBox)sender; if (chkBox.Checked == true) { List <DestinationControl> desCtrl = destination.Where(x => x.checkBox == chkBox).ToList(); foreach (DestinationControl des in desCtrl) { foreach (string field in des.fieldName) { trn_ques_patient patient_ques = (trn_ques_patient)bsPatientQues.Current; object value = TypeDescriptor.GetProperties(patient_ques)[field].GetValue(patient_ques); if (value != null) { if (value.GetType() == typeof(bool)) { if ((bool)value == true) { TypeDescriptor.GetProperties(patient_ques)[field].SetValue(patient_ques, false); } } } } } } }
private void patientsQustionnareToolStripMenuItem_Click(object sender, EventArgs e) { if (Program.CurrentRegis != null) { QuestionnaireFrm fqn = new QuestionnaireFrm(); fqn.tpr_id = Program.CurrentRegis.tpr_id; fqn.ShowDialog(); trn_ques_patient q = cdc.trn_ques_patients.Where(x => x.tpr_id == tpr_id).FirstOrDefault(); cdc.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, q); } }
private void LoadQuestionare(ref trn_patient_regi _patientRegis) { trn_ques_patient quesPatient = _patientRegis.trn_ques_patients.FirstOrDefault(); if (quesPatient != null) { trn_doctor_hdr doctorHdr = _patientRegis.trn_doctor_hdrs.FirstOrDefault(); if (quesPatient.tqp_ill_concern == 'A') { doctorHdr.trh_chief_complaint = "Annaul Check-up"; } else if (quesPatient.tqp_ill_concern == 'O') { if (quesPatient.tqp_ill_conc_oth != null && quesPatient.tqp_ill_conc_oth != "") { doctorHdr.trh_chief_complaint = "Other { " + quesPatient.tqp_ill_conc_oth + " }"; } else { doctorHdr.trh_chief_complaint = "Other"; } } else { doctorHdr.trh_chief_complaint = "N/A"; } List <string> remarkHyper = new List <string>(); List <string> remarkHeart = new List <string>(); List <string> remarkDiab = new List <string>(); List <string> remarkStroke = new List <string>(); List <string> remarkSeizure = new List <string>(); List <string> remarkCancer = new List <string>(); List <string> remarkOther = new List <string>(); List <string> CurrentMedicine = new List <string>(); if (quesPatient.tqp_ill_cur_med == 'H') { if (quesPatient.tqp_ill_cmed_diab == true) { CurrentMedicine.Add("ยารักษาเบาหวาน"); } if (quesPatient.tqp_ill_cmed_demia == true) { CurrentMedicine.Add("ยารักษาโรคไขมันในเลือดสูง"); } if (quesPatient.tqp_ill_cmed_diab == true) { CurrentMedicine.Add("ไขมันในเลือดผิดปกติ"); } if (quesPatient.tqp_ill_cmed_hyper == true) { CurrentMedicine.Add("ยารักษาโรคความดันโลหิตสูง"); } if (quesPatient.tqp_ill_cmed_cardi == true) { CurrentMedicine.Add("ยารักษาโรคหัวใจและหลอดเลือด"); } if (quesPatient.tqp_ill_cmed_horm == true) { CurrentMedicine.Add("ฮอร์โมน"); } if (quesPatient.tqp_ill_cmed_oth == true) { CurrentMedicine.Add("ยาอื่นๆ(" + quesPatient.tqp_ill_cmed_others + ")"); } } if (quesPatient.tqp_fhis_f_disease == 'D') { if (quesPatient.tqp_fhis_fdis_hyper == true) { remarkHyper.Add("บิดา"); chHypertension.Checked = true; } if (quesPatient.tqp_fhis_fdis_heart == true) { remarkHeart.Add("บิดา"); chHeartDisease.Checked = true; } if (quesPatient.tqp_fhis_fdis_diab == true) { remarkDiab.Add("บิดา"); chDiabetes.Checked = true; } if (quesPatient.tqp_fhis_fdis_stro == true) { remarkStroke.Add("บิดา"); chStroke.Checked = true; } if (quesPatient.tqp_fhis_fdis_canc == true) { remarkCancer.Add("บิดา"); chCancer.Checked = true; } if (quesPatient.tqp_fhis_fdis_oth == true) { remarkOther.Add("(บิดา) : " + quesPatient.tqp_fhis_fdis_others); chOther.Checked = true; } } if (quesPatient.tqp_fhis_m_disease == 'D') { if (quesPatient.tqp_fhis_mdis_hyper == true) { remarkHyper.Add("มารดา"); chHypertension.Checked = true; } if (quesPatient.tqp_fhis_mdis_heart == true) { remarkHeart.Add("มารดา"); chHeartDisease.Checked = true; } if (quesPatient.tqp_fhis_mdis_diab == true) { remarkDiab.Add("มารดา"); chDiabetes.Checked = true; } if (quesPatient.tqp_fhis_mdis_stro == true) { remarkStroke.Add("มารดา"); chStroke.Checked = true; } if (quesPatient.tqp_fhis_mdis_canc == true) { remarkCancer.Add("มารดา"); chCancer.Checked = true; } if (quesPatient.tqp_fhis_mdis_oth == true) { remarkOther.Add("(มารดา) : " + quesPatient.tqp_fhis_mdis_others); chOther.Checked = true; } } if (quesPatient.tqp_fhis_b_disease == 'D') { if (quesPatient.tqp_fhis_bdis_hyper == true) { remarkHyper.Add("พี่น้อง"); chHypertension.Checked = true; } if (quesPatient.tqp_fhis_bdis_heart == true) { remarkHeart.Add("พี่น้อง"); chHeartDisease.Checked = true; } if (quesPatient.tqp_fhis_bdis_diab == true) { remarkDiab.Add("พี่น้อง"); chDiabetes.Checked = true; } if (quesPatient.tqp_fhis_bdis_stro == true) { remarkStroke.Add("พี่น้อง"); chStroke.Checked = true; } if (quesPatient.tqp_fhis_bdis_canc == true) { remarkCancer.Add("พี่น้อง"); chCancer.Checked = true; } if (quesPatient.tqp_fhis_bdis_oth == true) { remarkOther.Add("(พี่น้อง) : " + quesPatient.tqp_fhis_bdis_others); chOther.Checked = true; } } doctorHdr.trh_hypertension_txt = string.Join(", ", remarkHyper); doctorHdr.trh_heart_disease_txt = string.Join(", ", remarkDiab); doctorHdr.trh_stroke_txt = string.Join(", ", remarkStroke); doctorHdr.trh_cancer_txt = string.Join(", ", remarkCancer); doctorHdr.trh_other_txt = string.Join(", ", remarkOther); if (CurrentMedicine.Count != 0) { gv_cur_med.Rows.Clear(); for (int i = 0; i < CurrentMedicine.Count; i++) { gv_cur_med.Rows.Add(i + 1, CurrentMedicine[i], "Delete", "O"); } } } }
private bool SaveData() { bool isCompleted = false; try { DateTime dtnow = Program.GetServerDateTime(); trn_pft objcurrentpft = (trn_pft)PFTbindingSource1.Current; if (objcurrentpft.tpr_id == 0) { objcurrentpft.tpr_id = Program.CurrentRegis.tpr_id; } if (objcurrentpft.tpf_create_by == null) { objcurrentpft.tpf_create_by = Program.CurrentUser.mut_username; objcurrentpft.tpf_create_date = dtnow; } objcurrentpft.tpf_update_by = Program.CurrentUser.mut_username; objcurrentpft.tpf_update_date = dtnow; objcurrentpft.tpf_result = true; PictureBox p1 = new PictureBox(); using (Bitmap bitmap = new Bitmap(pictureBox_result.ClientSize.Width, pictureBox_result.ClientSize.Height)) { pictureBox_result.DrawToBitmap(bitmap, pictureBox_result.ClientRectangle); Bitmap bmp = new Bitmap(bitmap); p1.SizeMode = PictureBoxSizeMode.StretchImage; p1.Image = (Image)bmp; } MemoryStream stream = new MemoryStream(); p1.Image.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg); byte[] img1 = stream.ToArray(); objcurrentpft.tpf_docscan_img = img1; trn_ques_patient objqp = (trn_ques_patient)QestionPatientbindingSource1.Current; //load เคยมีอาการหรือปัญหาเหล่านี้หรือไม่ if (objqp.tpr_id == 0) { objqp.tpr_id = Program.CurrentRegis.tpr_id; } objqp.tqp_symp_faint = Program.GetValueRadioTochar(pl_symp_faint); objqp.tqp_symp_shake = Program.GetValueRadioTochar(pl_symp_shake); objqp.tqp_symp_wind = Program.GetValueRadioTochar(pl_symp_wind); objqp.tqp_symp_breath = Program.GetValueRadioTochar(pl_symp_breath); objqp.tqp_symp_vein = Program.GetValueRadioTochar(pl_symp_vein); objqp.tqp_symp_paralysis = Program.GetValueRadioTochar(pl_symp_paralysis); // Load 5 objqp.tqp_his_smok = Program.GetValueGroupBox(gb_his_smok); if (objqp.tqp_his_smok == 'S') { objqp.tqp_his_smok_amt = Convert1.ToDouble(txt_his_smok_amt1.Text); objqp.tqp_his_smok_dur = Convert1.ToDouble(txt_his_smok_dur1.Text); } else if (objqp.tqp_his_smok == 'Q') { objqp.tqp_his_smok_amt = Convert1.ToDouble(txt_his_smok_amt2.Text); objqp.tqp_his_smok_dur = Convert1.ToDouble(txt_his_smok_dur2.Text); } //load 6.1 ไอ objqp.tqp_cur_ill_cough = Program.GetValueRadioTochar(pl2_cur_ill_cough); objqp.tqp_cur_ill_wcough = Program.GetValueRadioTochar(pl2_cur_ill_wcough); objqp.tqp_cur_ill_gcough = Program.GetValueRadioTochar(pl2_cur_ill_gcough); objqp.tqp_cur_ill_bcough = Program.GetValueRadioTochar(pl2_cur_ill_bcough); //6.2 เหนื่อยหอบ objqp.tqp_cur_ill_pant = Program.GetValueRadioTochar(pl3_cur_ill_pant); //ความถี่ของการเกิดอาการ objqp.tqp_pat_freq = Program.GetValueRadioTochar(pl4_pat_freq); if (objqp.tqp_create_by == null) { objqp.tqp_create_by = Program.CurrentUser.mut_username; objqp.tqp_create_date = dtnow; } objqp.tqp_update_by = Program.CurrentUser.mut_username; objqp.tqp_update_date = dtnow; PFTbindingSource1.EndEdit(); QestionPatientbindingSource1.EndEdit(); try { dbc.SubmitChanges(); } catch (System.Data.Linq.ChangeConflictException) { foreach (System.Data.Linq.ObjectChangeConflict occ in dbc.ChangeConflicts) { dbc.Refresh(System.Data.Linq.RefreshMode.KeepChanges, occ.Object); } dbc.SubmitChanges(); } isCompleted = true; } catch (Exception ex) { Program.MessageError(this.Name, "SaveData", ex, false); } return(isCompleted); }
private void patientQuest_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "tqp_his_smok") { trn_ques_patient patient_ques = (trn_ques_patient)sender; if (patient_ques.tqp_his_smok == 'N') //tqp_his_smok N=None,O=No smoking,Q=Quit smoking,S=Smoking { patient_ques.tqp_his_smok_amt = null; patient_ques.tqp_his_smok_dur = null; txt_his_smok_amt1.Enabled = false; txt_his_smok_dur1.Enabled = false; txt_his_smok_amt1.DataBindings.Clear(); txt_his_smok_dur1.DataBindings.Clear(); txt_his_smok_amt2.Enabled = false; txt_his_smok_dur2.Enabled = false; txt_his_smok_amt2.DataBindings.Clear(); txt_his_smok_dur2.DataBindings.Clear(); txtNSmokeYear.Enabled = false; patient_ques.tqp_his_nsmok_yrs = null; txtQsSmokeYear.Enabled = false; patient_ques.tqp_his_qsmok_yrs = null; txtQsSmokeRemark.Enabled = false; patient_ques.tqp_his_smok_remark = null; } else if (patient_ques.tqp_his_smok == 'O') { patient_ques.tqp_his_smok_amt = null; patient_ques.tqp_his_smok_dur = null; txt_his_smok_amt1.Enabled = false; txt_his_smok_dur1.Enabled = false; txt_his_smok_amt1.DataBindings.Clear(); txt_his_smok_dur1.DataBindings.Clear(); txt_his_smok_amt2.Enabled = false; txt_his_smok_dur2.Enabled = false; txt_his_smok_amt2.DataBindings.Clear(); txt_his_smok_dur2.DataBindings.Clear(); txtNSmokeYear.Enabled = true; patient_ques.tqp_his_nsmok_yrs = null; txtQsSmokeYear.Enabled = false; patient_ques.tqp_his_qsmok_yrs = null; txtQsSmokeRemark.Enabled = false; patient_ques.tqp_his_smok_remark = null; } else if (patient_ques.tqp_his_smok == 'Q') { patient_ques.tqp_his_smok_amt = null; patient_ques.tqp_his_smok_dur = null; txt_his_smok_amt1.DataBindings.Clear(); txt_his_smok_dur1.DataBindings.Clear(); txt_his_smok_amt1.Enabled = false; txt_his_smok_dur1.Enabled = false; txt_his_smok_amt2.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.bsPatientQues, "tqp_his_smok_amt", true)); txt_his_smok_dur2.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.bsPatientQues, "tqp_his_smok_dur", true)); txt_his_smok_amt2.Enabled = true; txt_his_smok_dur2.Enabled = true; txtNSmokeYear.Enabled = false; patient_ques.tqp_his_nsmok_yrs = null; txtQsSmokeYear.Enabled = true; patient_ques.tqp_his_qsmok_yrs = null; txtQsSmokeRemark.Enabled = true; patient_ques.tqp_his_smok_remark = null; } else if (patient_ques.tqp_his_smok == 'S') { patient_ques.tqp_his_smok_amt = null; patient_ques.tqp_his_smok_dur = null; txt_his_smok_amt1.Enabled = true; txt_his_smok_dur1.Enabled = true; txt_his_smok_amt1.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.bsPatientQues, "tqp_his_smok_amt", true)); txt_his_smok_dur1.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.bsPatientQues, "tqp_his_smok_dur", true)); txt_his_smok_amt2.Enabled = false; txt_his_smok_dur2.Enabled = false; txt_his_smok_amt2.DataBindings.Clear(); txt_his_smok_dur2.DataBindings.Clear(); txtNSmokeYear.Enabled = false; patient_ques.tqp_his_nsmok_yrs = null; txtQsSmokeYear.Enabled = false; patient_ques.tqp_his_qsmok_yrs = null; txtQsSmokeRemark.Enabled = false; patient_ques.tqp_his_smok_remark = null; } else { patient_ques.tqp_his_smok_amt = null; patient_ques.tqp_his_smok_dur = null; txt_his_smok_amt1.Enabled = false; txt_his_smok_dur1.Enabled = false; txt_his_smok_amt1.DataBindings.Clear(); txt_his_smok_dur1.DataBindings.Clear(); txt_his_smok_amt2.Enabled = false; txt_his_smok_dur2.Enabled = false; txt_his_smok_amt2.DataBindings.Clear(); txt_his_smok_dur2.DataBindings.Clear(); txtNSmokeYear.Enabled = false; patient_ques.tqp_his_nsmok_yrs = null; txtQsSmokeYear.Enabled = false; patient_ques.tqp_his_qsmok_yrs = null; txtQsSmokeRemark.Enabled = false; patient_ques.tqp_his_smok_remark = null; } } else { if (e.PropertyName == "tqp_ill_med_heart") { object value = TypeDescriptor.GetProperties(sender)[e.PropertyName].GetValue(sender); if (value != null) { if (value.GetType() == typeof(bool)) { if ((bool)value) { txt1_hearRemark.Enabled = true; } else { txt1_hearRemark.Enabled = false; TypeDescriptor.GetProperties(sender)["tqp_ill_med_heart_txt"].SetValue(sender, null); } } } } else if (e.PropertyName == "tqp_ill_med_oth") { object value = TypeDescriptor.GetProperties(sender)[e.PropertyName].GetValue(sender); if (value != null) { if (value.GetType() == typeof(bool)) { if ((bool)value) { txt1_OtherRemark.Enabled = true; } else { txt1_OtherRemark.Enabled = false; TypeDescriptor.GetProperties(sender)["tqp_ill_med_rmk_oth"].SetValue(sender, null); } } } } else if (e.PropertyName == "tqp_cur_ill_pant") { object value = TypeDescriptor.GetProperties(sender)[e.PropertyName].GetValue(sender); if (value != null) { if (value.GetType() == typeof(char?) || value.GetType() == typeof(char)) { if ((char)value == 'N') { propPant.ForEach(x => TypeDescriptor.GetProperties(sender)[x].SetValue(sender, false)); TypeDescriptor.GetProperties(sender)["tqp_pat_freq"].SetValue(sender, null); } } } } else if (e.PropertyName == "tqp_pat_freq") { object value = TypeDescriptor.GetProperties(sender)[e.PropertyName].GetValue(sender); if (value != null) { TypeDescriptor.GetProperties(sender)["tqp_cur_ill_pant"].SetValue(sender, 'Y'); } } else if (propPant.Contains(e.PropertyName)) { if (propPant.Any(x => (bool?)TypeDescriptor.GetProperties(sender)[x].GetValue(sender) == true)) { TypeDescriptor.GetProperties(sender)["tqp_cur_ill_pant"].SetValue(sender, 'Y'); } else { TypeDescriptor.GetProperties(sender)["tqp_cur_ill_pant"].SetValue(sender, 'N'); } } else if (propCough.Contains(e.PropertyName)) { if (propCough.All(x => (char?)TypeDescriptor.GetProperties(sender)[x].GetValue(sender) == 'N')) { propTimeCough.ForEach(x => TypeDescriptor.GetProperties(sender)[x].SetValue(sender, false)); } } else if (propTimeCough.Contains(e.PropertyName)) { if (propTimeCough.All(x => (bool?)TypeDescriptor.GetProperties(sender)[x].GetValue(sender) == false || (bool?)TypeDescriptor.GetProperties(sender)[x].GetValue(sender) == null)) { propCough.ForEach(x => TypeDescriptor.GetProperties(sender)[x].SetValue(sender, null)); } } List <DestinationControl> desControls = destination.Where(x => x.fieldName.Any(y => y == e.PropertyName)).ToList(); if (desControls.Count() > 0) { object value = TypeDescriptor.GetProperties(sender)[e.PropertyName].GetValue(sender); if (value != null) { if (value.GetType() == typeof(bool)) { if ((bool)value == true) { foreach (DestinationControl des in desControls) { if (des.checkBox.Checked == true) { des.checkBox.Checked = false; } } } } } } } }