Ejemplo n.º 1
0
        private bool CanWithdrawSubmissionCore(EmrModel model)
        {
            if (_readOnlyMode)
            {
                return(false);
            }
            int grade = _employee.DoctorGradeNumber;

            if (grade == -1)
            {
                return(false);
            }
            // Check State
            if ((model.State == ExamineState.NotSubmit) || (model.State == ExamineState.Deleted))
            {
                return(false);
            }
            if (model.State == ExamineState.SubmitButNotExamine) // 已提交未审核
            {
                //如果允许多次撤销,若当前病历是当前医生创建或当前医师是住院医师级别以上的医师,则允许撤销

                return(_employee.DoctorGradeNumber > 1);
            }
            else if (model.State == ExamineState.FirstExamine) // 主治已审核状态
            {
                return(_employee.DoctorGradeNumber > 1);       // 暂时不做其它控制
            }
            else // 其它状态下,只能由主任撤销
            {
                return(_employee.DoctorGradeNumber > 2);
            }
        }
Ejemplo n.º 2
0
        public void LoadDocment(EmrModel model)
        {
            m_CurrentModel = model;
            SetReplaceEvent();

            if (model.ModelContent == null)
            {
                //model.ModelContent = zyEditorControl1.BinaryToXml(m_Util.GetTemplateContent(model.TempIdentity));
                XmlDocument doc = new XmlDocument();
                doc.PreserveWhitespace = true;
                doc.LoadXml(m_Util.GetTemplateContent(model.TempIdentity, model.PersonalTemplate));
                model.ModelContent = doc;
            }

            if (model.ModelContent != null && !model.IsReadConfigPageSize && model.ModelCatalog != ContainerCatalog.BingChengJiLu)
            {
                SetPageSize(model.ModelContent);
            }

            zyEditorControl1.EMRDoc.ClearContent();
            zyEditorControl1.LoadXML(model.ModelContent);
            SetSubTitleFont();

            //设置当前病人
            this.zyEditorControl1.EMRDoc.Info.PatientID = m_Util.CurrentInpatient.NoOfFirstPage.ToString();

            //判断当前模型状态
            ResetEditMode(model);

            zyEditorControl1.EMRDoc.Modified = false;
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 设置病程的所有时间
 /// </summary>
 /// <auth>Yanqiao.Cai</auth>
 /// <date>2013-01-08</date>
 /// <param name="node">当前节点</param>
 public void SetAllDisplayDateTime(TreeListNode node)
 {
     try
     {
         if (null == node || null == node.ParentNode)
         {
             return;
         }
         var nodeList = node.ParentNode.Nodes;
         if (null == nodeList || nodeList.Count == 0)
         {
             return;
         }
         foreach (TreeListNode nd in nodeList)
         {
             if (null != nd.Tag && nd.Tag is EmrModel)
             {
                 EmrModel model = (EmrModel)nd.Tag;
                 if (null == model)
                 {
                     continue;
                 }
                 m_AllDisplayDateTime.Add(model.DisplayTime.ToString("yyyy-MM-dd HH:mm:ss"));
             }
         }
         m_AllDisplayDateTime = m_AllDisplayDateTime.OrderBy(q => DateTime.Parse(q)).ToList();
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 加载病人的病历记录
        /// </summary>
        /// <param name="noofinpat"></param>
        private void LoadHistoryEmr()
        {
            foreach (TreeListNode node in treeListHistory.Nodes)
            {
                HistoryInpatient pat = node.Tag as HistoryInpatient;
                if (pat == null)
                {
                    continue;
                }
                DataTable datatable = m_RecordDal.GetHistoryInpatientFolder(Convert.ToInt32(pat.NoOfInpat));
                foreach (DataRow dr in datatable.Rows)
                {
                    //加载病历文件夹
                    TreeListNode      subNode   = treeListHistory.AppendNode(new object[] { dr["CNAME"].ToString() }, node);
                    EmrModelContainer container = new EmrModelContainer(dr);
                    subNode.Tag = container;

                    if (container.EmrContainerType != ContainerType.None)
                    {
                        //加载具体的病历
                        DataTable leafs = m_patUtil.GetPatRecInfo(container.ContainerCatalog, pat.NoOfInpat);
                        {
                            foreach (DataRow leaf in leafs.Rows)
                            {
                                EmrModel     leafmodel = new EmrModel(leaf);
                                TreeListNode leafNode  = treeListHistory.AppendNode(new object[] { leafmodel.ModelName }, subNode);
                                leafNode.Tag = leafmodel;
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 5
0
        public void ResetEditMode(EmrModel model)
        {
            IEmrModelPermision modelPermision;
            bool b;

            DrectSoft.Common.Eop.Employee empl = new DrectSoft.Common.Eop.Employee(m_app.User.Id);

            modelPermision = ModelPermisionFactroy.Create(ModelPermisionType.Audit, empl);
            b = modelPermision.CanDo(model);
            if (b) // 文件已提交,处于审核模式
            {
                // 审核——已提交(未归档),符合级别要求

                //m_ActionAuditAll.Enabled = b;
            }
            else
            {
                //是否可以编辑
                modelPermision = ModelPermisionFactroy.Create(ModelPermisionType.Edit, empl);
                b = modelPermision.CanDo(model);
                //保存按钮状态
                //
                // 提交——新增状态,未归档,本人创建
                modelPermision = ModelPermisionFactroy.Create(ModelPermisionType.Submit, empl);
                b = modelPermision.CanDo(model);

                // 删除——新增状态,未归档,本人创建
                modelPermision = ModelPermisionFactroy.Create(ModelPermisionType.Delete, empl);
                b = modelPermision.CanDo(model);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 设置复选框列表
        /// </summary>
        public void SetCheckBoxList()
        {
            try
            {
                //SetPreViewVisible(false);
                DataTable dt = GetEmrRecord(m_CurrentInpatient.NoOfFirstPage.ToString(), ChangeID);
                if (CheckIfNeedRefresh(dt, CurrentUCEmrInputBody.CurrentTreeList.FocusedNode))
                {
                    if (MyMessageBox.Show("数据库中病历有更新,建议您刷新后预览。您是否要刷新病程记录?", "提示", MyMessageBoxButtons.YesNo, DrectSoft.Common.Ctrs.DLG.MessageBoxIcon.QuestionIcon) == DialogResult.Yes)
                    {
                        TreeListNode focusedNode = CurrentUCEmrInputBody.CurrentTreeList.FocusedNode;
                        if (null != focusedNode && null != focusedNode.Tag && focusedNode.Tag is EmrModel)
                        {
                            EmrModel model = focusedNode.Tag as EmrModel;
                            m_App.CurrentSelectedEmrID = model.InstanceId.ToString();
                        }
                        CurrentUCEmrInputBody.RefreshBingChengJiLu();
                    }
                }

                m_WaitDialog = new WaitDialogForm("正在加载病程预览区...", "请稍候");
                SetCheckBoxListSource(dt);
                DefaultCheckItem();
                XmlDocument doc = ConcatCheckedEmrContent();

                SetEmrContent(doc);
                SetPreViewVisible(true);
                CurrentEditorForm.SetCurrentElement(FirstCallRecordDetailCaptionDateTime);
                DS_Common.HideWaitDialog(m_WaitDialog);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 /// 刷新病历预览区
 /// </summary>
 /// <param name="model">病历</param>
 /// <param name="editState">状态</param>
 public void RefreashEmrView(EmrModel model, EditState editState)
 {
     try
     {
         if (null == model || null == m_CurrentModel)
         {
             return;
         }
         ///刷新预览区
         var preViewArray = m_TempDailyPreViewCollection.FirstOrDefault(p => !string.IsNullOrEmpty(m_CurrentModel.DeptChangeID) && p.Key == m_CurrentModel.DeptChangeID);
         if (null != preViewArray.Value && null != preViewArray.Value.PreViewInner)
         {
             if (editState == EditState.Add || editState == EditState.Edit)
             {///保存
                 preViewArray.Value.PreViewInner.AfterSaveEmr(m_CurrentModel.InstanceId.ToString(), m_CurrentModel.DisplayTime.ToString("yyyy-MM-dd HH:mm:ss"));
             }
             else if (editState == EditState.Delete)
             {///删除
                 preViewArray.Value.PreViewInner.AfterDeleteEmr(m_CurrentModel.InstanceId.ToString());
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 8
0
        /// <summary>
        /// 計算病程可以修改的時間範圍
        /// </summary>
        /// <param name="node"></param>
        private void ComputeDateTimeMinAndMax(TreeListNode node, string datetime)
        {
            DateTime currentDateTime = Convert.ToDateTime(datetime);

            if (node != null && node.Tag != null)
            {
                EmrModel emrModel = node.Tag as EmrModel;
                if (emrModel != null && emrModel.DailyEmrModel)
                {
                    for (int i = 0; i < node.ParentNode.Nodes.Count; i++)
                    {
                        TreeListNode subNode       = node.ParentNode.Nodes[i];
                        EmrModel     dailyEmrModel = subNode.Tag as EmrModel;
                        if (dailyEmrModel.DisplayTime < currentDateTime)
                        {
                            if (m_MinDateTime == DateTime.MinValue || m_MinDateTime < dailyEmrModel.DisplayTime)
                            {
                                m_MinDateTime = dailyEmrModel.DisplayTime;
                            }
                        }
                        else if (currentDateTime < dailyEmrModel.DisplayTime)
                        {
                            if (m_MaxDateTime == DateTime.MinValue || dailyEmrModel.DisplayTime < m_MaxDateTime)
                            {
                                m_MaxDateTime = dailyEmrModel.DisplayTime;
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 在病历编辑器中定位病程记录
        /// </summary>
        /// <param name="node"></param>
        public void LocateDailyEmrMode(TreeListNode node)
        {
            if (node.Tag is EmrModel)
            {
                EmrModel model           = node.Tag as EmrModel;
                string   displayDateTime = model.DisplayTime.ToString("yyyy-MM-dd HH:mm:ss");

                this.zyEditorControl1.EMRDoc.Info.DocumentModel = DocumentModel.Edit;

                ArrayList al = new ArrayList();
                this.zyEditorControl1.EMRDoc.GetAllSpecElement(al, this.zyEditorControl1.EMRDoc.RootDocumentElement, ElementType.Text, "记录日期");

                //把光标定位到它处
                ZYText find = null;
                foreach (ZYText ele in al)
                {
                    if (ele.Text == displayDateTime)
                    {
                        find = ele;
                        break;
                    }
                }
                if (find != null)
                {
                    this.zyEditorControl1.EMRDoc.Content.AutoClearSelection = true;
                    this.zyEditorControl1.EMRDoc.Content.MoveSelectStart(find.FirstElement);
                    this.zyEditorControl1.ScrollViewtopToCurrentElement();

                    //设置编辑区域
                    this.zyEditorControl1.Refresh();
                }
            }
        }
Ejemplo n.º 10
0
 /// <summary>
 /// 获取页面所有病历节点Model
 /// 注:只针对病程记录
 /// </summary>
 /// <returns></returns>
 public static List <EmrModel> GetAllEmrModels(TreeListNodes nodes, List <EmrModel> list)
 {
     try
     {
         if (null == nodes || nodes.Count == 0)
         {
             return(list);
         }
         if (null == list)
         {
             list = new List <EmrModel>();
         }
         foreach (TreeListNode node in nodes)
         {
             if (null != node.Tag && node.Tag is EmrModel)
             {
                 EmrModel modelevey = (EmrModel)node.Tag;
                 if (modelevey.DailyEmrModel)
                 {
                     list.Add(modelevey);
                 }
             }
             else if (null != node.Nodes && node.Nodes.Count > 0)
             {
                 list = GetAllEmrModels(node.Nodes, list);
             }
         }
         return(list);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="datetime">当前所修改的病历时间</param>
        /// <param name="app"></param>
        /// <param name="firstEmrModel">首次病程</param>
        public DailyFormDisplayDateTime(IEmrHost app, UCEmrInputBody emrInputBody)
            : this()
        {
            if (null == emrInputBody)
            {
                return;
            }
            m_App             = app;
            m_CurrentEmrModel = emrInputBody.CurrentModel;
            m_FirstEmrModel   = Util.GetFirstDailyEmrModel(emrInputBody.CurrentTreeList);
            m_TreeList        = emrInputBody.CurrentTreeList;

            if (null != m_CurrentEmrModel)
            {
                dateEditData.EditValue = m_CurrentEmrModel.DisplayTime.ToString("yyyy-MM-dd");
                timeEditTime.EditValue = m_CurrentEmrModel.DisplayTime.ToString("HH:mm:ss");
            }
            else
            {
                dateEditData.EditValue = System.DateTime.Now.ToString("yyyy-MM-dd");
                timeEditTime.EditValue = System.DateTime.Now.ToString("HH:mm:ss");
            }
            List <EmrModel> modelList = Util.GetAllEmrModels(emrInputBody.CurrentTreeList.Nodes, new List <EmrModel>());

            ComputeDateTime(m_CurrentEmrModel, m_FirstEmrModel, modelList);
        }
Ejemplo n.º 12
0
 public static void GetFirstDailyEmrModelInner(TreeList treeList, TreeListNodes nodes)
 {
     try
     {
         if (nodes == null)
         {
             FirstDailyEmrModel = null;
             nodes = treeList.Nodes;
         }
         if (FirstDailyEmrModel != null)
         {
             return;
         }
         foreach (TreeListNode subNode in nodes)
         {
             EmrModel model = subNode.Tag as EmrModel;
             if (model != null && model.FirstDailyEmrModel)
             {
                 FirstDailyEmrModel = model;
             }
             GetFirstDailyEmrModelInner(treeList, subNode.Nodes);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 13
0
        /// <summary>
        /// 设置时间提示信息
        /// </summary>
        /// <param name="currentEmrModel"></param>
        /// <param name="firstEmrModel"></param>
        private void ComputeDateTime(EmrModel currentEmrModel, EmrModel firstEmrModel, List <EmrModel> modelList)
        {
            try
            {
                if (null != currentEmrModel && null != firstEmrModel)
                {
                    if (currentEmrModel.FirstDailyEmrModel)
                    {///修改的病历是首程
                        m_MinDateTime             = DS_BaseService.GetInHostTime((int)m_App.CurrentPatientInfo.NoOfFirstPage);
                        this.labelControlTip.Text = "病程时间应大于入院时间 " + m_MinDateTime.ToString("yyyy-MM-dd HH:mm:ss");

                        EmrModel firstModel = modelList.Where(p => !p.FirstDailyEmrModel).OrderByDescending(q => q.DisplayTime).FirstOrDefault();
                        if (null != firstModel)
                        {
                            m_MaxDateTime              = firstModel.DisplayTime;
                            this.labelControlTip.Text += ",小于下一个病历时间 " + firstModel.DisplayTime.ToString("yyyy-MM-dd HH:mm:ss") + "。";
                        }
                    }
                    else
                    {///修改的病历不是首程
                        m_MinDateTime             = firstEmrModel.DisplayTime;
                        this.labelControlTip.Text = "病程时间应大于首次病程时间 " + m_MinDateTime.ToString("yyyy-MM-dd HH:mm:ss");
                    }
                }
                else
                {
                    m_MinDateTime             = DS_BaseService.GetInHostTime((int)m_App.CurrentPatientInfo.NoOfFirstPage);
                    this.labelControlTip.Text = "病程时间应大于入院时间 " + m_MinDateTime.ToString("yyyy-MM-dd HH:mm:ss");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 14
0
 /// <summary>
 /// 保存所有病历
 /// </summary>
 /// <auth>Yanqiao.Cai</auth>
 /// <date>2013-02-21</date>
 /// <param name="list"></param>
 private void SaveRecordsInTran(List <DataRow> list)
 {
     try
     {
         if (null == list || list.Count() == 0)
         {
             return;
         }
         DS_SqlHelper.CreateSqlHelper();
         DS_SqlHelper.BeginTransaction();
         foreach (DataRow dr in list)
         {
             if (dr["sortid"].ToString() == ContainerCatalog.BingChengJiLu && !m_IsNeedBatchInDailyEmr)//如果是病程记录,并且不需要导入病程,则暂时不做任何动作
             {
                 //TODO
             }
             else
             {
                 EmrModel model = new EmrModel(dr);
                 if (null != dr["content"] && !string.IsNullOrEmpty(dr["content"].ToString().Trim()))
                 {
                     model.ModelContent = NewXmlDocument(dr["content"].ToString());
                 }
                 m_RecordDal.InsertModelInstanceInTran(model, Convert.ToInt32(m_CurrentInpatient.NoOfFirstPage));
             }
         }
         DS_SqlHelper.CommitTransaction();
     }
     catch (Exception ex)
     {
         DS_SqlHelper.AppDbTransaction.Rollback();
         throw new Exception(ex.Message);
     }
 }
Ejemplo n.º 15
0
        private void treeListHistory_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            try
            {
                TreeListHitInfo hitInfo = treeListHistory.CalcHitInfo(e.Location);
                if (hitInfo != null && hitInfo.Node != null)
                {
                    TreeListNode node  = hitInfo.Node;
                    EmrModel     model = node.Tag as EmrModel;
                    if (model != null)
                    {
                        //弹出病历内容
                        HistoryEmrForm printForm = new HistoryEmrForm(m_patUtil, m_RecordDal, model, node);
                        printForm.ShowDialog();
                        if (CurrentForm != null)
                        {
                            CurrentForm.Focus();
                        }

                        if (printForm.IsNeedInsertContent && CurrentForm != null)
                        {
                            if (CanEdit())
                            {
                                CurrentForm.zyEditorControl1.EMRDoc._Paste();
                                Clipboard.Clear();
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        /// 检查是否需要刷新病程记录
        /// </summary>
        /// <param name="dt">数据库中该病程科室下所有记录</param>
        /// <param name="focusedNode">获取焦点的病历</param>
        /// <returns></returns>
        private bool CheckIfNeedRefresh(DataTable dt, TreeListNode focusedNode)
        {
            try
            {
                if (null == focusedNode || null == focusedNode.ParentNode || !(focusedNode.ParentNode.Tag is EmrModelDeptContainer))
                {
                    return(false);
                }
                List <EmrModel> savedList = CurrentUCEmrInputBody.GetSavedEmrModelsInFloader(CurrentUCEmrInputBody.CurrentTreeList.FocusedNode);
                if (savedList.Count() != dt.Rows.Count)
                {
                    return(true);
                }
                else if (null != focusedNode.ParentNode.Nodes && focusedNode.ParentNode.Nodes.Count > 0)
                {
                    foreach (TreeListNode node in focusedNode.ParentNode.Nodes)
                    {
                        if (null != node.Tag && node.Tag is EmrModel)
                        {
                            EmrModel model = node.Tag as EmrModel;
                            if (model.InstanceId != -1 && !dt.AsEnumerable().Any(p => Convert.ToInt32(p["id"]) == model.InstanceId))
                            {
                                return(true);
                            }
                        }
                    }
                }

                return(false);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 17
0
        /// <summary>
        /// 判断是否有审核的权限
        /// </summary>
        /// <param name="model"></param>
        /// <returns>true:有审核权限 false:没有审核权限</returns>
        private bool GetThreeLevelCheck(EmrModel model, Employee employee)
        {
            IDataAccess sqlDataAccess = DataAccessFactory.DefaultDataAccess;
            bool        result        = true;
            string      num           = sqlDataAccess.ExecuteScalar(c_GetThreeLevelCheck + string.Format(c_Resident, model.CreatorXH), System.Data.CommandType.Text).ToString();

            if (num != "0") //设置了指定人员的三级检诊
            {
                switch (employee.DoctorGradeNumber)
                {
                case 1:     //主治医师
                    num = sqlDataAccess.ExecuteScalar(c_GetThreeLevelCheck + string.Format(c_Attend, model.CreatorXH, _employee.Code), System.Data.CommandType.Text).ToString();
                    if (num == "0")
                    {
                        result = false;
                    }
                    break;

                case 2:     //主任医师 副主任医师
                    num = sqlDataAccess.ExecuteScalar(c_GetThreeLevelCheck + string.Format(c_Chief, model.CreatorXH, _employee.Code), System.Data.CommandType.Text).ToString();
                    if (num == "0")
                    {
                        result = false;
                    }
                    break;
                }
            }
            return(result);
        }
Ejemplo n.º 18
0
        private void SetDocmentExamineState(EmrModel model)
        {
            //如果

            if (model.State == DrectSoft.Common.Eop.ExamineState.NotSubmit)
            {
            }
        }
Ejemplo n.º 19
0
 public SaveAsForm(EmrModel model, IEmrHost app, RecordDal recordDal, string content)
     : this()
 {
     m_Model            = model;
     m_app              = app;
     m_RecordDal        = recordDal;
     m_Content          = content;
     this.StartPosition = FormStartPosition.CenterScreen;
 }
Ejemplo n.º 20
0
 public HistoryEmrForm(PatRecUtil patUtil, RecordDal recordDal, EmrModel model, TreeListNode node)
 {
     InitializeComponent();
     this.StartPosition = FormStartPosition.CenterScreen;
     m_PatUtil          = patUtil;
     m_RecordDal        = recordDal;
     m_Node             = node;
     GetEmrContent(model);
     AddPadForm();
 }
Ejemplo n.º 21
0
 public void RefreshLookUpEditorEmrDoc(string noofinpat, EmrModel emrModel, EmrModelContainer emrModelContainer)
 {
     m_NoOfInpat         = noofinpat;
     SumPoint            = m_SqlManger.GetSumPoint(m_NoOfInpat, m_App);
     m_EmrModel          = emrModel;
     m_EmrModelContainer = emrModelContainer;
     dtRHQCReport        = GetQCTable();
     InitLookUpEditorEmrDoc();
     InitLookUpEditorDoctor();
     InitTotalGrade();
     InitGridControl();
     InitPatientInfo();
 }
Ejemplo n.º 22
0
 public PrintForm(PatRecUtil patUtil, EmrModel model, int defaultPageIndex, string noofinpat)
 {
     InitializeComponent();
     //this.Height = 600;
     this.StartPosition = FormStartPosition.CenterScreen;
     m_PatUtil          = patUtil;
     m_Model            = model;
     AddPadForm();
     InitSpinEdit();
     m_DefaultPageIndex = defaultPageIndex;
     m_noofinpat        = noofinpat;
     //checkEditPrintSelectArea.Visible = false;
 }
Ejemplo n.º 23
0
        /// <summary>
        /// 获取病历开始时间
        /// </summary>
        /// <param name="noofinpat"></param>
        /// <param name="modelList">编辑器传递节点集合</param>
        /// <param name="isFirstDailyEmr">是否首程</param>
        /// <returns></returns>
        private string GetDailyBeginTime(int noofinpat, List <EmrModel> modelList, bool isFirstDailyEmr)
        {
            try
            {
                string starttime = string.Empty;
                //该病人当前所属科室
                string    currentDeptID = string.Empty;
                DataTable inpatientDt   = DS_SqlService.GetInpatientByID(noofinpat, 2);
                if (null != inpatientDt && inpatientDt.Rows.Count > 0)
                {
                    currentDeptID = null == inpatientDt.Rows[0]["outhosdept"] ? "" : inpatientDt.Rows[0]["outhosdept"].ToString();
                }
                if (string.IsNullOrEmpty(currentDeptID))
                {
                    currentDeptID = DS_Common.currentUser.CurrentDeptId;
                }
                //该病人的所有病历(页面节点)
                if (null == modelList && modelList.Count() == 0)
                {
                    return(starttime);
                }
                //最后一个病历
                EmrModel lastRecord = modelList.OrderByDescending(q => q.DisplayTime).FirstOrDefault();
                if (null == lastRecord)
                {//不存在病历
                    return(starttime);
                }
                //获取该病人所有首次病程
                var firstDailyRecords = modelList.Where(p => p.FirstDailyEmrModel);
                if (null == firstDailyRecords && firstDailyRecords.Count() == 0)
                {//不存在首次病程
                    return(starttime);
                }
                if (lastRecord.DepartCode != currentDeptID)
                {
                    return(lastRecord.DisplayTime.ToString("yyyy-MM-dd HH:mm:ss"));
                }
                //当前(科室)首次病程(最后一个)
                EmrModel theFirstDialy = firstDailyRecords.Where(p => p.DepartCode == currentDeptID).OrderByDescending(q => q.DisplayTime).FirstOrDefault();
                if (null != theFirstDialy)
                {
                    return(theFirstDialy.DisplayTime.ToString("yyyy-MM-dd HH:mm:ss"));
                }

                return(starttime);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Ejemplo n.º 24
0
        /// <summary>
        /// 获取病历内容
        /// </summary>
        /// <param name="model"></param>
        private void GetEmrContent(EmrModel model)
        {
            m_Model = model;

            //是病程记录
            if (model.ModelCatalog == ContainerCatalog.BingChengJiLu)
            {
                model.ModelContent = GetAllDailyEmrContentInOneDept();
            }
            else
            {
                model.ModelContent = m_RecordDal.LoadModelInstance(model.InstanceId).ModelContent;
            }
        }
Ejemplo n.º 25
0
        /// <summary>
        /// .ctor
        /// </summary>
        /// <param name="recordDal"></param>
        /// <param name="model"></param>
        /// <param name="node"></param>
        /// <param name="inpatient"></param>
        public HistoryEmrFormNew(RecordDal recordDal, EmrModel model, TreeListNode node, Inpatient inpatient, IEmrHost app)
        {
            WaitDialogForm m_WaitDialog = new WaitDialogForm("正在加载病历...", "请稍候");

            InitializeComponent();
            this.StartPosition = FormStartPosition.CenterScreen;
            m_RecordDal        = recordDal;
            m_Node             = node;
            m_CurrentInpatient = inpatient;
            m_App = app;
            GetEmrContent(model);
            AddPadForm();
            DS_Common.HideWaitDialog(m_WaitDialog);
        }
Ejemplo n.º 26
0
 /// <summary>
 /// 初始化
 /// </summary>
 private void Init(EmrModel model, DateTime?firstDailyTime, List <EmrModel> list)
 {
     try
     {
         string titleName = model.IsShowFileName == "1" ? (string.IsNullOrEmpty(model.FileName.Trim()) ? model.Description.Trim() : model.FileName.Trim()) : string.Empty;
         if (null == firstDailyTime)
         {
             DataTable dt = DS_SqlService.GetInpatientByID((int)m_app.CurrentPatientInfo.NoOfFirstPage, 2);
             if (null != dt && dt.Rows.Count > 0)
             {
                 string config = DS_SqlService.GetConfigValueByKey("EmrInputConfig");
                 if (!string.IsNullOrEmpty(config))
                 {
                     XmlDocument doc = new XmlDocument();
                     doc.LoadXml(config);
                     XmlNodeList nodeList = doc.GetElementsByTagName("InHosTimeType");
                     if (null != nodeList && nodeList.Count > 0)
                     {
                         string cfgValue = null == nodeList[0].InnerText ? "" : nodeList[0].InnerText.Trim();
                         if (cfgValue == "0" && !string.IsNullOrEmpty(dt.Rows[0]["admitdate"].ToString().Trim()))
                         {//入院
                             m_BeginTime = DateTime.Parse(dt.Rows[0]["admitdate"].ToString());
                         }
                         else if (!string.IsNullOrEmpty(dt.Rows[0]["inwarddate"].ToString().Trim()))
                         {//入科
                             m_BeginTime = DateTime.Parse(dt.Rows[0]["inwarddate"].ToString());
                         }
                     }
                     else
                     {
                         m_BeginTime = (null != dt.Rows[0]["inwarddate"] && dt.Rows[0]["inwarddate"].ToString().Trim() != "") ? DateTime.Parse(dt.Rows[0]["inwarddate"].ToString()) : DateTime.Parse(dt.Rows[0]["admitdate"].ToString());
                     }
                 }
                 this.labelControl_Info.Text = "病程时间应大于入院时间 " + m_BeginTime.ToString("yyyy-MM-dd HH:mm:ss");
             }
         }
         else
         {
             m_BeginTime = (DateTime)firstDailyTime;
             this.labelControl_Info.Text = "病程时间应大于首次病程时间 " + m_BeginTime.ToString("yyyy-MM-dd HH:mm:ss");
         }
         dateEdit_Date.DateTime = DateTime.Now.Date;
         timeEdit_Time.Time     = DateTime.Now;
         textEdit_Name.Text     = titleName;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 27
0
        /// <summary>
        /// 检查在内存中或数据库中是否存在首次病程
        /// </summary>
        /// <returns></returns>
        private bool CheckIsHaveFirstDailyEmr()
        {
            //获取数据库中的首次病程
            string displayDateTime = m_HistoryEmrBll.GetFirstDailyEmrCaptionDateTime(m_CurrentUCEmrInput.CurrentInpatient.NoOfFirstPage.ToString());

            //获取内存中的首次病程
            EmrModel firstDailyEmrModel = Util.GetFirstDailyEmrModel(m_CurrentUCEmrInput.CurrentInputBody.CurrentTreeList);

            //表示首程不存在,如果需要导入日常病程,则需要和首程一起导入
            if (displayDateTime != "" || firstDailyEmrModel != null)
            {
                return(true);
            }
            return(false);
        }
Ejemplo n.º 28
0
        private bool CanCreateCore(EmrModel model, out string msg)
        {
            msg = string.Empty;
            if (_readOnlyMode)
            {
                return(false);
            }
            int grade = _employee.DoctorGradeNumber;

            if (grade == -1)
            {
                msg = "您无创建病历权限。";
                return(false);
            }
            return(true);
        }
Ejemplo n.º 29
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="app"></param>
 /// <param name="model"></param>
 /// <param name="firstDailyTime">首次病程时间</param>
 public DailyTemplateForm(IEmrHost app, EmrModel model, DateTime?firstDailyTime, List <EmrModel> list, UCEmrInputBody inputBody)
 {
     try
     {
         InitializeComponent();
         m_app            = app;
         m_EmrModel       = model;
         modelList        = list;
         m_UCEmrInputBody = inputBody;
         Init(model, firstDailyTime, list);
     }
     catch (Exception ex)
     {
         MyMessageBox.Show(1, ex);
     }
 }
Ejemplo n.º 30
0
 /// <summary>
 /// 在病程中定位对应的病程记录
 /// </summary>
 /// <param name="node"></param>
 private void LocateDailyEmrModel(TreeListNode node)
 {
     try
     {
         if (node.Tag is EmrModel)
         {
             EmrModel model           = node.Tag as EmrModel;
             string   displayDateTime = model.DisplayTime.ToString("yyyy-MM-dd HH:mm:ss");
             CurrentForm.SetCurrentElement(displayDateTime);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }