我想使用smooks库将NCPDP D.0事务解析为XML。
我是不熟悉smooks库的人,在尝试使用smooks配置固定长度和动态长度字段时遇到问题。
样本NCPDP D.0
抽烟配置文件
<?xml version="1.1" encoding="UTF-8"?>
<smooks-resource-list
xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
xmlns:edi="http://www.milyn.org/xsd/smooks/edi-1.4.xsd">
<edi:reader mappingModel="ncpdp-to-xml-order-mapping.xml"/>
</smooks-resource-list>
ncpdp-to-xml-order-mapping.xml
<?xml version="1.1" encoding="UTF-8"?>
<medi:edimap xmlns:medi="http://www.milyn.org/schema/edi-message-mapping-1.2.xsd">
<medi:description name="Parse NCPDP to XML" version="1.0" />
<medi:delimiters segment="0x1E" field="0x1C" component="0x1D"
sub-component="~" />
<medi:segments xmltag="Segments">
<medi:segment segcode="00" xmltag="Header" truncatable="true">
<medi:field xmltag="Bin"/>
<medi:field xmltag="Version" />
<medi:field xmltag="TransactionCode" />
<medi:field xmltag="ProcessControlNumber" />
<medi:field xmltag="ServiceProviderIdQualifier" />
<medi:field xmltag="ServiceProviderId" />
<medi:field xmltag="DateOfService" />
<medi:field xmltag="Software" />
</medi:segment>
<medi:segment segcode="01" xmltag="PatientInformation" truncatable="true">
<medi:field xmltag="FirstName"/>
<medi:field xmltag="LastName" />
<medi:field xmltag="StreetAddress" />
<medi:field xmltag="City" />
<medi:field xmltag="State" />
<medi:field xmltag="Zipcode" />
<medi:field xmltag="PhoneNumber" />
</medi:segment>
<medi:segment segcode="07" xmltag="ClaimInformation" truncatable="true">
<medi:field xmltag="PrescriptionReferenceNumberQualifier"/>
<medi:field xmltag="PrescriptionReferenceNumber"/>
<medi:field xmltag="ProductServiceIdQualifier"/>
<medi:field xmltag="ProductServiceId"/>
<medi:field xmltag="QuantityDispensed"/>
<medi:field xmltag="FillNumber"/>
<medi:field xmltag="DaySupply"/>
<medi:field xmltag="CompoundCode"/>
<medi:field xmltag="DispenseAsWrittenProductSelectionCode"/>
<medi:field xmltag="DatePrescriptionWritten"/>
<medi:field xmltag="NumberOfRefillsAuthorized"/>
<medi:field xmltag="PrescriptionOriginCode"/>
<medi:field xmltag="UnitOfMeasure"/>
<medi:field xmltag="LevelOfService"/>
<medi:field xmltag="PatientAssignmentIndicator"/>
<medi:field xmltag="PharmacyServiceType"/>
</medi:segment>
<medi:segment segcode="11" xmltag="PricingInformation" truncatable="true">
<medi:field xmltag="IngredientCostSubmitted"/>
<medi:field xmltag="DispensingFeeSubmitted"/>
<medi:field xmltag="PatientPaidAmountSubmitted"/>
<medi:field xmltag="PercentageSalesTaxRateSubmitted"/>
<medi:field xmltag="UsualAndCustomaryCharge"/>
<medi:field xmltag="GrossAmountDue"/>
<medi:field xmltag="BasisOfCostDetermination"/>
</medi:segment>
</medi:segments>
</medi:edimap>
Smooks库应该能够解析NCPDP D.0声明并将其转换为XML。
ncpdp-to-xml-order-mapping.xml中的标头部分是固定长度的,不确定如何配置欺骗以解析固定长度的标头。
这是固定长度行的字典。 https://snag.gy/IgbxpW.jpg
感谢您的帮助。