Ejemplo n.º 1
0
        /// <summary>
        /// 将datarow实例化为分诊病人对象
        /// </summary>
        /// <param name="dr"></param>
        /// <returns></returns>
        public static MZHS_FZJL DataRowToFZjl(DataRow dr)
        {
            MZHS_FZJL fz_br = new MZHS_FZJL();

            try
            {
                fz_br.Djsj        = Convertor.IsNull(dr["登记时间"], "");
                fz_br.Fzid        = dr["FZID"].ToString();
                fz_br.Fzksid      = int.Parse(Convertor.IsNull(dr["fzks"], "-1"));
                fz_br.Fzsj        = dr["分诊时间"].ToString();
                fz_br.Fzysid      = int.Parse(Convertor.IsNull(dr["分诊医生ID"], "-1"));
                fz_br.Ghxxid      = dr["ghxxid"].ToString();
                fz_br.Jlzt        = int.Parse(Convertor.IsNull(dr["记录状态"], "0"));
                fz_br.Patdlxh     = Convert.ToInt32(Convertor.IsNull(dr["候诊号"], "0"));
                fz_br.PatGhjb     = dr["ghjb"].ToString();
                fz_br.PatGHJBName = dr["挂号级别"].ToString();
                fz_br.patGHZKName = dr["挂号科室"].ToString();
                fz_br.patName     = dr["姓名"].ToString();
                fz_br.roomName    = Convertor.IsNull(dr["候诊诊室"], "");
                fz_br.Yysd        = Convertor.IsNull(dr["预约时段"], "");
                fz_br.patzqName   = Convertor.IsNull(dr["诊区名称"], "");
                fz_br.Zsid        = int.Parse(Convertor.IsNull(dr["zsid"], "0"));
                fz_br.Patzqid     = int.Parse(Convertor.IsNull(dr["诊区ID"], "-1"));
                fz_br.Sjnc        = Convertor.IsNull(dr["时段昵称"], "");
                fz_br.pdxh        = int.Parse(Convertor.IsNull(dr["排队序号"], "0"));
            }
            catch (Exception ea)
            {
                throw ea;
            }
            return(fz_br);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 更新当前界面的显示 返回当前呼叫信息
        /// </summary>
        /// <param name="text"></param>
        public static string UpdateDisplay(object data, int zqid, RelationalDatabase _DataBase)
        {
            string values = "";

            try
            {
                //更新医生呼叫情况的显示DisplayAreaDoctorCallInfo();
                if (data != null && data.GetType() == typeof(System.String))
                {
                    values = (data.ToString() + "\r\n");
                }
                if (data != null && data.GetType() == typeof(ts_mzys_class.MZHS_FZJL))
                {
                    ts_mzys_class.MZHS_FZJL patient = (ts_mzys_class.MZHS_FZJL)data;
                    //设置呼叫列表
                    values = string.Format("{0}:请{1}号{2}到{3}{4}就诊", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                                           patient.Patdlxh, patient.patName, patient.patGHZKName, patient.roomName);
                    if (new  SystemCfg(3013).Config == "1")
                    {
                        values = string.Format("{0}:请{1}号{2}到{3}的{4}就诊", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                                               patient.Pdxh, patient.patName, patient.patGHZKName, patient.roomName);
                    }
                }

                //重新获取未分诊的病人,并将列表送到显示屏
                if (refreshScreenDisplay != null)
                {
                    string rq1 = DateManager.ServerDateTimeByDBType(_DataBase).ToShortDateString() + " 00:00:00";
                    string rq2 = DateManager.ServerDateTimeByDBType(_DataBase).ToShortDateString() + " 23:59:59";
                    int    klx = 0;
                    string kh  = "";
                    string blh = "";

                    int sort = 0;
                    int hour = Convert.ToInt32(_DataBase.GetDataResult("select DATEPART(hh, GETDATE())"));
                    //从后台参数获取时间段进行判断 Modify By Zp 2014-02-11

                    //if (hour >= 8 && hour < 12)
                    //    sort = 1;
                    //else if (hour >= 12 && hour < 18)
                    //    sort = 2;
                    DataSet          ds    = MZHS_FZJL.Select_yfzpat(zqid, rq1, rq2, klx, kh, blh, sort, _DataBase); //包含两个内存表1个预约病人列表1个现场病人列表
                    List <MZHS_FZJL> _list = new List <MZHS_FZJL> ();
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        MZHS_FZJL fz_br = MZHS_FZJL.DataRowToFZjl(dr);
                        _list.Add(fz_br);
                    }
                    refreshScreenDisplay(data, _list); //传给显示屏已分诊病人信息
                }
            }
            catch (Exception ea)
            {
                throw new Exception("UpdateDisplay函数出现异常!原因:" + ea.Message);
            }
            return(values);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 朗诵呼叫信息
        /// </summary>
        /// <param name="lstCalledPatient">呼叫病人列表</param>
        /// <param name="speech">语音呼叫对象</param>
        /// <param name="Hjcs">呼叫次数</param>
        public static void CallPatient(List <ts_mzys_class.MZHS_FZJL> lstCalledPatient)
        {
            try
            {
                if (lstCalledPatient != null && lstCalledPatient.Count > 0)
                {
                    lock (objLockHelper)
                    {
                        //取最后一个呼叫
                        MZHS_FZJL patient = lstCalledPatient[lstCalledPatient.Count - 1];
                        lstCalledPatient.Remove(patient);//从呼叫列表中移除
                        string zqname = string.Empty;

                        if ((!string.IsNullOrEmpty(patient.PatzqName)) && patient.PatzqName.Trim().Length > 0)
                        {
                            zqname = patient.PatzqName.Trim();
                        }
                        else
                        {
                            zqname = patient.patGHZKName;
                        }
                        /*此处需要进行动态配置,取Fz_WbeShow.INI文件中的值为呼叫次数*/
                        //设置呼叫列表 Modify By zp 2014-06-14
                        string zs = patient.roomName;
                        if (_cfg3117.Config.Trim() == "1")
                        {
                            zs = patient.Patzjjc;
                        }
                        string msg        = "";
                        string callString = "";
                        for (int i = 0; i < Hjcs; i++)//循环呼叫
                        {
                            if (new SystemCfg(3013).Config == "1")
                            {
                                if (!string.IsNullOrEmpty(patient.patName))
                                {
                                    callString += string.Format("请{0}到{1}就诊", patient.patName, zs);
                                }
                            }
                            else
                            {
                                callString += string.Format("请{0}到{1}{2}就诊", patient.patName, patient.patGHZKName, zs);
                            }
                        }
                        _voice.VoiceSpeak(callString, ref msg);
                        if (!string.IsNullOrEmpty(msg))
                        {
                            throw new Exception("语音呼叫出现异常!原因:" + msg);
                        }
                    }
                }
            }
            catch (Exception ea)
            {
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Add By zp 2014-06-14
        /// </summary>
        /// <param name="Fz_Br"></param>
        /// <param name="_cfg3080"></param>
        /// <returns></returns>
        public static string GetShowLabString(MZHS_FZJL Fz_Br, SystemCfg _cfg3080, SystemCfg _cfg3117)
        {
            string result = ""; //Fz_Br.patName.Trim() + "(" + Fz_Br.roomName + ")" + Fz_Br.patGHZKName;
            string xsgs   = _cfg3080.Config.Trim();

            string[] par = xsgs.Split('+');

            for (int i = 0; i < par.Length; i++)
            {
                //Add by zp 2014-11-05
                if (par[i] == "候诊号")
                {
                    result += "[" + Fz_Br.patdlxh + "]";
                    continue;
                }
                //End Add By zp 2014-10-30
                if (par[i] == "姓名")
                {
                    result += Fz_Br.patName.Trim();
                    continue;
                }
                if (par[i] == "科室")
                {
                    result += "  " + Fz_Br.patGHZKName.Trim();
                    continue;
                }
                if (par[i] == "时段" && (!string.IsNullOrEmpty(Fz_Br.Sjnc.Trim())))
                {
                    result += "(" + Fz_Br.Sjnc.Trim() + ")";
                    continue;
                }
                if (par[i] == "诊室" && (!string.IsNullOrEmpty(Fz_Br.roomName.Trim())))
                {
                    if (_cfg3117.Config.Trim() == "0")
                    {
                        result += "(" + Fz_Br.roomName.Trim() + ")";
                    }
                    else
                    {
                        result += "(" + Fz_Br.patzjjc.Trim() + ")";
                    }
                    continue;
                }
                //湘潭妇幼需求 Add by zp 2014-10-23
                if (par[i] == "预约标识" && (!string.IsNullOrEmpty(Fz_Br.yysd.Trim())))
                {
                    result += " 预约";
                }
            }
            if (string.IsNullOrEmpty(result))
            {
                result = Fz_Br.patName.Trim() + "(" + Fz_Br.roomName + ")" + Fz_Br.patGHZKName;
            }
            return(result);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 呼叫病人(通过此方法链接目标机器)
        /// </summary>
        /// <param name="patient">被呼叫的病人对象</param>
        /// <param name="remoteIP">当前工作站所在的诊区的分诊台IP</param>
        public bool CallPatient(MZHS_FZJL patient, string remoteIP, int port, out string msg)
        {
            #region 将病人对象构造成xml字符串
            msg = "";
            string message = "";
            if (patient != null)
            {
                message = "<PATIENT>";
                System.Reflection.PropertyInfo[] ps = patient.GetType().GetProperties();
                foreach (System.Reflection.PropertyInfo p in ps)
                {
                    object obj = p.GetValue(patient, System.Reflection.BindingFlags.GetProperty | System.Reflection.BindingFlags.Public,
                                            null, null, null);
                    string str = string.Format("<{0}>{1}</{0}>", p.Name, obj);
                    message += str;
                }
                message += "</PATIENT>";
            }
            // msg = message; //add by 2012-12-10 zp
            #endregion

            if (!string.IsNullOrEmpty(remoteIP))
            {
                string    remoteHostIP   = remoteIP.Trim(); //诊区的IP
                int       remoteHostPort = port;            //端口号
                TcpClient tcpClient      = new TcpClient();

                try
                {
                    try
                    {
                        tcpClient.Connect(IPAddress.Parse(remoteHostIP), remoteHostPort);//链接目标计算机(呼叫大厅)
                    }
                    catch (System.Net.Sockets.SocketException err_sock)
                    {
                        msg = "通讯出现异常!请检查诊区服务端机器是否已开启!网络异常信息:" + err_sock.Message;
                        return(false);
                    }

                    NetworkStream ns = tcpClient.GetStream();
                    try
                    {
                        if (ns.CanWrite)
                        {
                            Byte[] sendBytes = Encoding.UTF8.GetBytes(message);//UTF字节占用少
                            ns.Write(sendBytes, 0, sendBytes.Length);
                            return(true);
                        }
                        else
                        {
                            //throw new Exception( "不能写入数据流" );
                            msg = "不能写入数据流";
                            return(false);
                        }
                    }
                    catch (Exception err1)
                    {
                        msg = err1.Message;
                        throw new Exception(err1.ToString());
                        //return false;
                    }
                    finally
                    {
                        ns.Close();
                    }
                }
                catch (Exception err2)
                {
                    msg = err2.ToString();
                    //throw err2;
                    return(false);
                }
                finally
                {
                    tcpClient.Close();
                }
            }
            return(false);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 监听端口 有数据传输则刷新显示屏以及语音朗诵
        /// </summary>
        /// <param name="port">端口号</param>
        public void SocketListen(int port, RelationalDatabase _DataBase, Fz_Zq zq,
                                 Socket listener, VoiceHelp _voice, ref Socket socket)
        {
            string rq1 = DateManager.ServerDateTimeByDBType(_DataBase).ToShortDateString() + " 00:00:00";
            string rq2 = DateManager.ServerDateTimeByDBType(_DataBase).ToShortDateString() + " 23:59:59";

            Hjcs = int.Parse(zq.Zqhjcs);
            string msg = "";

            _voice.InitializeVoiceLib();
            _voice.VoiceSpeak(zq.Zqname, ref msg);
            IPEndPoint address = new IPEndPoint(IPAddress.Any, port);

            try
            {
                while (true)
                {
                    if (new SystemCfg(3103).Config == "1")
                    {
                        UpdateDisplayDelegate callDisplay = new UpdateDisplayDelegate(UpdateDisplay);
                        callDisplay("正在等待呼叫。。。", zq.Zqid, _DataBase);
                    }
                    if (listener != null)
                    {
                        if (listener.LocalEndPoint == null)
                        {
                            listener.Bind(address);
                        }
                    }

                    listener.Listen(0);
                    socket = listener.Accept();
                    Stream netStream = new NetworkStream(socket);

                    StreamReader reader = new StreamReader(netStream);
                    string       result = reader.ReadToEnd();//收到呼叫的信息
                    lock (objLockHelper)
                    {
                        ts_mzys_class.MZHS_FZJL p   = new ts_mzys_class.MZHS_FZJL();
                        System.Xml.XmlDocument  doc = new System.Xml.XmlDocument();
                        bool valid = false;
                        try
                        {
                            doc.LoadXml(result);
                            valid = true;
                        }
                        catch
                        {
                            UpdateDisplayDelegate _callDisplay = new UpdateDisplayDelegate(UpdateDisplay);
                            _callDisplay("无效的呼叫信息!", zq.Zqid, _DataBase);
                        }
                        if (valid)
                        {
                            System.Xml.XmlNodeList nodes = doc.GetElementsByTagName("PATIENT")[0].ChildNodes;
                            /*反射生成病人对象*/
                            foreach (System.Xml.XmlNode node in nodes)
                            {
                                try
                                {
                                    System.Reflection.PropertyInfo pi = p.GetType().GetProperty(node.Name); //定义一个属性对象,并且设置类型(需要反射目的对象的某个属性名称)
                                    object objValue = Convert.ChangeType(node.InnerText, pi.PropertyType);  //通过一个object对象获取属性的值与属性的类型
                                    p.GetType().GetProperty(node.Name).SetValue(p, objValue, null);         //对反射对象进行赋值,第一个参数为反射对象,第二参数为反射对象所需的值与类型信息
                                }
                                catch
                                {
                                    continue;
                                }
                            }
                            lstCalledPatient.Insert(0, p);
                            //将当前呼叫的病人发送到显示窗口
                            if (refreshScreenDisplay != null)
                            {
                                int sort = 0;
                                int hour = Convert.ToInt32(_DataBase.GetDataResult("select DATEPART(hh, GETDATE())"));
                                if (hour >= 8 && hour <= 12)
                                {
                                    sort = 1;
                                }
                                else if (hour > 12 && hour < 18)
                                {
                                    sort = 2;
                                }

                                DataSet          ds    = MZHS_FZJL.Select_yfzpat(zq.Zqid, rq1, rq2, 0, "", "", sort, _DataBase);//得到最新的候诊列表
                                List <MZHS_FZJL> _list = new List <MZHS_FZJL>();
                                foreach (DataRow dr in ds.Tables[0].Rows)
                                {
                                    _list.Add(MZHS_FZJL.DataRowToFZjl(dr));
                                }
                                refreshScreenDisplay(p, _list);
                            }
                            CallPatient(lstCalledPatient);
                        }
                    }
                }
            }
            catch (Exception ea)
            {
                MessageBox.Show(ea.Message);
            }
        }