Example #1
0
 public string GetVisitById(int visitId)
 {
     try
     {
         PatientMasterVisitManager patientMasterVisitManager = new PatientMasterVisitManager();
         _jsonMessage = new JavaScriptSerializer().Serialize(patientMasterVisitManager.GetVisitById(visitId));
     }
     catch (Exception e)
     {
         _jsonMessage = e.Message;
     }
     return(_jsonMessage);
 }
Example #2
0
        public static ObservationResultDTO GetWHOStage(int entityId)
        {
            try
            {
                ObservationResultDTO   observationResult = new ObservationResultDTO();
                PatientWhoStageManager whoStageManager   = new PatientWhoStageManager();
                var whoStage = whoStageManager.GetWhoStageById(entityId);

                if (whoStage != null)
                {
                    LookupLogic lookupLogic = new LookupLogic();
                    PatientMasterVisitManager visitManager            = new PatientMasterVisitManager();
                    PersonIdentifierManager   personIdentifierManager = new PersonIdentifierManager();
                    IdentifierManager         identifierManager       = new IdentifierManager();
                    Identifier            identifier            = identifierManager.GetIdentifierByCode("GODS_NUMBER");
                    PatientMessageManager patientMessageManager = new PatientMessageManager();
                    PatientMessage        patientMessage        = patientMessageManager.GetPatientMessageByEntityId(whoStage.PatientId);
                    PatientMasterVisit    visit = visitManager.GetVisitById(whoStage.PatientMasterVisitId);

                    List <PersonIdentifier> personIdentifiers = personIdentifierManager.GetPersonIdentifiers(patientMessage.Id, identifier.Id);
                    string whoStageString = lookupLogic.GetLookupItemNameByMasterNameItemId(whoStage.WHOStage, "WHOStage");

                    //Initialize default values
                    observationResult.PATIENT_IDENTIFICATION = observationResult.PATIENT_IDENTIFICATION == null ? new OBSERVATIONPATIENTIDENTIFICATION() : observationResult.PATIENT_IDENTIFICATION;
                    observationResult.PATIENT_IDENTIFICATION.INTERNAL_PATIENT_ID = observationResult.PATIENT_IDENTIFICATION.INTERNAL_PATIENT_ID == null ? new List <INTERNALPATIENTID>() : observationResult.PATIENT_IDENTIFICATION.INTERNAL_PATIENT_ID;
                    observationResult.PATIENT_IDENTIFICATION.EXTERNAL_PATIENT_ID = observationResult.PATIENT_IDENTIFICATION.EXTERNAL_PATIENT_ID == null ? new EXTERNALPATIENTID() : observationResult.PATIENT_IDENTIFICATION.EXTERNAL_PATIENT_ID;
                    observationResult.PATIENT_IDENTIFICATION.PATIENT_NAME        = observationResult.PATIENT_IDENTIFICATION.PATIENT_NAME == null ? new PATIENTNAME() : observationResult.PATIENT_IDENTIFICATION.PATIENT_NAME;
                    observationResult.OBSERVATION_RESULT = observationResult.OBSERVATION_RESULT == null ? new List <OBSERVATION_RESULT>() : observationResult.OBSERVATION_RESULT;

                    //External Patient Id
                    observationResult.PATIENT_IDENTIFICATION.EXTERNAL_PATIENT_ID = PatientIdentificationSegment.GetExternalPatientId(personIdentifiers);

                    //CCC Number
                    INTERNALPATIENTID internalPatientId = PatientIdentificationSegment.getInternalPatientIdCCC(patientMessage);
                    observationResult.PATIENT_IDENTIFICATION.INTERNAL_PATIENT_ID.Add(internalPatientId);

                    //National ID
                    INTERNALPATIENTID internalNationalId = PatientIdentificationSegment.getInternalPatientIdNationalId(patientMessage);
                    if (internalNationalId != null)
                    {
                        observationResult.PATIENT_IDENTIFICATION.INTERNAL_PATIENT_ID.Add(internalNationalId);
                    }

                    //Patient Names
                    observationResult.PATIENT_IDENTIFICATION.PATIENT_NAME = PatientIdentificationSegment.GetPatientName(patientMessage);

                    //set visitdate value
                    DateTime visitDate       = visit.VisitDate.HasValue ? visit.VisitDate.Value : DateTime.Now;
                    string   observationDate = visitDate.ToString("yyyyMMddHmmss", CultureInfo.InvariantCulture);

                    string observationValue = String.Empty;
                    switch (whoStageString)
                    {
                    case "Stage1":
                        observationValue = "1";
                        break;

                    case "Stage2":
                        observationValue = "2";
                        break;

                    case "Stage3":
                        observationValue = "3";
                        break;

                    case "Stage4":
                        observationValue = "4";
                        break;
                    }
                    //WHO STAGE
                    OBSERVATION_RESULT observation = new OBSERVATION_RESULT()
                    {
                        OBSERVATION_IDENTIFIER = "WHO_STAGE",
                        OBSERVATION_SUB_ID     = "",
                        CODING_SYSTEM          = "WHO",
                        VALUE_TYPE             = "NM",
                        OBSERVATION_VALUE      = observationValue,
                        UNITS = "",
                        OBSERVATION_RESULT_STATUS = "F",
                        OBSERVATION_DATETIME      = observationDate,
                        ABNORMAL_FLAGS            = "N"
                    };

                    observationResult.OBSERVATION_RESULT.Add(observation);
                }

                return(observationResult);
            }
            catch (Exception e)
            {
                throw e;
            }
        }