示例#1
0
        private void newWaitingListStationUC1_OnWaitingSuccessProcess(object sender, StatusTransaction isCallQueue, string e)
        {
            this.AutoScrollPosition = new Point(0, 0);
            lbAlertMsg.Text         = e;
            if (isCallQueue == StatusTransaction.True)
            {
                DisableBtnAll();
                frmBGScreen frmbg = new frmBGScreen();
                frmbg.Show();
                Application.DoEvents();

                if (Program.CurrentRegis != null)
                {
                    this.tpr_id = Program.CurrentRegis.tpr_id;
                    this.tps_id = Program.CurrentPatient_queue.tps_id;
                    clsCountDown.startCountDown(0, clsCountDown.GetTimeCountDown());
                    StatusNSWR();
                }
                else
                {
                    lbAlertMsg.Text = "No patient on queue!";
                    StatusEmptyRoom();
                }
                frmbg.Close();
            }
        }
示例#2
0
        private void GridWaitingList_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (_mrm_id == null || _mrd_id == null || mut_id == null)
            {
            }
            else
            {
                if (e.RowIndex < 0)
                {
                    return;
                }
                try
                {
                    if (!_ableDoubleClick)
                    {
                        return;
                    }
                    DataGridView dgv = (DataGridView)sender;
                    Class.WaitingListCls.WaitingListDtl data = (Class.WaitingListCls.WaitingListDtl)dgv.Rows[e.RowIndex].DataBoundItem;
                    int         tpr_id  = data.tpr_id;
                    string      queueNo = "";
                    int         tps_id  = 0;
                    frmBGScreen frmbg   = new frmBGScreen();
                    frmbg.Show();
                    Application.DoEvents();

                    StatusTransaction onWaiting = new Class.FunctionDataCls().checkStatusWaiting(tpr_id, (int)_mrm_id, ref tps_id, ref queueNo);
                    frmbg.Close();
                    if (onWaiting == StatusTransaction.False)
                    {
                        _OnWaitingSuccessProcess(StatusTransaction.False, queueNo + " อยู่ในสถานะที่ไม่สามารถดำเนินการได้ กรุณาตรวจสอบ");
                    }
                    else
                    {
                        string            messageAlert = "";
                        frmManageWaiting  frmWaiting   = new frmManageWaiting();
                        StatusTransaction isCallQ      = frmWaiting.isCallQueue(tps_id, ref messageAlert);
                        if (isCallQ == StatusTransaction.True)
                        {
                        }
                        _OnWaitingSuccessProcess(isCallQ, messageAlert);
                    }
                }
                catch (Exception ex)
                {
                    Program.MessageError(this.Name, "GridWaitingList_CellDoubleClick", ex, false);
                }
                finally
                {
                    Program.RefreshWaiting = true;
                }
            }
        }
示例#3
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            frmBGScreen frmbg = new frmBGScreen();

            frmbg.Show();
            LoadHandlerCountDown();
            this.Text = PrePareData.StaticDataCls.RoomName(this.Text);
            if (FormStatus == formStatus.isStation)
            {
                //uiFooter1.LoadData();
                refreshTool();
            }
            frmbg.Close();
        }
示例#4
0
        private void GridWaitingList_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }
            try
            {
                if (!_ableDoubleClick)
                {
                    return;
                }

                Program.RefreshWaiting = false;
                int         tpr_id  = (int)(GridWaitingList.Rows[e.RowIndex].Cells["tpr_id"].Value);
                string      queueNo = "";
                int         tps_id  = 0;
                frmBGScreen frmbg   = new frmBGScreen();
                frmbg.Show();
                Application.DoEvents();
                StatusTransaction onWaiting = new Class.FunctionDataCls().checkStatusWaiting(tpr_id, Program.CurrentRoom.mrm_id, ref tps_id, ref queueNo);
                frmbg.Close();
                if (onWaiting == StatusTransaction.False)
                {
                    _OnWaitingSuccessProcess(StatusTransaction.False, queueNo + " อยู่ในสถานะที่ไม่สามารถดำเนินการได้ กรุณาตรวจสอบ");
                }
                else
                {
                    string            messageAlert = "";
                    frmManageWaiting  frmWaiting   = new frmManageWaiting();
                    StatusTransaction isCallQ      = frmWaiting.isCallQueue(tps_id, ref messageAlert);
                    if (isCallQ == StatusTransaction.True)
                    {
                    }
                    _OnWaitingSuccessProcess(isCallQ, messageAlert);
                }
            }
            catch (Exception ex)
            {
                Program.MessageError("UIWaitList", "GridWaitingList_CellDoubleClick", ex, false);
            }
            finally
            {
                Program.RefreshWaiting = true;
            }
        }
