예제 #1
0
        public ServiceResult Update(Symptom s)
        {
            if (s == null)
            {
                return(ServiceResponse.Error("Invalid Symptom sent to server."));
            }

            SymptomManager symptomManager = new SymptomManager(Globals.DBConnectionKey, this.GetAuthToken(Request));
            var            res            = symptomManager.Get(s.UUID);

            if (res.Code != 200)
            {
                return(res);
            }

            var dbS = (Symptom)res.Result;

            if (dbS.DateCreated == DateTime.MinValue)
            {
                dbS.DateCreated = DateTime.UtcNow;
            }
            dbS.Deleted   = s.Deleted;
            dbS.Name      = s.Name;
            dbS.Status    = s.Status;
            dbS.SortOrder = s.SortOrder;

            return(symptomManager.Update(dbS));
        }
예제 #2
0
        public ServiceResult Insert(Symptom n)
        {
            if (CurrentUser == null)
            {
                return(ServiceResponse.Error("You must be logged in to access this function."));
            }

            if (string.IsNullOrWhiteSpace(n.AccountUUID) || n.AccountUUID == SystemFlag.Default.Account)
            {
                n.AccountUUID = CurrentUser.AccountUUID;
            }

            if (string.IsNullOrWhiteSpace(n.CreatedBy))
            {
                n.CreatedBy = CurrentUser.UUID;
            }

            if (n.DateCreated == DateTime.MinValue)
            {
                n.DateCreated = DateTime.UtcNow;
            }

            SymptomManager symptomManager = new SymptomManager(Globals.DBConnectionKey, this.GetAuthToken(Request));

            return(symptomManager.Insert(n));
        }
예제 #3
0
        public void SymptomManager_DeleteSymptomLog()
        {
            SymptomManager m = new SymptomManager(new TreeMonDbContext(connectionKey));
            SymptomLog     s = new SymptomLog()
            {
                AccountId   = "a",
                Name        = "DELETERECORD",
                CreatedBy   = "TESTUSER",
                DateCreated = DateTime.UtcNow,
                DoseUUID    = "D"
            };

            m.InsertLog(s);

            //Test the delete flag
            Assert.IsTrue(m.DeleteSymptomLog(s) > 0);
            m.GetSymptomLog("DELETERECORD");
            SymptomLog d = m.GetSymptomLog("DELETERECORD");

            Assert.IsNotNull(d);
            Assert.IsTrue(d.Deleted == true);


            Assert.IsTrue(m.DeleteSymptomLog(s, true) > 0);
            d = m.GetSymptomLog("DELETERECORD");
            Assert.IsNull(d);
        }
예제 #4
0
        public void SymptomManager_GetSymptomLogs()
        {
            SymptomManager    m    = new SymptomManager(new TreeMonDbContext(connectionKey));
            List <SymptomLog> logs = m.GetSymptomsLog("a");

            Assert.IsTrue(logs.Count > 0);
        }
예제 #5
0
        public void SymptomManager_Insert_SymptomLog()
        {
            SymptomManager m = new SymptomManager(new TreeMonDbContext(connectionKey));

            Assert.AreEqual(
                m.InsertLog(new SymptomLog()
            {
                AccountId   = "a",
                Name        = "TESTRECORD",
                DateCreated = DateTime.UtcNow
                , DoseUUID  = "D"
            }, false)
                .Code, 200);

            //won't allow a duplicate name
            Assert.AreEqual(
                m.InsertLog(new SymptomLog()
            {
                AccountId   = "a",
                Name        = "TESTRECORD",
                DateCreated = DateTime.UtcNow
                ,
                DoseUUID = "D"
            })
                .Code, 500);
        }
예제 #6
0
        public ServiceResult Update(Symptom s)
        {
            if (s == null)
            {
                return(ServiceResponse.Error("Invalid Symptom sent to server."));
            }

            SymptomManager symptomManager = new SymptomManager(Globals.DBConnectionKey, Request.Headers?.Authorization?.Parameter);

            var dbS = (Symptom)symptomManager.GetBy(s.UUID);

            if (dbS == null)
            {
                return(ServiceResponse.Error("Symptom was not found."));
            }

            if (dbS.DateCreated == DateTime.MinValue)
            {
                dbS.DateCreated = DateTime.UtcNow;
            }
            dbS.Deleted   = s.Deleted;
            dbS.Name      = s.Name;
            dbS.Status    = s.Status;
            dbS.SortOrder = s.SortOrder;

            return(symptomManager.Update(dbS));
        }
