コード例 #1
0
ファイル: Fz_Zq.cs プロジェクト: Wooyme/HIS-1
        /// <summary>
        /// 新增诊区|更新诊区 Modiffy By zp 2013-07-31
        /// </summary>
        /// <param name="zq"></param>
        /// <param name="_DataBase"></param>
        /// <returns></returns>
        public bool SaveZqInfo(Fz_Zq zq, RelationalDatabase _DataBase, out string msg)
        {
            _DataBase.BeginTransaction();
            try
            {
                msg = "保存成功!";
                string sql = "";

                if (zq.Zqid <= 0)
                {
                    sql = string.Format(@"INSERT INTO JC_FZ_ZQ(ZQ_NAME,ZQ_ADDRESS,ZQ_IPADDRESS,ZQ_HJCS,ZQ_MEMO,ZQ_BDFS,BSCBZ,QYYY,XSFS)
                           VALUES('{0}','{1}','{2}',{3},'{4}',{5},{6},{7},{8})", zq.Zqname, zq.Zqaddress, zq.Zqipaddress, zq.Zqhjcs, zq.Zqmemo, zq.Zqbdfs, Convert.ToInt32(zq.Zqscbz), zq.Isqyyy, zq.Xsfs);
                    object zqid = 0;

                    if (_DataBase.InsertRecord(sql, out zqid) > 0)
                    {
                        sql = string.Format(@"INSERT INTO JC_FZ_ZQTV(ZQID,HZTBA,HZTBB,HZTBC,HZTBD)
                           VALUES({0},{1},{2},{3},{4})", zqid, zq.Hztba, zq.Hztbb, zq.Hztbc, zq.Hztbd);
                        _DataBase.DoCommand(sql);

                        _DataBase.CommitTransaction();
                        return(true);
                    }
                    _DataBase.RollbackTransaction();
                }
                else
                {
                    sql = string.Format(@"UPDATE JC_FZ_ZQ SET ZQ_NAME='{0}',ZQ_ADDRESS='{1}',ZQ_IPADDRESS='{2}',ZQ_HJCS={3},ZQ_MEMO='{4}'
                     ,ZQ_BDFS={5},BSCBZ={6},QYYY={7},XSFS={8} WHERE ZQ_ID={9}", zq.Zqname, zq.Zqaddress, zq.Zqipaddress, zq.Zqhjcs, zq.Zqmemo, zq.Zqbdfs, Convert.ToInt32(zq.Zqscbz), zq.Isqyyy, zq.Xsfs, zq.Zqid);

                    if (_DataBase.DoCommand(sql) > 0)
                    {
                        sql = "select * from JC_FZ_ZQTV where ZQID=" + zq.Zqid + "";
                        if (_DataBase.GetDataTable(sql).Rows.Count > 0)
                        {
                            sql = @"UPDATE JC_FZ_ZQTV SET HZTBA=" + zq.Hztba + ",HZTBB=" + zq.Hztbb + ",HZTBC=" + zq.Hztbc + ",HZTBD=" + zq.Hztbd + " WHERE ZQID=" + zq.Zqid + "";
                        }
                        else
                        {
                            sql = @"INSERT INTO JC_FZ_ZQTV(ZQID,HZTBA,HZTBB,HZTBC,HZTBD) VALUES(" + zq.Zqid + "," + zq.Hztba + "," + zq.Hztbb + "," + zq.Hztbc + "," + zq.Hztbd + ")";
                        }

                        _DataBase.DoCommand(sql);
                        _DataBase.CommitTransaction();
                        return(true);
                    }
                    _DataBase.RollbackTransaction();
                }
                msg = "保存失败!";
                return(false);
            }
            catch (Exception ea)
            {
                _DataBase.RollbackTransaction();
                msg = "保存失败!";
                throw ea;
            }
        }
コード例 #2
0
ファイル: Fz_Zq.cs プロジェクト: Wooyme/HIS-1
        /// <summary>
        /// 更新诊区信息 Add By zp 2013-09-24
        /// </summary>
        /// <param name="zq"></param>
        /// <param name="db"></param>
        /// <returns></returns>
        public bool UpdateZqInfo(Fz_Zq zq, RelationalDatabase db)
        {
            bool result = false;

            try
            {
                string sql = string.Format(@"UPDATE JC_FZ_ZQ SET ZQ_NAME='{0}',ZQ_ADDRESS='{1}',ZQ_IPADDRESS='{2}',ZQ_HJCS={3},ZQ_MEMO='{4}'
                     ,ZQ_BDFS={5},BSCBZ={6},QYYY={7},XSFS={8} WHERE ZQ_ID={9}", zq.Zqname, zq.Zqaddress, zq.Zqipaddress, zq.Zqhjcs, zq.Zqmemo, zq.Zqbdfs, Convert.ToInt32(zq.Zqscbz), zq.Isqyyy, zq.Xsfs, zq.Zqid);
                if (db.DoCommand(sql) > 0)
                {
                    result = true;
                }
            }
            catch (Exception ea)
            {
                throw ea;
            }
            return(result);
        }
コード例 #3
0
ファイル: Fz_Zq.cs プロジェクト: Wooyme/HIS-1
        private List <Fz_Zq> ResultFz_Zq(DataTable dt)
        {
            List <Fz_Zq> _list = new List <Fz_Zq>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                Fz_Zq _zq = new Fz_Zq();
                _zq._zqaddress   = Convertor.IsNull(dt.Rows[i]["诊区地址"], "");
                _zq._zqcjsj      = dt.Rows[i]["诊区创建时间"].ToString();
                _zq._zqhjcs      = dt.Rows[i]["诊区呼叫次数"].ToString();
                _zq._zqid        = int.Parse(dt.Rows[i]["诊区ID"].ToString());
                _zq._zqipaddress = Convertor.IsNull(dt.Rows[i]["诊区IP地址"], "");
                _zq._zqmemo      = Convertor.IsNull(dt.Rows[i]["诊区备注"], "");
                _zq._zqname      = dt.Rows[i]["诊区名称"].ToString();
                _zq._zqscbz      = Convert.ToBoolean(dt.Rows[i]["诊区删除标记"]);
                _zq._zqbdfs      = int.Parse(dt.Rows[i]["诊区报到方式"].ToString());
                _zq.Xsfs         = int.Parse(dt.Rows[i]["显示方式"].ToString());
                _list.Add(_zq);
            }
            return(_list);
        }
コード例 #4
0
ファイル: ServerListen.cs プロジェクト: Wooyme/HIS-1
        /// <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);
            }
        }