示例#1
0
        private void SearchGetDoctor(string strSearch)
        {
            if (RDRequestDoctorInDepart.Checked == true)
            {
                var objlistMstUserType = (from t1 in dbc.mst_user_types
                                          where t1.mut_type == 'D' &&
                                          t1.mut_out_checkup == false &&
                                          t1.mut_fullname.Contains(strSearch) &&
                                          t1.mut_status == 'A'
                                          select new { DoctorName = t1.mut_fullname, DoctorCode = t1.mut_username }).ToList();
                GridDoctorName.DataSource              = objlistMstUserType;
                GridDoctorName.Columns[1].Visible      = false;
                GridDoctorName.Columns[0].HeaderText   = "Doctor Name";
                GridDoctorName.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                if (objlistMstUserType.Count() > 0)
                {
                    GridDoctorName.Visible = true;
                }
            }
            else
            {
                try
                {
                    if (strSearch.Length >= 2)
                    {
                        GridDoctorName.Visible = true;
                        using (Service.WS_TrakcareCls ws = new Service.WS_TrakcareCls())
                        {
                            DataTable dt = ws.GetCareprovider(strSearch);

                            GridDoctorName.DataSource = dt;

                            GridDoctorName.Columns[0].Visible = false;
                            GridDoctorName.Columns[1].Visible = false;
                            GridDoctorName.Columns[2].Visible = false;
                            GridDoctorName.Columns[3].Visible = false;

                            GridDoctorName.Columns[4].Visible      = true;
                            GridDoctorName.Columns[4].HeaderText   = "Doctor Name";
                            GridDoctorName.Columns[4].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                            GridDoctorName.Visible = true;
                        }
                    }
                    else if (strSearch.Length >= 2)
                    {
                        GridDoctorName.Visible = true;
                        var datasourc = DoctorList.Where(c => c.CTPCP_Desc.Contains(strSearch));
                        GridDoctorName.DataSource = datasourc;
                    }
                    else
                    {
                        GridDoctorName.Visible = false;
                    }
                }
                catch (Exception)
                {
                    // Program.MessageError("=>SearchGetDoctor :" + ex.Message);
                }
            }
        }
示例#2
0
 private void SearchOtherAddress(string strtext)
 {
     if (strtext.Length > 1)
     {
         using (Service.WS_TrakcareCls ws = new Service.WS_TrakcareCls())
         {
             DataTable dt = ws.ListAddress(strtext);
             GridOtherAddress.DataSource = dt;
             if (GridOtherAddress.Rows.Count > 0)
             {
                 GridOtherAddress.Visible = true;
             }
         }
     }
 }
示例#3
0
 private void LoadAppointment(string hn)
 {
     if (hn != String.Empty)
     {
         using (Service.WS_TrakcareCls ws = new Service.WS_TrakcareCls())
         {
             //string HN_No = dbc.trn_patients.Where(c => c.tpt_id == dbc.trn_patients.Where(c => c.tpt_hn_no == hn).Single().tpt_id).Single().tpt_hn_no;
             DataTable Dt = ws.GetAppointmentByHN(hn, "N");
             for (int i = 0; i < Dt.Rows.Count; i++)
             {
                 GvAppointmentSub.Rows.Add(i + 1, String.Format("{0:dd/MM/yyyy} {1}", Dt.Rows[i]["AS_Date"], Dt.Rows[i]["AS_SessStartTime"]), Dt.Rows[i]["CTLOC_Desc"].ToString(), Dt.Rows[i]["SER_Desc"].ToString(), Dt.Rows[i]["RES_Desc"].ToString());
             }
         }
     }
 }
示例#4
0
 private void LoadAppointment()
 {
     if (Program.CurrentRegis != null)
     {
         using (Service.WS_TrakcareCls ws = new Service.WS_TrakcareCls())
         {
             string    HN_No = dbc.trn_patients.Where(c => c.tpt_id == Program.CurrentRegis.tpt_id).Single().tpt_hn_no;
             DataTable Dt    = ws.GetAppointmentByHN(HN_No, "N");
             for (int i = 0; i < Dt.Rows.Count; i++)
             {
                 GvAppointment.Rows.Add(i + 1, String.Format("{0:dd/MM/yyyy} {1}", Dt.Rows[i]["AS_Date"], Dt.Rows[i]["AS_SessStartTime"]), Dt.Rows[i]["CTLOC_Desc"].ToString(), Dt.Rows[i]["SER_Desc"].ToString(), Dt.Rows[i]["RES_Desc"].ToString());
             }
         }
     }
 }