예제 #7
0
        public ServiceResult UpdateSymptomLogField(string symptomLogUUID, string fieldName, string fieldValue)
        {
            if (string.IsNullOrWhiteSpace(symptomLogUUID))
            {
                return(ServiceResponse.Error("You must provide a UUID."));
            }

            if (string.IsNullOrWhiteSpace(fieldName))
            {
                return(ServiceResponse.Error("You must provide a field name."));
            }

            if (string.IsNullOrWhiteSpace(fieldValue))
            {
                return(ServiceResponse.Error("You must provide a field value."));
            }

            if (CurrentUser == null)
            {
                return(ServiceResponse.Error("You must be logged in to access this function."));
            }

            SymptomManager symptomManager = new SymptomManager(Globals.DBConnectionKey, this.GetAuthToken(Request));

            SymptomLog sl = symptomManager.GetSymptomLogBy(symptomLogUUID);

            if (sl == null)
            {
                return(ServiceResponse.Error("Could not find the log item."));
            }

            if (CurrentUser.UUID != sl.CreatedBy)
            {
                return(ServiceResponse.Error("You are not authorized to change this item."));
            }

            bool success = false;

            fieldName = fieldName.ToLower();

            switch (fieldName)
            {
            case "duration":
                sl.Duration = fieldValue.ConvertTo <float>(out success);
                if (!success)
                {
                    return(ServiceResponse.Error("Invalid field value."));
                }
                break;

            case "durationmeasure":
                sl.DurationMeasure = fieldValue;
                break;

            default:
                return(ServiceResponse.Error("Field " + fieldName + " not supported."));
            }
            return(symptomManager.Update(sl));
        }
예제 #8
0
        public ServiceResult Delete(SymptomLog s)
        {
            if (s == null || string.IsNullOrWhiteSpace(s.UUID))
            {
                return(ServiceResponse.Error("Invalid account was sent."));
            }

            SymptomManager symptomManager = new SymptomManager(Globals.DBConnectionKey, this.GetAuthToken(Request));

            return(symptomManager.Delete(s));
        }
예제 #9
0
        public ServiceResult GetBy(string uuid)
        {
            if (string.IsNullOrWhiteSpace(uuid))
            {
                return(ServiceResponse.Error("You must provide a name for the Symptom."));
            }

            SymptomManager symptomManager = new SymptomManager(Globals.DBConnectionKey, this.GetAuthToken(Request));

            return(symptomManager.Get(uuid));
        }
예제 #10
0
        public ServiceResult Delete(SymptomLog s)
        {
            if (s == null || string.IsNullOrWhiteSpace(s.UUID))
            {
                return(ServiceResponse.Error("Invalid account was sent."));
            }

            SymptomManager symptomManager = new SymptomManager(Globals.DBConnectionKey, Request.Headers?.Authorization?.Parameter);

            return(symptomManager.Delete(s));
        }
예제 #11
0
        public void SymptomManager_GetSymptom()
        {
            SymptomManager m  = new SymptomManager(new TreeMonDbContext(connectionKey));
            ServiceResult  sr = m.Insert(new Symptom()
            {
                AccountId   = "a",
                Name        = "ALPHA",
                DateCreated = DateTime.UtcNow
            }, false);

            Assert.AreEqual(sr.Code, 200, sr.Message);
            Symptom s = m.GetSymptom("ALPHA");

            Assert.IsNotNull(s);
        }
예제 #12
0
        public ServiceResult GetSymptoms()
        {
            if (CurrentUser == null)
            {
                return(ServiceResponse.Error("You must be logged in to access this function."));
            }

            DataFilter     filter         = this.GetFilter(Request);
            SymptomManager symptomManager = new SymptomManager(Globals.DBConnectionKey, this.GetAuthToken(Request));

            List <dynamic> Symptoms = symptomManager.GetSymptoms(CurrentUser.AccountUUID).Cast <dynamic>().ToList();

            Symptoms = Symptoms.Filter(ref filter);
            return(ServiceResponse.OK("", Symptoms, filter.TotalRecordCount));
        }
예제 #13
0
        public void SymptomManager_GetSymptomsByDose()
        {
            SymptomManager m = new SymptomManager(new TreeMonDbContext(connectionKey));

            Assert.AreEqual(
                m.InsertLog(new SymptomLog()
            {
                AccountId   = "a",
                Name        = "TESTRECORD",
                DateCreated = DateTime.UtcNow,
                DoseUUID    = "D"
            }, false)
                .Code, 200);

            Assert.IsTrue(m.GetSymptomsByDose("D", "", "a").Count > 0);
        }
