public static DateTime GetOrthoNextClaimDate(DateTime currentOrthoClaimDate, PatientNote patNoteCur, OrthoAutoProcFrequency freq, int monthsTreat) { //No remotingrole check needed; no call to db. DateTime claimDate = currentOrthoClaimDate; switch (freq) { case OrthoAutoProcFrequency.Monthly: claimDate = currentOrthoClaimDate.AddMonths(1); break; case OrthoAutoProcFrequency.Quarterly: claimDate = currentOrthoClaimDate.AddMonths(3); break; case OrthoAutoProcFrequency.SemiAnnual: claimDate = currentOrthoClaimDate.AddMonths(6); break; case OrthoAutoProcFrequency.Annual: claimDate = currentOrthoClaimDate.AddYears(1); break; } //If we are passed the total allotted treatment time for this patient, there should be no NextClaimDate. if (claimDate.AddMonths(-1) > Procedures.GetFirstOrthoProcDate(patNoteCur).AddMonths(monthsTreat)) { claimDate = DateTime.MinValue; //the previous claim send was their last claim. } return(claimDate); }
///<summary></summary> public FormMedical(PatientNote patientNoteCur,Patient patCur) { InitializeComponent();// Required for Windows Form Designer support PatCur=patCur; PatientNoteCur=patientNoteCur; Lan.F(this); }
///<summary></summary> public static PatientNote Refresh(long patNum, long guarantor) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <PatientNote>(MethodBase.GetCurrentMethod(), patNum, guarantor)); } string command = "SELECT COUNT(*) FROM patientnote WHERE patnum = '" + POut.Long(patNum) + "'"; DataTable table = Db.GetTable(command); if (table.Rows[0][0].ToString() == "0") { InsertRow(patNum); } command = "SELECT * FROM patientnote WHERE patnum ='" + POut.Long(patNum) + "'"; PatientNote Cur = Crud.PatientNoteCrud.SelectOne(command); //fam financial note: command = "SELECT * FROM patientnote WHERE patnum ='" + POut.Long(guarantor) + "'"; table = Db.GetTable(command); if (table.Rows.Count == 0) { InsertRow(guarantor); } command = "SELECT famfinancial FROM patientnote WHERE patnum ='" + POut.Long(guarantor) + "'"; table = Db.GetTable(command); Cur.FamFinancial = PIn.String(table.Rows[0][0].ToString()); //overrides original FamFinancial value. return(Cur); }
///<summary></summary> public static void Update(PatientNote Cur,long guarantor) { if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(),Cur,guarantor); return; } Crud.PatientNoteCrud.Update(Cur);//FamFinancial gets skipped string command = "UPDATE patientnote SET " + "FamFinancial = '"+POut.String(Cur.FamFinancial)+"'" +" WHERE patnum = '"+POut.Long (guarantor)+"'"; Db.NonQ(command); }
///<summary></summary> public static void Update(PatientNote Cur, long guarantor) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(), Cur, guarantor); return; } Crud.PatientNoteCrud.Update(Cur); //FamFinancial gets skipped string command = "UPDATE patientnote SET " + "FamFinancial = '" + POut.String(Cur.FamFinancial) + "'" + " WHERE patnum = '" + POut.Long(guarantor) + "'"; Db.NonQ(command); }
///<summary>Merge the PatientNote for patFrom into the PatientNote for patTo. Appends to FamFinancial, Medical, Service, MedicalComp, Treatment. ///Overwrites ICEName, ICEPhone, OrthoMonthsTreatOverride, DateOrthoPlacementOverride, but only if those fields are not already set for patTo. ///</summary> public static void Merge(Patient patFrom, Patient patTo) { PatientNote patNoteFrom = PatientNotes.Refresh(patFrom.PatNum, patFrom.Guarantor); //Never returns null. PatientNote patNoteTo = PatientNotes.Refresh(patTo.PatNum, patTo.Guarantor); //Never returns null. string strMergeDiv = "\r\n"; if (!string.IsNullOrEmpty(patNoteTo.FamFinancial)) //FamFinancial { patNoteTo.FamFinancial += strMergeDiv; } patNoteTo.FamFinancial += patNoteFrom.FamFinancial; //Skip ApptPhone, no longer used as of 4/2007. if (!string.IsNullOrEmpty(patNoteTo.Medical)) //Medical { patNoteTo.Medical += strMergeDiv; } patNoteTo.Medical += patNoteFrom.Medical; if (!string.IsNullOrEmpty(patNoteTo.Service)) //Service { patNoteTo.Service += strMergeDiv; } patNoteTo.Service += patNoteFrom.Service; if (!string.IsNullOrEmpty(patNoteTo.MedicalComp)) //MedicalComp { patNoteTo.MedicalComp += strMergeDiv; } patNoteTo.MedicalComp += patNoteFrom.MedicalComp; if (!string.IsNullOrEmpty(patNoteTo.Treatment)) //Treatment { patNoteTo.Treatment += strMergeDiv; } patNoteTo.Treatment += patNoteFrom.Treatment; if (string.IsNullOrEmpty(patNoteTo.ICEName)) //ICEName, only change if patNotTo was not set. { patNoteTo.ICEName += patNoteFrom.ICEName; } if (string.IsNullOrEmpty(patNoteTo.ICEPhone)) //ICEPhone, only change if patNotTo was not set. { patNoteTo.ICEPhone += patNoteFrom.ICEPhone; } if (patNoteTo.OrthoMonthsTreatOverride == -1) //OrthoMonthsTreatOverride, only change if patNoteTo was not set. { patNoteTo.OrthoMonthsTreatOverride = patNoteFrom.OrthoMonthsTreatOverride; } if (patNoteTo.DateOrthoPlacementOverride != DateTime.MinValue) //DateOrthoPlacementOverride, only change if patNotTo was not set. { patNoteTo.DateOrthoPlacementOverride = patNoteFrom.DateOrthoPlacementOverride; } PatientNotes.Update(patNoteTo, patTo.Guarantor); //Will cause the guarantor's FamFinancial field to be updated. }
///<summary>Gets the PatientNote for the patient passed in. ///Inserts a row into the database for the patient AND for the guarantor passed in if one does not exist for either. ///The PatientNote returned always has the guarantor's FamFinancial value which should always override all family member's value.</summary> public static PatientNote Refresh(long patNum, long guarantor) { //RemotingRole check is needed here even though this method does not run methods, it does however call multiple private methods. if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <PatientNote>(MethodBase.GetCurrentMethod(), patNum, guarantor)); } PatientNote patientNote = GetOne(patNum); if (patientNote == null) { InsertRow(patNum); //Do NOT go back to the database to get the newly inserted row because there could be replication delay for larger customers. //Instead, just fill in the patientNote object with default values. patientNote = new PatientNote(); patientNote.PatNum = patNum; } PatientNote patientNoteGuarantor; //Check to see if the patient passed in IS the guarantor. if (patNum == guarantor) { //Do NOT try and insert yet another row for the guarantor if the guarantor IS the patient that we just inserted a new row for. //Make a deep copy of the current patientNote instead. patientNoteGuarantor = patientNote.Copy(); } else //Guarantor is a different patient than the patNum passed in. { patientNoteGuarantor = GetOne(guarantor); if (patientNoteGuarantor == null) { InsertRow(guarantor); //Do NOT go back to the database to get the newly inserted row because there could be replication delay for larger customers. //Instead, just fill in the patientNote object with default values. patientNoteGuarantor = new PatientNote(); patientNoteGuarantor.PatNum = guarantor; } } //Always override the family memeber's FamFinancial value with that of the guarantors (old behavior). patientNote.FamFinancial = patientNoteGuarantor.FamFinancial; return(patientNote); }
public static void IncrementOrthoNextClaimDates(PatPlan patPlan, InsPlan insPlan, int monthsTreat, PatientNote patNoteCur) { patPlan.OrthoAutoNextClaimDate = GetOrthoNextClaimDate(patPlan.OrthoAutoNextClaimDate, patNoteCur, insPlan.OrthoAutoProcFreq, monthsTreat); Update(patPlan); }
///<summary>isFullRefresh is ONLY for eCW at this point.</summary> private void RefreshModuleData(long patNum,bool isFullRefresh) { if(patNum==0){ PatCur=null; FamCur=null; return; } if(!isFullRefresh) { return; } FamCur=Patients.GetFamily(patNum); PatCur=FamCur.GetPatient(patNum); SubList=InsSubs.RefreshForFam(FamCur); PlanList=InsPlans.RefreshForSubList(SubList); PatPlanList=PatPlans.Refresh(patNum); BenefitList=Benefits.Refresh(PatPlanList,SubList); //todo: track down where this is altered. Optimize for eCW: PatientNoteCur=PatientNotes.Refresh(patNum,PatCur.Guarantor); if(PrefC.AtoZfolderUsed) { patFolder=ImageStore.GetPatientFolder(PatCur,ImageStore.GetPreferredAtoZpath());//GetImageFolder(); } DocumentList=Documents.GetAllWithPat(patNum); //todo: might change for planned appt: ApptList=Appointments.GetForPat(patNum); //todo: refresh as needed elsewhere: ToothInitialList=ToothInitials.Refresh(patNum); //todo: optimize for Full mode: PatFieldList=PatFields.Refresh(patNum); }
private void RefreshModuleData(long patNum) { if(patNum==0){ PatCur=null; FamCur=null; return; } FamCur=Patients.GetFamily(patNum); PatCur=FamCur.GetPatient(patNum); SubList=InsSubs.RefreshForFam(FamCur); PlanList=InsPlans.RefreshForSubList(SubList); PatPlanList=PatPlans.Refresh(patNum); BenefitList=Benefits.Refresh(PatPlanList,SubList); PatientNoteCur=PatientNotes.Refresh(patNum,PatCur.Guarantor); if(PrefC.UsingAtoZfolder) { patFolder=ImageStore.GetPatientFolder(PatCur,ImageStore.GetPreferredAtoZpath());//GetImageFolder(); } DocumentList=Documents.GetAllWithPat(patNum); ApptList=Appointments.GetForPat(patNum); ToothInitialList=ToothInitials.Refresh(patNum); PatFieldList=PatFields.Refresh(patNum); }
///<summary></summary> private void RefreshModuleData(long patNum,bool isSelectingFamily) { if (patNum == 0){ PatCur=null; FamCur=null; DataSetMain=null; Plugins.HookAddCode(this,"ContrAccount.RefreshModuleData_null"); return; } DateTime fromDate=DateTime.MinValue; DateTime toDate=DateTime.MaxValue; if(textDateStart.errorProvider1.GetError(textDateStart)=="" && textDateEnd.errorProvider1.GetError(textDateEnd)=="") { if(textDateStart.Text!="") { fromDate=PIn.Date(textDateStart.Text); } if(textDateEnd.Text!="") { toDate=PIn.Date(textDateEnd.Text); } } bool viewingInRecall=ViewingInRecall; if(PrefC.GetBool(PrefName.FuchsOptionsOn)) { panelTotalOwes.Top=-38; viewingInRecall=true; } DataSetMain=AccountModules.GetAll(patNum,viewingInRecall,fromDate,toDate,isSelectingFamily,checkShowDetail.Checked,true,true); FamCur=Patients.GetFamily(patNum);//for now, have to get family after dataset due to aging calc. PatCur=FamCur.GetPatient(patNum); PatientNoteCur=PatientNotes.Refresh(PatCur.PatNum,PatCur.Guarantor); FillSummary(); Plugins.HookAddCode(this,"ContrAccount.RefreshModuleData_end",FamCur,PatCur,DataSetMain,PPBalanceTotal,isSelectingFamily); }
///<summary>Runs the required queries to populate the necessary StaticTextData fields corresponding to staticTextDependencies.</summary> private void LoadData(StaticTextFieldDependency staticTextDependencies, Patient pat, Family fam, List <long> listProcCodeNums) { bool isMiddleTier = (RemotingClient.RemotingRole == RemotingRole.ServerWeb); System.Diagnostics.Stopwatch timer = null; if (ODBuild.IsDebug()) { timer = new System.Diagnostics.Stopwatch(); timer.Start(); } if (staticTextDependencies.HasFlag(StaticTextFieldDependency.Pat)) { //patient should already be loaded. } if (fam == null && staticTextDependencies.HasFlag(StaticTextFieldDependency.Fam)) { fam = Patients.GetFamily(pat.PatNum); } if (PatNote == null) { if (staticTextDependencies.HasFlag(StaticTextFieldDependency.PatNote)) { PatNote = PatientNotes.Refresh(pat.PatNum, pat.Guarantor); } else { PatNote = new PatientNote(); } } bool IsQueryNeeded <T>(ref List <T> list, StaticTextFieldDependency dependency) { if (list == null || (isMiddleTier && list.Count == 0)) //Middle Tier deserializes null lists to empty lists. { if (staticTextDependencies.HasFlag(dependency)) { return(true); } else { list = new List <T>(); } } return(false); } if (IsQueryNeeded(ref ListRefAttaches, StaticTextFieldDependency.ListRefAttaches)) { ListRefAttaches = RefAttaches.Refresh(pat.PatNum); } if (IsQueryNeeded(ref ListInsSubs, StaticTextFieldDependency.ListInsSubs)) { ListInsSubs = InsSubs.RefreshForFam(fam); } if (IsQueryNeeded(ref ListInsPlans, StaticTextFieldDependency.ListInsPlans)) { ListInsPlans = InsPlans.RefreshForSubList(ListInsSubs); } if (IsQueryNeeded(ref ListPatPlans, StaticTextFieldDependency.ListPatPlans)) { ListPatPlans = PatPlans.Refresh(pat.PatNum); } if (IsQueryNeeded(ref ListBenefits, StaticTextFieldDependency.ListBenefits)) { ListBenefits = Benefits.Refresh(ListPatPlans, ListInsSubs); } if (IsQueryNeeded(ref HistList, StaticTextFieldDependency.HistList)) { HistList = ClaimProcs.GetHistList(pat.PatNum, ListBenefits, ListPatPlans, ListInsPlans, DateTime.Today, ListInsSubs); } if (IsQueryNeeded(ref ListTreatPlans, StaticTextFieldDependency.ListTreatPlans)) { ListTreatPlans = TreatPlans.Refresh(pat.PatNum); } if (IsQueryNeeded(ref ListRecallsForFam, StaticTextFieldDependency.ListRecallsForFam)) { ListRecallsForFam = Recalls.GetList(fam.ListPats.Select(x => x.PatNum).ToList()); } if (IsQueryNeeded(ref ListAppts, StaticTextFieldDependency.ListAppts)) { ListAppts = Appointments.GetListForPat(pat.PatNum); } if (IsQueryNeeded(ref ListFutureApptsForFam, StaticTextFieldDependency.ListFutureApptsForFam)) { ListFutureApptsForFam = Appointments.GetFutureSchedApts(fam.ListPats.Select(x => x.PatNum).ToList()); } if (IsQueryNeeded(ref ListDiseases, StaticTextFieldDependency.ListDiseases)) { ListDiseases = Diseases.Refresh(pat.PatNum, true); } if (IsQueryNeeded(ref ListAllergies, StaticTextFieldDependency.ListAllergies)) { ListAllergies = Allergies.GetAll(pat.PatNum, false); } if (IsQueryNeeded(ref ListMedicationPats, StaticTextFieldDependency.ListMedicationPats)) { ListMedicationPats = MedicationPats.Refresh(pat.PatNum, false); } if (IsQueryNeeded(ref ListFamPopups, StaticTextFieldDependency.ListFamPopups)) { ListFamPopups = Popups.GetForFamily(pat); } if (IsQueryNeeded(ref ListProceduresSome, StaticTextFieldDependency.ListProceduresSome)) { ListProceduresSome = Procedures.RefreshForProcCodeNums(pat.PatNum, listProcCodeNums); } if (IsQueryNeeded(ref ListProceduresPat, StaticTextFieldDependency.ListProceduresPat)) { ListProceduresPat = Procedures.Refresh(pat.PatNum); } if (IsQueryNeeded(ref ListPlannedAppts, StaticTextFieldDependency.ListPlannedAppts)) { ListPlannedAppts = new List <PlannedAppt>(); PlannedAppt plannedAppt = PlannedAppts.GetOneOrderedByItemOrder(pat.PatNum); if (plannedAppt != null) { ListPlannedAppts.Add(plannedAppt); } } if (ODBuild.IsDebug()) { timer.Stop(); Console.WriteLine("Static text field query time (ms): " + timer.ElapsedMilliseconds); } }