예제 #1
0
 private void butAdd_Click(object sender,EventArgs e)
 {
     Recall recall=new Recall();
     recall.RecallTypeNum=0;//user will have to pick
     recall.PatNum=PatNum;
     recall.RecallInterval=new Interval(0,0,6,0);
     FormRecallEdit FormRE=new FormRecallEdit();
     FormRE.IsNew=true;
     FormRE.RecallCur=recall;
     FormRE.ShowDialog();
     FillGrid();
 }
예제 #2
0
        //Type: RecallType, once we have multiple recall types

        ///<summary>Returns a copy of this Recall.</summary>
        public Recall Copy()
        {
            Recall recall = new Recall();

            recall.RecallNum      = RecallNum;
            recall.PatNum         = PatNum;
            recall.DateDueCalc    = DateDueCalc;
            recall.DateDue        = DateDue;
            recall.DatePrevious   = DatePrevious;
            recall.RecallInterval = RecallInterval;
            recall.RecallStatus   = RecallStatus;
            recall.Note           = Note;
            recall.IsDisabled     = IsDisabled;
            return(recall);
        }
예제 #3
0
파일: FormRecallsPat.cs 프로젝트: mnisl/OD
		private void butPerio_Click(object sender,EventArgs e) {
			//make sure we have both special types properly setup.
			if(!RecallTypes.PerioAndProphyBothHaveTriggers()){
				MsgBox.Show(this,"Prophy and Perio special recall types are not setup properly.  They must both exist, and they must both have a trigger.");
				return;
			}
			if(IsPerio){
				//change the perio types to prophy
				for(int i=0;i<RecallList.Count;i++){
					if(PrefC.GetLong(PrefName.RecallTypeSpecialPerio)==RecallList[i].RecallTypeNum){
						RecallList[i].RecallTypeNum=PrefC.GetLong(PrefName.RecallTypeSpecialProphy);
						RecallList[i].RecallInterval=RecallTypes.GetInterval(PrefC.GetLong(PrefName.RecallTypeSpecialProphy));
						//previous date will be reset below in synch, but probably won't change since similar triggers.
						Recalls.Update(RecallList[i]);
						break;
					}
				}
			}
			else{
				bool found=false;
				//change any prophy types to perio
				for(int i=0;i<RecallList.Count;i++){
					if(PrefC.GetLong(PrefName.RecallTypeSpecialProphy)==RecallList[i].RecallTypeNum){
						RecallList[i].RecallTypeNum=PrefC.GetLong(PrefName.RecallTypeSpecialPerio);
						RecallList[i].RecallInterval=RecallTypes.GetInterval(PrefC.GetLong(PrefName.RecallTypeSpecialPerio));
						//previous date will be reset below in synch, but probably won't change since similar triggers.
						Recalls.Update(RecallList[i]);
						found=true;
						break;
					}
				}
				//if none found, then add a perio
				if(!found){
					Recall recall=new Recall();
					recall.PatNum=PatNum;
					recall.RecallInterval=RecallTypes.GetInterval(PrefC.GetLong(PrefName.RecallTypeSpecialPerio));
					recall.RecallTypeNum=PrefC.GetLong(PrefName.RecallTypeSpecialPerio);
					Recalls.Insert(recall);
				}
			}
			FillGrid();
		}
예제 #4
0
            ///<summary>Returns true if the recall will fit in the time slot and there are no other appointments in the slot.</summary>
            public bool IsApptSlotAvailable(Recall recall, long opNum, DateTime slotStart, DateTime slotEnd)
            {
                int minutes = RecallTypes.GetTimePattern(recall.RecallTypeNum).Length *PrefC.GetInt(PrefName.AppointmentTimeIncrement);

                return(IsApptSlotAvailable(minutes, opNum, slotStart, slotEnd));
            }