示例#5
0
        private void LoadDiagnosis()
        {
            if (Program.CurrentRegis != null)
            {
                using (Service.WS_TrakcareCls ws = new Service.WS_TrakcareCls())
                {
                    string HN_No = dbc.trn_patients.Where(c => c.tpt_id == Program.CurrentRegis.tpt_id).Single().tpt_hn_no;

                    DataTable Dt           = ws.GetTop5Diagnosis(HN_No);
                    var       objDiagnosis = (from DataRow t2 in Dt.Rows select t2).OrderByDescending(c => c.Field <DateTime>("MRDIA_Date")).ToList();
                    for (int i = 0; i < objDiagnosis.Count; i++)
                    {
                        GvDiagnosis.Rows.Add(i + 1, String.Format("{0:dd/MM/yyyy}", objDiagnosis[i]["MRDIA_Date"]), objDiagnosis[i]["MRCID_Code"].ToString(), objDiagnosis[i]["MRCID_Desc"].ToString(), objDiagnosis[i]["DTYP_Desc"].ToString(), objDiagnosis[i]["SSUSR_Name"].ToString());
                    }
                }
            }
        }
示例#6
0
        private void LoadDiagnosis(string hn)
        {
            if (hn != String.Empty)
            {
                using (Service.WS_TrakcareCls ws = new Service.WS_TrakcareCls())
                {
                    string HN_No = hn;

                    DataTable Dt           = ws.GetTop5Diagnosis(HN_No);
                    var       objDiagnosis = (from DataRow t2 in Dt.Rows select t2).OrderByDescending(c => c.Field <DateTime>("MRDIA_Date")).ToList();
                    for (int i = 0; i < objDiagnosis.Count; i++)
                    {
                        GvDiagnosis.Rows.Add(i + 1, objDiagnosis[i]["MRDIA_Date"], objDiagnosis[i]["MRCID_Code"].ToString(), objDiagnosis[i]["MRCID_Desc"].ToString(), objDiagnosis[i]["DTYP_Desc"].ToString(), objDiagnosis[i]["SSUSR_Name"].ToString());
                    }
                }
            }
        }
示例#7
0
        private void LoadDiagnosisAll(string Date_S, string Date_E, string HN_No)
        {
            lblMsgAlert.Text = String.Empty;
            if (Program.CurrentRegis != null || refhn != null)
            {
                using (Service.WS_TrakcareCls ws = new Service.WS_TrakcareCls())
                {
                    DataTable Dt = ws.GetDiagnosisByDate(HN_No, Date_S, Date_E);

                    if (Dt.Rows.Count == 0)
                    {
                        lblMsgAlert.Text = "No Data.";
                    }
                    for (int i = 0; i < Dt.Rows.Count; i++)
                    {
                        GvDiagnosis.Rows.Add(i + 1, String.Format("{0:dd/MM/yyyy}", Dt.Rows[i]["MRDIA_Date"]), Dt.Rows[i]["MRCID_Code"].ToString(), Dt.Rows[i]["MRCID_Desc"].ToString(), Dt.Rows[i]["DTYP_Desc"].ToString(), Dt.Rows[i]["SSUSR_Name"].ToString());
                    }
                }
            }
        }
示例#8
0
        private void GetPackageTakecare(String RowID)
        {
            btnloadPackageTK.Enabled = false;
            try
            {
                if (RowID == null || RowID == "")
                {
                    return;
                }
                //Get from web service
                using (Service.WS_TrakcareCls ws = new Service.WS_TrakcareCls())
                {
                    DataTable dt = ws.GetPTPackage(Convert.ToInt32(RowID));
                    //show Package

                    //Save Pakcage to Base
                    List <TmpOrderSet> packageList = new List <TmpOrderSet>();
                    foreach (DataRow dr in dt.Rows)
                    {
                        TmpOrderSet newitem = new TmpOrderSet();
                        newitem.Code  = dr["ARCOS_Code"].ToString();
                        newitem.Desc  = dr["ARCOS_Desc"].ToString();
                        newitem.RowID = dr["ARCOS_RowId"].ToString();
                        packageList.Add(newitem);
                    }
                    var pklist = packageList.DistinctBy(pk => new { pk.RowID, pk.Code, pk.Desc });
                    GridPackage.DataSource = pklist;
                }
            }
            catch (Exception ex)
            {
                Program.MessageError(this.Name, "GetPackageTakecare", ex, false);
                throw;
            }
            btnloadPackageTK.Enabled = true;
        }