예제 #14
0
        public ServiceResult GetSymptoms(string filter = "")
        {
            if (CurrentUser == null)
            {
                return(ServiceResponse.Error("You must be logged in to access this function."));
            }

            DataFilter     tmpFilter      = this.GetFilter(filter);
            SymptomManager symptomManager = new SymptomManager(Globals.DBConnectionKey, Request.Headers?.Authorization?.Parameter);

            List <dynamic> Symptoms = symptomManager.GetSymptoms(CurrentUser.AccountUUID).Cast <dynamic>().ToList();
            int            count    = 0;


            Symptoms = FilterEx.FilterInput(Symptoms, tmpFilter, out count);
            return(ServiceResponse.OK("", Symptoms, count));
        }
예제 #15
0
        public ServiceResult Get(string name)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                return(ServiceResponse.Error("You must provide a name for the Symptom."));
            }

            SymptomManager symptomManager = new SymptomManager(Globals.DBConnectionKey, this.GetAuthToken(Request));

            List <Symptom> s = symptomManager.Search(name);

            if (s == null || s.Count == 0)
            {
                return(ServiceResponse.Error("Symptom could not be located for the name " + name));
            }

            return(ServiceResponse.OK("", s));
        }
예제 #16
0
        public ServiceResult GetSymptomLog(string name = "")
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                return(ServiceResponse.Error("You must provide a name for the SymptomLog."));
            }

            SymptomManager symptomManager = new SymptomManager(Globals.DBConnectionKey, this.GetAuthToken(Request));

            SymptomLog s = symptomManager.GetSymptomLog(name);

            if (s == null)
            {
                return(ServiceResponse.Error("SymptomLog could not be located for the name " + name));
            }

            return(ServiceResponse.OK("", s));
        }
예제 #17
0
        public void SymptomManager_UpdateSymptom()
        {
            SymptomManager m = new SymptomManager(new TreeMonDbContext(connectionKey));

            m.Insert(new Symptom()
            {
                AccountId = "a",
                Name      = "TESTRECORD",
            });
            Symptom s = m.GetSymptom("TESTRECORD");

            s.Name = "UPDATEDRECORD";

            Assert.AreEqual(m.UpdateSymptom(s).Code, 200);
            Symptom u = m.GetSymptom("UPDATEDRECORD");

            Assert.IsNotNull(u);
        }
예제 #18
0
        public ServiceResult GetBy(string uuid)
        {
            if (string.IsNullOrWhiteSpace(uuid))
            {
                return(ServiceResponse.Error("You must provide a name for the Symptom."));
            }

            SymptomManager symptomManager = new SymptomManager(Globals.DBConnectionKey, Request.Headers?.Authorization?.Parameter);

            Symptom s = (Symptom)symptomManager.Get(uuid);

            if (s == null)
            {
                return(ServiceResponse.Error("Symptom could not be located for the uuid " + uuid));
            }

            return(ServiceResponse.OK("", s));
        }
예제 #19
0
        public void SymptomManager_GetSymptomBy()
        {
            SymptomManager m = new SymptomManager(new TreeMonDbContext(connectionKey));

            Assert.AreEqual(
                m.Insert(new Symptom()
            {
                AccountId   = "a",
                Name        = "TESTRECORD",
                DateCreated = DateTime.UtcNow
            }, false)
                .Code, 200);
            Symptom s = m.GetSymptom("TESTRECORD");

            Assert.IsNotNull(s);
            Symptom suid = m.GetSymptomBy(s.UUID);

            Assert.IsNotNull(suid);
        }
