public MainForm(string _UserCode, string _UserName, string _HOSPITAL_ID, string _HOSPITAL_NAME, string _sbjgbh, string _yybm, string _UserCode_DW, string _Password_DW, string networkPatclassID) { StringBuilder strSql = new StringBuilder(); strSql.Append(" SELECT TOP 1 a.USER_SYS_ID,HOSPITAL_ID FROM COMM.COMM.USERINFO_VIEW a "); strSql.Append(" LEFT JOIN COMM.COMM.ROLES_VS_SYS b ON b.ROLE_ID = a.ROLE_ID "); strSql.Append(" WHERE b.SYS_ID='1' AND a.FLAG_SYSINVALID=0 "); strSql.Append(" AND USER_CODE= '" + _UserCode + "' "); DataTable oper = SQLHelper.ExecSqlReDs(strSql.ToString()).Tables[0]; OPERATOR_ID = oper.Rows[0]["USER_SYS_ID"].ToString(); StringBuilder strSql2 = new StringBuilder(); strSql2.Append(" SELECT TOP 1 NETWORKING_PAT_CLASS_ID FROM COMM.DICT.NETWORKING_PAT_CLASS "); oper = SQLHelper.ExecSqlReDs(strSql2.ToString()).Tables[0]; // NETWORKING_PAT_CLASS_ID = oper.Rows[0]["NETWORKING_PAT_CLASS_ID"].ToString(); //networkPatclassID NETWORKING_PAT_CLASS_ID = networkPatclassID; HOSPITAL_ID = _HOSPITAL_ID; UserName = _UserName; HOSPITAL_NAME = _HOSPITAL_NAME; sbjgbh = _sbjgbh; yybm = _yybm; UserCode_DW = _UserCode_DW; Password_DW = _Password_DW; InitializeComponent(); }
private void gb() { StringBuilder StrSql = new StringBuilder(); StrSql.Append(" SELECT "); // StrSql.Append(" [ITEM_PROP]"); StrSql.Append(" [HIS_ITEM_CODE]"); StrSql.Append(" ,[HIS_ITEM_NAME] AS 医院项目名称"); StrSql.Append(" ,[NETWORK_ITEM_CODE] as 医保项目编码"); StrSql.Append(" ,[NETWORK_ITEM_NAME] as 中心名称"); StrSql.Append(" ,[SELF_BURDEN_RATIO] "); StrSql.Append(" ,[MEMO]"); StrSql.Append(" ,[START_TIME] as 启用时间"); StrSql.Append(" ,[STOP_TIME] as 停用时间"); StrSql.Append(" ,[TYPE_MEMO]"); // StrSql.Append(" ,[NETWORK_ITEM_PROP]"); StrSql.Append(" ,[NETWORK_ITEM_CHARGE_CLASS]"); StrSql.Append(" ,[HOSPITAL_ID]"); StrSql.Append(" ,[AUTO_ID] "); StrSql.Append(" ,[NETWORK_ITEM_PRICE] as 联网价格"); // StrSql.Append(" ,[FLAG_DISABLED]"); // StrSql.Append(" ,[NETWORK_ITEM_FLAG_UP]"); StrSql.Append(" FROM [COMM].[COMM].[NETWORKING_ITEM_VS_HIS] "); StrSql.Append(" where memo in('审批已通过','未审批') "); StrSql.Append(" AND (HIS_ITEM_CODE LIKE '%" + txt_hisxm.Text + "%' OR HIS_ITEM_NAME LIKE '%" + txt_hisxm.Text + "%' ) ORDER BY HIS_ITEM_CODE "); DataSet ds = new DataSet(); DataTable zxdata = new DataTable(); ds = SQLHelper.ExecSqlReDs(StrSql.ToString()); zxdata = ds.Tables[0]; dataGridView1.DataSource = zxdata; }
public DataTable OutPatIdToInvoiceCode(string OutPatID, string StrConn, string StartTime, string EndTime) { sqlHelper = new MSSQLHelpers(StrConn); DataTable dtResult = new DataTable(); StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT CAST(0 AS BIT) as 选择需要退费的发票号, INVOICE_CODE as 发票号,INVOICE_ID as 发票ID,AMOUNT as 发票金额 FROM MZ.OUT.INVOICE_MAIN WHERE CREATE_TIME BETWEEN '" + StartTime + "' AND '" + EndTime + "' AND OUT_PAT_ID ='" + OutPatID + "'AND INVOICE_TYPE <10000 "); dtResult = sqlHelper.ExecSqlReDs(strSql.ToString()).Tables[0]; return(dtResult); }
public DataTable OutPatCodeQueryAutoID(string OutPatCode, string StrConn) { sqlHelper = new MSSQLHelpers(StrConn); DataTable dtResult = new DataTable(); StringBuilder strSql = new StringBuilder(); strSql.Append(" SELECT CAST(1 AS BIT) AS 是否收取该费用,b.AUTO_ID,c.CHARGE_NAME,b.AMOUNT AS 总金额,b.QUANTITY AS 数量,b.SPEC,b.PRICE AS 单价 FROM COMM.DICT.OUT_PATS a INNER JOIN MZ.OUT.OUT_ORDER_CHARGE_TMP b ON a.OUT_PAT_ID =b.PAT_ID INNER JOIN COMM.COMM.CHARGE_PRICE_ALL_VIEW c ON b.CHARGE_ID = c.CHARGE_ID WHERE a.OUT_PAT_CODE='" + OutPatCode + "'"); dtResult = sqlHelper.ExecSqlReDs(strSql.ToString()).Tables[0]; return(dtResult); }
public DataTable QueryChargeClassID(string StrConn) { sqlHelper = new MSSQLHelpers(StrConn); DataTable dtResult = new DataTable(); StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT CHARGE_CLASS_ID ,CHARGE_CLASS_NAME ,NETWORKING_PAT_CLASS_ID FROM COMM.DICT.CHARGE_CLASSES"); dtResult = sqlHelper.ExecSqlReDs(strSql.ToString()).Tables[0]; return(dtResult); }
public DataTable PatHosCodeConvertToPatHosId(string PatInHosCode, string StrConn) { sqlHelper = new MSSQLHelpers(StrConn); DataTable dtResult = new DataTable(); StringBuilder strSql = new StringBuilder(); strSql.Append(" SELECT PAT_IN_HOS_ID,PAT_AGAIN_IN_TIMES,CHARGE_CLASS_NAME,IN_PAT_NAME,CHARGE_CLASS_ID FROM ZY.[IN].PAT_ALL_INFO_VIEW WHERE PAT_IN_HOS_CODE ='" + PatInHosCode + "'"); dtResult = sqlHelper.ExecSqlReDs(strSql.ToString()).Tables[0]; return(dtResult); }
public DataTable GetOutPatAllInfo(string name, string StrConn) { DataTable dtResult = new DataTable(); sqlHelper = new MSSQLHelpers(StrConn); StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT OUT_PAT_ID,OUT_PAT_CODE,CHARGE_CLASS_ID,OUT_PAT_NAME FROM COMM.DICT.OUT_PATS WHERE OUT_PAT_NAME ='" + name + "' OR INPUT_CODE LIKE '" + name + "%'"); dtResult = sqlHelper.ExecSqlReDs(strSql.ToString()).Tables[0]; return(dtResult); }
public DataTable OutPatIDToOutPatCode(string OutPatID, string StrConn) { DataTable dtResult = new DataTable(); sqlHelper = new MSSQLHelpers(StrConn); StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT OUT_PAT_CODE FROM COMM.DICT.OUT_PATS WHERE OUT_PAT_ID ='" + OutPatID + "'"); dtResult = sqlHelper.ExecSqlReDs(strSql.ToString()).Tables[0]; return(dtResult); }
public DataTable OutPatCodeConvertToOutPatID(string OutPatCode, string StrConn) { sqlHelper = new MSSQLHelpers(StrConn); DataTable dtResult = new DataTable(); StringBuilder strSql = new StringBuilder(); strSql.Append(" SELECT OUT_PAT_NAME,OUT_PAT_ID,CHARGE_CLASS_ID FROM COMM.DICT.OUT_PATS WHERE OUT_PAT_CODE ='" + OutPatCode + "'"); dtResult = sqlHelper.ExecSqlReDs(strSql.ToString()).Tables[0]; return(dtResult); }
public DataTable ChargeClassIdConvertToNetworkPatClassId(string ChargeClassId, string StrConn) { sqlHelper = new MSSQLHelpers(StrConn); DataTable dtResult = new DataTable(); StringBuilder strSql = new StringBuilder(); strSql.Append(" SELECT NETWORKING_PAT_CLASS_ID FROM COMM.DICT.CHARGE_CLASSES WHERE CHARGE_CLASS_ID ='" + ChargeClassId + "'"); dtResult = sqlHelper.ExecSqlReDs(strSql.ToString()).Tables[0]; return(dtResult); }
public DataTable GetInoviceDetails(string InvoiceList, string StrConn) { DataTable dtResult = new DataTable(); sqlHelper = new MSSQLHelpers(StrConn); StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT CAST(0 AS BIT) as 选择需要退费的项目,b.CHARGE_NAME,a.QUANTITY AS 退费数量,a.QUANTITY AS 数量,a.AMOUNT AS 总额,(CASE WHEN b.CHARGE_TYPE >100 THEN '诊疗' WHEN b.CHARGE_TYPE<100 THEN '药品' END) AS 类型,a.INVOICE_DETAIL_ID AS 发票明细ID FROM"); strSql.Append(" MZ.OUT.INVOICE_DETAILS_VIEW a INNER JOIN COMM.COMM.CHARGE_PRICE_ALL_VIEW b ON a.CHARGE_ID = b.CHARGE_ID INNER JOIN MZ.OUT.INVOICE_MAIN c ON a.INVOICE_ID =c.INVOICE_ID WHERE A.INVOICE_ID in (" + InvoiceList + ") AND (c.INVOICE_TYPE >=1 AND c.INVOICE_TYPE <=10000)"); dtResult = sqlHelper.ExecSqlReDs(strSql.ToString()).Tables[0]; return(dtResult); }
private void GX() { StringBuilder sqlStr1 = new StringBuilder(); sqlStr1.Append(" select * FROM COMM.COMM.NETWORKING_ITEM_VS_HIS "); sqlStr1.Append(" WHERE HIS_ITEM_CODE IN ( SELECT HIS_ITEM_CODE "); sqlStr1.Append(" FROM COMM.COMM.NETWORKING_ITEM_VS_HIS "); sqlStr1.Append(" WHERE HOSPITAL_ID = '1' "); sqlStr1.Append(" AND NETWORKING_PAT_CLASS_ID='3' "); sqlStr1.Append(" GROUP BY HIS_ITEM_CODE "); sqlStr1.Append(" HAVING COUNT(HIS_ITEM_CODE) > 1 "); sqlStr1.Append(" ) "); sqlStr1.Append("AND HOSPITAL_ID = '1' "); sqlStr1.Append(" AND NETWORKING_PAT_CLASS_ID='3';"); DataSet ds = new DataSet(); DataTable hisdata = new DataTable(); ds = SQLHelper.ExecSqlReDs(sqlStr1.ToString()); hisdata = ds.Tables[0]; dgv_his.DataSource = hisdata; }
/// <summary> /// 添加按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { if (cmbfylb.Text == "居民统筹") { fylb = "2"; } else if (cmbfylb.Text == "居民门规") { fylb = "1"; } else if (cmbfylb.Text == "普通门诊") { fylb = "3"; } else if (cmbfylb.Text == "职工门规") { fylb = "4"; } else if (cmbfylb.Text == "免费药品") { fylb = "5"; } else if (cmbfylb.Text == "职工统筹") { fylb = "6"; } string networktypeprop = ""; //if (cmbfylb.Text == "测试") //{ // fylb = "10004"; //} string networkchargeClass = ""; if (cmbxmlx.Text == "药品") { xmlb = "1"; networktypeprop = "1"; networkchargeClass = "1"; } else if (cmbxmlx.Text == "诊疗") { xmlb = "2"; networktypeprop = "2"; networkchargeClass = ""; } else if (cmbxmlx.Text == "材料") { xmlb = "1"; networktypeprop = "1"; networkchargeClass = "3"; } if (txtzfbl.Text == "0") { memo = "甲"; } else if (txtzfbl.Text != "0" && txtzfbl.Text != "100") { memo = "乙"; } else if (txtzfbl.Text == "100") { memo = "丙"; } if (string.IsNullOrEmpty(txtHiscode.Text) || string.IsNullOrEmpty(txtHisname.Text) || string.IsNullOrEmpty(txtZxCode.Text) || string.IsNullOrEmpty(MainForm.HOSPITAL_ID)) { MessageBox.Show("不能添加或插入空值!"); return; } //插入之前判断重复 StringBuilder strquchong = new StringBuilder(); strquchong.Append("select * from COMM.COMM.NETWORKING_ITEM_VS_HIS WHERE NETWORKING_PAT_CLASS_ID=" + fylb + " and HIS_ITEM_CODE= '" + txtHiscode.Text + "' and HOSPITAL_ID= " + MainForm.HOSPITAL_ID); //WHERE NETWORKING_PAT_CLASS_ID='4' AND HIS_ITEM_CODE='110900001c' and HOSPITAL_ID ='8001' if (sqlHelper.ExecSqlReDs(strquchong.ToString()).Tables[0].Rows.Count > 0) { MessageBox.Show("该类别的HIS编码已有一条对应关系,无法添加"); return; } StringBuilder strAdd = new StringBuilder(); strAdd.Append(" INSERT INTO COMM.COMM.NETWORKING_ITEM_VS_HIS "); strAdd.Append("( NETWORKING_PAT_CLASS_ID, "); strAdd.Append(" ITEM_PROP, "); strAdd.Append(" HIS_ITEM_CODE, "); strAdd.Append(" HIS_ITEM_NAME, "); strAdd.Append(" NETWORK_ITEM_CODE, "); strAdd.Append(" NETWORK_ITEM_NAME, "); strAdd.Append(" SELF_BURDEN_RATIO, "); strAdd.Append(" MEMO, "); strAdd.Append(" START_TIME, "); strAdd.Append(" STOP_TIME, "); strAdd.Append(" TYPE_MEMO, "); strAdd.Append(" NETWORK_ITEM_PROP, "); strAdd.Append(" NETWORK_ITEM_CHARGE_CLASS, "); strAdd.Append(" HOSPITAL_ID, "); strAdd.Append(" NETWORK_ITEM_PRICE, "); strAdd.Append(" FLAG_DISABLED, "); strAdd.Append(" NETWORK_ITEM_FLAG_UP "); strAdd.Append(" ) "); strAdd.Append(" VALUES( "); strAdd.Append(" '" + fylb + "', "); strAdd.Append(" '" + xmlb + "', "); strAdd.Append(" '" + txtHiscode.Text + "', "); strAdd.Append(" '" + txtHisname.Text + "', "); strAdd.Append(" '" + txtZxCode.Text + "', "); strAdd.Append(" '" + txtZxname.Text + "', "); strAdd.Append(" '" + txtzfbl.Text + "', "); strAdd.Append(" '" + memo + "', "); strAdd.Append(" '" + DateTime.Now + "', "); strAdd.Append(" '" + DateTime.Now + "', "); strAdd.Append(" '" + memo + "', "); strAdd.Append(" '" + networktypeprop + "', "); strAdd.Append(" '" + networkchargeClass + "', "); strAdd.Append(" '" + MainForm.HOSPITAL_ID + "', "); strAdd.Append(" '" + txtPrice.Text + "', "); strAdd.Append(" '0', "); strAdd.Append(" '1' "); strAdd.Append(" ) "); int suuccess = sqlHelper.ExecSqlReInt(strAdd.ToString()); if (suuccess > 0) { MessageBox.Show("添加成功"); } }
/// <summary> /// 查询按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { StringBuilder strSselect = new StringBuilder(); if (cmbfylb.Text == "") { strSselect.Append(" SELECT NETWORKING_PAT_CLASS_ID AS 费用类别,HIS_ITEM_CODE AS 医院编码,HIS_ITEM_NAME AS 医院名称,NETWORK_ITEM_CODE AS 中心编码,NETWORK_ITEM_NAME AS 中心名称,SELF_BURDEN_RATIO AS 自付比例,NETWORK_ITEM_PRICE AS 价格,HOSPITAL_ID AS 医院编号 "); strSselect.Append(" FROM COMM.COMM.NETWORKING_ITEM_VS_HIS WHERE (HOSPITAL_ID='" + hosid + "') AND HIS_ITEM_CODE LIKE '%" + txtmcbm.Text + "%' OR HIS_ITEM_NAME LIKE '%" + txtmcbm.Text + "%' OR NETWORK_ITEM_CODE LIKE '%" + txtmcbm.Text + "%' AND HOSPITAL_ID "); } else { //arraylist1.Add(new DictionaryEntry(ConfigurationManager.AppSettings["JMTC_PATID"].ToString(), "居民统筹")); //arraylist1.Add(new DictionaryEntry(ConfigurationManager.AppSettings["JMMG_PATID"].ToString(), "居民门规")); //arraylist1.Add(new DictionaryEntry(ConfigurationManager.AppSettings["PTMZ_PATID"].ToString(), "普通门诊")); //arraylist1.Add(new DictionaryEntry(ConfigurationManager.AppSettings["ZGMG_PATID"].ToString(), "职工门规")); //arraylist1.Add(new DictionaryEntry(ConfigurationManager.AppSettings["MFYY_PATID"].ToString(), "免费药品")); //arraylist1.Add(new DictionaryEntry(ConfigurationManager.AppSettings["ZGTC_PATID"].ToString(), "职工统筹")); if (cmbfylb.Text == "居民统筹") { fylb = "2"; } else if (cmbfylb.Text == "居民门规") { fylb = "1"; } else if (cmbfylb.Text == "普通门诊") { fylb = "3"; } else if (cmbfylb.Text == "职工门规") { fylb = "4"; } else if (cmbfylb.Text == "免费药品") { fylb = "5"; } else if (cmbfylb.Text == "职工统筹") { fylb = "6"; } else if (cmbfylb.Text == "居民住院") { fylb = "7"; } else if (cmbfylb.Text == "职工住院") { fylb = "8"; } //if (cmbfylb.Text == "测试") //{ // fylb = "10004"; //} strSselect.Append(" SELECT 0 as ISCHECK,NETWORKING_PAT_CLASS_ID AS 费用类别,HIS_ITEM_CODE AS 医院编码,HIS_ITEM_NAME AS 医院名称,NETWORK_ITEM_CODE AS 中心编码,NETWORK_ITEM_NAME AS 中心名称,SELF_BURDEN_RATIO AS 自付比例,NETWORK_ITEM_PRICE AS 价格,HOSPITAL_ID AS 医院id "); strSselect.Append(" FROM COMM.COMM.NETWORKING_ITEM_VS_HIS WHERE (HOSPITAL_ID='" + hosid + "') AND NETWORKING_PAT_CLASS_ID='" + fylb + "' AND ( HIS_ITEM_CODE LIKE '%" + txtmcbm.Text + "%' OR HIS_ITEM_NAME LIKE '%" + txtmcbm.Text + "%' OR NETWORK_ITEM_CODE LIKE '%" + txtmcbm.Text + "%' )"); } DataSet ds = new DataSet(); DataTable hisdata = new DataTable(); ds = sqlHelper.ExecSqlReDs(strSselect.ToString()); hisdata = ds.Tables[0]; dataGridView1.DataSource = hisdata; }
private void button1_Click(object sender, EventArgs e) { string strHisCode = this.tbxyyxmbm.Text.Trim(); string strHisName = this.tbxyyxmm.Text.Trim(); string strZXCode = this.tbxCenterbm.Text.Trim(); string strZXName = this.tbxcenterName.Text.Trim(); string strTypeMemoCgHIScode = ""; string crcgName = ""; // SELECT * FROM [COMM].[COMM].[NETWORKING_ITEM_VS_HIS] WHERE [HIS_ITEM_CODE]='' StringBuilder SqlstringQc = new StringBuilder(); SqlstringQc.Append("SELECT * FROM [COMM].[COMM].[NETWORKING_ITEM_VS_HIS] WHERE HIS_ITEM_CODE='"+ strHisCode + "'"); DataSet dtc = SQLHelper.ExecSqlReDs(SqlstringQc.ToString()); if (dtc.Tables[0].Rows.Count >= 1) { MessageBox.Show("该编码已存在!"); return; } StringBuilder Sqlstring = new StringBuilder(); Sqlstring.Append("INSERT INTO COMM.COMM.NETWORKING_ITEM_VS_HIS"); Sqlstring.Append("(NETWORKING_PAT_CLASS_ID,"); Sqlstring.Append("ITEM_PROP,"); Sqlstring.Append("HIS_ITEM_CODE,"); Sqlstring.Append("HIS_ITEM_NAME,"); Sqlstring.Append("NETWORK_ITEM_CODE,"); Sqlstring.Append("NETWORK_ITEM_NAME,"); Sqlstring.Append("SELF_BURDEN_RATIO,"); Sqlstring.Append("MEMO,"); Sqlstring.Append("START_TIME,"); Sqlstring.Append("STOP_TIME,"); Sqlstring.Append("TYPE_MEMO,"); Sqlstring.Append("NETWORK_ITEM_PROP,"); Sqlstring.Append("NETWORK_ITEM_CHARGE_CLASS,"); Sqlstring.Append("HOSPITAL_ID,"); Sqlstring.Append("NETWORK_ITEM_PRICE,"); Sqlstring.Append("FLAG_DISABLED,"); Sqlstring.Append("NETWORK_ITEM_FLAG_UP"); Sqlstring.Append(")"); Sqlstring.Append("VALUES( 3,"); Sqlstring.Append(" '" + 9 + "',"); Sqlstring.Append(" '" + strHisCode + "',"); Sqlstring.Append(" '" + strHisName + "',"); if (string.IsNullOrEmpty(this.cbotype.Text) || string.IsNullOrEmpty(strHisCode) || string.IsNullOrEmpty(strHisName)) { // strHisCode = this.cbotype.SelectedValue.ToString(); MessageBox.Show("请选择项目类型!医院项目码医院项目名必填!"); return; } //此处篡改中心码 if (this.cbotype.SelectedValue.ToString() == "1017-4") { strZXCode = "210485"; strZXName = "自费诊疗项目"; Sqlstring.Append(" '" + strZXCode + "',"); //中心名无所谓 Sqlstring.Append(" '" + strZXName + "',"); strTypeMemoCgHIScode = "1017-4"; // crcgName = "锂测定(离子选择电极法)"; } if (this.cbotype.SelectedValue.ToString() == "30401") { strZXCode = "206024"; strZXName = "(新)自费一次性材料"; Sqlstring.Append(" '" + strZXCode + "',"); //中心名无所谓 Sqlstring.Append(" '" + strZXName + "',"); strTypeMemoCgHIScode = "30401"; // crcgName = "C高频手术电刀柄"; } if (this.cbotype.SelectedValue.ToString() == "999") { Frmaddfalg fflag = new Frmaddfalg(); fflag.ShowDialog(); strZXCode = fflag.thzxbm; strZXName = fflag.thzxbmc; Sqlstring.Append(" '" + strZXCode + "',"); //中心名无所谓 Sqlstring.Append(" '" + strZXName + "',"); strTypeMemoCgHIScode = fflag.thhisbm; } Sqlstring.Append(" '" + 100 + "',"); Sqlstring.Append(" '审批已通过',"); //国药 Sqlstring.Append(" GETDATE(),"); Sqlstring.Append(" GETDATE(),"); Sqlstring.Append(" '" + strTypeMemoCgHIScode + "',");//此处写入篡改的编码 对应his Sqlstring.Append(" '" + 0 + "',"); //此处写入篡改的名称 Sqlstring.Append("'" + crcgName + "',"); Sqlstring.Append(" 1,"); Sqlstring.Append(" '" + 0.0000 + "',"); Sqlstring.Append(" 1, "); Sqlstring.Append(" 1 "); Sqlstring.Append(" ) "); int Num = SQLHelper.ExecSqlReInt(Sqlstring.ToString()); if (Num > 0) { MessageBox.Show("添加成功!"); return; } }
/// <summary> /// 登录 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { var time = DateTime.Now; UserCode = text_UserCode.Text.ToString().Trim(); Password = text_Password.Text.ToString().Trim(); UserName = textBox_CzyXm.Text.ToString().Trim(); HOSPITAL_ID = cmb_Hos.SelectedValue.ToString(); HOSPITAL_NAME = cmb_Hos.Text; if (UserCode == "" || UserName == "") { MessageBox.Show("请正确输入用户名回车后再进行登录!"); this.text_UserCode.Focus(); return; } else if (Password == "") { MessageBox.Show("请输入密码后再进行登录!"); this.text_Password.Focus(); return; } else { string PassWord_JM = StringHelper.GetMD5String(Password); StringBuilder strSql = new StringBuilder(); strSql.Append(" SELECT DISTINCT a.USER_CODE,a.UESR_NAME,a.PASSWORD,a.HOSPITAL_ID,c.HOSPITAL_NAME FROM COMM.COMM.USERINFO_VIEW a "); strSql.Append(" LEFT JOIN COMM.COMM.ROLES_VS_SYS b ON b.ROLE_ID = a.ROLE_ID "); strSql.Append(" LEFT JOIN COMM.COMM.HOSPITALS c ON c.HOSPITAL_ID = a.HOSPITAL_ID "); strSql.Append(" WHERE b.SYS_ID IN ('1','3') AND a.FLAG_SYSINVALID=0 "); strSql.Append(" AND USER_CODE= '" + UserCode + "' AND a.HOSPITAL_ID='" + HOSPITAL_ID + "' ");//AND a.PASSWORD='******' DataTable dtRe = new DataTable(); dtRe = SQLHelper.ExecSqlReDs(strSql.ToString()).Tables[0]; if (dtRe.Rows.Count == 0) { MessageBox.Show("用户不存在或无此登陆权限"); return; } else if (dtRe.Rows[0]["PASSWORD"].ToString().Trim() != PassWord_JM) //判断密码 { MessageBox.Show("密码不正确"); this.text_Password.Text = ""; text_Password.Focus(); return; } this.Hide(); StringBuilder strSql2 = new StringBuilder(); strSql2.Append(" SELECT TOP 1 MEMO, INSTITUTION_CODE, INSTITUTION_NAME, INSTITUTION_USER_CODE, INSTITUTION_PASSWORD "); strSql2.Append(" FROM COMM.DICT.NETWORK_VS_INSTITUTION "); strSql2.Append(" WHERE HOSPITAL_ID='" + HOSPITAL_ID + "' "); dtRe = new DataTable(); dtRe = SQLHelper.ExecSqlReDs(strSql2.ToString()).Tables[0]; if (dtRe.Rows.Count == 0) { MessageBox.Show("用户不存在或无此登陆权限"); return; } sbjgbh = ConfigurationManager.AppSettings["sbjgbh_JMYB"].ToString(); //社保机构编号(居民) yybm = dtRe.Rows[0]["INSTITUTION_CODE"].ToString(); //医院编码 zcm = dtRe.Rows[0]["MEMO"].ToString(); //注册码 UserCode_DW = dtRe.Rows[0]["INSTITUTION_USER_CODE"].ToString(); //医保登录用户名 Password_DW = dtRe.Rows[0]["INSTITUTION_PASSWORD"].ToString(); //医保登录密码 //LOGIN.Sel_SBJG frm = new LOGIN.Sel_SBJG(this.text_UserCode.Text.ToString(), this.textBox_CzyXm.Text.ToString(), HOSPITAL_ID, HOSPITAL_NAME); MainForm frm = new MainForm(UserCode, UserName, HOSPITAL_ID, HOSPITAL_NAME, sbjgbh, yybm, zcm, UserCode_DW, Password_DW); frm.ShowDialog(); this.Close(); this.Dispose(); } }
/// <summary> /// 第一步:获取已经归档的病人的病案首页 /// </summary> /// <returns></returns> private DataTable get_maininfo() { StringBuilder str_info_s = new StringBuilder(); str_info_s.Append("SELECT a.MEDICAL_RECORD_CODE AS 病例号 ,"); str_info_s.Append(" a.PAT_IN_WAY AS 入院途径 ,"); str_info_s.Append(" CONVERT(DATETIME,a.PAT_IN_TIME,120) AS 住院日期 ,"); str_info_s.Append(" CONVERT(DATETIME,a.PAT_OUT_TIME,120) 出院日期 ,"); str_info_s.Append(" isnull((case when b.DIAGNOSE_TIME='0001-01-01'then CONVERT(DATETIME,a.PAT_IN_TIME,120) else CONVERT(DATETIME,b.DIAGNOSE_TIME,120) end), CONVERT(DATETIME,a.PAT_IN_TIME,120)) AS 确诊日期 ,"); str_info_s.Append(" a.PAT_IN_DEPT AS 入院科室 ,"); str_info_s.Append(" a.PAT_OUT_DEPT AS 出院科室 ,"); str_info_s.Append(" b.BLOOD_TYPE AS 血型 ,"); str_info_s.Append(" b.RH AS RH血型 ,"); str_info_s.Append(" '' AS 离院方式 ,"); str_info_s.Append(" '医嘱出院' AS 出院小结 ,"); str_info_s.Append(" ISNULL(c.USER_CODE,'') AS 主治医师 ,"); str_info_s.Append(" ISNULL(d.USER_CODE,'') AS 住院医师 ,"); str_info_s.Append(" a.RELATIVE_NAME AS 联系人 ,"); str_info_s.Append(" a.RELATION AS 联系人关系 ,"); str_info_s.Append(" (CASE WHEN a.RELATIVE_PHONE = '' AND a.ADDRESS_PHONE='' THEN '05338592008' WHEN a.ADDRESS_PHONE='' THEN a.RELATIVE_PHONE ELSE a.ADDRESS_PHONE END) AS 联系人电话 ,"); str_info_s.Append(" (CASE WHEN a.RELATIVE_PHONE = '' AND a.ADDRESS_PHONE='' THEN '05338592008' WHEN a.ADDRESS_PHONE='' THEN a.RELATIVE_PHONE ELSE a.ADDRESS_PHONE END) AS 病人电话 ,"); str_info_s.Append(" ISNULL(e.USER_CODE,'') AS 责任护士 ,"); str_info_s.Append(" ISNULL(f.USER_CODE,'') AS 科室主任 ,"); str_info_s.Append(" ISNULL(g.USER_CODE,'') AS 主任医师 ,"); str_info_s.Append(" ISNULL(h.USER_CODE,'') AS 进修医师 ,"); str_info_s.Append(" ISNULL(j.USER_CODE,'') AS 实习医师 ,"); str_info_s.Append(" '' AS 转出医疗机构编码,A.PAT_IN_HOS_ID "); str_info_s.Append("FROM MedicalRecord.MEDICAL.MEDICAL_RECORD_BASE_MSG a"); //str_info_s.Append(" INNER JOIN MedicalRecord.MEDICAL.MEDICAL_RECORD_CHECK k ON a.MEDICAL_RECORD_CODE = k.MEDICAL_CODE"); str_info_s.Append(" LEFT JOIN MedicalRecord.MEDICAL.MEDICAL_RECORD_DIAGNOSIS b ON a.MEDICAL_RECORD_CODE = b.MEDICAL_CODE AND a.ID = b.BASE_MSG_ID"); str_info_s.Append(" LEFT JOIN COMM.COMM.users c ON b.MAIN_DOCTOR = c.[USER_ID]"); str_info_s.Append(" LEFT JOIN COMM.COMM.users d ON b.PAT_IN_DOCTOR = d.[USER_ID]"); str_info_s.Append(" LEFT JOIN COMM.COMM.users e ON b.RESP_NURSE = e.[USER_ID]"); str_info_s.Append(" LEFT JOIN COMM.COMM.users f ON b.DEPT_HEAD = f.[USER_ID]"); str_info_s.Append(" LEFT JOIN COMM.COMM.users g ON b.DEPUTY_HEAD = g.[USER_ID]"); str_info_s.Append(" LEFT JOIN COMM.COMM.users h ON b.ADVANCED_DOCTOR = h.[USER_ID]"); str_info_s.Append(" LEFT JOIN COMM.COMM.users j ON b.STUDY_DOCTOR = j.[USER_ID]"); if (comboBox1.Text == "已上传") { str_info_s.Append(" WHERE CONVERT(VARCHAR(10),CONVERT(DATETIME,a.pat_out_time,120),120)>=CONVERT(VARCHAR(10),CONVERT(DATETIME,'"+ dtp_start.Value.ToString("yyyy-MM-dd") + " 00:00:00 ',120),120) and CONVERT(VARCHAR(10),CONVERT(DATETIME,a.pat_out_time,120),120)<=CONVERT(VARCHAR(10),CONVERT(DATETIME,'" + dtp_stop.Value.ToString("yyyy-MM-dd") + " 23:59:59',120),120) and a.pat_in_hos_id in(select pat_in_hos_id from report.dbo.lszy_basc_dw) and a.HOSPITAL_ID='" + _hosId + "' "); } else { str_info_s.Append(" WHERE CONVERT(VARCHAR(10),CONVERT(DATETIME,a.pat_out_time,120),120)>=CONVERT(VARCHAR(10),CONVERT(DATETIME,'"+ dtp_start.Value.ToString("yyyy-MM-dd") + " 00:00:00 ',120),120) and CONVERT(VARCHAR(10),CONVERT(DATETIME,a.pat_out_time,120),120)<=CONVERT(VARCHAR(10),CONVERT(DATETIME,'" + dtp_stop.Value.ToString("yyyy-MM-dd") + " 23:59:59',120),120) and a.pat_in_hos_id not in(select pat_in_hos_id from report.dbo.lszy_basc_dw) and a.HOSPITAL_ID='" + _hosId + "' "); } //str_info_s.Append(" WHERE CONVERT(VARCHAR(10),CONVERT(DATETIME,k.CHECK_DATE,120),120)>=CONVERT(VARCHAR(10),'" + dtp_start.Value + "',120) and CONVERT(VARCHAR(10),CONVERT(DATETIME,k.CHECK_DATE,120),120)<=CONVERT(VARCHAR(10),'" + dtp_stop.Value + "',120) and a.pat_in_hos_id not in(select pat_in_hos_id from report.dbo.lszy_basc_dw) "); if (txt_zyh.Text != "") { str_info_s.Append(" AND A.MEDICAL_RECORD_CODE='" + txt_zyh.Text.Trim() + "'"); } else { } string str_info = str_info_s.ToString(); DataSet ds = SSS.ExecSqlReDs(str_info); if (ds.Tables[0].Rows.Count > 0) { return(ds.Tables[0]); } else { return(ds.Tables[0]); } }