Ejemplo n.º 1
0
        /// <summary>
        /// Get core value when value contains pipe delimited data
        /// </summary>
        /// <param name="observation">The observation to examine</param>
        /// <returns>The core value for this observation</returns>
        public static string GetObservationCoreValue(Observation observation)
        {
            string returnVal = "";

            EddHistoryItem tempItem = GetHistoryItem(observation);

            EddItemType itemType = GetItemType(observation.Code);

            switch (itemType)
            {
            case EddItemType.Ultrasound:
            case EddItemType.Other:
                int    days   = -1;
                string piece3 = Util.Piece(observation.Value, "|", 3);
                if (int.TryParse(piece3, out days))
                {
                    int wholeWeeks = (int)days / 7;
                    returnVal = wholeWeeks.ToString();
                }
                break;

            default:
                returnVal = tempItem.Edd;
                break;
            }

            return(returnVal);
        }
Ejemplo n.º 2
0
        public static EddHistoryItem GetHistoryItem(Observation observation)
        {
            EddHistoryItem returnVal = new EddHistoryItem();

            returnVal.Ien = observation.Ien;
            DateTime enteredOnDate = observation.EntryDate; //VistaDates.ParseDateString(dsioObservation.Date, VistaDates.VistADateFormatFour);

            returnVal.EnteredOn = enteredOnDate.ToString(VistaDates.VistADateOnlyFormat);
            returnVal.EnteredBy = observation.EnteredBy;
            returnVal.Imported  = (string.IsNullOrWhiteSpace(observation.ExchangeDocumentIen)) ? false : true;

            returnVal.Criteria = GetEddCriteria(observation);

            string valPiece1 = Util.Piece(observation.Value, "|", 1);
            string valPiece2 = Util.Piece(observation.Value, "|", 2);
            string valPiece3 = Util.Piece(observation.Value, "|", 3);

            bool isFinal = false;

            bool.TryParse(valPiece2, out isFinal);
            returnVal.IsFinal = isFinal;

            returnVal.EventDate = valPiece1;

            EddItemType itemType = GetItemType(observation.Code);

            switch (itemType)
            {
            case EddItemType.EddOnly:
                returnVal.Edd       = valPiece1;
                returnVal.EventDate = "";
                break;

            case EddItemType.Ultrasound:
            case EddItemType.Other:
                returnVal.GestationalAge = EddUtility.GetFormattedGestationalAge(valPiece3);
                returnVal.Edd            = EddUtility.GetEddFromGA(valPiece1, valPiece3);
                break;

            case EddItemType.LMP:
                returnVal.Edd       = valPiece1;
                returnVal.EventDate = EddUtility.GetLmpFromEdd(valPiece1);
                returnVal.Criteria  = "Last Menstrual Period";
                break;

            default:
                returnVal.Edd = EddUtility.GetEddFromDate(itemType, valPiece1);
                break;
            }

            return(returnVal);
        }