Ejemplo n.º 1
0
        public JsonResult SaveExcelData()
        {
            List <Patient> lstPatient = new List <Patient>();
            List <Gender>  lstGender  = new GenderDao().GetAllGender().ToList();

            lstPatient = HttpContext.Session.GetObjectFromJson <List <Patient> >("patient");
            ReturnMessage returnMessage = new ReturnMessage();

            for (int i = 0; i < lstPatient.Count; i++)
            {
                lstPatient[i].GenderID = (from x in lstGender
                                          where x.GenderName == lstPatient[i].GenderName
                                          select x.GenderID).FirstOrDefault();

                lstPatient[i].Created_By  = 1;
                lstPatient[i].Created_On  = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
                lstPatient[i].Modified_By = 1;
                lstPatient[i].Modified_On = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
                lstPatient[i].Active      = true;
            }

            returnMessage = new PatientDao().Import(lstPatient);

            return(Json(lstPatient));
        }
Ejemplo n.º 2
0
        public async Task <JsonResult> UpdatePatient(ImportClass tempData)
        {
            dynamic jsData      = JsonConvert.DeserializeObject(tempData.receive);
            var     fileID      = HttpContext.Session.GetInt32(SessionFile);
            string  DateOfBirth = jsData.DOB;

            Patient patient = new Patient();

            patient.PatientID   = jsData.Patient_ID;
            patient.PatientCode = jsData.Patient_Code;
            patient.PatientName = jsData.Patient_Name;
            patient.Address     = jsData.Address;
            patient.GenderID    = jsData.GenderID;
            //patient.FileID = Convert.ToInt32(fileID);

            if (!string.IsNullOrEmpty(DateOfBirth))
            {
                string[] datePart = DateOfBirth.Split('/');
                patient.DOB = new DateTime(Convert.ToInt32(datePart[2]), Convert.ToInt32(datePart[1]), Convert.ToInt32(datePart[0]));
            }

            int message = new PatientDao().EditPatient(patient);

            return(Json(new
            {
                status = message
            }));
        }
Ejemplo n.º 3
0
        public SignUP(MainWindow mainWindow)
        {
            InitializeComponent();
            Basewindow = mainWindow;
            using (PatientDao patientDao = new PatientDao())
            {
                var condition = new Dictionary <string, object>();
                var list      = patientDao.SelectPatient(condition);

                tbUid.Text = (list.Count + 1).ToString();
            }
        }
Ejemplo n.º 4
0
        private List <Patient> GetPatientsInFixedDay(List <Patient> srcList, long areaid)
        {
            List <Patient> patients = new List <Patient>();

            using (var scheduleTemplateDao = new ScheduleTemplateDao())
            {
                var condition = new Dictionary <string, object>();
                condition["DATE"] = DatePicker1.SelectedDate.Value.ToString("yyyy-MM-dd");// DateTime.Now.ToString("yyyy-MM-dd");
                var list22 = scheduleTemplateDao.SelectScheduleTemplate(condition);

                foreach (var type in list22)
                {
                    if (type.BedId == -1)
                    {
                        continue;
                    }

                    bool bExist = true;
                    foreach (var patient in patients)
                    {
                        if (patient.PatientId != type.PatientId.ToString())
                        {
                            bExist = false;
                            break;
                        }
                    }
                    if (!bExist)
                    {
                        long areaid1 = GetAreaIdByBedId(type.BedId);
                        if (areaid == areaid1)
                        {
                            using (PatientDao patientDao1 = new PatientDao())
                            {
                                var condition2 = new Dictionary <string, object>();
                                condition2["ID"] = type.PatientId;
                                var list2 = patientDao1.SelectPatient(condition2);
                                patients.Add(list2[0]);
                            }
                        }
                    }
                }
            }

            foreach (var patient in srcList)
            {
                if (!patients.Contains(patient))
                {
                    patients.Add(patient);
                }
            }
            return(patients);
        }
Ejemplo n.º 5
0
        public IActionResult PatientList()
        {
            //if (!IsAllowed(1,2))
            //{

            //    return RedirectToAction("NoPermission", "AppBase");
            //}

            List <Patient> lstPatient = new PatientDao().GetAllPatient().ToList();

            ViewBag.patientList = lstPatient;
            return(View());
        }
Ejemplo n.º 6
0
        //GET: Get patients list
        public ActionResult Index()
        {
            int doctor = User.Identity.GetUserId <int>();

            if (doctor < 1)
            {
                return(RedirectToAction("Login", "Account", new { Area = "" }));
            }
            var model = new PatientDao().GetPatientsDetail(doctor);

            //return Json(model, JsonRequestBehavior.AllowGet);
            return(View(model));
        }
Ejemplo n.º 7
0
        // GET: Get Patient detail
        public ActionResult Detail(int id)
        {
            int doctor = User.Identity.GetUserId <int>();

            if (doctor < 1)
            {
                return(RedirectToAction("Login", "Account", new { Area = "" }));
            }
            ViewBag.PatientList = new SelectList(new PatientDao().GetDoctorPatientsId(doctor), id);
            var model = new PatientDao().GetPatientDetail(id);

            //return Json(model,JsonRequestBehavior.AllowGet);
            return(View(model));
        }
