///<summary>Returns the toothNums from 1-32 to skip for the given patient.</summary> private static List <int> GetSkippedTeethForExam(Patient pat, PerioExam examCur) { List <int> listSkippedTeeth = new List <int>(); List <PerioExam> listOtherExamsForPat = GetExamsList(pat.PatNum) .Where(x => x.PerioExamNum != examCur.PerioExamNum) .OrderBy(x => x.ExamDate) .ToList(); //If any other perio exams exist, we'll use the latest exam for the skipped tooth. if (!listOtherExamsForPat.IsNullOrEmpty()) { listSkippedTeeth = PerioMeasures.GetSkipped(listOtherExamsForPat.Last().PerioExamNum); } //For patient's first perio chart, any teeth marked missing are automatically marked skipped. else if (PrefC.GetBool(PrefName.PerioSkipMissingTeeth)) { //Procedures will only be queried for as needed. List <Procedure> listProcs = null; foreach (string missingTooth in ToothInitials.GetMissingOrHiddenTeeth(ToothInitials.Refresh(pat.PatNum))) { if (missingTooth.CompareTo("A") >= 0 && missingTooth.CompareTo("Z") <= 0) { //If is a letter (not a number) //Skipped teeth are only recorded by tooth number within the perio exam. continue; } int toothNum = PIn.Int(missingTooth); //Check if this tooth has had an implant done AND the office has the preference to SHOW implants if (PrefC.GetBool(PrefName.PerioTreatImplantsAsNotMissing)) { if (listProcs == null) { listProcs = Procedures.Refresh(pat.PatNum); } if (IsToothImplant(toothNum, listProcs)) { //Remove the tooth from the list of skipped teeth if it exists. listSkippedTeeth.RemoveAll(x => x == toothNum); //We do not want to add it back to the list below. continue; } } //This tooth is missing and we know it is not an implant OR the office has the preference to ignore implants. //Simply add it to our list of skipped teeth. listSkippedTeeth.Add(toothNum); } } return(listSkippedTeeth); }
///<summary>Creates a new perio exam for the given patient. Returns that perio exam. Handles setting default skipped teeth/implants. Does not create a security log entry.</summary> public static PerioExam CreateNewExam(Patient pat) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <PerioExam>(MethodBase.GetCurrentMethod(), pat)); } PerioExam newExam = new PerioExam { PatNum = pat.PatNum, ExamDate = DateTimeOD.Today, ProvNum = pat.PriProv, DateTMeasureEdit = MiscData.GetNowDateTime() }; Insert(newExam); PerioMeasures.SetSkipped(newExam.PerioExamNum, GetSkippedTeethForExam(pat, newExam)); return(newExam); }