示例#9
0
        private void frmPreRegister_Load(object sender, EventArgs e)
        {
            this.Text           = "Pre Register";
            lbDataFullName.Text = FullName;
            lbDataHN.Text       = HNno;
            frmBGScreen frmbg = new frmBGScreen();

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

            LoadData();

            Application.DoEvents();
            try
            {
                DateTime datenow = Program.GetServerDateTime();

                var objlocation = (from t1 in dbc.mst_locations
                                   where datenow.Date >= t1.mlc_effective_date.Value.Date &&
                                   (t1.mlc_expire_date == null || (t1.mlc_expire_date != null && datenow.Date <= t1.mlc_expire_date.Value.Date))
                                   select new LocationRegis {
                    strlocation = t1.mlc_ename
                }).ToList();
                LocationRegis newselect = new LocationRegis();
                newselect.strlocation = "- Select -";
                objlocation.Insert(0, newselect);
                DDLocation.DataSource    = objlocation;
                DDLocation.DisplayMember = "strlocation";
                DDLocation.ValueMember   = "strlocation";
                if (isAddnew == true)
                {
                    using (Service.WS_TrakcareCls ws = new Service.WS_TrakcareCls())
                    {
                        string SiteCode = Program.CurrentSite.mhs_code;

                        //LoadOutDepart
                        DataTable dtOutDepart = ws.getApptByHN(HNno, SiteCode, datenow.ToString("yyyy-MM-dd"));
                        foreach (DataRow droutDepart in dtOutDepart.Rows)
                        {
                            tmp_out_department newitem = (tmp_out_department)tmpoutdepartmentsBindingSource.AddNew();
                            newitem.description = droutDepart["SER_Desc"].ToString();
                            newitem.location    = droutDepart["CTLOC_Desc"].ToString();

                            try
                            {
                                DateTime dtdata       = Convert.ToDateTime(droutDepart["AS_Date"].ToString());
                                TimeSpan tarrivaltime = TimeSpan.Parse(droutDepart["AS_SessStartTime"].ToString().Replace("PT", "").Replace("H", ":").Replace("M", ""));
                                newitem.start_date = new DateTime(dtdata.Year, dtdata.Month, dtdata.Day, tarrivaltime.Hours, tarrivaltime.Minutes, 0);
                            }
                            catch (Exception)
                            {
                                newitem.start_date = null;
                                return;
                            }
                        }
                    }
                }
                GenRowNoDridoutDepartment();
                //this.GetPackageTakecare(Program.Tmp_GetPtarrived.paadm_rowid);// Load Pacakge
            }
            catch (Exception ex)
            {
                Program.MessageError(this.Name, "frmPreRegister_Load", ex, false);
                //throw;
            }

            //ไม่Default Aviation Type
            RDAviationCategoryNewcase.Enabled = false;
            RDaviationTypeFollowup.Enabled    = false;
            RDAviationCategoryNewcase.Checked = false;
            RDaviationTypeFollowup.Checked    = false;
            CBAviationCategory.Enabled        = false;
            // Other
            GridOtherAddress.AutoGenerateColumns = false;
            panel2.Enabled = true;
            GC.Collect();

            frmbg.Close();
        }
