Esempio n. 1
0
		///<summary></summary>
		public static long Insert(PerioExam Cur) {
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				Cur.PerioExamNum=Meth.GetLong(MethodBase.GetCurrentMethod(),Cur);
				return Cur.PerioExamNum;
			}
			return Crud.PerioExamCrud.Insert(Cur);
		}
Esempio n. 2
0
		///<summary></summary>
		public static void Update(PerioExam Cur){
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				Meth.GetVoid(MethodBase.GetCurrentMethod(),Cur);
				return;
			}
			Crud.PerioExamCrud.Update(Cur);
		}
Esempio n. 3
0
		///<summary></summary>
		public static void Delete(PerioExam Cur){
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				Meth.GetVoid(MethodBase.GetCurrentMethod(),Cur);
				return;
			}
			string command= "DELETE from perioexam WHERE PerioExamNum = '"+Cur.PerioExamNum.ToString()+"'";
			Db.NonQ(command);
			command= "DELETE from periomeasure WHERE PerioExamNum = '"+Cur.PerioExamNum.ToString()+"'";
			Db.NonQ(command);
		}
Esempio n. 4
0
        ///<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);
        }
Esempio n. 5
0
		///<summary>Most recent date last.  All exams loaded, even if not displayed.</summary>
		public static void Refresh(long patNum) {
			//No need to check RemotingRole; no call to db.
			DataTable table=GetExamsTable(patNum);
			ListExams=new List<PerioExam>();
			PerioExam exam;
			for(int i=0;i<table.Rows.Count;i++){
				exam=new PerioExam();
				exam.PerioExamNum= PIn.Long   (table.Rows[i][0].ToString());
				exam.PatNum      = PIn.Long(table.Rows[i][1].ToString());
				exam.ExamDate    = PIn.Date(table.Rows[i][2].ToString());
				exam.ProvNum     = PIn.Long(table.Rows[i][3].ToString());
				ListExams.Add(exam);
			}
			//return list;
			//PerioMeasures.Refresh(patNum);
		}
Esempio n. 6
0
        ///<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);
        }
Esempio n. 7
0
		private void butAdd_Click(object sender, System.EventArgs e) {
			if(!Security.IsAuthorized(Permissions.PerioEdit,MiscData.GetNowDateTime())){
				return;
			}
			if(listExams.SelectedIndex!=-1){
				gridP.SaveCurExam(PerioExamCur.PerioExamNum);
			}
			PerioExamCur=new PerioExam();
			PerioExamCur.PatNum=PatCur.PatNum;
			PerioExamCur.ExamDate=DateTimeOD.Today;
			PerioExamCur.ProvNum=PatCur.PriProv;
			PerioExams.Insert(PerioExamCur);
			List<int> skippedTeeth=new List<int>();//int 1-32
			if(PerioExams.ListExams.Count==0){
				for(int i=0;i<MissingTeeth.Count;i++){
					if(((string)MissingTeeth[i]).CompareTo("A")<0//if a number
						|| ((string)MissingTeeth[i]).CompareTo("Z")>0)
					{
						skippedTeeth.Add(PIn.Int(MissingTeeth[i]));
					}
				}
			}
			else{
				//set skipped teeth based on the last exam in the list: 
				skippedTeeth=PerioMeasures.GetSkipped(PerioExams.ListExams[PerioExams.ListExams.Count-1].PerioExamNum);
			}
			PerioMeasures.SetSkipped(PerioExamCur.PerioExamNum,skippedTeeth);
			RefreshListExams();
			listExams.SelectedIndex=PerioExams.ListExams.Count-1;
			FillGrid();
		}
