001package ca.cdr.api.pub.hl7v2.common.abstraction;
002
003/*-
004 * #%L
005 * Smile CDR - CDR
006 * %%
007 * Copyright (C) 2016 - 2024 Smile CDR, Inc.
008 * %%
009 * All rights reserved.
010 * #L%
011 */
012
013import ca.uhn.hl7v2.model.v25.segment.*;
014
015import java.util.Collections;
016import java.util.List;
017
018import static ca.cdr.api.pub.hl7v2.common.abstraction.VisitMessage.call;
019
020public class PatientMessage implements IPatientMessage {
021
022        private List<IAM> myIam;
023        private List<NK1> myNk1;
024        private PD1 myPd1;
025        private PID myPid;
026        private List<ROL> myRol;
027        private IAddCallback<ROL> myAddRolFunction;
028        private IAddCallback<NK1> myAddNk1Function;
029
030        @Override
031        public ROL addROL() {
032                if (myAddRolFunction == null) {
033                        return null;
034                }
035                return call(myAddRolFunction);
036        }
037
038        @Override
039        public List<IAM> getIAM() {
040                return myIam;
041        }
042
043        public PatientMessage setIAM(List<IAM> theIam) {
044                myIam = theIam;
045                return this;
046        }
047
048        @Override
049        public List<NK1> getNK1() {
050                return myNk1;
051        }
052
053        @Override
054        public NK1 addNk1() {
055                return call(myAddNk1Function);
056        }
057
058        @Override
059        public PD1 getPD1() {
060                return myPd1;
061        }
062
063        public PatientMessage setPD1(PD1 thePd1) {
064                myPd1 = thePd1;
065                return this;
066        }
067
068        @Override
069        public PID getPID() {
070                return myPid;
071        }
072
073        public PatientMessage setPID(PID thePid) {
074                myPid = thePid;
075                return this;
076        }
077
078        @Override
079        public List<ROL> getROL() {
080                return myRol == null ? Collections.emptyList() : myRol;
081        }
082
083        public PatientMessage setNK1(List<NK1> theNk1, IAddCallback<NK1> theAddNk1Function) {
084                myNk1 = theNk1;
085                myAddNk1Function = theAddNk1Function;
086                return this;
087        }
088
089        public PatientMessage setROL(List<ROL> theROL, IAddCallback<ROL> theAddRolFunction) {
090                myRol = theROL;
091                myAddRolFunction = theAddRolFunction;
092                return this;
093        }
094
095        @Override
096        public boolean canAddNk1() {
097                return myAddNk1Function != null;
098        }
099}