示例#10
0
        //private void btnSearch_Click(object sender, EventArgs e)
        //{
        //    label3.Visible = false;
        //    label4.Visible = false;
        //    using (InhCheckupDataContext cdc = new InhCheckupDataContext())
        //    {
        //        trn_patient patient = cdc.trn_patients
        //                                 .Where(x => x.tpt_hn_no == txtSearchHN.Text ||
        //                                             x.tpt_hn_no.Replace("-", "") == txtSearchHN.Text).FirstOrDefault();
        //        if (patient != null)
        //        {
        //            trn_patient_regi patient_regis = patient.trn_patient_regis
        //                                                    .Where(x => x.tpr_en_no == txtSearchEN.Text ||
        //                                                                x.tpr_en_no.Replace("-", "") == txtSearchEN.Text).FirstOrDefault();
        //            if (patient_regis != null)
        //            {
        //                patientProfileUC1.tpr_id = patient_regis.tpr_id;
        //                List<Class.GetDataFromWSTrakCare.StationStatus> list_StationStatus = new List<Class.GetDataFromWSTrakCare.StationStatus>();
        //                new Class.GetDataFromWSTrakCare().WS_GetPTPackageAllStation(ref list_StationStatus, patient_regis.tpr_id);

        //                var source = (from ss in list_StationStatus
        //                              join me in cdc.mst_events
        //                              on ss.mvt_id equals me.mvt_id
        //                              select new strGridStation
        //                              {
        //                                  station_name = me.mvt_ename,
        //                                  mvt_id = ss.mvt_id,
        //                                  status = ss.status
        //                              }).ToList();
        //                gridStation.DataSource = source;

        //                foreach (DataGridViewRow gr in gridStation.Rows)
        //                {
        //                    gr.Cells["colChk"].Value = true;
        //                    if (gr.Cells["colStatus"].Value.ToString() == "E")
        //                    {
        //                        gr.Cells["colChk"].ReadOnly = true;
        //                    }
        //                    else
        //                    {
        //                        gr.Cells["colChk"].ReadOnly = false;
        //                    }
        //                }
        //                btnImport.Enabled = true;
        //                _tpr_id = patient_regis.tpr_id;
        //            }
        //            else
        //            {
        //                label4.Visible = true;
        //                gridStation.DataSource = new List<strGridStation>();
        //                patientProfileUC1.Clear();
        //                txtSearchEN.Focus();
        //                txtSearchEN.SelectionStart = 0;
        //                txtSearchEN.SelectionLength = txtSearchEN.Text.Length;
        //                btnImport.Enabled = false;
        //                _tpr_id = null;
        //            }
        //        }
        //        else
        //        {
        //            label3.Visible = true;
        //            gridStation.DataSource = new List<strGridStation>();
        //            patientProfileUC1.Clear();
        //            txtSearchHN.Focus();
        //            txtSearchHN.SelectionStart = 0;
        //            txtSearchHN.SelectionLength = txtSearchEN.Text.Length;
        //            btnImport.Enabled = false;
        //            _tpr_id = null;
        //        }
        //    }
        //} //del suriya 01/04/2015

        private bool ImportPatient(ref int?tpr_id)
        {
            try
            {
                tpr_id = null;
                using (Service.WS_TrakcareCls ws = new Service.WS_TrakcareCls())
                {
                    var resultEPI = ws.GetEPIRowIDByEN(txtSearchEN.Text).AsEnumerable()
                                    .Select(x => new
                    {
                        en           = x.Field <string>("PAADM_ADMNo"),
                        en_rowid     = x.Field <int>("PAADM_RowID"),
                        arrived_date = x.Field <DateTime>("PAADM_AdmDate")
                    }).FirstOrDefault();
                    if (resultEPI == null)
                    {
                        MessageBox.Show("ไม่พบ Episode นี้ในระบบ Trakcare", "Warning!!");
                        return(false);
                    }
                    else
                    {
                        using (InhCheckupDataContext cdc = new InhCheckupDataContext())
                        {
                            trn_patient_regi patient_regis = cdc.trn_patient_regis
                                                             .Where(x => x.tpr_en_no == resultEPI.en)
                                                             .FirstOrDefault();
                            if (patient_regis == null)
                            {
                                var resultArrived = ws.GetPTArrivedCheckUpFilter(Program.CurrentSite.mhs_code, resultEPI.en, resultEPI.arrived_date.ToString("yyyy-MM-dd")).AsEnumerable()
                                                    //var resultArrived = ws.GetPTArrivedCheckUpFilter(Program.CurrentSite.mhs_code, resultEPI.en, "2017-03-08").AsEnumerable()
                                                    .Select(x => new tmp_getptarrived
                                {
                                    paadm_type_of_patient_calc = x.Field <string>("PAADM_Type_of_Patient_Calc"),
                                    paadm_rowid      = x.Field <int>("PAADM_RowID").ToString(),
                                    appt_rowid       = x.Field <string>("APPT_RowId"),
                                    appt_arrivaltime = x.Field <TimeSpan>("APPT_ArrivalTime").ToString(),
                                    paadm_admdate    = x.Field <DateTime?>("PAADM_AdmDate"),
                                    allergy_eng      = new APITrakcare.GetAllergyCls().GetByHN(x.Field <string>("PAPMI_No")),                //call webserice
                                    paadm_admno      = x.Field <string>("PAADM_ADMNo"),
                                    papmi_no         = x.Field <string>("PAPMI_No"),
                                    ttl_desc         = x.Field <string>("TTL_Desc"),
                                    papmi_name       = x.Field <string>("PAPMI_Name"),
                                    papmi_name2      = x.Field <string>("PAPMI_Name2"),
                                    appt_transdate   = x.Field <DateTime?>("APPT_TransDate"),
                                    appt_datesearch  = x.Field <DateTime?>("APPT_DateSearch"),
                                    paadm_admtime    = x.Field <TimeSpan>("PAADM_admTime").ToString(),
                                    ctloc_code       = Program.CurrentSite.mhs_code,
                                    ctloc_desc       = x.Field <string>("CTLOC_Desc"),
                                    penstype_code    = x.Field <string>("PENSTYPE_Code"),
                                    penstype_desc    = x.Field <string>("PENSTYPE_Desc"),
                                    ser_rowid        = x.Field <int>("SER_RowId"),
                                    ser_desc         = x.Field <string>("SER_Desc"),
                                    ctnat_code       = x.Field <string>("CTNAT_Code"),
                                    ctnat_desc       = x.Field <string>("CTNAT_Desc"),
                                    ctsex_code       = x.Field <string>("CTSEX_Code"),
                                    ctsex_desc       = x.Field <string>("CTSEX_Desc"),
                                    papmi_dob        = x.Field <DateTime?>("PAPMI_DOB"),
                                    paper_photo      = new EmrClass.GetPatientImage().getByPath(x.Field <string>("PAPMI_No")),

                                    paper_ageyr    = x.Field <string>("PAPER_AgeYr"),
                                    paper_agemth   = x.Field <string>("PAPER_AgeMth"),
                                    paper_ageday   = x.Field <string>("PAPER_AgeDay"),
                                    paper_stname   = x.Field <string>("PAPER_StName"),
                                    citarea_desc   = x.Field <string>("CITAREA_Desc"),
                                    prov_desc      = x.Field <string>("PROV_Desc"),
                                    ctcit_desc     = x.Field <string>("CTCIT_Desc"),
                                    ctzip_code     = x.Field <string>("CTZIP_Code"),
                                    paper_id       = x.Field <string>("PAPER_ID"),
                                    paper_telo     = x.Field <string>("PAPER_TelO"),
                                    paper_telh     = x.Field <string>("PAPER_TelH"),
                                    paper_mobphone = x.Field <string>("PAPER_MobPhone"),
                                    paper_email    = x.Field <string>("PAPER_Email"),

                                    ctmar_desc  = x.Field <string>("CTMAR_Desc"),
                                    paper_name5 = x.Table.Columns.Contains("PAPMI_Name5")
                                                                        ? x.Field <string>("PAPMI_Name5")
                                                                        : x.Table.Columns.Contains("PAPER_Name5")
                                                                        ? x.Field <string>("PAPER_Name5")
                                                                        : "",
                                    paper_name6 = x.Table.Columns.Contains("PAPMI_Name6")
                                                                        ? x.Field <string>("PAPMI_Name6")
                                                                        : x.Table.Columns.Contains("PAPER_Name6")
                                                                        ? x.Field <string>("PAPER_Name6")
                                                                        : "",
                                    paper_name7 = x.Table.Columns.Contains("PAPMI_Name7")
                                                                        ? x.Field <string>("PAPMI_Name7")
                                                                        : x.Table.Columns.Contains("PAPER_Name7")
                                                                        ? x.Field <string>("PAPER_Name7")
                                                                        : "",
                                    papmi_dob_text = x.Field <string>("papmi_dob_text")
                                }).FirstOrDefault();
                                if (resultArrived == null)
                                {
                                    MessageBox.Show("ไม่พบ Episode นี้ใน Location ==>" + Program.CurrentSite.mhs_ename, "Warning!!");
                                    return(false);
                                }
                                else
                                {
                                    bool regis = new EmrClass.FunctionDataCls().RegisterPatient(resultArrived);
                                    if (!regis)
                                    {
                                        MessageBox.Show("โปรดลองอีกครั้ง");
                                        return(false);
                                    }
                                    else
                                    {
                                        patient_regis = cdc.trn_patient_regis
                                                        .Where(x => x.tpr_en_no == resultEPI.en)
                                                        .FirstOrDefault();
                                    }
                                }
                            }

                            tpr_id = patient_regis.tpr_id;
                            return(true);
                        }
                    }
                }
            }
            catch
            {
                MessageBox.Show("โปรดลองอีกครั้ง");
                return(false);
            }
        }