示例#5
0
        private void btnSendToCheckB_Click(object sender, EventArgs e)
        {
            DisableBtnAll();

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

            frmBGScreen frmbg = new frmBGScreen();

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

            if (saveData())
            {
                int               tps_id  = Program.CurrentPatient_queue.tps_id;
                int               mrm_id  = Program.CurrentRoom.mrm_id;
                string            messege = "";
                StatusTransaction sendToB = new Class.SendQueue().SendToCheckB((int)tpr_id, mrm_id, ref messege);
                if (sendToB == StatusTransaction.True)
                {
                    new Class.logPatientFlowCls(Class.logPatientFlowCls.sendType.SendCheckB,
                                                (int)tpr_id,
                                                tps_id,
                                                Program.CurrentSite.mhs_id,
                                                Program.CurrentRoom.mrd_ename,
                                                Program.CurrentUser.mut_username);

                    new ClsTCPClient().sendClearUnitDisplay();
                    lbAlertMsg.Text = messege;
                    StatusEmptyRoom();
                    this.tpr_id = null;
                }
                else if (sendToB == StatusTransaction.Error)
                {
                    lbAlertMsg.Text = "ระบบเกิดความผิดพลาดไม่สามารถส่งไปยัง Checkpoint B ได้ กรุณา กดปุ่ม go to Checkpoint B อีกครั้ง";
                    StatusWK();
                }
            }
            else
            {
                lbAlertMsg.Text = "Save Data Incomplete. Please Try Again.";
                StatusWK();
            }

            frmbg.Close();
        }
示例#6
0
        private void btnCallQueue_Click(object sender, EventArgs e)
        {
            DisableBtnAll();
            this.AutoScrollPosition = new Point(0, 0);

            frmBGScreen frmbg = new frmBGScreen();

            frmbg.Show();
            try
            {
                //noina
                StatusTransaction callQ = CallQueue.P_CallQueueWaitReady();
                //end noina

                if (callQ == StatusTransaction.Error)
                {
                    lbAlertMsg.Text      = "กรุณากด Call Queue อีกครั้ง";
                    btnCallQueue.Enabled = true;
                }
                else
                {
                    if (Program.CurrentRegis != null)
                    {
                        this.tpr_id = Program.CurrentRegis.tpr_id;
                        clsCountDown.startCountDown(0, clsCountDown.GetTimeCountDown());
                        StatusNSWR();
                    }
                    else
                    {
                        lbAlertMsg.Text = "No patient on queue!";
                        StatusEmptyRoom();
                    }
                }
            }
            catch (Exception ex)
            {
                Program.MessageError(this.Name, "btnCallQueue_Click", ex, false);
            }
            finally
            {
                frmbg.Close();
            }
        }