예제 #5
0
파일: Appointments.cs 프로젝트: mnisl/OD
		///<summary>Fills an appointment passed in with all appropriate procedures for the recall passed in.  It's up to the calling class to then place the appointment on the pinboard or schedule.  The appointment will be inserted into the database in this method so it's important to delete it if the appointment doesn't get scheduled.  Returns the list of procedures that were created for the appointment so that they can be displayed to Orion users.</summary>
		public static List<Procedure> FillAppointmentForRecall(Appointment aptCur,Recall recallCur,List<Recall> listRecalls,Patient patCur,List<string> listProcStrs,List<InsPlan> listPlans,List<InsSub> listSubs) {
			//No need to check RemotingRole; no call to db.
			aptCur.PatNum=patCur.PatNum;
			aptCur.AptStatus=ApptStatus.UnschedList;//In all places where this is used, the unsched status with no aptDateTime will cause the appt to be deleted when the pinboard is cleared.
			if(patCur.PriProv==0) {
				aptCur.ProvNum=PrefC.GetLong(PrefName.PracticeDefaultProv);
			}
			else {
				aptCur.ProvNum=patCur.PriProv;
			}
			aptCur.ProvHyg=patCur.SecProv;
			if(aptCur.ProvHyg!=0) {
				aptCur.IsHygiene=true;
			}
			aptCur.ClinicNum=patCur.ClinicNum;
			//whether perio or prophy:
			string recallPattern=RecallTypes.GetTimePattern(recallCur.RecallTypeNum);
			if(RecallTypes.IsSpecialRecallType(recallCur.RecallTypeNum)
				&& patCur.Birthdate.AddYears(PrefC.GetInt(PrefName.RecallAgeAdult)) > ((recallCur.DateDue>DateTime.Today)?recallCur.DateDue:DateTime.Today)) //For example, if pt's 12th birthday falls after recall date.
			{
				List<RecallType> listRecallTypes=RecallTypeC.GetListt();
				for(int i=0;i<listRecallTypes.Count;i++) {
					if(listRecallTypes[i].RecallTypeNum==RecallTypes.ChildProphyType) {
						List<string> childprocs=RecallTypes.GetProcs(listRecallTypes[i].RecallTypeNum);
						if(childprocs.Count>0) {
							listProcStrs=childprocs;//overrides adult procs.
						}
						string childpattern=RecallTypes.GetTimePattern(listRecallTypes[i].RecallTypeNum);
						if(childpattern!="") {
							recallPattern=childpattern;//overrides adult pattern.
						}
					}
				}
			}
			//convert time pattern to 5 minute increment
			StringBuilder savePattern=new StringBuilder();
			for(int i=0;i<recallPattern.Length;i++) {
				savePattern.Append(recallPattern.Substring(i,1));
				if(PrefC.GetLong(PrefName.AppointmentTimeIncrement)==10) {
					savePattern.Append(recallPattern.Substring(i,1));
				}
				if(PrefC.GetLong(PrefName.AppointmentTimeIncrement)==15) {
					savePattern.Append(recallPattern.Substring(i,1));
					savePattern.Append(recallPattern.Substring(i,1));
				}
			}
			if(savePattern.ToString()=="") {
				if(PrefC.GetLong(PrefName.AppointmentTimeIncrement)==15) {
					savePattern.Append("///XXX///");
				}
				else {
					savePattern.Append("//XX//");
				}
			}
			aptCur.Pattern=savePattern.ToString();
			//Add films------------------------------------------------------------------------------------------------------
			if(RecallTypes.IsSpecialRecallType(recallCur.RecallTypeNum)) {//if this is a prophy or perio
				for(int i=0;i<listRecalls.Count;i++) {
					if(recallCur.RecallNum==listRecalls[i].RecallNum) {
						continue;//already handled.
					}
					if(listRecalls[i].IsDisabled) {
						continue;
					}
					if(listRecalls[i].DateDue.Year<1880) {
						continue;
					}
					if(listRecalls[i].DateDue>recallCur.DateDue//if film due date is after prophy due date
						&& listRecalls[i].DateDue>DateTime.Today)//and not overdue
					{
						continue;
					}
					//incomplete: exclude manual recall types
					listProcStrs.AddRange(RecallTypes.GetProcs(listRecalls[i].RecallTypeNum));
				}
			}
			aptCur.ProcDescript="";
			aptCur.ProcsColored="";
			for(int i=0;i<listProcStrs.Count;i++) {
				string procDescOne="";
				if(i>0) {
					aptCur.ProcDescript+=", ";
				}
				procDescOne+=ProcedureCodes.GetProcCode(listProcStrs[i]).AbbrDesc;
				aptCur.ProcDescript+=procDescOne;
				//Color and previous date are determined by ProcApptColor object
				ProcApptColor pac=ProcApptColors.GetMatch(listProcStrs[i]);
				System.Drawing.Color pColor=System.Drawing.Color.Black;
				string prevDateString="";
				if(pac!=null) {
					pColor=pac.ColorText;
					if(pac.ShowPreviousDate) {
						prevDateString=Procedures.GetRecentProcDateString(aptCur.PatNum,aptCur.AptDateTime,pac.CodeRange);
						if(prevDateString!="") {
							prevDateString=" ("+prevDateString+")";
						}
					}
				}
				aptCur.ProcsColored+="<span color=\""+pColor.ToArgb().ToString()+"\">"+procDescOne+prevDateString+"</span>";
			}
			aptCur.TimeLocked=PrefC.GetBool(PrefName.AppointmentTimeIsLocked);
			Appointments.Insert(aptCur);
			Procedure procCur;
			List<PatPlan> listPatPlans=PatPlans.Refresh(patCur.PatNum);
			List<Benefit> listBenifits=Benefits.Refresh(listPatPlans,listSubs);
			InsPlan priplan=null;
			InsSub prisub=null;
			if(listPatPlans.Count>0) {
				prisub=InsSubs.GetSub(listPatPlans[0].InsSubNum,listSubs);
				priplan=InsPlans.GetPlan(prisub.PlanNum,listPlans);
			}
			double insfee;
			double standardfee;
			List<Procedure> listProcs=new List<Procedure>();
			for(int i=0;i<listProcStrs.Count;i++) {
				procCur=new Procedure();//this will be an insert
				//procnum
				procCur.PatNum=patCur.PatNum;
				procCur.AptNum=aptCur.AptNum;
				procCur.CodeNum=ProcedureCodes.GetCodeNum(listProcStrs[i]);
				procCur.ProcDate=DateTime.Now;
				procCur.DateTP=DateTime.Now;
				//Check if it's a medical procedure.
				bool isMed = false;
				procCur.MedicalCode=ProcedureCodes.GetProcCode(procCur.CodeNum).MedicalCode;
				if(procCur.MedicalCode != null && procCur.MedicalCode != "") {
					isMed = true;
				}
				//Get fee schedule for medical or dental.
				long feeSch;
				if(isMed) {
					feeSch=Fees.GetMedFeeSched(patCur,listPlans,listPatPlans,listSubs);
				}
				else {
					feeSch=Fees.GetFeeSched(patCur,listPlans,listPatPlans,listSubs);
				}
				//Get the fee amount for medical or dental.
				if(PrefC.GetBool(PrefName.MedicalFeeUsedForNewProcs) && isMed) {
					insfee=Fees.GetAmount0(ProcedureCodes.GetProcCode(procCur.MedicalCode).CodeNum,feeSch);
				}
				else {
					insfee=Fees.GetAmount0(procCur.CodeNum,feeSch);
				}
				if(priplan!=null && priplan.PlanType=="p") {//PPO
					standardfee=Fees.GetAmount0(procCur.CodeNum,Providers.GetProv(Patients.GetProvNum(patCur)).FeeSched);
					if(standardfee>insfee) {
						procCur.ProcFee=standardfee;
					}
					else {
						procCur.ProcFee=insfee;
					}
				}
				else {
					procCur.ProcFee=insfee;
				}
				//surf
				//toothnum
				//Procedures.Cur.ToothRange="";
				//ProcCur.NoBillIns=ProcedureCodes.GetProcCode(ProcCur.CodeNum).NoBillIns;
				//priority
				procCur.ProcStatus=ProcStat.TP;
				procCur.Note="";
				//Procedures.Cur.PriEstim=
				//Procedures.Cur.SecEstim=
				//claimnum
				procCur.ProvNum=patCur.PriProv;
				//Procedures.Cur.Dx=
				procCur.ClinicNum=patCur.ClinicNum;
				//nextaptnum
				procCur.BaseUnits = ProcedureCodes.GetProcCode(procCur.CodeNum).BaseUnits;
				procCur.DiagnosticCode=PrefC.GetString(PrefName.ICD9DefaultForNewProcs);
				Procedures.Insert(procCur);//no recall synch required
				Procedures.ComputeEstimates(procCur,patCur.PatNum,new List<ClaimProc>(),false,listPlans,listPatPlans,listBenifits,patCur.Age,listSubs);
				listProcs.Add(procCur);
			}
			return listProcs;
		}