cdac.medinfo.sdk.hl7282.baselibs.segments

## Class MRG

- java.lang.Object
- - cdac.medinfo.sdk.hl7282.baselibs.segments.Segment
  - - cdac.medinfo.sdk.hl7282.baselibs.segments.MRG

- All Implemented Interfaces:
    ISegment

      public class MRG
      extends Segment

  MRG - Merge Patient Information Segment.

  MRG segment provides receiving applications with information necessary to initiate the merging of patient data as well as groups of records. It is intended that this segment be used throughout the Standard to allow the merging of registration, accounting, and clinical records within specific applications.

  Represents an HL7 MRG message segment. This segment has the following fields:

  MRG-1: Prior Patient Identifier List (CX)Required
  MRG-2: Prior Alternate Patient ID (CX)Withdrawn
  MRG-3: Prior Patient Account Number (CX)Optional
  MRG-4: Prior Patient ID (CX)Withdrawn
  MRG-5: Prior Visit Number (CX)Optional
  MRG-6: Prior Alternate Visit ID (CX)Optional
  MRG-7: Prior Patient Name (XPN)Optional

  This class provides mechanism to validate message against HL7 v 2.8.2 standard. The class provides accessors & mutators for the elements mentioned above. The class has validate method which validates Message against HL7 v 2.8.2 standard.

  User can also create Segment through `SegmentFactory`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MRG()` Constructs the MRG segment.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addPriorAlternateVisitID(CX objpriorAlternateVisitID)` Sets the Prior Alternate Visit ID.
    `void` | `addPriorAlternateVisitID(java.lang.String strIDNumber, java.lang.String strCheckDigit, java.lang.String strCheckDigitScheme, HD objAssigningAuthority, java.lang.String strIdentifierTypeCode, HD objAssigningFacility, java.lang.String strEffectiveDate, java.lang.String strExpirationDate, CWE objAssigningJurisdiction, CWE objAssigningAgencyOrDepartment, java.lang.String strSecurityCheck, java.lang.String strSecurityCheckScheme)` Set the Prior AlternateVisit ID.
    `void` | `addPriorPatientIdentifierList(CX objpriorPatientIdentifier)` Set the Prior Patient Identifier.
    `void` | `addPriorPatientIdentifierList(java.lang.String strIDNumber, java.lang.String strCheckDigit, java.lang.String strCheckDigitScheme, HD objAssigningAuthority, java.lang.String strIdentifierTypeCode, HD objAssigningFacility, java.lang.String strEffectiveDate, java.lang.String strExpirationDate, CWE objAssigningJurisdiction, CWE objAssigningAgencyOrDepartment, java.lang.String strSecurityCheck, java.lang.String strSecurityCheckScheme)` Set the Prior Patient Identifier List.
    `void` | `addPriorPatientName(FN objFamilyName, java.lang.String strGivenName, java.lang.String strSecondAndFurtherGivenNamesOrInitialsThereof, java.lang.String strSuffix, java.lang.String strPrefix, java.lang.String strNameTypeCode, java.lang.String strNameRepresentationCode, CWE objNameContext, java.lang.String strNameAssemblyOrder, DTM objEffectiveDate, DTM objExpirationDate, java.lang.String strProfessionalSuffix, java.lang.String strCalledBy)` Set the Prior Patient Name.
    `void` | `addPriorPatientName(XPN objPriorPatientNameID)` Sets the Prior Patient Name.
    `ISingleCollection<CX>` | `getPriorAlternateVisitID()` Retrieves the Prior Alternate Visit ID.
    `CX` | `getPriorPatientAccountNumber()` Retrieves the Prior Patient Account Number.
    `ISingleCollection<CX>` | `getPriorPatientIdentifierList()` Retrieves the Prior Patient Identifier List.
    `ISingleCollection<XPN>` | `getPriorPatientName()` Retrieves the Prior Patient Name.
    `CX` | `getPriorVisitNumber()` Retrieves the Prior Visit Number.
    `void` | `setPriorAlternateVisitID(ISingleCollection<CX> objPriorPatientNameList)` Set the Prior Alternate Visit ID.
    `void` | `setPriorPatientAccountNumber(CX objpriorPatientAccountNumber)` Set the Prior Patient Account Number.
    `void` | `setPriorPatientAccountNumber(java.lang.String strIDNumber, java.lang.String strCheckDigit, java.lang.String strCheckDigitScheme, HD objAssigningAuthority, java.lang.String strIdentifierTypeCode, HD objAssigningFacility, java.lang.String strEffectiveDate, java.lang.String strExpirationDate, CWE objAssigningJurisdiction, CWE objAssigningAgencyOrDepartment, java.lang.String strSecurityCheck, java.lang.String strSecurityCheckScheme)` Set the Prior Patient Account Number.
    `void` | `setPriorPatientIdentifierList(ISingleCollection<CX> objPriorPatientIdentifierList)` Set the Patient Identifier.
    `void` | `setPriorPatientName(ISingleCollection<XPN> objPriorPatientNameList)` Set the Prior Patient Name.
    `void` | `setPriorVisitNumber(CX objPriorPatientNameID)` Sets the Prior Visit Number.
    `void` | `setPriorVisitNumber(java.lang.String strIDNumber, java.lang.String strCheckDigit, java.lang.String strCheckDigitScheme, HD objAssigningAuthority, java.lang.String strIdentifierTypeCode, HD objAssigningFacility, java.lang.String strEffectiveDate, java.lang.String strExpirationDate, CWE objAssigningJurisdiction, CWE objAssigningAgencyOrDepartment, java.lang.String strSecurityCheck, java.lang.String strSecurityCheckScheme)` Set the Prior Visit Number.
    `boolean` | `validate()` Validates HL7 Message objects .

    - ### Methods inherited from class cdac.medinfo.sdk.hl7282.baselibs.segments.Segment

      `addUnRecognizedField, dumpSegment, getFields, getName, getUnrecognizedFields, moveToNextSegment, parse, removeDataElement, removeDataElement, serialize, setName, setUnRecognizedField, updateDataElement, updateDataElement, writeToXML`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MRG

          public MRG()

      Constructs the MRG segment.

  - ### Method Detail

    - #### getPriorAlternateVisitID

          public ISingleCollection<CX> getPriorAlternateVisitID()

      Retrieves the Prior Alternate Visit ID. This field contains the prior alternate visit number.
      Returns:
        CX - priorAlternateVisitID

    - #### getPriorPatientAccountNumber

          public CX getPriorPatientAccountNumber()

      Retrieves the Prior Patient Account Number. This field contains the prior patient account number.
      Returns:
        CX - priorPatientAccountNumber

    - #### getPriorPatientIdentifierList

          public ISingleCollection<CX> getPriorPatientIdentifierList()

      Retrieves the Prior Patient Identifier List. This field contains the prior patient identifier list.
      Returns:
        ISingleCollection - priorPatientIdentifierList

    - #### getPriorPatientName

          public ISingleCollection<XPN> getPriorPatientName()

      Retrieves the Prior Patient Name. This field contains the prior name of the patient.
      Returns:
        ISingleCollection - priorPatientName

    - #### getPriorVisitNumber

          public CX getPriorVisitNumber()

      Retrieves the Prior Visit Number. This field contains the prior visit number.
      Returns:
        CX - priorVisitNumber

    - #### setPriorPatientAccountNumber

          public void setPriorPatientAccountNumber(java.lang.String strIDNumber,
                                          java.lang.String strCheckDigit,
                                          java.lang.String strCheckDigitScheme,
                                          HD objAssigningAuthority,
                                          java.lang.String strIdentifierTypeCode,
                                          HD objAssigningFacility,
                                          java.lang.String strEffectiveDate,
                                          java.lang.String strExpirationDate,
                                          CWE objAssigningJurisdiction,
                                          CWE objAssigningAgencyOrDepartment,
                                          java.lang.String strSecurityCheck,
                                          java.lang.String strSecurityCheckScheme)

      Set the Prior Patient Account Number. This field contains the prior patient account number.
      Parameters:
        `strIDNumber` - Specifies the value of the identifier itself.
        `strCheckDigit` - It is part of the identifying number used in the sending application.
        `strCheckDigitScheme` - Contains the code identifying the check digit scheme employed. Suggested Values NP,ISO,M10,M11.[Refer table No.0061].
        `objAssigningAuthority` - The assigning authority is a unique name of the system (or organization or agency or department) that creates the data. .
        `strIdentifierTypeCode` - Specifies a code corresponding to the type of identifier.In some cases, this code may be used as a qualifier to the "Assigning authority" component.[Refer table No 0203]
        `objAssigningFacility` - Specifies the place or location identifier where the identifier was first assigned to the patient.
        `strEffectiveDate` - Specifies the first date, if known, on which the address is valid and active.
        `strExpirationDate` - Specifies the last date, if known, on which the address is valid and active.
        `objAssigningJurisdiction` - Specifies the geo-political body that assigned the identifier.
        `objAssigningAgencyOrDepartment` - Specifies agency or department that assigned the identifier.
        `strSecurityCheck` - is used to communicate the version code.
        `objSecurityCheckSCheme` - is used to transmit information intended to validate veracity of the supplied identifier

    - #### setPriorPatientAccountNumber

          public void setPriorPatientAccountNumber(CX objpriorPatientAccountNumber)

      Set the Prior Patient Account Number. This field contains the prior patient account number.
      Parameters:
        `objpriorPatientAccountNumber` - object of Patient Account Number.

    - #### addPriorPatientIdentifierList

          public void addPriorPatientIdentifierList(java.lang.String strIDNumber,
                                           java.lang.String strCheckDigit,
                                           java.lang.String strCheckDigitScheme,
                                           HD objAssigningAuthority,
                                           java.lang.String strIdentifierTypeCode,
                                           HD objAssigningFacility,
                                           java.lang.String strEffectiveDate,
                                           java.lang.String strExpirationDate,
                                           CWE objAssigningJurisdiction,
                                           CWE objAssigningAgencyOrDepartment,
                                           java.lang.String strSecurityCheck,
                                           java.lang.String strSecurityCheckScheme)

      Set the Prior Patient Identifier List. This field contains the prior patient identifier list.
      Parameters:
        `strIDNumber` - Specifies the value of the identifier itself.
        `strCheckDigit` - It is part of the identifying number used in the sending application.
        `strCheckDigitScheme` - Contains the code identifying the check digit scheme employed. Suggested Values NP,ISO,M10,M11.[Refer table No.0061].
        `objAssigningAuthority` - The assigning authority is a unique name of the system (or organization or agency or department) that creates the data. .
        `strIdentifierTypeCode` - Specifies a code corresponding to the type of identifier.In some cases, this code may be used as a qualifier to the "Assigning authority" component.[Refer table No 0203]
        `objAssigningFacility` - Specifies the place or location identifier where the identifier was first assigned to the patient.
        `strEffectiveDate` - Specifies the first date, if known, on which the address is valid and active.
        `strExpirationDate` - Specifies the last date, if known, on which the address is valid and active.
        `objAssigningJurisdiction` - Specifies the geo-political body that assigned the identifier.
        `objAssigningAgencyOrDepartment` - Specifies agency or department that assigned the identifier.
        `strSecurityCheck` - is used to communicate the version code.
        `objSecurityCheckSCheme` - is used to transmit information intended to validate veracity of the supplied identifier

    - #### addPriorPatientIdentifierList

          public void addPriorPatientIdentifierList(CX objpriorPatientIdentifier)

      Set the Prior Patient Identifier. This field contains the prior patient identifier.
      Parameters:
        `objpriorPatientIdentifier` - object of Prior Patient Identifier.

    - #### setPriorPatientIdentifierList

          public void setPriorPatientIdentifierList(ISingleCollection<CX> objPriorPatientIdentifierList)

      Set the Patient Identifier.
      Parameters:
        `objPriorPatientIdentifierList` - List of Patient Identifier.

    - #### addPriorAlternateVisitID

          public void addPriorAlternateVisitID(java.lang.String strIDNumber,
                                      java.lang.String strCheckDigit,
                                      java.lang.String strCheckDigitScheme,
                                      HD objAssigningAuthority,
                                      java.lang.String strIdentifierTypeCode,
                                      HD objAssigningFacility,
                                      java.lang.String strEffectiveDate,
                                      java.lang.String strExpirationDate,
                                      CWE objAssigningJurisdiction,
                                      CWE objAssigningAgencyOrDepartment,
                                      java.lang.String strSecurityCheck,
                                      java.lang.String strSecurityCheckScheme)

      Set the Prior AlternateVisit ID. This field contains the prior Alternate visit number of patient.
      Parameters:
        `strIDNumber` - Specifies the value of the identifier itself.
        `strCheckDigit` - It is part of the identifying number used in the sending application.
        `strCheckDigitScheme` - Contains the code identifying the check digit scheme employed. Suggested Values NP,ISO,M10,M11.[Refer table No.0061].
        `objAssigningAuthority` - The assigning authority is a unique name of the system (or organization or agency or department) that creates the data. .
        `strIdentifierTypeCode` - Specifies a code corresponding to the type of identifier.In some cases, this code may be used as a qualifier to the "Assigning authority" component.[Refer table No 0203]
        `objAssigningFacility` - Specifies the place or location identifier where the identifier was first assigned to the patient.
        `strEffectiveDate` - Specifies the first date, if known, on which the address is valid and active.
        `strExpirationDate` - Specifies the last date, if known, on which the address is valid and active.
        `objAssigningJurisdiction` - Specifies the geo-political body that assigned the identifier.
        `objAssigningAgencyOrDepartment` - Specifies agency or department that assigned the identifier.
        `strSecurityCheck` - is used to communicate the version code.
        `objSecurityCheckSCheme` - is used to transmit information intended to validate veracity of the supplied identifier

    - #### addPriorAlternateVisitID

          public void addPriorAlternateVisitID(CX objpriorAlternateVisitID)

      Sets the Prior Alternate Visit ID.
      Parameters:
        `objpriorAlternateVisitID` - object of Prior Alternate Visit ID.

    - #### setPriorAlternateVisitID

          public void setPriorAlternateVisitID(ISingleCollection<CX> objPriorPatientNameList)

      Set the Prior Alternate Visit ID.
      Parameters:
        `objPriorAlternateVisitID` - List of Prior Patient Name.

    - #### addPriorPatientName

          public void addPriorPatientName(FN objFamilyName,
                                 java.lang.String strGivenName,
                                 java.lang.String strSecondAndFurtherGivenNamesOrInitialsThereof,
                                 java.lang.String strSuffix,
                                 java.lang.String strPrefix,
                                 java.lang.String strNameTypeCode,
                                 java.lang.String strNameRepresentationCode,
                                 CWE objNameContext,
                                 java.lang.String strNameAssemblyOrder,
                                 DTM objEffectiveDate,
                                 DTM objExpirationDate,
                                 java.lang.String strProfessionalSuffix,
                                 java.lang.String strCalledBy)

      Set the Prior Patient Name. This field contains the prior name of the patient.
      Parameters:
        `objFamilyName` - Specifies the surname of a person.
        `strGivenName` - Specifies First name.
        `strSecondAndFurtherGivenNamesOrInitialsThereof` - Specifies multiple middle names that may be included by separating them with spaces.
        `strSuffix` - Used to specify a name suffix (e.g., Jr. or III).
        `strPrefix` - Used to specify a name prefix (e.g., Dr.).
        `strNameTypeCode` - Specifies a code that represents the type of name. Suggested values are A,B,C,D,I,L,M,N,P,R,S,T,U...[Refer table 0200.]
        `strNameRepresentationCode` - Specifies representations of the same name/address Suggested values are I,A,P [Refer table 0465]
        `objNameContext` - Designates the context in which a name is used. [Refer User-defined Table 0448 ]
        `strNameAssemblyOrder` - Specifies a code that represents the preferred display order of the components of this person name. Suggested values are G,F[Refer table 0444.]
        `objEffectiveDate` - Specifies the first date, if known, on which the address is valid and active.
        `objExpirationDate` - Specifies the last date, if known, on which the address is valid and active.
        `strProfessionalSuffix` - Used to specify an abbreviation, or a string of abbreviations, denoting qualifications that support the person's profession, (e.g., licenses).
        `strCalledBy` - Used to specify the called name.

    - #### addPriorPatientName

          public void addPriorPatientName(XPN objPriorPatientNameID)

      Sets the Prior Patient Name.
      Parameters:
        `objPriorPatientNameID` - object of Prior Patient Name.

    - #### setPriorPatientName

          public void setPriorPatientName(ISingleCollection<XPN> objPriorPatientNameList)

      Set the Prior Patient Name.
      Parameters:
        `objPriorPatientNameList` - List of Prior Patient Name.

    - #### setPriorVisitNumber

          public void setPriorVisitNumber(java.lang.String strIDNumber,
                                 java.lang.String strCheckDigit,
                                 java.lang.String strCheckDigitScheme,
                                 HD objAssigningAuthority,
                                 java.lang.String strIdentifierTypeCode,
                                 HD objAssigningFacility,
                                 java.lang.String strEffectiveDate,
                                 java.lang.String strExpirationDate,
                                 CWE objAssigningJurisdiction,
                                 CWE objAssigningAgencyOrDepartment,
                                 java.lang.String strSecurityCheck,
                                 java.lang.String strSecurityCheckScheme)

      Set the Prior Visit Number. This field contains the prior visit number.
      Parameters:
        `strIDNumber` - Specifies the value of the identifier itself.
        `strCheckDigit` - It is part of the identifying number used in the sending application.
        `strCheckDigitScheme` - Contains the code identifying the check digit scheme employed. Suggested Values NP,ISO,M10,M11.[Refer table No.0061].
        `objAssigningAuthority` - The assigning authority is a unique name of the system (or organization or agency or department) that creates the data. .
        `strIdentifierTypeCode` - Specifies a code corresponding to the type of identifier.In some cases, this code may be used as a qualifier to the "Assigning authority" component.[Refer table No 0203]
        `objAssigningFacility` - Specifies the place or location identifier where the identifier was first assigned to the patient.
        `strEffectiveDate` - Specifies the first date, if known, on which the address is valid and active.
        `strExpirationDate` - Specifies the last date, if known, on which the address is valid and active.
        `objAssigningJurisdiction` - Specifies the geo-political body that assigned the identifier.
        `objAssigningAgencyOrDepartment` - Specifies agency or department that assigned the identifier.
        `strSecurityCheck` - is used to communicate the version code.
        `objSecurityCheckSCheme` - is used to transmit information intended to validate veracity of the supplied identifier

    - #### setPriorVisitNumber

          public void setPriorVisitNumber(CX objPriorPatientNameID)

      Sets the Prior Visit Number.
      Parameters:
        `objPriorPatientNameID` - object of Prior Visit Number.

    - #### validate

          public boolean validate()
                           throws InvalidSegmentException

      Validates HL7 Message objects . Validate method checks for validation each and every segments in side the Message object against specified message Structure. Validation chcecks include optionality of segment or group. It also verifies the number of times segment or group is repeated in message. e.g {PSH} while parsing PSH segment validate method will check for its mandatory presence. [PSH] in this case validate will throw exception if one tries to enter more than one PSH segment.
      Specified by:
        `validate` in interface `ISegment`
      Overrides:
        `validate` in class `Segment`
      Returns:
        boolean - true or false.
      Throws:
        `InvalidSegmentException` - Throws when Segment Validation fails