///<summary></summary> public static void Update(AutoCode Cur){ if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(),Cur); return; } Crud.AutoCodeCrud.Update(Cur); }
///<summary>Surround with try/catch. Currently only called from FormAutoCode and FormAutoCodeEdit.</summary> public static void Delete(AutoCode autoCodeCur){ if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(),autoCodeCur); return; } //look for dependencies in ProcButton table. string strInUse=""; for(int i=0;i<ProcButtons.List.Length;i++) { for(int j=0;j<ProcButtonItems.List.Length;j++) { if(ProcButtonItems.List[j].ProcButtonNum==ProcButtons.List[i].ProcButtonNum && ProcButtonItems.List[j].AutoCodeNum==autoCodeCur.AutoCodeNum) { if(strInUse!="") { strInUse+="; "; } //Add the procedure button description to the list for display. strInUse+=ProcButtons.List[i].Description; break;//Button already added to the description, check the other buttons in the list. } } } if(strInUse!="") { throw new ApplicationException(Lans.g("AutoCodes","Not allowed to delete autocode because it is in use. Procedure buttons using this autocode include ")+strInUse); } List<AutoCodeItem> listAutoCodeItems=AutoCodeItems.GetListForCode(autoCodeCur.AutoCodeNum); for(int i=0;i<listAutoCodeItems.Count;i++) { AutoCodeItem AutoCodeItemCur=listAutoCodeItems[i]; AutoCodeConds.DeleteForItemNum(AutoCodeItemCur.AutoCodeItemNum); AutoCodeItems.Delete(AutoCodeItemCur); } Crud.AutoCodeCrud.Delete(autoCodeCur.AutoCodeNum); }
///<summary></summary> public static long Insert(AutoCode Cur) { if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { Cur.AutoCodeNum=Meth.GetLong(MethodBase.GetCurrentMethod(),Cur); return Cur.AutoCodeNum; } return Crud.AutoCodeCrud.Insert(Cur); }
///<summary>This could be improved since it does not delete any autocode items.</summary> public static void Delete(AutoCode Cur) { if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(),Cur); return; } string command= "DELETE from autocode WHERE autocodenum = '"+POut.Long(Cur.AutoCodeNum)+"'"; Db.NonQ(command); }
///<summary></summary> public static void Update(AutoCode Cur) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(), Cur); return; } Crud.AutoCodeCrud.Update(Cur); }
///<summary></summary> public static long Insert(AutoCode Cur) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { Cur.AutoCodeNum = Meth.GetLong(MethodBase.GetCurrentMethod(), Cur); return(Cur.AutoCodeNum); } return(Crud.AutoCodeCrud.Insert(Cur)); }
///<summary>This could be improved since it does not delete any autocode items.</summary> public static void Delete(AutoCode Cur) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(), Cur); return; } string command = "DELETE from autocode WHERE autocodenum = '" + POut.Long(Cur.AutoCodeNum) + "'"; Db.NonQ(command); }
///<summary>Checks inputs and determines if user should be prompted to pick a more applicable procedure code.</summary> ///<param name="verifyCode">This is the recommended code based on input. If it matches procCode return value will be false.</param> public static bool ShouldPromptForCodeChange(Procedure proc, ProcedureCode procCode, Patient pat, bool isMandibular, List <ClaimProc> claimProcsForProc, out long verifyCode) { //No remoting role check; no call to db and method utilizes an out parameter. verifyCode = proc.CodeNum; //these areas have no autocodes if (procCode.TreatArea == TreatmentArea.Mouth || procCode.TreatArea == TreatmentArea.Quad || procCode.TreatArea == TreatmentArea.Sextant || Procedures.IsAttachedToClaim(proc, claimProcsForProc)) { return(false); } //this represents the suggested code based on the autocodes set up. AutoCode AutoCodeCur = null; if (procCode.TreatArea == TreatmentArea.Arch) { if (string.IsNullOrEmpty(proc.Surf)) { return(false); } if (proc.Surf == "U") { verifyCode = AutoCodeItems.VerifyCode(procCode.CodeNum, "1", "", false, pat.PatNum, pat.Age, out AutoCodeCur); //max } else { verifyCode = AutoCodeItems.VerifyCode(procCode.CodeNum, "32", "", false, pat.PatNum, pat.Age, out AutoCodeCur); //mand } } else if (procCode.TreatArea == TreatmentArea.ToothRange) { //test for max or mand. verifyCode = AutoCodeItems.VerifyCode(procCode.CodeNum, (isMandibular) ? "32" : "1", "", false, pat.PatNum, pat.Age, out AutoCodeCur); } else //surf or tooth { string claimSurf = Tooth.SurfTidyForClaims(proc.Surf, proc.ToothNum); verifyCode = AutoCodeItems.VerifyCode(procCode.CodeNum, proc.ToothNum, claimSurf, false, pat.PatNum, pat.Age, out AutoCodeCur); } return(procCode.CodeNum != verifyCode); }
///<summary>Only called when closing the procedure edit window. Usually returns the supplied CodeNum, unless a better match is found.</summary> public static long VerifyCode(long codeNum, string toothNum, string surf, bool isAdditional, long patNum, int age, out AutoCode AutoCodeCur) { //No need to check RemotingRole; no call to db. bool allCondsMet; AutoCodeCur = null; if (!GetContainsKey(codeNum)) { return(codeNum); } if (!AutoCodes.GetContainsKey(GetOne(codeNum).AutoCodeNum)) { return(codeNum); //just in case. } AutoCodeCur = AutoCodes.GetOne(GetOne(codeNum).AutoCodeNum); if (AutoCodeCur.LessIntrusive) { return(codeNum); } bool willBeMissing = Procedures.WillBeMissing(toothNum, patNum); List <AutoCodeItem> listForCode = AutoCodeItems.GetListForCode(GetOne(codeNum).AutoCodeNum); List <AutoCodeCond> condList; for (int i = 0; i < listForCode.Count; i++) { condList = AutoCodeConds.GetListForItem(listForCode[i].AutoCodeItemNum); allCondsMet = true; for (int j = 0; j < condList.Count; j++) { if (!AutoCodeConds.ConditionIsMet(condList[j].Cond, toothNum, surf, isAdditional, willBeMissing, age)) { allCondsMet = false; } } if (allCondsMet) { return(listForCode[i].CodeNum); } } return(codeNum); //if couldn't find a better match }
public static string AutoCodeItemsWithNoAutoCode(bool verbose,bool isCheck) { if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { return Meth.GetString(MethodBase.GetCurrentMethod(),verbose,isCheck); } string log=""; if(isCheck) { command=@"SELECT DISTINCT AutoCodeNum FROM autocodeitem WHERE NOT EXISTS( SELECT * FROM autocode WHERE autocodeitem.AutoCodeNum=autocode.AutoCodeNum)"; table=Db.GetTable(command); int numFound=table.Rows.Count; if(numFound!=0 || verbose) { log+=Lans.g("FormDatabaseMaintenance","Auto codes missing due to invalid auto code items")+": "+numFound.ToString()+"\r\n"; } } else { command=@"SELECT DISTINCT AutoCodeNum FROM autocodeitem WHERE NOT EXISTS( SELECT * FROM autocode WHERE autocodeitem.AutoCodeNum=autocode.AutoCodeNum)"; table=Db.GetTable(command); int numFixed=table.Rows.Count; for(int i=0;i<table.Rows.Count;i++) { AutoCode autoCode=new AutoCode(); autoCode.AutoCodeNum=PIn.Long(table.Rows[i]["AutoCodeNum"].ToString()); autoCode.Description="UNKNOWN"; Crud.AutoCodeCrud.Insert(autoCode,true); } if(numFixed>0) { Signalods.SetInvalid(InvalidType.AutoCodes); } if(numFixed!=0 || verbose) { log+=Lans.g("FormDatabaseMaintenance","Auto codes created due to invalid auto code items")+": "+numFixed.ToString()+"\r\n"; } } return log; }
///<summary>Only called when closing the procedure edit window. Usually returns the supplied CodeNum, unless a better match is found.</summary> public static long VerifyCode(long codeNum,string toothNum,string surf,bool isAdditional,long patNum,int age, out AutoCode AutoCodeCur) { //No need to check RemotingRole; no call to db. bool allCondsMet; AutoCodeCur=null; if(!AutoCodeItemC.HList.ContainsKey(codeNum)) { return codeNum; } if(!AutoCodeC.HList.ContainsKey((long)AutoCodeItemC.HList[codeNum])) { return codeNum;//just in case. } AutoCodeCur=(AutoCode)AutoCodeC.HList[(long)AutoCodeItemC.HList[codeNum]]; if(AutoCodeCur.LessIntrusive) { return codeNum; } bool willBeMissing=Procedures.WillBeMissing(toothNum,patNum); List<AutoCodeItem> listForCode=AutoCodeItems.GetListForCode((long)AutoCodeItemC.HList[codeNum]); List<AutoCodeCond> condList; for(int i=0;i<listForCode.Count;i++) { condList=AutoCodeConds.GetListForItem(listForCode[i].AutoCodeItemNum); allCondsMet=true; for(int j=0;j<condList.Count;j++) { if(!AutoCodeConds.ConditionIsMet(condList[j].Cond,toothNum,surf,isAdditional,willBeMissing,age)) { allCondsMet=false; } } if(allCondsMet) { return listForCode[i].CodeNum; } } return codeNum;//if couldn't find a better match }