예제 #20
0
        public ServiceResult Update(SymptomLog s)
        {
            if (s == null)
            {
                return(ServiceResponse.Error("Invalid SymptomLog sent to server."));
            }

            SymptomManager symptomManager = new SymptomManager(Globals.DBConnectionKey, this.GetAuthToken(Request));

            var dbS = symptomManager.GetSymptomLogBy(s.UUID);

            if (dbS == null)
            {
                return(ServiceResponse.Error("SymptomLog was not found."));
            }

            if (s.Efficacy < -5 || s.Efficacy > 5)
            {
                return(ServiceResponse.Error("Efficacy is out of range."));
            }

            if (CurrentUser == null)
            {
                return(ServiceResponse.Error("You must be logged in to access this function."));
            }

            if (CurrentUser.UUID != dbS.CreatedBy)
            {
                return(ServiceResponse.Error("You are not authorized to change this item."));
            }

            dbS.Name            = s.Name;
            dbS.Status          = s.Status;
            dbS.Duration        = s.Duration;
            dbS.DurationMeasure = s.DurationMeasure;
            dbS.Efficacy        = s.Efficacy;
            dbS.Severity        = s.Severity;
            dbS.SymptomDate     = s.SymptomDate;

            //test this.make sure date, status, severity, efficacy etc is copied over.

            return(symptomManager.Update(dbS));
        }
예제 #21
0
        public ServiceResult GetChildSymptomLogs(string doseUUID, string parentUUID = "")
        {
            if (CurrentUser == null)
            {
                return(ServiceResponse.Error("You must be logged in to access this function."));
            }

            if (string.IsNullOrWhiteSpace(doseUUID))
            {
                return(ServiceResponse.Error("You must send a dose uuid."));
            }

            SymptomManager symptomManager = new SymptomManager(Globals.DBConnectionKey, this.GetAuthToken(Request));

            List <dynamic> SymptomsLog = symptomManager.GetSymptomsByDose(doseUUID, parentUUID, CurrentUser.AccountUUID).Cast <dynamic>().ToList();

            DataFilter filter = this.GetFilter(Request);

            SymptomsLog = SymptomsLog.Filter(ref filter);
            return(ServiceResponse.OK("", SymptomsLog, filter.TotalRecordCount));
        }
예제 #22
0
        public ServiceResult SetRating(string uuid, string type, float score)
        {
            if (CurrentUser == null)
            {
                return(ServiceResponse.Error("You must be logged in to access this function."));
            }


            if (string.IsNullOrWhiteSpace(uuid))
            {
                return(ServiceResponse.Error("You must supply a unique identifier."));
            }
            if (string.IsNullOrWhiteSpace(type))
            {
                return(ServiceResponse.Error("You must supply a type identifier."));
            }

            type = type.ToUpper().Trim();
            switch (type)
            {
            case "SYMPTOMLOG":
                SymptomManager symptomManager = new SymptomManager(Globals.DBConnectionKey, Request.Headers?.Authorization?.Parameter);
                SymptomLog     sl             = symptomManager.GetSymptomLogBy(uuid);
                if (sl == null)
                {
                    return(ServiceResponse.Error("Could not find symptom."));
                }

                if (sl.CreatedBy != CurrentUser.UUID)    //|| sl.AccountId != currentUser.AccountId)
                {
                    return(ServiceResponse.Error("You are not authorized to rate this item."));
                }

                sl.Efficacy = score;
                return(symptomManager.Update(sl));
            }

            return(ServiceResponse.Error("Invalid type:" + type));
        }
예제 #23
0
        public ServiceResult GetChildSymptomLogs(string doseUUID, string parentUUID = "", string filter = "")
        {
            if (CurrentUser == null)
            {
                return(ServiceResponse.Error("You must be logged in to access this function."));
            }

            if (string.IsNullOrWhiteSpace(doseUUID))
            {
                return(ServiceResponse.Error("You must send a dose uuid."));
            }

            SymptomManager symptomManager = new SymptomManager(Globals.DBConnectionKey, Request.Headers?.Authorization?.Parameter);

            List <dynamic> SymptomsLog = symptomManager.GetSymptomsByDose(doseUUID, parentUUID, CurrentUser.AccountUUID).Cast <dynamic>().ToList();

            int        count;
            DataFilter tmpFilter = this.GetFilter(filter);

            SymptomsLog = FilterEx.FilterInput(SymptomsLog, tmpFilter, out count);
            return(ServiceResponse.OK("", SymptomsLog, count));
        }
