public void IsValid()
 {
     var item = new MedicalRecordDto()
     {
         Name = Guid.NewGuid().ToString(),
         CreationDate = DateTime.Today,
     };
     Assert.IsTrue(item.IsValid());
 }
 public void IsInvalid_NoDate()
 {
     var item = new MedicalRecordDto()
     {
         Name = Guid.NewGuid().ToString(),
         CreationDate = DateTime.MinValue,
     };
     Assert.IsFalse(item.IsValid());
 }
 public void IsInvalid_NoName()
 {
     var item = new MedicalRecordDto()
     {
         Name = string.Empty,
         CreationDate = DateTime.Today,
     };
     Assert.IsFalse(item.IsValid());
 }
示例#4
0
        /// <summary>
        /// Creates the specified record and link it to the specidied patient.
        /// </summary>
        /// <param name="record">The record.</param>
        /// <param name="forPatient">For patient.</param>
        public void Create(MedicalRecordDto record, LightPatientDto forPatient)
        {
            Assert.IsNotNull(record, "item");

            var foundPatient = (from p in this.Session.Query<Patient>()
                                where p.Id == forPatient.Id
                                select p).FirstOrDefault();
            if (foundPatient == null) throw new EntityNotFoundException(typeof(Patient));

            var recEntity = Mapper.Map<MedicalRecordDto, MedicalRecord>(record);

            foundPatient.MedicalRecords.Add(recEntity);

            this.Session.SaveOrUpdate(foundPatient);
        }
示例#5
0
        /// <summary>
        /// Create the specified item into the database
        /// </summary>
        /// <param name="item">The item to add in the database</param>
        public void Create(MedicalRecordDto item)
        {
            Assert.IsNotNull(item, "item");

            var found = (from p in this.Session.Query<MedicalRecord>()
                         where p.Id == item.Id
                         select p).ToList().Count() > 0;
            if (found) throw new ExistingItemException();

            var entity = Mapper.Map<MedicalRecordDto, MedicalRecord>(item);
            this.Session.Save(entity);
        }
 /// <summary>
 /// Creates the specified record and link it to the specidied patient.
 /// </summary>
 /// <param name="record">The record.</param>
 /// <param name="forPatient">For patient.</param>
 public void Create(MedicalRecordDto record, LightPatientDto forPatient)
 {
     new Creator(this.Session).Create(record, forPatient);
 }
示例#7
0
 public AddRecordViewModel()
 {
     PluginContext.Host.UserConnected += (sender, e) => this.component = PluginContext.ComponentFactory.GetInstance<IMedicalRecordComponent>();
     this.recordToAdd = new MedicalRecordDto();
     this.addRecordCommand = new RelayCommand(() => this.AddRecord(), () => this.CanAddRecord());
 }
        /// <summary>
        /// Revert the specified medical record into the specified state
        /// </summary>
        /// <param name="record">The record.</param>
        /// <param name="toState">The state.</param>
        public void Revert(MedicalRecordDto record, MedicalRecordStateDto toState)
        {
            Assert.IsNotNull(toState, "toState");

            record.Rtf = toState.Rtf;
            record.Tag = toState.Tag;
            record.LastUpdate = DateTime.Now;

            new Updator(this.Session).Update(record);
        }
 /// <summary>
 /// Gets the history of the specified medical record.
 /// </summary>
 /// <param name="record">The record.</param>
 /// <returns>The items contained in the history</returns>
 public IEnumerable<MedicalRecordStateDto> GetHistory(MedicalRecordDto record)
 {
     var history = this.Session.Get<MedicalRecord>(record.Id);
     return Mapper.Map<IEnumerable<MedicalRecordState>, IEnumerable<MedicalRecordStateDto>>(history.PreviousStates);
 }
 public static TitledMedicalRecordDto CreateFrom(MedicalRecordDto record)
 {
     return Mapper.Map<MedicalRecordDto, TitledMedicalRecordDto>(record);
 }
示例#11
0
        private void LoadRecords(object[] addedItems)
        {
            try
            {
                if (addedItems != null && addedItems.Length > 0)
                {
                    this.MedicalRecordCabinet = this.component.GetMedicalRecordCabinet(addedItems[0] as LightPatientDto);
                    PluginContext.Host.WriteStatus(StatusType.Info, Messages.Msg_MedicalRecordLoaded);

                    if (this.MedicalRecordCabinet != null && this.MedicalRecordCabinet.Folders.Count > 0)
                    {
                        this.SelectedFolder = this.MedicalRecordCabinet.Folders[0];
                    }
                    if (this.SelectedFolder != null && this.SelectedFolder.Records.Count > 0)
                    {
                        this.SelectedRecord = this.SelectedFolder.Records[0];
                    }
                }
                else { return; }
            }
            catch (Exception ex) { this.Handle.Error(ex); }
        }
示例#12
0
 /// <summary>
 /// Refreshes the whole data of this instance.
 /// </summary>
 public void Refresh()
 {
     try
     {
         var family = this.component.GetFamily(PluginContext.Host.SelectedPatient);
         this.FamilyMembers.Refill(family.ToPatients());
         this.SelectedFolder = null;
         this.SelectedRecord = null;
     }
     catch (Exception ex) { this.Handle.Error(ex); }
 }