예제 #1
0
        public void InsertPatientNote_Test()
        {
            List <string> prog = new List <string>();

            prog.Add("558c756184ac0707d02f72c8");

            PatientNoteData data = new PatientNoteData
            {
                PatientId         = "5429d29984ac050c788bd34f",
                Text              = "GGGG",
                ProgramIds        = prog,
                TypeId            = "54909997d43323251c0a1dfe",
                MethodId          = "540f1da7d4332319883f3e8c",
                ValidatedIdentity = false,
                ContactedOn       = DateTime.Now.AddDays(4)
            };

            InsertPatientNoteDataRequest request = new InsertPatientNoteDataRequest
            {
                Context        = context,
                ContractNumber = contractNumber,
                UserId         = userId,
                Version        = version,
                PatientNote    = data,
                PatientId      = "5429d29984ac050c788bd34f",
            };

            string requestURL = string.Format("{0}/{1}/{2}/{3}/Patient/{4}/Note", url, context, version, contractNumber, data.PatientId);
            //[Route("/{Context}/{Version}/{ContractNumber}/Patient/{PatientId}/Note", "POST")]
            InsertPatientNoteDataResponse response = client.Post <InsertPatientNoteDataResponse>(requestURL, request);

            Assert.IsNotNull(response);
        }
예제 #2
0
        public object Insert(object newEntity)
        {
            InsertPatientNoteDataRequest request = (InsertPatientNoteDataRequest)newEntity;
            PatientNoteData noteData             = request.PatientNote;
            string          noteId = string.Empty;
            MEPatientNote   meN    = null;

            try
            {
                if (noteData != null)
                {
                    meN = new MEPatientNote(this.UserId, noteData.CreatedOn)
                    {
                        PatientId         = ObjectId.Parse(noteData.PatientId),
                        Text              = noteData.Text,
                        ProgramIds        = Helper.ConvertToObjectIdList(noteData.ProgramIds),
                        ValidatedIdentity = noteData.ValidatedIdentity,
                        ContactedOn       = noteData.ContactedOn,
                        Type              = ObjectId.Parse(noteData.TypeId),
                        DeleteFlag        = false,
                        DataSource        = Helper.TrimAndLimit(noteData.DataSource, 50),
                        LastUpdatedOn     = noteData.UpdatedOn,
                        ExternalRecordId  = noteData.ExternalRecordId,
                        Duration          = noteData.Duration,
                    };

                    if (!string.IsNullOrEmpty(noteData.MethodId))
                    {
                        meN.MethodId = ObjectId.Parse(noteData.MethodId);
                    }
                    if (!string.IsNullOrEmpty(noteData.OutcomeId))
                    {
                        meN.OutcomeId = ObjectId.Parse(noteData.OutcomeId);
                    }
                    if (!string.IsNullOrEmpty(noteData.WhoId))
                    {
                        meN.WhoId = ObjectId.Parse(noteData.WhoId);
                    }
                    if (!string.IsNullOrEmpty(noteData.SourceId))
                    {
                        meN.SourceId = ObjectId.Parse(noteData.SourceId);
                    }

                    using (PatientNoteMongoContext ctx = new PatientNoteMongoContext(ContractDBName))
                    {
                        ctx.PatientNotes.Collection.Insert(meN);

                        AuditHelper.LogDataAudit(this.UserId,
                                                 MongoCollectionName.PatientNote.ToString(),
                                                 meN.Id.ToString(),
                                                 Common.DataAuditType.Insert,
                                                 request.ContractNumber);

                        noteId = meN.Id.ToString();
                    }
                }
                return(noteId);
            }
            catch (Exception) { throw; }
        }
예제 #3
0
        public void InsertPatientNote_Test()
        {
            PatientNoteData n = new PatientNoteData {
                Text = "Note D data domain", PatientId = "531f2dcf072ef727c4d2a150", CreatedById = "531f2df5072ef727c4d2a3bc"
            };
            InsertPatientNoteDataRequest request = new InsertPatientNoteDataRequest {
                Version     = 1,
                PatientNote = n
            };
            string id = m.InsertPatientNote(request);

            Assert.IsNotNull(id);
        }
예제 #4
0
        public string InsertPatientNote(InsertPatientNoteDataRequest request)
        {
            string noteId = string.Empty;

            try
            {
                IMongoPatientNoteRepository repo = Factory.GetRepository(RepositoryType.PatientNote);
                noteId = (string)repo.Insert(request);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(noteId);
        }
예제 #5
0
        public InsertPatientNoteDataResponse Post(InsertPatientNoteDataRequest request)
        {
            InsertPatientNoteDataResponse response = new InsertPatientNoteDataResponse();

            try
            {
                RequireUserId(request);
                response.Id      = Manager.InsertPatientNote(request);
                response.Version = request.Version;
            }
            catch (Exception ex)
            {
                RaiseException(response, ex);
            }
            return(response);
        }
예제 #6
0
 public string InsertPatientNote(InsertPatientNoteDataRequest request)
 {
     throw new NotImplementedException();
 }