Ejemplo n.º 8
0
        public IActionResult EditPatient(string patientId)
        {
            Patient       patient   = new PatientDao().GetAllPatient().Where(x => x.PatientID == Convert.ToInt32(patientId)).ToList()[0];
            List <Gender> lstGender = new GenderDao().GetAllGender().ToList();

            lstGender.Insert(0, new Gender()
            {
                GenderID = 0, GenderName = "Select Gender Name"
            });
            ViewBag.GenderList = new SelectList(lstGender, "GenderID", "GenderName");

            List <Attachments> lstAttachments = new AttachmentDao().GetAllTmpAttachmentsByIssueId(Convert.ToInt32(patientId)).ToList();

            ViewBag.AttachmentsList = lstAttachments;
            return(View(patient));
        }
Ejemplo n.º 9
0
        private void ButtonDelete_OnClick(object sender, RoutedEventArgs e)
        {
            var messageBox2 = new RemindMessageBox2();

            messageBox2.textBlock1.Text = "您确认删除当前病人记录吗?";
            messageBox2.ShowDialog();
            if (messageBox2.remindflag != 1)
            {
                return;
            }

            //if (ListViewBed.SelectedIndex == -1) return;
            if (Basewindow.patientGroupPanel.ListBoxPatient.SelectedIndex == -1)
            {
                return;
            }

            //throw new NotImplementedException();
            using (var patientDao = new PatientDao())
            {
                patientDao.DeletePatient((int)(Basewindow.patientGroupPanel.Datalist[Basewindow.patientGroupPanel.ListBoxPatient.SelectedIndex].Id));
                try
                {
                    using (MedicalOrderDao medicalOrderDao = new MedicalOrderDao())
                    {
                        medicalOrderDao.DeleteMedicalOrder2((int)(Basewindow.patientGroupPanel.Datalist[Basewindow.patientGroupPanel.ListBoxPatient.SelectedIndex].Id));
                    }
                    using (ScheduleTemplateDao scheduleDao = new ScheduleTemplateDao())
                    {
                        scheduleDao.DeleteScheduleTemplate2(
                            (int)
                            (Basewindow.patientGroupPanel.Datalist[
                                 Basewindow.patientGroupPanel.ListBoxPatient.SelectedIndex].Id));
                    }
                }
                catch (Exception ex)
                {
                    MainWindow.Log.WriteErrorLog("Init.cs-ButtonDelete_OnClick", ex);
                }

                Basewindow.patientGroupPanel.RemoveData(Basewindow.patientGroupPanel.Datalist[Basewindow.patientGroupPanel.ListBoxPatient.SelectedIndex].Id);
            }

            this.ButtonDelete.IsEnabled = false;
            this.ButtonApply.IsEnabled  = false;
            this.ButtonCancel.IsEnabled = false;
        }
        public void RefreshData()
        {
            MainWindow.ComboBoxPatientGroupIndex = this.ComboBoxPatientGroup.SelectedIndex;
            Datalist.Clear();
            using (var patientGroupDao = new PatientGroupDao())
            {
                var condition = new Dictionary <string, object>();
                condition["NAME"] = this.ComboBoxPatientGroup.SelectedItem;
                var list = patientGroupDao.SelectPatientGroup(condition);
                if (list.Count > 0)
                {
                    using (var patientGroupParaDao = new PatientGroupParaDao())
                    {
                        var conditionpara = new Dictionary <string, object>();
                        conditionpara["GROUPID"] = list[0].Id;
                        var listpara = patientGroupParaDao.SelectPatientGroupPara(conditionpara);

                        if (listpara.Count > 0)
                        {
                            using (var patientDao = new PatientDao())
                            {
                                var patientlist = patientDao.SelectPatientSpecial(listpara);
                                foreach (var patient in patientlist)
                                {
                                    var patientData = new PatientData();
                                    patientData.Id   = patient.Id;
                                    patientData.Name = patient.Name;
                                    Datalist.Add(patientData);
                                }
                            }
                        }
                    }
                }
                if (Datalist.Count > 0)
                {
                    this.ListBoxPatient.SelectedIndex = 0;
                }
            }
            UpdateGroupCount();
        }
        private void ComboBoxPatientGroup_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            MainWindow.ComboBoxPatientGroupIndex = this.ComboBoxPatientGroup.SelectedIndex;
            Datalist.Clear();
            using (var patientGroupDao = new PatientGroupDao())
            {
                var condition = new Dictionary <string, object>();
                condition["NAME"] = this.ComboBoxPatientGroup.SelectedItem;
                var list = patientGroupDao.SelectPatientGroup(condition);
                if (list.Count > 0)
                {
                    using (var patientGroupParaDao = new PatientGroupParaDao())
                    {
                        var conditionpara = new Dictionary <string, object>();
                        conditionpara["GROUPID"] = list[0].Id;
                        var listpara = patientGroupParaDao.SelectPatientGroupPara(conditionpara);

                        if (listpara.Count > 0)
                        {
                            using (var patientDao = new PatientDao())
                            {
                                var patientlist = patientDao.SelectPatientSpecial(listpara);
                                foreach (var patient in patientlist)
                                {
                                    var patientData = new PatientData();
                                    patientData.Id   = patient.Id;
                                    patientData.Name = patient.Name;
                                    Datalist.Add(patientData);
                                }
                            }
                        }
                    }
                }
            }
            UpdateGroupCount();
            //ListBoxPatient.SelectedIndex = Datalist.Count > 0 ? 1 : -1;
        }
        private void ListBoxPatient_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (this.ListBoxPatient.SelectedIndex != -1)
            {
                using (PatientDao patientDao = new PatientDao())
                {
                    var condition = new Dictionary <string, object>();
                    condition["ID"] = Datalist[this.ListBoxPatient.SelectedIndex].Id;
                    var list = patientDao.SelectPatient(condition);
                    if ((list != null) && (list.Count > 0))
                    {
                        Patient patient = list[0];
                        Basewindow.initContent.IDTextBox.Text   = patient.PatientId.ToString();
                        Basewindow.initContent.NameTextBox.Text = patient.Name;
                        if (patient.Gender.Equals("男"))
                        {
                            Basewindow.initContent.RadioButton1.IsChecked = true;
                        }
                        else if (patient.Gender.Equals("女"))
                        {
                            Basewindow.initContent.RadioButton2.IsChecked = true;
                        }
                        try
                        {
                            Basewindow.initContent.DatePicker1.Text = DateTime.Parse(patient.Dob).ToString();
                        }
                        catch (Exception)
                        {
                            Basewindow.initContent.DatePicker1.Text = "";
                        }

                        Basewindow.initContent.NationalityTextBox.Text = patient.Nationality;

                        if (patient.Gender.Equals("未婚"))
                        {
                            Basewindow.initContent.MarriageComboBox.SelectedIndex = 0;
                        }
                        else if (patient.Gender.Equals("已婚"))
                        {
                            Basewindow.initContent.MarriageComboBox.SelectedIndex = 1;
                        }

                        Basewindow.initContent.HeightTextBox.Text    = patient.Height;
                        Basewindow.initContent.BloodTypeTextBox.Text = patient.BloodType;

                        if (patient.InfectTypeId == 0)
                        {
                            Basewindow.initContent.RadioButton5.IsChecked = true;
                        }
                        else
                        {
                            Basewindow.initContent.RadioButton6.IsChecked = true;
                            using (InfectTypeDao infectTypeDao = new InfectTypeDao())
                            {
                                var condition1 = new Dictionary <string, object>();
                                condition1["ID"] = patient.InfectTypeId;
                                var list1 = infectTypeDao.SelectInfectType(condition1);
                                if ((list1 != null) && (list1.Count > 0))
                                {
                                    Basewindow.initContent.InfectTypeComboBox.Text = list1[0].Name;
                                }
                            }
                        }
                        if (patient.TreatStatusId == 0)
                        {
                            Basewindow.initContent.rbTreatStatus1.IsChecked = true;
                        }
                        else
                        {
                            Basewindow.initContent.rbTreatStatus2.IsChecked = true;
                            using (TreatStatusDao treatStatusDao = new TreatStatusDao())
                            {
                                var condition1 = new Dictionary <string, object>();
                                condition1["ID"] = patient.TreatStatusId;
                                var list1 = treatStatusDao.SelectTreatStatus(condition1);
                                if ((list1 != null) && (list1.Count > 0))
                                {
                                    Basewindow.initContent.StatusComboBox.Text = list1[0].Name;
                                }
                            }
                        }

                        if (patient.IsFixedBed)
                        {
                            Basewindow.initContent.RadioButton3.IsChecked = true;
                        }
                        else
                        {
                            Basewindow.initContent.RadioButton4.IsChecked = true;
                        }

                        using (PatientAreaDao patientAreaDao = new PatientAreaDao())
                        {
                            var condition1 = new Dictionary <string, object>();
                            condition1["ID"] = patient.AreaId;
                            var list1 = patientAreaDao.SelectPatientArea(condition1);
                            if ((list1 != null) && (list1.Count > 0))
                            {
                                Basewindow.initContent.AreaComboBox.Text = list1[0].Name;
                            }
                        }

                        Basewindow.initContent.PatientIDTextBox.Text = patient.Id.ToString();
                        Basewindow.initContent.MobileTextBox.Text    = patient.Mobile;
                        Basewindow.initContent.WeixinhaoTextBox.Text = patient.WeiXinHao;
                        Basewindow.initContent.PaymentTextBox.Text   = patient.Payment;
                        Basewindow.initContent.Discription.Text      = patient.Description;

                        Basewindow.initContent.ButtonApply.IsEnabled  = false;
                        Basewindow.initContent.ButtonCancel.IsEnabled = false;
                        Basewindow.initContent.ButtonDelete.IsEnabled = true;

                        #region orderContent
                        Basewindow.orderContent.IDTextBox.Text   = patient.PatientId.ToString();
                        Basewindow.orderContent.NameTextBox.Text = patient.Name;
                        if (patient.Gender.Equals("男"))
                        {
                            Basewindow.orderContent.RadioButton1.IsChecked = true;
                        }
                        else if (patient.Gender.Equals("女"))
                        {
                            Basewindow.orderContent.RadioButton2.IsChecked = true;
                        }
                        try
                        {
                            Basewindow.orderContent.DatePicker1.Text = DateTime.Parse(patient.Dob).ToString();
                        }
                        catch (Exception)
                        {
                            Basewindow.orderContent.DatePicker1.Text = "";
                        }

                        Basewindow.orderContent.NationalityTextBox.Text = patient.Nationality;

                        if (patient.Gender.Equals("未婚"))
                        {
                            Basewindow.orderContent.MarriageComboBox.SelectedIndex = 0;
                        }
                        else if (patient.Gender.Equals("已婚"))
                        {
                            Basewindow.orderContent.MarriageComboBox.SelectedIndex = 1;
                        }

                        Basewindow.orderContent.HeightTextBox.Text    = patient.Height;
                        Basewindow.orderContent.BloodTypeTextBox.Text = patient.BloodType;

                        if (patient.InfectTypeId == 0)
                        {
                            Basewindow.orderContent.RadioButton5.IsChecked = true;
                        }
                        else
                        {
                            Basewindow.orderContent.RadioButton6.IsChecked = true;
                            using (InfectTypeDao infectTypeDao = new InfectTypeDao())
                            {
                                var condition1 = new Dictionary <string, object>();
                                condition1["ID"] = patient.InfectTypeId;
                                var list1 = infectTypeDao.SelectInfectType(condition1);
                                if ((list1 != null) && (list1.Count > 0))
                                {
                                    Basewindow.orderContent.InfectTypeComboBox.Text = list1[0].Name;
                                }
                            }
                        }

                        using (TreatStatusDao treatStatusDao = new TreatStatusDao())
                        {
                            var condition1 = new Dictionary <string, object>();
                            condition1["ID"] = patient.TreatStatusId;
                            var list1 = treatStatusDao.SelectTreatStatus(condition1);
                            if ((list1 != null) && (list1.Count > 0))
                            {
                                Basewindow.orderContent.StatusComboBox.Text = list1[0].Name;
                            }
                        }

                        if (patient.IsFixedBed)
                        {
                            Basewindow.orderContent.RadioButton3.IsChecked = true;
                        }
                        else
                        {
                            Basewindow.orderContent.RadioButton4.IsChecked = true;
                        }

                        using (PatientAreaDao patientAreaDao = new PatientAreaDao())
                        {
                            var condition1 = new Dictionary <string, object>();
                            condition1["ID"] = patient.AreaId;
                            var list1 = patientAreaDao.SelectPatientArea(condition1);
                            if ((list1 != null) && (list1.Count > 0))
                            {
                                Basewindow.orderContent.AreaComboBox.Text = list1[0].Name;
                            }
                        }
                        Basewindow.orderContent.RefreshData();

                        Basewindow.orderContent.PatientIDTextBox.Text = patient.PatientId;
                        Basewindow.orderContent.MobileTextBox.Text    = patient.Mobile;
                        Basewindow.orderContent.WeixinhaoTextBox.Text = patient.WeiXinHao;
                        Basewindow.orderContent.PaymentTextBox.Text   = patient.Payment;
                        #endregion
                    }
                }
            }
        }
