Exemplo n.º 1
0
        public ViralLoadResultEntity ViralLoadResults(ViralLoadResultEntity entity)
        {
            var internalIdentifiers = new List <INTERNALPATIENTID>();

            foreach (var identifier in internalIdentifiers)
            {
                var internalIdentity = new INTERNALPATIENTID()
                {
                    ID = identifier.ID,
                    IDENTIFIER_TYPE     = identifier.IDENTIFIER_TYPE,
                    ASSIGNING_AUTHORITY = identifier.ASSIGNING_AUTHORITY
                };
                internalIdentifiers.Add(internalIdentity);
            }

            var vlResultsDto = new ViralLoadResultEntity()
            {
                MESSAGE_HEADER =
                {
                    SENDING_APPLICATION   = entity.MESSAGE_HEADER.SENDING_APPLICATION,
                    SENDING_FACILITY      = entity.MESSAGE_HEADER.SENDING_FACILITY,
                    RECEIVING_APPLICATION = entity.MESSAGE_HEADER.RECEIVING_APPLICATION,
                    RECEIVING_FACILITY    = entity.MESSAGE_HEADER.RECEIVING_FACILITY,
                    MESSAGE_DATETIME      = entity.MESSAGE_HEADER.MESSAGE_DATETIME, //DateTime.Now.ToString("yyyyMMddHHmmss");
                    SECURITY      = entity.MESSAGE_HEADER.SECURITY,
                    MESSAGE_TYPE  = entity.MESSAGE_HEADER.MESSAGE_TYPE,
                    PROCESSING_ID = entity.MESSAGE_HEADER.PROCESSING_ID
                },
                PATIENT_IDENTIFICATION =
                {
                    PATIENT_NAME        =
                    {
                        FIRST_NAME  = entity.PATIENT_IDENTIFICATION.PATIENT_NAME.FIRST_NAME,
                        MIDDLE_NAME = entity.PATIENT_IDENTIFICATION.PATIENT_NAME.MIDDLE_NAME,
                        LAST_NAME   = entity.PATIENT_IDENTIFICATION.PATIENT_NAME.LAST_NAME
                    },
                    INTERNAL_PATIENT_ID = internalIdentifiers
                },
                VIRAL_LOAD_RESULT =
                {
                    DATE_SAMPLE_COLLECTED = entity.VIRAL_LOAD_RESULT.DATE_SAMPLE_COLLECTED,
                    DATE_SAMPLE_TESTED    = entity.VIRAL_LOAD_RESULT.DATE_SAMPLE_TESTED,
                    JUSTIFICATION         = entity.VIRAL_LOAD_RESULT.JUSTIFICATION,
                    LAB_TESTED_IN         = entity.VIRAL_LOAD_RESULT.LAB_TESTED_IN,
                    REGIMEN     = entity.VIRAL_LOAD_RESULT.REGIMEN,
                    SAMPLE_TYPE = entity.VIRAL_LOAD_RESULT.SAMPLE_TYPE
                }
            };

            return(vlResultsDto);
        }
Exemplo n.º 2
0
        public ViralLoadResultsDto ViralLoadResults(ViralLoadResultEntity entity)
        {
            var internalIdentifiers = new List <DTOIdentifier>();
            var viralLoadResults    = new List <VLoadlResult>();

            foreach (var identifier in entity.PATIENT_IDENTIFICATION.INTERNAL_PATIENT_ID)
            {
                if (identifier.IDENTIFIER_TYPE == "CCC_NUMBER")
                {
                    var internalIdentifier = new DTOIdentifier()
                    {
                        IdentifierValue    = identifier.ID,
                        IdentifierType     = identifier.IDENTIFIER_TYPE,
                        AssigningAuthority = identifier.ASSIGNING_AUTHORITY
                    };
                    internalIdentifiers.Add(internalIdentifier);
                }
            }

            foreach (var result in entity.VIRAL_LOAD_RESULT)
            {
                DateTime dateSampleCollected = DateTime.Today;
                DateTime dateSampleTested    = DateTime.Today;

                if (result.DATE_SAMPLE_COLLECTED != "")
                {
                    dateSampleCollected = DateTime.ParseExact(result.DATE_SAMPLE_COLLECTED, "yyyyMMdd", null);
                }
                if (result.DATE_SAMPLE_TESTED != "")
                {
                    dateSampleTested = DateTime.ParseExact(result.DATE_SAMPLE_TESTED, "yyyyMMdd", null);
                }

                var vlLoadResult = new VLoadlResult()
                {
                    DateSampleCollected = dateSampleCollected,
                    DateSampleTested    = dateSampleTested,
                    VlResult            = result.VL_RESULT,
                    SampleRejection     = result.SAMPLE_REJECTION,
                    Justification       = result.JUSTIFICATION,
                    LabTestedIn         = result.LAB_TESTED_IN,
                    Regimen             = result.REGIMEN,
                    SampleType          = result.SAMPLE_TYPE
                };
                viralLoadResults.Add(vlLoadResult);
            }

            var vlResultsDto = new ViralLoadResultsDto()
            {
                MesssageHeader =
                {
                    SendingApplication   = entity.MESSAGE_HEADER.SENDING_APPLICATION,
                    SendingFacility      = entity.MESSAGE_HEADER.SENDING_FACILITY,
                    ReceivingApplication = entity.MESSAGE_HEADER.RECEIVING_APPLICATION,
                    ReceivingFacility    = entity.MESSAGE_HEADER.RECEIVING_FACILITY,
                    MessageDatetime      = DateTime.ParseExact(entity.MESSAGE_HEADER.MESSAGE_DATETIME, "yyyyMMddHHmmss", null),
                    Security             = entity.MESSAGE_HEADER.SECURITY,
                    MessageType          = entity.MESSAGE_HEADER.MESSAGE_TYPE,
                    ProcessingId         = entity.MESSAGE_HEADER.PROCESSING_ID
                },
                PatientIdentification =
                {
                    INTERNAL_PATIENT_ID = internalIdentifiers
                },
                ViralLoadResult = viralLoadResults
            };

            return(vlResultsDto);
        }