Example #1
0
        public bool UpdateClinicDoctorAdvice(CommContracts.ClinicDoctorAdvice ClinicDoctorAdvice)
        {
            using (DAL.HisContext ctx = new DAL.HisContext())
            {
                var temp = ctx.ClinicDoctorAdvices.FirstOrDefault(m => m.ID == ClinicDoctorAdvice.ID);
                if (temp != null)
                {
                    temp.DoctorAdviceType = (DAL.DoctorAdviceItemType)ClinicDoctorAdvice.DoctorAdviceType;
                    temp.StartTime        = ClinicDoctorAdvice.StartTime;
                    temp.DoctorName       = ClinicDoctorAdvice.DoctorName;
                    temp.DepartmentName   = ClinicDoctorAdvice.DepartmentName;
                    temp.IsExigence       = ClinicDoctorAdvice.IsExigence;


                    temp.UpdateTime           = ClinicDoctorAdvice.UpdateTime;
                    temp.ClinicRegistrationID = ClinicDoctorAdvice.ClinicRegistrationID;
                }
                else
                {
                    return(false);
                }

                try
                {
                    ctx.SaveChanges();
                }
#pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过
                catch (Exception ex)
#pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过
                {
                    return(false);
                }
            }
            return(true);
        }
Example #2
0
        public DoctorAdviceView(CommContracts.ClinicDoctorAdvice clinicDoctorAdvice)
        {
            InitializeComponent();
            ClinicDoctorAdvice = clinicDoctorAdvice;

            m_开医嘱时间Text.Text = clinicDoctorAdvice.StartTime.ToString();
            m_医嘱单Text.Text   = clinicDoctorAdvice.ID.ToString();

            m_myGridView.ItemsSource = clinicDoctorAdvice.DoctorAdviceDetailGroups;
        }
        private void m_editBtn_Click(object sender, RoutedEventArgs e)
        {
            var vm = this.DataContext as HISGUIClinicDoctorWorkVM;

            if (vm == null)
            {
                return;
            }

            int SelectNum = 0;

            CommContracts.ClinicDoctorAdvice EditAdvice = new CommContracts.ClinicDoctorAdvice();

            foreach (DoctorAdviceView tem in m_DoctorAdvicePanel.Children)
            {
                if (tem.IsChecked)
                {
                    SelectNum++;
                    EditAdvice = tem.ClinicDoctorAdvice;
                }
            }

            if (SelectNum == 1)
            {
                vm.CurrentClinicDoctorAdvice = EditAdvice;
                var window = new Window();
                DoctorAdviceEditView doctorAdviceEditView = new DoctorAdviceEditView();
                doctorAdviceEditView.DataContext = this.DataContext;

                // 这里最好能够让界面弹出在父窗口正中心位置
                window.Content = doctorAdviceEditView;
                window.Width   = 880;
                window.Height  = 700;

                if (window.ShowDialog().Value == true)
                {
                    //var tem = doctorAdviceEditView.CurrentClinicDoctorAdvice;
                    //ClinicDoctorAdviceList.Add(tem);
                    LoadAllClinicDoctorAdvices();
                }
            }
            else
            {
                MessageBox.Show("请选择一个医嘱进行修改操作!");
                return;
            }
        }
        private void SaveBtnClicked(object sender, RoutedEventArgs e)
        {
            var vm = this.DataContext as HISGUIClinicDoctorWorkVM;

            if (vm == null)
            {
                return;
            }

            var DoctorAdviceType = m_DoctorAdviceTypeCombo.SelectedItem;

            if (DoctorAdviceType == null)
            {
                return;
            }

            CommContracts.ClinicDoctorAdvice clinicDoctorAdvice = new CommContracts.ClinicDoctorAdvice();
            if (vm.ClinicDoctorAdviceList != null)
            {
                clinicDoctorAdvice.ID = vm.ClinicDoctorAdviceList.Count + 1;
            }
            else
            {
                clinicDoctorAdvice.ID = 1;
            }
            clinicDoctorAdvice.DoctorAdviceType = (CommContracts.DoctorAdviceItemType)DoctorAdviceType;
            clinicDoctorAdvice.StartTime        = m_开单日期.SelectedDate.Value;
            clinicDoctorAdvice.DoctorName       = m_医生Text.Text;
            clinicDoctorAdvice.DepartmentName   = m_科室Text.Text;

            clinicDoctorAdvice.IsExigence           = m_紧急CheckBox.IsChecked.Value;
            clinicDoctorAdvice.ClinicRegistrationID = vm.CurrentClinicRegistration.ID;

            List <CommContracts.ClinicDoctorAdvice_DiagnoseItem> DiagnoseItemDetaillist = new List <CommContracts.ClinicDoctorAdvice_DiagnoseItem>();

            foreach (DiagnoseItemControl temItemControl in this.m_诊断Panel.Children)
            {
                var item = temItemControl.CurrentDiagnoseItem;
                CommContracts.ClinicDoctorAdvice_DiagnoseItem detail = new CommContracts.ClinicDoctorAdvice_DiagnoseItem();
                detail.DiagnoseItemID = item.ID;
                detail.DiagnoseItem   = item;

                DiagnoseItemDetaillist.Add(detail);
            }
            clinicDoctorAdvice.ClinicDoctorAdvice_DiagnoseItems = DiagnoseItemDetaillist;

            clinicDoctorAdvice.DoctorAdviceDetailGroups = this.m_DoctorAdviceGrouplist;
            clinicDoctorAdvice.UpdateTime = DateTime.Now;

            //CurrentClinicDoctorAdvice = clinicDoctorAdvice;

            //if(vm.SaveClinicDoctorAdvice(clinicDoctorAdvice))
            //{
            //    var window = this.Parent as Window;
            //    window.DialogResult = true;
            //    window.Close();
            //}
            List <CommContracts.ClinicDoctorAdvice> list = new List <CommContracts.ClinicDoctorAdvice>();

            if (vm.ClinicDoctorAdviceList == null)
            {
                list.Add(clinicDoctorAdvice);
                vm.ClinicDoctorAdviceList = list;
            }
            else
            {
                vm.ClinicDoctorAdviceList.Add(clinicDoctorAdvice);
            }

            var window = this.Parent as Window;

            window.DialogResult = true;
            window.Close();
        }
