public ClientAppointment(Hl7.Fhir.Model.Appointment app) { Appointment = app; //Statuses = new List<string>() //{ "Proposed", "Pending", "Booked", "Arrived", "Fulfilled", "CheckedIn", "Waitlist", "Noshow", "EnteredInError" }; }
/// <summary> /// This will retrieve the FHIR resource, set the AppointmentType for teleconsultation, /// include a link for the video link in the comment and update the resource /// </summary> /// <param name="appointment"></param> /// <param name="videoLinkComment"></param> public void SaveAppointmentAsVideoMeeting(PmsAppointment appt, string videoLinkComment, string VideoUrl) { // Get the Appointment based on the appointment having an ID var fhirServer = GetFhirClient(); Hl7.Fhir.Model.Appointment fhirAppt = fhirServer.Read <Appointment>($"{fhirServer.Endpoint}Appointment/{appt.AppointmentFhirID}"); if (fhirAppt == null) { throw new Exception("Unable to read appointment " + appt.AppointmentFhirID); } CodeableConcept teleHealth = new CodeableConcept("http://hl7.org/au/fhir/CodeSystem/AppointmentType", "teleconsultation"); if (fhirAppt.AppointmentType == null || (fhirAppt.AppointmentType.Coding.FirstOrDefault()?.System != teleHealth.Coding[0].System || fhirAppt.AppointmentType.Coding.FirstOrDefault()?.Code != teleHealth.Coding[0].Code)) { fhirAppt.AppointmentType = teleHealth; } fhirAppt.RemoveExtension("http://hl7.org.au/fhir/StructureDefinition/telehealth-videolink"); if (VideoUrl != null) { fhirAppt.Extension.Add(new Extension() { Url = "http://hl7.org.au/fhir/StructureDefinition/telehealth-videolink", Value = new FhirUrl(VideoUrl) }); } fhirServer.Update(fhirAppt); }
public static void SerializeAppointment(Hl7.Fhir.Model.Appointment value, IFhirWriter writer, bool summary) { writer.WriteStartRootObject("Appointment"); writer.WriteStartComplexContent(); // Serialize element _id if (value.LocalIdElement != null) { writer.WritePrimitiveContents("_id", value.LocalIdElement, XmlSerializationHint.Attribute); } // Serialize element extension if (value.Extension != null && !summary && value.Extension.Count > 0) { writer.WriteStartArrayElement("extension"); foreach (var item in value.Extension) { writer.WriteStartArrayMember("extension"); ExtensionSerializer.SerializeExtension(item, writer, summary); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element language if (value.LanguageElement != null && !summary) { writer.WriteStartElement("language"); CodeSerializer.SerializeCode(value.LanguageElement, writer, summary); writer.WriteEndElement(); } // Serialize element text if (value.Text != null && !summary) { writer.WriteStartElement("text"); NarrativeSerializer.SerializeNarrative(value.Text, writer, summary); writer.WriteEndElement(); } // Serialize element contained if (value.Contained != null && !summary && value.Contained.Count > 0) { writer.WriteStartArrayElement("contained"); foreach (var item in value.Contained) { writer.WriteStartArrayMember("contained"); FhirSerializer.SerializeResource(item, writer, summary); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } writer.WriteEndComplexContent(); writer.WriteEndRootObject(); }
/// <summary> /// This will retrieve the FHIR appointment from the server, /// set the status value and then update back to the server /// </summary> /// <param name="appointment"></param> public void SaveAppointmentStatusValue(PmsAppointment appt) { // Get the Appointment based on the appointment having an ID // and update the status value var fhirServer = GetFhirClient(); Hl7.Fhir.Model.Appointment fhirAppt = fhirServer.Read <Appointment>($"{fhirServer.Endpoint}Appointment/{appt.AppointmentFhirID}"); if (fhirAppt.Status != appt.ArrivalStatus) { // Don't save it if hasn't changed fhirAppt.Status = appt.ArrivalStatus; fhirServer.Update(fhirAppt); } }
/// <summary> /// Parse Appointment /// </summary> public static Hl7.Fhir.Model.Appointment ParseAppointment(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Appointment existingInstance = null) { Hl7.Fhir.Model.Appointment result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Appointment(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if (atName == "extension") { result.Extension = new List <Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "extension")) { result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); } reader.LeaveArray(); } // Parse element language else if (atName == "language") { result.LanguageElement = CodeParser.ParseCode(reader, errors); } // Parse element text else if (atName == "text") { result.Text = NarrativeParser.ParseNarrative(reader, errors); } // Parse element contained else if (atName == "contained") { result.Contained = new List <Hl7.Fhir.Model.Resource>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "contained")) { result.Contained.Add(ParserUtils.ParseContainedResource(reader, errors)); } reader.LeaveArray(); } // Parse element _id else if (atName == "_id") { result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return(result); }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as AppointmentResponse; if (dest == null) { throw new ArgumentException("Can only copy to an object of the same type", "other"); } base.CopyTo(dest); if(Identifier != null) dest.Identifier = new List<Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy()); if(Appointment != null) dest.Appointment = (Hl7.Fhir.Model.ResourceReference)Appointment.DeepCopy(); if(StartElement != null) dest.StartElement = (Hl7.Fhir.Model.Instant)StartElement.DeepCopy(); if(EndElement != null) dest.EndElement = (Hl7.Fhir.Model.Instant)EndElement.DeepCopy(); if(ParticipantType != null) dest.ParticipantType = new List<Hl7.Fhir.Model.CodeableConcept>(ParticipantType.DeepCopy()); if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopy(); if(ParticipantStatusElement != null) dest.ParticipantStatusElement = (Code<Hl7.Fhir.Model.ParticipationStatus>)ParticipantStatusElement.DeepCopy(); if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopy(); return dest; }