Ejemplo n.º 13
0
        public ActionResult Update(PatientProfile model, IList <AddressDetail> addr)
        {
            if (addr != null)
            {
                model.Addresses = addr; // Assign AddressDetail list to PatientProfile model
            }
            else
            {
                model.Addresses = null;
            }
            if (ModelState.IsValid)
            {
                int             userid = User.Identity.GetUserId <int>();
                ApplicationUser user   = UserManager.FindById(userid);
                if (user == null)
                {
                    ViewBag.Errors = "Không thấy lễ tân này này";
                    return(RedirectToAction("Detail", "ReceptionProfile", new { Message = ProfileMessageId.Error }));
                }

                // Update account data

                user.Email       = model.Email;
                user.DateOfBirth = model.DoB;
                user.FullName    = model.FullName;
                user.PhoneNumber = model.PhoneNumber;
                user.Gender      = model.Gender;
                var updateacc = UserManager.Update(user);
                if (!updateacc.Succeeded)
                {
                    ViewBag.Errors = "Không cập nhật được account";
                    return(View("Detail", model));
                }

                // Update profile data
                TM_Patient patient = new PatientDao().FindByUserId(userid);
                if (patient == null)
                {
                    patient               = new TM_Patient();
                    patient.UserId        = userid;
                    patient.AssuranceCard = model.AssuranceCard;
                    patient.IdentityCard  = model.IdentityCard;
                    if (new PatientDao().Insert(patient) < 1)
                    {
                        ViewBag.Errors = "Không thêm được profile";
                        return(View("Detail", model));
                    }
                }
                else
                {
                    patient.AssuranceCard = model.AssuranceCard;
                    patient.IdentityCard  = model.IdentityCard;
                    if (!new PatientDao().Update(patient))
                    {
                        ViewBag.Errors = "Không cập nhật được profile";
                        return(View("Detail", model));
                    }
                }
                return(RedirectToAction("Detail", new { message = ProfileMessageId.ChangeAccountSuccess }));
            }
            return(View("Detail", model));
        }
