Exemple #1
0
        private void setPatientEvent()
        {
            bool passCheckB = checkPassCheckB(this.tpr_id);

            if (passCheckB)
            {
                bool isPE = checkPE(this.queue_mvt_id);
                if (isPE)
                {
                    this.PatientEvent = PatientEventStatus.PEAfterCheckB;
                }
                else
                {
                    this.PatientEvent = PatientEventStatus.Result;
                }
            }
            else
            {
                this.PatientEvent = PatientEventStatus.PEBeforeCheckB;
            }
        }
Exemple #2
0
        private void btnSendAuto_Click(object sender, EventArgs e)
        {
            DisableBtnAll();
            DateTime startDate = DateTime.Now;

            this.AutoScrollPosition = new Point(0, 0);
            //tps_id = Program.CurrentPatient_queue.tps_id;

            Class.FunctionDataCls     func = new Class.FunctionDataCls();
            EmrClass.GetDataMasterCls mst  = new EmrClass.GetDataMasterCls();
            frmBGScreen frmbg = new frmBGScreen();

            frmbg.Show();
            Application.DoEvents();

            try
            {
                int patientMvt = paRegis.trn_patient_queues.Where(x => x.tps_id == tps_id)
                                 .Select(x => (int)x.mvt_id).FirstOrDefault();
                using (InhCheckupDataContext contxt = new InhCheckupDataContext())
                {
                    string mvt_code = contxt.mst_events.Where(x => x.mvt_id == patientMvt).Select(x => x.mvt_code).FirstOrDefault();
                    if (mvt_code == "PE")
                    {
                        if (new Class.FunctionDataCls().checkPassedCheckPointB((int)this.tpr_id))
                        {
                            this.PatientEvent = PatientEventStatus.PEAfterCheckB;
                        }
                        else
                        {
                            this.PatientEvent = PatientEventStatus.PEBeforeCheckB;
                        }
                    }
                    else
                    {
                        this.PatientEvent = PatientEventStatus.Result;
                    }
                }

                if (saveData())
                {
                    if (this.PatientEvent == PatientEventStatus.PEBeforeCheckB)
                    {
                        bool sent = new QueueClass.TransactionQueueCls().SendQueueDoctorPEBeforeCheckB((int)tpr_id, (int)tps_id, user.mut_username);
                        if (sent)
                        {
                            lbAlertMsg.Text = new Class.FunctionDataCls().getStringGotoNextRoom((int)tpr_id);
                            StatusEmptyRoom();
                        }
                        else
                        {
                            lbAlertMsg.Text = "โปรดกด Send Auto อีกครั้ง";;
                            StatusWK();
                        }
                    }
                    else if (this.PatientEvent == PatientEventStatus.PEAfterCheckB)
                    {
                        if (resultUltrasound == PopupUltrasoundLower.ResultPopupUltrasoundLower.AfterStation)
                        {
                            List <int> mvt = mst.GetMstRoomEventByMrm(Program.CurrentRoom.mrm_id).Select(x => x.mvt_id).ToList();

                            Class.FunctionDataCls.sendQueueStatus result = func.sendQueueUltrasoundLower(resultUltrasound, mvt);
                            if (result == Class.FunctionDataCls.sendQueueStatus.error)
                            {
                                lbAlertMsg.Text = "เกิดความผิดพลาดทางเทคนิค ไม่สามารถส่งไป ultrasound ได้ กรุณาติดต่อผู้ดูแลระบบ";
                                StatusWK();
                            }
                            else if (result == Class.FunctionDataCls.sendQueueStatus.sendSuccess)
                            {
                                new ClsTCPClient().sendClearUnitDisplay();
                                lbAlertMsg.Text = func.GetStrSaveAndSend((int)tpr_id, "US", "UL");
                                StatusEmptyRoom();
                                this.tpr_id = null;
                            }
                        }
                        else
                        {
                            if (new Class.FunctionDataCls().ChkSendAutoNewModule(Program.CurrentRegis))
                            {
                                string     msgAlert    = "";
                                bool       isPopup     = false;
                                List <int> list_mvt_id = new List <int> {
                                    patientMvt
                                };
                                QueueClass.SendAutoCls.ResultSendQueue result = new QueueClass.SendAutoCls().SendAuto((int)tps_id, list_mvt_id, user, ref msgAlert, ref isPopup);
                                if (result == QueueClass.SendAutoCls.ResultSendQueue.Error)
                                {
                                    lbAlertMsg.Text = msgAlert;
                                    StatusWK();
                                }
                                else
                                {
                                    lbAlertMsg.Visible = true;
                                    if (result == QueueClass.SendAutoCls.ResultSendQueue.SendComplete)
                                    {
                                        new Class.logPatientFlowCls(Class.logPatientFlowCls.sendType.SendAuto,
                                                                    (int)tpr_id,
                                                                    (int)tps_id,
                                                                    Program.CurrentSite.mhs_id,
                                                                    Program.CurrentRoom.mrd_ename,
                                                                    Program.CurrentUser.mut_username,
                                                                    startDate);

                                        new ClsTCPClient().sendClearUnitDisplay();
                                        new Class.ReserveSkipCls().SendAndReserve(tpr_id);
                                        StatusEmptyRoom();
                                        this.tpr_id = null;
                                        if (isPopup)
                                        {
                                            MessageBox.Show(msgAlert, "EMR Checkup.");
                                        }
                                        else
                                        {
                                            lbAlertMsg.Text = msgAlert;
                                        }
                                    }
                                    else
                                    {
                                        if (isPopup)
                                        {
                                            MessageBox.Show(msgAlert, "EMR Checkup.");
                                        }
                                        else
                                        {
                                            lbAlertMsg.Text = msgAlert;
                                        }
                                    }
                                }
                            }
                            else
                            {
                                StatusTransaction result = CallQueue.SendAutoOnStation();
                                if (result == StatusTransaction.True || result == StatusTransaction.SendCheckB)
                                {
                                    new Class.logPatientFlowCls(Class.logPatientFlowCls.sendType.SendAuto,
                                                                (int)tpr_id,
                                                                (int)tps_id,
                                                                Program.CurrentSite.mhs_id,
                                                                Program.CurrentRoom.mrd_ename,
                                                                Program.CurrentUser.mut_username,
                                                                startDate);

                                    new ClsTCPClient().sendClearUnitDisplay();
                                    lbAlertMsg.Visible = true;
                                    new Class.ReserveSkipCls().SendAndReserve(tpr_id);
                                    lbAlertMsg.Text = new Class.FunctionDataCls().getStringGotoNextRoom((int)tpr_id);
                                    StatusEmptyRoom();
                                    this.tpr_id = null;
                                }
                                else if (result == StatusTransaction.Error)
                                {
                                    lbAlertMsg.Text = "โปรดกด Send Auto อีกครั้ง";
                                    StatusWK();
                                }
                                else if (result == StatusTransaction.False)
                                {
                                    lbAlertMsg.Text = "Save Data Complete.";
                                    StatusWK();
                                }
                            }
                        }
                    }
                    else if (this.PatientEvent == PatientEventStatus.Result)
                    {
                        bool sent = new QueueClass.TransactionQueueCls().SendQueueDoctorResult((int)tps_id, user.mut_username);
                        if (sent)
                        {
                            lbAlertMsg.Text = "Sent To Checkpoint C.";
                            StatusEmptyRoom();
                        }
                        else
                        {
                            lbAlertMsg.Text = "Save Data Incomplete. Please Try Again.";
                            StatusWK();
                        }
                    }
                }
                else
                {
                    lbAlertMsg.Text = "Save Data Incomplete. Please Try Again.";
                    StatusWK();
                }
            }
            catch (Exception ex)
            {
                lbAlertMsg.Text = ex.Message;
                StatusWK();
            }
            frmbg.Close();
        }