Ejemplo n.º 1
0
        /// <summary>
        /// 鼠标单击事件
        /// </summary>
        protected void MedDrugGraph_MouseClick(object sender, MouseEventArgs e)
        {
            try
            {
                RectangleF rectf = _currentGraph.GetMainRect();
                if (!rectf.Contains(e.Location.X, e.Location.Y))
                {
                    return;
                }

                if (e.Button == MouseButtons.Right)
                {
                    _currentGraph.SetMousePosition(e.Location);
                    string eventNo = ExtendApplicationContext.Current.EventNo;
                    if (_currentGraph.MouseTime > DateTime.MinValue)
                    {
                        MedDrugPoint pt = _currentGraph.SelectedPoint;
                        _currentTime = _currentGraph.MouseTime;
                        if (pt == null)
                        {
                            List <MED_EVENT_DICT> eventOpenTable = ExtendApplicationContext.Current.CommDict.EventDict;

                            List <MED_ANESTHESIA_EVENT> anesEvent = ModelHelper <MED_ANESTHESIA_EVENT> .ConvertDataTableToList(this.DataSource["AnesthesiaEvent"]);

                            int    Line      = (int)Math.Ceiling(((double)e.Location.Y - _currentGraph.TopOffSet) / _currentGraph.Height * _currentGraph.LineParameters.Count);
                            double locationH = (double)e.Location.Y - _currentGraph.TopOffSet;
                            double rowH      = _currentGraph.Height / _currentGraph.LineParameters.Count;
                            for (int i = 1; i <= _currentGraph.LineParameters.Count; i++)
                            {
                                if (rowH * i > locationH)
                                {
                                    Line = i; break;
                                }
                            }
                            if (_currentGraph.Curves.Count < Line)
                            {
                                DataTable sourceTable = ModelHelper <MED_EVENT_DICT> .ConvertListToDataTable(eventOpenTable.Where(x => x.EVENT_CLASS_CODE == "2" || x.EVENT_CLASS_CODE == "C").ToList());

                                PopupDrugSelector.ShowSelector(sourceTable, _currentGraph, e.Location, _currentTime != DateTime.MinValue ? _currentTime : DateTime.Now, this, "麻药及用药", eventNo);
                            }
                            else
                            {
                                if (_currentGraph.GetMainRect().X > e.Location.X)
                                {
                                    return;
                                }
                                List <MED_EVENT_DICT> eventDict = eventOpenTable.Where(x => x.EVENT_ITEM_NAME == _currentGraph.Curves[Line - 1].Text).ToList();
                                MED_EVENT_DICT        row       = new MED_EVENT_DICT();
                                if (eventDict != null && eventDict.Count > 0)
                                {
                                    row = eventDict[0];
                                }
                                MED_ANESTHESIA_EVENT eventRow = DataContext.GetCurrent().NewAnesthesiaEventRow(anesEvent, eventNo);
                                eventRow.EVENT_CLASS_CODE = row.EVENT_CLASS_CODE;
                                eventRow.EVENT_ITEM_NAME  = row.EVENT_ITEM_NAME;
                                eventRow.EVENT_ITEM_SPEC  = row.EVENT_ITEM_SPEC;
                                eventRow.EVENT_ITEM_CODE  = row.EVENT_ITEM_CODE;
                                eventRow.START_TIME       = _currentTime;
                                if (!string.IsNullOrEmpty(row.EVENT_ATTR))
                                {
                                    eventRow.EVENT_ATTR = row.EVENT_ATTR;
                                }
                                if (!string.IsNullOrEmpty(_currentGraph.Curves[Line - 1].Points[0].Route))
                                {
                                    eventRow.ADMINISTRATOR = _currentGraph.Curves[Line - 1].Points[0].Route;
                                }

                                if (!string.IsNullOrEmpty(_currentGraph.Curves[Line - 1].Points[0].ThickNessUnit))
                                {
                                    eventRow.CONCENTRATION_UNIT = _currentGraph.Curves[Line - 1].Points[0].ThickNessUnit;
                                }

                                if (!string.IsNullOrEmpty(_currentGraph.Curves[Line - 1].Points[0].Unit))
                                {
                                    eventRow.DOSAGE_UNITS = _currentGraph.Curves[Line - 1].Points[0].Unit;
                                }

                                if (!string.IsNullOrEmpty(_currentGraph.Curves[Line - 1].Points[0].SpeedUnit))
                                {
                                    eventRow.SPEED_UNIT = _currentGraph.Curves[Line - 1].Points[0].SpeedUnit;
                                }

                                if (!string.IsNullOrEmpty(row.SUPPLIER_NAME))
                                {
                                    eventRow.SUPPLIER_NAME = row.SUPPLIER_NAME;
                                }

                                if (!string.IsNullOrEmpty(_currentGraph.Curves[Line - 1].Points[0].ThickNess.ToString()))
                                {
                                    eventRow.CONCENTRATION = (decimal)_currentGraph.Curves[Line - 1].Points[0].ThickNess;
                                }

                                if (!string.IsNullOrEmpty(_currentGraph.Curves[Line - 1].Points[0].Value.ToString()))
                                {
                                    eventRow.DOSAGE = Convert.ToDecimal(_currentGraph.Curves[Line - 1].Points[0].Value);
                                }

                                if (!string.IsNullOrEmpty(_currentGraph.Curves[Line - 1].Points[0].Speed.ToString()))
                                {
                                    eventRow.PERFORM_SPEED = (decimal)_currentGraph.Curves[Line - 1].Points[0].Speed;
                                }

                                if (row.DURATIVE_INDICATOR.HasValue)
                                {
                                    eventRow.DURATIVE_INDICATOR = row.DURATIVE_INDICATOR;
                                }
                                EditEventItem editItem = new EditEventItem();
                                editItem.DataSource = eventRow;
                                editItem.ItemType   = EditEventItem.ItemTypes.MedicineItem;
                                DialogHostFormPC dialogHostForm = new DialogHostFormPC(editItem.Caption, editItem.Width, editItem.Height);
                                dialogHostForm.Child = editItem;
                                dialogHostForm.Text  = "新增麻药用药数据";
                                editItem.TitleColor  = Color.Blue;
                                DialogResult result = dialogHostForm.ShowDialog();
                                if (result == DialogResult.OK)
                                {
                                    eventRow.ITEM_NO = DataContext.GetCurrent().GetMaxItemNO(anesEvent);
                                    anesEvent.Add(eventRow);
                                    operationInfoRepository.SaveAnesthesiaEventList(anesEvent);
                                    RefreshData();
                                    _currentGraph.Refresh();
                                }
                            }
                        }
                        else
                        {
                            MED_ANESTHESIA_EVENT        row       = _drugRows[pt];
                            List <MED_ANESTHESIA_EVENT> anesEvent = ModelHelper <MED_ANESTHESIA_EVENT> .ConvertDataTableToList(this.DataSource["AnesthesiaEvent"]);

                            EditEventItem editItem = new EditEventItem();
                            editItem.DataSource = row;
                            editItem.ItemType   = EditEventItem.ItemTypes.MedicineItem;
                            editItem.IsAllowDel = true;
                            DialogHostFormPC dialogHostForm = new DialogHostFormPC("修改麻药用药数据", editItem.Width, editItem.Height);
                            dialogHostForm.Child = editItem;
                            editItem.TitleColor  = Color.DarkOrange;
                            if (dialogHostForm.ShowDialog() == DialogResult.OK)
                            {
                                if (editItem != null && editItem.IsDelete)
                                {
                                    if (MessageBoxFormPC.Show("是否确定要删除选中事件?", "操作提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                                    {
                                        List <MED_ANESTHESIA_EVENT> allEvent = ModelHelper <MED_ANESTHESIA_EVENT> .ConvertDataTableToList(this.DataSource["AnesAllEvent"]);

                                        List <MED_ANESTHESIA_EVENT> rows = allEvent.Where(x => x.EVENT_CLASS_CODE == row.EVENT_CLASS_CODE && x.ITEM_NO == row.ITEM_NO).ToList();
                                        if (rows.Count > 0)
                                        {
                                            allEvent.Remove(rows[0]);
                                        }
                                        //  OperationLogger.WriteOperate("文书用药模块", "右键删除", "右键用药模块弹出药品界面,勾选删除选择项,点确定进行删除保存,事件名称【" + row["ITEM_NAME"].ToString() + "】", false, OperationLogKind.Other);
                                        anesEventRepository.DelAnesEvent(row);
                                    }
                                }
                                else
                                {
                                    List <MED_ANESTHESIA_EVENT> eventList = new List <MED_ANESTHESIA_EVENT>();
                                    eventList.Add(row);
                                    operationInfoRepository.SaveAnesthesiaEventList(eventList);
                                }
                                RefreshData();
                                _currentGraph.Refresh();
                            }
                        }
                    }
                }
            }
            catch (Exception err)
            {
                Logger.Error(err.Message);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 鼠标按下事件:响应右键
        /// </summary>
        protected void MedGridGraph_MouseClick(object sender, MouseEventArgs e)
        {
            try
            {
                RectangleF rectf = _currentGraph.GetMainRect();
                if (!rectf.Contains(e.Location.X, e.Location.Y))
                {
                    return;
                }

                if (e.Button == MouseButtons.Right)
                {
                    _currentGraph.SetMousePosition(e.Location);
                    if (_currentGraph.MouseTime > DateTime.MinValue)
                    {
                        MedGridPoint pt = _currentGraph.SelectedPoint;
                        _currentTime = _currentGraph.MouseTime;
                        string eventNo = ExtendAppContext.Current.EventNo;
                        if (pt == null)
                        {
                            List <MED_EVENT_DICT>       eventOpenTable = ExtendApplicationContext.Current.CommDict.EventDict;
                            List <MED_ANESTHESIA_EVENT> anesEvent      = ModelHelper <MED_ANESTHESIA_EVENT> .ConvertDataTableToList(this.DataSource["AnesthesiaEvent"]);

                            int Line = (int)Math.Ceiling((double)e.Location.Y / _currentGraph.Height * _currentGraph.Rows.Count);
                            if (_currentGraph.Rows[Line - 1].Points.Count == 0 || Line == 7 || Line == 8 || Line == 9)
                            {
                                List <MED_EVENT_DICT> eventDict = null;
                                if (Line == 6)
                                {
                                    eventDict = eventOpenTable.Where(x => x.EVENT_CLASS_CODE == "B").ToList();
                                }
                                else if (Line == 7 || Line == 8 || Line == 9)
                                {
                                    eventDict = eventOpenTable.Where(x => x.EVENT_CLASS_CODE == "D").ToList();
                                }
                                else
                                {
                                    eventDict = eventOpenTable.Where(x => x.EVENT_CLASS_CODE == "3").ToList();
                                }

                                DataTable sourceTable = ModelHelper <MED_EVENT_DICT> .ConvertListToDataTable(eventDict);

                                DateTime tempDt = _currentTime != DateTime.MinValue ? _currentTime : DateTime.Now;
                                PopupDrugSelector.ShowSelector(sourceTable, _currentGraph, e.Location, tempDt, this, "输血及输液", eventNo);
                            }
                            else
                            {
                                if (_currentGraph.GetMainRect().X > e.Location.X)
                                {
                                    return;
                                }

                                List <MED_EVENT_DICT> eventDict = eventOpenTable.Where(x => x.EVENT_CLASS_CODE == _currentGraph.Rows[Line - 1].Text &&
                                                                                       (x.EVENT_CLASS_CODE == "B" ||
                                                                                        x.EVENT_CLASS_CODE == "D" ||
                                                                                        x.EVENT_CLASS_CODE == "3")).ToList();
                                if (eventDict.Count == 0)
                                {
                                    return;
                                }

                                MED_EVENT_DICT       row      = eventDict[0];
                                MED_ANESTHESIA_EVENT eventRow = DataContext.GetCurrent().NewAnesthesiaEventRow(anesEvent, eventNo);
                                eventRow.EVENT_CLASS_CODE = row.EVENT_CLASS_CODE;
                                eventRow.EVENT_ITEM_NAME  = row.EVENT_ITEM_NAME;
                                eventRow.EVENT_ITEM_SPEC  = row.EVENT_ITEM_SPEC;
                                eventRow.EVENT_ITEM_CODE  = row.EVENT_ITEM_CODE;
                                eventRow.START_TIME       = _currentTime;
                                if (!string.IsNullOrEmpty(row.EVENT_ATTR))
                                {
                                    eventRow.EVENT_ATTR = row.EVENT_ATTR;
                                }

                                MED_ANESTHESIA_EVENT firstrow = _gridRows[_currentGraph.Rows[Line - 1].Points[0]];
                                if (!string.IsNullOrEmpty(firstrow.ADMINISTRATOR))
                                {
                                    eventRow.ADMINISTRATOR = firstrow.ADMINISTRATOR;
                                }

                                if (!string.IsNullOrEmpty(_currentGraph.Rows[Line - 1].Points[0].ThickNessUnit))
                                {
                                    eventRow.CONCENTRATION_UNIT = _currentGraph.Rows[Line - 1].Points[0].ThickNessUnit;
                                }

                                if (!string.IsNullOrEmpty(_currentGraph.Rows[Line - 1].Points[0].Unit))
                                {
                                    eventRow.DOSAGE_UNITS = _currentGraph.Rows[Line - 1].Points[0].Unit;
                                }

                                if (!string.IsNullOrEmpty(_currentGraph.Rows[Line - 1].Points[0].SpeedUnit))
                                {
                                    eventRow.SPEED_UNIT = _currentGraph.Rows[Line - 1].Points[0].SpeedUnit;
                                }

                                if (!string.IsNullOrEmpty(row.SUPPLIER_NAME))
                                {
                                    eventRow.SUPPLIER_NAME = row.SUPPLIER_NAME;
                                }

                                if (!string.IsNullOrEmpty(_currentGraph.Rows[Line - 1].Points[0].ThickNess.ToString()))
                                {
                                    eventRow.CONCENTRATION = (decimal)_currentGraph.Rows[Line - 1].Points[0].ThickNess;
                                }

                                if (!string.IsNullOrEmpty(_currentGraph.Rows[Line - 1].Points[0].Value.ToString()))
                                {
                                    eventRow.DOSAGE = Convert.ToDecimal(_currentGraph.Rows[Line - 1].Points[0].Value);
                                }

                                if (!string.IsNullOrEmpty(_currentGraph.Rows[Line - 1].Points[0].Speed.ToString()))
                                {
                                    eventRow.PERFORM_SPEED = (decimal)_currentGraph.Rows[Line - 1].Points[0].Speed;
                                }

                                if (row.DURATIVE_INDICATOR.HasValue)
                                {
                                    eventRow.DURATIVE_INDICATOR = row.DURATIVE_INDICATOR;
                                }

                                EditEventItem editItem = new EditEventItem();
                                editItem.DataSource = eventRow;
                                editItem.ItemType   = EditEventItem.ItemTypes.MedicineItem;
                                DialogHostForm dialogHostForm = new DialogHostForm(editItem.Caption, 320, 300);
                                dialogHostForm.Child = editItem;
                                dialogHostForm.Text  = "新增输血及输液数据";
                                DialogResult result = dialogHostForm.ShowDialog();
                                if (result == DialogResult.OK)
                                {
                                    eventRow.ITEM_NO = DataContext.GetCurrent().GetMaxItemNO(anesEvent);
                                    anesEvent.Add(eventRow);
                                    operationInfoRepository.SaveAnesthesiaEventList(anesEvent);
                                    this.RefreshData();
                                    this._currentGraph.Refresh();
                                }
                            }
                        }
                        else
                        {
                            MED_ANESTHESIA_EVENT        row       = _gridRows[pt];
                            List <MED_ANESTHESIA_EVENT> anesEvent = ModelHelper <MED_ANESTHESIA_EVENT> .ConvertDataTableToList(this.DataSource["AnesthesiaEvent"]);

                            EditEventItem editItem = new EditEventItem();
                            editItem.DataSource = row;
                            editItem.ItemType   = EditEventItem.ItemTypes.MedicineItem;
                            editItem.IsAllowDel = true;
                            editItem.TitleColor = Color.DarkOrange;
                            DialogHostFormPC dialogHostForm = new DialogHostFormPC("修改输血及输液数据", 320, 300);
                            dialogHostForm.Child = editItem;
                            if (dialogHostForm.ShowDialog() == DialogResult.OK)
                            {
                                if (editItem != null && editItem.IsDelete)
                                {
                                    if (MessageBoxFormPC.Show("是否确定要删除选中事件?", "操作提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                                    {
                                        List <MED_ANESTHESIA_EVENT> allEvent = ModelHelper <MED_ANESTHESIA_EVENT> .ConvertDataTableToList(this.DataSource["AnesAllEvent"]);

                                        List <MED_ANESTHESIA_EVENT> rows = allEvent.Where(x => x.EVENT_CLASS_CODE == row.EVENT_CLASS_CODE && x.ITEM_NO == row.ITEM_NO).ToList();
                                        if (rows.Count > 0)
                                        {
                                            allEvent.Remove(rows[0]);
                                        }
                                        // OperationLogger.WriteOperate("文书液体模块", "右键删除", "右键液体模块弹出药品界面,勾选删除选择项,点确定进行删除保存,事件名称【" + row["ITEM_NAME"].ToString() + "】", false, OperationLogKind.Other);
                                        anesEventRepository.DelAnesEvent(row);
                                    }
                                }
                                operationInfoRepository.SaveAnesthesiaEventList(anesEvent);
                                RefreshData();
                                _currentGraph.Refresh();
                            }
                        }
                    }
                }
            }
            catch (Exception err)
            {
                ExceptionHandler.Handle(err);
            }
        }
Ejemplo n.º 3
0
        protected static void PopDrugItem_Selected(object s1, EventArgs e1)
        {
            try
            {
                DataRow row = s1 as DataRow;

                if (row == null)
                {
                    return;
                }
                List <MED_ANESTHESIA_EVENT> anesEvent = ModelHelper <MED_ANESTHESIA_EVENT> .ConvertDataTableToList(_handler.DataSource["AnesAllEvent"]);

                if (anesEvent == null)
                {
                    anesEvent = new List <MED_ANESTHESIA_EVENT>();
                }
                MED_ANESTHESIA_EVENT eventRow = DataContext.GetCurrent().NewAnesthesiaEventRow(anesEvent, _eventNo);

                eventRow.EVENT_CLASS_CODE = row["EVENT_CLASS_CODE"].ToString();
                eventRow.EVENT_ITEM_NAME  = row["EVENT_ITEM_NAME"].ToString();
                eventRow.EVENT_ITEM_SPEC  = row["EVENT_ITEM_SPEC"].ToString();
                eventRow.EVENT_ITEM_CODE  = row["EVENT_ITEM_CODE"].ToString();
                eventRow.START_TIME       = _currentTime;

                if (!row.IsNull("ADMINISTRATOR"))
                {
                    eventRow.ADMINISTRATOR = row["ADMINISTRATOR"].ToString();
                }

                if (!row.IsNull("CONCENTRATION_UNIT"))
                {
                    eventRow.CONCENTRATION_UNIT = row["CONCENTRATION_UNIT"].ToString();
                }

                if (!row.IsNull("DOSAGE_UNITS"))
                {
                    eventRow.DOSAGE_UNITS = row["DOSAGE_UNITS"].ToString();
                }

                if (!row.IsNull("SPEED_UNIT"))
                {
                    eventRow.SPEED_UNIT = row["SPEED_UNIT"].ToString();
                }

                if (!row.IsNull("SUPPLIER_NAME"))
                {
                    eventRow.SUPPLIER_NAME = row["SUPPLIER_NAME"].ToString();
                }

                if (!row.IsNull("CONCENTRATION"))
                {
                    eventRow.CONCENTRATION = Convert.ToDecimal(row["CONCENTRATION"]);
                }

                if (!row.IsNull("DOSAGE"))
                {
                    eventRow.DOSAGE = Convert.ToDecimal(row["DOSAGE"]);
                }

                if (!row.IsNull("PERFORM_SPEED"))
                {
                    eventRow.PERFORM_SPEED = Convert.ToDecimal(row["PERFORM_SPEED"]);
                }

                if (!row.IsNull("DURATIVE_INDICATOR"))
                {
                    eventRow.DURATIVE_INDICATOR = Convert.ToInt32(row["DURATIVE_INDICATOR"]);
                }

                EditEventItem editItem = new EditEventItem();
                editItem.DataSource = eventRow;
                editItem.ItemType   = _title == "事件" ? EditEventItem.ItemTypes.EventItem : EditEventItem.ItemTypes.MedicineItem;
                DialogHostFormPC dialogHostForm = new DialogHostFormPC(editItem.Caption, editItem.Width, editItem.Height);
                dialogHostForm.Child = editItem;
                dialogHostForm.Text  = _title;
                editItem.TitleColor  = Color.Blue;
                DialogResult result = dialogHostForm.ShowDialog(_parent);
                if (result == DialogResult.OK)
                {
                    anesEvent.Add(eventRow);

                    new OperationInfoRepository().SaveAnesthesiaEventList(anesEvent);

                    if (_handler.AttatchDoc != null)
                    {
                        _handler.AttatchDoc.RefreshData();
                    }
                }
            }
            catch (Exception err)
            {
                ExceptionHandler.Handle(err);
            }
        }