예제 #1
0
 private void SaveLAB()
 {
     try
     {
         try
         {
             DateTime dateNow = Program.GetServerDateTime();
             trn_patient_book_result bookResult = dbc.trn_patient_book_results
                                                  .Where(x => x.tpr_id == Program.CurrentRegis.tpr_id &&
                                                         x.tpbr_radiology == "LB")
                                                  .FirstOrDefault();
             if (bookResult == null)
             {
                 bookResult = new trn_patient_book_result()
                 {
                     tpr_id           = Program.CurrentRegis.tpr_id,
                     tpbr_radiology   = "LB",
                     tpbr_create_by   = Program.CurrentUser.mut_username,
                     tpbr_create_date = dateNow
                 };
                 dbc.trn_patient_book_results.InsertOnSubmit(bookResult);
             }
             bookResult.tpbr_flag_saved      = true;
             bookResult.tpbr_show_sections   = true;
             bookResult.tpbr_show_summary    = true;
             bookResult.tpbr_not_show_report = false;
             bookResult.tpbr_active          = true;
             bookResult.tpbr_update_by       = Program.CurrentUser.mut_username;
             bookResult.tpbr_update_date     = dateNow;
             dbc.SubmitChanges();
             lbAlertMsg.Text = "Save Data Complete.";
         }
         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();
         }
     }
     catch (ChangeConflictException)
     {
         foreach (ObjectChangeConflict occ in dbc.ChangeConflicts)
         {
             dbc.Refresh(System.Data.Linq.RefreshMode.KeepChanges, occ.Object);
         }
         dbc.SubmitChanges();
     }
 }
예제 #2
0
        public StatusTransaction skipOnStationSendManaul(int tpr_id, int tps_id, int next_mrm_id, int next_mvt_id)
        {
            try
            {
                InhCheckupDataContext cdc = new InhCheckupDataContext();

                trn_patient_regi  tpr = cdc.trn_patient_regis.Where(x => x.tpr_id == tpr_id).FirstOrDefault();
                trn_patient_queue tps = tpr.trn_patient_queues.Where(x => x.tps_id == tps_id).FirstOrDefault();

                Class.FunctionDataCls func = new Class.FunctionDataCls();
                updatePlanForSkip(ref tpr, tps_id);
                skipReserveCurrentQueue(ref tpr, tps_id);
                func.deleteCurrentQueue(ref cdc, ref tpr, tps_id);
                func.insertNextQueue(ref tpr, next_mrm_id, next_mvt_id);
                try
                {
                    cdc.SubmitChanges();
                    return(StatusTransaction.True);
                }
                catch (System.Data.Linq.ChangeConflictException)
                {
                    foreach (ObjectChangeConflict occ in cdc.ChangeConflicts)
                    {
                        cdc.Refresh(System.Data.Linq.RefreshMode.KeepChanges, occ.Object);
                    }
                    cdc.SubmitChanges();
                    return(StatusTransaction.True);
                }
            }
            catch (Exception ex)
            {
                Program.MessageError("ClsSkipOnStation", "skipOnStationSendManaul", ex, false);
                return(StatusTransaction.Error);
            }
        }
예제 #3
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         papResultUC1.EndEdit();
         try
         {
             cdc.SubmitChanges();
         }
         catch (System.Data.Linq.ChangeConflictException)
         {
             foreach (System.Data.Linq.ObjectChangeConflict occ in cdc.ChangeConflicts)
             {
                 cdc.Refresh(System.Data.Linq.RefreshMode.KeepChanges, occ.Object);
             }
             cdc.SubmitChanges();
         }
         lblAlert.Text = "Save Data Complete.";
     }
     catch (Exception ex)
     {
         Program.MessageError(this.Name, "btnSave_Click(object sender, EventArgs e)", ex, false);
         lblAlert.Text = "Please Try Again.";
     }
 }
예제 #4
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         tabAssessmentAndPlanUC1.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();
         }
         lbAlertMsg.Text = "Save Data Complete.";
     }
     catch (Exception ex)
     {
         Program.MessageError(this.Name, "btnSave_Click", ex, false);
         lbAlertMsg.Text = "โปรดลองอีกครั้ง";
     }
 }
