private void FillControls()
 {
     _listProviders         = Providers.GetDeepCopy(true);
     textPracticeTitle.Text = PrefC.GetString(PrefName.PracticeTitle);
     textAddress.Text       = PrefC.GetString(PrefName.PracticeAddress);
     textAddress2.Text      = PrefC.GetString(PrefName.PracticeAddress2);
     textCity.Text          = PrefC.GetString(PrefName.PracticeCity);
     textST.Text            = PrefC.GetString(PrefName.PracticeST);
     textZip.Text           = PrefC.GetString(PrefName.PracticeZip);
     textPhone.Text         = TelephoneNumbers.ReFormat(PrefC.GetString(PrefName.PracticePhone));
     textFax.Text           = TelephoneNumbers.ReFormat(PrefC.GetString(PrefName.PracticeFax));
     listProvider.Items.Clear();
     for (int i = 0; i < _listProviders.Count; i++)
     {
         listProvider.Items.Add(_listProviders[i].GetLongDesc());
         if (_listProviders[i].ProvNum == PrefC.GetLong(PrefName.PracticeDefaultProv))
         {
             listProvider.SelectedIndex = i;
         }
     }
     CheckIsDone();
 }
Ejemplo n.º 2
0
        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.");
        }