예제 #1
0
        public static int searchHis(His his)
        {
            int    res = 0;
            string sql = "";

            if (his.IsCHeckHisSize && his.Size > 0)
            {
                sql = string.Format(searchHisSql, his.Vid, his.Size, his.HisTimeSpan);
            }
            else
            {
                sql = string.Format(searchHisSqlWithoutSize, his.Vid, his.HisTimeSpan);
            }

            using (SqlConnection conn = new SqlConnection(connstr))
            {
                conn.Open();
                SqlCommand sc = new SqlCommand(sql, conn);
                try
                {
                    res = Convert.ToInt32(sc.ExecuteScalar());
                }
                catch (Exception e)
                {
                    searchHis(his);
                }
            }
            return(res);
        }
예제 #2
0
        public override string ToX12String()
        {
            StringBuilder sb = new StringBuilder();

            if (His.Count(x => x.HIQual == "ABK" || x.HIQual == "BK") > 0)
            {
                HIItem primaryDiagnosis = His.Where(x => x.HIQual == "ABK" || x.HIQual == "BK").First();
                sb.Append("HI*" + primaryDiagnosis.HIQual + ":" + primaryDiagnosis.HICode);
                List <HIItem> additionalDiagnosis = His.Where(x => x.HIQual == "ABF" || x.HIQual == "BF").ToList();
                if (additionalDiagnosis.Count > 0)
                {
                    foreach (HIItem item in additionalDiagnosis)
                    {
                        sb.Append("*" + item.HIQual + ":" + item.HICode);
                    }
                }
                sb.Append("~");
                HiCount++;
            }
            if (His.Count(x => x.HIQual == "BP") > 0)
            {
                HIItem anesthesiaDiagnosis = His.Where(x => x.HIQual == "BP").First();
                sb.Append("HI*" + anesthesiaDiagnosis.HIQual + ":" + anesthesiaDiagnosis.HICode);
                if (His.Count(x => x.HIQual == "BO") > 0)
                {
                    HIItem anesthesiaAdditional = His.Where(x => x.HIQual == "BO").First();
                    sb.Append("*BO:" + anesthesiaAdditional.HICode);
                }
                sb.Append("~");
                HiCount++;
            }
            if (His.Count(x => x.HIQual == "BG") > 0)
            {
                sb.Append("HI");
                List <HIItem> conditionCodes = His.Where(x => x.HIQual == "BG").ToList();
                for (int i = 0; i < conditionCodes.Count; i++)
                {
                    if (i == 12)
                    {
                        sb.Append("~HI");
                    }
                    sb.Append("*BG:" + conditionCodes[i].HICode);
                    if (i == 23)
                    {
                        break;
                    }
                }
                sb.Append("~");
                HiCount++;
            }
            return(sb.ToString());
        }
예제 #3
0
        public static int getBlackListHis(His his)
        {
            string sql = "select count(*) from blackList where vid='" + his.Vid + "'";
            int    res;

            using (SqlConnection conn = new SqlConnection(connstr))
            {
                conn.Open();
                SqlCommand sc = new SqlCommand(sql, conn);
                res = Convert.ToInt32(sc.ExecuteScalar());
            }
            return(res);
        }
예제 #4
0
        public static void insertBLackList(His his)
        {
            string insert = "INSERT INTO [dbo].[blackList] ([vid],[size],[actress],[fileCount],[files],[createtime]) VALUES('{0}',{1},'{2}',{3},'{4}',getdate())";
            string sql    = string.Format(insert, his.Vid, his.Size, his.Actress, his.FileCount, his.Files);

            using (SqlConnection conn = new SqlConnection(connstr))
            {
                conn.Open();
                SqlCommand sc = new SqlCommand(sql, conn);
                sc.CommandTimeout = 120000;
                sc.ExecuteNonQuery();
            }
        }
예제 #5
0
 public override bool Valid()
 {
     if (His.Count(x => x.HIQual == "ABK" || x.HIQual == "BK") == 0)
     {
         return(false);
     }
     foreach (HIItem item in His)
     {
         if (string.IsNullOrEmpty(item.HIQual) || string.IsNullOrEmpty(item.HICode))
         {
             return(false);
         }
     }
     return(true);
 }
