///<summary>The values returned are sent to the webserver.</summary> public static List <DiseaseDefm> GetMultDiseaseDefms(List <long> diseaseDefNums) { List <DiseaseDef> DiseaseDefList = DiseaseDefs.GetMultDiseaseDefs(diseaseDefNums); List <DiseaseDefm> DiseaseDefmList = ConvertListToM(DiseaseDefList); return(DiseaseDefmList); }
///<summary>Inserts the new DiseaseDef address and returns it.</summary> public static DiseaseDef CreateDiseaseDef(string diseaseName = "", string icd10code = "") { DiseaseDef diseaseDef = new DiseaseDef(); diseaseDef.DiseaseName = diseaseName; if (diseaseName == "") { diseaseDef.DiseaseName = "Fatal Illness"; } diseaseDef.Icd10Code = icd10code; DiseaseDefs.Insert(diseaseDef); DiseaseDefs.RefreshCache(); return(diseaseDef); }
///<summary>Converts one Disease object to its mobile equivalent. Warning! CustomerNum will always be 0.</summary> internal static Diseasem ConvertToM(Disease disease) { Diseasem diseasem = new Diseasem(); //CustomerNum cannot be set. Remains 0. diseasem.DiseaseNum = disease.DiseaseNum; diseasem.PatNum = disease.PatNum; diseasem.DiseaseDefNum = disease.DiseaseDefNum; diseasem.PatNote = disease.PatNote; diseasem.ICD9Num = ICD9s.GetByCode(DiseaseDefs.GetItem(disease.DiseaseDefNum).ICD9Code).ICD9Num; diseasem.ProbStatus = disease.ProbStatus; diseasem.DateStart = disease.DateStart; diseasem.DateStop = disease.DateStop; return(diseasem); }
private static void OnCreated(object source, FileSystemEventArgs e) { //MessageBox.Show("File created. It will now be deleted."); Thread.Sleep(200); //just to make sure the other process is done writing. string[] lines = File.ReadAllLines(e.FullPath); File.Delete(e.FullPath); if (lines.Length != 1) { MessageBox.Show(e.FullPath + " was supposed to have exactly one line. Invalid file."); return; } string rawFieldNames = "PAT_PK,PAT_LOGFK,PAT_LANFK,PAT_TITLE,PAT_FNAME,PAT_MI,PAT_LNAME,PAT_CALLED,PAT_ADDR1,PAT_ADDR2,PAT_CITY,PAT_ST,PAT_ZIP,PAT_HPHN,PAT_WPHN,PAT_EXT,PAT_FAX,PAT_PAGER,PAT_CELL,PAT_EMAIL,PAT_SEX,PAT_EDOCS,PAT_STATUS,PAT_TYPE,PAT_BIRTH,PAT_SSN,PAT_NOCALL,PAT_NOCORR,PAT_DISRES,PAT_LSTUPD,PAT_INSNM,PAT_INSGPL,PAT_INSAD1,PAT_INSAD2,PAT_INSCIT,PAT_INSST,PAT_INSZIP,PAT_INSPHN,PAT_INSEXT,PAT_INSCON,PAT_INSGNO,PAT_EMPNM,PAT_EMPAD1,PAT_EMPAD2,PAT_EMPCIT,PAT_EMPST,PAT_EMPZIP,PAT_EMPPHN,PAT_REFLNM,PAT_REFFNM,PAT_REFMI,PAT_REFPHN,PAT_REFEML,PAT_REFSPE,PAT_NOTES,PAT_NOTE1,PAT_NOTE2,PAT_NOTE3,PAT_NOTE4,PAT_NOTE5,PAT_NOTE6,PAT_NOTE7,PAT_NOTE8,PAT_NOTE9,PAT_NOTE10,PAT_FPSCAN,PAT_PREMED,PAT_MEDS,PAT_FTSTUD,PAT_PTSTUD,PAT_COLLEG,PAT_CHRTNO,PAT_OTHID,PAT_RESPRT,PAT_POLHLD,PAT_CUSCD,PAT_PMPID"; fieldNames = rawFieldNames.Split(','); fieldVals = lines[0].Split(','); if (fieldNames.Length != fieldVals.Length) { MessageBox.Show(e.FullPath + " contains " + fieldNames.Length.ToString() + " field names, but " + fieldVals.Length.ToString() + " field values. Invalid file."); return; } for (int i = 0; i < fieldVals.Length; i++) { fieldVals[i] = fieldVals[i].Replace("\"", ""); //remove quotes } long patNum = PIn.Long(GetVal("PAT_OTHID")); if (patNum == 0) { MessageBox.Show(patNum.ToString() + " is not a recognized PatNum."); return; } Family fam = Patients.GetFamily(patNum); if (fam == null) { MessageBox.Show("Could not find patient based on PatNum " + patNum.ToString()); return; } Patient pat = fam.GetPatient(patNum); Patient patOld = pat.Copy(); string txt; string note = "PT Dental import processed. Some information is shown below which was too complex to import automatically.\r\n"; txt = GetVal("PAT_FNAME"); if (txt != "") { pat.FName = txt; } txt = GetVal("PAT_MI"); if (txt != "") { pat.MiddleI = txt; } txt = GetVal("PAT_LNAME"); if (txt != "") { pat.LName = txt; } txt = GetVal("PAT_CALLED"); if (txt != "") { pat.Preferred = txt; } txt = GetVal("PAT_ADDR1"); if (txt != "") { pat.Address = txt; } txt = GetVal("PAT_ADDR2"); if (txt != "") { pat.Address2 = txt; } txt = GetVal("PAT_CITY"); if (txt != "") { pat.City = txt; } txt = GetVal("PAT_ST"); if (txt != "") { pat.State = txt; } txt = GetVal("PAT_ZIP"); if (txt != "") { pat.Zip = txt; } txt = GetVal("PAT_HPHN"); //No punct if (txt != "") { pat.HmPhone = TelephoneNumbers.ReFormat(txt); } txt = GetVal("PAT_WPHN"); if (txt != "") { pat.WkPhone = TelephoneNumbers.ReFormat(txt); } //no matching fields for these three: txt = GetVal("PAT_EXT"); if (txt != "") { note += "Ph extension: " + txt + "\r\n"; } txt = GetVal("PAT_FAX"); if (txt != "") { note += "Fax: " + txt + "\r\n"; } txt = GetVal("PAT_PAGER"); if (txt != "") { note += "Pager: " + txt + "\r\n"; } txt = GetVal("PAT_CELL"); if (txt != "") { pat.WirelessPhone = TelephoneNumbers.ReFormat(txt); } txt = GetVal("PAT_EMAIL"); if (txt != "") { pat.Email = txt; } txt = GetVal("PAT_SEX"); //M or F if (txt == "M") { pat.Gender = PatientGender.Male; } if (txt == "F") { pat.Gender = PatientGender.Male; } txt = GetVal("PAT_STATUS"); //our patStatus, Any text allowed switch (txt) { case "Archived": pat.PatStatus = PatientStatus.Archived; break; case "Deceased": pat.PatStatus = PatientStatus.Deceased; break; //case "Archived": pat.PatStatus=PatientStatus.Deleted; break; case "Inactive": pat.PatStatus = PatientStatus.Inactive; break; case "NonPatient": pat.PatStatus = PatientStatus.NonPatient; break; case "Patient": pat.PatStatus = PatientStatus.Patient; break; } txt = GetVal("PAT_TYPE"); //our Position, Any text allowed switch (txt) { case "Child": pat.Position = PatientPosition.Child; break; case "Divorced": pat.Position = PatientPosition.Divorced; break; case "Married": pat.Position = PatientPosition.Married; break; case "Single": pat.Position = PatientPosition.Single; break; case "Widowed": pat.Position = PatientPosition.Widowed; break; } txt = GetVal("PAT_BIRTH"); // yyyyMMdd if (txt != "") { pat.Birthdate = PIn.Date(txt); } txt = GetVal("PAT_SSN"); // No punct if (txt != "") { pat.SSN = txt; } txt = GetVal("PAT_NOCALL"); // T if no call if (txt != "") { note += "No Call Patient: " + txt + "\r\n"; } txt = GetVal("PAT_NOCORR"); // T/F if (txt != "") { note += "No Correspondence: " + txt + "\r\n"; } txt = GetVal("PAT_NOTES"); // No limits. if (txt != "") { note += txt + "\r\n"; } txt = GetVal("PAT_PREMED"); // F or T //I don't like giving the patient control of this field, but I guess the office has the option of not showing this on forms. if (txt == "T") { pat.Premed = true; } if (txt == "F") { pat.Premed = false; } txt = GetVal("PAT_MEDS"); // The meds that they must premedicate with. if (txt != "") { note += "Patient Meds: " + txt + "\r\n"; } string ft = GetVal("PAT_FTSTUD"); // T/F string pt = GetVal("PAT_PTSTUD"); //parttime if (ft == "T") { pat.StudentStatus = "F"; //fulltime } else if (pt == "T") { pat.StudentStatus = "P"; //parttime } else if (ft == "F" && pt == "F") { pat.StudentStatus = ""; //nonstudent } else if (ft == "F" && pat.StudentStatus == "F") { pat.StudentStatus = ""; } else if (pt == "F" && pat.StudentStatus == "P") { pat.StudentStatus = ""; } txt = GetVal("PAT_COLLEG"); if (txt != "") { pat.SchoolName = txt; } txt = GetVal("PAT_CHRTNO"); //I don't think patient should have control of this field. if (txt != "") { pat.ChartNumber = txt; } txt = GetVal("PAT_RESPRT"); // Responsible party checkbox T/F if (txt == "T" && pat.PatNum != pat.Guarantor) { note += "Responsible party: True\r\n"; } if (txt == "F" && pat.PatNum == pat.Guarantor) { note += "Responsible party: False\r\n"; } txt = GetVal("PAT_POLHLD"); // Policy holder checkbox T/F if (txt == "T") { note += "Policy holder: True\r\n"; } if (txt == "F") { note += "Policy holder: False\r\n"; } txt = GetVal("PAT_INSNM"); if (txt != "") { note += "Insurance name: " + txt + "\r\n"; } txt = GetVal("PAT_INSGPL"); if (txt != "") { note += "Ins group plan name: " + txt + "\r\n"; } txt = GetVal("PAT_INSAD1"); if (txt != "") { note += "Ins address: " + txt + "\r\n"; } txt = GetVal("PAT_INSAD2"); if (txt != "") { note += "Ins address2: " + txt + "\r\n"; } txt = GetVal("PAT_INSCIT"); if (txt != "") { note += "Ins city: " + txt + "\r\n"; } txt = GetVal("PAT_INSST"); if (txt != "") { note += "Ins state: " + txt + "\r\n"; } txt = GetVal("PAT_INSZIP"); if (txt != "") { note += "Ins zip: " + txt + "\r\n"; } txt = GetVal("PAT_INSPHN"); if (txt != "") { note += "Ins phone: " + TelephoneNumbers.ReFormat(txt) + "\r\n"; } txt = GetVal("PAT_INSGNO"); // Ins group number if (txt != "") { note += "Ins group number: " + txt + "\r\n"; } txt = GetVal("PAT_EMPNM"); if (txt != "") { note += "Employer name: " + txt + "\r\n"; } txt = GetVal("PAT_REFLNM"); if (txt != "") { note += "Referral last name: " + txt + "\r\n"; } txt = GetVal("PAT_REFFNM"); if (txt != "") { note += "Referral first name: " + txt + "\r\n"; } txt = GetVal("PAT_REFMI"); if (txt != "") { note += "Referral middle init: " + txt + "\r\n"; } txt = GetVal("PAT_REFPHN"); if (txt != "") { note += "Referral phone: " + txt + "\r\n"; } txt = GetVal("PAT_REFEML"); // Referral source email if (txt != "") { note += "Referral email: " + txt + "\r\n"; } txt = GetVal("PAT_REFSPE"); // Referral specialty. Customizable, so any allowed if (txt != "") { note += "Referral specialty: " + txt + "\r\n"; } Patients.Update(pat, patOld); if (File.Exists(dir + "\\" + importMedCsv)) { lines = File.ReadAllLines(dir + "\\" + importMedCsv); File.Delete(dir + "\\" + importMedCsv); if (lines.Length < 1) { MessageBox.Show(e.FullPath + " was supposed to have at least one line. Invalid file."); return; } fieldNames = lines[0].Split(','); long diseaseDefNum; Disease disease; string diseaseNote; for (int i = 1; i < lines.Length; i++) { fieldVals = lines[i].Split(','); txt = GetVal("PMA_MALDES"); diseaseNote = GetVal("PMA_NOTES"); if (txt == "") { continue; } diseaseDefNum = DiseaseDefs.GetNumFromName(txt); if (diseaseDefNum == 0) { note += "Disease: " + txt + ", " + diseaseNote + "\r\n"; } disease = Diseases.GetSpecificDiseaseForPatient(patNum, diseaseDefNum); if (disease == null) { disease = new Disease(); disease.DiseaseDefNum = diseaseDefNum; disease.PatNum = patNum; disease.PatNote = diseaseNote; Diseases.Insert(disease); } else { if (txt != "") { if (disease.PatNote != "") { disease.PatNote += " "; } disease.PatNote += diseaseNote; Diseases.Update(disease); } } } } Commlog comm = new Commlog(); comm.PatNum = patNum; comm.SentOrReceived = CommSentOrReceived.Received; comm.CommDateTime = DateTime.Now; comm.CommType = Commlogs.GetTypeAuto(CommItemTypeAuto.MISC); comm.Mode_ = CommItemMode.None; comm.Note = note; comm.UserNum = Security.CurUser.UserNum; Commlogs.Insert(comm); MessageBox.Show("PT Dental import complete."); }
///<summary>The values returned are sent to the webserver.</summary> public static List <long> GetChangedSinceDiseaseDefNums(DateTime changedSince) { return(DiseaseDefs.GetChangedSinceDiseaseDefNums(changedSince)); }
public static void FillPtInfo(OpenDental.ContrChart sender, Patient PatCur) { //first, get all the objects we need. Because they are by ref, the original gets altered. ODGrid gridPtInfo = (ODGrid)sender.Controls.Find("gridPtInfo", true)[0]; TabControl tabControlImages = (TabControl)sender.Controls.Find("tabControlImages", true)[0]; TextBox textTreatmentNotes = (TextBox)sender.Controls.Find("textTreatmentNotes", true)[0]; //bool TreatmentNoteChanged=sender.TreatmentNoteChanged;//might have to do a by ref here? //Then get some data that we need Family fam = null; PatientNote PatientNoteCur = null; List <PatPlan> PatPlanList = null; List <InsSub> SubList = null; List <InsPlan> PlanList = null; if (PatCur != null) { fam = Patients.GetFamily(PatCur.PatNum); PatientNoteCur = PatientNotes.Refresh(PatCur.PatNum, PatCur.Guarantor); PatPlanList = PatPlans.Refresh(PatCur.PatNum); SubList = InsSubs.RefreshForFam(fam); PlanList = InsPlans.RefreshForSubList(SubList); } //Then, continue with the slightly altered original method. gridPtInfo.Height = tabControlImages.Top - gridPtInfo.Top; textTreatmentNotes.Text = ""; if (PatCur != null) { textTreatmentNotes.Text = PatientNoteCur.Treatment; textTreatmentNotes.Enabled = true; textTreatmentNotes.Select(textTreatmentNotes.Text.Length + 2, 1); textTreatmentNotes.ScrollToCaret(); sender.TreatmentNoteChanged = false; } gridPtInfo.BeginUpdate(); gridPtInfo.Columns.Clear(); ODGridColumn col = new ODGridColumn("", 100); //Lan.g("TableChartPtInfo",""),); gridPtInfo.Columns.Add(col); col = new ODGridColumn("", 300); gridPtInfo.Columns.Add(col); gridPtInfo.Rows.Clear(); if (PatCur == null) { gridPtInfo.EndUpdate(); return; } ODGridRow row; //Age row = new ODGridRow(); row.Cells.Add("Age"); row.Cells.Add(PatientLogic.DateToAgeString(PatCur.Birthdate)); row.Tag = null; gridPtInfo.Rows.Add(row); //Credit type row = new ODGridRow(); row.Cells.Add(Lan.g("TableChartPtInfo", "ABC0")); row.Cells.Add(PatCur.CreditType); row.Tag = null; gridPtInfo.Rows.Add(row); //Billing type row = new ODGridRow(); row.Cells.Add(Lan.g("TableChartPtInfo", "Billing Type")); row.Cells.Add(DefC.GetName(DefCat.BillingTypes, PatCur.BillingType)); row.Tag = null; gridPtInfo.Rows.Add(row); //Referrals RefAttach[] RefAttachList = RefAttaches.Refresh(PatCur.PatNum); for (int i = 0; i < RefAttachList.Length; i++) { row = new ODGridRow(); row.ColorBackG = Color.Aquamarine; if (RefAttachList[i].IsFrom) { row.Cells.Add("Referred From"); } else { row.Cells.Add("Referred To"); } row.Cells.Add(Referrals.GetNameLF(RefAttachList[i].ReferralNum)); row.Tag = null; gridPtInfo.Rows.Add(row); } //Date First Visit row = new ODGridRow(); row.Cells.Add(Lan.g("TableChartPtInfo", "Date First Visit")); if (PatCur.DateFirstVisit.Year < 1880) { row.Cells.Add("??"); } else if (PatCur.DateFirstVisit == DateTime.Today) { row.Cells.Add(Lan.g("TableChartPtInfo", "NEW PAT")); } else { row.Cells.Add(PatCur.DateFirstVisit.ToShortDateString()); } row.Tag = null; gridPtInfo.Rows.Add(row); //Prov - Pri & Sec row = new ODGridRow(); row.Cells.Add(Lan.g("TableChartPtInfo", "Prov. (Pri, Sec)")); if (PatCur.SecProv != 0) { row.Cells.Add(Providers.GetAbbr(PatCur.PriProv) + ", " + Providers.GetAbbr(PatCur.SecProv)); } else { row.Cells.Add(Providers.GetAbbr(PatCur.PriProv) + ", " + "None"); } row.Tag = null; gridPtInfo.Rows.Add(row); //PriIns row = new ODGridRow(); row.Cells.Add(Lan.g("TableChartPtInfo", "Pri Ins")); string name; if (PatPlanList.Count > 0) { name = InsPlans.GetCarrierName(PatPlans.GetPlanNum(PatPlanList, 1), PlanList); if (PatPlanList[0].IsPending) { name += Lan.g("TableChartPtInfo", " (pending)"); } row.Cells.Add(name); } else { row.Cells.Add(""); } row.Tag = null; gridPtInfo.Rows.Add(row); //SecIns row = new ODGridRow(); row.Cells.Add(Lan.g("TableChartPtInfo", "Sec Ins")); if (PatPlanList.Count > 1) { name = InsPlans.GetCarrierName(PatPlans.GetPlanNum(PatPlanList, 2), PlanList); if (PatPlanList[1].IsPending) { name += Lan.g("TableChartPtInfo", " (pending)"); } row.Cells.Add(name); } else { row.Cells.Add(""); } row.Tag = null; gridPtInfo.Rows.Add(row); //Registration keys------------------------------------------------------------------------------------------- if (PrefC.GetBool(PrefName.DistributorKey)) { RegistrationKey[] keys = RegistrationKeys.GetForPatient(PatCur.PatNum); for (int i = 0; i < keys.Length; i++) { row = new ODGridRow(); row.Cells.Add(Lan.g("TableChartPtInfo", "Registration Key")); string str = keys[i].RegKey.Substring(0, 4) + "-" + keys[i].RegKey.Substring(4, 4) + "-" + keys[i].RegKey.Substring(8, 4) + "-" + keys[i].RegKey.Substring(12, 4); if (keys[i].IsForeign) { str += "\r\nForeign"; } else { str += "\r\nUSA"; } str += "\r\nStarted: " + keys[i].DateStarted.ToShortDateString(); if (keys[i].DateDisabled.Year > 1880) { str += "\r\nDisabled: " + keys[i].DateDisabled.ToShortDateString(); } if (keys[i].DateEnded.Year > 1880) { str += "\r\nEnded: " + keys[i].DateEnded.ToShortDateString(); } if (keys[i].Note != "") { str += keys[i].Note; } row.Cells.Add(str); row.Tag = keys[i].Copy(); gridPtInfo.Rows.Add(row); } } ODGridCell cell; //medical fields----------------------------------------------------------------- bool showMed = true; if (Programs.IsEnabled(ProgramName.eClinicalWorks) && ProgramProperties.GetPropVal(ProgramName.eClinicalWorks, "IsStandalone") == "0") { showMed = false; } if (showMed) { //premed flag. if (PatCur.Premed) { row = new ODGridRow(); row.Cells.Add(""); cell = new ODGridCell(); cell.Text = Lan.g("TableChartPtInfo", "Premedicate"); cell.ColorText = Color.Red; cell.Bold = YN.Yes; row.Cells.Add(cell); row.ColorBackG = DefC.Long[(int)DefCat.MiscColors][3].ItemColor; row.Tag = "med"; gridPtInfo.Rows.Add(row); } //diseases Disease[] DiseaseList = Diseases.Refresh(PatCur.PatNum); row = new ODGridRow(); cell = new ODGridCell(Lan.g("TableChartPtInfo", "Diseases")); cell.Bold = YN.Yes; row.Cells.Add(cell); if (DiseaseList.Length > 0) { row.Cells.Add(""); } else { row.Cells.Add(Lan.g("TableChartPtInfo", "none")); } row.ColorBackG = DefC.Long[(int)DefCat.MiscColors][3].ItemColor; row.Tag = "med"; gridPtInfo.Rows.Add(row); for (int i = 0; i < DiseaseList.Length; i++) { row = new ODGridRow(); cell = new ODGridCell(DiseaseDefs.GetName(DiseaseList[i].DiseaseDefNum)); cell.ColorText = Color.Red; cell.Bold = YN.Yes; row.Cells.Add(cell); row.Cells.Add(DiseaseList[i].PatNote); row.ColorBackG = DefC.Long[(int)DefCat.MiscColors][3].ItemColor; row.Tag = "med"; gridPtInfo.Rows.Add(row); } //MedUrgNote row = new ODGridRow(); row.Cells.Add(Lan.g("TableChartPtInfo", "Med Urgent")); cell = new ODGridCell(); cell.Text = PatCur.MedUrgNote; cell.ColorText = Color.Red; cell.Bold = YN.Yes; row.Cells.Add(cell); row.ColorBackG = DefC.Long[(int)DefCat.MiscColors][3].ItemColor; row.Tag = "med"; gridPtInfo.Rows.Add(row); //Medical row = new ODGridRow(); row.Cells.Add(Lan.g("TableChartPtInfo", "Medical Summary")); row.Cells.Add(PatientNoteCur.Medical); row.ColorBackG = DefC.Long[(int)DefCat.MiscColors][3].ItemColor; row.Tag = "med"; gridPtInfo.Rows.Add(row); //Service row = new ODGridRow(); row.Cells.Add(Lan.g("TableChartPtInfo", "Service Notes")); row.Cells.Add(PatientNoteCur.Service); row.ColorBackG = DefC.Long[(int)DefCat.MiscColors][3].ItemColor; row.Tag = "med"; gridPtInfo.Rows.Add(row); //medications Medications.Refresh(); MedicationPats.Refresh(PatCur.PatNum); row = new ODGridRow(); cell = new ODGridCell(Lan.g("TableChartPtInfo", "Medications")); cell.Bold = YN.Yes; row.Cells.Add(cell); if (MedicationPats.List.Length > 0) { row.Cells.Add(""); } else { row.Cells.Add(Lan.g("TableChartPtInfo", "none")); } row.ColorBackG = DefC.Long[(int)DefCat.MiscColors][3].ItemColor; row.Tag = "med"; gridPtInfo.Rows.Add(row); string text; Medication med; for (int i = 0; i < MedicationPats.List.Length; i++) { row = new ODGridRow(); med = Medications.GetMedication(MedicationPats.List[i].MedicationNum); text = med.MedName; if (med.MedicationNum != med.GenericNum) { text += "(" + Medications.GetMedication(med.GenericNum).MedName + ")"; } row.Cells.Add(text); text = MedicationPats.List[i].PatNote + "(" + Medications.GetGeneric(MedicationPats.List[i].MedicationNum).Notes + ")"; row.Cells.Add(text); row.ColorBackG = DefC.Long[(int)DefCat.MiscColors][3].ItemColor; row.Tag = "med"; gridPtInfo.Rows.Add(row); } } //if !eCW.enabled gridPtInfo.EndUpdate(); }