示例#11
0
        private tmp_getptarrived getArrivedByHn(string hn)
        {
            lbAlert.Text        = "Searching...";
            btnCancel.Enabled   = false;
            btnContinue.Enabled = false;
            btnSearch.Enabled   = false;
            Application.DoEvents();

            string tmpHN = hn.Replace("-", "");

            System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture("en-US");
            //using (InhCheckupDataContext cdc = new InhCheckupDataContext())
            //{
            //    DateTime dateNow = Program.GetServerDateTime();
            //    List<vw_tmp_arrive> result = cdc.vw_tmp_arrives
            //                                    .Where(x => (x.papmi_no == tmpHN || x.papmi_no.Replace("-", "") == tmpHN) &&
            //                                                x.paadm_admdate.Value.Date == dateNow.Date).ToList();
            //    if (result.Count > 0)
            //    {
            //        result = result.Where(x => x.flag_success == 'N' || x.flag_success == null).ToList();
            //        if (result.Count > 0)
            //        {
            //            int row_id = result.Select(x => x.row_id).FirstOrDefault();
            //            return get_tgaByRowID(row_id);
            //        }
            //        else
            //        {
            //            lbAlert.Text = "This HN No. is processing on EMR-checkup.";
            //        }
            //    }
            //    else
            //    {
            //        lbAlert.Text = "This HN No. is not found.";
            //    }
            //    return null;
            //}
            try
            {
                string currentSite     = null;
                string currentSiteName = null;
                if (Program.CurrentSite != null)
                {
                    currentSite = Program.CurrentSite.mhs_code;
                    mst_hpc_site mhs = Program.getMstHpcSiteByMshCode(currentSite);
                    currentSiteName = mhs != null ? mhs.mhs_ename : null;
                }
                if (currentSite != null)
                {
                    DateTime dateTime = Program.GetServerDateTime();
                    string   hn_pos1  = tmpHN.Length >= 2 ? tmpHN.Substring(0, 2) : "";
                    string   hn_pos2  = tmpHN.Length >= 4 ? tmpHN.Substring(2, 2) : "";
                    string   hn_pos3  = tmpHN.Length >= 5 ? tmpHN.Substring(4) : "";

                    string realHN = hn_pos1 + "-" + hn_pos2 + "-" + hn_pos3;

                    using (InhCheckupDataContext cdc = new InhCheckupDataContext())
                    {
                        List <tmp_getptarrived> tmpArrived = cdc.tmp_getptarriveds.Where(x => x.papmi_no == realHN && x.paadm_admdate.Value.Date == dateTime.Date)
                                                             .ToList();
                        if (tmpArrived.Count > 0)
                        {
                            if (tmpArrived.Where(x => x.flag_success == 'Y').Count() != 0)
                            {
                                lbAlert.Text = "This HN No. is processing on EMR-checkup.";
                                return(null);
                            }
                        }
                        EmrClass.GetDataFromWSTrakCare cls = new EmrClass.GetDataFromWSTrakCare();
                        using (Service.WS_TrakcareCls ws = new Service.WS_TrakcareCls())
                        {
                            string           dateNow = Program.GetServerDateString();
                            string           timeNow = string.Format(DateTime.Now.ToString("{0}HH{1}mm{2}ss{3}"), "PT", "H", "M", "S");
                            tmp_getptarrived tga     = ws.GetPTOrderByLocDateHn(currentSite, dateNow, realHN).AsEnumerable()
                                                       .Select(x => new tmp_getptarrived
                            {
                                paadm_type_of_patient_calc = x.Field <string>("PAADM_Type_of_Patient_Calc"),
                                paadm_rowid      = x.Field <int?>("PAADM_RowID").ToString(),
                                appt_rowid       = x.Field <string>("APPT_RowId"),
                                appt_arrivaltime = timeNow,
                                paadm_admdate    = x.Field <DateTime?>("PAADM_AdmDate"),
                                allergy_eng      = new APITrakcare.GetAllergyCls().GetByHN(x.Field <string>("PAPMI_No")),
                                paadm_admno      = x.Field <string>("PAADM_ADMNo"),
                                papmi_no         = x.Field <string>("PAPMI_No"),
                                ttl_desc         = x.Field <string>("TTL_Desc"),
                                papmi_name       = x.Field <string>("PAPMI_Name"),
                                papmi_name2      = x.Field <string>("PAPMI_Name2"),
                                appt_transdate   = x.Field <DateTime?>("APPT_TransDate"),
                                appt_datesearch  = x.Field <DateTime?>("APPT_DateSearch"),
                                paadm_admtime    = x.Field <TimeSpan?>("PAADM_admTime").ToString(),
                                ctloc_code       = cls.returnMainSite(currentSite),
                                ctloc_desc       = currentSiteName,
                                penstype_code    = x.Field <string>("PENSTYPE_Code"),
                                penstype_desc    = x.Field <string>("PENSTYPE_Desc"),
                                ser_rowid        = x.Field <int?>("SER_RowId"),
                                ser_desc         = x.Field <string>("SER_Desc"),
                                ctnat_code       = x.Field <string>("CTNAT_Code"),
                                ctnat_desc       = x.Field <string>("CTNAT_Desc"),
                                ctsex_code       = x.Field <string>("CTSEX_Code"),
                                ctsex_desc       = x.Field <string>("CTSEX_Desc"),
                                papmi_dob        = x.Field <DateTime?>("PAPMI_DOB"),
                                paper_photo      = new EmrClass.GetPatientImage().getByPath(x.Field <string>("PAPER_Photo")),
                                paper_ageyr      = x.Field <string>("PAPER_AgeYr"),
                                paper_agemth     = x.Field <string>("PAPER_AgeMth"),
                                paper_ageday     = x.Field <string>("PAPER_AgeDay"),
                                paper_stname     = x.Field <string>("PAPER_StName"),
                                citarea_desc     = x.Field <string>("CITAREA_Desc"),
                                prov_desc        = x.Field <string>("PROV_Desc"),
                                ctcit_desc       = x.Field <string>("CTCIT_Desc"),
                                ctzip_code       = x.Field <string>("CTZIP_Code"),
                                paper_id         = x.Field <string>("PAPER_ID"),
                                paper_telo       = x.Field <string>("PAPER_TelO"),
                                paper_telh       = x.Field <string>("PAPER_TelH"),
                                paper_mobphone   = x.Field <string>("PAPER_MobPhone"),
                                paper_email      = x.Field <string>("PAPER_Email"),

                                ctmar_desc   = x.Field <string>("CTMAR_Desc"),
                                paper_name5  = x.Field <string>("PAPER_Name5"),
                                paper_name6  = x.Field <string>("PAPER_Name6"),
                                paper_name7  = x.Field <string>("PAPER_Name7"),
                                flag_success = 'Y',

                                LocWhenOrdOther = cls.returnMainSite(x.Field <string>("LocWhenOrdOther")),
                                //LocWhenOrdCheckup = x.Field<string>("LocWhenOrdCheckup"),
                                //LocWhenOrdConsult = cls.returnMainSite(x.Field<string>("LocWhenOrdConsult")),
                                LocWhenOrdOtherDesc = x.Field <string>("LocWhenOrdOtherDesc"),
                            }).FirstOrDefault();

                            //btnCancel.Enabled = true;
                            //btnContinue.Enabled = true;
                            //btnSearch.Enabled = true;
                            if (tga == null)
                            {
                                lbAlert.Text = "This HN No. is not found.";
                                return(null);
                            }
                            else
                            {
                                //if (tga.paper_photo == null)
                                //{
                                //    MemoryStream ms = new MemoryStream();
                                //    BKvs2010.Properties.Resources.no_image.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                                //    tga.paper_photo = ms.ToArray();
                                //}
                                //tmpArrived.ForEach(x => x.flag_success = 'Y');
                                //cdc.SubmitChanges();
                                lbAlert.Text = "";
                                return(tga);
                            }
                        }
                    }
                }
            }
            catch
            {
                lbAlert.Text = "This process is Error.";
            }
            finally
            {
                btnCancel.Enabled   = true;
                btnContinue.Enabled = true;
                btnSearch.Enabled   = true;
            }
            return(null);
        }