예제 #6
0
        public static void insertHis(His his)
        {
            if (his.Actress.Length > 250)
            {
                his.Actress = his.Actress.Substring(0, 248);
            }
            string sql = string.Format(insertHisSql, his.Vid, his.Size, his.Actress.Replace("'", "''"), his.FileCount, his.Files.Replace("'", "''"));

            using (SqlConnection conn = new SqlConnection(connstr))
            {
                conn.Open();
                SqlCommand sc = new SqlCommand(sql, conn);
                sc.ExecuteNonQuery();
            }
        }
예제 #7
0
        public static int searchHis(His his)
        {
            int    res;
            string sql = "";

            if (his.Size > 0)
            {
                sql = string.Format(seachHisSql, his.Vid, his.Size);
            }
            else
            {
                return(0);
            }
            using (SqlConnection conn = new SqlConnection(connstr))
            {
                conn.Open();
                SqlCommand sc = new SqlCommand(sql, conn);
                res = Convert.ToInt32(sc.ExecuteScalar());
            }
            return(res);
        }
예제 #8
0
        public override string ToX12String()
        {
            StringBuilder sb = new StringBuilder();
            HIItem        primaryDiagnosis = His.Where(x => x.HIQual == "ABK" || x.HIQual == "BK").First();

            sb.Append("HI*" + primaryDiagnosis.HIQual + ":" + primaryDiagnosis.HICode);
            if (!string.IsNullOrEmpty(primaryDiagnosis.PresentOnAdmissionIndicator))
            {
                sb.Append(":::::::" + primaryDiagnosis.PresentOnAdmissionIndicator);
            }
            sb.Append("~");
            HiCounts++;
            HIItem admittingDiagnosis = His.Where(x => x.HIQual == "ABJ" || x.HIQual == "BJ").FirstOrDefault();

            if (admittingDiagnosis != null)
            {
                sb.Append("HI*" + admittingDiagnosis.HIQual + ":" + admittingDiagnosis.HICode + "~");
                HiCounts++;
            }
            List <HIItem> patientReasonForVisitDiagnosis = His.Where(x => x.HIQual == "APR" || x.HIQual == "PR").ToList();

            if (patientReasonForVisitDiagnosis.Count > 0)
            {
                sb.Append("HI");
                for (int i = 0; i < patientReasonForVisitDiagnosis.Count; i++)
                {
                    sb.Append("*" + patientReasonForVisitDiagnosis[i].HIQual + ":" + patientReasonForVisitDiagnosis[i].HICode);
                    if (i == 2)
                    {
                        break;
                    }
                }
                sb.Append("~");
                HiCounts++;
            }
            List <HIItem> externalCauseofInjuryDiagnosis = His.Where(x => x.HIQual == "ABN" || x.HIQual == "BN").ToList();

            if (externalCauseofInjuryDiagnosis.Count > 0)
            {
                sb.Append("HI");
                for (int i = 0; i < externalCauseofInjuryDiagnosis.Count; i++)
                {
                    sb.Append("*" + externalCauseofInjuryDiagnosis[i].HIQual + ":" + externalCauseofInjuryDiagnosis[i].HICode);
                    if (!string.IsNullOrEmpty(externalCauseofInjuryDiagnosis[i].PresentOnAdmissionIndicator))
                    {
                        sb.Append(":::::::" + externalCauseofInjuryDiagnosis[i].PresentOnAdmissionIndicator);
                    }
                    if (i == 11)
                    {
                        break;
                    }
                }
                sb.Append("~");
                HiCounts++;
            }
            HIItem DRGDiagnosis = His.Where(x => x.HIQual == "DR").FirstOrDefault();

            if (DRGDiagnosis != null)
            {
                sb.Append("HI*" + DRGDiagnosis.HIQual + ":" + DRGDiagnosis.HICode + "~");
                HiCounts++;
            }
            List <HIItem> otherDiagnosis = His.Where(x => x.HIQual == "ABF" || x.HIQual == "BF").ToList();

            if (otherDiagnosis.Count > 0)
            {
                sb.Append("HI");
                for (int i = 0; i < otherDiagnosis.Count; i++)
                {
                    if (i == 12)
                    {
                        sb.Append("~HI");
                        HiCounts++;
                    }
                    sb.Append("*" + otherDiagnosis[i].HIQual + ":" + otherDiagnosis[i].HICode);
                    if (!string.IsNullOrEmpty(otherDiagnosis[i].PresentOnAdmissionIndicator))
                    {
                        sb.Append(":::::::" + otherDiagnosis[i].PresentOnAdmissionIndicator);
                    }
                    if (i == 23)
                    {
                        break;
                    }
                }
                sb.Append("~");
                HiCounts++;
            }
            HIItem principleProcedureDiagnosis = His.Where(x => x.HIQual == "BBR" || x.HIQual == "BR" || x.HIQual == "CAH").FirstOrDefault();

            if (principleProcedureDiagnosis != null)
            {
                sb.Append("HI*" + principleProcedureDiagnosis.HIQual + ":" + principleProcedureDiagnosis.HICode + ":D8:" + principleProcedureDiagnosis.HIFromDate + "~");
                HiCounts++;
                List <HIItem> otherProcedureDiagnosis = His.Where(x => x.HIQual == "BBQ" || x.HIQual == "BQ").ToList();
                if (otherProcedureDiagnosis.Count > 0)
                {
                    sb.Append("HI");
                    for (int i = 0; i < otherProcedureDiagnosis.Count; i++)
                    {
                        if (i == 12)
                        {
                            sb.Append("~HI");
                            HiCounts++;
                        }
                        sb.Append("*" + otherProcedureDiagnosis[i].HIQual + ":" + otherProcedureDiagnosis[i].HICode + ":D8:" + otherProcedureDiagnosis[i].HIFromDate);
                        if (i == 23)
                        {
                            break;
                        }
                    }
                    sb.Append("~");
                    HiCounts++;
                }
            }
            List <HIItem> spanDiagnosis = His.Where(x => x.HIQual == "BI").ToList();

            if (spanDiagnosis.Count > 0)
            {
                sb.Append("HI");
                for (int i = 0; i < spanDiagnosis.Count; i++)
                {
                    if (i == 12)
                    {
                        sb.Append("~HI");
                        HiCounts++;
                    }
                    sb.Append("*" + spanDiagnosis[i].HIQual + ":" + spanDiagnosis[i].HICode + ":RD8:" + spanDiagnosis[i].HIFromDate + "-" + spanDiagnosis[i].HIToDate);
                    if (i == 23)
                    {
                        break;
                    }
                }
                sb.Append("~");
                HiCounts++;
            }
            List <HIItem> occurrenceDiagnosis = His.Where(x => x.HIQual == "BH").ToList();

            if (occurrenceDiagnosis.Count > 0)
            {
                sb.Append("HI");
                for (int i = 0; i < occurrenceDiagnosis.Count; i++)
                {
                    if (i == 12)
                    {
                        sb.Append("~HI");
                        HiCounts++;
                    }
                    sb.Append("*" + occurrenceDiagnosis[i].HIQual + ":" + occurrenceDiagnosis[i].HICode + ":D8:" + occurrenceDiagnosis[i].HIFromDate);
                    if (i == 23)
                    {
                        break;
                    }
                }
                sb.Append("~");
                HiCounts++;
            }
            List <HIItem> valueDiagnosis = His.Where(x => x.HIQual == "BE").ToList();

            if (valueDiagnosis.Count > 0)
            {
                sb.Append("HI");
                for (int i = 0; i < valueDiagnosis.Count; i++)
                {
                    if (i == 12)
                    {
                        sb.Append("~HI");
                        HiCounts++;
                    }
                    if (!string.IsNullOrEmpty(valueDiagnosis[i].HIAmount))
                    {
                        sb.Append("*" + valueDiagnosis[i].HIQual + ":" + valueDiagnosis[i].HICode + ":::" + valueDiagnosis[i].HIAmount);
                    }
                    else
                    {
                        sb.Append("*" + valueDiagnosis[i].HIQual + ":" + valueDiagnosis[i].HICode);
                    }
                    if (i == 23)
                    {
                        break;
                    }
                }
                sb.Append("~");
                HiCounts++;
            }
            List <HIItem> conditionDiagnosis = His.Where(x => x.HIQual == "BG").ToList();

            if (conditionDiagnosis.Count > 0)
            {
                sb.Append("HI");
                for (int i = 0; i < conditionDiagnosis.Count; i++)
                {
                    if (i == 12)
                    {
                        sb.Append("~HI");
                        HiCounts++;
                    }
                    sb.Append("*" + conditionDiagnosis[i].HIQual + ":" + conditionDiagnosis[i].HICode);
                    if (i == 23)
                    {
                        break;
                    }
                }
                sb.Append("~");
                HiCounts++;
            }
            List <HIItem> treatmentDiagnosis = His.Where(x => x.HIQual == "TC").ToList();

            if (treatmentDiagnosis.Count > 0)
            {
                sb.Append("HI");
                for (int i = 0; i < treatmentDiagnosis.Count; i++)
                {
                    if (i == 12)
                    {
                        sb.Append("~HI");
                        HiCounts++;
                    }
                    sb.Append("*" + treatmentDiagnosis[i].HIQual + ":" + treatmentDiagnosis[i].HICode);
                    if (i == 23)
                    {
                        break;
                    }
                }
                sb.Append("~");
                HiCounts++;
            }
            return(sb.ToString());
        }