Example #5
0
 public bool SaveClinicDoctorAdvice(CommContracts.ClinicDoctorAdvice ClinicDoctorAdvice)
 {
     return(client.SaveClinicDoctorAdvice(ClinicDoctorAdvice));
 }
Example #6
0
 public bool UpdateClinicDoctorAdvice(CommContracts.ClinicDoctorAdvice ClinicDoctorAdvice)
 {
     return(client.UpdateClinicDoctorAdvice(ClinicDoctorAdvice));
 }
Example #7
0
        public bool SaveClinicDoctorAdvice(CommContracts.ClinicDoctorAdvice ClinicDoctorAdvice)
        {
            using (DAL.HisContext ctx = new DAL.HisContext())
            {
                var config = new MapperConfiguration(cfg =>
                {
                    cfg.CreateMap <CommContracts.ClinicDoctorAdvice, DAL.ClinicDoctorAdvice>()/*.ForMember(x => x.ClinicDoctorAdvice_DiagnoseItems, opt => opt.Ignore())*/
                    /*.ForMember(x => x.DoctorAdviceDetailGroups, opt => opt.Ignore())*/;
                });
                var mapper = config.CreateMapper();

                DAL.ClinicDoctorAdvice temp = new DAL.ClinicDoctorAdvice();
                temp = mapper.Map <DAL.ClinicDoctorAdvice>(ClinicDoctorAdvice);


                //var configDetail = new MapperConfiguration(ctr =>
                //{
                //    ctr.CreateMap<CommContracts.ClinicDoctorAdvice_DiagnoseItem, DAL.ClinicDoctorAdvice_DiagnoseItem>().ForMember(x => x.ClinicDoctorAdvice, opt => opt.Ignore());
                //});
                //var mapperDetail = configDetail.CreateMapper();

                //List<CommContracts.ClinicDoctorAdvice_DiagnoseItem> list1 = ClinicDoctorAdvice.ClinicDoctorAdvice_DiagnoseItems;
                //List<DAL.ClinicDoctorAdvice_DiagnoseItem> res = mapperDetail.Map<List<DAL.ClinicDoctorAdvice_DiagnoseItem>>(list1);

                //temp.ClinicDoctorAdvice_DiagnoseItems = res;

                //List<DAL.DoctorAdviceDetailGroup> resGroup = new List<DAL.DoctorAdviceDetailGroup>();
                //foreach (var temGroupDetail in ClinicDoctorAdvice.DoctorAdviceDetailGroups)
                //{
                //    var configGroupDetail = new MapperConfiguration(ctr =>
                //    {
                //        ctr.CreateMap<CommContracts.DoctorAdviceDetailGroup, DAL.DoctorAdviceDetailGroup>().ForMember(x => x.ClinicDoctorAdvice, opt => opt.Ignore())
                //        .ForMember(x => x.Usage, opt => opt.Ignore()).ForMember(x => x.DoctorAdviceItems, opt => opt.Ignore());
                //    });
                //    var mapperGroupDetail = configGroupDetail.CreateMapper();

                //    DAL.DoctorAdviceDetailGroup resGroupDetail = new DAL.DoctorAdviceDetailGroup();
                //    resGroupDetail = mapperGroupDetail.Map<DAL.DoctorAdviceDetailGroup>(temGroupDetail);


                //    ///
                //    var configItmes = new MapperConfiguration(ctr =>
                //    {
                //        ctr.CreateMap<CommContracts.DoctorAdviceDetail, DAL.DoctorAdviceDetail>()
                //        .ForMember(x=>x.DoctorAdviceDetailGroup, opt=> opt.Ignore()).ForMember(x=>x.DoctorAdviceItem, opt =>opt.Ignore());
                //    });
                //    var mapperItems = configItmes.CreateMapper();

                //    List<CommContracts.DoctorAdviceDetail> listItems = temGroupDetail.DoctorAdviceItems;
                //    List<DAL.DoctorAdviceDetail> resItems = mapperItems.Map<List<DAL.DoctorAdviceDetail>>(listItems);

                //    resGroupDetail.DoctorAdviceItems = resItems;

                //    resGroup.Add(resGroupDetail);

                //}



                //temp.DoctorAdviceDetailGroups = resGroup;

                ctx.ClinicDoctorAdvices.Add(temp);
                try
                {
                    ctx.SaveChanges();
                }
#pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过
                catch (Exception ex)
#pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过
                {
                    return(false);
                }
            }
            return(true);
        }