Exemple #1
0
        public ActionResult AssociatePhysician(int physicianId, int patientId, bool isPrimary)
        {
            //Save selected physician for current patient (The patient whos detail is being shown)
            PatientPhysician pPhysician = new PatientPhysician();

            pPhysician.PhysicianId = physicianId;
            pPhysician.PatientId   = patientId;
            pPhysician.IsPrimary   = isPrimary;
            _patientRepo.SavePatientPhysician(pPhysician);

            //Get list of saved patients for the current patient. and return  this list to the patient detail page via ajax.
            ViewBag.PPhysicians = _patientRepo.GetPatientPhysicians(patientId);
            return(PartialView("_PartialPhysicians"));
            //return "response done";
        }
Exemple #2
0
        protected void AssignPhysicianClick(object sender, EventArgs e)
        {
            // assign selected physician as following physician
            if (!String.IsNullOrEmpty(FollowingPhysicianId.SelectedValue) && PatientId != 0)
            {
                Physician phObj = new Physician();
                phObj.Get(Int32.Parse(FollowingPhysicianId.SelectedValue));
                if (!phObj.IsEmpty)
                {
                    PhysicianDa pda         = new PhysicianDa();
                    int         physicianId = Int32.Parse(phObj[Physician.PhysicianId].ToString());

                    PatientPhysicianDa ptPhDa = new PatientPhysicianDa();
                    DataTable          ptphDt = ptPhDa.ValidatePatientPhysician(PatientId, physicianId).Tables[0];
                    if (VerifyUnique(ptphDt))
                    {
                        AssignPhysicianErrorLBL.Text = String.Empty;

                        // NEW CODE, insert record though middle tier
                        PatientPhysician ptPhysician = new PatientPhysician();
                        ptPhysician[PatientPhysician.PatientId]   = PatientId;
                        ptPhysician[PatientPhysician.PhysicianId] = physicianId;
                        ptPhysician[PatientPhysician.PtPhRole]    = "Following";

                        UserController userCt        = new UserController();
                        int            currentUserId = userCt.GetUserId();
                        UserDa         currentUserDa = new UserDa();
                        DataSet        currentUserDs = currentUserDa.GetByUserId(userCt.GetUserId());

                        ptPhysician[PatientPhysician.EnteredTime] = DateTime.Now;
                        ptPhysician[PatientPhysician.EnteredBy]   = (currentUserDs.Tables.Count > 0 && currentUserDs.Tables[0].Rows.Count > 0) ? currentUserDs.Tables[0].Rows[0][BOL.User.UserName].ToString() : "not specified";
                        ptPhysician.Save();

                        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "_refreshPage", "refreshPage(); ", true);
                    }
                    else
                    {
                        AssignPhysicianErrorLBL.Text = "Physician " + phObj[Physician.PhFirstName].ToString() + " " + phObj[Physician.PhLastName].ToString() + " already assigned to patient as a(n) " + ptphDt.Rows[0][PatientPhysician.PtPhRole].ToString() + " physician.";
                    }
                }
            }
        }
Exemple #3
0
 public int SavePatientPhysician(PatientPhysician patientphysician)
 {
     try
     {
         if (patientphysician.Id > 0)
         {
             _db.Entry(patientphysician).State = System.Data.Entity.EntityState.Modified;
         }
         else
         {
             _db.Entry(patientphysician).State = System.Data.Entity.EntityState.Added;
         }
         //_db.Users.Add(user);
         _db.SaveChanges();
         return(patientphysician.Id);
     }
     catch (Exception ex)
     {
         return(0);
     }
 }
Exemple #4
0
        private void InsertDimension(object atts, int patientId, SqlTransaction trans)
        {
            DataRow dr;

            if (atts is XmlNode)
            {
                dr = this.AttributesToRow(((XmlNode)atts).Attributes);
            }
            else
            {
                dr = (DataRow)atts;
            }

            string dimType = (string)dr["type"];

            switch (dimType)
            {
            case "Institution":
                InstitutionDa ida           = new InstitutionDa();
                int           institutionId = ida.GetPrimKey((string)dr["value"]);
                this._CheckId(institutionId, dimType, dr);
                PatientInstitutionDa pida = new PatientInstitutionDa();

                if (VerifyUnique((pida.GetPatientInstitution(patientId, institutionId, trans)).Tables[0]))
                {
                    // NEW CODE, insert record though middle tier
                    PatientInstitution ptInstitution = new PatientInstitution();
                    ptInstitution[PatientInstitution.PatientId]     = patientId;
                    ptInstitution[PatientInstitution.InstitutionId] = institutionId;
                    ptInstitution.Save();

                    // OLD CODE, inserts now handled by middle tier
                    // pida.InsertPatientInstitution(patientId, institutionId, trans);  add trans logic after concurrency fully tested- spy 2/21
                    // pida.InsertPatientInstitution(patientId, institutionId, trans);
                }
                break;

            case "Physician":
                PhysicianDa pda = new PhysicianDa();
                //to get Physician primary key need to pass first and last name in from dataset defined in XML
                int physicianId = pda.GetPrimKey((string)dr["value"], (string)dr["value2"]);
                this._CheckId(physicianId, dimType, dr);

                PatientPhysicianDa ppda = new PatientPhysicianDa();
                if (VerifyUnique((ppda.ValidatePatientPhysician(patientId, physicianId)).Tables[0]))
                {
                    // NEW CODE, insert record though middle tier
                    PatientPhysician ptPhysician = new PatientPhysician();
                    ptPhysician[PatientPhysician.PatientId]   = patientId;
                    ptPhysician[PatientPhysician.PhysicianId] = physicianId;
                    ptPhysician.Save();

                    // OLD CODE, inserts now handled by middle tier
                    //should be creating Patient Physician biz object and passing object to PatientPhysicianDa
                    //ppda.InsertPatientPhysicianDimension(patientId, physicianId, _sc.GetUserName(), trans);
                }
                break;

            case "Protocol":
                ProtocolDa protDa     = new ProtocolDa();
                int        protocolId = protDa.GetPrimKey((string)dr["value"]);
                this._CheckId(protocolId, dimType, dr);

                PatientProtocolDa ptProtDa = new PatientProtocolDa();
                if (VerifyUnique((ptProtDa.ValidatePatientProtocol(patientId, protocolId)).Tables[0]))
                {
                    // NEW CODE, insert record though middle tier
                    PatientProtocol ptProtocol = new PatientProtocol();
                    ptProtocol[PatientProtocol.PatientId]  = patientId;
                    ptProtocol[PatientProtocol.ProtocolId] = protocolId;
                    ptProtocol.Save();

                    // OLD CODE, inserts now handled by middle tier
                    //ptProtDa.InsertPatientProtocolDimension(patientId, protocolId, _sc.GetUserName(), trans);
                }
                break;

            case "Disease":
                DiseaseDa disDa     = new DiseaseDa();
                int       diseaseId = disDa.GetPrimKey((string)dr["value"]);
                this._CheckId(diseaseId, dimType, dr);

                PatientDiseaseDa ptDiseaseDa = new PatientDiseaseDa();
                if (VerifyUnique((ptDiseaseDa.GetPatientDisease(patientId, diseaseId)).Tables[0]))
                {
                    // NEW CODE, insert record though middle tier
                    PatientDisease ptDisease = new PatientDisease();
                    ptDisease[PatientDisease.PatientId] = patientId;
                    ptDisease[PatientDisease.DiseaseId] = diseaseId;
                    ptDisease.Save();

                    // OLD CODE, inserts now handled by middle tier
                    //ptDiseaseDa.InsertPatientDisease(patientId, diseaseId, trans);
                }
                break;
            }
        }