Changeset 995 for ccr2ccd-xslt


Ignore:
Timestamp:
Oct 28, 2010, 10:09:32 PM (13 years ago)
Author:
George Lilly
Message:

updates

Location:
ccr2ccd-xslt/trunk/make
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • ccr2ccd-xslt/trunk/make/M1-Nancy-qrda-header.xsl

    r994 r995  
    7171       
    7272       
    73         <!--Script replaces UUID each time-->
     73        <!--Script replaces UUID each time if the version number is 1-->
    7474        <id root="2.16.840.1.113883.3.543" extension="@@@UUID-DOC@@@"/>
    7575
    76                 <xsl:attribute name="root">
     76             <!--   <xsl:attribute name="root">
    7777                    <xsl:value-of select="/a:ContinuityOfCareRecord/a:CCRDocumentObjectID"></xsl:value-of>
    7878                </xsl:attribute>
    79             </id>
     79            </id>-->
    8080                 <!--WVP next two lines fixed-->
    8181        <code code="55182-0" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Quality Measure Report"/>
     
    260260              <templateId root="2.16.840.1.113883.3.249.11.10" />
    261261              <templateId root="2.16.840.1.113883.3.249.11.11" />
    262               <templateId root="eRx/2.16.840.1.113883.3.249.11.15" />
     262              <templateId root="eRx/2.16.840.1.113883.3.249.11.15" />-->
    263263             <!--New for 2011-->
    264264             <!-- <templateId root="2.16.840.1.113883.3.249.11.51" />
     
    390390                  <statusCode code="completed"/>
    391391                </act>
    392                 </entry>
     392                </entry>-->
    393393               
    394394 <!--******************************************
  • ccr2ccd-xslt/trunk/make/M1-ccr_qrda.xsl

    r994 r995  
    7171       
    7272       
    73         <!--Script replaces UUID each time-->
     73        <!--Script replaces UUID each time if the version number is 1-->
    7474        <id root="2.16.840.1.113883.3.543" extension="@@@UUID-DOC@@@"/>
    7575
    76                 <xsl:attribute name="root">
     76             <!--   <xsl:attribute name="root">
    7777                    <xsl:value-of select="/a:ContinuityOfCareRecord/a:CCRDocumentObjectID"></xsl:value-of>
    7878                </xsl:attribute>
    79             </id>
     79            </id>-->
    8080                 <!--WVP next two lines fixed-->
    8181        <code code="55182-0" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Quality Measure Report"/>
     
    260260              <templateId root="2.16.840.1.113883.3.249.11.10" />
    261261              <templateId root="2.16.840.1.113883.3.249.11.11" />
    262               <templateId root="eRx/2.16.840.1.113883.3.249.11.15" />
     262              <templateId root="eRx/2.16.840.1.113883.3.249.11.15" />-->
    263263             <!--New for 2011-->
    264264             <!-- <templateId root="2.16.840.1.113883.3.249.11.51" />
     
    390390                  <statusCode code="completed"/>
    391391                </act>
    392                 </entry>
     392                </entry>-->
    393393               
    394394 <!--******************************************
     
    679679<title>Payers</title>
    680680<text>
    681 </text
     681</text>
    682682<!--medicare-->
    683683<entry typeCode="DRIV">
     
    750750</ClinicalDocument>
    751751    </xsl:template>
     752    <xsl:template name="ccdAssignedEntity">
     753        <xsl:param name="ccrActorObjectID"/>
     754
     755        <xsl:variable name="CCRActor" select="/a:ContinuityOfCareRecord/a:Actors/a:Actor[a:ActorObjectID=$ccrActorObjectID]"/>
     756
     757        <assignedEntity>
     758            <xsl:call-template name="ccdEntityID">
     759                <xsl:with-param name="CCRActor" select="$CCRActor"/>
     760            </xsl:call-template>
     761
     762            <xsl:call-template name="ccdAddress">
     763                <xsl:with-param name="CCRActorAddress" select="$CCRActor/a:Address"/>
     764            </xsl:call-template>
     765
     766            <xsl:call-template name="ccdTelecom">
     767                <xsl:with-param name="CCRActor" select="$CCRActor"/>
     768            </xsl:call-template>
     769
     770            <xsl:if test="$CCRActor/a:Person">
     771                <xsl:call-template name="ccdPerson">
     772                    <xsl:with-param name="CCRActorPerson" select="$CCRActor/a:Person"/>
     773                    <xsl:with-param name="personNodeName" select="'assignedPerson'"/>
     774                </xsl:call-template>
     775            </xsl:if>
     776
     777            <xsl:if test="$CCRActor/a:InternalCCRLink[a:LinkRelationship='Organization']">
     778                <xsl:call-template name="ccdOrganization">
     779                    <xsl:with-param name="ccrActorObjectID" select="$CCRActor/a:InternalCCRLink[a:LinkRelationship='Organization']/a:LinkID"/>
     780                    <xsl:with-param name="organizationNodeName" select="'representedOrganization'"/>
     781                </xsl:call-template>
     782            </xsl:if>
     783
     784        </assignedEntity>
     785    </xsl:template>
     786
     787    <xsl:template name="ccdPatient">
     788        <xsl:param name="CCRActorPerson"/>
     789        <patient>
     790            <xsl:call-template name="ccdPersonName">
     791                <xsl:with-param name="CCRActorName" select="$CCRActorPerson/a:Name"/>
     792            </xsl:call-template>
     793
     794            <xsl:if test="$CCRActorPerson/a:Gender">
     795                <xsl:call-template name="ccdCodedValue">
     796                    <xsl:with-param name="ccrCodedDescription" select="$CCRActorPerson/a:Gender"/>
     797                    <xsl:with-param name="domain" select="'AdministrativeGender'"/>
     798                    <xsl:with-param name="nodeName" select="'administrativeGenderCode'"/>
     799                </xsl:call-template>
     800            </xsl:if>
     801
     802            <xsl:if test="$CCRActorPerson/a:DateOfBirth">
     803                <birthTime>
     804                    <xsl:attribute name="value">
     805                        <xsl:call-template name="date:format-date">
     806                            <xsl:with-param name="date-time" select="$CCRActorPerson/a:DateOfBirth/a:ExactDateTime"/>
     807                            <xsl:with-param name="pattern">yyyyMMddhhmmss</xsl:with-param>
     808                        </xsl:call-template>
     809                    </xsl:attribute>
     810                </birthTime>
     811            </xsl:if>
     812
     813            <xsl:if test="/a:ContinuityOfCareRecord/a:Body/a:SocialHistory/a:SocialHistoryElement[a:Type/a:Text='Marital Status']">
     814                <xsl:call-template name="ccdCodedValue">
     815                    <xsl:with-param name="ccrCodedDescription" select="/a:ContinuityOfCareRecord/a:Body/a:SocialHistory/a:SocialHistoryElement[a:Type/a:Text='Marital Status']/a:Description"/>
     816                    <xsl:with-param name="domain" select="'MaritalStatus'"/>
     817                    <xsl:with-param name="nodeName" select="'maritalStatusCode'"/>
     818                </xsl:call-template>
     819            </xsl:if>
     820
     821            <xsl:if test="/a:ContinuityOfCareRecord/a:Body/a:SocialHistory/a:SocialHistoryElement[a:Type/a:Text='Language']">
     822                <languageCommunication>
     823                    <templateId root="2.16.840.1.113883.3.88.11.83.2" assigningAuthorityName="HITSP/C83"/>
     824                    <templateId root="1.3.6.1.4.1.19376.1.5.3.1.2.1" assigningAuthorityName="IHE/PCC"/>
     825                    <xsl:call-template name="ccdCodedValue">
     826                        <xsl:with-param name="ccrCodedDescription" select="/a:ContinuityOfCareRecord/a:Body/a:SocialHistory/a:SocialHistoryElement[a:Type/a:Text='Language']/a:Description"></xsl:with-param>
     827                        <xsl:with-param name="domain" select="'HumanLanguage'"/>
     828                        <xsl:with-param name="nodeName" select="'languageCode'"/>
     829                    </xsl:call-template>
     830                </languageCommunication>
     831            </xsl:if>
     832        </patient>
     833    </xsl:template>
     834
     835    <xsl:template name="ccdPerformer">
     836        <xsl:param name="ccrActorReference"/>
     837        <performer typeCode="PRF">
     838            <xsl:if test="$ccrActorReference/a:ActorRole">
     839                <xsl:call-template name="ccdCodedValue">
     840                    <xsl:with-param name="ccrCodedDescription" select="$ccrActorReference/a:ActorRole"/>
     841                    <xsl:with-param name="nodeName" select="'functionCode'"/>
     842                </xsl:call-template>
     843            </xsl:if>
     844            <xsl:call-template name="ccdAssignedEntity">
     845                <xsl:with-param name="ccrActorObjectID" select="$ccrActorReference/a:ActorID"/>
     846            </xsl:call-template>
     847        </performer>
     848    </xsl:template>
     849
     850    <xsl:template name="ccdPerson">
     851        <xsl:param name="CCRActorPerson"/>
     852        <xsl:param name="personNodeName">assignedPerson</xsl:param>
     853        <xsl:element name="{$personNodeName}">
     854            <xsl:call-template name="ccdPersonName">
     855                <xsl:with-param name="CCRActorName" select="$CCRActorPerson/a:Name"/>
     856            </xsl:call-template>
     857        </xsl:element>
     858    </xsl:template>
     859
     860    <xsl:template name="ccdPersonName">
     861        <xsl:param name="CCRActorName"/>
     862        <name>
     863            <xsl:if test="$CCRActorName/a:CurrentName/a:Title">
     864                <prefix>
     865                    <xsl:value-of select="$CCRActorName/a:CurrentName/a:Title"/>
     866                </prefix>
     867            </xsl:if>
     868            <xsl:if test="$CCRActorName/a:CurrentName/a:Given">
     869                <given>
     870                    <xsl:value-of select="$CCRActorName/a:CurrentName/a:Given"/>
     871                </given>
     872            </xsl:if>
     873            <xsl:if test="$CCRActorName/a:CurrentName/a:Middle">
     874                <given>
     875                    <xsl:value-of select="$CCRActorName/a:CurrentName/a:Middle"/>
     876                </given>
     877            </xsl:if>
     878            <xsl:if test="$CCRActorName/a:CurrentName/a:Family">
     879                <family>
     880                    <xsl:value-of select="$CCRActorName/a:CurrentName/a:Family"/>
     881                </family>
     882            </xsl:if>
     883            <xsl:if test="$CCRActorName/a:CurrentName/a:Suffix">
     884                <suffix>
     885                    <xsl:value-of select="$CCRActorName/a:CurrentName/a:Suffix"/>
     886                </suffix>
     887            </xsl:if>
     888        </name>
     889    </xsl:template>
     890
     891    <xsl:template name="ccdOrganization">
     892        <xsl:param name="ccrActorObjectID"/>
     893        <xsl:param name="organizationNodeName"/>
     894
     895        <xsl:variable name="CCRActor" select="/a:ContinuityOfCareRecord/a:Actors/a:Actor[a:ActorObjectID=$ccrActorObjectID]"/>
     896
     897        <xsl:element name="{$organizationNodeName}">
     898            <xsl:call-template name="ccdEntityID">
     899                <xsl:with-param name="CCRActor" select="$CCRActor"/>
     900            </xsl:call-template>
     901            <xsl:call-template name="ccdTelecom">
     902                <xsl:with-param name="CCRActor" select="$CCRActor"/>
     903            </xsl:call-template>
     904
     905            <xsl:call-template name="ccdAddress">
     906                <xsl:with-param name="CCRActorAddress" select="$CCRActor/a:Address[1]"/>
     907            </xsl:call-template>
     908        </xsl:element>
     909    </xsl:template>
     910
     911    <xsl:template name="ccdPatientRole">
     912        <xsl:param name="ccrActorObjectID"/>
     913
     914        <xsl:variable name="CCRActor" select="/a:ContinuityOfCareRecord/a:Actors/a:Actor[a:ActorObjectID=$ccrActorObjectID]"/>
     915
     916        <xsl:call-template name="ccdEntityID">
     917            <xsl:with-param name="CCRActor" select="$CCRActor"/>
     918        </xsl:call-template>
     919
     920        <xsl:call-template name="ccdAddress">
     921            <xsl:with-param name="CCRActorAddress" select="$CCRActor/a:Address[1]"/>
     922        </xsl:call-template>
     923
     924        <xsl:call-template name="ccdTelecom">
     925            <xsl:with-param name="CCRActor" select="$CCRActor"/>
     926        </xsl:call-template>
     927
     928        <xsl:call-template name="ccdPatient">
     929            <xsl:with-param name="CCRActorPerson" select="$CCRActor/a:Person"/>
     930        </xsl:call-template>
     931    </xsl:template>
     932
     933    <xsl:template name="ccdAssignedAuthor">
     934        <xsl:param name="ccrActorObjectID"/>
     935                <assignedAuthor>
     936        <xsl:variable name="CCRActor" select="/a:ContinuityOfCareRecord/a:Actors/a:Actor[a:ActorObjectID=$ccrActorObjectID]"/>
     937
     938        <xsl:call-template name="ccdEntityID">
     939            <xsl:with-param name="CCRActor" select="$CCRActor"/>
     940        </xsl:call-template>
     941
     942        <xsl:call-template name="ccdAddress">
     943            <xsl:with-param name="CCRActorAddress" select="$CCRActor/a:Address[1]"/>
     944        </xsl:call-template>
     945
     946        <xsl:call-template name="ccdTelecom">
     947            <xsl:with-param name="CCRActor" select="$CCRActor"/>
     948        </xsl:call-template>
     949
     950        <xsl:call-template name="ccdPerson">
     951            <xsl:with-param name="CCRActorPerson" select="$CCRActor/a:Person"/>
     952        </xsl:call-template>
     953
     954        <xsl:if test="$CCRActor/a:InternalCCRLink[a:LinkRelationship='Organization']">
     955            <representedOrganization>
     956                <xsl:call-template name="ccdOrganization">
     957                    <xsl:with-param name="ccrActorObjectID" select="$CCRActor/a:InternalCCRLink[a:LinkRelationship='Organization']/a:LinkID"/>
     958                </xsl:call-template>
     959            </representedOrganization>
     960        </xsl:if>
     961        </assignedAuthor>
     962    </xsl:template>
     963
     964    <xsl:template name="ccdParticipantRoleActor">
     965        <xsl:param name="ccrActorObjectID"/>
     966
     967        <xsl:variable name="CCRActor" select="/a:ContinuityOfCareRecord/a:Actors/a:Actor[a:ActorObjectID=$ccrActorObjectID]"/>
     968
     969        <xsl:call-template name="ccdEntityID">
     970            <xsl:with-param name="CCRActor" select="$CCRActor"/>
     971        </xsl:call-template>
     972
     973        <xsl:call-template name="ccdAddress">
     974            <xsl:with-param name="CCRActorAddress" select="$CCRActor/a:Address[1]"/>
     975        </xsl:call-template>
     976
     977        <xsl:call-template name="ccdTelecom">
     978            <xsl:with-param name="CCRActor" select="$CCRActor"/>
     979        </xsl:call-template>
     980
     981        <xsl:if test="$CCRActor/a:Organization/a:Name">
     982            <playingEntity classCode="PLC">
     983                <name>
     984                    <xsl:value-of select="$CCRActor/a:Organization/a:Name"/>
     985                </name>
     986            </playingEntity>
     987        </xsl:if>
     988    </xsl:template>
     989
     990    <xsl:template name="ccdParticipantRoleCodedDescription">
     991        <xsl:param name="ccrCodedDescription"/>
     992        <participantRole classCode="MANU">
     993           <!--Product Detail-->
     994           <playingEntity classCode="MMAT">
     995                                <xsl:if test="$ccrCodedDescription/a:Code">
     996                                        <xsl:call-template name="ccdCodedValue">
     997                                                <xsl:with-param name="ccrCodedDescription" select="$ccrCodedDescription"/>
     998                                                <xsl:with-param name="nodeName" select="'code'"/>
     999                                        </xsl:call-template>
     1000                                </xsl:if>
     1001                                <name>
     1002                                        <xsl:value-of select="$ccrCodedDescription/a:Text"/>
     1003                                </name>
     1004                        </playingEntity>
     1005                </participantRole>
     1006    </xsl:template>
     1007
     1008    <xsl:template name="ccdEntityID">
     1009        <xsl:param name="CCRActor"/>
     1010        <id>
     1011            <xsl:choose>
     1012                <xsl:when test="$CCRActor/a:IDs">
     1013                    <xsl:attribute name="extension">
     1014                        <xsl:value-of select="$CCRActor/a:IDs[1]/a:ID"/>
     1015                    </xsl:attribute>
     1016                    <xsl:attribute name="root">
     1017                        <xsl:value-of select="$CCRActor/a:IDs[1]/a:Type/a:Text"/>
     1018                    </xsl:attribute>
     1019                </xsl:when>
     1020                <xsl:otherwise>
     1021                    <xsl:attribute name="extension">
     1022                        <xsl:value-of select="$CCRActor/a:ActorObjectID"/>
     1023                    </xsl:attribute>
     1024                    <xsl:attribute name="root">
     1025                        <xsl:text>CCRActorID</xsl:text>
     1026                    </xsl:attribute>
     1027                </xsl:otherwise>
     1028            </xsl:choose>
     1029        </id>
     1030         <xsl:if test="$CCRActor/a:Organization">
     1031            <name><xsl:value-of select="$CCRActor/a:Organization/a:Name"></xsl:value-of></name>
     1032        </xsl:if>
     1033    </xsl:template>             
     1034    <xsl:template name="ccdAddress">
     1035        <xsl:param name="CCRActorAddress"/>
     1036        <addr>
     1037            <xsl:choose>
     1038                <xsl:when test="$CCRActorAddress">
     1039                    <xsl:attribute name="use">
     1040                        <xsl:call-template name="CDAVocabularyLookup">
     1041                            <xsl:with-param name="domain" select="'telecommunicationsAddressUse'"/>
     1042                            <xsl:with-param name="ccrtext" select="$CCRActorAddress/a:Type/a:Text"/>
     1043                        </xsl:call-template>
     1044                    </xsl:attribute>
     1045                    <streetAddressLine>
     1046                        <xsl:value-of select="$CCRActorAddress/a:Line1"/>
     1047                    </streetAddressLine>
     1048                    <city>
     1049                        <xsl:value-of select="$CCRActorAddress/a:City"/>
     1050                    </city>
     1051                    <state>
     1052                        <xsl:value-of select="$CCRActorAddress/a:State"/>
     1053                    </state>
     1054                    <postalCode>
     1055                        <xsl:value-of select="$CCRActorAddress/a:PostalCode"/>
     1056                    </postalCode>
     1057                </xsl:when>
     1058                <xsl:otherwise>
     1059                    <streetAddressLine/>
     1060                </xsl:otherwise>
     1061            </xsl:choose>
     1062        </addr>
     1063    </xsl:template>
     1064   
     1065    <xsl:template name="ccdTelecom">
     1066        <xsl:param name="CCRActor"/>
     1067        <telecom>
     1068            <xsl:if test="$CCRActor/a:Telephone">
     1069                <xsl:attribute name="use">
     1070                    <xsl:call-template name="CDAVocabularyLookup">
     1071                        <xsl:with-param name="domain" select="'telecommunicationsAddressUse'"/>
     1072                        <xsl:with-param name="ccrtext" select="$CCRActor/a:Telephone/a:Type/a:Text"/>
     1073                    </xsl:call-template>
     1074                </xsl:attribute>
     1075                <xsl:attribute name="value">
     1076                    <xsl:text>tel:+1-</xsl:text>
     1077                    <xsl:value-of select="$CCRActor/a:Telephone[1]/a:Value"/>
     1078                </xsl:attribute>
     1079            </xsl:if>
     1080        </telecom>
     1081
     1082        <xsl:if test="$CCRActor/a:Email">
     1083            <telecom>
     1084                <xsl:choose>
     1085                    <xsl:when test="$CCRActor/a:Telephone">
     1086                        <xsl:attribute name="use">
     1087                            <xsl:call-template name="CDAVocabularyLookup">
     1088                                <xsl:with-param name="domain" select="'telecommunicationsAddressUse'"/>
     1089                                <xsl:with-param name="ccrtext" select="$CCRActor/a:Telephone/a:Type/a:Text"/>
     1090                            </xsl:call-template>
     1091                        </xsl:attribute>
     1092                        <xsl:attribute name="value">
     1093                            <xsl:text>mailto:</xsl:text>
     1094                            <xsl:value-of select="$CCRActor/a:Email[1]/a:Value"/>
     1095                        </xsl:attribute>
     1096                    </xsl:when>
     1097                    <xsl:otherwise>
     1098                        <xsl:attribute name="value">
     1099                            <xsl:text>Unknown</xsl:text>
     1100                        </xsl:attribute>
     1101                    </xsl:otherwise>
     1102                </xsl:choose>
     1103            </telecom>
     1104        </xsl:if>
     1105    </xsl:template>
     1106
     1107    <xsl:template name="ccdID">
     1108        <xsl:param name="ccrObjectID"/>
     1109        <xsl:param name="suffix"/>
     1110        <id>
     1111            <xsl:attribute name="root">
     1112                <xsl:value-of select="$ccrObjectID"></xsl:value-of>
     1113            </xsl:attribute>
     1114            <xsl:attribute name="extension">CCRObjectID</xsl:attribute>
     1115        </id>
     1116    </xsl:template>
     1117
     1118    <xsl:template name="ccdCodedValue">
     1119        <xsl:param name="ccrCodedDescription"/>
     1120        <xsl:param name="type"/>
     1121        <xsl:param name="domain"/>
     1122        <xsl:param name="nodeName">value</xsl:param>
     1123        <xsl:param name="originalTextReference"/>
     1124
     1125        <xsl:element name="{$nodeName}">
     1126            <xsl:if test="$type">
     1127                <xsl:attribute name="xsi:type">
     1128                    <xsl:value-of select="$type"/>
     1129                </xsl:attribute>
     1130            </xsl:if>
     1131            <xsl:choose>
     1132                <xsl:when test="$ccrCodedDescription/a:Code">
     1133                    <xsl:attribute name="displayName">
     1134                        <xsl:value-of select="$ccrCodedDescription/a:Text"/>
     1135                    </xsl:attribute>
     1136                    <xsl:attribute name="code">
     1137                        <xsl:value-of select="$ccrCodedDescription/a:Code/a:Value"/>
     1138                    </xsl:attribute>
     1139                    <xsl:attribute name="codeSystemName">
     1140                        <xsl:value-of select="$ccrCodedDescription/a:Code/a:CodingSystem"/>
     1141                    </xsl:attribute>
     1142                    <xsl:attribute name="codeSystem">
     1143                        <xsl:call-template name="HL7OIDLookup">
     1144                            <xsl:with-param name="name" select="$ccrCodedDescription/a:Code/a:CodingSystem"/>
     1145                        </xsl:call-template>
     1146                    </xsl:attribute>
     1147                </xsl:when>
     1148                <xsl:when test="$domain">
     1149                    <xsl:variable name="cdaCode">
     1150                        <xsl:call-template name="CDAVocabularyLookup">
     1151                            <xsl:with-param name="domain" select="$domain"/>
     1152                            <xsl:with-param name="ccrtext" select="$ccrCodedDescription/a:Text"/>
     1153                        </xsl:call-template>
     1154                    </xsl:variable>
     1155                    <xsl:attribute name="displayName">
     1156                        <xsl:call-template name="CDADisplayNameLookup">
     1157                            <xsl:with-param name="domain" select="$domain"/>
     1158                            <xsl:with-param name="cdacode" select="$cdaCode"/>
     1159                        </xsl:call-template>
     1160                    </xsl:attribute>
     1161                    <xsl:attribute name="code">
     1162                        <xsl:value-of select="$cdaCode"></xsl:value-of>
     1163                    </xsl:attribute>
     1164                    <xsl:attribute name="codeSystemName">
     1165                        <xsl:call-template name="CDAVocabularyCodeSystemNameLookup">
     1166                            <xsl:with-param name="domain" select="$domain"/>
     1167                        </xsl:call-template>
     1168                    </xsl:attribute>
     1169                    <xsl:attribute name="codeSystemName">
     1170                        <xsl:call-template name="CDAVocabularyCodeSystemLookup">
     1171                            <xsl:with-param name="domain" select="$domain"/>
     1172                        </xsl:call-template>
     1173                    </xsl:attribute>
     1174                </xsl:when>
     1175                <xsl:otherwise>
     1176                    <originalText>
     1177                        <xsl:value-of select="$ccrCodedDescription/a:Text"/>
     1178                        <xsl:if test="$originalTextReference">
     1179                            <reference>
     1180                                <xsl:attribute name="value">
     1181                                    <xsl:value-of select="$originalTextReference"/>
     1182                                </xsl:attribute>
     1183                            </reference>
     1184                        </xsl:if>
     1185                    </originalText>
     1186                </xsl:otherwise>
     1187            </xsl:choose>
     1188        </xsl:element>
     1189    </xsl:template>
     1190
     1191    <xsl:template name="ccdDateTime">
     1192        <xsl:param name="dt"/>
     1193        <xsl:param name="type"/>
     1194        <xsl:if test="$dt">
     1195            <xsl:if test="$dt[1]/a:ExactDateTime">
     1196                <effectiveTime>
     1197                    <xsl:if test="$type">
     1198                        <xsl:attribute name="xsi:type">
     1199                            <xsl:value-of select="$type"></xsl:value-of>
     1200                        </xsl:attribute>
     1201                    </xsl:if>
     1202                    <low>
     1203                        <xsl:attribute name="value">
     1204                            <xsl:call-template name="date:format-date">
     1205                                <xsl:with-param name="date-time" select="$dt[1]/a:ExactDateTime"/>
     1206                                <xsl:with-param name="pattern">yyyyMMdd</xsl:with-param>
     1207                            </xsl:call-template>
     1208                        </xsl:attribute>
     1209                    </low>
     1210                    <high nullFlavor="UNK"/>
     1211                </effectiveTime>
     1212            </xsl:if>
     1213            <xsl:if test="$dt[1]/a:DateTimeRange">
     1214                <effectiveTime>
     1215                    <low>
     1216                        <xsl:attribute name="value">
     1217                            <xsl:call-template name="date:format-date">
     1218                                <xsl:with-param name="date-time" select="$dt[1]/a:DateTimeRange/a:BeginRange/a:ExactDateTime"/>
     1219                                <xsl:with-param name="pattern">yyyyMMdd</xsl:with-param>
     1220                            </xsl:call-template>
     1221                        </xsl:attribute>
     1222                    </low>
     1223                    <high>
     1224                        <xsl:attribute name="value">
     1225                            <xsl:call-template name="date:format-date">
     1226                                <xsl:with-param name="date-time" select="$dt[1]/a:DateTimeRange/a:EndRange/a:ExactDateTime"/>
     1227                                <xsl:with-param name="pattern">yyyyMMdd</xsl:with-param>
     1228                            </xsl:call-template>
     1229                        </xsl:attribute>
     1230                    </high>
     1231                </effectiveTime>
     1232            </xsl:if>
     1233        </xsl:if>
     1234    </xsl:template>
     1235
     1236    <xsl:template name="ccdMedicationFrequency">
     1237        <xsl:param name="frequency"/>
     1238        <xsl:if test="$frequency">
     1239            <xsl:choose>
     1240                <xsl:when test="$frequency/a:Value='qd'">
     1241                    <effectiveTime xsi:type="PIVL_TS" operator="A">
     1242                        <xsl:attribute name="institutionSpecified">true</xsl:attribute>
     1243                        <period>
     1244                            <xsl:attribute name="value">24</xsl:attribute>
     1245                            <xsl:attribute name="unit">h</xsl:attribute>
     1246                        </period>
     1247                    </effectiveTime>
     1248                </xsl:when>
     1249                <xsl:when test="$frequency/a:Value='bid'">
     1250                    <effectiveTime xsi:type="PIVL_TS" operator="A">
     1251                        <xsl:attribute name="institutionSpecified">true</xsl:attribute>
     1252                        <period>
     1253                            <xsl:attribute name="value">12</xsl:attribute>
     1254                            <xsl:attribute name="unit">h</xsl:attribute>
     1255                        </period>
     1256                    </effectiveTime>
     1257                </xsl:when>
     1258                <xsl:when test="$frequency/a:Value='tid'">
     1259                    <effectiveTime xsi:type="PIVL_TS" operator="A">
     1260                        <xsl:attribute name="institutionSpecified">true</xsl:attribute>
     1261                        <period>
     1262                            <xsl:attribute name="value">8</xsl:attribute>
     1263                            <xsl:attribute name="unit">h</xsl:attribute>
     1264                        </period>
     1265                    </effectiveTime>
     1266                </xsl:when>
     1267                <xsl:when test="$frequency/a:Value='qid'">
     1268                    <effectiveTime xsi:type="PIVL_TS" operator="A">
     1269                        <xsl:attribute name="institutionSpecified">true</xsl:attribute>
     1270                        <period>
     1271                            <xsl:attribute name="value">6</xsl:attribute>
     1272                            <xsl:attribute name="unit">h</xsl:attribute>
     1273                        </period>
     1274                    </effectiveTime>
     1275                </xsl:when>
     1276                <xsl:when test="$frequency/a:Value='qam'">
     1277                    <effectiveTime xsi:type='EIVL' operator='A'>
     1278                        <event code='ACM'/>
     1279                    </effectiveTime>
     1280                </xsl:when>
     1281                <xsl:when test="$frequency/a:Value='qpm'">
     1282                    <effectiveTime xsi:type='EIVL' operator='A'>
     1283                        <event code='PCV'/>
     1284                    </effectiveTime>
     1285                </xsl:when>
     1286            </xsl:choose>
     1287        </xsl:if>
     1288    </xsl:template>
     1289
     1290    <xsl:template name="ccdStatus">
     1291        <xsl:param name="ccrStatus"/>
     1292
     1293        <entryRelationship typeCode="REFR">
     1294            <observation classCode="OBS" moodCode="EVN">
     1295                <templateId root="2.16.840.1.113883.10.20.1.50"/>
     1296                <!-- Problem status observation template -->
     1297                <code code="33999-4" codeSystem="2.16.840.1.113883.6.1" displayName="Status"/>
     1298                <statusCode code="completed"/>
     1299                <xsl:call-template name="ccdCodedValue">
     1300                    <xsl:with-param name="ccrCodedDescription" select="$ccrStatus"/>
     1301                </xsl:call-template>
     1302            </observation>
     1303        </entryRelationship>
     1304    </xsl:template>
     1305
     1306    <xsl:template name="ccdStatusObservation">
     1307        <xsl:param name="status"/>
     1308        <xsl:variable name="statusText" select="$status/a:Text"></xsl:variable>
     1309        <xsl:choose>
     1310            <xsl:when test="$statusText='Active'">
     1311                <xsl:call-template name="ccdStatusElement">
     1312                    <xsl:with-param name="statusCode" select="'55561003'"/>
     1313                    <xsl:with-param name="statusDisplayName" select="$statusText"/>
     1314                </xsl:call-template>
     1315            </xsl:when>
     1316            <xsl:when test="$statusText='Inactive'">
     1317                <xsl:call-template name="ccdStatusElement">
     1318                    <xsl:with-param name="statusCode" select="'73425007'"/>
     1319                    <xsl:with-param name="statusDisplayName" select="$statusText"/>
     1320                </xsl:call-template>
     1321            </xsl:when>
     1322            <xsl:when test="$statusText='Chronic'">
     1323                <xsl:call-template name="ccdStatusElement">
     1324                    <xsl:with-param name="statusCode" select="'90734009'"/>
     1325                    <xsl:with-param name="statusDisplayName" select="$statusText"/>
     1326                </xsl:call-template>
     1327            </xsl:when>
     1328        </xsl:choose>
     1329    </xsl:template>
     1330
     1331    <xsl:template name="ccdStatusProcedure">
     1332        <xsl:param name="status"/>
     1333        <xsl:variable name="statusText" select="$status/a:Text"></xsl:variable>
     1334        <xsl:choose>
     1335            <xsl:when test="$statusText='Completed'">
     1336                <statusCode code="completed"/>
     1337            </xsl:when>
     1338            <xsl:when test="$statusText='Active'">
     1339                <statusCode code="active"/>
     1340            </xsl:when>
     1341            <xsl:when test="$statusText='Aborted'">
     1342                <statusCode code="aborted"/>
     1343            </xsl:when>
     1344            <xsl:when test="$statusText='Cancelled' or $statusText='Canceled'">
     1345                <statusCode code="cancelled"/>
     1346            </xsl:when>
     1347            <xsl:otherwise>
     1348                <statusCode>
     1349                    <xsl:attribute name="code">
     1350                        <xsl:value-of select="$statusText"></xsl:value-of>
     1351                    </xsl:attribute>
     1352                </statusCode>
     1353            </xsl:otherwise>
     1354        </xsl:choose>
     1355    </xsl:template>
     1356
     1357    <xsl:template name="ccdStatusElement">
     1358        <xsl:param name="statusCode"/>
     1359        <xsl:param name="statusDisplayName"/>
     1360        <value>
     1361            <xsl:attribute name="xsi:type">CE</xsl:attribute>
     1362            <xsl:attribute name="code">
     1363                <xsl:value-of select="$statusCode"></xsl:value-of>
     1364            </xsl:attribute>
     1365            <xsl:attribute name="codeSystem">2.16.840.1.113883.6.96</xsl:attribute>
     1366            <xsl:attribute name="displayName">
     1367                <xsl:value-of select="$statusDisplayName"></xsl:value-of>
     1368            </xsl:attribute>
     1369        </value>
     1370    </xsl:template>
     1371
     1372    <xsl:template name="ccdObservation">
     1373        <xsl:param name="ccrTestNode"/>
     1374        <xsl:param name="testDate"/>
     1375
     1376        <component>
     1377            <observation classCode="OBS" moodCode="EVN">
     1378                <templateId root="2.16.840.1.113883.3.88.11.83.15" assigningAuthorityName="HITSP C83"/>
     1379                <templateId root="2.16.840.1.113883.10.20.1.31" assigningAuthorityName="CCD"/>
     1380                <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.13" assigningAuthorityName="IHE PCC"/>
     1381
     1382                <!-- Result observation template -->
     1383
     1384                <xsl:call-template name="ccdID">
     1385                    <xsl:with-param name="ccrObjectID" select="$ccrTestNode/a:CCRDataObjectID"/>
     1386                </xsl:call-template>
     1387
     1388                <!-- <code> -->
     1389                <xsl:call-template name="ccdCodedValue">
     1390                    <xsl:with-param name="ccrCodedDescription" select="$ccrTestNode/a:Description"/>
     1391                    <xsl:with-param name="nodeName" select="'code'"/>
     1392                </xsl:call-template>
     1393
     1394                <text>
     1395                    <reference>
     1396                        <xsl:attribute name="value">
     1397                            <xsl:text>#</xsl:text>
     1398                            <xsl:value-of select="$ccrTestNode/a:CCRDataObjectID"/>
     1399                        </xsl:attribute>
     1400                    </reference>
     1401                </text>
     1402
     1403                <statusCode code="completed"/>
     1404
     1405                <!-- <effectiveTime> -->
     1406                <xsl:choose>
     1407                    <xsl:when test="$ccrTestNode/a:DateTime">
     1408                        <xsl:call-template name="ccdDateTime">
     1409                            <xsl:with-param name="dt" select="$ccrTestNode/a:DateTime"/>
     1410                        </xsl:call-template>
     1411                    </xsl:when>
     1412                    <xsl:otherwise>
     1413                        <xsl:call-template name="ccdDateTime">
     1414                            <xsl:with-param name="dt" select="$testDate"/>
     1415                        </xsl:call-template>
     1416                    </xsl:otherwise>
     1417                </xsl:choose>
     1418
     1419                <xsl:choose>
     1420                    <xsl:when test="$ccrTestNode/a:TestResult[a:Value!='']">
     1421                        <value xsi:type="PQ">
     1422                            <xsl:attribute name="value">
     1423                                <xsl:value-of select="$ccrTestNode/a:TestResult/a:Value"/>
     1424                            </xsl:attribute>
     1425                            <xsl:attribute name="unit">
     1426                                <xsl:value-of select="$ccrTestNode/a:TestResult/a:Units/a:Unit"/>
     1427                            </xsl:attribute>
     1428                        </value>
     1429                    </xsl:when>
     1430                    <xsl:when test="$ccrTestNode/a:TestResult[a:Description/a:Text!='']">
     1431                        <value xsi:type="TX">
     1432                            <xsl:attribute name="value">
     1433                                <xsl:value-of select="$ccrTestNode/a:TestResult/a:Description/a:Text"/>
     1434                            </xsl:attribute>
     1435                        </value>
     1436                    </xsl:when>
     1437                </xsl:choose>
     1438
     1439                <xsl:if test="$ccrTestNode/a:Flag">
     1440                    <xsl:call-template name="ccdCodedValue">
     1441                        <xsl:with-param name="ccrCodedDescription" select="$ccrTestNode/a:Flag"/>
     1442                        <xsl:with-param name="nodeName" select="'interpretationCode'"/>
     1443                        <xsl:with-param name="domain" select="'ObservationInterpretation'"/>
     1444                    </xsl:call-template>
     1445                </xsl:if>
     1446
     1447                <xsl:if test="$ccrTestNode/a:NormalResult">
     1448                    <referenceRange>
     1449                        <xsl:if test="$ccrTestNode/a:NormalResult/a:Normal/a:Description/a:Text">
     1450                            <observationRange>
     1451                                <text>
     1452                                    <xsl:value-of select="$ccrTestNode/a:NormalResult/a:Normal/a:Description/a:Text"/>
     1453                                </text>
     1454                            </observationRange>
     1455                        </xsl:if>
     1456                    </referenceRange>
     1457                </xsl:if>
     1458
     1459            </observation>
     1460        </component>
     1461
     1462    </xsl:template>
     1463</xsl:stylesheet>
  • ccr2ccd-xslt/trunk/make/M1-make-qrda-M1.sh

    r994 r995  
    1717#cat ccd-actors.xsl >> M1-ccr_qrda.xsl
    1818cat qrda-footer.xsl >> M1-ccr_qrda.xsl
    19 #cat ccd-util.xsl >> M1-ccr_qrda.xsl
     19cat ccd-util.xsl >> M1-ccr_qrda.xsl
  • ccr2ccd-xslt/trunk/make/PayersSectionMedicareTemplate.xml

    r994 r995  
    88<title>Payers</title>
    99<text>
    10 </text
     10</text>
    1111<!--medicare-->
    1212<entry typeCode="DRIV">
  • ccr2ccd-xslt/trunk/make/ccd-problems.xsl

    r875 r995  
    8181
    8282                                                    <code code="55607006" displayName="Problem" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED-CT"/>
    83 
     83                                                    <statusCode code="completed"/>
    8484                                                    <text>
    8585                                                        <reference>
     
    9191                                                    </text>
    9292
    93                                                     <statusCode code="completed"/>
    94 
    95                                                     <xsl:call-template name="ccdDateTime">
     93                                                     <xsl:call-template name="ccdDateTime">
    9694                                                        <xsl:with-param name="dt" select="a:DateTime"/>
    9795                                                    </xsl:call-template>
Note: See TracChangeset for help on using the changeset viewer.