Ejemplo n.º 1
0
 private DrugUse EntityToModel(CR_DRUGUSE entity)
 {
     if (entity != null)
     {
         var model = new DrugUse()
         {
             ID                = entity.ID,
             DISEASEID         = entity.DISEASEID,
             USERID            = entity.USERID,
             DRUGTYPE          = entity.DRUGTYPE,
             DRUGNAME          = entity.DRUGNAME,
             DRUGID            = entity.DRUGID,
             TREATMENTDISEASES = entity.TREATMENTDISEASES,
             STARTTIME         = entity.STARTTIME,
             ENDTIME           = entity.ENDTIME,
             TIMESADAY         = entity.TIMESADAY,
             DOSE              = entity.DOSE,
             UNITS             = entity.UNITS,
             USEDAY            = entity.USEDAY,
             ISNEWDRUG         = entity.ISNEWDRUG,
             CREATEUSERID      = entity.CREATEUSERID,
             CREATEDATETIME    = entity.CREATEDATETIME,
             EDITUSERID        = entity.EDITUSERID,
             EDITDATETIME      = entity.EDITDATETIME,
             ISDELETED         = entity.ISDELETED,
             OWNERID           = entity.OWNERID
         };
         return(model);
     }
     return(null);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 添加用药情况
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool AddDrugUse(DrugUse model)
        {
            context.CR_DRUGUSE.Add(ModelToEntity(model));

            if (model.InterEffect.Any())
            {
                foreach (var drugEffect2 in model.InterEffect)
                {
                    var item = ModelToEntity(drugEffect2);
                    item.DISEASEID = model.DISEASEID;
                    item.DRUGID    = model.DRUGID;
                    context.CR_DRUGEFFECT.Add(item);
                }
            }
            if (model.GeneEffect.Any())
            {
                foreach (var drugGeneInfo in model.GeneEffect)
                {
                    var item = ModelToEntity(drugGeneInfo);
                    item.DISEASEID = model.DISEASEID;
                    item.DRUGID    = model.DRUGID;
                    context.CR_GENEEFFECT.Add(item);
                }
            }

            return(context.SaveChanges() > 0);
        }
Ejemplo n.º 3
0
        private CR_DRUGUSE ModelToEntity(DrugUse model)
        {
            if (model != null)
            {
                var entity = new CR_DRUGUSE()
                {
                    ID                = context.Database.SqlQuery <int>("select CR_DRUGUSE_ID.nextval from dual").FirstOrDefault(),
                    DISEASEID         = model.DISEASEID,
                    USERID            = model.USERID,
                    DRUGTYPE          = model.DRUGTYPE,
                    DRUGNAME          = model.DRUGNAME,
                    DRUGID            = model.DRUGID,
                    TREATMENTDISEASES = model.TREATMENTDISEASES,
                    STARTTIME         = model.STARTTIME,
                    ENDTIME           = model.ENDTIME,

                    TIMESADAY      = model.TIMESADAY,
                    DOSE           = model.DOSE,
                    UNITS          = model.UNITS,
                    USEDAY         = model.USEDAY,
                    ISNEWDRUG      = model.ISNEWDRUG,
                    CREATEUSERID   = model.CREATEUSERID,
                    CREATEDATETIME = model.CREATEDATETIME,
                    EDITUSERID     = model.EDITUSERID,
                    EDITDATETIME   = model.EDITDATETIME,
                    ISDELETED      = model.ISDELETED,
                    OWNERID        = model.OWNERID
                };
                return(entity);
            }
            return(null);
        }
Ejemplo n.º 4
0
        public bool UpdateDrugUse(DrugUse model)
        {
            var entity = context.CR_DRUGUSE.FirstOrDefault(u => u.ID == model.ID);

            if (entity != null)
            {
                entity.TREATMENTDISEASES = model.TREATMENTDISEASES;
                entity.USEDAY            = model.USEDAY;
                entity.DOSE      = model.DOSE;
                entity.UNITS     = model.UNITS;
                entity.STARTTIME = model.STARTTIME;
                entity.ENDTIME   = model.ENDTIME;
                entity.TIMESADAY = model.TIMESADAY;
            }
            return(context.SaveChanges() > 0);
        }
Ejemplo n.º 5
0
        public IHttpActionResult Post([FromBody] Request <DrugUse> request)
        {
            Response <string> response = new Response <string>();

            try
            {
                DrugUse model = request.Data as DrugUse;
                if (model == null)
                {
                    return(NotFound());
                }
                model.DISEASEID = model.DISEASEID == "" ? Guid.NewGuid().ToString() : model.DISEASEID;
                var cookie = HttpContext.Current.Request.Cookies["Token"].Value;
                if (model.Action == 1) //添加
                {
                    model.CREATEUSERID   = new UserInfoService().GetLoginInfo(cookie).UserId;
                    model.CREATEDATETIME = System.DateTime.Now;
                    model.EDITDATETIME   = System.DateTime.Now;
                    model.EDITUSERID     = new UserInfoService().GetLoginInfo(cookie).UserId;
                    model.OWNERID        = new UserInfoService().GetLoginInfo(cookie).UserId;
                    bool flag = pbll.AddDrugUse(model);
                }
                else //更新
                {
                    model.EDITDATETIME = System.DateTime.Now;
                    model.EDITUSERID   = new UserInfoService().GetLoginInfo(cookie).UserId;


                    bool flag = pbll.UpdateDrugUse(model);
                }
                response.Data = model.DISEASEID;
                return(Ok(response));
            }
            catch (Exception ex)
            {
                LogService.WriteErrorLog("PrescriptionController[Post]", ex.ToString());
                return(BadRequest(ex.Message));
            }
        }
Ejemplo n.º 6
0
        //"StarSI" type="bh:AdmissionStarSIDef" minOccurs="0"/>
        //"FamilyReunification" type="bh:AdmissionFamilyReunificationDef" minOccurs="0"/>
        //"WomensProgram" type="bh:AdmissionWomensProgramDef" minOccurs="0"/>
        //"PayingBoard" type="bh:BoardNumberDef" minOccurs="1" maxOccurs="unbounded"/>
        //"GAF" type="integer" minOccurs="0" maxOccurs="1"/>
        //"MHSecondary" type="bh:AddMHSecondaryDef" minOccurs="0" maxOccurs="1"/>

        public void Initialize()
        {
            DateOfFirstContact       = DateTime.Now.Date.AddMonths(-5);
            AdmissionDate            = DateOfFirstContact.AddDays(1);
            CompletelyPaidByMedicaid = false;
            LevelOfCare = new LevelOfCare();
            //"NotConsistentWithAssessment" type="bh:NotConsistentWithAssessmentDef" minOccurs="0"/>
            //"GamblingDisorderScreen" type="boolean" minOccurs="0"/>
            //"GamblingDisorderAssessment" type="boolean" minOccurs="0"/>
            //"ProviderEpisodeNumber" type="bh:ProviderEpisodeNumberDef" minOccurs="0"/>
            ReferredBy                 = new ReferredBy();
            MaritalStatus              = new MaritalStatus();
            EducationLevel             = new EducationLevel();
            EducationEnrollment        = new EducationEnrollment();
            EmploymentStatus           = new EmploymentStatus();
            SourceOfIncomeSupport      = new SourceOfIncomeSupport();
            LivingArrangement          = new LivingArrangement();
            PriorAODTxtEpisodes        = new PriorAODTxtEpisodes();
            MentalHealthHistory        = true;
            Diagnoses                  = new Diagnoses();
            OpioidReplacementTherapy   = new OpioidReplacementTherapy();
            NumberOfChildrenUnder18    = 2;
            SpecialPopulation          = new SpecialPopulation();
            ChildBirthWithinLast5Years = true;
            NumberOfBirths             = 0;
            ClientPregnant             = false;
            StageOfPregnancy           = new StageOfPregnancy();
            MilitaryStatus             = new MilitaryStatus();
            ServedInIraq               = false;
            ServedInAfghanistan        = false;
            AlcoholAgeOfFirstIntox     = 15;
            DrugUse = new DrugUse();
            NumberOfArrestsPast30Days = 0;
            Reimbursement             = new Reimbursement();
            SelfHelp = new SelfHelp();
        }
Ejemplo n.º 7
0
        public Admission(int id, Client client, DateTime dateOfFirstContact, DateTime admissionDate, bool completelyPaidByMedicaid, LevelOfCare levelOfCare, ReferredBy referredBy, MaritalStatus maritalStatus, EducationLevel educationLevel, EducationEnrollment educationEnrollment, EmploymentStatus employmentStatus, SourceOfIncomeSupport sourceOfIncomeSupport, LivingArrangement livingArrangement, PriorAODTxtEpisodes priorAODTxtEpisodes, bool mentalHealthHistory, Diagnoses diagnoses, OpioidReplacementTherapy opioidReplacementTherapy, int numberOfChildrenUnder18, SpecialPopulation specialPopulation, bool childBirthWithinLast5Years, int numberOfBirths, bool clientPregnant, StageOfPregnancy stageOfPregnancy, MilitaryStatus militaryStatus, bool servedInIraq, bool servedInAfghanistan, int alcoholAgeOfFirstIntox, DrugUse drugUse, int numberOfArrestsPast30Days, Reimbursement reimbursement, SelfHelp selfHelp)
        {
            this.id = id;
            RaiseIfClientIsNull("Admission Client", client);
            RaiseIfTooOld("Date of First Contact", dateOfFirstContact, new DateTime(2000, 1, 1));
            RaiseIfTooOld("Admission Date", admissionDate, new DateTime(2000, 1, 1));
            RaiseIfDateTooEarly("Admission Date", admissionDate, "Date of First Contact", dateOfFirstContact);
            this.dateOfFirstContact       = dateOfFirstContact;
            this.admissionDate            = admissionDate;
            this.completelyPaidByMedicaid = completelyPaidByMedicaid;

            RaiseIfNull("Level of Care", levelOfCare);
            this.levelOfCare = levelOfCare;

            RaiseIfNull("Referred By", referredBy);
            this.referredBy = referredBy;

            RaiseIfNull("Marital Status", maritalStatus);
            this.maritalStatus = maritalStatus;

            RaiseIfNull("Education Level", educationLevel);
            this.educationLevel = educationLevel;

            RaiseIfNull("Education Enrollment", educationEnrollment);
            this.educationEnrollment = educationEnrollment;

            RaiseIfNull("Employment Status", employmentStatus);
            this.employmentStatus = employmentStatus;

            RaiseIfNull("Source of Income Support", sourceOfIncomeSupport);
            this.sourceOfIncomeSupport = sourceOfIncomeSupport;

            //RaiseIfNull("Living Arrangement", livingArrangement);
            this.livingArrangement = livingArrangement;

            //RaiseIfNull("Prior AOD Treatment Episodes", priorAODTxtEpisodes);
            this.priorAODTxtEpisodes = priorAODTxtEpisodes;

            //RaiseIfNull("", );
            this.mentalHealthHistory      = mentalHealthHistory;
            this.diagnoses                = diagnoses;
            this.opioidReplacementTherapy = opioidReplacementTherapy;

            RaiseIfNotInRange("Number of Children Under 18", numberOfChildrenUnder18, 0, 99);
            this.numberOfChildrenUnder18 = numberOfChildrenUnder18;

            this.specialPopulation = specialPopulation;

            RaiseIfChildbirthTrueAndClientIsMale("Childbirth Within Last 5 Years", childBirthWithinLast5Years, client.Gender);
            this.childBirthWithinLast5Years = childBirthWithinLast5Years;


            this.numberOfBirths         = numberOfBirths;
            this.clientPregnant         = clientPregnant;
            this.stageOfPregnancy       = stageOfPregnancy;
            this.militaryStatus         = militaryStatus;
            this.servedInIraq           = servedInIraq;
            this.servedInAfghanistan    = servedInAfghanistan;
            this.alcoholAgeOfFirstIntox = alcoholAgeOfFirstIntox;
            this.drugUse = drugUse;
            this.numberOfArrestsPast30Days = numberOfArrestsPast30Days;
            this.reimbursement             = reimbursement;
            this.selfHelp = selfHelp;
        }