예제 #24
0
        public ServiceResult Insert(DoseLogForm d)
        {
            string authToken = this.GetAuthToken(Request);

            //d.UserUUID  <= patient id. for now make this a hidden field and use the cookie value.
            //               for an app that uses multiple patients then we'll need make a combobox or some list to select
            //whom we're logging for.

            if (CurrentUser == null)
            {
                return(ServiceResponse.Error("You must be logged in to access this function."));
            }

            UserSession us = SessionManager.GetSession(authToken);

            if (us == null)
            {
                return(ServiceResponse.Error("You must be logged in to access this function."));
            }

            if (us.Captcha?.ToUpper() != d.Captcha?.ToUpper())
            {
                return(ServiceResponse.Error("Invalid code."));
            }

            if (string.IsNullOrWhiteSpace(d.AccountUUID))
            {
                d.AccountUUID = CurrentUser.AccountUUID;
            }

            if (string.IsNullOrWhiteSpace(d.CreatedBy))
            {
                d.CreatedBy = us.UUID;
            }

            if (d.DateCreated == DateTime.MinValue)
            {
                d.DateCreated = DateTime.UtcNow;
            }

            d.Active  = true;
            d.Deleted = false;

            if (d.DoseDateTime == null || d.DoseDateTime == DateTime.MinValue)
            {
                return(ServiceResponse.Error("You must a date time for the dose."));
            }

            if (string.IsNullOrWhiteSpace(d.ProductUUID))
            {
                return(ServiceResponse.Error("You must select a product."));
            }

            ProductManager productManager = new ProductManager(Globals.DBConnectionKey, this.GetAuthToken(Request));
            var            res            = productManager.Get(d.ProductUUID);

            if (res.Code != 200)
            {
                return(res);// return ServiceResponse.Error("Product could not be found. You must select a product, or create one from the products page.");
            }
            Product p = (Product)res.Result;

            if (string.IsNullOrWhiteSpace(d.Name))
            {
                d.Name = string.Format("{0} {1} {2}", p.Name, d.Quantity, d.UnitOfMeasure);
            }

            if (d.Quantity <= 0)
            {
                return(ServiceResponse.Error("You must enter a quantity"));
            }

            if (string.IsNullOrWhiteSpace(d.UnitOfMeasure))
            {
                return(ServiceResponse.Error("You must select a unit of measure."));
            }

            UnitOfMeasureManager uomm = new UnitOfMeasureManager(Globals.DBConnectionKey, this.GetAuthToken(Request));

            if (uomm.Get(d.UnitOfMeasure) == null)
            {
                var           filter = new DataFilter();
                UnitOfMeasure uom    = (UnitOfMeasure)uomm.Search(d.UnitOfMeasure, ref filter)?.FirstOrDefault();
                if (uom == null)
                {
                    uom             = new UnitOfMeasure();
                    uom.Name        = d.UnitOfMeasure.Trim();
                    uom.AccountUUID = CurrentUser.AccountUUID;
                    uom.Active      = true;
                    uom.Deleted     = false;
                    uom.Private     = true;
                    ServiceResult uomSr = uomm.Insert(uom);
                    if (uomSr.Code != 200)
                    {
                        return(uomSr);
                    }
                }
                d.UnitOfMeasure = uom.UUID;
            }

            var config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <DoseLogForm, DoseLog>();
            });

            IMapper mapper = config.CreateMapper();
            var     dest   = mapper.Map <DoseLogForm, DoseLog>(d);

            DoseManager   DoseManager = new DoseManager(Globals.DBConnectionKey, this.GetAuthToken(Request));
            ServiceResult sr          = DoseManager.Insert(dest);

            if (sr.Code != 200)
            {
                return(sr);
            }

            SymptomManager sm            = new SymptomManager(Globals.DBConnectionKey, this.GetAuthToken(Request));
            StringBuilder  symptomErrors = new StringBuilder();

            int index = 1;

            foreach (SymptomLog s in d.Symptoms)
            {
                if (string.IsNullOrWhiteSpace(s.UUID))
                {
                    symptomErrors.AppendLine("Symptom " + index + " UUID must be set!");
                    Debug.Assert(false, "SYMPTOM UUID MUST BE SET!!");
                    continue;
                }

                var res2 = sm.Get(s.UUID);
                if (res2.Code != 200)
                {
                    continue;
                }

                Symptom stmp = (Symptom)res2.Result;

                s.Name = stmp.Name;

                if (s.SymptomDate == null || s.SymptomDate == DateTime.MinValue)
                {
                    symptomErrors.AppendLine("Symptom " + s.UUID + " date must be set!");
                    continue;
                }
                //s.Status
                s.AccountUUID = CurrentUser.AccountUUID;
                s.Active      = true;
                s.CreatedBy   = CurrentUser.UUID;
                s.DateCreated = DateTime.UtcNow;
                s.Deleted     = false;
                s.DoseUUID    = dest.UUID;
                s.Private     = true;
                ServiceResult slSr = sm.Insert(s);

                if (slSr.Code != 200)
                {
                    symptomErrors.AppendLine("Symptom " + index + " failed to save. " + slSr.Message);
                }
                index++;
            }

            if (symptomErrors.Length > 0)
            {
                return(ServiceResponse.Error(symptomErrors.ToString()));
            }

            return(ServiceResponse.OK("", dest));
        }
