public object Initialize(object newEntity) { PutInitializeObservationDataRequest request = (PutInitializeObservationDataRequest)newEntity; PatientObservationData patientObservationData = null; MEPatientObservation mePg = null; try { mePg = new MEPatientObservation(this.UserId) { Id = ObjectId.GenerateNewId(), PatientId = ObjectId.Parse(request.PatientId), ObservationId = ObjectId.Parse(request.ObservationId), TTLDate = System.DateTime.UtcNow.AddDays(_initializeDays), DeleteFlag = false, Source = CareManager, StartDate = DateTime.UtcNow, EndDate = DateTime.UtcNow, State = ObservationState.Complete, Version = request.Version }; using (PatientObservationMongoContext ctx = new PatientObservationMongoContext(_dbName)) { ctx.PatientObservations.Collection.Insert(mePg); AuditHelper.LogDataAudit(this.UserId, MongoCollectionName.PatientObservation.ToString(), mePg.Id.ToString(), Common.DataAuditType.Insert, request.ContractNumber); patientObservationData = new PatientObservationData { Id = mePg.Id.ToString(), PatientId = mePg.PatientId.ToString() }; } return(patientObservationData); } catch (Exception) { throw; } }
public ObservationValueData InitializePatientObservation(IDataDomainRequest request, string patientId, List <ObservationValueData> list, ObservationData od, string initSetId) { try { IPatientObservationRepository repo = Factory.GetRepository(request, RepositoryType.PatientObservation); PutInitializeObservationDataRequest req = new PutInitializeObservationDataRequest { PatientId = patientId, ObservationId = od.Id, Context = request.Context, ContractNumber = request.ContractNumber, UserId = request.UserId, Version = request.Version, SetId = initSetId }; ObservationValueData ovd = new ObservationValueData(); // get last value for each observation data GetPreviousValuesForObservation(ovd, patientId, od.Id, request); PatientObservationData pod = (PatientObservationData)repo.Initialize(req); ovd.Id = pod.Id; ovd.Text = od.Description; ovd.Value = string.Empty; // changed to initialize the value. list.Add(ovd); return(ovd); } catch (Exception ex) { throw new Exception("DD.DataPatientObservationManager:InitializePatientObservation()::" + ex.Message, ex.InnerException); } }
public PutInitializeObservationDataResponse InsertNewPatientObservation(PutInitializeObservationDataRequest request) { PutInitializeObservationDataResponse response = new PutInitializeObservationDataResponse(); try { if (string.IsNullOrEmpty(request.UserId)) { throw new UnauthorizedAccessException("PatientObservationDD:Insert()"); } IPatientObservationRepository repo = new PatientObservationRepositoryFactory().GetRepository(request, RepositoryType.PatientObservation); response.ObservationData = (PatientObservationData)repo.Initialize(request); } catch (Exception ex) { CommonFormatter.FormatExceptionResponse(response, base.Response, ex); string aseProcessID = ConfigurationManager.AppSettings.Get("ASEProcessID") ?? "0"; Common.Helper.LogException(int.Parse(aseProcessID), ex); } return(response); }