public ReasonForHospitalization AddReasHosp(ReasonForHospitalization ReasHos)
        {
            ReasonForHospitalization reashosp = _reasonhospital.FindAll().OrderBy(p => p.ReasonId).Last();

            ReasHos._id = ObjectId.GenerateNewId().ToString();
            Int32 reasonid = reashosp.ReasonId + 1;

            ReasHos.ReasonId = reasonid;
            if (ReasHos.EncounterType == "P")
            {
                ReasHos.EncounterType = "I,A";
            }
            _reasonhospital.Insert(ReasHos);
            return(ReasHos);
        }
        public ReasonForHospitalization UpdateReason(ReasonForHospitalization Reason)
        {
            var reasexist = GetByUserId(Reason.UserId);

            if (Reason.EncounterType == "P")
            {
                if (Reason.UserId != "a8a56c1d-203c-4c53-9d95-972dec7a2ef5" || Reason.UserId == "b6c625f5-653a-429f-b134-5b4d128ce4e8" || Reason.UserId == "a24e6d62-414d-4434-bbe3-b3eec3a026e7")
                {
                    Reason.EncounterType = "I,A";
                }
            }
            ReasonForHospitalization reas = reasexist.Where(p => p._id == Reason._id).First();

            reas.Reason        = Reason.Reason;
            reas.EncounterType = Reason.EncounterType;

            _reasonhospital.Save(reas);

            return(reas);
        }