Ejemplo n.º 14
0
        public JsonResult GetPatient()
        {
            List <Patient> lstPatient = new PatientDao().GetAllPatient();

            return(Json(lstPatient));
        }
Ejemplo n.º 15
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            if (tbName.Text.Equals("") || tbUid.Text.Equals(""))
            {
                var a = new RemindMessageBox1();
                a.remindText.Text = "患者名称和唯一识别码不能为空.";
                a.ShowDialog();
                return;
            }

            name = tbName.Text;
            if (rbM.IsChecked == true)
            {
                sex = "男";
            }
            else
            {
                sex = "女";
            }
            birthday = dpBirthday.Text;

            if ((bool)this.rbNegative1.IsChecked)
            {
                infectionTypeId = 0;
            }
            else if ((bool)this.rbNegative2.IsChecked)
            {
                using (InfectTypeDao infectTypeDao = new InfectTypeDao())
                {
                    var condition = new Dictionary <string, object>();
                    condition["Name"] = InfectTypeComboBox.Text;
                    infectionName     = InfectTypeComboBox.Text;
                    var list = infectTypeDao.SelectInfectType(condition);
                    if (list != null)
                    {
                        infectionTypeId = list[0].Id;
                    }
                }
            }

            if ((bool)this.rbTreatStatus1.IsChecked)
            {
                treatmentStatus    = 0;
                treatmentStausName = "在治";
            }
            else if ((bool)this.rbTreatStatus2.IsChecked)
            {
                using (TreatStatusDao treatStatusDao = new TreatStatusDao())
                {
                    var condition = new Dictionary <string, object>();
                    condition["Name"]  = StatusComboBox.Text;
                    treatmentStausName = StatusComboBox.Text;
                    var list = treatStatusDao.SelectTreatStatus(condition);
                    if (list != null)
                    {
                        treatmentStatus = list[0].Id;
                    }
                }
            }

            if ((bool)this.rbFixBed1.IsChecked)
            {
                isFixBed = true;
            }
            else if ((bool)this.rbFixBed2.IsChecked)
            {
                isFixBed = false;
            }

            uid = tbUid.Text;

            using (PatientAreaDao patientAreaDao = new PatientAreaDao())
            {
                var condition = new Dictionary <string, object>();
                condition["Name"] = AreaComboBox.Text;
                areaName          = AreaComboBox.Text;
                var list = patientAreaDao.SelectPatientArea(condition);
                if (list != null)
                {
                    areaId = list[0].Id;
                }
            }

            result = System.Windows.Forms.DialogResult.OK;

            using (PatientDao patientDao = new PatientDao())
            {
                Patient patient = new Patient();
                patient.Name          = name;
                patient.Gender        = sex;
                patient.Dob           = birthday;
                patient.InfectTypeId  = infectionTypeId;
                patient.TreatStatusId = treatmentStatus;
                patient.IsFixedBed    = isFixBed;
                patient.PatientId     = uid;
                patient.AreaId        = areaId;
                patient.BedId         = -1;
                int lastInsertId = -1;
                patientDao.InsertPatient(patient, ref lastInsertId);

                InitMedicalOrderData(lastInsertId);

                Basewindow.initContent.IDTextBox.Text   = lastInsertId.ToString();
                Basewindow.initContent.NameTextBox.Text = patient.Name;
                if (patient.Gender.Equals("男"))
                {
                    Basewindow.initContent.RadioButton1.IsChecked = true;
                }
                else if (patient.Gender.Equals("女"))
                {
                    Basewindow.initContent.RadioButton2.IsChecked = true;
                }
                Basewindow.initContent.DatePicker1.Text = DateTime.Parse(patient.Dob).ToString();

                using (InfectTypeDao infectTypeDao = new InfectTypeDao())
                {
                    var condition = new Dictionary <string, object>();
                    condition["ID"] = patient.InfectTypeId;
                    var list = infectTypeDao.SelectInfectType(condition);
                    if ((list != null) && (list.Count > 0))
                    {
                        Basewindow.initContent.InfectTypeComboBox.Text = list[0].Name;
                    }
                }

                using (TreatStatusDao treatStatusDao = new TreatStatusDao())
                {
                    var condition = new Dictionary <string, object>();
                    condition["ID"] = patient.TreatStatusId;
                    var list = treatStatusDao.SelectTreatStatus(condition);
                    if ((list != null) && (list.Count > 0))
                    {
                        Basewindow.initContent.StatusComboBox.Text = list[0].Name;
                    }
                }

                Basewindow.initContent.IDTextBox.Text = patient.PatientId;
                if (patient.IsFixedBed)
                {
                    Basewindow.initContent.RadioButton3.IsChecked = true;
                }
                else
                {
                    Basewindow.initContent.RadioButton4.IsChecked = true;
                }

                using (PatientAreaDao patientAreaDao = new PatientAreaDao())
                {
                    var condition = new Dictionary <string, object>();
                    condition["ID"] = patient.AreaId;
                    var list = patientAreaDao.SelectPatientArea(condition);
                    if ((list != null) && (list.Count > 0))
                    {
                        Basewindow.initContent.AreaComboBox.Text = list[0].Name;
                    }
                }
            }

            //TODO:判断一下当前添加的患者是否满足当前患者组条件,如果满足需要刷新患者列表
            Basewindow.patientGroupPanel.RefreshData();


            Basewindow.initContent.ButtonNew.IsEnabled    = true;
            Basewindow.initContent.ButtonDelete.IsEnabled = true;
            Basewindow.initContent.ButtonApply.IsEnabled  = false;
            Basewindow.initContent.ButtonCancel.IsEnabled = false;

            this.Close();
        }