예제 #5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            lblMsg.Text = "";
            try
            {
                DateTime dateNow = Program.GetServerDateTime();
                DataBinding_trn_doctor_exam.EndEdit();

                var other = DataBinding_trn_doctor_exam.OfType <trn_doctor_exam>().FirstOrDefault();
                if (other.trxm_create_date == null)
                {
                    other.trxm_create_date = dateNow;
                }
                other.trxm_update_date = dateNow;

                try
                {
                    trn_patient_book_result bookResult = dbc.trn_patient_book_results
                                                         .Where(x => x.tpr_id == Program.CurrentRegis.tpr_id &&
                                                                x.tpbr_radiology == "OE")
                                                         .FirstOrDefault();
                    if (bookResult == null)
                    {
                        bookResult = new trn_patient_book_result()
                        {
                            tpr_id           = Program.CurrentRegis.tpr_id,
                            tpbr_radiology   = "OE",
                            tpbr_create_by   = Program.CurrentUser.mut_username,
                            tpbr_create_date = dateNow
                        };
                        dbc.trn_patient_book_results.InsertOnSubmit(bookResult);
                    }
                    bookResult.tpbr_flag_saved      = true;
                    bookResult.tpbr_show_sections   = true;
                    bookResult.tpbr_show_summary    = true;
                    bookResult.tpbr_not_show_report = false;
                    bookResult.tpbr_active          = true;
                    bookResult.tpbr_update_by       = Program.CurrentUser.mut_username;
                    bookResult.tpbr_update_date     = dateNow;
                    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();
                }
            }
            catch (Exception ex)
            {
                lblMsg.Text = ex.Message;
            }
            lblMsg.Text = "Save Data Completed.";
        }
예제 #6
0
 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);
     }
 }
예제 #7
0
        private bool Save(char strType)
        {
            try
            {
                if (strType == 'N')
                {
                    var objQuestP = (from t1 in dbc.trn_ques_patients where t1.tpr_id == SetTprID select new { t1.tqp_type }).FirstOrDefault();
                    if (objQuestP == null || objQuestP.tqp_type == 'D')
                    {
                        //lblnotcc_questionnaire.Visible = true;

                        if (MessageBox.Show("กรุณายืนยันข้อมูลแบบสอบถาม", "Message Alert", MessageBoxButtons.OK, MessageBoxIcon.Information) == DialogResult.OK)
                        {
                            Forms.QuestionnaireFrm fqn = new Forms.QuestionnaireFrm();
                            fqn.tpr_id = Program.CurrentRegis.tpr_id;
                            fqn.ShowDialog();
                            return(false);
                        }
                        else
                        {
                            return(false);
                        }
                        //return false;
                    }
                }

                try
                {
                    this.subjectiveUC1.EndEdit();
                    this.objectiveUC1.EndEdit();
                    this.tabAssessmentAndPlanUC1.EndEdit();
                    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();
                }

                //select set current dc hdr
                Program.CurrentHDR = (from hdr in dbc.trn_doctor_hdrs where hdr.tpr_id == SetTprID select hdr).FirstOrDefault();
                return(true);
            }
            catch (Exception ex)
            {
                Program.MessageError(this.Name, "Save", ex, false);
                return(false);
            }
        }
예제 #8
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         tabPhyExamUC1.EndEdit();
         try
         {
             DateTime dateNow = Program.GetServerDateTime();
             trn_patient_book_result bookResult = dbc.trn_patient_book_results
                                                  .Where(x => x.tpr_id == this._tpr_id &&
                                                         x.tpbr_radiology == "PE")
                                                  .FirstOrDefault();
             if (bookResult == null)
             {
                 bookResult = new trn_patient_book_result()
                 {
                     tpr_id           = (int)this._tpr_id,
                     tpbr_radiology   = "PE",
                     tpbr_create_by   = Program.CurrentUser.mut_username,
                     tpbr_create_date = dateNow
                 };
                 dbc.trn_patient_book_results.InsertOnSubmit(bookResult);
             }
             bookResult.tpbr_flag_saved      = true;
             bookResult.tpbr_show_sections   = true;
             bookResult.tpbr_show_summary    = true;
             bookResult.tpbr_not_show_report = false;
             bookResult.tpbr_active          = true;
             bookResult.tpbr_update_by       = Program.CurrentUser.mut_username;
             bookResult.tpbr_update_date     = dateNow;
             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();
         }
         lbAlertMsg.Text          = "Save Data Complete.";
         btnSendToDocscan.Enabled = true;
     }
     catch (Exception ex)
     {
         Program.MessageError(this.Name, "btnSave_Click", ex, false);
         lbAlertMsg.Text = "โปรดลองอีกครั้ง";
     }
 }
