Exemplo n.º 1
0
		///<summary></summary>
		public static void Update(Encounter encounter) {
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				Meth.GetVoid(MethodBase.GetCurrentMethod(),encounter);
				return;
			}
			Crud.EncounterCrud.Update(encounter);
		}
Exemplo n.º 2
0
		///<summary></summary>
		public static long Insert(Encounter encounter) {
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				encounter.EncounterNum=Meth.GetLong(MethodBase.GetCurrentMethod(),encounter);
				return encounter.EncounterNum;
			}
			return Crud.EncounterCrud.Insert(encounter);
		}
Exemplo n.º 3
0
		///<summary>Automatically generate and insert encounter as long as there is no other encounter with that date and provider for that patient.  Does not insert an encounter if one of the CQM default encounter prefs are invalid.</summary>
		public static void InsertDefaultEncounter(long patNum, long provNum, DateTime date) {
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				Meth.GetVoid(MethodBase.GetCurrentMethod(),patNum,provNum,date);
				return;
			}
			//Validate prefs. If they are not set, we have nothing to insert so no reason to check.
			if(PrefC.GetString(PrefName.CQMDefaultEncounterCodeSystem)=="" || PrefC.GetString(PrefName.CQMDefaultEncounterCodeValue)=="none"){
				return;
			}
			//If no encounter for date for this patient
			string command="SELECT COUNT(*) NumEncounters FROM encounter WHERE encounter.PatNum="+POut.Long(patNum)+" "
				+"AND encounter.DateEncounter="+POut.Date(date)+" "
				+"AND encounter.ProvNum="+POut.Long(provNum);
			int count=PIn.Int(Db.GetCount(command));
			if(count > 0) { //Encounter already exists for date
				return;
			}
			//Insert encounter with default encounter code system and code value set in Setup>EHR>Settings
			Encounter encounter = new Encounter();
			encounter.PatNum=patNum;
			encounter.ProvNum=provNum;
			encounter.DateEncounter=date;
			encounter.CodeSystem=PrefC.GetString(PrefName.CQMDefaultEncounterCodeSystem);
			encounter.CodeValue=PrefC.GetString(PrefName.CQMDefaultEncounterCodeValue);
			Insert(encounter);
		}
Exemplo n.º 4
0
		private void butAdd_Click(object sender,EventArgs e) {
			Encounter EncCur=new Encounter();
			EncCur.PatNum=PatCur.PatNum;
			EncCur.ProvNum=PatCur.PriProv;
			EncCur.DateEncounter=DateTime.Today;
			EncCur.IsNew=true;
			FormEncounterEdit FormEE=new FormEncounterEdit(EncCur);
			FormEE.ShowDialog();
			FillGrid();
		}