Ejemplo n.º 16
0
        private void QueryPatientsByArea(string areaName)
        {
            string areaid = "";

            using (var patientAreaDao = new PatientAreaDao())
            {
                var condition = new Dictionary <string, object>();
                condition["Name"] = areaName;
                var arealist = patientAreaDao.SelectPatientArea(condition);

                areaid = arealist[0].Id.ToString();
            }

            using (BedDao bedDao = new BedDao())
            {
                Dictionary <string, object> condition = new Dictionary <string, object>();
                condition["PatientAreaId"] = areaid;
                var list = bedDao.SelectBed(condition);
                foreach (DAOModule.Bed bed in list)
                {
                    using (var scheduleTemplateDao = new ScheduleTemplateDao())
                    {
                        condition.Clear();
                        condition          = new Dictionary <string, object>();
                        condition["BedId"] = bed.Id;
                        condition["DATE"]  = DatePicker1.SelectedDate.Value.ToString("yyyy-MM-dd");// DateTime.Now.ToString("yyyy-MM-dd");
                        var list22 = scheduleTemplateDao.SelectScheduleTemplate(condition);
                        foreach (var type in list22)
                        {
                            if (type.BedId == -1)
                            {
                                continue;
                            }

                            var rReportData = new ReportData();

                            rReportData.Id = type.Id;
                            using (PatientDao patientDao1 = new PatientDao())
                            {
                                var condition2 = new Dictionary <string, object>();
                                condition2["ID"] = type.PatientId;
                                var list2 = patientDao1.SelectPatient(condition2);
                                if ((list2 != null) && (list.Count > 0))
                                {
                                    rReportData.PatientName = list2[0].Name;
                                    rReportData.Description = list2[0].Description;
                                }
                            }

                            rReportData.ShiftWork = type.AmPmE;
                            rReportData.Method    = type.Method;

                            /*if (type.BedId == -1)
                             *  rReportData.BedId = "";
                             * else
                             * {
                             *  rReportData.BedId = type.BedId.ToString();
                             * }*/

                            using (var bedDao1 = new BedDao())
                            {
                                condition.Clear();
                                condition["Id"] = type.BedId;
                                var bedlist = bedDao1.SelectBed(condition);
                                if (bedlist.Count == 1)
                                {
                                    long areaId = bedlist[0].PatientAreaId;
                                    rReportData.BedId = bedlist[0].Name;
                                    using (var patientAreaDao = new PatientAreaDao())
                                    {
                                        condition.Clear();
                                        condition["Id"] = areaId;
                                        var arealist = patientAreaDao.SelectPatientArea(condition);
                                        if (arealist.Count == 1)
                                        {
                                            rReportData.Area = arealist[0].Name;
                                        }
                                    }
                                }
                            }

                            Datalist.Add(rReportData);
                        }
                    }
                }
            }
            UpdateGroupCount();
        }
