为什么此字符串:javax.sql.rowset.serial.SerialClob 包含在输出文件中而不是实际值中
Why is this string: javax.sql.rowset.serial.SerialClob being included in an output file instead of the actual value
我正在使用 Mirth 3.1.0.x,从 Sql Server 2012 数据库中提取数据并将结果集写入平面文件。
代码在添加新列之前有效。
这是 Mirth Channel 目的地的转换器脚本中的代码:
var dbConn = DatabaseConnectionFactory.createDatabaseConnection('net.sourceforge.jtds.jdbc.Driver','jdbc:jtds:sqlserver://10.10.1.74:1433/rRIS_California','rRIS_California','rRIS_California');
var result1 = dbConn.executeCachedQuery("exec [z_SelectChannelData] 'AAI'");
while(result1.next())
{
tmp.row += <row>
<LastName>"{result1.getString('LastName')}"</LastName>
<FirstName>"{result1.getString('FirstName')}"</FirstName>
<HomePhone>"{result1.getString('HomePhone')}"</HomePhone>
<MRN>"{result1.getString('MRN')}"</MRN>
<EncounterID>"{result1.getString('EncounterID')}"</EncounterID>
<Accession>"{result1.getString('Accession')}"</Accession>
<Modality>"{result1.getString('Modality')}"</Modality>
<Procedure>"{result1.getString('ProcedureCode')}"</Procedure>
<Location>"{result1.getString('Location')}"</Location>
<PreferredLanguage>"{result1.getString('PreferredLanguage')}"</PreferredLanguage>
<Gender>"{result1.getString('Gender')}"</Gender>
<EmailAddress>"{result1.getString('EmailAddress')}"</EmailAddress>
<MobilePhoneNumber>"{result1.getString('MobilePhoneNumber')}"</MobilePhoneNumber>
<Room>"{result1.getString('Room')}"</Room>
<billing_code>"{result1.getString('billing_code')}"</billing_code>
<copay>"{result1.getString('copay')}"</copay>
</row>;
}
dbConn.close();
在输出文件中,最后一列未填充实际值,而是填充以下字符串:
"copay"
"javax.sql.rowset.serial.SerialClob@1b795929"
"javax.sql.rowset.serial.SerialClob@5693cfb7"
下面是最后一列的T-SQL:
Select
CASE WHEN v.copay is null THEN '' WHEN v.copay =0 THEN '' ELSE cast(v.copay as varchar(max)) END as copay
FROM <table> as v
你可以尝试这样的事情。
var clob = result1.getClob("copay");
var result = clob.getSubString(1,clob.length());
然后将结果放入共付额标签中。
将转换从 varchar(max) 更改为 varchar(20),实际列值显示在下面的 sql 中。感谢 Evan Knowles 和 kucing_terbang 找到了答案。
SELECT
CASE WHEN v.copay is null THEN '' WHEN v.copay =0 THEN '' ELSE cast(v.copay as varchar(20)) END as copay
FROM <table> v
我正在使用 Mirth 3.1.0.x,从 Sql Server 2012 数据库中提取数据并将结果集写入平面文件。
代码在添加新列之前有效。
这是 Mirth Channel 目的地的转换器脚本中的代码:
var dbConn = DatabaseConnectionFactory.createDatabaseConnection('net.sourceforge.jtds.jdbc.Driver','jdbc:jtds:sqlserver://10.10.1.74:1433/rRIS_California','rRIS_California','rRIS_California');
var result1 = dbConn.executeCachedQuery("exec [z_SelectChannelData] 'AAI'");
while(result1.next())
{
tmp.row += <row>
<LastName>"{result1.getString('LastName')}"</LastName>
<FirstName>"{result1.getString('FirstName')}"</FirstName>
<HomePhone>"{result1.getString('HomePhone')}"</HomePhone>
<MRN>"{result1.getString('MRN')}"</MRN>
<EncounterID>"{result1.getString('EncounterID')}"</EncounterID>
<Accession>"{result1.getString('Accession')}"</Accession>
<Modality>"{result1.getString('Modality')}"</Modality>
<Procedure>"{result1.getString('ProcedureCode')}"</Procedure>
<Location>"{result1.getString('Location')}"</Location>
<PreferredLanguage>"{result1.getString('PreferredLanguage')}"</PreferredLanguage>
<Gender>"{result1.getString('Gender')}"</Gender>
<EmailAddress>"{result1.getString('EmailAddress')}"</EmailAddress>
<MobilePhoneNumber>"{result1.getString('MobilePhoneNumber')}"</MobilePhoneNumber>
<Room>"{result1.getString('Room')}"</Room>
<billing_code>"{result1.getString('billing_code')}"</billing_code>
<copay>"{result1.getString('copay')}"</copay>
</row>;
}
dbConn.close();
在输出文件中,最后一列未填充实际值,而是填充以下字符串:
"copay"
"javax.sql.rowset.serial.SerialClob@1b795929"
"javax.sql.rowset.serial.SerialClob@5693cfb7"
下面是最后一列的T-SQL:
Select
CASE WHEN v.copay is null THEN '' WHEN v.copay =0 THEN '' ELSE cast(v.copay as varchar(max)) END as copay
FROM <table> as v
你可以尝试这样的事情。
var clob = result1.getClob("copay");
var result = clob.getSubString(1,clob.length());
然后将结果放入共付额标签中。
将转换从 varchar(max) 更改为 varchar(20),实际列值显示在下面的 sql 中。感谢 Evan Knowles 和 kucing_terbang 找到了答案。
SELECT
CASE WHEN v.copay is null THEN '' WHEN v.copay =0 THEN '' ELSE cast(v.copay as varchar(20)) END as copay
FROM <table> v