示例#7
0
        private void btnCallQueue_Click(object sender, EventArgs e)
        {
            DisableBtnAll();
            this.AutoScrollPosition = new Point(0, 0);

            frmBGScreen frmbg = new frmBGScreen();

            frmbg.Show();
            try
            {
                //noina
                if (this.mrd_id != null && this.user != null)
                {
                    QueueClass.TransactionQueueCls.PatientCallQueue CallQueue = new QueueClass.TransactionQueueCls().CallQueue((int)this.mrd_id, this.user.mut_id, this.user.mut_username);
                    if (CallQueue.Status == QueueClass.TransactionQueueCls.PatientCallQueue.StatusCallQueue.Error)
                    {
                        lbAlertMsg.Text = "กรุณากด Call Queue อีกครั้ง";
                        StatusEmptyRoom();
                    }
                    else if (CallQueue.Status == QueueClass.TransactionQueueCls.PatientCallQueue.StatusCallQueue.NoPatient)
                    {
                        lbAlertMsg.Text = "No patient on queue!";
                        StatusEmptyRoom();
                    }
                    else
                    {
                        this.tpr_id = CallQueue.tpr_id;
                        this.tps_id = CallQueue.tps_id;
                        clsCountDown.startCountDown(0, clsCountDown.GetTimeCountDown());
                        StatusNSWR();
                    }
                }
            }
            catch (Exception ex)
            {
                Program.MessageError(this.Name, "btnCallQueue_Click", ex, false);
            }
            finally
            {
                frmbg.Close();
            }
        }
示例#8
0
        public bool SendtoDocscan(string roomcode, int tprid, string en, string careProvider)
        {
            Boolean isCompleted = false;

            try
            {
                using (InhCheckupDataContext dbc = new InhCheckupDataContext())
                {
                    if (CheckPath(dbc, roomcode) == true)
                    {
                        frmBGScreen frmbg = new frmBGScreen();
                        frmbg.Show();
                        Application.DoEvents();
                        Send(roomcode, tprid);

                        if (SaveToDocScan(dbc, roomcode, tprid, en, careProvider))
                        {
                            //dbc.pw_Update_Docscan(tprid, roomcode);
                            dbc.SubmitChanges();
                            HistoryData.savestatus = "Send To Docscan Completed";
                            isCompleted            = true;
                        }
                        frmbg.Close();
                    }
                    else
                    {
                        HistoryData.savestatus = "Not found report !";
                    }
                }
            }
            catch
            {
                DeleteFile();
            }
            return(isCompleted);
        }
示例#9
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();
        }
示例#10
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();
                }
            }
        }
示例#11
0
        private void btnSendToCheckB_Click(object sender, EventArgs e)
        {
            DisableBtnAll();

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

            frmBGScreen frmbg = new frmBGScreen();

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

            int        mrm_id  = Program.CurrentRoom.mrm_id;
            string     messege = "";
            List <int> mvt_id  = new List <int>();

            if (uu.enable && uu.visible && uu.check)
            {
                mvt_id.Add(uu.mvt_id);
            }
            if (ul.enable && ul.visible && ul.check)
            {
                mvt_id.Add(ul.mvt_id);
            }
            if (ub.enable && ub.visible && ub.check)
            {
                mvt_id.Add(ub.mvt_id);
            }
            if (uw.enable && uw.visible && uw.check)
            {
                mvt_id.Add(uw.mvt_id);
            }
            if (mvt_id.Count() == 0)
            {
                lbAlertMsg.Text = "กรุณาเลือก Order ที่ต้องการตรวจเพิ่มอย่างน้อย 1 รายการ";
                StatusWK();
            }
            else
            {
                StatusTransaction sendToB = new Class.SendQueue().SendToCheckB((int)tpr_id, mvt_id, (int)this.tps_id, ref messege);
                if (sendToB == StatusTransaction.True)
                {
                    new Class.logPatientFlowCls(Class.logPatientFlowCls.sendType.SendCheckB,
                                                (int)tpr_id,
                                                (int)tps_id,
                                                Program.CurrentSite.mhs_id,
                                                Program.CurrentRoom.mrd_ename,
                                                Program.CurrentUser.mut_username);

                    new ClsTCPClient().sendClearUnitDisplay();
                    lbAlertMsg.Text = messege;
                    StatusEmptyRoom();
                    this.tpr_id = null;
                }
                else if (sendToB == StatusTransaction.Error)
                {
                    lbAlertMsg.Text = "ระบบเกิดความผิดพลาดไม่สามารถส่งไปยัง Checkpoint B ได้ กรุณา กดปุ่ม go to Checkpoint B อีกครั้ง";
                    StatusWK();
                }
            }
            frmbg.Close();
        }
