public PatientAllergyData InitializePatientAllergy(PutInitializePatientAllergyDataRequest request)
 {
     try
     {
         //PatientAllergyRepository.UserId = request.UserId;
         var repo = AllergyRepositoryFactory.GetAllergyRepository(request, RepositoryType.PatientAllergy);
         return((PatientAllergyData)repo.Initialize(request));
     }
     catch (Exception ex) { throw ex; }
 }
        public void InitializePatientAllergy_Test()
        {
            PutInitializePatientAllergyDataRequest request = new PutInitializePatientAllergyDataRequest {
                AllergyId      = "54489a3dfe7a59146485bafe",
                Context        = context,
                ContractNumber = contractNumber,
                PatientId      = "54087f43d6a48509407d69cb",
                UserId         = userId,
                Version        = version
            };
            // [Route("/{Context}/{Version}/{ContractNumber}/PatientAllergy/{PatientId}/Initialize", "PUT")]
            PutInitializePatientAllergyDataResponse response = client.Put <PutInitializePatientAllergyDataResponse>(
                string.Format("{0}/{1}/{2}/{3}/PatientAllergy/Initialize", url, context, version, contractNumber), request);

            Assert.IsNotNull(response);
        }
Example #3
0
        public void InitializePatientAllergy_Test()
        {
            PutInitializePatientAllergyDataRequest request = new PutInitializePatientAllergyDataRequest {
                AllergyId      = "54489a3dfe7a59146485bafe",
                Context        = context,
                ContractNumber = contractNumber,
                PatientId      = "54087f43d6a48509407d69cb",
                SystemName     = "Engage",
                UserId         = userId,
                Version        = version
            };

            PatientAllergyData data = cm.InitializePatientAllergy(request);

            Assert.IsTrue(data.AllergyId == request.AllergyId);
        }
Example #4
0
        public PutInitializePatientAllergyDataResponse Put(PutInitializePatientAllergyDataRequest request)
        {
            PutInitializePatientAllergyDataResponse response = new PutInitializePatientAllergyDataResponse {
                Version = request.Version
            };

            try
            {
                RequireUserId(request);
                response.PatientAllergyData = Manager.InitializePatientAllergy(request);
            }
            catch (Exception ex)
            {
                RaiseException(response, ex);
            }
            return(response);
        }
Example #5
0
        public object Initialize(object newEntity)
        {
            PutInitializePatientAllergyDataRequest request = (PutInitializePatientAllergyDataRequest)newEntity;
            PatientAllergyData data = null;

            try
            {
                MEPatientAllergy mePA = new MEPatientAllergy(this.UserId)
                {
                    PatientId  = ObjectId.Parse(request.PatientId),
                    AllergyId  = ObjectId.Parse(request.AllergyId),
                    TTLDate    = System.DateTime.UtcNow.AddDays(_initializeDays),
                    SystemName = request.SystemName,
                    DeleteFlag = false
                };

                using (AllergyMongoContext ctx = new AllergyMongoContext(ContractDBName))
                {
                    ctx.PatientAllergies.Collection.Insert(mePA);

                    AuditHelper.LogDataAudit(this.UserId,
                                             MongoCollectionName.PatientAllergy.ToString(),
                                             mePA.Id.ToString(),
                                             DataAuditType.Insert,
                                             request.ContractNumber);

                    data = new PatientAllergyData
                    {
                        Id         = mePA.Id.ToString(),
                        PatientId  = mePA.PatientId.ToString(),
                        AllergyId  = mePA.AllergyId.ToString(),
                        SystemName = mePA.SystemName
                    };
                    // get corresponding allergy name and type.
                    getAllergyDetails(data, ctx, mePA.AllergyId);
                }
                return(data);
            }
            catch (Exception) { throw; }
        }
Example #6
0
        public object Initialize(object newEntity)
        {
            PutInitializePatientAllergyDataRequest request = (PutInitializePatientAllergyDataRequest)newEntity;
            PatientAllergyData data = null;
            MEPatientAllergy   mePA = new MEPatientAllergy(this.UserId)
            {
                PatientId  = ObjectId.Parse(request.PatientId),
                AllergyId  = ObjectId.Parse(request.AllergyId),
                TTLDate    = System.DateTime.UtcNow.AddDays(1),
                SystemName = request.SystemName,
                DeleteFlag = false
            };

            data = new PatientAllergyData
            {
                Id         = mePA.Id.ToString(),
                PatientId  = mePA.PatientId.ToString(),
                AllergyId  = mePA.AllergyId.ToString(),
                SystemName = mePA.SystemName
            };
            return(data);
        }