Exemplo n.º 5
0
Arquivo: EhrCCD.cs Projeto: mnisl/OD
		///<summary>Helper for GenerateCCD().</summary>
		private void GenerateCcdSectionEncounters(bool hasEncounter) {
			_w.WriteComment(@"
=====================================================================================================
Encounters
=====================================================================================================");
			List<Encounter> listEncountersFiltered;
			if(!hasEncounter) {
				listEncountersFiltered=new List<Encounter>();
			}
			else {
				listEncountersFiltered=_listEncountersFiltered;
			}
			Start("component");
			Start("section");
			TemplateId("2.16.840.1.113883.10.20.22.2.22.1");//Encounters section with coded entries required.
			_w.WriteComment("Encounters section template");//(Page 227)
			StartAndEnd("code","code","46240-8","codeSystem",strCodeSystemLoinc,"codeSystemName",strCodeSystemNameLoinc,"displayName","History of encounters");
			_w.WriteElementString("title","Encounters");
			Start("text");//The following text will be parsed as html with a style sheet to be human readable.
			if(listEncountersFiltered.Count>0 && hasEncounter) {
				Start("table","width","100%","border","1");
				Start("thead");
				Start("tr");
				_w.WriteElementString("th","Performer");
				_w.WriteElementString("th","Observation");
				_w.WriteElementString("th","Date");
				_w.WriteElementString("th","Notes");
				End("tr");
				End("thead");
				Start("tbody");
				for(int i=0;i<listEncountersFiltered.Count;i++) {
					Start("tr");
					if(listEncountersFiltered[i].ProvNum==0) {
						_w.WriteElementString("td","");
					}
					else {
						_w.WriteElementString("td",Providers.GetProv(listEncountersFiltered[i].ProvNum).GetFormalName());
					}
					Snomed snomedDiagnosis=Snomeds.GetByCode(listEncountersFiltered[i].CodeValue);
					if(snomedDiagnosis==null) {//Could be null if the code was imported from another EHR.
						_w.WriteElementString("td","");
					}
					else {
						_w.WriteElementString("td",snomedDiagnosis.SnomedCode+" - "+snomedDiagnosis.Description);
					}
					if(listEncountersFiltered[i].DateEncounter.Year<1880) {
						_w.WriteElementString("td","");
					}
					else {
						DateText("td",listEncountersFiltered[i].DateEncounter);
					}
					_w.WriteElementString("td",listEncountersFiltered[i].Note);
					End("tr");
				}
				End("tbody");
				End("table");
			}
			else {
				_w.WriteString("None");
			}
			End("text");
			if(listEncountersFiltered.Count==0) {//If there are no entries in the filtered list, then we want to add a dummy entry since at least one is required.
				Encounter enc=new Encounter();
				listEncountersFiltered.Add(enc);
			}
			for(int i=0;i<listEncountersFiltered.Count;i++) {
				Start("entry","typeCode","DRIV");
				Start("encounter","classCode","ENC","moodCode","EVN");
				TemplateId("2.16.840.1.113883.10.20.22.4.49");
				_w.WriteComment("Encounter Activity Template");//(Page 358)
				Guid();
				StartAndEnd("code","code","99212","displayName","Outpatient Visit","codeSystemName","CPT-4");//CPT-4 is required. Valid codes are 99201 through 99607.
				if(listEncountersFiltered[i].DateEncounter.Year<1880) {
					StartAndEnd("effectiveTime","nullFlavor","UNK");
				}
				else {
					StartAndEnd("effectiveTime","value",listEncountersFiltered[i].DateEncounter.ToString("yyyyMMdd"));
				}
				Provider prov=Providers.GetProv(listEncountersFiltered[i].ProvNum);
				if(prov!=null && !prov.IsNotPerson) {
					Start("performer");
					Start("assignedEntity");
					Guid();
					_w.WriteComment("Performer Information");
					if(listEncountersFiltered[i].ProvNum==0) {
						StartAndEnd("code","nullFlavor","UNK");
					}
					else {
						prov=Providers.GetProv(listEncountersFiltered[i].ProvNum);
						StartAndEnd("code","code",GetTaxonomy(prov),"codeSystem",strCodeSystemNucc,"codeSystemName",strCodeSystemNameNucc);
					}
					//The assignedPerson element might not be allowed here. If that is the case, then performer is useless, because it would only contain the specialty code. Our HTML output shows the prov name.
					Start("assignedPerson");
					if(listEncountersFiltered[i].ProvNum==0) {
						StartAndEnd("name","nullFlavor","UNK");
					}
					else {
						Start("name");
						if(prov.IsNotPerson) {
							_w.WriteElementString("given","");//Not needed for CCD
						}
						else {
							_w.WriteElementString("given",prov.FName.Trim());
						}
						_w.WriteElementString("family",prov.LName.Trim());
						End("name");
					}
					End("assignedPerson");
					End("assignedEntity");
					End("performer");
				}
				//Possibly add an Instructions Template
				bool isInversion=false;//Specifies that the problem was or was not observed. All problems are "observed" for now.
				Start("entryRelationship","typeCode","SUBJ","inversionInd",isInversion?"true":"false");
				Start("act","classCode","ACT","moodCode","EVN");
				_w.WriteComment("Encounter Diagnosis Template");
				TemplateId("2.16.840.1.113883.10.20.22.4.80");//(Page 362)
				Guid();
				Start("code");
				_w.WriteAttributeString("xsi","type",null,"CE");
				Attribs("code","29308-4","codeSystem",strCodeSystemLoinc,"codeSystemName",strCodeSystemNameLoinc,"displayName","Encounter Diagnosis");
				End("code");
				StartAndEnd("statusCode","code","completed");
				Start("effectiveTime");
				if(listEncountersFiltered[i].DateEncounter.Year<1880) {
					StartAndEnd("low","nullFlavor","UNK");
				}
				else {
					DateElement("low",listEncountersFiltered[i].DateEncounter);
				}
				End("effectiveTime");
				Start("entryRelationship","typeCode","SUBJ","inversionInd",isInversion?"true":"false");
				Start("observation","classCode","OBS","moodCode","EVN","negationInd",isInversion?"true":"false");
				_w.WriteComment("Problem Observation Template");
				TemplateId("2.16.840.1.113883.10.20.22.4.4");//(Page 466)
				Guid();
				StartAndEnd("code","code","409586006","codeSystem",strCodeSystemSnomed,"displayName","Complaint");
				StartAndEnd("statusCode","code","completed");
				Start("effectiveTime");
				if(listEncountersFiltered[i].DateEncounter.Year<1880) {
					StartAndEnd("low","nullFlavor","UNK");
				}
				else {
					DateElement("low",listEncountersFiltered[i].DateEncounter);
				}
				//"If the problem is known to be resolved, but the date of resolution is not known, 
				//then the high element SHALL be present, and the nullFlavor attribute SHALL be set to 'UNK'.
				//Therefore, the existence of an high element within a problem does indicate that the problem has been resolved."
				End("effectiveTime");
				Snomed snomedDiagnosis=Snomeds.GetByCode(listEncountersFiltered[i].CodeValue);
				if(snomedDiagnosis==null) {
					Start("value");
					_w.WriteAttributeString("xsi","type",null,"CD");
					Attribs("nullFlavor","UNK");
					End("value");
				}
				else {
					Start("value");
					_w.WriteAttributeString("xsi","type",null,"CD");
					//The format only allows SNOMED and ICD10 code systems. If we support ICD10 in the future, then the value must be specified in a special manner. SNOMED appears to be preferred. See the guide for details.
					//Snomed snomedDiagnosis=Snomeds.GetByCode(listEncountersFiltered[i].CodeValue);
					Attribs("code",snomedDiagnosis.SnomedCode,"codeSystem",strCodeSystemSnomed,"codeSystemName",strCodeSystemNameSnomed,"displayName",snomedDiagnosis.Description);
					End("value");
				}
				End("observation");
				End("entryRelationship");
				End("act");
				End("entryRelationship");
				End("encounter");
				End("entry");
			}
			End("section");
			End("component");
		}
Exemplo n.º 6
0
		public FormEncounterEdit(Encounter encCur) {
			InitializeComponent();
			_encCur=encCur;
		}