private void RDmale_CheckedChanged(object sender, EventArgs e) { if (RDmale.Checked) { trn_patient currentpt = (trn_patient)PatientbindingSource1.Current; currentpt.tpt_gender = 'M'; } else if (RDFemale.Checked) { trn_patient currentpt = (trn_patient)PatientbindingSource1.Current; currentpt.tpt_gender = 'F'; } }
public bool RegisterPatient(tmp_getptarrived arrivedData) { try { using (InhCheckupDataContext cdc = new InhCheckupDataContext()) { DateTime dateNow = Program.GetServerDateTime(); EmrClass.GetDataFromWSTrakCare cls = new EmrClass.GetDataFromWSTrakCare(); trn_patient tpt = cdc.trn_patients.Where(x => x.tpt_hn_no == arrivedData.papmi_no).FirstOrDefault(); bool flagNewPatient = true; if (tpt != null) { flagNewPatient = false; } cls.otherClinicSkipToCheckB(arrivedData, ref tpt, Program.CurrentSite.mhs_id);//add Program.CurrentSite.mhs_id suriya 03/04/2015 List <trn_patient_regi> listRegis = tpt.trn_patient_regis.Where(x => x.tpr_en_no == arrivedData.paadm_admno).ToList(); foreach (trn_patient_regi regis in listRegis) { trn_doctor_hdr docHdr = regis.trn_doctor_hdrs.FirstOrDefault(); if (docHdr == null) { docHdr = new trn_doctor_hdr(); regis.trn_doctor_hdrs.Add(docHdr); docHdr.trh_create_date = dateNow; docHdr.trh_create_by = "SysImp"; docHdr.trh_update_date = dateNow; docHdr.trh_update_by = "SysImp"; } } if (flagNewPatient) { cdc.trn_patients.InsertOnSubmit(tpt); } cdc.SubmitChanges(); trn_patient_regi PatientRegis = tpt.trn_patient_regis.OrderByDescending(x => x.tpr_id).FirstOrDefault(); if (PatientRegis != null) { new EmrClass.GetPTPackageCls().setRelationOrderSet(ref PatientRegis); cdc.SubmitChanges(); } return(true); } } catch (Exception ex) { Program.MessageError("EmrClass.FunctionDataCls", "RegisterPatient", ex, false); return(false); } }
public static bool chkVIP() { if (CurrentSite != null && CurrentRegis != null) { trn_patient tpt = getPatientByTprID(CurrentRegis.tpr_id); if (tpt != null) { if (CurrentSite.mhs_code == "01HPC3" && tpt.tpt_vip_hpc == true) { return(true); } } } return(false); }
public trn_name_check getNameCheck(string hn_no) { using (InhCheckupDataContext cdc = new InhCheckupDataContext()) { trn_patient tpt = cdc.trn_patients.Where(x => x.tpt_hn_no == hn_no).FirstOrDefault(); if (tpt != null) { using (InhToDoListDataContext tdc = new InhToDoListDataContext()) { trn_name_check tnc = tdc.trn_name_checks.Where(x => x.tnc_fname == tpt.tpt_first_name && x.tnc_lname == tpt.tpt_last_name).OrderByDescending(x => x.tnc_create_date).FirstOrDefault(); return(tnc); } } } return(null); }
public static trn_patient getPatientByTprID(int?tpr_id) { try { using (InhCheckupDataContext cdc = new InhCheckupDataContext()) { trn_patient tpt = cdc.trn_patient_regis.Where(x => x.tpr_id == tpr_id).Select(x => x.trn_patient).FirstOrDefault(); return(tpt); } } catch (Exception ex) { Program.MessageError("Program", "getPatientByTprID", ex, false); return(null); } }
private void btnSave_Click(object sender, EventArgs e) { if (tpt_id == null) { MessageBox.Show("Please Select Patient."); txtPatientName.Focus(); } else if (mut_id == null) { MessageBox.Show("Please Select Doctor."); txtDoctor.Focus(); } else { DateTime dateNow = Program.GetServerDateTime(); trn_patient tpt = cdc.trn_patients.Where(x => x.tpt_id == tpt_id).FirstOrDefault(); trn_report_vaccine_hdr trvh = (trn_report_vaccine_hdr)bsVaccineHdr.Current; trvh.mut_id = mut_id; trvh.mhs_id = Program.CurrentSite.mhs_id; trvh.trvh_update_by = Program.CurrentUser.mut_username; trvh.trvh_update_date = dateNow; if (trvh.trvh_id == 0) { tpt.trn_report_vaccine_hdrs.Add(trvh); trvh.trvh_create_by = Program.CurrentUser.mut_username; trvh.trvh_create_date = dateNow; } else { bsVaccineHdr.EndEdit(); } cdc.SubmitChanges(); // แก้ bug colTimeName หาย หลังจาก submit foreach (DataGridViewRow row in gridDtl.Rows) { string val = ""; if (row.Cells["colTime"].Value != null) { val = row.Cells["colTime"].Value.ToString(); } row.Cells["colTimeName"].Value = mstTime.Where(x => x.val == val).Select(x => x.display).FirstOrDefault(); } // btnPrint.Enabled = true; } }
private void btnSave_Click(object sender, EventArgs e) { if (tpt_id == null) { MessageBox.Show("Please Select Patient."); txtPatientName.Focus(); } else if (mut_id == null) { MessageBox.Show("Please Select Doctor."); txtDoctor.Focus(); } else { DateTime dateNow = Program.GetServerDateTime(); trn_report_aviation_medical tram = (trn_report_aviation_medical)bsAviaMedCer.Current; tram.mut_id = mut_id; tram.tram_date_print = dateTimePicker1.Value.Date; tram.tram_date_exam = dateTimePicker2.Value.Date; tram.tram_purpose_physical = Program.GetValueRadioTochar(pnPurpose); tram.tram_assessment_aircrew = Program.GetValueRadio(pnAirMedCer); tram.tram_assessment_as = Program.GetValueRadio(pnAS); tram.tram_ass_as_remark = txtAsRemark.Text; tram.tram_update_by = Program.CurrentUser.mut_username; tram.tram_update_date = dateNow; trn_patient tpt = cdc.trn_patients.Where(x => x.tpt_id == tpt_id).FirstOrDefault(); if (tram.tram_id == 0) { tram.tram_create_by = Program.CurrentUser.mut_username; tram.tram_create_date = dateNow; tpt.trn_report_aviation_medicals.Add(tram); } else { bsAviaMedCer.EndEdit(); } cdc.SubmitChanges(); tram_id = tram.tram_id; btnPrint.Enabled = true; } }
private void PatientbindingSource1_CurrentChanged(object sender, EventArgs e) { try { if (dbc.GetChangeSet().Updates.Count > 0) { if (MessageBox.Show("คุณต้องการบันทึกการเปลี่ยนแปลงข้อมูลหรือไม่", "Confirm Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { dbc.SubmitChanges(); } else { PatientbindingSource1.CancelEdit(); } } } catch (Exception ex) { Program.MessageError(ex.Message); } // Gender trn_patient currentpt = (trn_patient)PatientbindingSource1.Current; if (currentpt != null) { Program.SetValueRadioGroup(GBGender, currentpt.tpt_gender); Program.SetValueRadioGroup(pnlMarried, currentpt.tpt_married); } //Patient Type trn_patient_regi currentRegis = (trn_patient_regi)trnpatientregisBindingSource.Current; if (currentRegis != null) { Program.SetValueRadioGroup(GBPatientType, currentRegis.tpr_patient_type); } }
private void load_trn_report_med_cer(int tpt_id, string en) { using (InhCheckupDataContext dbc = new InhCheckupDataContext()) { if (Program.CurrentRegis != null) { trn_report_med_cer trmc = (from t1 in dbc.trn_report_med_cers where t1.trmc_en == en && t1.tpt_id == tpt_id select t1).FirstOrDefault(); if (trmc != null) { txtfullname.Text = trmc.trmc_full_name; txtaddress.Text = trmc.trmc_address; txtdob.Text = String.Format("{0:dd/MM/yyyy}", trmc.trmc_dob); txtnation.Text = trmc.trmc_nation; txtlicence.Text = trmc.trmc_licence_no; cbmedical_standard_class.SelectedIndex = Convert.ToInt16(trmc.trmc_med_std); cbame_signature.SelectedValue = Convert.ToInt16(trmc.trmc_ame_signature); dtpexam.Value = trmc.trmc_date_exam.Value.Date; dtpvalid_until.Value = trmc.trmc_valid_until.Value.Date; } else { trn_patient tpt = Program.CurrentRegis.trn_patient; //find aviation licence trn_ques_aviation tqa = (from t1 in dbc.trn_ques_aviations where t1.tpr_id == Program.CurrentRegis.tpr_id select t1).FirstOrDefault(); txtfullname.Text = tpt.tpt_othername; txtaddress.Text = Program.CurrentRegis.tpr_main_address; txtdob.Text = tpt.tpt_dob_text; // String.Format("{0:dd/MM/yyyy}", tpt.tpt_dob); txtnation.Text = tpt.tpt_nation_desc; txtlicence.Text = tqa.tqa_license_no; cbmedical_standard_class.SelectedIndex = 0; cbame_signature.SelectedValue = 0; dtpexam.Value = Program.CurrentRegis.tpr_arrive_date.Value.Date; } } } }
public void otherClinicSkipToCheckB(tmp_getptarrived tga, ref trn_patient objpatient, int SiteCode = -999)//add SiteCode suriya 03/04/2015 { if (tga != null) { DateTime dateNow = DateTime.Now; //Program.GetServerDateTime(); if (objpatient == null) { objpatient = new trn_patient(); objpatient.tpt_create_date = dateNow; } objpatient.tpt_update_date = dateNow; objpatient.tpt_hn_no = tga.papmi_no; objpatient.tpt_gender = Convert.ToChar(tga.ctsex_code); objpatient.tpt_pre_name = tga.ttl_desc; objpatient.tpt_first_name = tga.papmi_name; objpatient.tpt_last_name = tga.papmi_name2; objpatient.tpt_image = tga.paper_photo; objpatient.tpt_dob = tga.papmi_dob; objpatient.tpt_nation_code = tga.ctnat_code; objpatient.tpt_nation_desc = tga.ctnat_desc; objpatient.tpt_update_date = dateNow; objpatient.tpt_id_card = tga.paper_id; objpatient.tpt_allergy = tga.allergy_eng; objpatient.tpt_en_name1 = tga.paper_name5; objpatient.tpt_en_name2 = tga.paper_name6; objpatient.tpt_en_name3 = tga.paper_name7; objpatient.tpt_dob_text = tga.papmi_dob_text; try { string tname = string.IsNullOrEmpty(tga.ttl_desc) ? "" : tga.ttl_desc.Trim(); string fname = string.IsNullOrEmpty(tga.papmi_name) ? "" : " " + tga.papmi_name.Trim(); string mname = string.IsNullOrEmpty(tga.paper_name7) ? "" : " " + tga.paper_name7.Trim(); string lname = string.IsNullOrEmpty(tga.papmi_name2) ? "" : " " + tga.papmi_name2.Trim(); string fullname = (tname + fname + mname + lname).Trim(); objpatient.tpt_fullname = fullname; objpatient.tpt_othername = fullname; } catch (Exception ex) { try { string tname = string.IsNullOrEmpty(tga.ttl_desc) ? "" : tga.ttl_desc.Trim(); string fname = string.IsNullOrEmpty(tga.papmi_name) ? "" : " " + tga.papmi_name.Trim(); string lname = string.IsNullOrEmpty(tga.papmi_name2) ? "" : " " + tga.papmi_name2.Trim(); string fullname = (tname + fname + lname).Trim(); objpatient.tpt_fullname = fullname; objpatient.tpt_othername = fullname; } catch { } Program.MessageError("GetDataFromTrakCare", "tpt_fullname", ex, false); } if (!string.IsNullOrEmpty(tga.ctmar_desc)) { married mar = mst_married.Where(x => x.desc.Any(y => tga.ctmar_desc.Contains(y))).FirstOrDefault(); if (mar != null) { objpatient.tpt_married = mar.status; objpatient.tpt_married_desc = mar.desc; } } objpatient.trn_patient_regis.Add(getDefaultPatientRegis(tga, SiteCode));//add SiteCode suriya 03/04/2015 } }
public void Clear() { Patient = null; }
public bool Insert(int tpr_id, string user, List <APITrakcare.ImagingResult> imgResults, List <APITrakcare.PatientOrderSet> orders) { try { using (InhCheckupDataContext cdc = new InhCheckupDataContext()) { trn_patient_regi pRegis = cdc.trn_patient_regis.Where(x => x.tpr_id == tpr_id).FirstOrDefault(); if (pRegis != null) { DateTime dateNow = Class.globalCls.GetServerDateTime(); trn_patient patient = pRegis.trn_patient; foreach (var item in imgResults) { switch (item.mvt_code) { case "XR": trn_patient_history_xray hxr = patient.trn_patient_history_xrays.Where(x => x.tphx_en_no == item.en_no).FirstOrDefault(); if (hxr == null) { hxr = new trn_patient_history_xray(); hxr.tphx_en_no = item.en_no; patient.trn_patient_history_xrays.Add(hxr); } hxr.tphx_link = item.Link; trn_chest_xray xr = pRegis.trn_chest_xrays.Where(x => x.tcx_order_code == item.ARCIMCode && x.tcx_en_no == item.en_no).FirstOrDefault(); if (xr == null) { xr = new trn_chest_xray(); xr.tcx_type = 'N'; xr.tcx_order_code = item.ARCIMCode; xr.tcx_order_name = item.ARCIMDesc; xr.tcx_en_no = item.en_no; xr.tcx_create_date = dateNow; pRegis.trn_chest_xrays.Add(xr); } xr.tcx_order_date = item.OEORISttDat.Value.Date.Add(item.OEORITimeOrd.Value.Duration()); xr.tcx_result_date = item.RESDateVerified.Value.Date.Add(item.RESTimeVerified.Value.Duration()); xr.tcx_overseen_by = item.SSUSR_Name; xr.tcx_result = item.resultText == null ? null : (item.resultText.Substring(0, item.resultText.Length >= 8000 ? 8000 : item.resultText.Length)); xr.tcx_path_html = item.PathHTML; xr.tcx_child_id = item.ChildID; xr.tcx_create_by = user; xr.tcx_update_by = user; xr.tcx_update_date = dateNow; break; case "UU": case "UB": case "UL": case "UW": trn_patient_history_ultrasound hus = patient.trn_patient_history_ultrasounds.Where(x => x.tphu_en_no == item.en_no && x.tphu_type == item.mvt_code).FirstOrDefault(); if (hus == null) { hus = new trn_patient_history_ultrasound(); hus.tphu_en_no = item.en_no; hus.tphu_type = item.mvt_code; patient.trn_patient_history_ultrasounds.Add(hus); } hus.tphu_link = item.Link; trn_ultrasound us = pRegis.trn_ultrasounds.Where(x => x.tus_order_code == item.ARCIMCode && x.tus_en_no == item.en_no && x.tus_ultra_type == item.mvt_code).FirstOrDefault(); if (us == null) { us = new trn_ultrasound(); us.tus_ultra_type = item.mvt_code; us.tus_type = 'N'; us.tus_order_code = item.ARCIMCode; us.tus_order_name = item.ARCIMDesc; us.tus_en_no = item.en_no; us.tus_create_date = dateNow; pRegis.trn_ultrasounds.Add(us); } us.tus_order_date = item.OEORISttDat.Value.Date.Add(item.OEORITimeOrd.Value.Duration()); us.tus_result_date = item.RESDateVerified.Value.Date.Add(item.RESTimeVerified.Value.Duration()); us.tus_overseen_by = item.SSUSR_Name; us.tus_result = item.resultText == null ? null : (item.resultText.Substring(0, item.resultText.Length >= 8000 ? 8000 : item.resultText.Length)); us.tus_update_date = dateNow; us.tus_path_html = item.PathHTML; us.tus_child_id = item.ChildID; us.tus_create_by = user; us.tus_update_by = user; break; case "UG": trn_patient_history_ugi hug = patient.trn_patient_history_ugis.Where(x => x.tphu_en_no == item.en_no).FirstOrDefault(); if (hug == null) { hug = new trn_patient_history_ugi(); hug.tphu_en_no = item.en_no; patient.trn_patient_history_ugis.Add(hug); } hug.tphu_link = item.Link; trn_ugi_xray ug = pRegis.trn_ugi_xrays.Where(x => x.tug_order_code == item.ARCIMCode && x.tug_en_no == item.en_no).FirstOrDefault(); if (ug == null) { ug = new trn_ugi_xray(); ug.tug_type = 'N'; ug.tug_order_code = item.ARCIMCode; ug.tug_order_name = item.ARCIMDesc; ug.tug_en_no = item.en_no; ug.tug_create_date = dateNow; pRegis.trn_ugi_xrays.Add(ug); } ug.tug_order_date = item.OEORISttDat.Value.Date.Add(item.OEORITimeOrd.Value.Duration()); ug.tug_result_date = item.RESDateVerified.Value.Date.Add(item.RESTimeVerified.Value.Duration()); ug.tug_overseen_by = item.SSUSR_Name; ug.tug_result = item.resultText == null ? null : (item.resultText.Substring(0, item.resultText.Length >= 8000 ? 8000 : item.resultText.Length)); ug.tug_path_html = item.PathHTML; ug.tug_child_id = item.ChildID; ug.tug_create_by = user; ug.tug_update_by = user; ug.tug_update_date = dateNow; break; case "DM": trn_patient_history_mammogram hdm = patient.trn_patient_history_mammograms.Where(x => x.tphm_en_no == item.en_no).FirstOrDefault(); if (hdm == null) { hdm = new trn_patient_history_mammogram(); hdm.tphm_en_no = item.en_no; patient.trn_patient_history_mammograms.Add(hdm); } hdm.tphm_link = item.Link; trn_mammogram dm = pRegis.trn_mammograms.Where(x => x.tmg_order_code == item.ARCIMCode && x.tmg_en_no == item.en_no).FirstOrDefault(); if (dm == null) { dm = new trn_mammogram(); dm.tmg_type = 'N'; dm.tmg_order_code = item.ARCIMCode; dm.tmg_order_name = item.ARCIMDesc; dm.tmg_en_no = item.en_no; dm.tmg_create_date = dateNow; pRegis.trn_mammograms.Add(dm); } dm.tmg_order_date = item.OEORISttDat.Value.Date.Add(item.OEORITimeOrd.Value.Duration()); dm.tmg_result_date = item.RESDateVerified.Value.Date.Add(item.RESTimeVerified.Value.Duration()); dm.tmg_birads_cat = (item.biradsCate == null || item.biradsCate.Length < 1) ? "" : item.biradsCate.Substring(0, 1); dm.tmg_overseen_by = item.SSUSR_Name; dm.tmg_result = item.resultText == null ? null : (item.resultText.Substring(0, item.resultText.Length >= 8000 ? 8000 : item.resultText.Length)); dm.tmg_path_html = item.PathHTML; dm.tmg_child_id = item.ChildID; dm.tmg_create_by = user; dm.tmg_update_by = user; dm.tmg_update_date = dateNow; break; case "BD": trn_patient_history_bmd hbd = patient.trn_patient_history_bmds.Where(x => x.tphb_en_no == item.en_no).FirstOrDefault(); if (hbd == null) { hbd = new trn_patient_history_bmd(); hbd.tphb_en_no = item.en_no; patient.trn_patient_history_bmds.Add(hbd); } hbd.tphb_link = item.Link; trn_bmd bd = pRegis.trn_bmds.Where(x => x.bmd_order_code == item.ARCIMCode && x.bmd_en_no == item.en_no).FirstOrDefault(); if (bd == null) { bd = new trn_bmd(); bd.bmd_type = 'N'; bd.bmd_order_code = item.ARCIMCode; bd.bmd_order_name = item.ARCIMDesc; bd.bmd_en_no = item.en_no; bd.bmd_create_date = dateNow; pRegis.trn_bmds.Add(bd); } bd.bmd_order_date = item.OEORISttDat.Value.Date.Add(item.OEORITimeOrd.Value.Duration()); bd.bmd_result_date = item.RESDateVerified.Value.Date.Add(item.RESTimeVerified.Value.Duration()); bd.bmd_overseen_by = item.SSUSR_Name; bd.bmd_result = item.resultText == null ? null : (item.resultText.Substring(0, item.resultText.Length >= 8000 ? 8000 : item.resultText.Length)); bd.bmd_path_html = item.PathHTML; bd.bmd_child_id = item.ChildID; bd.bmd_create_by = user; bd.bmd_update_by = user; bd.bmd_update_date = dateNow; break; case "CD": trn_other_xray ox = pRegis.trn_other_xrays.Where(x => x.tox_order_code == item.ARCIMCode && x.tox_en_no == item.en_no && x.tox_room_type == item.mvt_code).FirstOrDefault(); if (ox == null) { ox = new trn_other_xray(); ox.tox_room_type = item.mvt_code; ox.tox_type = 'N'; ox.tox_order_code = item.ARCIMCode; ox.tox_order_name = item.ARCIMDesc; ox.tox_en_no = item.en_no; ox.tox_create_date = dateNow; pRegis.trn_other_xrays.Add(ox); } ox.tox_patient_result = item.patient_result; ox.tox_patient_comt = item.patient_comt; ox.tox_order_date = item.OEORISttDat.Value.Date.Add(item.OEORITimeOrd.Value.Duration()); ox.tox_result_date = item.RESDateVerified.Value.Date.Add(item.RESTimeVerified.Value.Duration()); ox.tox_overseen_by = item.SSUSR_Name; ox.tox_result = item.resultText == null ? null : (item.resultText.Substring(0, item.resultText.Length >= 8000 ? 8000 : item.resultText.Length)); ox.tox_path_html = item.PathHTML; ox.tox_child_id = item.ChildID; ox.tox_create_by = user; ox.tox_update_by = user; ox.tox_update_date = dateNow; break; case "EC": trn_patient_history_echo hec = patient.trn_patient_history_echos.Where(x => x.tphc_en_no == item.en_no).FirstOrDefault(); if (hec == null) { hec = new trn_patient_history_echo(); patient.trn_patient_history_echos.Add(hec); hec.tphc_en_no = item.en_no; } hec.tphc_link = item.Link; break; case "EK": trn_patient_history_ekg ek = patient.trn_patient_history_ekgs.Where(x => x.tphk_en_no == item.en_no).FirstOrDefault(); if (ek == null) { ek = new trn_patient_history_ekg(); patient.trn_patient_history_ekgs.Add(ek); ek.tphk_en_no = item.en_no; } ek.tphk_link = item.Link; break; case "ES": trn_patient_history_est es = patient.trn_patient_history_ests.Where(x => x.tphs_en_no == item.en_no).FirstOrDefault(); if (es == null) { es = new trn_patient_history_est(); patient.trn_patient_history_ests.Add(es); es.tphs_en_no = item.en_no; } es.tphs_link = item.Link; break; } trn_patient_retrieve ret = pRegis.trn_patient_retrieves.Where(x => x.tpr_image_type == item.mvt_code).FirstOrDefault(); if (ret == null) { ret = new trn_patient_retrieve(); ret.tpr_image_type = item.mvt_code; } ret.tpr_flag_retrieve = true; if (item.en_no == pRegis.tpr_en_no) { List <trn_patient_queue> Queues = pRegis.trn_patient_queues.Where(x => x.mvt_id == item.mvt_id).ToList(); if (Queues.All(x => x.tps_status == "ED")) { foreach (trn_patient_queue queue in Queues) { queue.tps_status = "LR"; } List <trn_patient_plan> Plans = pRegis.trn_patient_plans.Where(x => x.mvt_id == item.mvt_id).ToList(); foreach (trn_patient_plan plan in Plans) { plan.tpl_status = 'L'; } } } } if (orders != null) { foreach (var order in orders) { foreach (var item in order.orderitems) { switch (item.mvt_code) { case "PT": if (!string.IsNullOrEmpty(item.patho)) { trn_obstetric_chief obChief = pRegis.trn_obstetric_chiefs.FirstOrDefault(); if (obChief == null) { obChief = new trn_obstetric_chief(); pRegis.trn_obstetric_chiefs.Add(obChief); } obChief.toc_patho_result = true; trn_patient_history_patho hpt = patient.trn_patient_history_pathos.Where(x => x.tphp_en_no == order.en).FirstOrDefault(); if (hpt == null) { hpt = new trn_patient_history_patho(); hpt.tphp_en_no = order.en; patient.trn_patient_history_pathos.Add(hpt); } hpt.tphp_link = item.patho; } break; case "XR": if (!string.IsNullOrEmpty(item.pacsheet)) { trn_patient_history_xray xr = patient.trn_patient_history_xrays.Where(x => x.tphx_en_no == order.en).FirstOrDefault(); if (xr == null) { xr = new trn_patient_history_xray(); xr.tphx_en_no = order.en; patient.trn_patient_history_xrays.Add(xr); } xr.tphx_link = item.pacsheet; } break; case "UU": case "UB": case "UL": case "UW": if (!string.IsNullOrEmpty(item.pacsheet)) { trn_patient_history_ultrasound hus = patient.trn_patient_history_ultrasounds.Where(x => x.tphu_en_no == order.en && x.tphu_type == item.mvt_code).FirstOrDefault(); if (hus == null) { hus = new trn_patient_history_ultrasound(); hus.tphu_en_no = order.en; hus.tphu_type = item.mvt_code; patient.trn_patient_history_ultrasounds.Add(hus); } hus.tphu_link = item.pacsheet; } break; case "UG": if (!string.IsNullOrEmpty(item.pacsheet)) { trn_patient_history_ugi ug = patient.trn_patient_history_ugis.Where(x => x.tphu_en_no == order.en).FirstOrDefault(); if (ug == null) { ug = new trn_patient_history_ugi(); ug.tphu_en_no = order.en; patient.trn_patient_history_ugis.Add(ug); } ug.tphu_link = item.pacsheet; } break; case "DM": if (!string.IsNullOrEmpty(item.pacsheet)) { trn_patient_history_mammogram dm = patient.trn_patient_history_mammograms.Where(x => x.tphm_en_no == order.en).FirstOrDefault(); if (dm == null) { dm = new trn_patient_history_mammogram(); dm.tphm_en_no = order.en; patient.trn_patient_history_mammograms.Add(dm); } dm.tphm_link = item.pacsheet; } break; case "BD": if (!string.IsNullOrEmpty(item.pacsheet)) { trn_patient_history_bmd bd = patient.trn_patient_history_bmds.Where(x => x.tphb_en_no == order.en).FirstOrDefault(); if (bd == null) { bd = new trn_patient_history_bmd(); bd.tphb_en_no = order.en; patient.trn_patient_history_bmds.Add(bd); } bd.tphb_link = item.pacsheet; } break; } } } //foreach (var item in docResults) //{ // if (item.Excuted) // { // switch (item.mvt_code) // { // case "PT": // trn_obstetric_chief obChief = pRegis.trn_obstetric_chiefs.FirstOrDefault(); // if (obChief == null) // { // obChief = new trn_obstetric_chief(); // pRegis.trn_obstetric_chiefs.Add(obChief); // } // obChief.toc_patho_result = true; // trn_patient_history_patho hpt = patient.trn_patient_history_pathos.Where(x => x.tphp_en_no == item.en).FirstOrDefault(); // if (hpt == null) // { // hpt = new trn_patient_history_patho(); // hpt.tphp_en_no = item.en; // patient.trn_patient_history_pathos.Add(hpt); // } // hpt.tphp_link = item.Link; // break; // case "XR": // trn_patient_history_xray xr = patient.trn_patient_history_xrays.Where(x => x.tphx_en_no == item.en).FirstOrDefault(); // if (xr == null) // { // xr = new trn_patient_history_xray(); // xr.tphx_en_no = item.en; // patient.trn_patient_history_xrays.Add(xr); // } // xr.tphx_link = item.Link; // break; // case "UU": // case "UB": // case "UL": // case "UW": // trn_patient_history_ultrasound hus = patient.trn_patient_history_ultrasounds.Where(x => x.tphu_en_no == item.en && x.tphu_type == item.mvt_code).FirstOrDefault(); // if (hus == null) // { // hus = new trn_patient_history_ultrasound(); // hus.tphu_en_no = item.en; // hus.tphu_type = item.mvt_code; // patient.trn_patient_history_ultrasounds.Add(hus); // } // hus.tphu_link = item.Link; // break; // case "UG": // trn_patient_history_ugi ug = patient.trn_patient_history_ugis.Where(x => x.tphu_en_no == item.en).FirstOrDefault(); // if (ug == null) // { // ug = new trn_patient_history_ugi(); // ug.tphu_en_no = item.en; // patient.trn_patient_history_ugis.Add(ug); // } // ug.tphu_link = item.Link; // break; // case "DM": // trn_patient_history_mammogram dm = patient.trn_patient_history_mammograms.Where(x => x.tphm_en_no == item.en).FirstOrDefault(); // if (dm == null) // { // dm = new trn_patient_history_mammogram(); // dm.tphm_en_no = item.en; // patient.trn_patient_history_mammograms.Add(dm); // } // dm.tphm_link = item.Link; // break; // case "BD": // trn_patient_history_bmd bd = patient.trn_patient_history_bmds.Where(x => x.tphb_en_no == item.en).FirstOrDefault(); // if (bd == null) // { // bd = new trn_patient_history_bmd(); // bd.tphb_en_no = item.en; // patient.trn_patient_history_bmds.Add(bd); // } // bd.tphb_link = item.Link; // break; // } // } //} } } cdc.SubmitChanges(); return(true); } } catch (Exception ex) { Class.globalCls.MessageError("RetrieveImagingCls", "Retrieve", ex.Message); return(false); } }
private void btnContinue_Click(object sender, EventArgs e) { try { btnContinue.Enabled = false; btnSearch.Enabled = false; btnCancel.Enabled = false; lbAlert.Text = "Processing..."; Application.DoEvents(); //tmp_getptarrived result = getArrivedByHn(hn_no); if (currentGetArrived != null) { using (InhCheckupDataContext cdc = new InhCheckupDataContext()) { //tmp_getptarrived tga = cdc.tmp_getptarriveds.Where(x => x.row_id == result.row_id).FirstOrDefault(); //tga.flag_success = 'Y'; DateTime dateNow = Program.GetServerDateTime(); List <tmp_getptarrived> tmpArrived = cdc.tmp_getptarriveds.Where(x => x.papmi_no == currentGetArrived.papmi_no).ToList(); // && x.paadm_admdate.Value.Date == dateNow.Date if (tmpArrived.Where(x => x.flag_success == 'Y').Count() == 0) { tmpArrived.ForEach(x => x.flag_success = 'Y'); cdc.tmp_getptarriveds.InsertOnSubmit(currentGetArrived); EmrClass.GetDataFromWSTrakCare cls = new EmrClass.GetDataFromWSTrakCare(); trn_patient tpt = cdc.trn_patients.Where(x => x.tpt_hn_no == currentGetArrived.papmi_no).FirstOrDefault(); bool flagNewPatient = true; if (tpt != null) { flagNewPatient = false; } cls.otherClinicSkipToCheckB(currentGetArrived, ref tpt); if (flagNewPatient == true) { cdc.trn_patients.InsertOnSubmit(tpt); } cdc.SubmitChanges(); trn_patient_regi tpr = tpt.trn_patient_regis.OrderByDescending(x => x.tpr_create_date).FirstOrDefault(); trn_RefreshLabHistory refreshHis = new trn_RefreshLabHistory() { tpr_id = tpr.tpr_id, CreateDate = dateNow, HN_no = tpt.tpt_hn_no, status = false }; cdc.trn_RefreshLabHistories.InsertOnSubmit(refreshHis); cdc.SubmitChanges(); new EmrClass.GetPTPackageCls().setRelationOrderSet(ref tpr); cdc.SubmitChanges(); btnContinue.Enabled = true; btnSearch.Enabled = true; btnCancel.Enabled = true; returnHN = currentGetArrived.papmi_no; this.Close(); } else { } } } } catch { } }
public int?RegisPatient(string location, string en, DateTime arrived, string user) { using (Service.WS_TrakcareCls ws = new Service.WS_TrakcareCls()) { var result = ws.GetPTArrivedCheckUpFilter(location, en, arrived.ToString("yyyy-MM-dd")).AsEnumerable().FirstOrDefault(); if (result != null) { using (InhCheckupDataContext cdc = new InhCheckupDataContext()) { DateTime dateNow = globalCls.GetServerDateTime(); var patient = cdc.trn_patients.Where(x => x.tpt_hn_no == result.Field <string>("PAPMI_No")).FirstOrDefault(); if (patient == null) { patient = new trn_patient { tpt_hn_no = result.Field <string>("PAPMI_No"), tpt_create_date = dateNow }; cdc.trn_patients.InsertOnSubmit(patient); } patient.tpt_pre_name = result.Field <string>("TTL_Desc") == null ? "" : result.Field <string>("TTL_Desc").Trim(); patient.tpt_first_name = result.Field <string>("PAPMI_Name") == null ? "" : result.Field <string>("PAPMI_Name").Trim(); patient.tpt_last_name = result.Field <string>("PAPMI_Name2") == null ? "" : result.Field <string>("PAPMI_Name2").Trim(); patient.tpt_en_name1 = result.Field <string>("PAPER_Name5") == null ? "" : result.Field <string>("PAPER_Name5").Trim(); patient.tpt_en_name2 = result.Field <string>("PAPER_Name6") == null ? "" : result.Field <string>("PAPER_Name6").Trim(); patient.tpt_en_name3 = result.Field <string>("PAPMI_Name7") == null ? "" : result.Field <string>("PAPMI_Name7").Trim(); List <string> name = new List <string>(); if (patient.tpt_pre_name != "") { name.Add(patient.tpt_pre_name); } if (patient.tpt_first_name != "") { name.Add(patient.tpt_first_name); } if (patient.tpt_en_name3 != "") { name.Add(patient.tpt_en_name3); } if (patient.tpt_last_name != "") { name.Add(patient.tpt_last_name); } patient.tpt_fullname = string.Join(" ", name); patient.tpt_othername = string.Join(" ", name); patient.tpt_id_card = result.Field <string>("PAPER_ID") == null ? "" : result.Field <string>("PAPER_ID").Trim(); patient.tpt_dob = result.Field <DateTime?>("PAPMI_DOB"); patient.tpt_dob_text = result.Field <string>("papmi_dob_text") == null ? "" : result.Field <string>("papmi_dob_text").Trim(); patient.tpt_gender = result.Field <string>("CTSEX_Code") == null || result.Field <string>("CTSEX_Code").Trim().Length == 0 ? (char?)null : result.Field <string>("CTSEX_Code").Trim()[0]; Marrie mar = new Marrie(result.Field <string>("CTMAR_Desc")); patient.tpt_married = mar.code; patient.tpt_married_desc = mar.desc; patient.tpt_nation_code = result.Field <string>("CTNAT_Code") == null ? "" : result.Field <string>("CTNAT_Code").Trim(); patient.tpt_nation_desc = result.Field <string>("CTNAT_Desc") == null ? "" : result.Field <string>("CTNAT_Desc").Trim(); patient.tpt_allergy = new APITrakcare.GetAllergyCls().ByGetAllergyByHN(result.Field <string>("PAPMI_No")); patient.tpt_image = GetImage(result.Field <string>("PAPMI_No")); patient.tpt_vip_hpc = location == "01HPC3" ? true : false; patient.tpt_update_date = dateNow; int mhs_id = cdc.mst_hpc_sites.Where(x => x.mhs_code == location).Select(x => x.mhs_id).FirstOrDefault(); var regis = patient.trn_patient_regis.Where(x => x.tpr_en_no == result.Field <string>("PAADM_ADMNo") && x.mhs_id == mhs_id).FirstOrDefault(); if (regis == null) { DateTime?PAADM_AdmDate = result.Field <DateTime?>("PAADM_AdmDate"); TimeSpan?PAADM_AdmTime = result.Field <TimeSpan?>("PAADM_AdmTime"); TimeSpan?APPT_ArrivalTime = result.Field <TimeSpan?>("APPT_ArrivalTime"); DateTime?app = null; DateTime?arr = null; if (PAADM_AdmDate != null) { app = PAADM_AdmDate.Value; arrived = PAADM_AdmDate.Value; if (APPT_ArrivalTime != null) { app = app.Value.Add(APPT_ArrivalTime.Value); } if (PAADM_AdmTime != null) { arr = arr.Value.Add(PAADM_AdmTime.Value); } } var pattype = '1'; var apptype = GetAppointType(GetLimitAppoint(mhs_id), app, arr); var arrtype = app == null ? 'W' : 'A'; var queueType = GetQueueType(result.Field <int>("SER_RowId"), !string.IsNullOrEmpty(result.Field <string>("PENSTYPE_Code")), apptype); regis = new trn_patient_regi { mhs_id = mhs_id, tpr_en_no = result.Field <string>("PAADM_ADMNo"), tpr_vip_code = result.Field <string>("PENSTYPE_Code") == null ? null : result.Field <string>("PENSTYPE_Code").Trim(), tpr_vip_desc = result.Field <string>("PENSTYPE_Desc") == null ? null : result.Field <string>("PENSTYPE_Desc").Trim(), tpr_email = result.Field <string>("PAPER_Email") == null ? null : result.Field <string>("PAPER_Email").Trim(), tpr_en_rowid = result.Field <int?>("PAADM_RowID") == null ? null : result.Field <int?>("PAADM_RowID").ToString(), tpr_foreigner = result.Field <string>("CTNAT_Code") == null ? (char?)null : (result.Field <string>("CTNAT_Code") == "TH" ? 'N' : 'Y'), tpr_home_phone = result.Field <string>("PAPER_TelH") == null ? null : result.Field <string>("PAPER_TelH").Trim(), tpr_main_address = result.Field <string>("PAPER_StName") == null ? null : result.Field <string>("PAPER_StName").Trim(), tpr_main_amphur = result.Field <string>("CTCIT_Desc") == null ? null : result.Field <string>("CTCIT_Desc").Trim(), tpr_main_province = result.Field <string>("PROV_Desc") == null ? null : result.Field <string>("PROV_Desc").Trim(), tpr_main_tumbon = result.Field <string>("CITAREA_Desc") == null ? null : result.Field <string>("CITAREA_Desc").Trim(), tpr_main_zip_code = result.Field <string>("CTZIP_Code") == null ? null : result.Field <string>("CTZIP_Code").Trim(), tpr_office_phone = result.Field <string>("PAPER_TelO") == null ? null : result.Field <string>("PAPER_TelO"), tpr_mobile_phone = result.Field <string>("PAPER_MobPhone") == null ? null : result.Field <string>("PAPER_MobPhone").Trim(), tpr_new_patient = result.Field <string>("PAADM_Type_of_Patient_Calc") == null ? (char?)null : (new List <string> { "1", "2" }.Contains(result.Field <string>("PAADM_Type_of_Patient_Calc")) ? 'Y' : 'N'), tpr_appoint_type = apptype, tpr_appointment_date = app, tpr_arrive_date = arr, tpr_arrive_type = arrtype, tpr_patient_type = pattype, tpr_req_doc_code = null, tpr_req_doc_gender = null, tpr_req_doc_name = null, tpr_req_doctor = null, tpr_req_inorout_doctor = null, tpr_req_pe_bef_chkup = null, tpr_req_same_doc = null, tpr_pe_doc = null, // queue tpr_pe_doc_code = null, // queue tpr_pe_doc_name = null, // queue tpr_pe_site2 = 'P', // site 2 tpr_pe_type = 'W', // site 1 tpr_pending_no_station = null, tpr_check_pending = 'N', //pending tpr_type = 'D', tpr_return_screening = null, tpr_miss_lower = null, //ultrasound tpr_miss_lower_date = null, //ultrasound tpr_call_lower_date = null, //ultrasound tpr_call_lower_time = null, //ultrasound tpr_pd_pe_site2 = null, // queue tpr_pending = null, tpr_pending_cancel_onday = null, tpr_pending_ct = 0, tpr_site_use = null, // stamp on checkpoint B tpr_status = "WB", // status = Wait Book, for CK Report tpr_pe_status = "RS", // status = Result, for CK Report tpr_mhc_ename = null, //package tpr_other_address = null, // trn_patient_regis last espisode tpr_other_amphur = null, // trn_patient_regis last espisode tpr_other_province = null, // trn_patient_regis last espisode tpr_other_tumbon = null, // trn_patient_regis last espisode tpr_other_zip_code = null, // trn_patient_regis last espisode tpr_other_name = null, tpr_PRM = null, // package PMR tpr_PRM_check = null, // package PMR tpr_PRM_doccode = null, // package PMR tpr_PRM_docname = null, // package PMR tpr_PRM_doctor = null, // package PMR tpr_queue_no = GetQueueNo(result.Field <string>("PAADM_ADMNo"), queueType, CheckOtherSite(mhs_id)), tpr_queue_type = CheckVIP(patient.tpt_hn_no) ? '1' : queueType, tpr_remark = null, tpr_send_book = null, tpr_send_to = null, // trn_patient_regis last espisode tnc_document_no = null, // company tnc_emp_id = null, // company tnc_id = null, // company tnc_position = null, // company tpr_employee_no = null, tcd_id = null, tpr_comp_dep = null, tpr_comp_dep_edesc = null, tpr_comp_dep_tdesc = null, tpr_comp_edesc = null, tpr_comp_tdesc = null, tpr_company_code = null, tpr_company_id = null, tnc_department = null, tpr_create_by = user, tpr_create_date = dateNow, tpr_update_by = user, tpr_update_date = dateNow, tpr_sys_assign_doctor = null, // not use mut_id = null, // not use mac_id = null, // not use mdc_id = null, // not use mhc_id = null, // not use tpr_arrive_site = "", // not use tpr_arrive_site_desc = "", // not use tpr_close_other_site = null, // not use tpr_npo_text = null, // tmp_patient_regis tpr_npo_time = null, // tmp_patient_regis tpr_aviation_type = null, //select on register tpr_nurse_code = null, tpr_nurse_name = null, tpr_prev_pe_code = null, tpr_prev_pe_name = null, tpr_rtn_pe_date = null, tpr_print_book = "N", tpr_rtn_pe_name = null }; patient.trn_patient_regis.Add(regis); } cdc.SubmitChanges(); return(regis.tpr_id); } } } return(null); }
public void GetEyeExam(int tpr_id, string username) { using (InhCheckupDataContext dbc = new InhCheckupDataContext()) { DateTime dateNow = globalCls.GetServerDateTime(); trn_patient_regi tpr = dbc.trn_patient_regis.Where(x => x.tpr_id == tpr_id).FirstOrDefault(); if (tpr != null) { var visitdate = tpr.trn_patient_regis_detail != null && tpr.trn_patient_regis_detail.tpr_real_arrived_date != null ? tpr.trn_patient_regis_detail.tpr_real_arrived_date.Value.Date : tpr.tpr_arrive_date != null ? tpr.tpr_arrive_date.Value.Date : dateNow; trn_eye_exam_hdr teh = dbc.trn_eye_exam_hdrs.Where(x => x.tpr_id == tpr_id).FirstOrDefault(); trn_basic_measure_hdr hdr = dbc.trn_basic_measure_hdrs.Where(x => x.tpr_id == tpr_id).FirstOrDefault(); trn_patient_event mvt = dbc.trn_patient_events.Where(x => x.tpr_id == tpr_id && x.mst_event.mvt_code == "EM").FirstOrDefault(); if (mvt != null) { hdr.tbm_glass_or_contact = string.IsNullOrEmpty(teh.teh_vision_le) == true && string.IsNullOrEmpty(teh.teh_vision_out_le) == false ? 'Y' : 'N'; hdr.tbm_color_blind = teh.teh_color_vision == null ? (char?)null : (char?)teh.teh_color_vision; //tbm_vision_lvisual_with_lens if (teh.teh_vision_le == null && teh.teh_vision_out_llens == null) { hdr.tbm_vision_lvisual_with_lens = null; } else if (teh.teh_vision_le != null) { if (teh.teh_vision_le.Contains("20/")) { hdr.tbm_vision_lvisual_with_lens = findEyeValue(teh.teh_vision_le); } else { hdr.tbm_vision_lvisual_with_lens = teh.teh_vision_le; } } else if (teh.teh_vision_out_llens != null) { if (teh.teh_vision_out_llens.Contains("20/")) { hdr.tbm_vision_lvisual_with_lens = findEyeValue(teh.teh_vision_out_llens); } else { hdr.tbm_vision_lvisual_with_lens = teh.teh_vision_out_llens.ToString(); } } //tbm_vision_rvisual_with_lens if (teh.teh_vision_re == null && teh.teh_vision_out_rlens == null) { hdr.tbm_vision_rvisual_with_lens = null; } else if (teh.teh_vision_re != null) { if (teh.teh_vision_re.Contains("20/")) { hdr.tbm_vision_rvisual_with_lens = findEyeValue(teh.teh_vision_re); } else { hdr.tbm_vision_rvisual_with_lens = teh.teh_vision_re; } } else if (teh.teh_vision_out_llens != null) { if (teh.teh_vision_out_rlens.Contains("20/")) { hdr.tbm_vision_rvisual_with_lens = findEyeValue(teh.teh_vision_out_rlens); } else { hdr.tbm_vision_rvisual_with_lens = teh.teh_vision_out_rlens.ToString(); } } hdr.tbm_vision_lvisual_out_lens = teh.teh_vision_out_le == null ? null : teh.teh_vision_out_le.Contains("20/") ? findEyeValue(teh.teh_vision_out_le) : null; hdr.tbm_vision_rvisual_out_lens = teh.teh_vision_out_re == null ? null : teh.teh_vision_out_re.Contains("20/") ? findEyeValue(teh.teh_vision_out_re) : null; // } dbc.SubmitChanges(); var labconfig = new LabClass.GetLabConfigCls().GetByPaientLab(tpr_id); trn_patient tpt = dbc.trn_patients.Where(x => x.tpt_id == tpr.tpt_id).FirstOrDefault(); var ages = new LabClass.InterpretLabCls().calAge(tpt.tpt_dob.Value.Date, visitdate); var sex = Convert.ToChar(tpt.tpt_gender.ToString()); mst_lab lab = dbc.mst_labs.Where(x => x.mlb_type == 'C' && x.mlb_status == 'A' && x.mlb_code == "VS001").FirstOrDefault(); var maplabspecial = new LabClass.MapLab { code = lab.mlb_code, id = lab.mlb_id, nameen = lab.mlb_ename, nameth = lab.mlb_tname, seq = lab.mlb_chart_seq, setcode = lab.mlb_lab_set, usechart = false, valuetype = lab.mlb_value_type, status = 'E' }; var rs = new LabClass.InterpretLabCls().GetResult(maplabspecial, labconfig, ages, sex); var rslab = new LabClass.InterpretLab { setcode = lab.mlb_lab_set, code = lab.mlb_code, name_en = lab.mlb_ename, name_th = lab.mlb_tname, seq = lab.mlb_chart_seq, mlr_id = rs.mlr_id, summary = rs.summary, result_en = rs.result_en, result_th = rs.result_th, result_jp = rs.result_jp, normalrange = rs.normalrange, unit = rs.unit, status = rs.status }; var labvs = tpr.trn_patient_lab_vitalsigns.Where(x => x.tplv_lab_code == maplabspecial.code && x.tpr_id == tpr_id).FirstOrDefault(); if (labvs != null) { labvs.tplv_summary = rslab.summary == null ? null : rslab.summary.ToString(); labvs.tplv_lab_name_th = rslab.name_th; labvs.tplv_lab_name_en = rslab.name_en; labvs.tplv_lab_result_th = rslab.result_th; labvs.tplv_lab_result_en = rslab.result_en; labvs.tplv_lab_result_jp = rslab.result_jp; labvs.tplv_normal_range = rslab.normalrange; labvs.tplv_update_by = username; labvs.tplv_update_date = dateNow; } } try { dbc.SubmitChanges(); } catch (Exception ex) { Class.globalCls.MessageError("GetVitalSignCls", "GetEyeExam", ex.Message); throw ex; } // } } } }
public void PatientByGetPTArrived(ref trn_patient patient, APITrakcare.GetPTArrivedResult arrived) { }