Esempio n. 8
0
		///<summary>Usually set the selected index first</summary>
		private void FillGrid() {
			if(listExams.SelectedIndex!=-1){
				gridP.perioEdit=true;
				if(!Security.IsAuthorized(Permissions.PerioEdit,PerioExams.ListExams[listExams.SelectedIndex].ExamDate,true)) {
					gridP.perioEdit=false;
				}
				PerioExamCur=PerioExams.ListExams[listExams.SelectedIndex];
			}
			gridP.SelectedExam=listExams.SelectedIndex;
			gridP.LoadData();
			FillIndexes();
			FillCounts();
			gridP.Invalidate();
			gridP.Focus();//this still doesn't seem to work to enable first arrow click to move
		}
		//public List<PerioMeasure> ListPerioMeasures; 

		public FormPerioGraphical(PerioExam perioExam,Patient patient) {
			PerioExamCur=perioExam;
			PatCur=patient;
			InitializeComponent();
			//ComputerPref localComputerPrefs=ComputerPrefs.GetForLocalComputer();
			toothChart.DeviceFormat=new ToothChartDirectX.DirectXDeviceFormat(ComputerPrefs.LocalComputer.DirectXFormat);//Must be set before draw mode
			toothChart.DrawMode=DrawingMode.DirectX;
			toothChart.SetToothNumberingNomenclature((ToothNumberingNomenclature)PrefC.GetInt(PrefName.UseInternationalToothNumbers));
			toothChart.ColorBackground=Color.White;
			toothChart.ColorText=Color.Black;
			toothChart.PerioMode=true;
			toothChart.ColorBleeding=DefC.Short[(int)DefCat.MiscColors][1].ItemColor;
			toothChart.ColorSuppuration=DefC.Short[(int)DefCat.MiscColors][2].ItemColor;
			toothChart.ColorProbing=PrefC.GetColor(PrefName.PerioColorProbing);
			toothChart.ColorProbingRed=PrefC.GetColor(PrefName.PerioColorProbingRed);
			toothChart.ColorGingivalMargin=PrefC.GetColor(PrefName.PerioColorGM);
			toothChart.ColorCAL=PrefC.GetColor(PrefName.PerioColorCAL);
			toothChart.ColorMGJ=PrefC.GetColor(PrefName.PerioColorMGJ);
			toothChart.ColorFurcations=PrefC.GetColor(PrefName.PerioColorFurcations);
			toothChart.ColorFurcationsRed=PrefC.GetColor(PrefName.PerioColorFurcationsRed);
			toothChart.RedLimitProbing=PrefC.GetInt(PrefName.PerioRedProb);
			toothChart.RedLimitFurcations=PrefC.GetInt(PrefName.PerioRedFurc);
			List<PerioMeasure> listMeas=PerioMeasures.GetAllForExam(PerioExamCur.PerioExamNum);
			//compute CAL's for each site.  If a CAL is valid, pass it in.
			PerioMeasure measureProbe;
			PerioMeasure measureGM;
			int gm;
			int pd;
			int calMB;
			int calB;
			int calDB;
			int calML;
			int calL;
			int calDL;
			for(int t=1;t<=32;t++) {
				measureProbe=null;
				measureGM=null;
				for(int i=0;i<listMeas.Count;i++) {
					if(listMeas[i].IntTooth!=t) {
						continue;
					}
					if(listMeas[i].SequenceType==PerioSequenceType.Probing) {
						measureProbe=listMeas[i];
					}
					if(listMeas[i].SequenceType==PerioSequenceType.GingMargin) {
						measureGM=listMeas[i];
					}
				}
				if(measureProbe==null||measureGM==null) {
					continue;//to the next tooth
				}
				//mb
				calMB=-1;
				gm=measureGM.MBvalue;//MBvalue must stay over 100 for hyperplasia, because that's how we're storing it in ToothChartData.ListPerioMeasure.
				if(gm>100) {//hyperplasia
					gm=100-gm;//e.g. 100-103=-3
				}
				pd=measureProbe.MBvalue;
				if(measureGM.MBvalue!=-1 && pd!=-1) {
					calMB=gm+pd;
					if(calMB<0) {
						calMB=0;//CALs can't be negative
					}
				}
				//B
				calB=-1;
				gm=measureGM.Bvalue;
				if(gm>100) {//hyperplasia
					gm=100-gm;//e.g. 100-103=-3 
				}
				pd=measureProbe.Bvalue;
				if(measureGM.Bvalue!=-1&&pd!=-1) {
					calB=gm+pd;
					if(calB<0) {
						calB=0;
					}
				}
				//DB
				calDB=-1;
				gm=measureGM.DBvalue;
				if(gm>100) {//hyperplasia
					gm=100-gm;//e.g. 100-103=-3 
				}
				pd=measureProbe.DBvalue;
				if(measureGM.DBvalue!=-1&&pd!=-1) {
					calDB=gm+pd;
					if(calDB<0) {
						calDB=0;
					}
				}
				//ML
				calML=-1;
				gm=measureGM.MLvalue;
				if(gm>100) {//hyperplasia
					gm=100-gm;//e.g. 100-103=-3 
				}
				pd=measureProbe.MLvalue;
				if(measureGM.MLvalue!=-1&&pd!=-1) {
					calML=gm+pd;
					if(calML<0) {
						calML=0;
					}
				}
				//L
				calL=-1;
				gm=measureGM.Lvalue;
				if(gm>100) {//hyperplasia
					gm=100-gm;//e.g. 100-103=-3 
				}
				pd=measureProbe.Lvalue;
				if(measureGM.Lvalue!=-1&&pd!=-1) {
					calL=gm+pd;
					if(calL<0) {
						calL=0;
					}
				}
				//DL
				calDL=-1;
				gm=measureGM.DLvalue;
				if(gm>100) {//hyperplasia
					gm=100-gm;//e.g. 100-103=-3 
				}
				pd=measureProbe.DLvalue;
				if(measureGM.DLvalue!=-1&&pd!=-1) {
					calDL=gm+pd;
					if(calDL<0) {
						calDL=0;
					}
				}
				if(calMB!=-1||calB!=-1||calDB!=-1||calML!=-1||calL!=-1||calDL!=-1){
					toothChart.AddPerioMeasure(t,PerioSequenceType.CAL,calMB,calB,calDB,calML,calL,calDL);
				}
			}
			for(int i=0;i<listMeas.Count;i++) {
				if(listMeas[i].SequenceType==PerioSequenceType.SkipTooth) {
					toothChart.SetMissing(listMeas[i].IntTooth.ToString());
				} 
				else if(listMeas[i].SequenceType==PerioSequenceType.Mobility) {
					int mob=listMeas[i].ToothValue;
					Color color=Color.Black;
					if(mob>=PrefC.GetInt(PrefName.PerioRedMob)) {
						color=Color.Red;
					}
					toothChart.SetMobility(listMeas[i].IntTooth.ToString(),mob.ToString(),color);
				} 
				else {
					toothChart.AddPerioMeasure(listMeas[i]);
				}
			}


			/*
			toothChart.SetMissing("13");
			toothChart.SetMissing("14");
			toothChart.SetMissing("18");
			toothChart.SetMissing("25");
			toothChart.SetMissing("26");
			toothChart.SetImplant("14",Color.Gray);
			//Movements are too low of a priority to test right now.  We might not even want to implement them.
			//toothChart.MoveTooth("4",0,0,0,0,-5,0);
			//toothChart.MoveTooth("16",0,20,0,-3,0,0);
			//toothChart.MoveTooth("24",15,2,0,0,0,0);
			toothChart.SetMobility("2","3",Color.Red);
			toothChart.SetMobility("7","2",Color.Red);
			toothChart.SetMobility("8","2",Color.Red);
			toothChart.SetMobility("9","2",Color.Red);
			toothChart.SetMobility("10","2",Color.Red);
			toothChart.SetMobility("16","3",Color.Red);
			toothChart.SetMobility("24","2",Color.Red);
			toothChart.SetMobility("31","3",Color.Red);
			toothChart.AddPerioMeasure(1,PerioSequenceType.Furcation,-1,2,-1,1,-1,-1);
			toothChart.AddPerioMeasure(2,PerioSequenceType.Furcation,-1,2,-1,1,-1,-1);
			toothChart.AddPerioMeasure(3,PerioSequenceType.Furcation,-1,2,-1,1,-1,-1);
			toothChart.AddPerioMeasure(5,PerioSequenceType.Furcation,1,-1,-1,-1,-1,-1);
			toothChart.AddPerioMeasure(30,PerioSequenceType.Furcation,-1,-1,-1,-1,3,-1);
			for(int i=1;i<=32;i++) {
				//string tooth_id=i.ToString();
				//bleeding and suppuration on all MB sites
				//bleeding only all DL sites
				//suppuration only all B sites
				//blood=1, suppuration=2, both=3
				toothChart.AddPerioMeasure(i,PerioSequenceType.Bleeding,  3,2,-1,-1,-1,1);
				toothChart.AddPerioMeasure(i,PerioSequenceType.GingMargin,0,1,1,1,0,0);
				toothChart.AddPerioMeasure(i,PerioSequenceType.Probing,   3,2,3,4,2,3);
				toothChart.AddPerioMeasure(i,PerioSequenceType.CAL,       3,3,4,5,2,3);//basically GingMargin+Probing, unless one of them is -1
				toothChart.AddPerioMeasure(i,PerioSequenceType.MGJ,       5,5,5,6,6,6);
			}*/
		}