Ignore:
Timestamp:
Oct 26, 2010, 10:10:55 PM (14 years ago)
Author:
George Lilly
Message:

latest qrda work

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ccr2ccd-xslt/trunk/make/ccr_qrda.xsl

    r981 r991  
    27162716    </xsl:template>
    27172717</xsl:stylesheet>
     2718                    <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Procedures">
     2719                        <component>
     2720                            <section>
     2721                                <templateId root="2.16.840.1.113883.10.20.1.12"/>
     2722                                <code code="47519-4" codeSystem="2.16.840.1.113883.6.1"/>
     2723                                <title>Procedures</title>
     2724                                <text>
     2725                                    <table>
     2726                                        <tbody>
     2727                                            <tr>
     2728                                                <th>Type</th>
     2729                                                <th>Date</th>
     2730                                                <th>Code</th>
     2731                                                <th>Description</th>
     2732                                                <th>Location</th>
     2733                                                <th>Substance</th>
     2734                                                <th>Method</th>
     2735                                                <th>Position</th>
     2736                                                <th>Site</th>
     2737                                                <th>Status</th>
     2738                                                <th>Source</th>
     2739                                            </tr>
     2740                                            <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Procedures/a:Procedure">
     2741                                                <tr>
     2742                                                    <xsl:attribute name="id">
     2743                                                        <xsl:value-of select="a:CCRDataObjectID"/>
     2744                                                    </xsl:attribute>
     2745
     2746                                                    <td>
     2747                                                        <xsl:value-of select="a:Type/a:Text"/>
     2748                                                    </td>
     2749                                                    <table>
     2750                                                        <tbody>
     2751                                                            <xsl:apply-templates select="a:DateTime"/>
     2752                                                        </tbody>
     2753                                                    </table>
     2754                                                    <td>
     2755                                                        <xsl:apply-templates select="a:Description/a:Code"/>
     2756                                                    </td>
     2757                                                    <td>
     2758                                                        <xsl:value-of select="a:Description/a:Text"/>
     2759                                                    </td>
     2760                                                    <td>
     2761                                                        <xsl:for-each select="a:Locations/a:Location">
     2762                                                            <xsl:value-of select="a:Description/a:Text"/>
     2763                                                            <xsl:if test="a:Actor">
     2764                                                                (<xsl:call-template name="actorName">
     2765                                                                    <xsl:with-param name="objID" select="a:Actor/a:ActorID"/>
     2766                                                                </xsl:call-template>
     2767                                                                <xsl:if test="a:Actor/a:ActorRole/a:Text">
     2768                                                                    <xsl:text xml:space="preserve"> - </xsl:text><xsl:value-of select="a:ActorRole/a:Text"/>)
     2769                                                                </xsl:if>
     2770                                                            </xsl:if>)
     2771                                                            <xsl:if test="position() != last()">
     2772                                                                <br/>
     2773                                                            </xsl:if>
     2774                                                        </xsl:for-each>
     2775                                                    </td>
     2776                                                    <td>
     2777                                                        <xsl:for-each select="a:Substance">
     2778                                                            <xsl:value-of select="a:Text"/>
     2779                                                        </xsl:for-each>
     2780                                                    </td>
     2781                                                    <td>
     2782                                                        <xsl:value-of select="a:Method/a:Text"/>
     2783                                                    </td>
     2784                                                    <td>
     2785                                                        <xsl:value-of select="a:Position/a:Text"/>
     2786                                                    </td>
     2787                                                    <td>
     2788                                                        <xsl:value-of select="a:Site/a:Text"/>
     2789                                                    </td>
     2790                                                    <td>
     2791                                                        <xsl:value-of select="a:Status/a:Text"/>
     2792                                                    </td>
     2793                                                    <td>
     2794                                                        <xsl:call-template name="actorName">
     2795                                                            <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
     2796                                                        </xsl:call-template>
     2797                                                    </td>
     2798                                                </tr>
     2799                                            </xsl:for-each>
     2800                                        </tbody>
     2801                                    </table>
     2802                                </text>
     2803
     2804                                <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Procedures/a:Procedure">
     2805                                    <entry typeCode="DRIV">
     2806                                        <procedure classCode="PROC" moodCode="EVN">
     2807                                            <templateId root="2.16.840.1.113883.3.88.11.83.17" assigningAuthorityName="HITSP C83"/>
     2808                                            <templateId root="2.16.840.1.113883.10.20.1.29" assigningAuthorityName="CCD"/>
     2809                                            <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.19" assigningAuthorityName="IHE PCC"/>
     2810
     2811                                            <!-- <id> -->
     2812                                            <xsl:call-template name="ccdID">
     2813                                                <xsl:with-param name="ccrObjectID" select="a:CCRDataObjectID"/>
     2814                                            </xsl:call-template>
     2815
     2816                                            <!-- <code> -->
     2817                                            <xsl:call-template name="ccdCodedValue">
     2818                                                <xsl:with-param name="ccrCodedDescription" select="a:Description"/>
     2819                                                <xsl:with-param name="nodeName" select="'code'"/>
     2820                                            </xsl:call-template>
     2821
     2822                                            <text>
     2823                                                <reference>
     2824                                                    <xsl:attribute name="value">
     2825                                                        <xsl:text>#</xsl:text>
     2826                                                        <xsl:value-of select="a:CCRDataObjectID"/>
     2827                                                    </xsl:attribute>
     2828                                                </reference>
     2829                                            </text>
     2830
     2831                                            <xsl:call-template name="ccdStatusProcedure">
     2832                                                <xsl:with-param name="status" select="a:Status"/>
     2833                                            </xsl:call-template>
     2834
     2835                                            <xsl:call-template name="ccdDateTime">
     2836                                                <xsl:with-param name="dt" select="a:DateTime"/>
     2837                                            </xsl:call-template>
     2838
     2839                                            <xsl:if test="a:Method">
     2840                                                <xsl:call-template name="ccdCodedValue">
     2841                                                    <xsl:with-param name="ccrCodedDescription" select="a:Method"/>
     2842                                                    <xsl:with-param name="nodeName" select="'approachSiteCode'"/>
     2843                                                </xsl:call-template>
     2844                                            </xsl:if>
     2845
     2846                                            <xsl:if test="a:Site">
     2847                                                <xsl:call-template name="ccdCodedValue">
     2848                                                    <xsl:with-param name="ccrCodedDescription" select="a:Site"/>
     2849                                                    <xsl:with-param name="nodeName" select="'targetSiteCode'"/>
     2850                                                </xsl:call-template>
     2851                                            </xsl:if>
     2852
     2853                                            <xsl:if test="a:Practitioners/a:Practitioner">
     2854                                                <xsl:call-template name="ccdPerformer">
     2855                                                    <xsl:with-param name="ccrActorReference" select="a:Practitioners/a:Practitioner[1]"/>
     2856                                                </xsl:call-template>
     2857                                            </xsl:if>
     2858                                        </procedure>
     2859                                    </entry>
     2860                                </xsl:for-each>
     2861                            </section>
     2862                        </component>
     2863                    </xsl:if>
     2864                    <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Procedures">
     2865                        <component>
     2866                            <section>
     2867                                <templateId root="2.16.840.1.113883.10.20.1.12"/>
     2868                                <code code="47519-4" codeSystem="2.16.840.1.113883.6.1"/>
     2869                                <title>Procedures</title>
     2870                                <text>
     2871                                    <table>
     2872                                        <tbody>
     2873                                            <tr>
     2874                                                <th>Type</th>
     2875                                                <th>Date</th>
     2876                                                <th>Code</th>
     2877                                                <th>Description</th>
     2878                                                <th>Location</th>
     2879                                                <th>Substance</th>
     2880                                                <th>Method</th>
     2881                                                <th>Position</th>
     2882                                                <th>Site</th>
     2883                                                <th>Status</th>
     2884                                                <th>Source</th>
     2885                                            </tr>
     2886                                            <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Procedures/a:Procedure">
     2887                                                <tr>
     2888                                                    <xsl:attribute name="id">
     2889                                                        <xsl:value-of select="a:CCRDataObjectID"/>
     2890                                                    </xsl:attribute>
     2891
     2892                                                    <td>
     2893                                                        <xsl:value-of select="a:Type/a:Text"/>
     2894                                                    </td>
     2895                                                    <table>
     2896                                                        <tbody>
     2897                                                            <xsl:apply-templates select="a:DateTime"/>
     2898                                                        </tbody>
     2899                                                    </table>
     2900                                                    <td>
     2901                                                        <xsl:apply-templates select="a:Description/a:Code"/>
     2902                                                    </td>
     2903                                                    <td>
     2904                                                        <xsl:value-of select="a:Description/a:Text"/>
     2905                                                    </td>
     2906                                                    <td>
     2907                                                        <xsl:for-each select="a:Locations/a:Location">
     2908                                                            <xsl:value-of select="a:Description/a:Text"/>
     2909                                                            <xsl:if test="a:Actor">
     2910                                                                (<xsl:call-template name="actorName">
     2911                                                                    <xsl:with-param name="objID" select="a:Actor/a:ActorID"/>
     2912                                                                </xsl:call-template>
     2913                                                                <xsl:if test="a:Actor/a:ActorRole/a:Text">
     2914                                                                    <xsl:text xml:space="preserve"> - </xsl:text><xsl:value-of select="a:ActorRole/a:Text"/>)
     2915                                                                </xsl:if>
     2916                                                            </xsl:if>)
     2917                                                            <xsl:if test="position() != last()">
     2918                                                                <br/>
     2919                                                            </xsl:if>
     2920                                                        </xsl:for-each>
     2921                                                    </td>
     2922                                                    <td>
     2923                                                        <xsl:for-each select="a:Substance">
     2924                                                            <xsl:value-of select="a:Text"/>
     2925                                                        </xsl:for-each>
     2926                                                    </td>
     2927                                                    <td>
     2928                                                        <xsl:value-of select="a:Method/a:Text"/>
     2929                                                    </td>
     2930                                                    <td>
     2931                                                        <xsl:value-of select="a:Position/a:Text"/>
     2932                                                    </td>
     2933                                                    <td>
     2934                                                        <xsl:value-of select="a:Site/a:Text"/>
     2935                                                    </td>
     2936                                                    <td>
     2937                                                        <xsl:value-of select="a:Status/a:Text"/>
     2938                                                    </td>
     2939                                                    <td>
     2940                                                        <xsl:call-template name="actorName">
     2941                                                            <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
     2942                                                        </xsl:call-template>
     2943                                                    </td>
     2944                                                </tr>
     2945                                            </xsl:for-each>
     2946                                        </tbody>
     2947                                    </table>
     2948                                </text>
     2949
     2950                                <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Procedures/a:Procedure">
     2951                                    <entry typeCode="DRIV">
     2952                                        <procedure classCode="PROC" moodCode="EVN">
     2953                                            <templateId root="2.16.840.1.113883.3.88.11.83.17" assigningAuthorityName="HITSP C83"/>
     2954                                            <templateId root="2.16.840.1.113883.10.20.1.29" assigningAuthorityName="CCD"/>
     2955                                            <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.19" assigningAuthorityName="IHE PCC"/>
     2956
     2957                                            <!-- <id> -->
     2958                                            <xsl:call-template name="ccdID">
     2959                                                <xsl:with-param name="ccrObjectID" select="a:CCRDataObjectID"/>
     2960                                            </xsl:call-template>
     2961
     2962                                            <!-- <code> -->
     2963                                            <xsl:call-template name="ccdCodedValue">
     2964                                                <xsl:with-param name="ccrCodedDescription" select="a:Description"/>
     2965                                                <xsl:with-param name="nodeName" select="'code'"/>
     2966                                            </xsl:call-template>
     2967
     2968                                            <text>
     2969                                                <reference>
     2970                                                    <xsl:attribute name="value">
     2971                                                        <xsl:text>#</xsl:text>
     2972                                                        <xsl:value-of select="a:CCRDataObjectID"/>
     2973                                                    </xsl:attribute>
     2974                                                </reference>
     2975                                            </text>
     2976
     2977                                            <xsl:call-template name="ccdStatusProcedure">
     2978                                                <xsl:with-param name="status" select="a:Status"/>
     2979                                            </xsl:call-template>
     2980
     2981                                            <xsl:call-template name="ccdDateTime">
     2982                                                <xsl:with-param name="dt" select="a:DateTime"/>
     2983                                            </xsl:call-template>
     2984
     2985                                            <xsl:if test="a:Method">
     2986                                                <xsl:call-template name="ccdCodedValue">
     2987                                                    <xsl:with-param name="ccrCodedDescription" select="a:Method"/>
     2988                                                    <xsl:with-param name="nodeName" select="'approachSiteCode'"/>
     2989                                                </xsl:call-template>
     2990                                            </xsl:if>
     2991
     2992                                            <xsl:if test="a:Site">
     2993                                                <xsl:call-template name="ccdCodedValue">
     2994                                                    <xsl:with-param name="ccrCodedDescription" select="a:Site"/>
     2995                                                    <xsl:with-param name="nodeName" select="'targetSiteCode'"/>
     2996                                                </xsl:call-template>
     2997                                            </xsl:if>
     2998
     2999                                            <xsl:if test="a:Practitioners/a:Practitioner">
     3000                                                <xsl:call-template name="ccdPerformer">
     3001                                                    <xsl:with-param name="ccrActorReference" select="a:Practitioners/a:Practitioner[1]"/>
     3002                                                </xsl:call-template>
     3003                                            </xsl:if>
     3004                                        </procedure>
     3005                                    </entry>
     3006                                </xsl:for-each>
     3007                            </section>
     3008                        </component>
     3009                    </xsl:if>
     3010                    <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Problems">
     3011                        <component>
     3012                            <section>
     3013                                <templateId root="2.16.840.1.113883.3.88.11.83.103" assigningAuthorityName="HITSP/C83"/>
     3014                                <templateId root="1.3.6.1.4.1.19376.1.5.3.1.3.6" assigningAuthorityName="IHE PCC"/>
     3015                                <templateId root="2.16.840.1.113883.10.20.1.11" assigningAuthorityName="HL7 CCD"/>
     3016                                <code code="11450-4" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Problem list"/>
     3017                                <title>Problems</title>
     3018                                <text>
     3019                                    <table>
     3020                                        <tbody>
     3021                                            <tr>
     3022                                                <th>Type</th>
     3023                                                <th>Date</th>
     3024                                                <th>Code</th>
     3025                                                <th>Description</th>
     3026                                                <th>Status</th>
     3027                                                <th>Source</th>
     3028                                            </tr>
     3029                                            <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Problems/a:Problem">
     3030                                                <tr>
     3031                                                    <td>
     3032                                                        <xsl:value-of select="a:Type/a:Text"/>
     3033                                                    </td>
     3034                                                    <td>
     3035                                                        <table>
     3036                                                            <tbody>
     3037                                                                <xsl:apply-templates select="a:DateTime"/>
     3038                                                            </tbody>
     3039                                                        </table>
     3040                                                    </td>
     3041                                                    <td>
     3042                                                        <xsl:apply-templates select="a:Description/a:Code"/>
     3043                                                    </td>
     3044                                                    <td>
     3045                                                                                                                <xsl:attribute name="ID">
     3046                                                                                                                        <xsl:value-of select="a:CCRDataObjectID"></xsl:value-of>
     3047                                                                                                                </xsl:attribute>
     3048                                                        <xsl:value-of select="a:Description/a:Text"/>
     3049                                                    </td>
     3050                                                    <td>
     3051                                                        <xsl:value-of select="a:Status/a:Text"/>
     3052                                                    </td>
     3053                                                    <td>
     3054                                                        <xsl:call-template name="actorName">
     3055                                                            <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
     3056                                                        </xsl:call-template>
     3057                                                    </td>
     3058                                                </tr>
     3059                                            </xsl:for-each>
     3060                                        </tbody>
     3061                                    </table>
     3062                                </text>
     3063                                <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Problems/a:Problem">
     3064                                    <entry typeCode="DRIV">
     3065                                        <act classCode="ACT" moodCode="EVN">
     3066                                            <templateId root="2.16.840.1.113883.10.20.1.27"/>
     3067                                            <!-- Problem act template -->
     3068
     3069                                            <!-- <id> -->
     3070                                            <xsl:call-template name="ccdID">
     3071                                                <xsl:with-param name="ccrObjectID" select="a:CCRDataObjectID"/>
     3072                                            </xsl:call-template>
     3073
     3074                                            <code nullFlavor="NA"/>
     3075
     3076                                            <xsl:call-template name="ccdPerformer">
     3077                                                <xsl:with-param name="ccrActorReference" select="a:Source/a:Actor"/>
     3078                                            </xsl:call-template>
     3079
     3080                                            <entryRelationship typeCode="SUBJ">
     3081                                                <observation classCode="OBS" moodCode="EVN">
     3082                                                    <templateId root="2.16.840.1.113883.10.20.1.28" assigningAuthorityName="CCD"/>
     3083                                                    <!--Problem observation template-->
     3084
     3085                                                    <!-- <id> -->
     3086                                                    <xsl:call-template name="ccdID">
     3087                                                        <xsl:with-param name="ccrObjectID" select="a:CCRDataObjectID"/>
     3088                                                        <xsl:with-param name="suffix"></xsl:with-param>
     3089                                                    </xsl:call-template>
     3090
     3091                                                    <code code="55607006" displayName="Problem" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED-CT"/>
     3092
     3093                                                    <text>
     3094                                                        <reference>
     3095                                                            <xsl:attribute name="value">
     3096                                                                <xsl:text>#</xsl:text>
     3097                                                                <xsl:value-of select="a:CCRDataObjectID"/>
     3098                                                            </xsl:attribute>
     3099                                                        </reference>
     3100                                                    </text>
     3101
     3102                                                    <statusCode code="completed"/>
     3103
     3104                                                    <xsl:call-template name="ccdDateTime">
     3105                                                        <xsl:with-param name="dt" select="a:DateTime"/>
     3106                                                    </xsl:call-template>
     3107
     3108                                                    <xsl:call-template name="ccdCodedValue">
     3109                                                        <xsl:with-param name="ccrCodedDescription" select="a:Description"/>
     3110                                                    </xsl:call-template>
     3111
     3112                                                    <xsl:call-template name="ccdStatus">
     3113                                                        <xsl:with-param name="ccrStatus" select="a:Status"/>
     3114                                                    </xsl:call-template>
     3115                                                </observation>
     3116                                            </entryRelationship>
     3117
     3118                                        </act>
     3119                                    </entry>
     3120                                </xsl:for-each>
     3121                            </section>
     3122                        </component>
     3123                    </xsl:if>
     3124                    <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Procedures">
     3125                        <component>
     3126                            <section>
     3127                                <templateId root="2.16.840.1.113883.10.20.1.12"/>
     3128                                <code code="47519-4" codeSystem="2.16.840.1.113883.6.1"/>
     3129                                <title>Procedures</title>
     3130                                <text>
     3131                                    <table>
     3132                                        <tbody>
     3133                                            <tr>
     3134                                                <th>Type</th>
     3135                                                <th>Date</th>
     3136                                                <th>Code</th>
     3137                                                <th>Description</th>
     3138                                                <th>Location</th>
     3139                                                <th>Substance</th>
     3140                                                <th>Method</th>
     3141                                                <th>Position</th>
     3142                                                <th>Site</th>
     3143                                                <th>Status</th>
     3144                                                <th>Source</th>
     3145                                            </tr>
     3146                                            <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Procedures/a:Procedure">
     3147                                                <tr>
     3148                                                    <xsl:attribute name="id">
     3149                                                        <xsl:value-of select="a:CCRDataObjectID"/>
     3150                                                    </xsl:attribute>
     3151
     3152                                                    <td>
     3153                                                        <xsl:value-of select="a:Type/a:Text"/>
     3154                                                    </td>
     3155                                                    <table>
     3156                                                        <tbody>
     3157                                                            <xsl:apply-templates select="a:DateTime"/>
     3158                                                        </tbody>
     3159                                                    </table>
     3160                                                    <td>
     3161                                                        <xsl:apply-templates select="a:Description/a:Code"/>
     3162                                                    </td>
     3163                                                    <td>
     3164                                                        <xsl:value-of select="a:Description/a:Text"/>
     3165                                                    </td>
     3166                                                    <td>
     3167                                                        <xsl:for-each select="a:Locations/a:Location">
     3168                                                            <xsl:value-of select="a:Description/a:Text"/>
     3169                                                            <xsl:if test="a:Actor">
     3170                                                                (<xsl:call-template name="actorName">
     3171                                                                    <xsl:with-param name="objID" select="a:Actor/a:ActorID"/>
     3172                                                                </xsl:call-template>
     3173                                                                <xsl:if test="a:Actor/a:ActorRole/a:Text">
     3174                                                                    <xsl:text xml:space="preserve"> - </xsl:text><xsl:value-of select="a:ActorRole/a:Text"/>)
     3175                                                                </xsl:if>
     3176                                                            </xsl:if>)
     3177                                                            <xsl:if test="position() != last()">
     3178                                                                <br/>
     3179                                                            </xsl:if>
     3180                                                        </xsl:for-each>
     3181                                                    </td>
     3182                                                    <td>
     3183                                                        <xsl:for-each select="a:Substance">
     3184                                                            <xsl:value-of select="a:Text"/>
     3185                                                        </xsl:for-each>
     3186                                                    </td>
     3187                                                    <td>
     3188                                                        <xsl:value-of select="a:Method/a:Text"/>
     3189                                                    </td>
     3190                                                    <td>
     3191                                                        <xsl:value-of select="a:Position/a:Text"/>
     3192                                                    </td>
     3193                                                    <td>
     3194                                                        <xsl:value-of select="a:Site/a:Text"/>
     3195                                                    </td>
     3196                                                    <td>
     3197                                                        <xsl:value-of select="a:Status/a:Text"/>
     3198                                                    </td>
     3199                                                    <td>
     3200                                                        <xsl:call-template name="actorName">
     3201                                                            <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
     3202                                                        </xsl:call-template>
     3203                                                    </td>
     3204                                                </tr>
     3205                                            </xsl:for-each>
     3206                                        </tbody>
     3207                                    </table>
     3208                                </text>
     3209
     3210                                <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Procedures/a:Procedure">
     3211                                    <entry typeCode="DRIV">
     3212                                        <procedure classCode="PROC" moodCode="EVN">
     3213                                            <templateId root="2.16.840.1.113883.3.88.11.83.17" assigningAuthorityName="HITSP C83"/>
     3214                                            <templateId root="2.16.840.1.113883.10.20.1.29" assigningAuthorityName="CCD"/>
     3215                                            <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.19" assigningAuthorityName="IHE PCC"/>
     3216
     3217                                            <!-- <id> -->
     3218                                            <xsl:call-template name="ccdID">
     3219                                                <xsl:with-param name="ccrObjectID" select="a:CCRDataObjectID"/>
     3220                                            </xsl:call-template>
     3221
     3222                                            <!-- <code> -->
     3223                                            <xsl:call-template name="ccdCodedValue">
     3224                                                <xsl:with-param name="ccrCodedDescription" select="a:Description"/>
     3225                                                <xsl:with-param name="nodeName" select="'code'"/>
     3226                                            </xsl:call-template>
     3227
     3228                                            <text>
     3229                                                <reference>
     3230                                                    <xsl:attribute name="value">
     3231                                                        <xsl:text>#</xsl:text>
     3232                                                        <xsl:value-of select="a:CCRDataObjectID"/>
     3233                                                    </xsl:attribute>
     3234                                                </reference>
     3235                                            </text>
     3236
     3237                                            <xsl:call-template name="ccdStatusProcedure">
     3238                                                <xsl:with-param name="status" select="a:Status"/>
     3239                                            </xsl:call-template>
     3240
     3241                                            <xsl:call-template name="ccdDateTime">
     3242                                                <xsl:with-param name="dt" select="a:DateTime"/>
     3243                                            </xsl:call-template>
     3244
     3245                                            <xsl:if test="a:Method">
     3246                                                <xsl:call-template name="ccdCodedValue">
     3247                                                    <xsl:with-param name="ccrCodedDescription" select="a:Method"/>
     3248                                                    <xsl:with-param name="nodeName" select="'approachSiteCode'"/>
     3249                                                </xsl:call-template>
     3250                                            </xsl:if>
     3251
     3252                                            <xsl:if test="a:Site">
     3253                                                <xsl:call-template name="ccdCodedValue">
     3254                                                    <xsl:with-param name="ccrCodedDescription" select="a:Site"/>
     3255                                                    <xsl:with-param name="nodeName" select="'targetSiteCode'"/>
     3256                                                </xsl:call-template>
     3257                                            </xsl:if>
     3258
     3259                                            <xsl:if test="a:Practitioners/a:Practitioner">
     3260                                                <xsl:call-template name="ccdPerformer">
     3261                                                    <xsl:with-param name="ccrActorReference" select="a:Practitioners/a:Practitioner[1]"/>
     3262                                                </xsl:call-template>
     3263                                            </xsl:if>
     3264                                        </procedure>
     3265                                    </entry>
     3266                                </xsl:for-each>
     3267                            </section>
     3268                        </component>
     3269                    </xsl:if>
     3270                    <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Problems">
     3271                        <component>
     3272                            <section>
     3273                                <templateId root="2.16.840.1.113883.3.88.11.83.103" assigningAuthorityName="HITSP/C83"/>
     3274                                <templateId root="1.3.6.1.4.1.19376.1.5.3.1.3.6" assigningAuthorityName="IHE PCC"/>
     3275                                <templateId root="2.16.840.1.113883.10.20.1.11" assigningAuthorityName="HL7 CCD"/>
     3276                                <code code="11450-4" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Problem list"/>
     3277                                <title>Problems</title>
     3278                                <text>
     3279                                    <table>
     3280                                        <tbody>
     3281                                            <tr>
     3282                                                <th>Type</th>
     3283                                                <th>Date</th>
     3284                                                <th>Code</th>
     3285                                                <th>Description</th>
     3286                                                <th>Status</th>
     3287                                                <th>Source</th>
     3288                                            </tr>
     3289                                            <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Problems/a:Problem">
     3290                                                <tr>
     3291                                                    <td>
     3292                                                        <xsl:value-of select="a:Type/a:Text"/>
     3293                                                    </td>
     3294                                                    <td>
     3295                                                        <table>
     3296                                                            <tbody>
     3297                                                                <xsl:apply-templates select="a:DateTime"/>
     3298                                                            </tbody>
     3299                                                        </table>
     3300                                                    </td>
     3301                                                    <td>
     3302                                                        <xsl:apply-templates select="a:Description/a:Code"/>
     3303                                                    </td>
     3304                                                    <td>
     3305                                                                                                                <xsl:attribute name="ID">
     3306                                                                                                                        <xsl:value-of select="a:CCRDataObjectID"></xsl:value-of>
     3307                                                                                                                </xsl:attribute>
     3308                                                        <xsl:value-of select="a:Description/a:Text"/>
     3309                                                    </td>
     3310                                                    <td>
     3311                                                        <xsl:value-of select="a:Status/a:Text"/>
     3312                                                    </td>
     3313                                                    <td>
     3314                                                        <xsl:call-template name="actorName">
     3315                                                            <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
     3316                                                        </xsl:call-template>
     3317                                                    </td>
     3318                                                </tr>
     3319                                            </xsl:for-each>
     3320                                        </tbody>
     3321                                    </table>
     3322                                </text>
     3323                                <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Problems/a:Problem">
     3324                                    <entry typeCode="DRIV">
     3325                                        <act classCode="ACT" moodCode="EVN">
     3326                                            <templateId root="2.16.840.1.113883.10.20.1.27"/>
     3327                                            <!-- Problem act template -->
     3328
     3329                                            <!-- <id> -->
     3330                                            <xsl:call-template name="ccdID">
     3331                                                <xsl:with-param name="ccrObjectID" select="a:CCRDataObjectID"/>
     3332                                            </xsl:call-template>
     3333
     3334                                            <code nullFlavor="NA"/>
     3335
     3336                                            <xsl:call-template name="ccdPerformer">
     3337                                                <xsl:with-param name="ccrActorReference" select="a:Source/a:Actor"/>
     3338                                            </xsl:call-template>
     3339
     3340                                            <entryRelationship typeCode="SUBJ">
     3341                                                <observation classCode="OBS" moodCode="EVN">
     3342                                                    <templateId root="2.16.840.1.113883.10.20.1.28" assigningAuthorityName="CCD"/>
     3343                                                    <!--Problem observation template-->
     3344
     3345                                                    <!-- <id> -->
     3346                                                    <xsl:call-template name="ccdID">
     3347                                                        <xsl:with-param name="ccrObjectID" select="a:CCRDataObjectID"/>
     3348                                                        <xsl:with-param name="suffix"></xsl:with-param>
     3349                                                    </xsl:call-template>
     3350
     3351                                                    <code code="55607006" displayName="Problem" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED-CT"/>
     3352
     3353                                                    <text>
     3354                                                        <reference>
     3355                                                            <xsl:attribute name="value">
     3356                                                                <xsl:text>#</xsl:text>
     3357                                                                <xsl:value-of select="a:CCRDataObjectID"/>
     3358                                                            </xsl:attribute>
     3359                                                        </reference>
     3360                                                    </text>
     3361
     3362                                                    <statusCode code="completed"/>
     3363
     3364                                                    <xsl:call-template name="ccdDateTime">
     3365                                                        <xsl:with-param name="dt" select="a:DateTime"/>
     3366                                                    </xsl:call-template>
     3367
     3368                                                    <xsl:call-template name="ccdCodedValue">
     3369                                                        <xsl:with-param name="ccrCodedDescription" select="a:Description"/>
     3370                                                    </xsl:call-template>
     3371
     3372                                                    <xsl:call-template name="ccdStatus">
     3373                                                        <xsl:with-param name="ccrStatus" select="a:Status"/>
     3374                                                    </xsl:call-template>
     3375                                                </observation>
     3376                                            </entryRelationship>
     3377
     3378                                        </act>
     3379                                    </entry>
     3380                                </xsl:for-each>
     3381                            </section>
     3382                        </component>
     3383                    </xsl:if>
     3384                    <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Encounters">
     3385                        <component>
     3386                            <section>
     3387                                <templateId root="2.16.840.1.113883.3.88.11.83.127" assigningAuthorityName="HITSP/C83"/>
     3388                                <templateId root="1.3.6.1.4.1.19376.1.5.3.1.1.5.3.3" assigningAuthorityName="IHE PCC"/>
     3389                                <templateId root="2.16.840.1.113883.10.20.1.3" assigningAuthorityName="HL7 CCD"/>
     3390                                <!--Encounters section template-->
     3391                                <code code="46240-8" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="History of encounters"/>
     3392                                <title>Encounters</title>
     3393                                <text>
     3394                                    <table>
     3395                                        <tbody>
     3396                                            <tr>
     3397                                                <th>Type</th>
     3398                                                <th>Date</th>
     3399                                                <th>Location</th>
     3400                                                <th>Status</th>
     3401                                                <th>Practitioner</th>
     3402                                                <th>Description</th>
     3403                                                <th>Indications</th>
     3404                                                <th>Source</th>
     3405                                            </tr>
     3406                                            <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Encounters/a:Encounter">
     3407                                                <tr>
     3408                                                    <xsl:attribute name="id">
     3409                                                        <xsl:value-of select="a:CCRDataObjectID"/>
     3410                                                    </xsl:attribute>
     3411
     3412                                                    <td>
     3413                                                        <xsl:value-of select="a:Type/a:Text"/>
     3414                                                    </td>
     3415                                                    <td>
     3416                                                        <xsl:call-template name="date:format-date">
     3417                                                            <xsl:with-param name="date-time" select="a:DateTime/a:ExactDateTime"/>
     3418                                                        </xsl:call-template>
     3419                                                    </td>
     3420                                                    <td>
     3421                                                        <xsl:for-each select="a:Locations/a:Location">
     3422                                                            <xsl:value-of select="a:Description/a:Text"/>
     3423                                                            <xsl:call-template name="actorName">
     3424                                                                <xsl:with-param name="objID" select="a:Actor/a:ActorID"/>
     3425                                                            </xsl:call-template>
     3426                                                            <br/>
     3427                                                        </xsl:for-each>
     3428                                                    </td>
     3429                                                    <td>
     3430                                                        <xsl:value-of select="a:Status/a:Text"/>
     3431                                                    </td>
     3432                                                    <td>
     3433                                                        <xsl:for-each select="a:Practitioners/a:Practitioner">
     3434                                                            <xsl:call-template name="actorName">
     3435                                                                <xsl:with-param name="objID" select="a:ActorID"/>
     3436                                                            </xsl:call-template>
     3437                                                            <br/>
     3438                                                        </xsl:for-each>
     3439                                                    </td>
     3440                                                    <td>
     3441                                                        <xsl:value-of select="a:Description/a:Text"/>
     3442                                                    </td>
     3443                                                    <td>
     3444                                                        <xsl:for-each select="a:Indications/a:Indication">
     3445                                                            <xsl:call-template name="problemDescription">
     3446                                                                <xsl:with-param name="objID" select="a:InternalCCRLink/a:LinkID"/>
     3447                                                            </xsl:call-template>
     3448                                                            <br/>
     3449                                                        </xsl:for-each>
     3450                                                    </td>
     3451                                                    <td>
     3452                                                        <xsl:call-template name="actorName">
     3453                                                            <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
     3454                                                        </xsl:call-template>
     3455                                                    </td>
     3456                                                </tr>
     3457                                            </xsl:for-each>
     3458                                        </tbody>
     3459                                    </table>
     3460                                </text>
     3461                                <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Encounters/a:Encounter">
     3462                                    <entry typeCode="DRIV">
     3463                                        <encounter classCode="ENC" moodCode="EVN">
     3464                                            <templateId root="2.16.840.1.113883.3.88.11.83.16" assigningAuthorityName="HITSP C83"/>
     3465                                            <templateId root="2.16.840.1.113883.10.20.1.21" assigningAuthorityName="CCD"/>
     3466                                            <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.14" assigningAuthorityName="IHE PCC"/>
     3467
     3468                                            <!-- Encounter activity template -->
     3469
     3470                                            <!-- <id> -->
     3471                                            <xsl:call-template name="ccdID">
     3472                                                <xsl:with-param name="ccrObjectID" select="a:CCRDataObjectID"/>
     3473                                            </xsl:call-template>
     3474
     3475                                            <xsl:call-template name="ccdCodedValue">
     3476                                                <xsl:with-param name="ccrCodedDescription" select="a:Description"/>
     3477                                                <xsl:with-param name="nodeName" select="'code'"/>
     3478                                            </xsl:call-template>
     3479
     3480                                            <text>
     3481                                                <reference>
     3482                                                    <xsl:attribute name="value">
     3483                                                        <xsl:text>#</xsl:text>
     3484                                                        <xsl:value-of select="a:CCRDataObjectID"/>
     3485                                                    </xsl:attribute>
     3486                                                </reference>
     3487                                            </text>
     3488
     3489                                            <xsl:call-template name="ccdDateTime">
     3490                                                <xsl:with-param name="dt" select="a:DateTime"/>
     3491                                            </xsl:call-template>
     3492
     3493                                            <xsl:if test="a:Practitioners[1]/a:Practitioner">
     3494                                                <xsl:call-template name="ccdPerformer">
     3495                                                    <xsl:with-param name="ccrActorReference" select="a:Practitioners/a:Practitioner[1]"/>
     3496                                                </xsl:call-template>
     3497                                            </xsl:if>
     3498
     3499                                            <xsl:if test="a:Locations[1]/a:Location">
     3500                                                <participant typeCode="LOC">
     3501                                                    <templateId root="2.16.840.1.113883.10.20.1.45"/>
     3502                                                    <!-- Location participation template -->
     3503                                                    <xsl:choose>
     3504                                                        <xsl:when test="a:Locations[1]/a:Location/a:ActorID">
     3505                                                            <xsl:call-template name="ccdParticipantRoleActor">
     3506                                                                <xsl:with-param name="ccrActorObjectID" select="a:Locations[1]/a:Location/a:ActorID"/>
     3507                                                            </xsl:call-template>
     3508                                                        </xsl:when>
     3509                                                        <xsl:otherwise>
     3510                                                            <xsl:call-template name="ccdParticipantRoleCodedDescription">
     3511                                                                <xsl:with-param name="ccrCodedDescription" select="a:Locations[1]/a:Location/a:Description"/>
     3512                                                            </xsl:call-template>
     3513                                                        </xsl:otherwise>
     3514                                                    </xsl:choose>
     3515                                                </participant>
     3516                                            </xsl:if>
     3517                                        </encounter>
     3518                                    </entry>
     3519                                </xsl:for-each>
     3520                            </section>
     3521                        </component>
     3522                    </xsl:if>
Note: See TracChangeset for help on using the changeset viewer.