Record Class PatientContext

java.lang.Object
java.lang.Record
com.framed.interop.hl7.hl7v2.PatientContext
Record Components:
mrn - medical record number (PID-3)
lastName - family name (PID-5)
firstName - given name (PID-5)
dob - date of birth, HL7 yyyyMMdd (PID-7); may be empty
sex - administrative sex (PID-8); may be empty
location - patient location / point of care (PV1-3); may be empty

public record PatientContext(String mrn, String lastName, String firstName, String dob, String sex, String location) extends Record
Static patient/encounter context used to populate the PID/PV1 segments of outbound messages. In this first iteration it is supplied from configuration; later it can be refreshed from inbound ADT.
  • Constructor Details

    • PatientContext

      public PatientContext(String mrn, String lastName, String firstName, String dob, String sex, String location)
      Creates an instance of a PatientContext record class.
      Parameters:
      mrn - the value for the mrn record component
      lastName - the value for the lastName record component
      firstName - the value for the firstName record component
      dob - the value for the dob record component
      sex - the value for the sex record component
      location - the value for the location record component
  • Method Details

    • fromJson

      public static PatientContext fromJson(org.json.JSONObject json)
      Builds a context from a config JSON object, defaulting missing fields to empty/UNKNOWN.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • mrn

      public String mrn()
      Returns the value of the mrn record component.
      Returns:
      the value of the mrn record component
    • lastName

      public String lastName()
      Returns the value of the lastName record component.
      Returns:
      the value of the lastName record component
    • firstName

      public String firstName()
      Returns the value of the firstName record component.
      Returns:
      the value of the firstName record component
    • dob

      public String dob()
      Returns the value of the dob record component.
      Returns:
      the value of the dob record component
    • sex

      public String sex()
      Returns the value of the sex record component.
      Returns:
      the value of the sex record component
    • location

      public String location()
      Returns the value of the location record component.
      Returns:
      the value of the location record component