示例#12
0
 public void GetHistory(string roomCode, string enCurrent, int tprid)
 {
     try
     {
         using (InhCheckupDataContext dbc = new InhCheckupDataContext())
         {
             frmBGScreen frmbg = new frmBGScreen();
             frmbg.Show();
             Application.DoEvents();
             HistoryData.filelength = 0;
             HistoryData.newImage   = null;
             HistoryData.bmpData    = null;
             HistoryData.arrlist.Clear();
             // getDocCode = dbc.pw_Get_DocCode(roomCode).ToList();
             DateTime datenow    = Program.GetServerDateTime();
             var      getDocCode = (from t1 in dbc.mst_reports
                                    join t2 in dbc.mst_report_docscans
                                    on t1.mrt_id equals t2.mrt_id
                                    where t1.mrt_code == roomCode &&
                                    t1.mrt_status == 'A' &&
                                    datenow >= t1.mrt_effective_date.Value &&
                                    (t1.mrt_expire_date != null ? (datenow <= t1.mrt_expire_date.Value) : true)
                                    orderby t2.mds_page_no
                                    select new
             {
                 filereport = t1.mrt_path_file + "/" + t1.mrt_file_name,
                 t2.mds_doc_code,
                 t2.mds_page_code,
                 t2.mds_page_no,
             }).ToList();
             DataSet   ds = new DataSet();
             DataTable dt = new DataTable();
             if (getDocCode.Count != 0)
             {
                 for (int i = 0; i <= getDocCode.Count - 1; i++)
                 {
                     string   hn     = (from t1 in dbc.trn_patient_regis where t1.tpr_id == tprid select t1.trn_patient.tpt_hn_no).FirstOrDefault();
                     string   strEn  = enCurrent;
                     string   strHn  = hn;
                     string[] sAryHN = strHn.Split('-');
                     string[] sAryEN = strEn.Split('-');
                     HistoryData.HN           = sAryHN[0] + sAryHN[1] + sAryHN[2];
                     HistoryData.EN           = sAryEN[0] + sAryEN[1] + sAryEN[2];
                     HistoryData.page         = getDocCode[i].mds_page_code + getDocCode[i].mds_page_no;
                     HistoryData.doctorCode   = Program.CurrentUser.mut_carevider_code;
                     HistoryData.locationCode = Program.CurrentSite.mhs_code;
                     HistoryData.documentCode = getDocCode[i].mds_doc_code;
                     //ds = wsSaveDocscan.getDocumentList(HistoryData.HN, HistoryData.EN, "", HistoryData.documentCode, HistoryData.page);
                     // ds = wsSaveDocscan.getDocumentList("0111006591", "O0113450939", "", "VVF", "A1");
                     if (ds != null)
                     {
                         dt = ds.Tables[0];
                         HistoryData.Totalpage = dt.Rows.Count;
                         for (int j = 0; j <= dt.Rows.Count - 1; j++)
                         {
                             HistoryData.item = dt.Rows[j][1].ToString();
                             HistoryData.img  = wsSaveDocscan.getImage(HistoryData.HN, HistoryData.EN, HistoryData.item);
                             //HistoryData.img = wsSaveDocscan.getImage("0111006591", "O0113450939", "1");
                             byte[]       buffer = HistoryData.img;
                             MemoryStream ms2    = new MemoryStream(buffer);
                             Bitmap       bmp    = new Bitmap(ms2);
                             Image        img    = (Image)bmp;
                             HistoryData.bmpData = bmp;
                             HistoryData.arrlist.Add(img);
                             HistoryData.filelength = HistoryData.filelength + 1;
                             HistoryData.newImage   = (Image)HistoryData.arrlist[j];
                         }
                         HistoryData.count = 0;
                     }
                 }
             }
             if (dt.Rows.Count != 0)
             {
                 if (HistoryData.showform != 'N')
                 {
                     frmViewDocScan frm = new frmViewDocScan();
                     frm.Show();
                 }
             }
             else
             {
                 MessageBox.Show("View docscan Failed ! Please contact administrator", "Information", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
             frmbg.Close();
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
示例#13
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();
        }