예제 #1
0
        public static PatientRegistrationDTO Get(int patientId)
        {
            PatientMessageManager  patientMessageManager = new PatientMessageManager();
            PatientMessage         patientMessage        = patientMessageManager.GetPatientMessageByEntityId(patientId);
            PatientRegistrationDTO registration          = new PatientRegistrationDTO();
            var personIdentifierManager = new PersonIdentifierManager();

            if (patientMessage != null)
            {
                IdentifierManager identifierManager = new IdentifierManager();
                Identifier        identifier        = identifierManager.GetIdentifierByCode("GODS_NUMBER");
                var personIdentifiers = personIdentifierManager.GetPersonIdentifiers(patientMessage.Id, identifier.Id);

                INTERNALPATIENTID internalPatientId = new INTERNALPATIENTID();
                internalPatientId.ID = patientMessage.IdentifierValue;
                internalPatientId.IDENTIFIER_TYPE     = "CCC_NUMBER";
                internalPatientId.ASSIGNING_AUTHORITY = "CCC";


                registration.PATIENT_IDENTIFICATION = registration.PATIENT_IDENTIFICATION == null ? new PATIENTIDENTIFICATION() : registration.PATIENT_IDENTIFICATION;
                registration.PATIENT_IDENTIFICATION.INTERNAL_PATIENT_ID = registration.PATIENT_IDENTIFICATION.INTERNAL_PATIENT_ID == null ? new List <INTERNALPATIENTID>() : registration.PATIENT_IDENTIFICATION.INTERNAL_PATIENT_ID;
                registration.PATIENT_IDENTIFICATION.EXTERNAL_PATIENT_ID = registration.PATIENT_IDENTIFICATION.EXTERNAL_PATIENT_ID == null ? new EXTERNALPATIENTID() : registration.PATIENT_IDENTIFICATION.EXTERNAL_PATIENT_ID;
                registration.PATIENT_IDENTIFICATION.PATIENT_NAME        = registration.PATIENT_IDENTIFICATION.PATIENT_NAME == null ? new PATIENTNAME() : registration.PATIENT_IDENTIFICATION.PATIENT_NAME;
                registration.PATIENT_IDENTIFICATION.MOTHER_NAME         = registration.PATIENT_IDENTIFICATION.MOTHER_NAME == null ? (dynamic)null : registration.PATIENT_IDENTIFICATION.MOTHER_NAME;
                registration.PATIENT_IDENTIFICATION.PATIENT_ADDRESS     = registration.PATIENT_IDENTIFICATION.PATIENT_ADDRESS == null ? new PATIENTADDRESS() : registration.PATIENT_IDENTIFICATION.PATIENT_ADDRESS;
                registration.PATIENT_IDENTIFICATION.PATIENT_ADDRESS.PHYSICAL_ADDRESS = registration.PATIENT_IDENTIFICATION.PATIENT_ADDRESS.PHYSICAL_ADDRESS == null ? new PHYSICAL_ADDRESS() : registration.PATIENT_IDENTIFICATION.PATIENT_ADDRESS.PHYSICAL_ADDRESS;
                registration.PATIENT_VISIT = registration.PATIENT_VISIT == null ? new VISIT() : registration.PATIENT_VISIT;
                registration.NEXT_OF_KIN   = registration.NEXT_OF_KIN == null ? new List <NEXTOFKIN>() : registration.NEXT_OF_KIN;

                //External Patient Id
                registration.PATIENT_IDENTIFICATION.EXTERNAL_PATIENT_ID.ID = personIdentifiers.Count > 0 ? personIdentifiers[0].IdentifierValue : String.Empty;
                registration.PATIENT_IDENTIFICATION.EXTERNAL_PATIENT_ID.ASSIGNING_AUTHORITY = "MPI";
                registration.PATIENT_IDENTIFICATION.EXTERNAL_PATIENT_ID.IDENTIFIER_TYPE     = "GODS_NUMBER";
                //Start setting values
                registration.PATIENT_IDENTIFICATION.INTERNAL_PATIENT_ID.Add(internalPatientId);
                if (!String.IsNullOrWhiteSpace(patientMessage.NATIONAL_ID) && patientMessage.NATIONAL_ID != "99999999")
                {
                    INTERNALPATIENTID internalNationalId = new INTERNALPATIENTID();
                    internalNationalId.ID = patientMessage.NATIONAL_ID;
                    internalNationalId.IDENTIFIER_TYPE     = "NATIONAL_ID";
                    internalNationalId.ASSIGNING_AUTHORITY = "GOK";

                    registration.PATIENT_IDENTIFICATION.INTERNAL_PATIENT_ID.Add(internalNationalId);
                }
                //set names
                registration.PATIENT_IDENTIFICATION.PATIENT_NAME.FIRST_NAME  = !string.IsNullOrWhiteSpace(patientMessage.FIRST_NAME) ? patientMessage.FIRST_NAME: "";
                registration.PATIENT_IDENTIFICATION.PATIENT_NAME.MIDDLE_NAME = !string.IsNullOrWhiteSpace(patientMessage.MIDDLE_NAME) ? patientMessage.MIDDLE_NAME : "";
                registration.PATIENT_IDENTIFICATION.PATIENT_NAME.LAST_NAME   = !string.IsNullOrWhiteSpace(patientMessage.LAST_NAME) ? patientMessage.LAST_NAME : "";
                //set DOB
                registration.PATIENT_IDENTIFICATION.DATE_OF_BIRTH           = !string.IsNullOrWhiteSpace(patientMessage.DATE_OF_BIRTH) ? patientMessage.DATE_OF_BIRTH : "";
                registration.PATIENT_IDENTIFICATION.DATE_OF_BIRTH_PRECISION = !string.IsNullOrWhiteSpace(patientMessage.DATE_OF_BIRTH_PRECISION) ? patientMessage.DATE_OF_BIRTH_PRECISION : "";
                //set sex
                registration.PATIENT_IDENTIFICATION.SEX = !string.IsNullOrWhiteSpace(patientMessage.SEX) ? patientMessage.SEX : "";
                //set phone number
                registration.PATIENT_IDENTIFICATION.PHONE_NUMBER = !string.IsNullOrWhiteSpace(patientMessage.MobileNumber) ? patientMessage.MobileNumber : "";
                //set marital status
                registration.PATIENT_IDENTIFICATION.MARITAL_STATUS = !string.IsNullOrWhiteSpace(patientMessage.MARITAL_STATUS) ? patientMessage.MARITAL_STATUS : "";
                //set patient address variables
                registration.PATIENT_IDENTIFICATION.PATIENT_ADDRESS.POSTAL_ADDRESS                    = !string.IsNullOrWhiteSpace(patientMessage.PhysicalAddress) ? patientMessage.PhysicalAddress : "";
                registration.PATIENT_IDENTIFICATION.PATIENT_ADDRESS.PHYSICAL_ADDRESS.VILLAGE          = !string.IsNullOrWhiteSpace(patientMessage.Village) ? patientMessage.Village : "";
                registration.PATIENT_IDENTIFICATION.PATIENT_ADDRESS.PHYSICAL_ADDRESS.WARD             = !string.IsNullOrWhiteSpace(patientMessage.WardName) ? patientMessage.WardName : "";
                registration.PATIENT_IDENTIFICATION.PATIENT_ADDRESS.PHYSICAL_ADDRESS.SUB_COUNTY       = !string.IsNullOrWhiteSpace(patientMessage.Subcountyname) ? patientMessage.Subcountyname : "";
                registration.PATIENT_IDENTIFICATION.PATIENT_ADDRESS.PHYSICAL_ADDRESS.COUNTY           = !string.IsNullOrWhiteSpace(patientMessage.CountyName) ? patientMessage.CountyName : "";
                registration.PATIENT_IDENTIFICATION.PATIENT_ADDRESS.PHYSICAL_ADDRESS.NEAREST_LANDMARK = !string.IsNullOrWhiteSpace(patientMessage.Landmark) ? patientMessage.Landmark : "";
                //set visit variables
                registration.PATIENT_VISIT.HIV_CARE_ENROLLMENT_DATE = !string.IsNullOrWhiteSpace(patientMessage.DateOfEnrollment) ? patientMessage.DateOfEnrollment : "";
                registration.PATIENT_VISIT.PATIENT_SOURCE           = !string.IsNullOrWhiteSpace(patientMessage.EntryPoint) ? patientMessage.EntryPoint : "";
                registration.PATIENT_VISIT.PATIENT_TYPE             = !string.IsNullOrWhiteSpace(patientMessage.PatientType) ? patientMessage.PatientType : "";
                registration.PATIENT_VISIT.VISIT_DATE = !string.IsNullOrWhiteSpace(patientMessage.DateOfRegistration) ? patientMessage.DateOfRegistration : "";
                //set if patient is dead
                registration.PATIENT_IDENTIFICATION.DEATH_DATE      = !string.IsNullOrWhiteSpace(patientMessage.DateOfDeath) ? patientMessage.DateOfDeath : "";
                registration.PATIENT_IDENTIFICATION.DEATH_INDICATOR = !string.IsNullOrWhiteSpace(patientMessage.DeathIndicator) ? patientMessage.DeathIndicator : "";

                if (!string.IsNullOrWhiteSpace(patientMessage.TFIRST_NAME) && !string.IsNullOrWhiteSpace(patientMessage.TLAST_NAME))
                {
                    NEXTOFKIN treatmentSupporter = new NEXTOFKIN();
                    treatmentSupporter.NOK_NAME.FIRST_NAME  = !string.IsNullOrWhiteSpace(patientMessage.TFIRST_NAME) ? patientMessage.TFIRST_NAME : "";
                    treatmentSupporter.NOK_NAME.MIDDLE_NAME = !string.IsNullOrWhiteSpace(patientMessage.TMIDDLE_NAME) ? patientMessage.TMIDDLE_NAME : "";
                    treatmentSupporter.NOK_NAME.LAST_NAME   = !string.IsNullOrWhiteSpace(patientMessage.TLAST_NAME) ? patientMessage.TLAST_NAME : "";
                    treatmentSupporter.DATE_OF_BIRTH        = !string.IsNullOrWhiteSpace(patientMessage.TDATE_OF_BIRTH) ? patientMessage.TDATE_OF_BIRTH : "";
                    treatmentSupporter.PHONE_NUMBER         = !string.IsNullOrWhiteSpace(patientMessage.TPHONE_NUMBER) ? patientMessage.TPHONE_NUMBER : "";
                    treatmentSupporter.ADDRESS      = !string.IsNullOrWhiteSpace(patientMessage.TADDRESS) ? patientMessage.TADDRESS : "";
                    treatmentSupporter.CONTACT_ROLE = "T";
                    treatmentSupporter.RELATIONSHIP = String.Empty;
                    treatmentSupporter.SEX          = !string.IsNullOrWhiteSpace(patientMessage.TSEX) ? patientMessage.TSEX : "";

                    registration.NEXT_OF_KIN.Add(treatmentSupporter);
                }
            }

            return(registration);
        }