Ejemplo n.º 17
0
        private void FillValues(string key)
        {
            IsEditabel = false;
            using (var patientDao = new PatientDao())
            {
                var            condition    = new Dictionary <string, object>();
                List <Patient> patientslist = patientDao.SelectPatient(condition);
                switch (key)
                {
                case "姓名":
                    IsEditabel = true;

                    /*_details.Clear();
                     * foreach (var patient in patientslist)
                     * {
                     *  _details.Add(patient.Name);
                     * }*/
                    break;

                case "性别":
                    _details.Clear();
                    _details.Add("男");
                    _details.Add("女");
                    break;

                case "血型":
                    _details.Clear();
                    _details.Add("O");
                    _details.Add("A");
                    _details.Add("B");
                    _details.Add("AB");

                    break;

                case "婚姻状况":
                    _details.Clear();
                    _details.Add("已婚");
                    _details.Add("未婚");
                    break;

                case "感染情况":
                    _details.Clear();
                    using (var infectTypeDao = new InfectTypeDao())
                    {
                        condition.Clear();
                        var arealist = infectTypeDao.SelectInfectType(condition);
                        foreach (var infectType in arealist)
                        {
                            _details.Add(infectType.Name);
                        }
                        _details.Add("阴性");
                    }
                    break;

                case "治疗状态":
                    _details.Clear();
                    using (TreatStatusDao treatStatusDao = new TreatStatusDao())
                    {
                        var condition1 = new Dictionary <string, object>();
                        var list1      = treatStatusDao.SelectTreatStatus(condition1);
                        foreach (var treatStatuse in list1)
                        {
                            _details.Add(treatStatuse.Name);
                        }
                        _details.Add("在治");
                    }

                    break;

                case "固定床位":
                    _details.Clear();
                    _details.Add("FALSE");
                    _details.Add("TRUE");
                    break;

                case "所属分区":
                    _details.Clear();
                    using (var patientAreaDao = new PatientAreaDao())
                    {
                        condition.Clear();
                        var list = patientAreaDao.SelectPatientArea(condition);
                        foreach (var type in list)
                        {
                            _details.Add(type.Name);
                        }
                    }

                    break;
                }
            }
        }