示例#12
0
        private void LoadAppointmentHead()
        {
            frmBGScreen frmbg = new frmBGScreen();

            frmbg.Show();

            if (dgvAppointments.Rows.Count > 0)
            {
                dgvAppointments.Rows.Clear();
            }

            try
            {
                using (Service.WS_TrakcareCls ws = new Service.WS_TrakcareCls())
                {
                    string    SiteCode = Program.CurrentSite.mhs_code;
                    DataTable dt       = ws.GetPTAppointment(SiteCode, ddlAppointDate.Value.ToString("yyyy-MM-dd"));

                    if (dt.Rows.Count != 0)
                    {
                        int i = 1;

                        var TmpDT = (from DataRow t1 in dt.Rows
                                     select new
                        {
                            No = i++,
                            HN = t1.Field <string>("PAPMI_No"),
                            Fullname = t1.Field <string>("Fullname"),
                            Date = Program.ConvertDateFromServer(t1.Field <DateTime>("AS_Date").ToString(), t1.Field <TimeSpan>("AS_SessStartTime").ToString()),
                            RowId = t1.Field <string>("APPT_RowId"),
                            TelNo = t1.Field <string>("PAPER_MobPhone")
                                    + ((t1.Field <string>("PAPER_TelO") != null) ? "," + t1.Field <string>("PAPER_TelO") : "")
                                    + ((t1.Field <string>("PAPER_TelH") != null) ? "," + t1.Field <string>("PAPER_TelH") : "")
                        }).ToList();
                        for (int a = 0; a < TmpDT.Count; a++)
                        {
                            dgvAppointments.Rows.Add(TmpDT[a].No, TmpDT[a].HN, TmpDT[a].Fullname, TmpDT[a].Date, TmpDT[a].TelNo, false, false, String.Empty, "ลงทะเบียน", TmpDT[a].RowId, 0);
                        }

                        for (int j = 0; j < dgvAppointments.Rows.Count; j++)
                        {
                            var objAp = (from ap in dbc.trn_appoints
                                         where ap.tap_row_id == dgvAppointments.Rows[j].Cells["Colrowid"].Value.ToString() &&
                                         ap.tap_appoint_date == Convert.ToDateTime(dgvAppointments.Rows[j].Cells["Colarrivedate"].Value)
                                         select ap).ToList();
                            if (objAp.Count != 0)
                            {
                                dgvAppointments.Rows[j].Cells["Colsms"].Value    = objAp[0].tap_contact_sms;
                                dgvAppointments.Rows[j].Cells["Coltel"].Value    = objAp[0].tap_contact_tel;
                                dgvAppointments.Rows[j].Cells["ColtapId"].Value  = objAp[0].tap_id;
                                dgvAppointments.Rows[j].Cells["Colremark"].Value = objAp[0].tap_remark;
                            }
                            else
                            {
                                dgvAppointments.Rows[j].Cells["Colsms"].Value    = false;
                                dgvAppointments.Rows[j].Cells["Coltel"].Value    = false;
                                dgvAppointments.Rows[j].Cells["ColtapId"].Value  = 0;
                                dgvAppointments.Rows[j].Cells["Colremark"].Value = String.Empty;
                            }

                            dgvAppointments.Rows[j].Cells["Colcall"].Value = "ลงทะเบียน";
                        }
                    }
                }
                frmbg.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }