Exemple #1
0
        private static void GetMacroSource(string patid, string userid)
        {
            try
            {
                //取得地址的那个取值方式 add by ywk 2012年8月3日 13:47:33
                //string isreadaddress = GetConfigValueByKey("EmrInputConfig");
                //XmlDocument doc1 = new XmlDocument();
                //doc1.LoadXml(isreadaddress);
                //string ReadAddress = doc1.GetElementsByTagName("IsReadAddressInfo")[0].InnerText;

                _macroSource = new Dictionary <string, DataRow>();
                HFDate hf = new HFDate();
                foreach (DataRow row in Macros.Rows)
                {
                    Macro     mac  = new Macro(row);
                    DataTable data = null;
                    if (!_macroSource.ContainsKey(mac.D_Table))
                    {
                        //此处做一下特殊处理,如果是inpatient 表则传入病人首页序号
                        if (mac.D_Table.Equals("INPATIENT"))
                        {
                            SqlParameter para = new SqlParameter("@NoOfinpat", SqlDbType.VarChar);
                            para.Value = patid;

                            m_PatID = patid;

                            data = DataAccessFactory.DefaultDataAccess.ExecuteDataTable("USP_EMR_GETPATINFO", new SqlParameter[] { para }, CommandType.StoredProcedure);
                            DataTable newDT = new DataTable();
                            if (data.Rows.Count > 0 && data.Rows[0]["isbaby"].ToString() == "1") //如果是婴儿,就把住院号,换成他母亲的 eidt by ywk 2012年11月23日15:53:27
                            {
                                string mother = data.Rows[0]["mother"].ToString();               //取得母亲的首页序号
                                newDT = DataAccessFactory.DefaultDataAccess.ExecuteDataTable(string.Format(@"select patid from inpatient
                            where noofinpat='{0}'", mother), CommandType.Text);
                                if (newDT != null && newDT.Rows.Count > 0)
                                {
                                    data.Rows[0]["patid"] = newDT.Rows[0]["patid"].ToString();//值替换为他母亲的号!
                                }
                            }

                            if (data.Rows.Count > 0)
                            {
                                DateTime dt    = Convert.ToDateTime(data.Rows[0]["jieqi"].ToString());
                                string   jieqi = hf.GetSolarTermInfo(dt);
                                data.Rows[0]["jieqi"] = jieqi;
                                _macroSource.Add(mac.D_Table, data.Rows[0]);
                            }
                        }
                        else if (mac.D_Table.Equals("INPATIENT_CLINIC"))
                        {
                            SqlParameter para = new SqlParameter("@NoOfinpat", SqlDbType.VarChar);
                            para.Value = patid;

                            m_PatID = patid;

                            data = DataAccessFactory.DefaultDataAccess.ExecuteDataTable("PATIENT_INFO.USP_INPATIENT_CLINIC", new SqlParameter[] { para }, CommandType.StoredProcedure);
                            //data = DataAccessFactory.DefaultDataAccess.ExecuteDataTable("PATIENT_INFO.usp_xml_content", new SqlParameter[] { para }, CommandType.StoredProcedure);
                            if (data.Rows.Count > 0)
                            {
                                _macroSource.Add(mac.D_Table, data.Rows[0]);
                            }
                        }
                        else if (mac.D_Table.Equals("CURRENTUSER")) //得到当前用户信息的宏
                        {
                            string sqlGetUser = @"select users.id userid, (case b.name||'/' when  '/' then users.name  else  b.name||'/'||users.name end)  username,a.masterid,b.name||'/' mastername, users.deptid userdeptid, users.wardid userwardid, department.name userdeptname, ward.name userwardname
                                                from users
                                                left outer join department on department.id = users.deptid and department.valid = '1'
                                                left outer join ward on ward.id = users.wardid and ward.valid = '1'
                                                left join tempusers a on users.id=a.userid
                                                left join users b on a.masterid=b.id
                                                where users.id = '{0}' and users.valid = '1'";
                            data = DataAccessFactory.DefaultDataAccess.ExecuteDataTable(string.Format(sqlGetUser, userid));
                            if (data.Rows.Count > 0)
                            {
                                _macroSource.Add(mac.D_Table, data.Rows[0]);
                            }
                        }
                        else
                        {
                            if (string.IsNullOrEmpty(mac.D_Sql))
                            {
                                continue;
                            }
                            data = DataAccessFactory.DefaultDataAccess.ExecuteDataTable(mac.D_Sql);
                            if (data.Rows.Count > 0)
                            {
                                _macroSource.Add(mac.D_Table, data.Rows[0]);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MyMessageBox.Show("MacroUtil.GetMacroSource:" + ex.Message);
            }
        }
Exemple #2
0
        /// <summary>
        /// 重新设置单元格
        /// </summary>
        private void InitCells()
        {
            int column = 0; int row = 0;

            MainPanel.RowCount = 6;
            DateTime currMonth = new DateTime(displayDate.Year, displayDate.Month, 1);
            DateTime currDay   = new DateTime();

            currDay = currMonth.AddDays((double)(0 - currMonth.DayOfWeek));
            CalendarCell currCell = new CalendarCell();

            #region 填充单元格
            while (column < 7 && row < 6)
            {
                HFDate  lunarProcessor = new HFDate(currDay);
                DayInfo currDayInfo    = new DayInfo();
                currDayInfo.date    = currDay;
                currDayInfo.animal  = animalNames[lunarProcessor.LunarYear.Zhi.IntValue - 1];
                currDayInfo.lunarM  = lunarProcessor.LunarCalendarMonth;
                currDayInfo.lunarD  = lunarProcessor.LunarCalendarDay;
                currDayInfo.ganZhi  = lunarProcessor.LunarYear.Name + "年";
                currDayInfo.ganZhiM = lunarProcessor.LunarMonth.Name + "月";
                currDayInfo.ganZhiD = lunarProcessor.LunarDay.Name + "日";
                currDayInfo.lunarMS = lunarProcessor.LunarCalendarMonthString;
                currDayInfo.lunarDS = lunarProcessor.LunarCalendarDayString;
                currDayInfo.term    = lunarProcessor.SolarTermInfo;

                currDayInfo.isHoliday      = IsHoliday(ref currDayInfo); //加入节假日判断
                currDayInfo.isLunarHoliday = IsLunarHoliday(ref currDayInfo);

                currCell         = (CalendarCell)MainPanel.GetControlFromPosition(column, row);
                currCell.Visible = true;

                SetCellText(currCell, currDayInfo);
                SetCellColor(currCell);
                if (currDayInfo.date.Date == displayDate.Date)
                {
                    cColumn = column; cRow = row;
                    CellClicked(currCell, new EventArgs());
                }

                column++;
                if (column > 6)
                {
                    column = 0;
                    row++;
                }

                currDay = currDay.AddDays(1);
            }

            CalendarCell tmpCell = (CalendarCell)MainPanel.GetControlFromPosition(0, 5);
            if (((DayInfo)tmpCell.Tag).date.Month != displayDate.Date.Month)
            {
                for (int i = 0; i < 7; i++)
                {
                    tmpCell         = (CalendarCell)MainPanel.GetControlFromPosition(i, 5);
                    tmpCell.Visible = false;
                }
            }

            #endregion
            oldDate = displayDate;
            return;
        }