예제 #9
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                personalHealthManagmentUC1.EndEdit();
                try
                {
                    //try
                    //{
                    //    trn_patient_regi patientRegis = dbc.trn_patient_regis
                    //                                       .Where(x => x.tpr_id == this._tpr_id)
                    //                                       .FirstOrDefault();
                    //    trn_eye_exam_hdr eyeHdr = patientRegis.trn_eye_exam_hdrs.FirstOrDefault();
                    //    if (eyeHdr != null)
                    //    {
                    //        eyeHdr.teh_is_eye_record = true;
                    //    }
                    //}
                    //catch
                    //{

                    //}
                    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();
                }
                lbAlertMsg.Text = "Save Data Complete.";
            }
            catch (Exception ex)
            {
                lbAlertMsg.Text = "โปรดลองอีกครั้ง";
                Program.MessageError(this.Name, "btnSave_Click", ex, false);
            }
        }
예제 #10
0
        public StatusTransaction importPatient(int tpr_id, List <int> mvt_id)
        {
            try
            {
                using (InhCheckupDataContext contxt = new InhCheckupDataContext())
                {
                    DateTime dateNow = Program.GetServerDateTime();
                    List <trn_RefreshLabHistory> his = contxt.trn_RefreshLabHistories.Where(x => x.tpr_id == tpr_id).ToList();
                    his.ForEach(x => x.status = true);
                    contxt.SubmitChanges();

                    trn_patient_regi patient_regis = contxt.trn_patient_regis.Where(x => x.tpr_id == tpr_id).FirstOrDefault();
                    using (Service.WS_CheckupCls wsCheckup = new Service.WS_CheckupCls())
                    {
                        wsCheckup.InsertDBEmrCheckupResultXray(patient_regis.trn_patient.tpt_hn_no, patient_regis.tpr_en_no, dateNow.AddYears(-5), dateNow, true);
                    }
                }

                using (InhCheckupDataContext cdc = new InhCheckupDataContext())
                {
                    try
                    {
                        string   username = Program.CurrentUser == null ? "" : Program.CurrentUser.mut_username;
                        DateTime dateNow  = Program.GetServerDateTime();
                        cdc.Connection.Open();
                        DbTransaction trans = cdc.Connection.BeginTransaction();
                        cdc.Transaction = trans;

                        trn_patient_regi patient_regis = cdc.trn_patient_regis.Where(x => x.tpr_id == tpr_id).FirstOrDefault();

                        patient_regis.trn_patient_queues.ToList().ForEach(x => { x.tps_status = "ED"; x.tps_ns_status = null; x.tps_update_by = username; x.tps_update_date = dateNow; });

                        int enRowID = Convert.ToInt32(patient_regis.tpr_en_rowid);
                        EmrClass.GetPTPackageCls          PackageCls   = new EmrClass.GetPTPackageCls();
                        EnumerableRowCollection <DataRow> getPTPackage = PackageCls.GetPTPackage(enRowID);
                        PackageCls.AddPatientOrderItem(ref patient_regis, username, dateNow, getPTPackage);
                        PackageCls.AddPatientOrderSet(ref patient_regis, username, dateNow, getPTPackage);
                        List <MapOrderEvent> mapOrder = PackageCls.MapEvent(getPTPackage);
                        PackageCls.AddPatientEvent(ref patient_regis, username, dateNow, mapOrder);
                        PackageCls.AddPatientPlan(ref patient_regis, username, dateNow, mapOrder);
                        PackageCls.skipReqDoctorOutDepartment(ref patient_regis);
                        PackageCls.CompleteEcho(ref patient_regis);
                        PackageCls.skipChangeEstToEcho(ref patient_regis, patient_regis.mhs_id);
                        PackageCls.checkOrderPMR(ref patient_regis, patient_regis.mhs_id);

                        patient_regis.tpr_status    = "WB";
                        patient_regis.tpr_pe_status = "RS";
                        try
                        {
                            cdc.SubmitChanges();
                        }
                        catch (System.Data.Linq.ChangeConflictException)
                        {
                            foreach (System.Data.Linq.ObjectChangeConflict occ in cdc.ChangeConflicts)
                            {
                                cdc.Refresh(System.Data.Linq.RefreshMode.KeepChanges, occ.Object);
                            }
                            cdc.SubmitChanges();
                        }
                        PackageCls.setRelationOrderSet(ref patient_regis);
                        cdc.SubmitChanges();
                        cdc.Transaction.Commit();

                        using (Service.WS_CheckupCls ws = new Service.WS_CheckupCls())
                        {
                            ws.retrieveVitalSign(tpr_id, username);
                            ws.getCheckUpLabResult(patient_regis.trn_patient.tpt_hn_no, tpr_id);
                        }
                        return(StatusTransaction.True);
                    }
                    catch (Exception ex)
                    {
                        cdc.Transaction.Rollback();
                        Program.MessageError("ImportPatientToBookCls", "importPatient", ex, false);
                        return(StatusTransaction.Error);
                    }
                    finally
                    {
                        cdc.Connection.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                Program.MessageError("ImportPatientToBookCls", "importPatient", ex, false);
                return(StatusTransaction.Error);
            }
        }
예제 #11
0
        private void Update(char doctype)
        {
            trn_ques_aviation currentquest = (trn_ques_aviation)trnquesavaitionBindingSource.Current;

            currentquest.tpr_id          = Program.CurrentRegis.tpr_id;
            currentquest.tqa_type        = doctype;
            currentquest.tqa_doc_type    = Program.CurrentRegis.tpr_aviation_type;
            currentquest.tqa_update_by   = Program.CurrentUser.mut_username;
            currentquest.tqa_update_date = Program.GetServerDateTime();

            if (doctype == 'N')
            {
                currentquest.tqa_confirm_doctor = Program.CurrentUser.mut_username;
                currentquest.tqa_confirm_date   = Program.GetServerDateTime();
            }

            currentquest.tqa_place_exam  = txtplace.Text;
            currentquest.tqa_th_fullname = txtname_th.Text;
            currentquest.tqa_en_fullname = txtname_en.Text;
            currentquest.tqa_th_nation   = txtnation_th.Text;
            currentquest.tqa_en_nation   = txtnation_en.Text;
            currentquest.tqa_age_yrs     = Convert.ToDouble(txtage.Text);
            currentquest.tqa_age_month   = Convert.ToDouble(txtmonth.Text);
            currentquest.tqa_th_address  = txtaddress.Text;


            //find dob
            DateTime dob = (DateTime)(from t1 in dbc.trn_patients where t1.tpt_id == Program.CurrentRegis.tpt_id select t1.tpt_dob).FirstOrDefault();

            currentquest.tqa_dob = dob;
            //currentquest.tqa_dob = Program.CurrentRegis.trn_patient.tpt_dob;

            //tab 1
            currentquest.tqa_sex       = Program.GetValueGroupBox(grbgender);
            currentquest.tqa_avia_type = Program.GetValueRadioTochar(pnlaviatype);

            currentquest.tqa_prev_exam_deca = Program.GetValueRadioTochar(pnlprev_exam_decla);
            currentquest.tqa_use_medicine   = Program.GetValueRadioTochar(pnluse_med);
            currentquest.tqa_med_amount     = txtmed_amt.Text;
            currentquest.tqa_med_reason     = txtmed_reason.Text;
            currentquest.tqa_med_name       = txtmed_name.Text;
            currentquest.tqa_avia_oths      = txtavia_oth.Text;
            //tab 2

            currentquest.tqa_chis_freq       = Program.GetValueRadioTochar(pnlchis_freq);
            currentquest.tqa_chis_freq_rmk   = txtfreq.Text;
            currentquest.tqa_chis_dizz       = Program.GetValueRadioTochar(pnlchis_dizz);
            currentquest.tqa_chis_dizz_rmk   = txtdizz.Text;
            currentquest.tqa_chis_unco       = Program.GetValueRadioTochar(pnlchis_unco);
            currentquest.tqa_chis_unco_rmk   = txtunco.Text;
            currentquest.tqa_chis_eyet       = Program.GetValueRadioTochar(pnlchis_eyes);
            currentquest.tqa_chis_eyet_rmk   = txteye.Text;
            currentquest.tqa_chis_hayf       = Program.GetValueRadioTochar(pnlchis_hayf);
            currentquest.tqa_chis_hayf_rmk   = txtalle.Text;
            currentquest.tqa_chis_lung       = Program.GetValueRadioTochar(pnlchis_lung);
            currentquest.tqa_chis_lung_rmk   = txtlung.Text;
            currentquest.tqa_chis_kidn       = Program.GetValueRadioTochar(pnlchis_kind);
            currentquest.tqa_chis_kidn_rmk   = txtkind.Text;
            currentquest.tqa_chis_ment       = Program.GetValueRadioTochar(pnlchis_mental);
            currentquest.tqa_chis_ment_rmk   = txtmental.Text;
            currentquest.tqa_chis_alco       = Program.GetValueRadioTochar(pnlchis_alco);
            currentquest.tqa_chis_alco_rmk   = txtalco.Text;
            currentquest.tqa_chis_hert       = Program.GetValueRadioTochar(pnlchis_heart);
            currentquest.tqa_chis_hert_rmk   = txtheart.Text;
            currentquest.tqa_chis_high       = Program.GetValueRadioTochar(pnlchis_high);
            currentquest.tqa_chis_high_rmk   = txthigh.Text;
            currentquest.tqa_chis_stom       = Program.GetValueRadioTochar(pnlchis_stomach);
            currentquest.tqa_chis_stom_rmk   = txtstomach.Text;
            currentquest.tqa_chis_nurv       = Program.GetValueRadioTochar(pnlchis_nurv);
            currentquest.tqa_chis_nurv_rmk   = txtneur.Text;
            currentquest.tqa_chis_drug       = Program.GetValueRadioTochar(pnlchis_drug);
            currentquest.tqa_chis_drug_rmk   = txtdrug.Text;
            currentquest.tqa_chis_suic       = Program.GetValueRadioTochar(pnlchis_suic);
            currentquest.tqa_chis_suic_rmk   = txtsuic.Text;
            currentquest.tqa_chis_moti       = Program.GetValueRadioTochar(pnlchis_moti);
            currentquest.tqa_chis_moti_rmk   = txtmotion.Text;
            currentquest.tqa_chis_adms       = Program.GetValueRadioTochar(pnlchis_adm);
            currentquest.tqa_chis_adms_rmk   = txtadm.Text;
            currentquest.tqa_chis_avia       = Program.GetValueRadioTochar(pnlchis_avia);
            currentquest.tqa_chis_avia_rmk   = txtavia.Text;
            currentquest.tqa_chis_otha       = Program.GetValueRadioTochar(pnlchis_otha);
            currentquest.tqa_chis_otha_rmk   = txtotha.Text;
            currentquest.tqa_chis_gyna       = Program.GetValueRadioTochar(pnlchis_gyna);
            currentquest.tqa_chis_gyna_rmk   = txtgyne.Text;
            currentquest.tqa_chis_othi       = Program.GetValueRadioTochar(pnlchis_othi);
            currentquest.tqa_chis_othi_rmk   = txtothi.Text;
            currentquest.tqa_chis_conviction = Program.GetValueRadioTochar(pnlconviction);
            currentquest.tqa_chis_conv_rmk   = txtconvic.Text;
            currentquest.tqa_chge_address    = Program.GetValueRadioTochar(pnlchkaddr);

            currentquest.tqa_avia_oths = txtavia_oth.Text;


            currentquest.tqa_tot_fling_time = textBox12.Text == String.Empty ? 0 : Convert.ToDouble(textBox12.Text);
            currentquest.tqa_last_six_time  = textBox13.Text == String.Empty ? 0 : Convert.ToDouble(textBox13.Text);


            trnquesavaitionBindingSource.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();
            }
        }
예제 #12
0
        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);
        }
예제 #13
0
        public StatusTransaction SendManualOnStationPendingCheckB(int tpr_id, int mrm_id, ref string messegeSend)
        {
            using (InhCheckupDataContext cdc = new InhCheckupDataContext())
            {
                try
                {
                    string            currentRoom = new EmrClass.GetDataMasterCls().GetMstRoomHdrByMrd_id(Program.CurrentRoom.mrd_id).mrm_code;
                    trn_patient_regi  tpr         = cdc.trn_patient_regis.Where(x => x.tpr_id == tpr_id).FirstOrDefault();
                    StatusTransaction result      = SendManualPendingCheckB(ref tpr, ref messegeSend, currentRoom);
                    if (result == StatusTransaction.True)
                    {
                        tpr.tpr_pending_cancel_onday = false;

                        StatusTransaction checkPatientOnCheckB = new Class.FunctionDataCls().checkStatusPatientOnCheckPointB(tpr_id, mrm_id);
                        if (checkPatientOnCheckB == StatusTransaction.True)
                        {
                            new TransactionPlanCls().endPlan(ref tpr, mrm_id);
                            new TransactionQueueCls().endQueue(ref tpr);
                            try
                            {
                                cdc.SubmitChanges();
                            }
                            catch (System.Data.Linq.ChangeConflictException)
                            {
                                foreach (ObjectChangeConflict occ in cdc.ChangeConflicts)
                                {
                                    cdc.Refresh(System.Data.Linq.RefreshMode.KeepChanges, occ.Object);
                                }
                            }
                        }
                        else if (checkPatientOnCheckB == StatusTransaction.False)
                        {
                            MessageBox.Show("สถานะของคนไข้ ไม่ได้อยู่ในสถานะที่จะ Send Manual ได้", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return(StatusTransaction.False);
                        }
                        new Class.ReserveSkipCls().SendAndReserve(tpr_id);
                        return(StatusTransaction.True);
                    }
                    else if (result == StatusTransaction.False)
                    {
                        StatusTransaction rePendingCB = new Class.FunctionDataCls().rePendingCheckB(ref tpr);
                        if (rePendingCB == StatusTransaction.Error)
                        {
                            return(StatusTransaction.Error);
                        }
                        try
                        {
                            cdc.SubmitChanges();
                        }
                        catch (System.Data.Linq.ChangeConflictException)
                        {
                            foreach (ObjectChangeConflict occ in cdc.ChangeConflicts)
                            {
                                cdc.Refresh(System.Data.Linq.RefreshMode.KeepChanges, occ.Object);
                            }
                        }
                        return(StatusTransaction.False);
                    }
                    else
                    {
                        StatusTransaction rePendingCB = new Class.FunctionDataCls().rePendingCheckB(ref tpr);
                        if (rePendingCB == StatusTransaction.Error)
                        {
                            return(StatusTransaction.Error);
                        }
                        try
                        {
                            cdc.SubmitChanges();
                        }
                        catch (System.Data.Linq.ChangeConflictException)
                        {
                            foreach (ObjectChangeConflict occ in cdc.ChangeConflicts)
                            {
                                cdc.Refresh(System.Data.Linq.RefreshMode.KeepChanges, occ.Object);
                            }
                        }
                        return(StatusTransaction.Error);
                    }
                }
                catch (Exception ex)
                {
                    Program.MessageError("SendManaulCls", "SendManualOnStationPendingCheckB", ex, false);
                    return(StatusTransaction.Error);
                }
            }
        }
예제 #14
0
        public void GetVistalSign(int tpr_id, string username)
        {
            using (InhCheckupDataContext dbc = new InhCheckupDataContext())
            {
                DateTime         dateNow = globalCls.GetServerDateTime();
                trn_patient_regi tpr     = dbc.trn_patient_regis.Where(x => x.tpr_id == tpr_id).FirstOrDefault();
                if (tpr != null)
                {
                    List <string> locCheckup = dbc.mst_hpc_sites.Where(x => x.mhs_status == 'A' && x.mhs_other_clinic == false).Select(x => x.mhs_code).ToList();
                    locCheckup.Add("01AMSCHK");
                    var res = GetVitalSign(tpr.trn_patient.tpt_hn_no);//.Where(x => locCheckup.Contains(x.Location)).OrderByDescending(x => x.VitalSignDate);
                    trn_basic_measure_hdr hdr = tpr.trn_basic_measure_hdrs.FirstOrDefault();
                    if (hdr == null)
                    {
                        hdr = new trn_basic_measure_hdr();
                        hdr.tbm_create_by   = username;
                        hdr.tbm_create_date = dateNow;
                        tpr.trn_basic_measure_hdrs.Add(hdr);
                    }
                    hdr.tbm_vision_left              = null;
                    hdr.tbm_vision_right             = null;
                    hdr.tbm_glass_or_contact         = null;
                    hdr.tbm_vision_lvisual_with_lens = null;
                    hdr.tbm_vision_rvisual_with_lens = null;
                    hdr.tbm_vision_lvisual_out_lens  = null;
                    hdr.tbm_vision_rvisual_out_lens  = null;
                    hdr.tbm_update_by   = username;
                    hdr.tbm_update_date = dateNow;

                    var cur = res.Where(x => x.en == tpr.tpr_en_no).OrderByDescending(x => x.VitalSignDate).FirstOrDefault();
                    if (cur != null)
                    {
                        hdr.tbm_vision_left      = ConvertToInt(cur.VisionLeft);
                        hdr.tbm_vision_right     = ConvertToInt(cur.VisionRight);
                        hdr.tbm_glass_or_contact = cur.WithLen ? 'Y' : 'N';
                        hdr.tbm_color_blind      = cur.ColorBlind == null ? (char?)null : cur.ColorBlind.ToUpper() == "NA" ? 'X' : cur.ColorBlind.ToUpper() == "NO" ? 'N' : cur.ColorBlind.ToUpper() == "AB" ? 'A' : (char?)null;
                        if (hdr.tbm_glass_or_contact == 'Y')
                        {
                            hdr.tbm_vision_lvisual_with_lens = cur.VisionLeft;
                            hdr.tbm_vision_rvisual_with_lens = cur.VisionRight;
                        }
                        else
                        {
                            hdr.tbm_vision_lvisual_out_lens = cur.VisionLeft;
                            hdr.tbm_vision_rvisual_out_lens = cur.VisionRight;
                        }
                    }

                    bool       start       = false;
                    int        count       = 0;
                    List <int> list_tbd_id = hdr.trn_basic_measure_dtls.Select(x => x.tbd_id).ToList();
                    foreach (var rs in res)
                    {
                        if (rs.Equals(cur))
                        {
                            start = true;
                        }
                        if (start)
                        {
                            trn_basic_measure_dtl dtl = hdr.trn_basic_measure_dtls
                                                        .Where(x => x.tbd_row_id == rs.rowid &&
                                                               x.tbd_en_no == rs.en &&
                                                               x.tbd_date == rs.VitalSignDate)
                                                        .FirstOrDefault();
                            if (dtl == null)
                            {
                                dtl                 = new trn_basic_measure_dtl();
                                dtl.tbd_row_id      = rs.rowid;
                                dtl.tbd_create_by   = username;
                                dtl.tbd_create_date = dateNow;
                                hdr.trn_basic_measure_dtls.Add(dtl);
                            }
                            else
                            {
                                list_tbd_id.Remove(dtl.tbd_id);
                            }
                            dtl.tbd_en_no     = rs.en;
                            dtl.tbd_date      = rs.VitalSignDate;
                            dtl.tbd_vision_lt = rs.VisionLeft;
                            dtl.tbd_vision_rt = rs.VisionRight;
                            dtl.tbd_bmi       = rs.BMI;
                            dtl.tbd_diastolic = rs.Diastolic;
                            dtl.tbd_height    = rs.Height;
                            dtl.tbd_pulse     = rs.Pulse;
                            dtl.tbd_rr        = rs.RespirationRate;
                            dtl.tbd_systolic  = rs.Systolic;
                            dtl.tbd_temp      = rs.Temperature;
                            if (rs.WithLen)
                            {
                                dtl.tbd_vision_lvisual_out_lens  = null;
                                dtl.tbd_vision_rvisual_out_lens  = null;
                                dtl.tbd_vision_lvisual_with_lens = rs.VisionLeft;
                                dtl.tbd_vision_rvisual_with_lens = rs.VisionRight;
                            }
                            else
                            {
                                dtl.tbd_vision_lvisual_out_lens  = rs.VisionLeft;
                                dtl.tbd_vision_rvisual_out_lens  = rs.VisionRight;
                                dtl.tbd_vision_lvisual_with_lens = null;
                                dtl.tbd_vision_rvisual_with_lens = null;
                            }
                            dtl.tbd_vision_with_lens = rs.WithLen;
                            dtl.tbd_waist            = rs.Waist;
                            dtl.tbd_weight           = rs.Weight;
                            dtl.tbd_update_by        = username;
                            dtl.tbd_update_date      = dateNow;
                            count++;
                        }
                        if (count == 3)
                        {
                            break;
                        }
                    }

                    List <trn_basic_measure_dtl> listDeleteDtl = hdr.trn_basic_measure_dtls.Where(x => list_tbd_id.Contains(x.tbd_id)).ToList();
                    if (listDeleteDtl.Count > 0)
                    {
                        dbc.trn_basic_measure_dtls.DeleteAllOnSubmit(listDeleteDtl);
                    }

                    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();
                    }
                    //trn_basic_measure_hdr hdr = tpr.trn_basic_measure_hdrs.FirstOrDefault();
                    //if (hdr == null)
                    //{
                    //    hdr = new trn_basic_measure_hdr();
                    //    tpr.trn_basic_measure_hdrs.Add(hdr);
                    //}

                    //EnumerableRowCollection<DataRow> result = retrieveVitalSign(tpr.trn_patient.tpt_hn_no);

                    //List<int> ListOBS_Item_DR = new List<int>
                    //{
                    //    230, 231, 11, 129, 128, 9, 10, 134, 176, 173, 174, 281
                    //};

                    //if (result != null)
                    //{
                    //    if (result.Count() > 0)
                    //    {
                    //        var grpResultByID = result.Where(x => ListOBS_Item_DR.Contains(x.Field<int>("OBS_Item_DR")))
                    //                                  .GroupBy(x => x.Field<int>("OBS_ParRef"))
                    //                                  .Select(x => new VitalSign
                    //                                  {
                    //                                      OBS_ParRef = x.Key,
                    //                                      OBS_DateTime = x.Select(y => y.Field<DateTime>("OBS_Date").Add(y.Field<TimeSpan>("OBS_Time"))).OrderByDescending(y => y).FirstOrDefault(),
                    //                                      PAADM_ADMNo = x.Select(y => y.Field<string>("PAADM_ADMNo")).FirstOrDefault(),
                    //                                      VitalSign_Dtl = x.GroupBy(y => y.Field<DateTime>("OBS_Date").Add(y.Field<TimeSpan>("OBS_Time")))
                    //                                                       .OrderByDescending(y => y.Key).FirstOrDefault()
                    //                                                       .Select(y => new VitalSign.VitalSignDtl
                    //                                                       {
                    //                                                           OBS_Item_DR = y.Field<int>("OBS_Item_DR"),
                    //                                                           OBS_Value = y.Field<string>("OBS_Value")
                    //                                                       }).ToList()
                    //                                  }).ToList()
                    //                                  .OrderByDescending(x => x.OBS_DateTime);

                    //        bool start = false;
                    //        int countRec = 0;
                    //        List<int?> listNewRowID = new List<int?>();
                    //        foreach (var rowID in grpResultByID)
                    //        {
                    //            if (rowID.PAADM_ADMNo == tpr.tpr_en_no)
                    //            {
                    //                start = true;
                    //            }
                    //            if (start)
                    //            {
                    //                countRec = countRec + 1;
                    //                listNewRowID.Add(rowID.OBS_ParRef);
                    //                trn_basic_measure_dtl dtl = hdr.trn_basic_measure_dtls.Where(x => x.tbd_row_id == rowID.OBS_ParRef).FirstOrDefault();
                    //                if (dtl == null)
                    //                {
                    //                    dtl = new trn_basic_measure_dtl();
                    //                    dtl.tbd_en_no = rowID.PAADM_ADMNo;
                    //                    dtl.tbd_row_id = rowID.OBS_ParRef;
                    //                    dtl.tbd_date = rowID.OBS_DateTime;
                    //                    dtl.tbd_create_by = username;
                    //                    dtl.tbd_create_date = dateNow;
                    //                    hdr.trn_basic_measure_dtls.Add(dtl);
                    //                }
                    //                dtl.tbd_weight = null;
                    //                dtl.tbd_height = null;
                    //                dtl.tbd_temp = null;
                    //                dtl.tbd_systolic = null;
                    //                dtl.tbd_diastolic = null;
                    //                dtl.tbd_pulse = null;
                    //                dtl.tbd_rr = null;
                    //                dtl.tbd_bmi = null;
                    //                dtl.tbd_waist = null;
                    //                dtl.tbd_vision_lt = null;
                    //                dtl.tbd_vision_rt = null;
                    //                foreach (var item in rowID.VitalSign_Dtl)
                    //                {
                    //                    switch (item.OBS_Item_DR)
                    //                    {
                    //                        case 230:
                    //                            dtl.tbd_weight = item.OBS_Value;
                    //                            break;
                    //                        case 231:
                    //                            dtl.tbd_height = item.OBS_Value;
                    //                            break;
                    //                        case 11:
                    //                            dtl.tbd_temp = item.OBS_Value;
                    //                            break;
                    //                        case 129:
                    //                            dtl.tbd_systolic = item.OBS_Value;
                    //                            break;
                    //                        case 128:
                    //                            dtl.tbd_diastolic = item.OBS_Value;
                    //                            break;
                    //                        case 9:
                    //                            dtl.tbd_pulse = item.OBS_Value;
                    //                            break;
                    //                        case 10:
                    //                            dtl.tbd_rr = item.OBS_Value;
                    //                            break;
                    //                        case 134:
                    //                            dtl.tbd_bmi = item.OBS_Value;
                    //                            break;
                    //                        case 176:
                    //                            dtl.tbd_waist = item.OBS_Value;
                    //                            break;
                    //                        case 173:
                    //                            dtl.tbd_vision_lt = item.OBS_Value;
                    //                            break;
                    //                        case 174:
                    //                            dtl.tbd_vision_rt = item.OBS_Value;
                    //                            break;
                    //                        // Sumit Edit 23/12/2014
                    //                        case 281:
                    //                            dtl.tbd_vision_with_lens = (item.OBS_Value == "Y" || item.OBS_Value == "y") ? true : false;
                    //                            break;
                    //                    }
                    //                }
                    //                dtl.tbd_update_by = username;
                    //                dtl.tbd_update_date = dateNow;
                    //            }
                    //            if (countRec == 5) break;
                    //        }

                    //        try
                    //        {
                    //            var eyesVS = hdr.trn_basic_measure_dtls
                    //                            .OrderByDescending(x => x.tbd_date)
                    //                            .Select(x => new
                    //                            {
                    //                                x.tbd_vision_rt,
                    //                                x.tbd_vision_lt
                    //                            }).FirstOrDefault();
                    //            hdr.tbm_vision_right = Convert.ToInt32(eyesVS.tbd_vision_rt);
                    //            hdr.tbm_vision_left = Convert.ToInt32(eyesVS.tbd_vision_lt);
                    //        }
                    //        catch
                    //        {

                    //        }
                    //        List<trn_basic_measure_dtl> listDeleteDtl = hdr.trn_basic_measure_dtls.Where(x => !listNewRowID.Contains(x.tbd_row_id)).ToList();
                    //        dbc.trn_basic_measure_dtls.DeleteAllOnSubmit(listDeleteDtl);
                    //        dbc.SubmitChanges();
                    //    }
                    //}
                }
            }
        }