예제 #25
0
        public void SymptomManager_GetSymptoms()
        {
            SymptomManager m = new SymptomManager(new TreeMonDbContext(connectionKey));

            Assert.IsTrue(m.GetSymptoms("a").Count > 0);
        }
예제 #26
0
        public ServiceResult AddSymptomLog(SymptomLog s)
        {
            if (CurrentUser == null)
            {
                return(ServiceResponse.Error("You must be logged in to access this function."));
            }

            if (string.IsNullOrWhiteSpace(s.AccountUUID) || s.AccountUUID == SystemFlag.Default.Account)
            {
                s.AccountUUID = CurrentUser.AccountUUID;
            }

            if (string.IsNullOrWhiteSpace(s.CreatedBy))
            {
                s.CreatedBy = CurrentUser.UUID;
            }

            SymptomManager symptomManager = new SymptomManager(Globals.DBConnectionKey, this.GetAuthToken(Request));

            if (!string.IsNullOrWhiteSpace(s.UUParentID))
            {
                SymptomLog parentLog = symptomManager.GetSymptomLogBy(s.UUParentID);
                if (parentLog == null)
                {
                    return(ServiceResponse.Error("Invalid log parent id. The UUParentID must belong to a valid Symptom Log entry."));
                }

                s.DoseUUID = parentLog.DoseUUID;
                if (string.IsNullOrWhiteSpace(s.UUParentIDType))
                {
                    s.UUParentIDType = parentLog.UUIDType;
                }
            }

            s.Active = true;

            if (string.IsNullOrWhiteSpace(s.UUIDType))
            {
                s.UUIDType = "SymptomLog";
            }

            //backlog go to dosehistory selsect a dose and in the symptomps list
            //click add . fill in the data and click
            //VERIFY the fields here.
            //rules for parent list symptom creation
            //Name <- may need to create
            //SymptomUUID <- may need to create
            if (string.IsNullOrWhiteSpace(s.Name) && string.IsNullOrWhiteSpace(s.SymptomUUID))
            {
                return(ServiceResponse.Error("You must select a symptom."));
            }
            else if (string.IsNullOrWhiteSpace(s.Name) && string.IsNullOrWhiteSpace(s.SymptomUUID) == false)
            {   //get and assign the name
                var res = symptomManager.Get(s.SymptomUUID);
                if (res.Code != 200)
                {
                    return(res);
                }

                Symptom symptom = (Symptom)res.Result;

                s.Name = symptom.Name;
            }
            else if (!string.IsNullOrWhiteSpace(s.Name) && string.IsNullOrWhiteSpace(s.SymptomUUID))
            {   //create the symptoms and assign it to the symptomuuid
                Symptom symptom = (Symptom)symptomManager.Search(s.Name)?.FirstOrDefault();

                if (symptom != null)
                {
                    s.SymptomUUID = symptom.UUID;
                }
                else
                {
                    symptom = new Symptom()
                    {
                        Name        = s.Name,
                        AccountUUID = s.AccountUUID,
                        Active      = true,
                        CreatedBy   = CurrentUser.UUID,
                        DateCreated = DateTime.UtcNow,
                        Deleted     = false,
                        UUIDType    = "Symptom",
                        Category    = "General"
                    };

                    ServiceResult sr = symptomManager.Insert(symptom);
                    if (sr.Code == 500)
                    {
                        return(ServiceResponse.Error(sr.Message));
                    }

                    s.SymptomUUID = symptom.UUID;
                }
            }

            if (s.SymptomDate == null || s.SymptomDate == DateTime.MinValue)
            {
                s.SymptomDate = DateTime.UtcNow;
            }

            if (string.IsNullOrWhiteSpace(s.Status))//Status start middle end. Query StatusMessage table
            {
                return(ServiceResponse.Error("You must provide a status."));
            }

            if (s.Severity > 5)
            {
                return(ServiceResponse.Error("Severity must not be greater than 5."));
            }
            if (s.Efficacy > 5)
            {
                return(ServiceResponse.Error("Efficacy must not be greater than 5."));
            }

            return(symptomManager.Insert(s));
        }