/// <summary> /// 检查病人当前科室与医生科室(包含权限科室)是否一致 /// </summary> /// <auth>Yanqiao.Cai</auth> /// <date>2013-03-01</date> /// <param name="noofinpat">首页序号</param> /// <returns></returns> private string CheckIfCurrentDept(int noofinpat) { try { DataTable inpDt = DS_SqlService.GetInpatientByID(noofinpat, 2); if (null == inpDt || inpDt.Rows.Count == 0) { return("该病人不存在,请刷新数据重试。"); } string dept = null == inpDt.Rows[0]["outhosdept"] ? "" : inpDt.Rows[0]["outhosdept"].ToString().Trim(); if (dept != DS_Common.currentUser.CurrentDeptId) {//该病人已转科 if (string.IsNullOrEmpty(dept.Trim())) { return("该病人所属科室异常,请联系管理员。"); } string deptName = DS_BaseService.GetDeptNameByID(dept); List <string[]> list = DS_BaseService.GetDeptAndWardInRight(DS_Common.currentUser.Id); if (null != list && list.Count > 0 && list.Any(p => p[0] == dept)) {//转科后科室在医生权限范围内 return("该病人已转至 " + deptName + "(" + dept + ")" + ",请切换科室。"); } else { return("该病人已转至 " + deptName + "(" + dept + ")" + ",您无权操作。"); } } return(string.Empty); } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <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); } }
/// <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; } }
/// <summary> /// 画面检查 /// <auth>Yanqiao.Cai</auth> /// <date>2011-11-02</date> /// </summary> private string CheckItem() { try { if (string.IsNullOrEmpty(this.dateEdit.Text.Trim())) { this.dateEdit.Focus(); return("请选择日期"); } else if (string.IsNullOrEmpty(this.txtTime.Text.Trim())) { this.txtTime.Focus(); return("请选择时间"); } else if (string.IsNullOrEmpty(this.lookUpState.CodeValue)) { this.lookUpState.Focus(); return("请选择状态"); } else//add by cyq 2013-03-05 增加状态时间限制 { DateTime theTime = DateTime.Parse(this.dateEdit.DateTime.ToString("yyyy-MM-dd") + " " + this.txtTime.Time.ToString("HH:mm:ss")); if (theTime > DateTime.Now) { this.dateEdit.Focus(); return("病人状态时间不能大于当前时间"); } //获取入院记录 //DataTable inpatient = DS_SqlService.GetInpatientByID((int)m_currInpatient.NoOfFirstPage); DataTable inpatient = DS_SqlService.GetInpatientByID(Int32.Parse(NoOfinPat)); if (null != inpatient && inpatient.Rows.Count > 0) {//多次入院 if (theTime < DateTime.Parse(DateTime.Parse(inpatient.Rows[0]["inwarddate"].ToString()).ToString("yyyy-MM-dd 00:00:00"))) { return("病人状态时间不能小于入院时间(" + DateTime.Parse(inpatient.Rows[0]["inwarddate"].ToString()).ToString("yyyy-MM-dd 00:00:00") + ")"); } //if ((inpatient.Rows[0]["status"].ToString() == "1502" || inpatient.Rows[0]["status"].ToString() == "1503") && theTime > DateTime.Parse(inpatient.Rows[0]["outhosdate"].ToString())) //{ // return "病人状态时间不能大于出院时间(" + DateTime.Parse(inpatient.Rows[0]["outhosdate"].ToString()).ToString("yyyy-MM-dd HH:mm:ss") + ")"; //} } } return(string.Empty); } catch (Exception ex) { throw ex; } }
/// <summary> /// 获取入院时间(系统配置) /// </summary> /// <param name="noofinpat"></param> /// <returns></returns> public static DateTime GetInHostTime(int noofinpat) { try { DataTable dt = DS_SqlService.GetInpatientByID(noofinpat, 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") {//入院 if (!string.IsNullOrEmpty(dt.Rows[0]["admitdate"].ToString().Trim())) { return(DateTime.Parse(dt.Rows[0]["admitdate"].ToString())); } else if (!string.IsNullOrEmpty(dt.Rows[0]["inwarddate"].ToString().Trim())) { return(DateTime.Parse(dt.Rows[0]["inwarddate"].ToString())); } } else if (cfgValue == "1") {//入科 if (!string.IsNullOrEmpty(dt.Rows[0]["inwarddate"].ToString().Trim())) { return(DateTime.Parse(dt.Rows[0]["inwarddate"].ToString())); } else if (!string.IsNullOrEmpty(dt.Rows[0]["admitdate"].ToString().Trim())) { return(DateTime.Parse(dt.Rows[0]["admitdate"].ToString())); } } } } } return(DateTime.MinValue); } catch (Exception ex) { throw ex; } }
/// <summary> /// 检查病人是否已出院 /// </summary> /// <auth>Yanqiao.Cai</auth> /// <date>2013-03-01</date> /// <param name="noofinpat"></param> /// <returns></returns> public static bool CheckIfOutHos(int noofinpat) { try { DataTable dt = DS_SqlService.GetInpatientByID(noofinpat, 2); if (null != dt && dt.Rows.Count == 1) { if (Tool.IsInt(dt.Rows[0]["STATUS"].ToString()) && (int.Parse(dt.Rows[0]["STATUS"].ToString()) == 1502 || int.Parse(dt.Rows[0]["STATUS"].ToString()) == 1503)) { return(true); } } return(false); } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <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; } }
/// <summary> /// 检查HIS系统中出院卡片是否已审核通过 /// 注:功能未启用、未配置、配置信息错误也视为未通过 /// </summary> /// <auth>Yanqiao.Cai</auth> /// <date>2013-03-04</date> /// <param name="noofinpat"></param> /// <returns></returns> public static bool CheckOutHosCardCheckPassed(int noofinpat) { try { string config = DS_SqlService.GetConfigValueByKey("AuditOutHosCardInHIS"); if (string.IsNullOrEmpty(config)) { return(false); } XmlDocument doc = new XmlDocument(); doc.LoadXml(config); #region 1、出科检查按钮是否显示 XmlNodeList isOutHosCheckBtnOpenList = doc.GetElementsByTagName("IsOutHosCheckBtnOpen"); if (null == isOutHosCheckBtnOpenList || isOutHosCheckBtnOpenList.Count == 0) { return(false); } if (null != isOutHosCheckBtnOpenList[0].InnerText && isOutHosCheckBtnOpenList[0].InnerText.Trim() != "1") { return(false); } #endregion #region 2、此功能是否启用 XmlNodeList isOpenList = doc.GetElementsByTagName("IsOpen"); if (null == isOpenList || isOpenList.Count == 0) { return(false); } if (null != isOpenList[0].InnerText && isOpenList[0].InnerText.Trim() != "1") { return(false); } #endregion #region 3、出科检查是否已通过 ///3.1、EMR中病人基本信息表 XmlNodeList emrBasicInfoTableNameList = doc.GetElementsByTagName("EmrBasicInfoTableName"); if (null == emrBasicInfoTableNameList || emrBasicInfoTableNameList.Count == 0) { return(false); } string emrBasicInfoTableName = null == emrBasicInfoTableNameList[0].InnerText ? string.Empty : emrBasicInfoTableNameList[0].InnerText.Trim(); if (string.IsNullOrEmpty(emrBasicInfoTableName)) { return(false); } ///3.2、EMR病人基本信息表中对应的出院检查标识字段 XmlNodeList emrOutHosCheckFlagFieldNameList = doc.GetElementsByTagName("EmrOutHosCheckFlagFieldName"); if (null == emrOutHosCheckFlagFieldNameList || emrOutHosCheckFlagFieldNameList.Count == 0) { return(false); } string emrOutHosCheckFlagFieldName = null == emrOutHosCheckFlagFieldNameList[0].InnerText ? string.Empty : emrOutHosCheckFlagFieldNameList[0].InnerText.Trim(); if (string.IsNullOrEmpty(emrOutHosCheckFlagFieldName)) { return(false); } ///3.3、EMR病人基本信息表中与病人表关联的字段 XmlNodeList relatedNoofinpatFieldNameList = doc.GetElementsByTagName("RelatedNoofinpatFieldName"); if (null == relatedNoofinpatFieldNameList || relatedNoofinpatFieldNameList.Count == 0) { return(false); } string relatedNoofinpatFieldName = null == relatedNoofinpatFieldNameList[0].InnerText ? string.Empty : relatedNoofinpatFieldNameList[0].InnerText.Trim(); if (string.IsNullOrEmpty(relatedNoofinpatFieldName)) { return(false); } ///3.4、EMR病人基本信息表中出院检查标识字段对应的检查通过的值 XmlNodeList emrOutHosCheckPassedValueList = doc.GetElementsByTagName("EmrOutHosCheckPassedValue"); if (null == emrOutHosCheckPassedValueList || emrOutHosCheckPassedValueList.Count == 0) { return(false); } string emrOutHosCheckPassedValue = null == emrOutHosCheckPassedValueList[0].InnerText ? string.Empty : emrOutHosCheckPassedValueList[0].InnerText.Trim(); if (string.IsNullOrEmpty(emrOutHosCheckPassedValue)) { return(false); } string checkFlagValue = DS_SqlService.GetFieldContent(DS_Common.DeleteSpecialCharacter(emrBasicInfoTableName), DS_Common.DeleteSpecialCharacter(emrOutHosCheckFlagFieldName), DS_Common.DeleteSpecialCharacter(relatedNoofinpatFieldName), DS_Common.DeleteSpecialCharacter(noofinpat.ToString()).Trim()); ///3.5、判断出科检查是否已通过 if (checkFlagValue != emrOutHosCheckPassedValue) { return(false); } #endregion #region 4、EMR中病人表与HIS关联的字段 ///4.1、EMR中病人表与HIS关联的字段 XmlNodeList emrRelatedFieldNameList = doc.GetElementsByTagName("EmrRelatedFieldName"); if (null == emrRelatedFieldNameList || emrRelatedFieldNameList.Count == 0) { return(false); } string emrRelatedFieldName = null == emrRelatedFieldNameList[0].InnerText ? string.Empty : emrRelatedFieldNameList[0].InnerText.Trim(); if (string.IsNullOrEmpty(emrRelatedFieldName)) { return(false); } ///4.2、EMR中病人表与HIS关联的字段的值 DataTable dt = DS_SqlService.GetInpatientByID(noofinpat, 1); emrRelatedFieldName = DS_Common.DeleteSpecialCharacter(emrRelatedFieldName); if (null == dt || dt.Rows.Count == 0 || !dt.Columns.Contains(emrRelatedFieldName.ToUpper())) { return(false); } string emrRelatedFieldValue = dt.Rows[0][emrRelatedFieldName].ToString(); if (string.IsNullOrEmpty(emrRelatedFieldValue)) { return(false); } #endregion #region 5、该病人的出院卡片在HIS系统中是否已经审核通过 ///5.1、获取HIS审核状态表 XmlNodeList auditTableNameList = doc.GetElementsByTagName("AuditTableName"); if (null == auditTableNameList || auditTableNameList.Count == 0) { return(false); } string auditTableName = null == auditTableNameList[0].InnerText ? string.Empty : auditTableNameList[0].InnerText.Trim(); if (string.IsNullOrEmpty(auditTableName)) { return(false); } ///5.2、获取HIS审核状态字段 XmlNodeList auditFieldNameList = doc.GetElementsByTagName("AuditFieldName"); if (null == auditFieldNameList || auditFieldNameList.Count == 0) { return(false); } string auditFieldName = null == auditFieldNameList[0].InnerText ? string.Empty : auditFieldNameList[0].InnerText.Trim(); if (string.IsNullOrEmpty(auditFieldName)) { return(false); } ///5.3、获取HIS审核状态字段对应的审核通过的值(配置项) XmlNodeList auditPassedValueList = doc.GetElementsByTagName("AuditPassedValue"); if (null == auditPassedValueList || auditPassedValueList.Count == 0) { return(false); } string auditPassedValue = null == auditPassedValueList[0].InnerText ? string.Empty : auditPassedValueList[0].InnerText.Trim(); if (string.IsNullOrEmpty(auditPassedValue)) { return(false); } ///5.4、获取HIS中与EMR病人表关联的字段 XmlNodeList hisRelatedFieldNameList = doc.GetElementsByTagName("HisRelatedFieldName"); if (null == hisRelatedFieldNameList || hisRelatedFieldNameList.Count == 0) { return(false); } string hisRelatedFieldName = null == hisRelatedFieldNameList[0].InnerText ? string.Empty : hisRelatedFieldNameList[0].InnerText.Trim(); if (string.IsNullOrEmpty(hisRelatedFieldName)) { return(false); } using (OracleConnection conn = new OracleConnection(DataAccessFactory.GetSqlDataAccess("HISDB").GetDbConnection().ConnectionString)) { if (conn.State != ConnectionState.Open) { conn.Open(); } OracleCommand cmd = conn.CreateCommand(); cmd.CommandType = CommandType.Text; ///5.5、该病人的出院卡片在HIS系统中是否已经审核通过 auditTableName = DS_Common.DeleteSpecialCharacter(auditTableName); auditFieldName = DS_Common.DeleteSpecialCharacter(auditFieldName); auditPassedValue = DS_Common.DeleteSpecialCharacter(auditPassedValue); hisRelatedFieldName = DS_Common.DeleteSpecialCharacter(hisRelatedFieldName); cmd.CommandText = " select " + auditFieldName + " from " + auditTableName + " where " + hisRelatedFieldName + " = :emrRelatedFieldValue "; cmd.Parameters.Clear(); OracleParameter para = new OracleParameter("emrRelatedFieldValue", OracleType.Char); para.Value = emrRelatedFieldValue; cmd.Parameters.Add(para); object obj = cmd.ExecuteOracleScalar(); if (null != obj && obj.ToString().Trim() == auditPassedValue.Trim()) { return(true); } } #endregion return(false); } catch (Exception ex) { throw new Exception(ex.Message); } }
public void RefreshDate(Inpatient currInpatient) { try { DataTable dt = MethodSet.GetRedactPatientInfoFrm("14", "", m_currInpatient.NoOfFirstPage.ToString()); MethodSet.DaysAfterSurgery = m_DaysAfterSurgery; if (currInpatient != null) { InitInpatInfo(currInpatient); if (dt.Rows[0]["isbaby"].ToString().Equals("1"))//如果是婴儿 { txtPatID.Text = PublicSet.MethodSet.GetPatData(dt.Rows[0]["mother"].ToString()).Rows[0]["Patid"].ToString(); } else { txtPatID.Text = MethodSet.PatID; } //txtPatID.Text = MethodSet.PatID; txtInpatName.Text = MethodSet.PatName; //新增的床号显示 txtBedID.Text = MethodSet.BedID; //txtInpatName.Text = MethodSet.CurrentInPatient.Name; //txtAge.Text = PatientInfo.Age; txtAge.Text = MethodSet.Age;//wyt #region 已注释 //MethodSet.DaysAfterSurgery = m_DaysAfterSurgery; //if (currInpatient != null) //{ // InitInpatInfo(currInpatient); // if (patientInfo.IsBaby == "1")//如果是婴儿 add by ywk 2012年11月22日19:59:18 // { // txtPatID.Text = PublicSet.MethodSet.GetPatData(patientInfo.Mother).Rows[0]["Patid"].ToString(); // } // else // { // txtPatID.Text = MethodSet.PatID; // } // //txtPatID.Text = MethodSet.PatID; // txtInpatName.Text = MethodSet.PatName; // //新增的床号显示 // txtBedID.Text = MethodSet.BedID; // //txtInpatName.Text = MethodSet.CurrentInPatient.Name; // //txtAge.Text = PatientInfo.Age; // txtAge.Text = MethodSet.Age;//wyt #endregion } else { btnSave.Enabled = false; } ucNursingRecordTable1.InitForm(); //add by cyq 2013-03-05 dateEdit.DateTimeChanged -= new EventHandler(dateEdit_DateTimeChanged); if (IsChagedPat)//是跳转来的 { dateEdit.Text = InputDate; } else {//add by cyq 2013-03-05 DataTable inps = DS_SqlService.GetInpatientByID((int)currInpatient.NoOfFirstPage); if (null != inps && inps.Rows.Count == 1) { if (inps.Rows[0]["status"].ToString() == "1502" || inps.Rows[0]["status"].ToString() == "1503") { dateEdit.Text = DateTime.Parse(inps.Rows[0]["outhosdate"].ToString()).ToString("yyyy-MM-dd"); } else { dateEdit.Text = DateTime.Now.Date.ToString("yyyy-MM-dd"); } } else { dateEdit.Text = DateTime.Now.Date.ToString("yyyy-MM-dd"); } } //add by cyq 2013-03-05 dateEdit.DateTimeChanged += new EventHandler(dateEdit_DateTimeChanged); //dateEdit.Text = DateTime.Now.Date.ToString("yyyy-MM-dd"); //体征录入界面刚进入时,进入自定义控件进行计算要显示的手术后天数 2012年5月15日 09:44:02 //设置手术后天数 string inputdate = dateEdit.Text; //现新表已经取得的真实的首页序号 add by ywk 2013-4-8 16:10:04 ucNursingRecordTable1.SetDaysAfterSurgery(inputdate, currInpatient.NoOfFirstPage.ToString()); ucNursingRecordTable1.CurrentOperTime = DateTime.Parse(inputdate);//add by wyt //ucNursingRecordTable1.SetDaysAfterSurgery(m_DaysAfterSurgery); } catch (Exception ex) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show(1, ex); } }