예제 #1
0
 public ActionResult AddNewPatient(Patient pat, FormCollection frm)
 {
     var s = frm["ProviderID"];
     int PracticeID = Convert.ToInt32(Session["sespracticeid"]);
     pat.PracticeID = PracticeID;
     pat.StatusID = 1;
     db.Patients.Add(pat);
     db.SaveChanges();
     return RedirectToAction("Patients");
 }
        public JsonResult GetPatientInfo(Patient objPatient)
        {
            Patient objGetPatient = (from p in objDBContext.Patients
                                      where p.PatientID == objPatient.PatientID
                                      where p.PracticeID == objPatient.PracticeID
                                      select p).FirstOrDefault();

            return Json(objGetPatient, JsonRequestBehavior.AllowGet);
        }
        public JsonResult GetAllPatientEncounters(Patient objPatient)
        {
            var objPEncounters = (from p in objDBContext.PatientEncountersList
                                                where p.PatientID == objPatient.PatientID
                                                where p.StatusID != 2
                                  select new
                                  {
                                      p.EncounterID,
                                      p.PatientID,
                                      p.EquipID,
                                      p.Date,
                                      p.Notes,
                                      p.Equip_Options,
                                      p.Presc_Physician,
                                      p.Delivery_Method,
                                      p.Start_Refill_Date,
                                      p.Equip_Inspected_By,
                                      p.Equip_Deliv_Date,
                                      p.Facility_Name,
                                      p.Facility_Address,
                                      p.Diagnosis_Codes,
                                      p.Est_Treatment_Dur,
                                      p.Equip_Serial_Num,
                                      p.Type_Of_Equip,
                                      p.Drug,
                                      p.HCPCS_Code,
                                      p.J_Code,
                                      p.Po_Patient_Sign,
                                      p.Po_Patient_Sign_Date,
                                      p.Po_CompanyRep_Sign,
                                      p.Po_Company_Rep_Sign_Date,
                                      p.Po_Equip_Received_Date,
                                      p.Mcr_Beneficiary_Sign,
                                      p.Mcr_Beneficiary_Sign_Date,
                                      p.Mcr_Beneficiary_Name,
                                      p.Mcr_Notes,
                                      p.Pdr_Patient_Sign,
                                      p.Pdr_Patient_Sign_Date,
                                      p.Pdr_Legalguardian_Sign,
                                      p.Pdr_Legalguardian_Name,
                                      p.Pii_Patient_Sign,
                                      p.Pii_Patient_Sign_Date,
                                      p.Pii_Legalguardian_Sign,
                                      p.Pii_Reason_PatientUnsign,
                                      p.Pii_Guardian_Relation,
                                      p.Pii_Guardian_Firstname,
                                      p.Pii_Guardian_Lastname,
                                      p.Pii_Guardian_Address1,
                                      p.Pii_Guardian_Address2,
                                      p.Pii_Guardian_City,
                                      p.Pii_Guardian_State,
                                      p.Pii_Guardian_Zip,
                                      p.Pii_Guardian_Email,
                                      p.Pii_Guardian_Phone,
                                      p.Ptn_Physician_Sign,
                                      p.Ptn_Physician_Sign_Date,
                                      p.Ptn_Physician_Name,
                                      p.Ptn_Intravenous_Conti_Times,
                                      p.Ptn_Intravenous_Conti_Days,
                                      p.Ptn_Continu_Administrat,
                                      p.Ptn_Continu_Adminstrat_IFno,
                                      p.Ptn_Intravenous_Infusion,
                                      p.Ptn_Presc_Of_Equip,
                                      p.Dmeif_Supplier_Sign,
                                      p.Dmeif_Supplier_Sign_Date,
                                      p.Dmeif_Initial_Date,
                                      p.Dmeif_Revised_Date,
                                      p.Dmeif_Recertification_Date,
                                      p.StatusID
                                  }).ToList();

            return Json(objPEncounters, JsonRequestBehavior.AllowGet);
        }
        public JsonResult EditPatientInfo(Patient objPatient,int? Visit)
        {
            Patient objEditPatient = (from p in objDBContext.Patients
                                      where p.PatientID == objPatient.PatientID
                                      select p).FirstOrDefault();

            string meg = "";
            try
            {

                objEditPatient.PracticeID = objPatient.PracticeID;
                objEditPatient.ProviderID = objPatient.ProviderID;
                objEditPatient.PatientAcctNum = objPatient.PatientAcctNum;
                objEditPatient.FirstName = objPatient.FirstName;
                objEditPatient.LastName = objPatient.LastName;
                objEditPatient.MiddleName = objPatient.MiddleName;
                objEditPatient.Email = objPatient.Email;
                objEditPatient.PhoneNumber1 = objPatient.PhoneNumber1;
                objEditPatient.PhoneNumber2 = objPatient.PhoneNumber2;
                objEditPatient.Emergency_Contact_Num = objPatient.Emergency_Contact_Num;
                objEditPatient.Age = objPatient.Age;
                objEditPatient.Sex = objPatient.Sex;
                objEditPatient.Address1 = objPatient.Address1;
                objEditPatient.Address2 = objPatient.Address2;
                objEditPatient.City = objPatient.City;
                objEditPatient.State = objPatient.State;
                objEditPatient.Zip = objPatient.Zip;
                objEditPatient.Date_Of_Birth = objPatient.Date_Of_Birth;
                objEditPatient.Insurance1ID = objPatient.Insurance1ID;
                objEditPatient.Sub1ID = objPatient.Sub1ID;
                objEditPatient.Sub1FirstName = objPatient.Sub1FirstName;
                objEditPatient.Sub1LastName = objPatient.Sub1LastName;
                objEditPatient.Insurance2ID = objPatient.Insurance2ID;
                objEditPatient.Sub2ID = objPatient.Sub2ID;
                objEditPatient.Sub2FirstName = objPatient.Sub2FirstName;
                objEditPatient.Sub2LastName = objPatient.Sub2LastName;
                objEditPatient.Insurance3ID = objPatient.Insurance3ID;
                objEditPatient.Sub3ID = objPatient.Sub3ID;
                objEditPatient.Sub3FirstName = objPatient.Sub3FirstName;
                objEditPatient.Sub3LastName = objPatient.Sub3LastName;
                objEditPatient.HICN = objPatient.HICN;
                objEditPatient.Height = objPatient.Height;
                objEditPatient.Weight = objPatient.Weight;
                objEditPatient.Ptype = objPatient.Ptype;
                objEditPatient.Guarantor1ID = objPatient.Guarantor1ID;
                objEditPatient.Guarantor2ID = objPatient.Guarantor2ID;
                objEditPatient.Guarantor3ID = objPatient.Guarantor3ID;
                objEditPatient.Driver_Licence_Img = objPatient.Driver_Licence_Img;
                objEditPatient.InsuranceType = objPatient.InsuranceType;
                objEditPatient.SelfPay = objPatient.SelfPay;
                objEditPatient.StatusID = 1;
                objDBContext.SaveChanges();
                if (Visit == 1)
                {
                  meg =  addPatientvisits(objPatient.PatientID,objPatient.ProviderID);
                }
                else
                {
                    meg = "Success";
                }
                meg = "Success";
            }
            catch (Exception ex)
            {
                meg = "Failed";
                meg = ex.Message;
            }
            return Json(new { result = meg }, JsonRequestBehavior.AllowGet);
        }
        public JsonResult DeletePatientInfo(Patient objPatient)
        {
            Patient objEditPatient = (from p in objDBContext.Patients
                                      where p.PatientID == objPatient.PatientID
                                      where p.PracticeID == objPatient.PracticeID
                                      select p).FirstOrDefault();

            string meg = "";
            try
            {
                objEditPatient.StatusID = 2;
                objDBContext.SaveChanges();
                meg = "Success";
            }
            catch (Exception ex)
            {
                meg = "Failed";
                meg = ex.Message;
            }
            return Json(new { result = meg }, JsonRequestBehavior.AllowGet);
        }
        public JsonResult CreateNewPatient(Patient objPatient,int? Visit)
        {
            string meg = "";
            try
            {
                Patient objNewPatient = new Patient
                {
                    PracticeID = objPatient.PracticeID,
                    PatientAcctNum = objPatient.PatientAcctNum,
                    ProviderID = objPatient.ProviderID,
                    FirstName = objPatient.FirstName,
                    LastName = objPatient.LastName,
                    MiddleName = objPatient.MiddleName,
                    Email = objPatient.Email,
                    PhoneNumber1 = objPatient.PhoneNumber1,
                    PhoneNumber2 = objPatient.PhoneNumber2,
                    Emergency_Contact_Num = objPatient.Emergency_Contact_Num,
                    Age = objPatient.Age,
                    Sex = objPatient.Sex,
                    Address1 = objPatient.Address1,
                    Address2 = objPatient.Address2,
                    City = objPatient.City,
                    State = objPatient.State,
                    Zip = objPatient.Zip,
                    Date_Of_Birth = objPatient.Date_Of_Birth,
                    Insurance1ID = objPatient.Insurance1ID,
                    Sub1ID = objPatient.Sub1ID,
                    Sub1FirstName = objPatient.Sub1FirstName,
                    Sub1LastName = objPatient.Sub1LastName,
                    Insurance2ID = objPatient.Insurance2ID,
                    Sub2ID = objPatient.Sub2ID,
                    Sub2FirstName = objPatient.Sub2FirstName,
                    Sub2LastName = objPatient.Sub2LastName,
                    Insurance3ID = objPatient.Insurance3ID,
                    Sub3ID = objPatient.Sub3ID,
                    Sub3FirstName = objPatient.Sub3FirstName,
                    Sub3LastName = objPatient.Sub3LastName,
                    HICN = objPatient.HICN,
                    Height = objPatient.Height,
                    Weight = objPatient.Weight,
                    Ptype = objPatient.Ptype,
                    Guarantor1ID = objPatient.Guarantor1ID,
                    Guarantor2ID = objPatient.Guarantor2ID,
                    Guarantor3ID = objPatient.Guarantor3ID,
                    Driver_Licence_Img = objPatient.Driver_Licence_Img,
                    InsuranceType = objPatient.InsuranceType,
                    SelfPay = objPatient.SelfPay,
                    StatusID = 1
                };

                int? providerID = objPatient.ProviderID;
                objDBContext.Patients.Add(objNewPatient);
                objDBContext.SaveChanges();
                if (Visit == 1)
                {
                    int? lastPatientID = objDBContext.Patients.Max(Item => Item.PatientID);
                    meg = addPatientvisits(lastPatientID, providerID);
                }
                else
                {
                    meg = "Success";
                }
                //

            }
            catch (Exception ex)
            {
                meg = "Failed";
                meg = ex.Message;
            }
            return Json(new { result = meg }, JsonRequestBehavior.AllowGet);
        }