예제 #9
0
        static void Main()
        {
            //Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);
            //Application.Run(new Dict());

            SysSet.IsRunUnInstall = false;                                 //是否强制卸载
            SysSet.UpdateAddress  = "http://hiscs.gzwsxxh.com:82/install"; //更新路径

            SysSet.LoginImg = new Bitmap("Ico/login.jpg");
            SysSet.TopImg   = new Bitmap("Ico/top.jpg");
            SysSet.MainImg  = new Bitmap("Ico/main.jpg");
            SysSet.LinkTel  = "服务热线: 110 "; //4006613506转1
            SysSet.LinkQQ   = "企业QQ:QQNUM"; //800013506
            //SysSet.LinkTel = "";
            //SysSet.LinkQQ = "";
            SysSet.MainIco = new Icon("Ico/main.ICO");
            //SysSet.NotifyIco = new Icon("Ico/notify.ico");
            SysSet.PtLogin  = false;     //登录模式
            SysSet.SjLogin  = true;      //手机登录
            SysSet.CheckSuo = false;     //加密锁检查

            SysSet.MenuName = "allmenu"; //不知道干啥的
            //SysSet.MenuName = "lkwzmenu";//不知道干啥的

            SysSet.SysName      = "联科医院信息系统( WZ )";
            SysSet.SysPath      = "联科软件";
            SysSet.MainTitle    = "联科医院信息系统( WZ )";
            SysSet.UserInputLoc = new Point(25, 50);
            SysSet.NotifyShow   = false;
            SysSet.LoginInc     = "LKWZSVR.Login";//提交到服务端的那个函数里面
            //SysSet.InitPlug = "LkEmr.EmrInit";
            SysSet.IsUpdate       = false;
            SysSet.UpdateDbConn   = "DbEmr";
            SysSet.UpdateOpenWin  = false;
            SysSet.RunNewMain     = true;
            SysSet.MySelfRunLogin = true;//全部执行自己的登录信息


            SysSet.MenuWidth = 188;
            //状态栏新增点击按钮
            SysSet.BottomUrls.Add(new UrlLink("农合后台系统", "http://xnh.gzxnh.gov.cn/guizhou/"));//主窗体底部添加信息


            SysSet.LoginAdSuc = new LoginSucHandle(delegate(LoadEvent e, string sjh, string userPwd, Sys login)
            {
                His.his.Useraccount = login.Useraccount;
                His.his.UserId      = 0;
                His.his.ChosName    = login.DepName;
                His.his.Choscode    = login.DepCode;
                His.his.UserName    = login.UserName;
            });
            SysSet.LoginSuc = new LoginSucHandle(delegate(LoadEvent e, string sjh, string userPwd, Sys login)
            {
                DataTable dt       = e.Msg.GetDataTable("dataTwo");
                DataTable yljg     = e.Msg.GetDataTable("data2");
                DataTable LinkInfo = e.Msg.GetDataTable("data3");
                DataTable MsgTab   = e.Msg.GetDataTable("data4");

                // 初始化医疗机构信息
                His.his.Choscode    = dt.Rows[0]["Choscode"].ToString();
                His.his.ChosName    = yljg.Rows[0]["cHosName"].ToString();
                His.his.Useraccount = dt.Rows[0]["Useraccount"].ToString().Replace(His.his.Choscode, "");
                His.his.UserName    = dt.Rows[0]["Name"].ToString();
                His.his.UserId      = int.Parse(dt.Rows[0]["UserID"].ToString());
                //His.his.postName = dt.Rows[0]["职务"].ToString();
                His.his.DeptName = dt.Rows[0]["科室名称"].ToString();
                //His.his.DeptID = dt.Rows[0]["科室ID"].ToString();
                //His.his.DoctorID = dt.Rows[0]["医生ID"].ToString();

                His.his.Iswsj      = ("1".Equals(yljg.Rows[0]["Iswsj"].ToString()));
                His.his.Nhjb       = yljg.Rows[0]["NHJB"].ToString();
                His.his.Nhhospcode = yljg.Rows[0]["nhhospcode"].ToString();
                His.his.Xcode      = yljg.Rows[0]["XCODE"].ToString();
                His.his.Zcode      = yljg.Rows[0]["Zcode"].ToString();
                His.his.Ccode      = yljg.Rows[0]["Ccode"].ToString();
                His.his.areacode   = yljg.Rows[0]["AreaCode"].ToString();
                His.his.Supercode  = yljg.Rows[0]["Supercode"].ToString();
                His.his.Rank       = yljg.Rows[0]["zlxjlb"].ToString().Trim();
                if (His.his.Rank.Equals(""))
                {
                    if (His.his.Iswsj)
                    {
                        His.his.Rank = "1";
                    }
                    else
                    {
                        His.his.Rank = "2";
                    }
                }

                if (LinkInfo != null)
                {
                    His.his.NHLinkUrl   = LinkInfo.Rows[0]["LINK"].ToString(); // 农合连接地址
                    His.his.jkdaLinkUrl = LinkInfo.Rows[1]["LINK"].ToString(); // 健康档案查阅连接地址
                }

                if (dt.Rows[0]["Fixedflag"] != null)
                {
                    His.Fixedflag = int.Parse(dt.Rows[0]["Fixedflag"].ToString()) == 1;
                }
                else
                {
                    His.Fixedflag = false;
                }

                ActionLoad load = ActionLoad.Conn();
                load.Action     = "LKWZSVR.his.sys.GetHisParam";
                load.Add("cHosCode", His.his.Choscode);
                ServiceMsg e1  = load.Post();
                His.PRMDT      = e1.GetDataTable();
                His.HisParam   = e1.GetDataTable("dataTwo");
                His.wsjYBParam = e1.GetDataTable("data2");
                His.YBParam    = e1.GetDataTable("data3");

                // NHClient.NHHOSCODE = His.his.Nhhospcode;         // His.GetSysParam("NHHOSCODE");
                His.his.WsjCode    = His.GetSysParam("WSJCODE");
                His.his.Nhperfix   = His.GetSysParam("NHPERFIX");
                His.his.IsNotKF    = new ObjItem(His.HisSysParam(His.HP_SFKZZKF)).ToInt() != 1;
                His.his.IsUseYZ    = new ObjItem(His.HisSysParam(27)).ToInt() == 1;
                His.his.IsFpPj     = new ObjItem(His.HisSysParam(His.sys_PJmagr)).ToInt() == 1;
                His.his.UseBedbg   = new ObjItem(His.HisSysParam(His.sys_BedBg)).ToInt() == 1;
                His.his.IsYZAutoMB = new ObjItem(His.HisSysParam(28)).ToInt() == 1;
                His.his.YZPnum     = His.HisSysParam(30).ToString();

                login.DepCode       = His.his.Choscode;
                login.DepName       = His.his.ChosName;
                login.UserID        = His.his.UserId + "";
                login.Useraccount   = His.his.Useraccount;
                login.UserName      = His.his.UserName;
                login.XName         = His.his.UserName;
                login.DeptName      = His.his.DeptName;
                login.Tel           = sjh;
                YtSys.Ui.User       = login;
                ClientState.UseName = His.his.Choscode + "" + His.his.Useraccount;
                ClientState.Pwd     = userPwd;
                string fwqDate      = e.Msg.GetValue("data5").Trim();
                DateTime d          = DateTime.Parse(fwqDate);//同步服务器时间
                His.his.WebDate     = d;

                TimeSpan t = d - DateTime.Now;
                if (Math.Abs(t.TotalMinutes) > 2)
                {
                    try
                    {
                        Cmd.SetSysTime(short.Parse(d.Year + ""), short.Parse(d.Month + ""), short.Parse(d.Day + ""), short.Parse(d.Hour + ""), short.Parse(d.Minute + ""), short.Parse(d.Second + ""));
                    }
                    catch
                    {
                        WJs.alert("同步本机时间与服务器时间失败,请手动更改本机时间!\n服务器当前时间为【" + d.ToString("yyyy-MM-dd HH:ss") + "】");
                        return;
                    }
                }
                His.Right = e.Msg.GetDataTable();//获取用户权限

                // loadDataDict();


                if ("123456".Equals(userPwd))
                {
                    WJs.alert("您是用初始密码登陆,请您尽快修改密码!");
                }


                //------------ 系统消息显示 -------------------
                if (!His.his.Iswsj && MsgTab != null && MsgTab.Rows.Count > 0)  //消息显示
                {
                    WJs.alert(MsgTab.Rows[0]["msg"].ToString());
                }

                //------------- 机构设置消息显示 --------------
                //if (new ObjItem(yljg.Rows[0]["flag"].ToString()).ToInt() > 0)
                //{
                //    InfoFrm fm = new InfoFrm(yljg.Rows[0]["LICENCE"].ToString());
                //    fm.ShowDialog();
                //    if (new ObjItem(yljg.Rows[0]["flag"].ToString()).ToInt() == 3)//禁用系统
                //        Application.Exit();
                //}

                if (DataCache.serviceData != null)
                {
                    DataCache.serviceData.Clear();
                }

                //设置提示信息;
                string jbstr;
                if (His.his.Rank.Equals("1"))
                {
                    jbstr = "县级";
                }
                else if (His.his.Rank.Equals("3"))
                {
                    jbstr = "村级";
                }
                else
                {
                    if (!His.his.Iswsj)
                    {
                        jbstr = "乡镇级";
                    }
                    else
                    {
                        jbstr = "县级以上";
                    }
                }

                if (!His.his.Rank.Equals(His.his.Nhjb) && !His.his.Iswsj)
                {
                    if (His.his.Nhjb.Equals("1"))
                    {
                        jbstr = jbstr + "(农合级别:县级)";
                    }
                    else if (His.his.Rank.Equals("3"))
                    {
                        jbstr = jbstr + "、(农合级别:村级)";
                    }
                    else if (His.his.Nhjb.Equals("2"))
                    {
                        jbstr = jbstr + "、(农合级别:乡镇级)";
                    }
                    else
                    {
                        jbstr = jbstr + "、(农合级别:未设置)";
                    }
                }

                jbstr = " 【收费标准:" + jbstr + "】 ";

                SysSet.BottomAlert = "          当前机构:" + His.his.ChosName + jbstr + " ,          用户:" + His.his.UserName +
                                     " 、" + His.his.DeptName + " 、" + His.his.postName + "          ";
            });

            YTMain.RunMain.Main();
        }