private string ConvertEthnicGroup(PatientRace race) { switch(race) { case PatientRace.HispanicLatino: return "H^Hispanic or Latino^HL70189"; default: return "N^Not Hispanic or Latino^HL70189"; } }
///<summary>Inserts or Deletes neccesary PatientRace entries for the specified patient given the list of PatRaces provided.</summary> public static void Reconcile(long patNum, List <PatRace> listPatRaces) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(), patNum, listPatRaces); return; } string command; if (listPatRaces.Count == 0) //DELETE all for the patient if listPatRaces is empty. { command = "DELETE FROM patientrace WHERE PatNum = " + POut.Long(patNum); //Can't use CRUD layer here because there might be multiple races for one patient. Db.NonQ(command); return; } List <PatientRace> listPatientRaces; //Rename this variable and the listPatRaces variable so it is easier to indicate which is the "selected" list and which is the db list. command = "SELECT * FROM patientrace WHERE PatNum = " + POut.Long(patNum); listPatientRaces = Crud.PatientRaceCrud.SelectMany(command); //delete excess rows for (int i = 0; i < listPatientRaces.Count; i++) { if (!listPatRaces.Contains((PatRace)listPatientRaces[i].Race)) //if there is a PatientRace row that does not match the new list of PatRaces, delete it { Crud.PatientRaceCrud.Delete(listPatientRaces[i].PatientRaceNum); } } //insert new rows for (int i = 0; i < listPatRaces.Count; i++) { bool insertNeeded = true; for (int j = 0; j < listPatientRaces.Count; j++) { if (listPatRaces[i] == listPatientRaces[j].Race) { insertNeeded = false; } } if (insertNeeded) { PatientRace pr = new PatientRace(); pr.PatNum = patNum; pr.Race = listPatRaces[i]; pr.CdcrecCode = Cdcrecs.GetByPatRace(listPatRaces[i]); Crud.PatientRaceCrud.Insert(pr); } //next PatRace } //return; }
//======================================================================================================================================= //DO NOT ALTER any of these Convert... methods for use with any other HL7 bridge. //Each bridge tends to have slightly different implementation. //No bridge can share any of these. //Instead, copy them into other classes. //This set of methods is ONLY for ECW, and will have to be renamed and grouped if any other DFT bridge is built. //======================================================================================================================================= private string ConvertRace(PatientRace race) { switch(race) { case PatientRace.AmericanIndian: return "American Indian Or Alaska Native"; case PatientRace.Asian: return "Asian"; case PatientRace.HawaiiOrPacIsland: return "Native Hawaiian or Other Pacific"; case PatientRace.AfricanAmerican: return "Black or African American"; case PatientRace.White: return "White"; case PatientRace.HispanicLatino: return "Hispanic"; case PatientRace.Other: return "Other Race"; default: return "Other Race"; } }
///<summary>Inserts or Deletes neccesary PatientRace entries for the specified patient given the list of PatRaces provided.</summary> public static void Reconcile(long patNum,List<PatRace> listPatRaces) { if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(),patNum,listPatRaces); return; } string command; if(listPatRaces.Count==0) { //DELETE all for the patient if listPatRaces is empty. command="DELETE FROM patientrace WHERE PatNum = "+POut.Long(patNum);//Can't use CRUD layer here because there might be multiple races for one patient. Db.NonQ(command); return; } List<PatientRace> listPatientRaces;//Rename this variable and the listPatRaces variable so it is easier to indicate which is the "selected" list and which is the db list. command = "SELECT * FROM patientrace WHERE PatNum = "+POut.Long(patNum); listPatientRaces = Crud.PatientRaceCrud.SelectMany(command); //delete excess rows for(int i=0;i<listPatientRaces.Count;i++) { if(!listPatRaces.Contains((PatRace)listPatientRaces[i].Race)) {//if there is a PatientRace row that does not match the new list of PatRaces, delete it Crud.PatientRaceCrud.Delete(listPatientRaces[i].PatientRaceNum); } } //insert new rows for(int i=0;i<listPatRaces.Count;i++) { bool insertNeeded=true; for(int j=0;j<listPatientRaces.Count;j++) { if(listPatRaces[i]==listPatientRaces[j].Race) { insertNeeded=false; } } if(insertNeeded) { PatientRace pr=new PatientRace(); pr.PatNum=patNum; pr.Race=listPatRaces[i]; pr.CdcrecCode=Cdcrecs.GetByPatRace(listPatRaces[i]); Crud.PatientRaceCrud.Insert(pr); } //next PatRace } //return; }
private string ConvertRace(PatientRace race) { switch(race) { case PatientRace.AmericanIndian: return "1002-5^American Indian Or Alaska Native^HL70005"; case PatientRace.Asian: return "2028-9^Asian^HL70005"; case PatientRace.AfricanAmerican: return "2054-5^Black or African American^HL70005"; case PatientRace.HawaiiOrPacIsland: return "2076-8^Native Hawaiian or Other Pacific Islander^HL70005"; case PatientRace.White: return "2106-3^White^HL70005"; case PatientRace.Other: return "2131-1^Other Race^HL70005"; default://including hispanic return "2131-1^Other Race^HL70005"; } }