Ejemplo n.º 18
0
        private void QueryPatients()
        {
            try
            {
                int index = PatientGroupComboBox.SelectedIndex;
                if (index == -1)
                {
                    return;
                }
                using (var patientGroupDao = new PatientGroupDao())
                {
                    var condition = new Dictionary <string, object>();
                    condition["NAME"] = PatientGroupComboBoxItems[index];
                    var list = patientGroupDao.SelectPatientGroup(condition);
                    if (list.Count > 0)
                    {
                        using (var patientGroupParaDao = new PatientGroupParaDao())
                        {
                            var conditionpara = new Dictionary <string, object>();
                            conditionpara["GROUPID"] = list[0].Id;
                            var listpara = patientGroupParaDao.SelectPatientGroupPara(conditionpara);


                            if (listpara.Count > 0)
                            {
                                using (var patientDao = new PatientDao())
                                {
                                    var patientlist = patientDao.SelectPatientSpecial(listpara);

                                    string areaid = GetPatientArea(listpara);
                                    if (!areaid.Equals(""))
                                    {
                                        Datalist.Clear();
                                        QueryPatientsByArea(areaid);
                                        return;
                                    }


                                    Datalist.Clear();
                                    foreach (var patient in patientlist)
                                    {
                                        using (var scheduleTemplateDao = new ScheduleTemplateDao())
                                        {
                                            condition.Clear();
                                            condition = new Dictionary <string, object>();
                                            condition["PatientId"] = patient.Id;
                                            condition["DATE"]      = DatePicker1.SelectedDate.Value.ToString("yyyy-MM-dd");// DateTime.Now.ToString("yyyy-MM-dd");
                                            var list22 = scheduleTemplateDao.SelectScheduleTemplate(condition);
                                            foreach (var type in list22)
                                            {
                                                if (type.BedId == -1)
                                                {
                                                    continue;
                                                }

                                                var rReportData = new ReportData();

                                                rReportData.Id = type.Id;
                                                using (PatientDao patientDao1 = new PatientDao())
                                                {
                                                    var condition2 = new Dictionary <string, object>();
                                                    condition2["ID"] = type.PatientId;
                                                    var list2 = patientDao1.SelectPatient(condition2);
                                                    if ((list2 != null) && (list.Count > 0))
                                                    {
                                                        rReportData.PatientName = list2[0].Name;
                                                        rReportData.Description = list2[0].Description;
                                                    }
                                                }

                                                rReportData.ShiftWork = type.AmPmE;
                                                rReportData.Method    = type.Method;

                                                /*if (type.BedId == -1)
                                                 *  rReportData.BedId = "";
                                                 * else
                                                 * {
                                                 *  rReportData.BedId = type.BedId.ToString();
                                                 * }*/

                                                using (var bedDao = new BedDao())
                                                {
                                                    condition.Clear();
                                                    condition["Id"] = type.BedId;
                                                    var bedlist = bedDao.SelectBed(condition);
                                                    if (bedlist.Count == 1)
                                                    {
                                                        long areaId = bedlist[0].PatientAreaId;
                                                        rReportData.BedId = bedlist[0].Name;
                                                        using (var patientAreaDao = new PatientAreaDao())
                                                        {
                                                            condition.Clear();
                                                            condition["Id"] = areaId;
                                                            var arealist = patientAreaDao.SelectPatientArea(condition);
                                                            if (arealist.Count == 1)
                                                            {
                                                                rReportData.Area = arealist[0].Name;
                                                            }
                                                        }
                                                    }
                                                }

                                                //rReportData.Description = patient.Description;
                                                Datalist.Add(rReportData);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                UpdateGroupCount();
            }
            catch (Exception ex)
            {
                MainWindow.Log.WriteInfoConsole("In Init.xaml.cs:Init_OnLoaded select patient exception messsage: " + ex.Message);
            }
        }
Ejemplo n.º 19
0
        //private void AddNewPatient()
        //{
        //    using (PatientDao patientDao = new PatientDao())
        //    {
        //        Patient patient = new Patient();

        //        patient.Name = NameTextBox.Text;

        //        if ((bool)RadioButton1.IsChecked)
        //            patient.Gender = "男";
        //        else if ((bool)RadioButton2.IsChecked)
        //            patient.Gender = "女";

        //        patient.Dob = DatePicker1.Text;
        //        patient.Nationality= NationalityTextBox.Text;
        //        patient.Marriage  = MarriageComboBox.Text;
        //        patient.Height  = HeightTextBox.Text;
        //        patient.BloodType  = BloodTypeTextBox.Text;


        //        if ((bool)RadioButton5.IsChecked)
        //        {
        //            patient.InfectTypeId = 0;
        //        }
        //        else if ((bool)RadioButton6.IsChecked)
        //        {

        //            using (InfectTypeDao infectTypeDao = new InfectTypeDao())
        //            {
        //                var condition1 = new Dictionary<string, object>();
        //                condition1["NAME"] = InfectTypeComboBox.Text;
        //                var list1 = infectTypeDao.SelectInfectType(condition1);
        //                if ((list1 != null) && (list1.Count > 0))
        //                {
        //                    patient.InfectTypeId = list1[0].Id;
        //                }
        //            }
        //        }

        //        using (TreatStatusDao treatStatusDao = new TreatStatusDao())
        //        {
        //            var condition1 = new Dictionary<string, object>();
        //            condition1["NAME"] = StatusComboBox.Text;
        //            var list1 = treatStatusDao.SelectTreatStatus(condition1);
        //            if ((list1 != null) && (list1.Count > 0))
        //            {
        //                patient.TreatStatusId  = list1[0].Id;
        //            }
        //        }

        //        if ((bool)RadioButton3.IsChecked)
        //            patient.IsFixedBed = true;
        //        else if ((bool)RadioButton4.IsChecked)
        //            patient.IsFixedBed = false;

        //        using (PatientAreaDao patientAreaDao = new PatientAreaDao())
        //        {
        //            var condition1 = new Dictionary<string, object>();
        //            condition1["NAME"] = AreaComboBox.Text;
        //            var list1 = patientAreaDao.SelectPatientArea(condition1);
        //            if ((list1 != null) && (list1.Count > 0))
        //            {
        //                patient.AreaId = list1[0].Id;
        //            }
        //        }
        //        patient.PatientId = PatientIDTextBox.Text;
        //        patient.Mobile = MobileTextBox.Text;
        //        patient.WeiXinHao = WeixinhaoTextBox.Text;
        //        patient.Payment = PaymentTextBox.Text;
        //        int lastInsertId = -1;
        //        patientDao.InsertPatient(patient, ref lastInsertId);

        //    }
        //}

        //private bool CheckInfo()
        //{
        //    if (
        //        MobileTextBox.Text == ""
        //        )
        //        return false;
        //    else return true;
        //}


        private void ButtonApply_OnClick(object sender, RoutedEventArgs e)
        {
            //if (CheckInfo() == false)
            //{
            //    System.Windows.Forms.MessageBox.Show("请完善信息,*必填!");
            //    return;
            //}

            //if (isNewAdded == true)
            //{
            //    AddNewPatient();
            //    isNewAdded = false;
            //    return;
            //}
            if (Basewindow.patientGroupPanel.ListBoxPatient.SelectedIndex == -1)
            {
                return;
            }



            this.ButtonNew.IsEnabled    = true;
            this.ButtonDelete.IsEnabled = true;
            this.ButtonApply.IsEnabled  = false;

            using (PatientDao patientDao = new PatientDao())
            {
                var condition = new Dictionary <string, object>();
                condition["ID"] = Basewindow.patientGroupPanel.Datalist[Basewindow.patientGroupPanel.ListBoxPatient.SelectedIndex].Id;

                var fileds = new Dictionary <string, object>();

                fileds["NAME"] = NameTextBox.Text;

                if ((bool)RadioButton1.IsChecked)
                {
                    fileds["GENDER"] = "男";
                }
                else if ((bool)RadioButton2.IsChecked)
                {
                    fileds["GENDER"] = "女";
                }

                fileds["DOB"]         = DatePicker1.Text;
                fileds["NATIONALITY"] = NationalityTextBox.Text;
                fileds["MARRIAGE"]    = MarriageComboBox.Text;
                fileds["HEIGHT"]      = HeightTextBox.Text;
                fileds["BLOODTYPE"]   = BloodTypeTextBox.Text;


                if ((bool)RadioButton5.IsChecked)
                {
                    fileds["INFECTTYPEID"] = 0;
                }
                else if ((bool)RadioButton6.IsChecked)
                {
                    using (InfectTypeDao infectTypeDao = new InfectTypeDao())
                    {
                        var condition1 = new Dictionary <string, object>();
                        condition1["NAME"] = InfectTypeComboBox.Text;
                        var list1 = infectTypeDao.SelectInfectType(condition1);
                        if ((list1 != null) && (list1.Count > 0))
                        {
                            fileds["INFECTTYPEID"] = list1[0].Id;
                        }
                    }
                }

                if ((bool)rbTreatStatus1.IsChecked)
                {
                    fileds["TREATSTATUSID"] = 0;
                }
                else if ((bool)rbTreatStatus2.IsChecked)
                {
                    using (TreatStatusDao treatStatusDao = new TreatStatusDao())
                    {
                        var condition1 = new Dictionary <string, object>();
                        condition1["NAME"] = StatusComboBox.Text;
                        var list1 = treatStatusDao.SelectTreatStatus(condition1);
                        if ((list1 != null) && (list1.Count > 0))
                        {
                            fileds["TREATSTATUSID"] = list1[0].Id;
                        }
                    }
                }


                if ((bool)RadioButton3.IsChecked)
                {
                    fileds["ISFIXEDBED"] = true;
                }
                else if ((bool)RadioButton4.IsChecked)
                {
                    fileds["ISFIXEDBED"] = false;
                }

                using (PatientAreaDao patientAreaDao = new PatientAreaDao())
                {
                    var condition1 = new Dictionary <string, object>();
                    condition1["NAME"] = AreaComboBox.Text;
                    var list1 = patientAreaDao.SelectPatientArea(condition1);
                    if ((list1 != null) && (list1.Count > 0))
                    {
                        fileds["AREAID"] = list1[0].Id;
                    }
                }

                fileds["PATIENTID"]   = IDTextBox.Text;
                fileds["MOBILE"]      = MobileTextBox.Text;
                fileds["WEIXINHAO"]   = WeixinhaoTextBox.Text;
                fileds["PAYMENT"]     = PaymentTextBox.Text;
                fileds["DESCRIPTION"] = Discription.Text;


                patientDao.UpdatePatient(fileds, condition);
            }
        }