示例#1
0
        private void btnSendAuto_Click(object sender, EventArgs e)
        {
            DisableBtnAll();
            DateTime startDate = DateTime.Now;

            this.AutoScrollPosition = new Point(0, 0);
            List <int> mvt_id = new List <int>();

            if (uu.enable && uu.visible && uu.check && uu.autoCheck)
            {
                mvt_id.Add(uu.mvt_id);
            }
            if (ul.enable && ul.visible && ul.check && ul.autoCheck)
            {
                mvt_id.Add(ul.mvt_id);
            }
            if (ub.enable && ub.visible && ub.check && ub.autoCheck)
            {
                mvt_id.Add(ub.mvt_id);
            }
            if (uw.enable && uw.visible && uw.check && uw.autoCheck)
            {
                mvt_id.Add(uw.mvt_id);
            }
            if (mvt_id.Count() == 0)
            {
                lbAlertMsg.Text = "กรุณาเลือก Order ที่ต้องการตรวจเพิ่มอย่างน้อย 1 รายการ";
                StatusWK();
            }
            else
            {
                if (CheckMinLower())
                {
                    if (SkipLower())
                    {
                        Class.FunctionDataCls     func = new Class.FunctionDataCls();
                        EmrClass.GetDataMasterCls mst  = new EmrClass.GetDataMasterCls();
                        frmBGScreen frmbg = new frmBGScreen();
                        frmbg.Show();
                        Application.DoEvents();
                        try
                        {
                            if (new Class.FunctionDataCls().ChkSendAutoNewModule(Program.CurrentRegis))
                            {
                                string msgAlert = "";
                                bool   isPopup  = false;
                                QueueClass.SendAutoCls.ResultSendQueue result = new QueueClass.SendAutoCls().SendAuto((int)tps_id, mvt_id, user, ref msgAlert, ref isPopup);
                                if (result == QueueClass.SendAutoCls.ResultSendQueue.Error)
                                {
                                    lbAlertMsg.Text = msgAlert;
                                    StatusWK();
                                }
                                else if (result == QueueClass.SendAutoCls.ResultSendQueue.OldRoom)
                                {
                                    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;
                                        }
                                    }
                                }
                                //using (Service.WS_Checkup ws = new Service.WS_Checkup())
                                //{
                                //    WS_PathWay.SendAutoResult result = ws.SendAuto((int)tps_id, mvt_id.ToArray(), user.mut_username, Program.CurrentSite.mhs_id);
                                //    if (result.SendResult == WS_PathWay.Result.Error)
                                //    {
                                //        lbAlertMsg.Text = result.AlertMsg;
                                //        StatusWK();
                                //    }
                                //    else
                                //    {
                                //        if (result.SendResult == WS_PathWay.Result.Complete)
                                //        {
                                //            new ClsTCPClient().sendClearUnitDisplay();
                                //            new Class.ReserveSkipCls().SendAndReserve(tpr_id);
                                //            StatusEmptyRoom();
                                //            this.tpr_id = null;
                                //            lbAlertMsg.Text = result.AlertMsg;
                                //        }
                                //        else
                                //        {
                                //            lbAlertMsg.Text = result.AlertMsg;
                                //            StatusWK();
                                //        }
                                //    }
                                //}
                            }
                            else
                            {
                                StatusTransaction result = CallQueue.SendAutoOnStation(mvt_id);
                                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();
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            lbAlertMsg.Text = ex.Message;
                            StatusWK();
                        }
                        finally
                        {
                            frmbg.Close();
                        }
                    }
                    else
                    {
                        StatusWK();
                    }
                }
                else
                {
                    StatusWK();
                }
            }
        }
示例#2
0
        private void btnSendAuto_Click(object sender, EventArgs e)
        {
            DisableBtnAll();
            DateTime startDate = DateTime.Now;

            this.AutoScrollPosition = new Point(0, 0);

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

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

            try
            {
                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;
                        QueueClass.SendAutoCls.ResultSendQueue result = new QueueClass.SendAutoCls().SendAuto((int)tps_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();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                lbAlertMsg.Text = ex.Message;
                StatusWK();
            }
            frmbg.Close();
        }
示例#3
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();
        }