/// <summary> /// 测试方法 /// </summary> private void Test() { string message = ""; CommonNoteBiz cbiz = new CommonNoteBiz(m_app); m_commonNoteEntity = cbiz.GetDetailCommonNote("f5d1c558-df2a-4ac5-8d1d-6ef3ccaef5e7"); InCommonNoteBiz icombiz = new InCommonNoteBiz(m_app); List <InCommonNoteEnmtity> InCommonNoteList = icombiz.GetSimInCommonNote("1333"); if (InCommonNoteList == null || InCommonNoteList.Count == 0) { m_inCommonNote = InCommonNoteBiz.ConvertCommonToInCommon(m_commonNoteEntity); DataTable inpatientDt = icombiz.GetInpatient("1333"); m_inCommonNote.CurrDepartID = inpatientDt.Rows[0]["OUTHOSDEPT"].ToString(); m_inCommonNote.CurrDepartName = inpatientDt.Rows[0]["DEPARTNAME"].ToString(); m_inCommonNote.CurrWardID = inpatientDt.Rows[0]["OUTHOSWARD"].ToString(); m_inCommonNote.CurrWardName = inpatientDt.Rows[0]["WARDNAME"].ToString(); m_inCommonNote.NoofInpatient = "1333"; m_inCommonNote.InPatientName = inpatientDt.Rows[0]["NAME"].ToString(); bool saveResult = icombiz.SaveInCommomNoteAll(m_inCommonNote, ref message); } else { m_inCommonNote = InCommonNoteList[0]; } }
/// <summary> /// 将commonNoteEntity转成InCommonNoteEnmtity,并保存 /// </summary> /// <param name="commonNoteEntity"></param> /// <returns></returns> private InCommonNoteEnmtity ConverBycommonNote(CommonNoteEntity commonNoteEntity) { try { CommonNoteBiz commonNoteBiz = new DrectSoft.Core.CommonTableConfig.CommonNoteBiz(m_app); commonNoteEntity = commonNoteBiz.GetDetailCommonNote(commonNoteEntity.CommonNoteFlow); InCommonNoteEnmtity inCommonNote = InCommonNoteBiz.ConvertCommonToInCommon(commonNoteEntity); InCommonNoteBiz icombiz = new DrectSoft.Core.CommonTableConfig.CommonNoteUse.InCommonNoteBiz(m_app); DataTable inpatientDt = icombiz.GetInpatient(m_noofInpat); inCommonNote.CurrDepartID = inpatientDt.Rows[0]["OUTHOSDEPT"].ToString(); inCommonNote.CurrDepartName = inpatientDt.Rows[0]["DEPARTNAME"].ToString(); inCommonNote.CurrWardID = inpatientDt.Rows[0]["OUTHOSWARD"].ToString(); inCommonNote.CurrWardName = inpatientDt.Rows[0]["WARDNAME"].ToString(); inCommonNote.NoofInpatient = m_noofInpat; inCommonNote.InPatientName = inpatientDt.Rows[0]["NAME"].ToString(); string message = ""; bool saveResult = icombiz.SaveInCommomNoteAll(inCommonNote, ref message); if (saveResult) { return(inCommonNote); } else { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("创建单据失败"); return(null); } } catch (Exception ex) { throw ex; } }
public UCInCommonNote(IYidanEmrHost app, CommonNoteEntity commonNoteEntity, InCommonNoteEnmtity inCommonNote, bool canEdit) { try { m_app = app; m_commonNoteEntity = commonNoteEntity; m_inCommonNote = inCommonNote; m_canEdit = canEdit; //Test(); InitializeComponent(); InitForm(); } catch (Exception ex) { YiDanCommon.Ctrs.DLG.YiDanMessageBox.Show(ex.StackTrace); } }
/// <summary> /// 树选择节点改变事件 /// xlb 2013-01-19 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void treeListInpat_FocusedNodeChanged(object sender, FocusedNodeChangedEventArgs e) { try { InCommonNoteEnmtity inCommonNoteEntity = null; if (e.Node == null || !(e.Node.Tag is InCommonNoteEnmtity)) { //删除通用单据 lblJLDName.Text = ""; pcJLD.Controls.Clear(); return; } inCommonNoteEntity = e.Node.Tag as InCommonNoteEnmtity; if (pcJLD.Controls != null && pcJLD.Controls.Count != 0) { uCInCommonNote = (pcJLD.Controls[0] as UCInCommonNote); if (uCInCommonNote != null) { //判断是否存在未保存数据 bool HasSave = uCInCommonNote.HasInfoSave(); if (HasSave == true) { if (MessageBox.Show("是否需要保存数据?", "提示", MessageBoxButtons.YesNo) == DialogResult.No) { //不保存则不处理前节点的数据 AddUCInCommonNote(inCommonNoteEntity); return; } //选择保存则执行该方法 uCInCommonNote.SaveAllDate(); } } } AddUCInCommonNote(inCommonNoteEntity); //判断单据是否被删除,删除则删除该节点 xlb 2013-02-01 if (uCInCommonNote.m_inCommonNote.InCommonNoteFlow == null) { e.Node.TreeList.DeleteNode(e.Node); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// 右键删除事件 /// xlb 2013-01-19 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void barButtonItemDel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { TreeListNode treeList = treeListInpat.FocusedNode; if (treeList != null && treeList.Tag != null && treeList.Tag is InCommonNoteEnmtity) { m_inCommonNote = treeList.Tag as InCommonNoteEnmtity; } else { barCheckItemDel.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; } if (MyMessageBox.Show("您确定删除吗?", "提示", MyMessageBoxButtons.OkCancel) == DialogResult.Cancel) { return; } if (m_inCommonNoteBiz == null) { m_inCommonNoteBiz = new InCommonNoteBiz(m_app); } string message = ""; //用来判断要删除的单据是否有记录,有则无法删除 int count = m_inCommonNoteBiz.GetCommonItemCount(m_inCommonNote.InCommonNoteFlow); if (count != 0) { //throw new Exception("已被使用无法删除"); MessageBox.Show("已被使用无法删除"); return; } bool delResult = m_inCommonNoteBiz.DelInCommonNote(m_inCommonNote, ref message); if (delResult) { treeListInpat.DeleteNode(treeList);//删除节点 MessageBox.Show("删除单据成功"); } } catch (Exception ex) { MyMessageBox.Show(1, ex); } }
///// <summary> ///// 展开节点触发的事件 ///// xlb 2013-01-29 ///// 解决存在大量数据时一次加载引起的卡屏 ///// </summary> ///// <param name="sender"></param> ///// <param name="e"></param> //private void treeListInpat_AfterExpand(object sender, DevExpress.XtraTreeList.NodeEventArgs e) //{ // try // { // //如果有子节点则展开 // if (e.Node.HasChildren) // { // e.Node.ExpandAll(); // } // TreeListNode parentNode = e.Node;//以当前要展开的节点为父节点 // InPatientSim inpatient=new InPatientSim(); // if (e.Node.Tag is InPatientSim) // { // inpatient = e.Node.Tag as InPatientSim; // } // List<InCommonNoteEnmtity> inCommonNoteList = m_inCommonNoteBiz.GetSimInCommonNote(inpatient.NoofInpat.ToString()); // MakeTreeATwo(inCommonNoteList, parentNode); // } // catch (Exception ex) // { // MyMessageBox.Show(1, ex); // } //} #endregion /// <summary> /// 右键新增事件 /// xlb 2013-01-19 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void barButtonItemAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { InPatientSim inpatient = null; TreeListNode node = treeListInpat.FocusedNode; //父节点 TreeListNode node2 = null; //子节点 if (node != null && node.Tag != null && node.Tag is InPatientSim) { inpatient = node.Tag as InPatientSim; } CommonChooseForm commonChooseForm = new Core.CommonTableConfig.CommonNoteUse.CommonChooseForm("护理单据模板选择", m_app); //窗体运行起始位置居中 commonChooseForm.StartPosition = FormStartPosition.CenterScreen; if (commonChooseForm.ShowDialog() != DialogResult.OK) { return; } InCommonNoteEnmtity inCommonNote = ConvertToByCommonNote(commonChooseForm.SelectCommonNoteEntity, inpatient); if (inCommonNote == null) { return; } InCommonNoteBiz icbiz = new InCommonNoteBiz(m_app); icbiz.GetDetaliInCommonNote(ref inCommonNote); string createTIme = DateUtil.getDateTime(inCommonNote.CreateDateTime, DateUtil.NORMAL_LONG); string commmonNote = "创建人:" + inCommonNote.CreateDoctorName + "|" + "时间:" + createTIme; node2 = treeListInpat.AppendNode(new object[] { inCommonNote.InCommonNoteName, "Leaf", commmonNote }, node); node2.Tag = inCommonNote; treeListInpat.FocusedNode = node2;//定位在新增子节点上 } catch (Exception ex) { MyMessageBox.Show(1, ex); } }
/// <summary> /// 将CommonNoeEntity->InCommonNoteEnmtity; /// xlb 2013-01-19 /// </summary> /// <param name="commonNote"></param> /// <returns></returns> private InCommonNoteEnmtity ConvertToByCommonNote(CommonNoteEntity commonNote, InPatientSim inPatient) { try { //用来接收选择的模板的新模板名称 string commonNoteNames = commonNote.CommonNoteName == null ? "" : commonNote.CommonNoteName; CommonNoteBiz commonNoteBiz = new CommonNoteBiz(m_app); commonNote = commonNoteBiz.GetDetailCommonNote(commonNote.CommonNoteFlow); commonNote.CommonNoteName = commonNoteNames;//模板名称修改 InCommonNoteEnmtity inCommonNote = InCommonNoteBiz.ConvertCommonToInCommon(commonNote); InCommonNoteBiz incommonNoteBiz = new InCommonNoteBiz(m_app); DataTable dtPatient = incommonNoteBiz.GetInpatient(inPatient.NoofInpat.ToString()); inCommonNote.CurrDepartID = dtPatient.Rows[0]["OUTHOSDEPT"].ToString(); inCommonNote.CurrDepartName = dtPatient.Rows[0]["DEPARTNAME"].ToString(); inCommonNote.CurrWardID = dtPatient.Rows[0]["OUTHOSWARD"].ToString(); inCommonNote.CurrWardName = dtPatient.Rows[0]["WARDNAME"].ToString(); inCommonNote.NoofInpatient = inPatient.NoofInpat.ToString(); inCommonNote.InPatientName = dtPatient.Rows[0]["NAME"].ToString(); inCommonNote.CreateDateTime = DateTime.Now.ToString(); inCommonNote.Valide = "1"; string message = ""; bool saveResult = incommonNoteBiz.SaveInCommomNoteAll(inCommonNote, ref message); if (saveResult) { return(inCommonNote); } else { MessageBox.Show("创建单据失败"); return(null); } } catch (Exception ex) { throw ex; } }
/// <summary> /// 创建护理单据控件 添加到界面 /// edit by xlb 2013-01-29 /// </summary> /// <param name="MyinCommonNoteEnmtity"></param> private void AddUCInCommonNote(InCommonNoteEnmtity MyinCommonNoteEnmtity) { try { if (MyinCommonNoteEnmtity == null) { return; } CommonNoteBiz commonNoteBiz = new Core.CommonTableConfig.CommonNoteBiz(m_app); var commonnote = commonNoteBiz.GetDetailCommonNote(MyinCommonNoteEnmtity.CommonNoteFlow); int noofinpat = Convert.ToInt32(MyinCommonNoteEnmtity.NoofInpatient); DataTable dt = DS_SqlService.GetInpatientByID(noofinpat, 2); if (dt == null || dt.Rows.Count <= 0) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("病人不存在"); return; } string deptID = dt.Rows[0]["outhosdept"].ToString(); bool canEdit = true; if (deptID != MyinCommonNoteEnmtity.CurrDepartID) { canEdit = false; } uCInCommonNote = new UCInCommonNote(m_app, commonnote, MyinCommonNoteEnmtity, canEdit); pcJLD.Controls.Clear(); uCInCommonNote.Dock = DockStyle.Fill; pcJLD.Controls.Add(uCInCommonNote); string createTIme = DateUtil.getDateTime(MyinCommonNoteEnmtity.CreateDateTime, DateUtil.NORMAL_LONG); lblJLDName.Text = "病人:" + MyinCommonNoteEnmtity.InPatientName + " " + MyinCommonNoteEnmtity.InCommonNoteName; } catch (Exception ex) { throw ex; } }
private void gvInpatient_DoubleClick(object sender, EventArgs e) { try { var gvInpatient = (sender as DevExpress.XtraGrid.Views.Grid.GridView); if (gvInpatient == null) { return; } m_drInpatient = gvInpatient.GetFocusedDataRow(); if (m_drInpatient == null || string.IsNullOrEmpty(m_drInpatient["NOOFINPAT"].ToString())) { return; } //未保存数据提示 if (pcJLD.Controls != null && pcJLD.Controls.Count != 0) { UCInCommonNote uCInCommonNote = (pcJLD.Controls[0] as UCInCommonNote); if (uCInCommonNote != null) { bool HasSave = uCInCommonNote.HasInfoSave(); if (HasSave == true) { DialogResult diaResult = DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("存在数据未保存,确定退出吗?", "提示", DrectSoft.Common.Ctrs.DLG.MyMessageBoxButtons.YesNo); if (diaResult == DialogResult.No) { return; } } } } m_noofInpat = m_drInpatient["NOOFINPAT"].ToString(); InCommonNoteEnmtity MyinCommonNoteEnmtity = null; InCommonNoteBiz inCommonNoteBiz = new InCommonNoteBiz(m_app); List <InCommonNoteEnmtity> inCommonNoteListAll = inCommonNoteBiz.GetSimInCommonNote(this.m_noofInpat); List <InCommonNoteEnmtity> inCommonNoteList = inCommonNoteListAll.FindAll(a => a.CommonNoteFlow == m_commonNoteEntity.CommonNoteFlow) as List <InCommonNoteEnmtity>; if (inCommonNoteList != null && inCommonNoteList.Count >= 2) { InCommListForm inCommListForm = new InCommListForm(inCommonNoteList, m_app, m_noofInpat, m_commonNoteEntity); DialogResult diaResult = inCommListForm.ShowDialog(); if (diaResult == DialogResult.OK) { MyinCommonNoteEnmtity = inCommListForm.MyInCommonNoteEnmtity; AddUCInCommonNote(MyinCommonNoteEnmtity); } else { return; } } else if (inCommonNoteList == null || inCommonNoteList.Count == 0) { MyinCommonNoteEnmtity = ConverBycommonNote(m_commonNoteEntity); if (MyinCommonNoteEnmtity == null) { return; } AddUCInCommonNote(MyinCommonNoteEnmtity); } else { MyinCommonNoteEnmtity = inCommonNoteList[0]; AddUCInCommonNote(MyinCommonNoteEnmtity); } lblJLDName.Text = m_drInpatient["NAME"].ToString() + ":" + MyinCommonNoteEnmtity.InCommonNoteName; } catch (Exception ex) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show(ex.StackTrace); } }