public long m_lngDelYBInfo(string strlsh0) { long lngRes = 0; string[] strSqlList = new string[2]; strSqlList[0] = @"delete from zy_zydjb0 where zylsh0 = " + strlsh0; strSqlList[1] = @"delete from zy_yzbjb0 where zylsh0 = " + strlsh0; try { com.digitalwave.iCare.middletier.TSZZYHRPServiceYB.clsTSYBHRPService objYBSvc = new com.digitalwave.iCare.middletier.TSZZYHRPServiceYB.clsTSYBHRPService(); lngRes = objYBSvc.DoExcute(strSqlList); objYBSvc.Dispose(); } catch (Exception objEx) { clsLogText objLogger = new clsLogText(); objLogger.LogError(objEx); } return(lngRes); }
public long m_lngInsertRegister(string p_strlsh0, string p_inpatientid) { long lngRes = -1; DataTable dtResult = new DataTable(); string strSQL = @"select a.registerid_chr, a.inpatientid_chr, a.inpatient_dat, a.areaid_chr, a.bedid_chr, a.inareadate_dat, a.mzdiagnose_vchr, b.homeaddress_vchr, b.birth_dat, b.insuranceid_vchr, b.homephone_vchr, b.lastname_vchr, b.sex_chr, b.idcard_chr, b.operatorid_chr as inhospital_operator, b.govcard_chr, c.code_chr, d.outhospital_dat, d.operatorid_chr as outhospital_operator, d.diagnose_vchr, d.diseasetype_int, e.deptname_vchr, f.lastname_vchr as reg_operator, h.paytypeno_vchr from t_opr_bih_register a, t_opr_bih_registerdetail b, t_bse_bed c, t_opr_bih_leave d, t_bse_deptdesc e, t_bse_employee f, t_bse_patient g, t_bse_patientpaytype h where a.registerid_chr = b.registerid_chr and a.registerid_chr = d.registerid_chr and a.deptid_chr = e.deptid_chr(+) and a.patientid_chr = g.patientid_chr(+) and g.paytypeid_chr = h.paytypeid_chr and a.inpatientid_chr = ? and a.pstatus_int = 2 and b.registerid_chr = c.bihregisterid_chr(+) and b.operatorid_chr = f.empid_chr(+) and d.status_int = 1"; try { com.digitalwave.iCare.middletier.HRPService.clsHRPTableService objSvc = new clsHRPTableService(); IDataParameter[] objDPArr; objSvc.CreateDatabaseParameter(1, out objDPArr); objDPArr[0].Value = p_inpatientid; lngRes = objSvc.lngGetDataTableWithParameters(strSQL, ref dtResult, objDPArr); DataRow drPatientInfo = null; if (lngRes > 0 && dtResult.Rows.Count > 0) { drPatientInfo = dtResult.Rows[0]; } dtResult.Dispose(); objSvc.Dispose(); #region 插入台山旧的His系统 baojian.mo if (drPatientInfo == null) { return(0); } else { com.digitalwave.iCare.middletier.TSZZYHRPServiceYB.clsTSYBHRPService objYBSvc = new com.digitalwave.iCare.middletier.TSZZYHRPServiceYB.clsTSYBHRPService(); //Created by baojian.mo string strSQL1 = @"delete from zy_zydjb0 where zyhao0 = '"; strSQL = @"insert into zy_zydjb0 (zylsh0, zyhao0, brxm00, brxbie, brnl00, brdzhi, brlxdh, sfzhao, zydjrq, zyrqi0, zyfwbm, ksmc00, cwbhao, zyyyin, ysxm00, bzhong, cydjr0, ylbxh1, cyzd00, sffsbh ) values ("; StringBuilder sb = new StringBuilder(); DateTime datTmp; string strTemp = null; sb.Append(p_strlsh0 + ", '"); if (drPatientInfo["inpatientid_chr"].ToString().Length > 9) { strTemp = drPatientInfo["inpatientid_chr"].ToString().Substring(drPatientInfo["inpatientid_chr"].ToString().Length - 9, 9); sb.Append(strTemp + "', '");//截后面9位 } else { strTemp = drPatientInfo["inpatientid_chr"].ToString(); sb.Append(strTemp + "', '"); } //<------------------------ strSQL1 += strTemp + "'"; //------------------------> sb.Append(drPatientInfo["lastname_vchr"].ToString() + "', '"); sb.Append(drPatientInfo["sex_chr"].ToString() + "', "); if (string.IsNullOrEmpty(drPatientInfo["birth_dat"].ToString())) { sb.Append("null, '"); } else { datTmp = DateTime.Parse(drPatientInfo["birth_dat"].ToString()); strTemp = new clsBrithdayToAge().m_strGetAge(datTmp); sb.Append("'" + this.m_strCutString(strTemp) + "', '"); } sb.Append(drPatientInfo["homeaddress_vchr"].ToString() + "', '"); sb.Append(drPatientInfo["homephone_vchr"].ToString() + "', '"); sb.Append(drPatientInfo["idcard_chr"].ToString() + "', "); if (string.IsNullOrEmpty(drPatientInfo["inpatient_dat"].ToString())) { sb.Append("null, "); } else { datTmp = Convert.ToDateTime(drPatientInfo["inpatient_dat"]); strTemp = datTmp.ToString("yyyyMMdd"); sb.Append("'" + strTemp + "', "); } if (string.IsNullOrEmpty(drPatientInfo["inareadate_dat"].ToString())) { sb.Append("null, '"); } else { datTmp = Convert.ToDateTime(drPatientInfo["inareadate_dat"]); strTemp = datTmp.ToString("yyyyMMdd"); sb.Append("'" + strTemp + "', '"); } strTemp = drPatientInfo["areaid_chr"].ToString(); if (strTemp.Length > 6) { strTemp = strTemp.Substring(strTemp.Length - 6, 6); } sb.Append(strTemp + "', '"); sb.Append(drPatientInfo["deptname_vchr"].ToString() + "', '"); sb.Append(drPatientInfo["code_chr"].ToString() + "', '"); sb.Append(drPatientInfo["mzdiagnose_vchr"].ToString() + "', '"); strTemp = m_strCutString(drPatientInfo["reg_operator"].ToString(), 8); sb.Append(strTemp + "', '"); sb.Append(drPatientInfo["diseasetype_int"].ToString() + "', "); //if (string.IsNullOrEmpty(drPatientInfo["outhospital_dat"].ToString())) //{ // sb.Append("null, null, "); //} //else //{ // datTmp = Convert.ToDateTime(drPatientInfo["outhospital_dat"]); // strTemp = datTmp.ToString("yyyyMMdd"); // sb.Append("'" + strTemp + "', '" + strTemp + "', "); //} sb.Append("'" + drPatientInfo["outhospital_operator"].ToString() + "', '"); sb.Append(drPatientInfo["insuranceid_vchr"].ToString() + "', '"); sb.Append(drPatientInfo["diagnose_vchr"].ToString() + "', '"); sb.Append(drPatientInfo["paytypeno_vchr"].ToString() + "'"); strSQL += sb.ToString() + ")"; lngRes = objYBSvc.DoExcute(strSQL1); lngRes = objYBSvc.DoExcute(strSQL); objYBSvc.Dispose(); } #endregion } catch (Exception ex) { com.digitalwave.Utility.clsLogText objText = new clsLogText(); objText.LogError(ex); } return(lngRes); }
public long m_lngInsertRegisterCharge(string p_strlsh0, string p_inpatientid) { long lngRes = 0; DataTable dtResult = new DataTable(); string strSQL = @"select a.patientid_chr, a.registerid_chr, a.orderid_chr, a.chargeitemid_chr, a.chargeitemname_chr, a.unit_vchr, a.unitprice_dec, a.amount_dec, a.operator_chr, a.status_int, a.pstatus_int, a.curareaid_chr, a.chargedoctorid_chr, a.chargedoctor_vchr, b.insuranceid_chr, c.inpatientid_chr, d.executetype_int, d.name_vchr, d.startdate_dat, d.finishdate_dat, d.status_int as orderstatus from t_opr_bih_patientcharge a, t_bse_chargeitem b, t_opr_bih_register c, t_opr_bih_order d where a.chargeitemid_chr = b.itemid_chr(+) and a.registerid_chr = c.registerid_chr(+) and a.orderid_chr = d.orderid_chr(+) and a.status_int = 1 and a.pstatus_int > 0 and a.pstatus_int < 3 and c.inpatientid_chr = ?"; try { com.digitalwave.iCare.middletier.HRPService.clsHRPTableService objSvc = new clsHRPTableService(); IDataParameter[] objDPArr; objSvc.CreateDatabaseParameter(1, out objDPArr); objDPArr[0].Value = p_inpatientid; lngRes = objSvc.lngGetDataTableWithParameters(strSQL, ref dtResult, objDPArr); objSvc.Dispose(); int dtCount = dtResult.Rows.Count; DataRow dr = null; if (dtCount == 0) { return(0); } com.digitalwave.iCare.middletier.TSZZYHRPServiceYB.clsTSYBHRPService objYBSvc = new com.digitalwave.iCare.middletier.TSZZYHRPServiceYB.clsTSYBHRPService(); string[] strSQLArr = new string[dtCount + 1]; string strSQL1 = ""; string strinPatientID = ""; for (int i1 = 0; i1 < dtCount; i1++) { strSQL = @"insert into zy_yzbjb0 (zylsh0, zyhao0, zyfwbm, yzlxbh, xmbhao, xmmc00, xmdjia, xmsl00, csjl00, qssj00, fyqssj, jzsj00, tempid, yzysbh,jsbz00 ) values ("; dr = dtResult.Rows[i1]; StringBuilder sb = new StringBuilder(); DateTime datTmp; string strTemp = null; sb.Append(p_strlsh0 + ", '"); if (dr["inpatientid_chr"].ToString().Length > 9) { strTemp = dr["inpatientid_chr"].ToString().Substring(dr["inpatientid_chr"].ToString().Length - 9, 9); sb.Append(strTemp + "', '"); } else { strTemp = dr["inpatientid_chr"].ToString(); sb.Append(strTemp + "', '"); } strinPatientID = strTemp;//赋给删除语句的条件值 if (dr["curareaid_chr"].ToString().Length > 6) { strTemp = dr["curareaid_chr"].ToString().Substring(dr["curareaid_chr"].ToString().Length - 6, 6); sb.Append(strTemp + "', "); } else { strTemp = dr["curareaid_chr"].ToString(); sb.Append(strTemp + "', "); } sb.Append("1 , '");//我们系统长嘱都是转成临嘱来执行的 if (dr["insuranceid_chr"].ToString().Length > 8) { strTemp = dr["insuranceid_chr"].ToString().Substring(dr["inpatientid_chr"].ToString().Length - 8, 8); sb.Append(strTemp + "', '"); } else { strTemp = dr["insuranceid_chr"].ToString(); sb.Append(strTemp + "', '"); } strTemp = m_strCutString(dr["name_vchr"].ToString(), 24); sb.Append(strTemp + "', "); if (!string.IsNullOrEmpty(dr["unitprice_dec"].ToString())) { sb.Append(dr["unitprice_dec"].ToString() + " ,"); } else { sb.Append("0 ,"); } if (!string.IsNullOrEmpty(dr["amount_dec"].ToString())) { sb.Append(dr["amount_dec"].ToString() + " ,"); } else { sb.Append("0 ,"); } sb.Append("1 ,"); if (string.IsNullOrEmpty(dr["startdate_dat"].ToString())) { sb.Append("to_char(sysdate, 'yyyymmddhh24mi'), "); } else { datTmp = Convert.ToDateTime(dr["startdate_dat"]); strTemp = datTmp.ToString("yyyyMMdd"); sb.Append("'" + strTemp + "', "); } if (string.IsNullOrEmpty(dr["startdate_dat"].ToString())) { sb.Append("null, "); } else { datTmp = Convert.ToDateTime(dr["startdate_dat"]); strTemp = datTmp.ToString("yyyyMMdd"); sb.Append("'" + strTemp + "', "); } if (string.IsNullOrEmpty(dr["finishdate_dat"].ToString())) { sb.Append("null, "); } else { datTmp = Convert.ToDateTime(dr["finishdate_dat"]); strTemp = datTmp.ToString("yyyyMMdd"); sb.Append("'" + strTemp + "', "); } sb.Append("'" + i1.ToString() + "', '"); sb.Append(dr["chargedoctorid_chr"].ToString() + "', "); strTemp = dr["pstatus_int"].ToString(); switch (int.Parse(strTemp)) { case 0: case 1: case 2: strTemp = "0"; break; case 3: case 4: strTemp = "1"; break; default: strTemp = "0"; break; } sb.Append(strTemp); strSQL += sb.ToString() + ")"; if (i1 == 0) { strSQL1 = @"delete from zy_yzbjb0 where zyhao0 = '" + strinPatientID + "'"; strSQLArr[i1] = strSQL1; } strSQLArr[i1 + 1] = strSQL; } lngRes = objYBSvc.DoExcute(strSQLArr); objYBSvc.Dispose(); } catch (Exception ex) { com.digitalwave.Utility.clsLogText objText = new clsLogText(); objText.LogError(ex); } return(lngRes); }