예제 #2
0
        public PatientRegistrationEntity PatientRegistration(Registration entity)
        {
            var identifiers = new List <INTERNALPATIENTID>();

            foreach (var id in entity.InternalPatientIdentifiers)
            {
                var identifier = new INTERNALPATIENTID()
                {
                    ID = id.IdentifierValue,
                    IDENTIFIER_TYPE     = id.IdentifierType,
                    ASSIGNING_AUTHORITY = id.AssigningAuthority
                };
                identifiers.Add(identifier);
            }

            var nextOfKin = new List <NEXTOFKIN>();

            if (entity.TreatmentSupporter != null)
            {
                var treatmentSupporter = new NEXTOFKIN()
                {
                    NOK_NAME = new NOKNAME()
                    {
                        FIRST_NAME  = !string.IsNullOrWhiteSpace(entity.TreatmentSupporter.FirstName) ? entity.TreatmentSupporter.FirstName : "",
                        MIDDLE_NAME = !string.IsNullOrWhiteSpace(entity.TreatmentSupporter.MiddleName) ? entity.TreatmentSupporter.MiddleName : "",
                        LAST_NAME   = !string.IsNullOrWhiteSpace(entity.TreatmentSupporter.LastName) ? entity.TreatmentSupporter.LastName : ""
                    },
                    CONTACT_ROLE  = "T",
                    RELATIONSHIP  = !string.IsNullOrWhiteSpace(entity.TSRelationshipType) ? entity.TSRelationshipType : "",
                    PHONE_NUMBER  = !string.IsNullOrWhiteSpace(entity.TreatmentSupporter.MobileNumber) ? entity.TreatmentSupporter.MobileNumber : "",
                    SEX           = !string.IsNullOrWhiteSpace(entity.TreatmentSupporter.Sex) ? entity.TreatmentSupporter.Sex : "",
                    DATE_OF_BIRTH = !string.IsNullOrWhiteSpace(entity.TreatmentSupporter.DateOfBirth) ? entity.TreatmentSupporter.DateOfBirth : "",
                    ADDRESS       = !string.IsNullOrWhiteSpace(entity.TreatmentSupporter.PhysicalAddress) ? entity.TreatmentSupporter.PhysicalAddress : ""
                };
                nextOfKin.Add(treatmentSupporter);
            }


            var patientRegistrationEntity = new PatientRegistrationEntity()
            {
                MESSAGE_HEADER         = GetMessageHeader("ADT^A04"),
                PATIENT_IDENTIFICATION = new PATIENTIDENTIFICATION()
                {
                    PATIENT_NAME = new PATIENTNAME()
                    {
                        FIRST_NAME  = !string.IsNullOrWhiteSpace(entity.Patient.FirstName)? entity.Patient.FirstName:"",
                        MIDDLE_NAME = !string.IsNullOrWhiteSpace(entity.Patient.MiddleName)? entity.Patient.MiddleName:"",
                        LAST_NAME   = !string.IsNullOrWhiteSpace(entity.Patient.LastName)? entity.Patient.LastName:"",
                    },
                    EXTERNAL_PATIENT_ID = new EXTERNALPATIENTID()
                    {
                        ID = "",
                        IDENTIFIER_TYPE     = "GODS_NUMBER",
                        ASSIGNING_AUTHORITY = "MPI"
                    },
                    DATE_OF_BIRTH   = !string.IsNullOrWhiteSpace(entity.Patient.DateOfBirth)?entity.Patient.DateOfBirth:null,
                    SEX             = !string.IsNullOrWhiteSpace(entity.Patient.Sex)? entity.Patient.Sex:"",
                    PHONE_NUMBER    = !string.IsNullOrWhiteSpace(entity.Patient.MobileNumber)? entity.Patient.MobileNumber:"",
                    PATIENT_ADDRESS = new PATIENTADDRESS()
                    {
                        POSTAL_ADDRESS   = !string.IsNullOrWhiteSpace(entity.Patient.PhysicalAddress)? entity.Patient.PhysicalAddress:"",
                        PHYSICAL_ADDRESS = new PHYSICALADDRESS()
                        {
                            COUNTY     = !string.IsNullOrWhiteSpace(entity.County)? entity.County:"",
                            SUB_COUNTY = !string.IsNullOrWhiteSpace(entity.SubCounty)? entity.SubCounty:"",
                            VILLAGE    = !string.IsNullOrWhiteSpace(entity.Village)? entity.Village:"",
                            WARD       = !string.IsNullOrWhiteSpace(entity.Ward)? entity.Ward:""
                        },
                    },
                    MARITAL_STATUS      = !string.IsNullOrWhiteSpace(entity.MaritalStatus)? entity.MaritalStatus:"",
                    DEATH_INDICATOR     = !string.IsNullOrWhiteSpace(entity.DeathIndicator)? entity.DeathIndicator:"",
                    DEATH_DATE          = "",
                    MOTHER_MAIDEN_NAME  = entity.MotherMaidenName,
                    INTERNAL_PATIENT_ID = identifiers
                },
                NEXT_OF_KIN        = nextOfKin,
                OBSERVATION_RESULT = new List <OBSERVATIONRESULT>()
            };

            return(patientRegistrationEntity);
        }