add project qrda

This commit is contained in:
YuCheng Hu 2024-08-02 10:05:09 -04:00
parent e778d21bba
commit 0d364a6e1d
281 changed files with 496643 additions and 0 deletions

View File

@ -11,3 +11,6 @@ https://trac.opensourcevista.net/svn/mu-stage1-reg-changes
## mu_stage1_reg_changes
https://trac.opensourcevista.net/svn/lang-file4mu1and2
## qrda
https://trac.opensourcevista.net/svn/qrda

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,58 @@
C0QERTIM ; Time from admission to leaving a hospital location ;
;;0.1;C0Q;;;Build 19
EN ;Get Location
S DIC=42,DIC(0)="AEMQ" D ^DIC I Y<1 G EXIT
S LOCATION=+Y
;Start date
S %DT="AE",%DT("A")="Start DATE: " D ^%DT G:Y=-1 EXIT S START=Y
;End date
S %DT="AE",%DT("A")="Stop DATE: " D ^%DT G:Y=-1 EXIT S STOP=Y
;select device:
S %ZIS="Q" D ^%ZIS G EXIT:POP
I $D(IO("Q")) D G EXIT
. S ZTRTN="DQ^C0QERTIM",ZTDESC="Time from admission to leaving a hospital location"
. S ZTSAVE("LOCATION")="",ZTSAVE("START")="",ZTSAVE("STOP")=""
. D ^%ZTLOAD D HOME^%ZIS K IO("Q")
. Q
DQ ; Get down to business
;sort on admit date/time in file 45, screen on LOSING WARD in sub-file 535.
;^DGPT("AF",date/time,DA)
S PATCOUNT=0,ADMITIME=START
F S ADMITIME=$O(^DGPT("AF",ADMITIME)) Q:ADMITIME'>0 D
. Q:ADMITIME>STOP
. ;FMIN from ADMISSION DATE piece 2
. S X=ADMITIME D H^%DTC S FMINDAY=%H,FMINSEC=%T
. S D0="" F S D0=$O(^DGPT("AF",ADMITIME,D0)) Q:D0'>0 D
. . S D1=0 F S D1=$O(^DGPT(D0,535,D1)) Q:D1'>0 D
. . . ;Losing ward in piece 6 of ^DGPT(D0,535,D1,0)
. . . Q:$P($G(^DGPT(D0,535,D1,0)),U,6)'=LOCATION
. . . ;FMOUT from MOVEMENT DATE on leaving in piece 10
. . . S X=$P($G(^DGPT(D0,535,D1,0)),U,10) D H^%DTC S FMOUTDAY=%H,FMOUTSEC=%T
. . . I FMINDAY=FMOUTDAY S MINUTES=$P((FMOUTSEC-FMINSEC)/60,".")
. . . I FMINDAY'=FMOUTDAY D
. . . . S DIFFDAY=FMOUTDAY-FMINDAY
. . . . S MINUTES=1440*(DIFFDAY-1)+$P((FMOUTSEC+86400-FMINSEC)/60,".")
. . . . Q
. . . S PATCOUNT=PATCOUNT+1
. . . S ^TMP($J,"PATIENTS",$P(^DPT(+^DGPT(D0,0),0),U))=MINUTES
. . . S ^TMP($J,"MINUTES",MINUTES)=1+$G(^TMP($J,"MINUTES",MINUTES))
. . . Q
. . Q
. Q
U IO W @IOF
;list median time from Admission to leaving hospital LOCATION
S MID=$P(PATCOUNT/2,"."),SUM=0
S MEDIAN=0 F S MEDIAN=$O(^TMP($J,"MINUTES",MEDIAN)) Q:MEDIAN'>0 D
. S SUM=SUM+^TMP($J,"MINUTES",MEDIAN) Q:SUM>MID
. Q
W "The median time spent in ",$P(^DIC(42,LOCATION,0),U)," is ",MEDIAN," minutes.",!
W !,"Patient",?40,"Minutes in ",$P(^DIC(42,LOCATION,0),U)
;list patient and time from admission to leaving the location
S PATIENT="" F S PATIENT=$O(^TMP($J,"PATIENTS",PATIENT)) Q:PATIENT="" D
. W !,PATIENT,?40," ",^TMP($J,"PATIENTS",PATIENT)
EXIT ; DO CLEANUP
S:$D(ZTQUEUED) ZTREQ="@"
K DIC,START,STOP,LOCATION,PATCOUNT,ADMITIME,FMINDAY,FMINSEC,FMOUTDAY,FMOUTSEC
K POP,D0,D1,DIFFDAY,MINUTES,MID,MEDIAN,PATIENT,^TMP($J)
Q

View File

@ -0,0 +1,118 @@
C0QGMRAD ;HIRMFO/RM,WAA-UTILITY TO GATHER PATIENT DATA ;1/15/98 13:47
;;4.0;Adverse Reaction Tracking;**2,10**;Mar 29, 1996;Build 19
EN1 ; ENTRY TO GATHER PATIENT A/AR DATA
;INPUT VARIABLES:
;
; DFN Pointer to Patient file.
; GMRA (OPTIONAL) A^B^C DEFAULT="0^0^111^0" **LOCAL
; where A = 0 return all reactions (allergic/non-allergic).
; 1 return allergies only.
; 2 return non-allergies only.
; B = 0 return all data (verified or non-verified).
; 1 return only verified data.
; 2 return only non-verified data.
; C = X_Y_Z
; where X, Y, and Z are either 0 or 1. 1 would mean to
; return an Adverse Reaction of that particular type,
; and zero means do not return an Adverse Reaction of
; that type.
; X is for TYPE=OTHER
; Y is for TYPE=FOOD
; Z is for TYPE=DRUG.
; E.g., 001 (return drug only), 111 (returns all types),
; and 010 (returns food only).
; **LOCAL
; D = 0 return both Observed and Historical
; 1 return only Observed
; **LOCAL
;OUTPUT VARIABLES:
; GMRAL = 1 if patient has Adverse Reaction
; 0 if patient has no known Adverse Reaction
; null if patient has not been asked about Adverse Reaction
; GMRAL(PTR TO 120.8) = A^B^C^D^E^F^G^H^I
; where A = Pointer to Patient file.
; B = Free text of causative agent.
; *C = Type of reaction, where D is drug, F is food, and O is
; other.
; D = 1 if Adverse Reaction has been verified
; 0 if Adverse Reaction has not been verified
; E = 0 if this is an allergic reaction
; 1 if this is not an allergic reaction
; **F = the mechanism of reaction in the format:
; External format;Internal format
; (ALLERGY;0, PHARMACOLOGIC;2, UNKNOWN;U).
; G = Type of reaction.
; where D = drug
; DF = drug/food
; DFO = drug/food/other
; DO = drug/other
; F = food
; FO = food/other
; O = other
; H = the mechanism of reaction in the format:
; External format;Internal format
; (ALLERGY;A, PHARMACOLOGIC;P, UNKNOWN;U)
; I = IEN and Global root of reactant (stored in piece B above)
; set equal to the GMR ALLERGY field (#1) of the PATIENT
; ALLERGY file (#120.8)
; GMRAL(PTR TO 120.8,"S",COUNT) = S
; where COUNT = number 1 to number of signs/symptoms for this
; reaction.
; S = a sign/symptom for this reaction in the format:
; External format;Internal format
;
;* NOTE: This piece will no longer be supported after 9/1/97,
; Please use piece G.
;** NOTE: This piece will no longer be supported after 9/1/97,
; Please use piece H.
;
N GMRAOTH
Q:'$D(DFN) S:'$D(GMRA)#2 GMRA="0^0^111^1" K GMRAL
DPT ;
;Read NKA Node in file 120.86
S GMRAL=$P($G(^GMR(120.86,DFN,0)),U,2)
;Do not set GMRAL array if patient is unassessed or NKA.
I GMRAL=0 Q ;PATIENT HAS NO KNOWN ALLERGIES
F GMRAREC=0:0 S GMRAREC=$O(^GMR(120.8,"B",DFN,GMRAREC)) Q:GMRAREC'>0 S GMRANODE=$S($D(^GMR(120.8,GMRAREC,0)):^(0),1:"") D:GMRANODE SETAL
I GMRAL=1,+$O(GMRAL(0))'>0 S GMRAL=0 ;if flag is set to 1 (reactions exist), then make certain the reactions are passed in the GMRAL array
K GMRA,GMRANODE,GMRAOSOF,GMRAREC,GMRATCNT
Q
SETAL ;
N %,GMRAI,GMRASIGN
;Q:'$P(GMRANODE,"^",12)&'$D(GMRAOSOF) ;IF NOT SIGNED OFF MARK IT
Q:+$G(^GMR(120.8,GMRAREC,"ER"))&'$D(GMRAERR) ;IF ENTERED IN ERROR QUIT
I GMRAL'=1 S GMRAL=1 ; PATIENT HAS ALLERGIES
S GMRAI=0 ; BEGIN CHECK FOR ADR/ALL CRITERIA
I $P(GMRA,"^",4),$P(GMRANODE,"^",6)="h" Q ;QUIT IF HISTORICAL EXCLUDED **LOCAL
I '$P(GMRA,"^") S GMRAI=1
E I $P(GMRA,"^")=1 S:$F("AU",$P(GMRANODE,"^",14))>1 GMRAI=1
E S:$F("P",$P(GMRANODE,"^",14))>1 GMRAI=1
Q:'GMRAI ; QUIT IF ADR/ALL CRITERIA NOT MET
Q:2-$P(GMRA,"^",2)=(1-$P(GMRANODE,"^",16)) ;QUIT IF VER/NON VER CRITERIA NOT MET
S GMRAI=0 ; BEGIN CHECK FOR ALLERGY TYPE CRITERIA
F %=1:1:3 I $E($P(GMRA,"^",3),%),$P(GMRANODE,"^",20)[$E("OFD",%) S GMRAI=1 Q
Q:'GMRAI ; QUIT IF ALLERGY TYPE CRITERIA NOT MET
D PASS(GMRAREC,.GMRAL)
Q
PASS(GMRAREC,GMRAL) ; Data filer
; This subroutine will store all the patient date for a reaction is an
; array.
; Input:
; GMRAREC = The IEN for the entry in 120.8
;Output:
; GMRAL(GMRAREC) the array entry for the record
;
N GMRANODE
S GMRANODE=$G(^GMR(120.8,GMRAREC,0)) Q:GMRANODE=""
S %=$P(GMRANODE,"^",14)
S GMRAL(GMRAREC)=$P(GMRANODE,"^",1,2)_"^"_$E($P(GMRANODE,"^",20))_"^"_+$P(GMRANODE,"^",16)_"^"_$S(%="A"!(%="U"):0,1:1)
S GMRAL(GMRAREC)=GMRAL(GMRAREC)_"^"_$S(%="A":"ALLERGY;0",%="P":"PHARMACOLOGIC;2",%="U":"UNKNOWN;U",1:"")_"^"_$P(GMRANODE,"^",20)_"^"_$S(%="A":"ALLERGY;A",%="P":"PHARMACOLOGIC;P",%="U":"UNKNOWN;U",1:"")
S GMRAL(GMRAREC)=GMRAL(GMRAREC)_"^"_$P(GMRANODE,"^",3)
Q:'$O(^GMR(120.8,GMRAREC,10,0)) ;QUIT IF NO SIGNS/SYMPTOMS
S:'$D(GMRAOTH) GMRAOTH=$O(^GMRD(120.83,"B","OTHER REACTION",0))
S GMRAX=0,GMRAY=1 F S GMRAX=$O(^GMR(120.8,GMRAREC,10,GMRAX)) Q:GMRAX<1 D I GMRAZ'="" S GMRAL(GMRAREC,"S",GMRAY)=GMRAZ(1),GMRAY=GMRAY+1
.S GMRAZ=$G(^GMR(120.8,GMRAREC,10,GMRAX,0))
.S GMRAZ(1)=$S(+GMRAZ'=GMRAOTH:$P($G(^GMRD(120.83,+GMRAZ,0)),U)_";"_+GMRAZ,1:$P(GMRAZ,U,2)_";"_+GMRAZ)
.Q
K GMRAX,GMRAY,GMRAZ
Q

View File

@ -0,0 +1,26 @@
C0QGMTSA ; SLC/DLT,KER - Brief Adverse Reaction/Allergy ; 02/27/2002
;;2.7;Health Summary;**28,49**;Oct 20, 1995;Build 19
;
; External References
; DBIA 10096 ^%ZOSF("TEST"
; DBIA 10099 EN1^GMRADPT **LOCAL NOW EN1^C0QGMRAD
;
ALLRG ; Allergies
N I,Z,X,SEQ,GMTSA,ALLRG K GMTSA S (SEQ,ALLRG)=0 S X="C0QGMRAD" X ^%ZOSF("TEST")
I $T D Q:$D(GMTSQIT)
. D GETALLRG I ALLRG D
. . D CKP^GMTSUP Q:$D(GMTSQIT) W ?3,"Allergy/Reaction: " D ALLRGP
Q
ALLRGP ; Allergy Print
D CKP^GMTSUP Q:$D(GMTSQIT) W ?21 S X=0
F I=0:0 S I=$O(GMTSA(I)) Q:I="" D Q:$D(GMTSQIT)
. S X=X+1 W:X>1 ", " W:(77)'>($X+$L(GMTSA(I))) !
. D CKP^GMTSUP Q:$D(GMTSQIT) W GMTSA(I)
Q:$D(GMTSQIT) D CKP^GMTSUP Q:$D(GMTSQIT) W ! Q
GETALLRG ; Get Allergies
N GMI,GMJ,GMRAL D EN1^C0QGMRAD I GMRAL="" S ALLRG=0 Q
I GMRAL="0" S ALLRG=1,GMTSA(1)="No Known Allergies" Q
S ALLRG=1,GMI=0 F S GMI=$O(GMRAL(GMI)) Q:GMI'>0 D
. S GMTSA(GMI)=$P(GMRAL(GMI),U,2)
. S GMJ=0 F S GMJ=$O(GMTSA(GMJ)) Q:GMJ'>0 I GMI'=GMJ,(GMTSA(GMI)=$G(GMTSA(GMJ))) K GMTSA(GMI) Q
Q

View File

@ -0,0 +1,101 @@
C0QGMTSG ; SLC/DLT,KER - Allergies ; 01/06/2003
;;2.7;Health Summary;**9,28,49,58**;Oct 20, 1995;Build 19
;
; External References
; DBIA 10096 ^%ZOSF("TEST"
; DBIA 10035 ^DPT(
; DBIA 905 ^GMR(120.8
; DBIA 2056 $$GET1^DIQ (file #120.86 and #200)
; DBIA 10011 ^DIWP
; DBIA 10099 EN1^GMRADPT **LOCAL changed to C0QGMRAD
; DBIA 10060 ^VA(200,
; DBIA 3449 ^GMR(120.86,
;
ALLRG ; Allergies
N X,GMTSALAS,GMTSALAD,GMTSALAW,GMTSALAT,GMTSAV,GMTSAFN,GMRAL,GMTSAL
N GMTSALNM,GMTSCNT,GMTSEACT,GMTSLN,GMTSMECH,GMTSPRT,GMTSTY,CC,C,KK
N ALLRG,TITLE,JJ K GMTSA S (SEQ,ALLRG)=0,TITLE="ALLERGY/ADVERSE REACTION (AR)"
S X="C0QGMRAD" X ^%ZOSF("TEST")
I $T D Q:$D(GMTSQIT)
. D GETALLRG D:ALLRG TITLE,ALLRGP D:'ALLRG&($L($G(GMTSALAS))) TITLE,NKA
I 'ALLRG,'$L($G(GMTSALAS)) D
. I $D(GMTSPNF)&('ALLRG) D CKP^GMTSUP Q:$D(GMTSQIT) W "Unknown, please evaluate",!
K ALL,CC,CCC,CD,DIWF,DIWL,DIWR,GMTSALF,GMTSALNM,GMTSNODE,GMTSPRT,I,II,JJ,KK,L,M,MX,N,Z,X,SEQ,GMTSA,ALLRG,TITLE,GMRA,GMRAL,GMTSEACT,GMTSMECH,GMTSTY,GMTSPFN,GMTSAL,GMTSCNT,GMTSLN,ODT
Q
ALLRGP ; Allergy Print
S II="" F S II=$O(GMTSAL(II)) Q:II']"" I $O(GMTSAL(II,""))]"" D
. D CKP^GMTSUP Q:$D(GMTSQIT) W !?2,$S(II="D":"Drug:",II="DF":"Drug/Food:",II="DFO":"Drug/Food/Other:",II="DO":"Drug/Other:",II="F":"Food:",II="FO":"Food/Other:",II="O":"Other:",1:II_":")
. S JJ="" F S JJ=$O(GMTSAL(II,JJ)) Q:JJ="" D
.. N WKK S KK="" F S KK=$O(GMTSAL(II,JJ,KK)) Q:KK="" D
... S L=0 F S L=$O(GMTSAL(II,JJ,KK,L)) Q:'L D CKP^GMTSUP Q:$D(GMTSQIT) D AUTOV W !?5,JJ_": " S:$L(KK)>30 WKK=KK,WKK=$$WRAP^GMTSORC(WKK,30) W ?24,$S($L(KK)>30:$P(WKK,"|"),1:KK) D
.... I GMTSAV=1 W " (AV"
.... E W $S($P(GMTSAL(II,JJ,KK,L),U,5)=1:" (V",$P(GMTSAL(II,JJ,KK,L),U,5)=0:" (NV",1:"")
.... W $S($P($G(^GMR(120.8,GMTSALNM,0)),U,6)="h":"/Historical)",$P($G(^(0)),U,6)="o":"/Observed)",1:")")
.... I $L($P($G(WKK),"|",2)) D CKP^GMTSUP Q:$D(GMTSQIT) W !,?24,$P(WKK,"|",2)
.... S (M,MX,ALL)=0 F S M=$O(GMTSAL(II,JJ,KK,L,"S",M)) Q:M="" D Q:$D(GMTSQIT)
..... I ALL=0 D CKP^GMTSUP Q:$D(GMTSQIT) W !?27
..... S MX=MX+1
..... W:MX>1 ", "
..... S N=$P(GMTSAL(II,JJ,KK,L,"S",M),";")
..... S ALL=1 I (74)'>($X+$L(N)) D CKP^GMTSUP Q:$D(GMTSQIT) W !,?27,N Q
..... S ALL=1 W N
.... D SIGBLK($P(GMTSAFN,U,5))
.... D CKP^GMTSUP Q:$D(GMTSQIT) W !,?24,"Date/Time: " S ODT=$P(GMTSAFN,U,4) S X=ODT D REGDTM4^GMTSU W X,!
....S CC="" F S CC=$O(^GMR(120.8,GMTSALNM,26,"B",CC)) Q:CC="" D CKP^GMTSUP Q:$D(GMTSQIT) W !,?24,"Comments at: " S X=CC D REGDTM4^GMTSU S CD=X S CCC=0 F S CCC=$O(^GMR(120.8,GMTSALNM,26,"B",CC,CCC)) Q:'CCC D TEXT
Q
NKA ; No known allergies
D CKP^GMTSUP Q:$D(GMTSQIT) W:$L($G(GMTSALAS))!($L($G(GMTSALAD))) !
D CKP^GMTSUP Q:$D(GMTSQIT) W:$L($G(GMTSALAS)) ?22,$G(GMTSALAS),!
D CKP^GMTSUP Q:$D(GMTSQIT) W:$L($G(GMTSALAS))!($L($G(GMTSALAD)))!($L($G(GMTSALAW))) ?24,"Assessment date: ",$G(GMTSALAD),!
D CKP^GMTSUP Q:$D(GMTSQIT) W:$L($G(GMTSALAW)) ?28,"Assessed by: ",GMTSALAW,!
D CKP^GMTSUP Q:$D(GMTSQIT) W:$L($G(GMTSALAW))&($L($G(GMTSALAT))) ?34,"Title: ",GMTSALAT,!
Q
GETALLRG ; Get Allergies
S GMRA="0^0^111^1" D EN1^C0QGMRAD I GMRAL="" S ALLRG=0 Q
I +($G(DFN))>0,+($G(GMRAL))=0 D ALLAS S ALLRG=0 Q
I $D(GMRAL)>9 D
. S I=0 F GMTSCNT=1:1 S I=$O(GMRAL(I)) Q:'I D
.. S GMTSTY=$P(GMRAL(I),U,7) Q:GMTSTY']""
.. S GMTSEACT=$P(GMRAL(I),U,2) Q:GMTSEACT']""
.. S GMTSMECH=$P($P(GMRAL(I),U,8),";")
.. S:GMTSMECH']"" GMTSMECH="UNKNOWN"
.. S GMTSAL(GMTSTY,GMTSMECH,GMTSEACT,GMTSCNT)=I_"^"_GMRAL(I)
.. S JJ=0 F S JJ=$O(GMRAL(I,"S",JJ)) Q:'JJ S GMTSAL(GMTSTY,GMTSMECH,GMTSEACT,GMTSCNT,"S",JJ)=GMRAL(I,"S",JJ)
.. S ALLRG=1
Q
ALLAS ; Allergy Assessment
N X,GMTSALG1,GMTSALG2,GMTSALG3,GMTSAU S (GMTSALAS,GMTSALAD,GMTSALAW)="" S GMTSALAS="No known allergies"
S GMTSALAD=$$GET1^DIQ(120.86,+($G(DFN)),3,"I",,"GMTSALG2") S:$D(GMTSALG2) GMTSALAD="" S:+GMTSALAD=0 GMTSALAD=""
I +GMTSALAD>0 S X=GMTSALAD D REGDT4^GMTSU S GMTSALAD=X
S GMTSAU=$$GET1^DIQ(120.86,+($G(DFN)),2,"I")
S GMTSALAW=$$GET1^DIQ(200,(+GMTSAU_","),.01,"E",,"GMTSALG3")
S GMTSALAT=$$GET1^DIQ(200,(+GMTSAU_","),20.3)
S:$D(GMTSALG3) (GMTSALAW,GMTSALAT)=""
Q
AUTOV ; Autoverify
S GMTSAV=0,GMTSALNM=$P(GMTSAL(II,JJ,KK,L),U),GMTSAFN=$G(^GMR(120.8,GMTSALNM,0))
I $P(GMTSAFN,U,18)="",$P(GMTSAFN,U,16)=1 S GMTSAV=1
Q
TITLE ; Print title
D CKP^GMTSUP Q:$D(GMTSQIT)
I $D(GMTSPNF) W ?21,TITLE,!
E W ?21,"Title: ",TITLE,!
Q
TEXT ; Setup for print of allergy comments
W ?31,CD D CKP^GMTSUP Q:$D(GMTSQIT)
K ^UTILITY($J,"W") S GMTSLN=0 F S GMTSLN=$O(^GMR(120.8,GMTSALNM,26,CCC,2,GMTSLN)) Q:'GMTSLN S GMTSPRT=^GMR(120.8,GMTSALNM,26,CCC,2,GMTSLN,0) D FORMAT
I $D(^UTILITY($J,"W")) F GMTSLN=1:1:^UTILITY($J,"W",DIWL) D LINE Q:$D(GMTSQIT)
K ^UTILITY($J,"W")
Q:'GMTSLN
W ! Q
FORMAT ; Formats each line
S DIWL=3,DIWR=80,DIWF="C58",X=GMTSPRT D ^DIWP
Q
LINE ; Writes formatted lines of text
D CKP^GMTSUP Q:$D(GMTSQIT) W !,?24,^UTILITY($J,"W",DIWL,GMTSLN,0)
Q
SIGBLK(GMTSALF) ; Signature block
Q:+GMTSALF'>0 N GMTSSB,GMTSST,GMTSSN S GMTSSB=$$GET1^DIQ(200,(+GMTSALF_","),20.2),GMTSST=$$GET1^DIQ(200,(+GMTSALF_","),20.3),GMTSSN=$$GET1^DIQ(200,(+GMTSALF_","),.01)
D CKP^GMTSUP Q:$D(GMTSQIT) W !!,?24,"Originator: ",$S(GMTSSB'="":GMTSSB,1:GMTSSN)
D CKP^GMTSUP Q:$D(GMTSQIT) W:$L(GMTSST) !,?24,"Title: ",GMTSST
Q

View File

@ -0,0 +1,75 @@
C0QHF ; GPL - Health Factor Utility Routines ;9/02/11 17:05
;;0.1;C0Q;nopatch;noreleasedate;Build 19
;Copyright 2011 George Lilly. Licensed under the terms of the GNU
;General Public License See attached copy of the License.
;
;This program is free software; you can redistribute it and/or modify
;it under the terms of the GNU General Public License as published by
;the Free Software Foundation; either version 2 of the License, or
;(at your option) any later version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License along
;with this program; if not, write to the Free Software Foundation, Inc.,
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
;
Q
;
; these routines are for quick lookups on HEALTH FACTOR and V HEALTH FACTOR
; files...
;
; from the DD:
;STANDARD DATA DICTIONARY #9000010.23 -- V HEALTH FACTORS FILE
;STORED IN ^AUPNVHF( (6744 ENTRIES)
;CROSS REFERENCED BY: PATIENT NAME(AATOO), HEALTH FACTOR(AATOO1), VISIT(AD),
; VISIT(AV10), HEALTH FACTOR(B), PATIENT NAME(C)
;
;STANDARD DATA DICTIONARY #9999999.64 -- HEALTH FACTORS FILE
;STORED IN ^AUTTHF( (8656 ENTRIES)
;CROSS REFERENCED BY: CATEGORY(AC), ENTRY TYPE(AD), FACTOR(B), SYNONYM(D)
;
HFYN(DFN,C0QHF) ; EXTRINSIC RETURNS 1 (YES) OR 0 (NO) IF A PATIENT
; HAS A HEALTH FACTOR
N ZI,ZJ,ZR
S ZI=$O(^AUTTHF("B",C0QHF,"")) ; HEALTH FACTOR IEN
I $D(^AUPNVHF("AA",DFN,ZI)) S ZR=1
E S ZR=0
Q ZR
;
HFCAT(RTN,DFN,C0QHFCAT) ; C0QFHCAT IS A HEALTH FACTOR CATEGORY
; RTN IS PASSED BY REFERENCE AND RETURNS AN ARRAY OF HEALTH FACTORS
; THAT THE PATIENT HAS IN THE CATEGORY. RETURNS NULL IF NONE
; FORMAT RNT(HEALTH FACTOR IEN,HEALTH FACTOR NAME)=""
N ZI
S ZI=$O(^AUTTHF("B",C0QHFCAT,"")) ; HEALTH FACTOR CATEGORY IEN
N C0QN,C0QO
S C0QO=$NA(^AUPNVHF("AA",DFN)) ; ALL THE PATIENT'S HEALTH FACTORS
S C0QN=$NA(^AUTTHF("AC",ZI)) ; ALL HEALTH FACTORS IN THIS CATEGORY
D UNITY^C0QSET("C0QR",C0QN,C0QO) ; THE DIFFERENCE
K RTN ; CLEAR THE RETURN ARRAY
N ZJ S ZJ=""
F S ZJ=$O(C0QR(1,ZJ)) Q:ZJ="" D ; FOR ALL HEALTH FACTOR MATCHES
. S RTN(ZJ,$P(^AUTTHF(ZJ,0),"^",1))=""
Q
;
HFLCAT(RTN,C0QHFCAT) ; RETURNS A LIST OF PATIENTS WHO HAVE A HEALTH FACTOR
; IN THE C0QHFCAT CATEGORY. RTN IS PASSED BY REFERENCE
; THIS WILL BE HARD TO DO WITHOUT SOME NEW INDEXES
Q
;
HFLPAT(RTN,C0QHF) ; RETURNS A LIST OF PATIENTS WHO HAVE A SPECIFIC HEALTH
; FACTOR. RTN IS PASSED BY REFERENCE
; THIS ONE ALSO WILL BE HARD TO DO QUICKLY WITHOUT A NEW INDEX
Q
;
INDEXES(DDREF) ;PRINT THE INDEXES ACTUALLY ON FILE DDREF
; IE D INDEXES($NA(^DD))
N ZI
S ZI="A"
F S ZI=$O(@DDREF@(ZI)) Q:ZI="" W !,ZI
Q
;

View File

@ -0,0 +1,52 @@
C0QIMMUN ;Prep Immunization Order data for HL7 Message creation ;
;;0.1;C0Q;nopatch;noreleasedate;Build 19
; ^XTMP("C0QIMMUN",0)=purge date^create date
; ^XTMP("C0QIMMUN",order_date,order#,item_name)=item_value
; ^XTMP("C0QIMMUN","LASTORDR")=last order processed
FIND ; Find the next set of immunization orders
N X1,X2,X,%,%DT,%H,%T,NOW,ORDER,LASTORDR,SUBSC,DIR
S LASTORDR=+$G(^XTMP("C0QIMMUN","LASTORDR"))
W !,"The ""Last Order"" from which to begin checking for Immunization orders is: ",LASTORDR
S DIR("A")="Do you want to reset that value"
S DIR(0)="Y",DIR("B")="NO" D ^DIR D:Y=1
. S DIR("A")="What value shall be used?"
. S DIR(0)="NO",DIR("B")=LASTORDR D ^DIR
. W:Y'>0 !,"We'll skip reseting it then."
. D:Y>0
. . S LASTORDR=+Y
. . L +^XTMP("C0QIMMUN")
. . S X1=DT,X2=365 D C^%DTC
. . S ^XTMP("C0QIMMUN",0)=X_U_DT
. . S ^XTMP("C0QIMMUN","LASTORDR")=LASTORDR
. . L -^XTMP("C0QIMMUN")
. . Q
. Q
S DIR("A")="Ready to prep more immunization orders for HL7 messages"
S DIR(0)="Y",DIR("B")="YES" D ^DIR Q:Y'=1
L +^XTMP("C0QIMMUN")
I '$D(^XTMP("C0QIMMUN",0)) D
. S X1=DT,X2=365 D C^%DTC
. S ^XTMP("C0QIMMUN",0)=X_U_DT
. S ^XTMP("C0QIMMUN","LASTORDR")=0
S ORDER=^XTMP("C0QIMMUN","LASTORDR")
F S ORDER=$O(^OR(100,ORDER)) Q:ORDER'>0 D
. S LASTORDR=ORDER
. D:$D(^OR(100,ORDER,4.5,"ID","ORZ HL7")) GOTONE
. Q
S ^XTMP("C0QIMMUN","LASTORDR")=LASTORDR
W !,"Done",!,"Last Order processed: ",LASTORDR,!
L -^XTMP("C0QIMMUN")
Q
GOTONE ; Take the order number and move the relevant HL7 information into ^XTMP
S NOW=$P(^OR(100,ORDER,0),U,7)
S ^XTMP("C0QIMMUN",NOW,ORDER,"PATIENT")=$P(^OR(100,ORDER,0),U,2)
S ^XTMP("C0QIMMUN",NOW,ORDER,"LOCATION")=$P(^OR(100,ORDER,0),U,10)
S ^XTMP("C0QIMMUN",NOW,ORDER,"ORDEREDBY")=$P(^OR(100,ORDER,0),U,6)
S ENTRY=0 F S ENTRY=$O(^OR(100,ORDER,4.5,ENTRY)) Q:ENTRY'>0 D
. S SUBSC=$P($G(^OR(100,ORDER,4.5,ENTRY,0)),U,4)
. Q:'$L(SUBSC)
. I SUBSC'="TIME" S ^XTMP("C0QIMMUN",NOW,ORDER,SUBSC)=^OR(100,ORDER,4.5,ENTRY,1)
. E S X=^OR(100,ORDER,4.5,ENTRY,1),%DT="TS" D ^%DT S ^XTMP("C0QIMMUN",NOW,ORDER,SUBSC)=Y
. Q
S ^XTMP("C0QIMMUN",NOW,ORDER,"ORDERTEXT")=$G(^OR(100,ORDER,8,1,.1,1,0))
Q

View File

@ -0,0 +1,352 @@
C0QMAIN ; GPL - Quality Reporting Main Processing ;10/13/10 17:05
;;0.1;C0Q;nopatch;noreleasedate;Build 19
;Copyright 2009 George Lilly. Licensed under the terms of the GNU
;General Public License See attached copy of the License.
;
;This program is free software; you can redistribute it and/or modify
;it under the terms of the GNU General Public License as published by
;the Free Software Foundation; either version 2 of the License, or
;(at your option) any later version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License along
;with this program; if not, write to the Free Software Foundation, Inc.,
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
;
Q
;
C0QQFN() Q 1130580001.101 ; FILE NUMBER FOR C0Q QUALITY MEASURE FILE
C0QMFN() Q 1130580001.201 ; FILE NUMBER FOR C0Q MEASUREMENT FILE
C0QMMFN() Q 1130580001.2011 ; FN FOR MEASURE SUBFILE
C0QMMNFN() Q 1130580001.20111 ; FN FOR NUMERATOR SUBFILE
C0QMMDFN() Q 1130580001.20112 ; FN FOR DENOMINATOR SUBFILE
RLSTFN() Q 810.5 ; FN FOR REMINDER PATIENT LIST FILE
RLSTPFN() Q 810.53 ; FN FOR REMINDER PATIENT LIST PATIENT SUBFILE
C0QALFN() Q 1130580001.311 ; FILE NUMBER FOR C0Q PATIENT LIST PATIENT SUBFILE ;
EXPORT ; EXPORT ENTRY POINT FOR CCR
; Select a patient.
N C0QMS,C0QM,C0QMIEN,C0QNA,C0QNORD
S C0QNORD=3 ; WE WANT DENOMINATORS USE 1 FOR NUMERATORS
S DIC=$$C0QMFN,DIC(0)="AEMQ" D ^DIC
I Y<1 Q ; EXIT
S C0QMS=$P(Y,U,1) ; SET THE MEASURE SET
S DIC=$$C0QQFN,DIC(0)="AEMQ" D ^DIC
I Y<1 Q ; EXIT
S C0QM=$P(Y,U,1) ; SET THE MEASURE IEN
N C0QMN S C0QMN=$P(Y,U,2) ; SET THE MEASURE NAME
S C0QMIEN=$O(^C0Q(201,C0QMS,5,"B",C0QM,""))
S C0QNA=$NA(^C0Q(201,C0QMS,5,C0QMIEN,C0QNORD,"B"))
N ZI S ZI=""
F S ZI=$O(@C0QNA@(ZI)) Q:ZI="" D ;
. W !,ZI
. N ONAME S ONAME=C0QMN_"_"_ZI_"_CCR_V1_0_0.xml"
. D XPAT^C0CCCR(ZI,,,ONAME) ; EXPORT TO A FILE
Q
;
NBYP ; ENTRY POINT FOR COMMAND LINE BY PATIENT MEASURE LISTING
;
S DIC=$$C0QMFN,DIC(0)="AEMQ" D ^DIC
I Y<1 Q ; EXIT
N MSIEN S MSIEN=+Y
W !,"NUMERATOR PATIENT LIST",!
N C0QPAT
D PATS(.C0QPAT,MSIEN,"N") ; GET THE NUMERATOR PATIENT LIST
I $D(C0QPAT) D ; LIST RETURNED
. ;
Q
;
DBYP ; ENTRY POINT FOR COMMAND LINE BY PATIENT MEASURE LISTING
;
S DIC=$$C0QMFN,DIC(0)="AEMQ" D ^DIC
I Y<1 Q ; EXIT
N MSIEN S MSIEN=+Y
N C0QPAT
W !,"DENOMINATOR PATIENT LIST",!
D PATS(.C0QPAT,MSIEN,"D") ; GET THE NUMERATOR PATIENT LIST
I $D(C0QPAT) D ; LIST RETURNED
. ;
. ;
Q
;
ENEXP ; EXTERNAL MENU ENTRY POINT FOR EXP
;
S DIC=$$C0QMFN,DIC(0)="AEMQ" D ^DIC
I Y<1 Q ; EXIT
N MSIEN S MSIEN=+Y
D EXP(MSIEN)
Q
;
EXP(MSET,NOEX) ; EXPORT ALL PATIENTS FOR MEASURE SET IEN MSET
; ALSO, WRITE OUT THE BY PATIENT MEASURE TEXT FILE
; IF NOEX=1, THEN ONLY THE MEASURE TEXT FILE GETS WRITTEN, NO EXPORTS ARE
; DONE
I '$D(NOEX) S NOEX=0
N ZQI,ZARY,ZFN,ODIR
S ZQI=""
D PATS(.ZARY,MSET,"D",1)
S ZFN="MEASURES-BY-PATIENT.txt"
S ODIR=^TMP("C0CCCR","ODIR") ; OUTPUT DIRECTORY
S GARY=$NA(^TMP("C0Q",$J))
K @GARY
M @GARY=ZARY
S GARY1=$NA(@GARY@(1))
N ZY
S ZY=$$OUTPUT^C0CXPATH(GARY1,ZFN,ODIR)
W !,ZY
I NOEX=1 Q ; DO NOT EXPORT
F S ZQI=$O(ZARY(ZQI)) Q:ZQI="" D ; FOR EACH PATIENT
. D XPAT^C0CCCR(+ZARY(ZQI)) ;
Q
;
PATS(ZRTN,MSIEN,NORD,QT) ; BUILDS A LIST OF PATIENTS AND THEIR MEASURES
; FOR MEASURE SET MSET. NORD="N" (DEFAULT) MEANS NUMERATOR PATIENTS
; NORD="D" MEANS DENOMINATOR PATIENTS
; QT=1 MEANS QUIET
I $G(QT)'=1 S QT=0
N ZI,ZJ,ZK,ZIDX,ZN,ZM
S ZN=0 ; COUNT OF PATIENTS
S ZI=""
; GOING TO USE THE NUMERATOR BY PATIENT INDEX
I '$D(NORD) S NORD="N"
I '((NORD="N")!(NORD="D")) S NORD="N"
I NORD="N" S ZIDX=$NA(^C0Q(201,"ANBYP"))
E S ZIDX=$NA(^C0Q(201,"ADBYP"))
F S ZI=$O(@ZIDX@(ZI)) Q:ZI="" D ; FOR EACH PATIENT
. I $O(@ZIDX@(ZI,MSIEN,""))'="" D ; IF PATIENT IS IN THIS SET
. . I 'QT W !,$$GET1^DIQ(2,ZI_",",.01) ;PATIENT NAME
. . S ZN=ZN+1 ; INCREMENT PATIENT COUNT
. . S ZRTN(ZN)=ZI
. E Q ; NEXT PATIENT
. S (ZJ,ZK)=""
. F S ZJ=$O(@ZIDX@(ZI,MSIEN,ZJ)) Q:ZJ="" D ; FOR EACH MEASURE
. . ;S ZL=$O(@ZIDX@(ZI,MSIEN,ZJ,"")) ; MEASURE IS FOURTH
. . S ZK=""
. . S ZK=$$GET1^DIQ($$C0QMMFN,ZJ_","_MSIEN_",",.01,"I")
. . ;W !,"ZK:",ZK," ZJ:",ZJ," ZI",ZI,!
. . S ZM=$$GET1^DIQ($$C0QQFN,ZK_",",.01) ; MEASURE NAME
. . I 'QT W " ",ZM
. . S ZRTN(ZN)=ZRTN(ZN)_" "_ZM
Q
;
EN ; ENTRY POINT FOR COMMAND LINE AND MENU ACCESS TO C0QRPC
;
S DIC=$$C0QMFN,DIC(0)="AEMQ" D ^DIC
I Y<1 Q ; EXIT
N MSIEN S MSIEN=+Y
;D C0QRPC(.G,MSIEN)
D UPDATE^C0QUPDT(.G,MSIEN)
Q
;
EN2 ; SUMMARY ENTRY POINT FOR COMMAND LINE AND MENU ACCESS TO C0QRPC
;
S DIC=$$C0QMFN,DIC(0)="AEMQ" D ^DIC
I Y<1 Q ; EXIT
N MSIEN S MSIEN=+Y
S C0QSUM=1
D C0QRPC(.G,MSIEN)
; iterate over the measures
S MEASURE=0
F S MEASURE=$O(^C0Q(201,MSIEN,5,MEASURE)) Q:MEASURE'>0 D
. S NUMER=0,DENOM=0
. ; now count the numerator patients
. S P=0 F S P=$O(^C0Q(201,MSIEN,5,MEASURE,1,P)) Q:P'>0 S NUMER=NUMER+1
. S $P(^C0Q(201,MSIEN,5,MEASURE,2),U)=NUMER
. ; and count the denominator patients
. S P=0 F S P=$O(^C0Q(201,MSIEN,5,MEASURE,3,P)) Q:P'>0 S DENOM=DENOM+1
. Q:DENOM=0
. ; and stuff the values
. S $P(^C0Q(201,MSIEN,5,MEASURE,4),U,1,2)=DENOM_U_$J(100*NUMER/DENOM,0,0)
. Q
Q
;
C0QRPC(RTN,MSET,FMT,NOPURGE) ; RPC FORMAT
; MSET IS THE NAME OR IEN OF THE MEASURE SET
; RTN IS THE RETURN ARRAY OF THE RESULTS PASSED BY REFERENCE
; FMT IS THE FORMAT OF THE OUTPUT - "ARRAY" OR "HTML" OR "XML"
; NOTE: ARRAY IS DEFAULT AND THE OTHERS ARE NOT IMPLEMENTED YET
; IF NOPURGE IS 1, PATIENT LISTS WILL NOT BE DELETED BEFORE ADDING
; IF NOPURGE IS 0 OR OMITTED, PATIENT LISTS WILL BE DELETED THEN ADDED
;W !,"LOOKING FOR MEASURE SET ",MSET,!
N ZI S ZI=""
N C0QM ; FOR HOLDING THE MEASURES IN THE SET
D LIST^DIC($$C0QMMFN,","_MSET_",",".01I") ; GET ALL THE MEASURES
D DELIST("C0QM")
N ZII S ZII=0
F S ZII=$O(C0QM(ZII)) Q:+ZII=0 D ; FOR EACH MEASURE
. D CLEARMEA(MSET,ZII) ; FIRST CLEAR OUT THE MEASURE
K C0QM
D CLEAN^DILF
D LIST^DIC($$C0QMMFN,","_MSET_",",".01I") ; GET ALL THE MEASURES AGAIN
D DELIST("C0QM")
F S ZII=$O(C0QM(ZII)) Q:ZII="" D ; FOR EACH MEASURE
. S ZI=$P(C0QM(ZII),U,1) ; IEN OF THE MEASURE IN THE C0Q QUALITY MEAS FILE
. ;W $$GET1^DIQ($$C0QQFN,ZI_",","DISPLAY NAME"),!
. ;N C0QNL,C0QDL ;NUMERATOR AND DENOMINATOR LIST POINTERS
. ;W !,"MEASURE: ",$$GET1^DIQ($$C0QQFN,ZI_",",.01),! ; PRINT THE MEASURE NAME
. ; FOLLOW THE POINTERS TO THE C0Q QUALITYM MEASURE FILE AND GET LIST PTRS
. S C0QNL=$$GET1^DIQ($$C0QQFN,ZI_",",1,"I") ; NUMERATOR POINTER
. I C0QNL="" D ; CHECK ALTERNATE LIST
. . S C0QNL=$$GET1^DIQ($$C0QQFN,ZI_",",1.1,"I") ; NUMERATOR POINTER
. . I C0QNL'="" S C0QNALT=1
. S C0QDL=$$GET1^DIQ($$C0QQFN,ZI_",",2,"I") ; DENOMINATOR POINTER
. I C0QDL="" D ; CHECK ALTERNATE LIST
. . S C0QDL=$$GET1^DIQ($$C0QQFN,ZI_",",2.1,"I") ; DENOMINATOR POINTER
. . I C0QDL'="" S C0QDALT=1
. ; NOW FOLLOW THE LIST POINTERS TO THE REMINDER PATIENT LIST FILE
. ;W "NUMERATOR: ",$$GET1^DIQ($$RLSTFN,C0QNL_",","NAME"),!
. ; FIRST PROCESS THE NUMERATOR
. K ^TMP("DILIST",$J)
. N C0QUFN ; FILE NUMBER TO USE
. I $G(C0QNALT)=1 S C0QUFN=$$C0QALFN()
. E S C0QUFN=$$RLSTPFN
. D LIST^DIC(C0QUFN,","_C0QNL_",",".01I") ; GET THE LIST OF PATIENTS
. ;D DELIST("G") ;
. ;I $D(G) ZWR G
. K C0QNUMP
. S NCNT=$O(^TMP("DILIST",$J,"ID",""),-1) ; NUMERATOR COUNT
. N ZJ S ZJ=""
. F S ZJ=$O(^TMP("DILIST",$J,"ID",ZJ)) Q:ZJ="" D ;
. . S ZDFN=^TMP("DILIST",$J,"ID",ZJ,.01)
. . S C0QNUMP("N",ZJ,ZDFN)=""
. ;I '$G(C0QSUM) ZWR ^TMP("DILIST",$J,1,*) ; LIST THE PATIENT NAMES
. D ADDPATS(MSET,ZII,"C0QNUMP")
. ; NEXT PROCESS THE DENOMINATOR
. ;W "DENOMINATOR: ",$$GET1^DIQ($$RLSTFN,C0QDL_",","NAME"),!
. K ^TMP("DILIST",$J)
. I $G(C0QDALT)=1 S C0QUFN=$$C0QALFN()
. E S C0QUFN=$$RLSTPFN
. D LIST^DIC(C0QUFN,","_C0QDL_",",".01I") ; GET THE LIST OF PATIENTS
. ;D DELIST("G")
. ;I $D(G) ZWR G
. ;S ZJ=""
. S DCNT=$O(^TMP("DILIST",$J,"ID",""),-1) ; DENOMONIATOR COUNT
. K C0QDEMP
. F S ZJ=$O(^TMP("DILIST",$J,"ID",ZJ)) Q:ZJ="" D ;
. . S ZDFN=^TMP("DILIST",$J,"ID",ZJ,.01)
. . S C0QDEMP("D",ZJ,ZDFN)=""
. D ADDPATS(MSET,ZII,"C0QDEMP")
. ;I $G(C0QSUM)'=1 ZWR ^TMP("DILIST",$J,1,*) ; LIST THE PATIENT NAMES
. ;E D ;
. ;. W "NUM CNT: ",NCNT
. ;. W " DEN CNT: ",DCNT,!
Q
;
CLEARMEA(MSET,MEAS) ; DELETE AND THEN RECREATE AS EMPTY THE
; MEASURE MEAS IN MEASURE SET IEN MSET
;
N C0QFDA,MFN,MEASURE
S MFN=$$C0QMMFN() ; FILE NUMBER FOR MEASURE SUBFILE
D CLEAN^DILF
S MEASURE=$$GET1^DIQ(MFN,MEAS_","_MSET_",",.01,"I") ; MEASURE POINTER
D CLEAN^DILF
K ZERR
S C0QFDA(MFN,MEAS_","_MSET_",",.01)="@" ; GET READY TO DELETE THE MEASURE
D FILE^DIE(,"C0QFDA","ZERR") ; KILL THE SUBFILE
I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST, INVOKE THE ERROR TRAP IF TASKED
;. W "ERROR",!
;. ZWR ZERR
;. B
K C0QFDA
S C0QFDA(MFN,"+1,"_MSET_",",.01)=MEASURE ; GET READY TO RECREATE THE SUBFILE
D UPDIE ; CREATE THE SUBFILE
Q
;
ADDPATS(MSET,MEAS,PATS) ;ADD PATIENTS TO NUMERATOR AND DENOMINATOR
; OF MEASURE SET IEN MSET MEASURE IEN MEAS
; PATS IS OF THE FORM @PATS@("N",X,DFN)="" AND @PATS@("D",X,DFN)=""
; WHERE N IS FOR NUMERATOR AND D IS FOR DENOMINATOR AND X 1..N
; IF PATIENTS ARE ALREADY THERE, THEY WILL NOT BE ADDED AGAIN
N C0QI,C0QJ
N C0QFDA
S C0QI=""
F S C0QI=$O(@PATS@("N",C0QI)) Q:C0QI="" D ; FOR EACH NUMERATOR PATIENT
. S C0QFDA($$C0QMMNFN,"?+"_C0QI_","_MEAS_","_MSET_",",.01)=$O(@PATS@("N",C0QI,""))
;W "ADDING NUMERATOR",!
;I $D(C0QFDA) ZWR C0QFDA
I $D(C0QFDA) D UPDIE
K C0QFDA
S C0QI=""
F S C0QI=$O(@PATS@("D",C0QI)) Q:C0QI="" D ; FOR EACH NUMERATOR PATIENT
. S C0QFDA($$C0QMMDFN,"?+"_C0QI_","_MEAS_","_MSET_",",.01)=$O(@PATS@("D",C0QI,""))
;W "ADDING DENOMINATOR",!
;I $D(C0QFDA) ZWR C0QFDA
I $D(C0QFDA) D UPDIE
Q
;
DELIST(RTN) ; DECODES ^TMP("DILIST",$J) INTO
; @RTN@(IEN)=INTERNAL VALUE^EXTERNAL VALUE
N ZI,IV,EV,ZDI,ZIEN
S ZI=""
S ZDI=$NA(^TMP("DILIST",$J))
K @RTN
F S ZI=$O(@ZDI@(1,ZI)) Q:ZI="" D ;
. S EV=@ZDI@(1,ZI) ;EXTERNAL VALUE
. S IV=$G(@ZDI@("ID",ZI,.01)) ; INTERNAL VALUE
. S ZIEN=@ZDI@(2,ZI) ; IEN
. S @RTN@(ZIEN)=IV_"^"_EV
Q
;
DELPATS(MSET,MEAS,NDEL) ; DELETE PATIENTS FROM NUMERATOR AND DENOMINATOR
; FOR A MEASURE (ONLY AFFECTS THE C0Q MEASURES FILE)
; MSET IS THE IEN OF THE MEASURE SET
; MEAS IS THE IEN OF THE MEASURE
; NDEL IS A LIST OF PATIENTS TO NOT DELETE (NOT IMPLEMENTED YET)
; IN THE FORM @NDEL@("N",IEN,DFN)="" FOR NUMERATOR PATIENTS
; AND @NDEL@("D",IEN,DFN)="" FOR DENOMINATOR PATIENTS WHERE IEN IS
; THE IEN OF THE PATIENT RECORD IN THE SUBFILE
; THIS FEATURE WILL ALLOW EFFICIENCIES FOR LONG PATIENT LISTS
; IN THAT PATIENTS THAT ARE GOING TO BE ADDED ARE NOT FIRST DELETED
N C0QI,C0QJ
D LIST^DIC($$C0QMMFN,","_MSET_",")
K C0QFDA
;ZWR ^TMP("DILIST",$J,*)
;ZWR ^TMP("DIERR",$J,*)
;D
Q
;
UPDIE ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS
K ZERR
D CLEAN^DILF
D UPDATE^DIE("","C0QFDA","","ZERR")
I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST, INVOKE THE ERROR TRAP IF TASKED
;. W "ERROR",!
;. ZWR ZERR
;. B
K C0QFDA
Q
;
QUE ;QUE THE RUN OF THE PATIENT LISTS AND THE BUILD THE LISTS OF THE PATIENTS
;AND THEIR MEASURES
S MSIEN=$$GET^XPAR("DIV."_$P($$SITE^VASITE(),U,2),"C0Q MEASUREMENT TO USE")
N ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE
S ZTDESC="CREATE PATIENT LIST"
S ZTRTN="RUN^C0QMAIN"
S ZTSAVE("MSIEN")=""
S ZTIO=""
S ZTDTH=$$NOW^XLFDT
D ^%ZTLOAD
Q
;
RUN ; DO THE REAL WORK
I '$D(MSIEN) S MSIEN=$$GET^XPAR("DIV."_$P($$SITE^VASITE(),U,2),"C0Q MEASUREMENT TO USE")
S BEG=$P(^C0Q(201,MSIEN,4),U,3) ;Begin date
S END=$P(^C0Q(201,MSIEN,4),U,4) ;End date
S PATCREAT="N" ;Secure list - N=No
S PLISTPUG="N" ;Purge list after 5 years - N=No
S PXRMDPAT=0 ;Include deceased patients - N=No
S PXRMTPAT=0 ;Include test patients - N=No
S PXRMNODE="PXRMRULE" ;Node in ^TMP($J,"PXRMRULE"
N ZI S ZI=""
F S ZI=$O(^C0Q(201,MSIEN,5,"B",ZI)) Q:ZI'>0 D ; LOOP THROUGH EACH QM
. S PXRMLSTN=+$P(^C0Q(101,ZI,0),U,2) ; NUMERATOR MEASURE
. S PXRMLSTD=+$P(^C0Q(101,ZI,0),U,3) ; DENOMINATOR MEASURE
. S PXRMRULN=+$P(^PXRMXP(810.5,PXRMLSTN,0),U,6) ; RULES FOR THE LIST
. S PXRMRULD=+$P(^PXRMXP(810.5,PXRMLSTD,0),U,6)
. D RUN^PXRMLCR(PXRMRULD,PXRMLSTD,PXRMNODE,BEG,END,PXRMDPAT,PXRMTPAT)
. D RUN^PXRMLCR(PXRMRULN,PXRMLSTN,PXRMNODE,BEG,END,PXRMDPAT,PXRMTPAT)
D C0QRPC(.G,MSIEN)
Q

View File

@ -0,0 +1,210 @@
C0QMAIN ; GPL - Quality Reporting Main Processing ;10/13/10 17:05
;;0.1;C0Q;nopatch;noreleasedate;
;Copyright 2009 George Lilly. Licensed under the terms of the GNU
;General Public License See attached copy of the License.
;
;This program is free software; you can redistribute it and/or modify
;it under the terms of the GNU General Public License as published by
;the Free Software Foundation; either version 2 of the License, or
;(at your option) any later version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License along
;with this program; if not, write to the Free Software Foundation, Inc.,
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
;
Q
;
C0QQFN() Q 1130580001.101 ; FILE NUMBER FOR C0Q QUALITY MEASURE FILE
C0QMFN() Q 1130580001.201 ; FILE NUMBER FOR C0Q MEASUREMENT FILE
C0QMMFN() Q 1130580001.2011 ; FN FOR MEASURE SUBFILE
C0QMMNFN() Q 1130580001.20111 ; FN FOR NUMERATOR SUBFILE
C0QMMDFN() Q 1130580001.20112 ; FN FOR DENOMINATOR SUBFILE
RLSTFN() Q 810.5 ; FN FOR REMINDER PATIENT LIST FILE
RLSTPFN() Q 810.53 ; FN FOR REMINDER PATIENT LIST PATIENT SUBFILE
;
NBYP ; ENTRY POINT FOR COMMAND LINE BY PATIENT MEASURE LISTING
;
S DIC=$$C0QMFN,DIC(0)="AEMQ" D ^DIC
I Y<1 Q ; EXIT
N MSIEN S MSIEN=+Y
W !,"NUMERATOR PATIENT LIST",!
N C0QPAT
D PATS(.C0QPAT,MSIEN,"N") ; GET THE NUMERATOR PATIENT LIST
I $D(C0QPAT) D ; LIST RETURNED
.
. ;
Q
;
DBYP ; ENTRY POINT FOR COMMAND LINE BY PATIENT MEASURE LISTING
;
S DIC=$$C0QMFN,DIC(0)="AEMQ" D ^DIC
I Y<1 Q ; EXIT
N MSIEN S MSIEN=+Y
N C0QPAT
W !,"DENOMINATOR PATIENT LIST",!
D PATS(.C0QPAT,MSIEN,"D") ; GET THE NUMERATOR PATIENT LIST
I $D(C0QPAT) D ; LIST RETURNED
. ;
. ;
Q
;
PATS(ZRTN,MSIEN,NORD,PAT,EFORM) ; BUILDS A LIST OF PATIENTS AND THEIR MEASURES
; FOR MEASURE SET MSIEN. NORD="N" (DEFAULT) MEANS NUMERATOR PATIENTS
; NORD="D" MEANS DENOMINATOR PATIENTS
; PAT IS THE IEN OF A SINGLE PATIENT FOR PROCESSING. IF PAT IS OMMITED OR "*",
; ALL PATIENTS IN THE MEASURE SET NUM/DENOM WILL BE PROCESSED
; EFORM=1 MEANS ZRTN IS IN "EXTERNAL FORMAT" - THIS IS FOR USE AS AN RPC
; EXTERNAL FORMAT IS AN ARRAY OF STRINGS
; ZRTN(x)=DFN^NAME^MEASURE IEN^MEASURE NAME
; ONE FOR EACH MEASURE FOR EACH PATIENT IN THE NUMERATOR/DENOMINATOR
; EFORM=0 (DEFAULT) MEANS "INTERNAL FORMAT" - THIS IS FOR MUMPS CALLS
; ZRTN(DFN,MEASURE IEN)="" IT IS A PAIR OF POINTERS IN INDEX FORMAT
; ONE FOR EACH MEASURE FOR EACH PATIENT IN THE NUMERATOR/DENOMINATOR
;
N ZI,ZJ,ZK,ZIDX
S ZI=""
; GOING TO USE THE NUMERATOR BY PATIENT INDEX
I '$D(NORD) S NORD="N"
I '((NORD="N")!(NORD="D")) S NORD="N"
I NORD="N" S ZIDX=$NA(^C0Q(201,"ANBYP"))
E S ZIDX=$NA(^C0Q(201,"ADBYP"))
F S ZI=$O(@ZIDX@(ZI)) Q:ZI="" D ; FOR EACH PATIENT
. I $O(@ZIDX@(ZI,MSIEN,""))'="" D ; IF PATIENT IS IN THIS SET
. . W !,$$GET1^DIQ(2,ZI_",",.01) ;PATIENT NAME
. E Q ; NEXT PATIENT
. S (ZJ,ZK)=""
. F S ZJ=$O(@ZIDX@(ZI,MSIEN,ZJ)) Q:ZJ="" D ; FOR EACH MEASURE
. . ;S ZL=$O(@ZIDX@(ZI,MSIEN,ZJ,"")) ; MEASURE IS FOURTH
. . S ZK=""
. . S ZK=$$GET1^DIQ($$C0QMMFN,ZJ_","_MSIEN_",",.01,"I")
. . ;W !,"ZK:",ZK," ZJ:",ZJ," ZI",ZI,!
. . W " ",$$GET1^DIQ($$C0QQFN,ZK_",",.01) ; MEASURE NAME
Q
;
EN ; ENTRY POINT FOR COMMAND LINE AND MENU ACCESS TO C0QRPC
;
S DIC=$$C0QMFN,DIC(0)="AEMQ" D ^DIC
I Y<1 Q ; EXIT
N MSIEN S MSIEN=+Y
D C0QRPC(.G,MSIEN)
Q
;
C0QRPC(RTN,MSET,FMT,NOPURGE) ; RPC FORMAT
; MSET IS THE NAME OR IEN OF THE MEASURE SET
; RTN IS THE RETURN ARRAY OF THE RESULTS PASSED BY REFERENCE
; FMT IS THE FORMAT OF THE OUTPUT - "ARRAY" OR "HTML" OR "XML"
; NOTE: ARRAY IS DEFAULT AND THE OTHERS ARE NOT IMPLEMENTED YET
; IF NOPURGE IS 1, PATIENT LISTS WILL NOT BE DELETED BEFORE ADDING
; IF NOPURGE IS 0 OR OMITTED, PATIENT LISTS WILL BE DELETED THEN ADDED
W !,"LOOKING FOR MEASURE SET ",MSET,!
N ZI S ZI=""
N C0QM ; FOR HOLDING THE MEASURES IN THE SET
D LIST^DIC($$C0QMMFN,","_MSET_",",".01I") ; GET ALL THE MEASURES
D DELIST("C0QM")
N ZII S ZII=""
F S ZII=$O(C0QM(ZII)) Q:ZII="" D ; FOR EACH MEASURE
. S ZI=$P(C0QM(ZII),U,1) ; IEN OF THE MEASURE IN THE C0Q QUALITY MEAS FILE
. ;W $$GET1^DIQ($$C0QQFN,ZI_",","DISPLAY NAME"),!
. ;N C0QNL,C0QDL ;NUMERATOR AND DENOMINATOR LIST POINTERS
. W "MEASURE: ",$$GET1^DIQ($$C0QQFN,ZI_",",.01),! ; PRINT THE MEASURE NAME
. ; FOLLOW THE POINTERS TO THE C0Q QUALITY MEASURE FILE AND GET LIST PTRS
. S C0QNL=$$GET1^DIQ($$C0QQFN,ZI_",",1,"I") ; NUMERATOR POINTER
. S C0QDL=$$GET1^DIQ($$C0QQFN,ZI_",",2,"I") ; DENOMINATOR POINTER
. ; NOW FOLLOW THE LIST POINTERS TO THE REMINDER PATIENT LIST FILE
. W "NUMERATOR: ",$$GET1^DIQ($$RLSTFN,C0QNL_",","NAME"),!
. ; FIRST PROCESS THE NUMERATOR
. K ^TMP("DILIST",$J)
. D LIST^DIC($$RLSTPFN,","_C0QNL_",",".01I") ; GET THE LIST OF PATIENTS
. ;D DELIST("G") ;
. ;I $D(G) ZWR G
. K C0QNUMP
. N ZJ S ZJ=""
. F S ZJ=$O(^TMP("DILIST",$J,"ID",ZJ)) Q:ZJ="" D ;
. . S ZDFN=^TMP("DILIST",$J,"ID",ZJ,.01)
. . S C0QNUMP("N",ZJ,ZDFN)=""
. ZWR ^TMP("DILIST",$J,1,*) ; LIST THE PATIENT NAMES
. D ADDPATS(MSET,ZII,"C0QNUMP")
. ; NEXT PROCESS THE DENOMINATOR
. W "DENOMINATOR: ",$$GET1^DIQ($$RLSTFN,C0QDL_",","NAME"),!
. K ^TMP("DILIST",$J)
. D LIST^DIC($$RLSTPFN,","_C0QDL_",",".01I") ; GET THE LIST OF PATIENTS
. ;D DELIST("G")
. ;I $D(G) ZWR G
. ;S ZJ=""
. K C0QDEMP
. F S ZJ=$O(^TMP("DILIST",$J,"ID",ZJ)) Q:ZJ="" D ;
. . S ZDFN=^TMP("DILIST",$J,"ID",ZJ,.01)
. . S C0QDEMP("D",ZJ,ZDFN)=""
. D ADDPATS(MSET,ZII,"C0QDEMP")
. ZWR ^TMP("DILIST",$J,1,*) ; LIST THE PATIENT NAMES
Q
;
ADDPATS(MSET,MEAS,PATS) ;ADD PATIENTS TO NUMERATOR AND DENOMINATOR
; OF MEASURE SET IEN MSET MEASURE IEN MEAS
; PATS IS OF THE FORM @PATS@("N",X,DFN)="" AND @PATS@("D",X,DFN)=""
; WHERE N IS FOR NUMERATOR AND D IS FOR DENOMINATOR AND X 1..N
; IF PATIENTS ARE ALREADY THERE, THEY WILL NOT BE ADDED AGAIN
N C0QI,C0QJ
N C0QFDA
S C0QI=""
F S C0QI=$O(@PATS@("N",C0QI)) Q:C0QI="" D ; FOR EACH NUMERATOR PATIENT
. S C0QFDA($$C0QMMNFN,"?+"_C0QI_","_MEAS_","_MSET_",",.01)=$O(@PATS@("N",C0QI,""))
;W "ADDING NUMERATOR",!
;I $D(C0QFDA) ZWR C0QFDA
I $D(C0QFDA) D UPDIE
K C0QFDA
S C0QI=""
F S C0QI=$O(@PATS@("D",C0QI)) Q:C0QI="" D ; FOR EACH NUMERATOR PATIENT
. S C0QFDA($$C0QMMDFN,"?+"_C0QI_","_MEAS_","_MSET_",",.01)=$O(@PATS@("D",C0QI,""))
;W "ADDING DENOMINATOR",!
;I $D(C0QFDA) ZWR C0QFDA
I $D(C0QFDA) D UPDIE
Q
;
DELIST(RTN) ; DECODES ^TMP("DILIST",$J) INTO
; @RTN@(IEN)=INTERNAL VALUE^EXTERNAL VALUE
N ZI,IV,EV,ZDI,ZIEN
S ZI=""
S ZDI=$NA(^TMP("DILIST",$J))
K @RTN
F S ZI=$O(@ZDI@(1,ZI)) Q:ZI="" D ;
. S EV=@ZDI@(1,ZI) ;EXTERNAL VALUE
. S IV=$G(@ZDI@("ID",ZI,.01)) ; INTERNAL VALUE
. S ZIEN=@ZDI@(2,ZI) ; IEN
. S @RTN@(ZIEN)=IV_"^"_EV
Q
;
DELPATS(MSET,MEAS,NDEL) ; DELETE PATIENTS FROM NUMERATOR AND DENOMINATOR
; FOR A MEASURE (ONLY AFFECTS THE C0Q MEASURES FILE)
; MSET IS THE IEN OF THE MEASURE SET
; MEAS IS THE IEN OF THE MEASURE
; NDEL IS A LIST OF PATIENTS TO NOT DELETE (NOT IMPLEMENTED YET)
; IN THE FORM @NDEL@("N",IEN,DFN)="" FOR NUMERATOR PATIENTS
; AND @NDEL@("D",IEN,DFN)="" FOR DENOMINATOR PATIENTS WHERE IEN IS
; THE IEN OF THE PATIENT RECORD IN THE SUBFILE
; THIS FEATURE WILL ALLOW EFFICIENCIES FOR LONG PATIENT LISTS
; IN THAT PATIENTS THAT ARE GOING TO BE ADDED ARE NOT FIRST DELETED
N C0QI,C0QJ
D LIST^DIC($$C0QMMFN,","_MSET_",")
K C0QFDA
ZWR ^TMP("DILIST",$J,*)
ZWR ^TMP("DIERR",$J,*)
D
Q
;
UPDIE ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS
K ZERR
D CLEAN^DILF
D UPDATE^DIE("","C0QFDA","","ZERR")
I $D(ZERR) D ;
. W "ERROR",!
. ZWR ZERR
. B
K C0QFDA
Q
;

View File

@ -0,0 +1,180 @@
C0QPQRI ; GPL - GENERATES A PQRI XML FILE ;6/14/11 17:05
;;0.1;C0C;nopatch;noreleasedate;Build 19
;Copyright 2011 George Lilly. Licensed under the terms of the GNU
;General Public License See attached copy of the License.
;
;This program is free software; you can redistribute it and/or modify
;it under the terms of the GNU General Public License as published by
;the Free Software Foundation; either version 2 of the License, or
;(at your option) any later version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License along
;with this program; if not, write to the Free Software Foundation, Inc.,
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
;
Q
;
C0QQFN() Q 1130580001.101 ; FILE NUMBER FOR C0Q QUALITY MEASURE FILE
C0QMFN() Q 1130580001.201 ; FILE NUMBER FOR C0Q MEASUREMENT FILE
C0QMMFN() Q 1130580001.2011 ; FN FOR MEASURE SUBFILE
C0QMMNFN() Q 1130580001.20111 ; FN FOR NUMERATOR SUBFILE
C0QMMDFN() Q 1130580001.20112 ; FN FOR DENOMINATOR SUBFILE
RLSTFN() Q 810.5 ; FN FOR REMINDER PATIENT LIST FILE
RLSTPFN() Q 810.53 ; FN FOR REMINDER PATIENT LIST PATIENT SUBFILE
;
EN ;
; lets try some hard coded values for now
N C0QVAR
;
; first, the values that occur only once for the file
;
S C0QVAR("create-by")="RegistryA"
S C0QVAR("create-date")="12-10-2010"
S C0QVAR("create-time")="14:27"
S C0QVAR("file-number")=1
S C0QVAR("number-of-files")=9
S C0QVAR("version")="1.0"
;
; registry values
;
S C0QVAR("registry-id")=125789123
S C0QVAR("registry-name")="Model Registry"
S C0QVAR("submission-method")="C"
;
; values for each provider
;
S C0QVAR("npi")=12011989
S C0QVAR("tin")=387682321
S C0QVAR("waiver-signed")="Y"
S C0QVAR("encounter-from-date")="06-13-2010"
S C0QVAR("encounter-to-date")="12-10-2010"
;
; values for each measure group
;
S C0QVAR("ffs-patient-count")=2
S C0QVAR("group-eligible-instances")=30
S C0QVAR("group-reporting-rate")=66.67
S C0QVAR("group-reporting-rate-numerator")=20
;
; for each measure
;
S C0QVAR("pqri-measure-number")=128
S C0QVAR("eligible-instances")=100
S C0QVAR("meets-performance-instances")=18
S C0QVAR("performance-exclusion-instances")=0
S C0QVAR("performance-not-met-instances")=10
S C0QVAR("performance-rate")="90.00"
S C0QVAR("reporting-rate")="28.00"
;
;
N ZG,ZV
D GETTEMP^C0CMXP("ZG","PQRIXML") ; GET THE TEMPLATE
D BIND^C0CSOAP("ZV","C0QVAR","PQRIXML") ; GET BINDING VALUES
D MAP^C0CXPATH("ZG","ZV","ZO") ; MAP THE XML
D MEA("GG","GGG") ; GET THE MEASURES
N GB ; BUILD LIST
D QUEUE^C0CXPATH("GB","ZO",1,30) ; first part of pqri.xml
D QUEUE^C0CXPATH("GB","GG",2,$O(GG(""),-1)-1) ; the measures
D QUEUE^C0CXPATH("GB","ZO",$O(ZO(""),-1)-2,$O(ZO(""),-1)) ; LAST LINES
D BUILD^C0CXPATH("GB","GZO") ; BUILD THE XML
N ZI S ZI=0
F S ZI=$O(ZO(ZI)) Q:ZI="" D ; FOR EACH LINE OF XML
. W !,GZO(ZI) ; WRITE OUT THE XML
N GN,GN1,GD S GN=$NA(^TMP("C0QXML",$J))
K @GN
K ZO(0) ; GET RID OF LINE COUNT
M @GN=GZO
S GN1=$NA(@GN@(1))
S GD=$G(^TMP("C0CCCR","ODIR")) ; CONVENIENT OUTPUT DIRECTORY
W $$OUTPUT^C0CXPATH(GN1,"pqri.xml",GD)
K @GN ; DONT NEED IT ANYMORE
Q
;
INSERT(ZARY,ZONE) ; INSERT ONE MEASURE INTO THE ARRAY
;
;N GGG
S GGG="//submission/measure-group ID='C'/provider/pqri-measure" ;XPATH
D INSINNER^COCXPATH(ZARY,GGG,ZONE) ; INSERT XML
Q
;
PQRI(ZOUT,KEEP) ; RETURN THE NHIN ARRAY FOR THE PQRI XML TEMPLATE
;
N ZG
S ZG=$NA(^TMP("PQRIXML",$J))
K @ZG
D GETXML^C0CMXP(ZG,"PQRIXML") ; GET THE XML FROM C0C MISC XML
N C0CDOCID
S C0CDOCID=$$PARSE^C0CDOM(ZG,"PQRIXML") ; PARSE THE XML
D DOMO^C0CDOM(C0CDOCID,"/","ZOUT","GIDX","GARY",,"//submission") ; BLD ARRAYS
I '$G(KEEP) K GIDX,GARY ; GET RID OF THE ARRAYS UNLESS KEEP=1
Q
;
PROCESS(ZRSLT,ZXML,ZREDUCE,KEEP) ; PARSE AND RUN DOMO ON XML
; ZRTN IS PASSED BY REFERENCE
; ZXML IS PASSED BY NAME
; IF KEEP IS 1, GARY AND GIDX ARE NOT KILLED
;
N ZG
S ZG=$NA(^TMP("C0CXML",$J))
K @ZG
M @ZG=@ZXML
S C0CDOCID=$$PARSE^C0CDOM(ZG,"NHINARRAY") ; PARSE WITH MXML
D DOMO^C0CDOM(C0CDOCID,"/","ZRSLT","GIDX","GARY",,$G(ZREDUCE)) ; BLD ARRAYS
I '$G(KEEP) K GIDX,GARY,@ZG ; GET RID OF THE ARRAYS UNLESS KEEP=1
Q
;
GETFM(RTN,ZREC) ; GET THE QUALITY MEASURES ARRAY
;
I '$D(ZREC) S ZREC=7 ; OUTPATIENT CERTIFICATION SET
;N GPL
D LIST^DIC($$C0QMMFN(),","_ZREC_",",".01;1.1;2.1;3;",,,,,,,,"GPL")
N ZI S ZI=""
F S ZI=$O(GPL("DILIST","ID",ZI)) Q:ZI="" D ;
. S @RTN@(ZI,"measure")=GPL("DILIST","ID",ZI,.01)
. N ZMIEN,ZMEAIEN,ZRNAME
. S ZMIEN=GPL("DILIST",2,ZI) ; IEN OF MEASURE IN MEASURE FILE
. ;S ZMEAIEN=$$GET1^DIQ($$C0QMMFN(),ZMIEN_","_ZREC_",",.01,"I") ; MEASURE
. S ZRNAME=$$GET1^DIQ($$C0QMMFN(),ZMIEN_","_ZREC_",",".01:.8") ; MEASURE
. ;S @RTN@(ZI,"reportingName")=$$GET1^DIQ($$C0QQFN(),ZMEAIEN_",",.8) ; RNAME
. S @RTN@(ZI,"reportingName")=ZRNAME ; A SHORTCUT TO THE REPORTING NAME
. S @RTN@(ZI,"reportingNumber")=$P(ZRNAME,"NQF",2) ; NQF0001 -> 0001
. S @RTN@(ZI,"denominator")=+GPL("DILIST","ID",ZI,2.1)
. S @RTN@(ZI,"numerator")=+GPL("DILIST","ID",ZI,1.1)
. N ZNUM,ZDEM,ZPCT
. S (ZNUM,ZDEM,ZPCT)=0
. S ZDEM=+GPL("DILIST","ID",ZI,2.1)
. S ZNUM=+GPL("DILIST","ID",ZI,1.1)
. I ZDEM>0 S ZPCT=((ZNUM*100)/ZDEM)
. S @RTN@(ZI,"percent")=$P(ZPCT,".",1)
. S @RTN@(ZI,"ien")=ZI
;ZWR GPL
Q
;
MEA(ZOUT,ZIN) ; CREATE XML FROM THE MEASURES ARRAY
;
D GETFM(ZIN) ; GET THE MEASURES
;N G
;N ZI,ZJ
S ZI=""
F S ZI=$O(@ZIN@(ZI)) Q:ZI="" D ;
. N ZDEN,ZNUM,ZPCT
. S ZDEN=$G(@ZIN@(ZI,"denominator"))
. S ZNUM=$G(@ZIN@(ZI,"numerator"))
. S ZPCT=$G(@ZIN@(ZI,"percent"))
. S G("pqri-measure",ZI,"eligible-instances")=ZDEN
. S G("pqri-measure",ZI,"meets-performance-instances")=ZNUM
. S G("pqri-measure",ZI,"performance-exclusion-instances")=0
. S G("pqri-measure",ZI,"performance-not-met-instances")=ZDEN-ZNUM
. S G("pqri-measure",ZI,"performance-rate")=ZPCT
. S G("pqri-measure",ZI,"pqri-measure-number")="NQF "_@ZIN@(ZI,"reportingNumber")
. S G("pqri-measure",ZI,"reporting-rate")=ZPCT
K ^TMP("MXMLDOM",$J)
S C0CDOCID=$$DOMI^C0CDOM("G",1,"root")
D OUTXML^C0CDOM(ZOUT,C0CDOCID,1)
Q
;

View File

@ -0,0 +1,393 @@
C0QPRML ;JJOH/ZAG/GPL - Patient Reminder List ;7/5/11 8:50pm
;;1.0;MU PACKAGE;;;Build 19
;
;2011 Zach Gonzales<zach@linux.com> - Licensed under the terms of the GNU
;General Public License See attached copy of the License.
;
;This program is free software; you can redistribute it and/or modify
;it under the terms of the GNU General Public License as published by
;the Free Software Foundation; either version 2 of the License, or
;(at your option) any later version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License along
;with this program; if not, write to the Free Software Foundation, Inc.,
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
;
BUILD ; CALL ALL AND DIS AND BUILD THE GRSLT ARRAY or print or create
; patient lists
;N GRSLT ; ARRAY FOR RESULTS
I '$D(C0QSS) S C0QSS=0 ;default don't build spreadsheet array
I '$D(C0QPR) S C0QPR=0 ;default don't print out results
I '$D(C0QPL) S C0QPL=1 ;default do create patient lists
N G1 ; ONE SET OF VALUES - RNF1 FORMAT
; INITIALIZE LISTS
; this is done so that if there are no matching patients, the patient list
; will be zeroed out
S C0QLIST("HasDemographics")=""
S C0QLIST("Patient")=""
S C0QLIST("HasProblem")=""
S C0QLIST("HasAllergy")=""
S C0QLIST("HasMed")=""
S C0QLIST("HasVitalSigns")=""
S C0QLIST("HasMedOrders")=""
S C0QLIST("HasSmokingStatus")=""
D ALL ; all currently admitted patients in the hospital
D DIS ; all patients discharged since the reporting period began
I C0QSS ZWR GRSLT
I C0QPL D ;
. D FILE ; FILE THE PATIENT LISTS
. D UPDATE^C0QUPDT(.G,8) ; UPDATE THE MU MEASUREMENT SET
Q
;
ALL ;retrieve active inpatients
N WARD S WARD=""
F D Q:WARD=""
. S WARD=$O(^DIC(42,"B",WARD)) ;ward name
. Q:WARD=""
. N WIEN S WIEN=""
. F S WIEN=$O(^DIC(42,"B",WARD,WIEN)) Q:'WIEN D ;wards IEN
. . S WARDNAME=$P(^DIC(42,WIEN,0),U,2) ;ward name
. . N DFN,RB S DFN=""
. . F S DFN=$O(^DPT("CN",WARD,+DFN)) Q:'DFN D ;DFN of patient on ward
. . . D DEMO
. . . D PROBLEM
. . . D ALLERGY
. . . D MEDS
. . . D SMOKING
. . . D VITALS
. . . I C0QPR D PRINT
. . . I C0QSS D SS
. . . I C0QPL D PATLIST
Q
;
DEMO ; patient demographics
S PTNAME=$P(^DPT(DFN,0),U) ;patient name
S PTDOB=$$FMTE^XLFDT($P($G(^DPT(DFN,0)),U,3)) ;date of birth
S PTSEX=$P($G(^DPT(DFN,0)),U,2) ;patient sex
D PID^VADPT ;VADPT call to grab PISD based on PT Eligibility
S PTHRN=$P($G(VA("PID")),U) ;health record number
S PTRLANG=$P($G(^DPT(DFN,256000)),U) ;ptr to language file
I $G(PTRLANG)'="" S PTLANG=$P(^DI(.85,PTRLANG,0),U) ;PLS extrnl
S RACE=""
F D Q:RACE=""
. S RACE=$O(^DPT(DFN,.02,"B",RACE)) ;race code IEN
. Q:'RACE
. S RACEDSC=$P($G(^DIC(10,RACE,0)),U) ;race description
S ETHN=""
F D Q:ETHN=""
. S ETHN=$O(^DPT(DFN,.06,"B",ETHN)) ;ethnicity IEN
. Q:'ETHN
. S ETHNDSC=$P($G(^DIC(10.2,ETHN,0)),U) ;ethnincity description
S RB=$P($G(^DPT(DFN,.101)),U) ;room and bed
Q
;
PROBLEM ; PATIENT PROBLEMS
D LIST^ORQQPL(.PROBL,DFN,"A")
S PBCNT=""
F S PBCNT=$O(PROBL(PBCNT)) Q:PBCNT="" D
. S PBDESC=$P(PROBL(PBCNT),U,2) ;problem description
K PROBL
Q
;
ALLERGY ; ALLERGY LIST
D LIST^ORQQAL(.ALRGYL,DFN)
S ALCNT=""
F S ALCNT=$O(ALRGYL(ALCNT)) Q:ALCNT="" D
. S ALDESC=$P(ALRGYL(ALCNT),U,2) ;allergy description
K ALRGYL
Q
;
MEDS ; MEDICATIONS
;
I DFN=97 D Q ;
. S MDCNT=271
K MEDSL
D EN^C0CNHIN(.MEDSL,DFN,"MED;") ; GET THE MEDS FROM THE NHIN API
; can't use COVER^ORWPS even though it's fast.. we need to detect
; if the medications are Inpatient to compute the CPOE measure
; we will use the NHINV routines for this purpose
;D COVER^ORWPS(.MEDSL,DFN)
S MDCNT="" S HASINP=0
F S MDCNT=$O(MEDSL("med",MDCNT)) Q:MDCNT="" D
. ;Q:$P(MEDSL(MDCNT),U,4)'="ACTIVE" ;active medications only
. Q:MEDSL("med",MDCNT,"status@value")'="active"
. ;S MDDESC=$P(MEDSL(MDCNT),U,2) ;medication description
. S MDDESC=$G(MEDSL("med",MDCNT,"products.product@name"))
. ;S MDITEM=$P($G(MEDSL(MDCNT)),U,3)
. S MDITEM=$G(MEDSL("med",MDCNT,"sig")) ; i think this is what meditem is
. I MEDSL("med",MDCNT,"vaType@value")="I" S HASINP=1
I HASINP D ; THE PATIENT HAS AN INPATIENT MED
. S C0QLIST("HasMedOrders",DFN)="" ; an inpatient drug indicates CPOE
E S C0QLIST("NoMedOrders",DFN)="" ; this will be different for outpatient
K MEDSL
Q
;
SMOKING ;
N C0QSMOKE
D HFCAT^C0QHF(.C0QSMOKE,DFN,"TOBACCO") ; GET ALL HEALTH FACTORS FOR THE
; PATIENT IN THE CATEGORY OF TOBACCO
I $D(C0QSMOKE) S C0QLIST("HasSmokingStatus",DFN)=""
E S C0QLIST("NoSmokingStatus",DFN)=""
Q
;
VITALS ;
;
N C0QSDT,C0QEDT
D DT^DILF(,"JULY 3,2011",.C0QSDT) ; START DATE
D DT^DILF(,"T",.C0QEDT) ; END DATE TODAY
D VITALS^ORQQVI(.VITRSLT,DFN,C0QSDT,C0QEDT) ; CALL FAST VITALS
I $D(VITRSLT) D ;ZWR VITRSLT B ;
. I VITRSLT(1)["No vitals found." S C0QLIST("NoVitalSigns",DFN)=""
. E S C0QLIST("HasVitalSigns",DFN)=""
Q
;
PRINT ; PRINT TO SCREEN
I $D(WARD) W !!,WARD_"-"_WARDNAME_" "_RB_": "_PTNAME_"("_PTSEX_") "
I $D(EXDTE) D ;
. W !,"Discharge Date: ",EXDTE
. W !,DFN," ",PTNAME
W !,"DOB: ",PTDOB," HRN: ",PTHRN
W !,"Language Spoken: ",$G(PTLANG)
W !,"Race: ",RACEDSC
W !,"Ethnicity: ",$G(ETHNDSC)
W !,"Problems: "
W !,PBDESC
W !,"Allergies: "
W !,ALDESC
W !,"Medications: "
W !
Q
;
SS ; CREATE SPREADSHEET ARRAY
S G1("Patient")=DFN
I $D(WARD) D ;
. S G1("WardName")=WARDNAME
. S G1("RoomAndBed")=RB
I $D(EXDTE) D ;
. S G1("DischargeDate")=EXDTE
S G1("PatientName")=PTNAME
S G1("Gender")=PTSEX
S G1("DateOfBirth")=PTDOB
S G1("HealthRecordNumber")=PTHRN
S G1("LanguageSpoken")=$G(PTLANG)
S G1("Race")=RACEDSC
S G1("Ehtnicity")=$G(ETHNDSC)
S G1("Problem")=PBDESC
I PBDESC["No problems found" S G1("HasProblem")=0
E S G1("HasProblem")=1
S G1("Allergies")=ALDESC
I ALDESC["No Allergy" S G1("HasAllergy")=0
E S G1("HasAllergy")=1
I $D(MDITEM) D ;
. S G1("HasMed")=1
E S G1("HasMed")=0
S G1("MedDescription")=$G(MDDESC)
I $D(MDITEM) W !,"("_MDITEM_")"_MDDESC E W !,MDDESC
D RNF1TO2B^C0CRNF("GRSLT","G1")
K G1
Q ; DON'T WANT TO DO THE NHIN STUFF NOW
;
PATLIST ; CREATE PATIENT LISTS
S C0QLIST("Patient",DFN)="" ; THE PATIENT LIST
N DEMOYN S DEMOYN=1
I $G(PTSEX)="" S DEMOYN=0
I $G(PTDOB)="" S DEMOYN=0
I $G(PTHRN)="" S DEMOYN=0
I $G(PTLANG)="" S DEMOYN=0
I $G(RACEDSC)="" S DEMOYN=0
I $G(ETHNDSC)="" S DEMOYN=0
I DEMOYN S C0QLIST("HasDemographics",DFN)=""
E S C0QLIST("FailedDemographics",DFN)=""
;S G1("Gender")=PTSEX
;S G1("DateOfBirth")=PTDOB
;S G1("HealthRecordNumber")=PTHRN
;S G1("LanguageSpoken")=$G(PTLANG)
;S G1("Race")=RACEDSC
;S G1("Ehtnicity")=$G(ETHNDSC)
S G1("Problem")=PBDESC
I PBDESC["No problems found" S C0QLIST("NoProblem",DFN)=""
E S C0QLIST("HasProblem",DFN)=""
;S G1("Allergies")=ALDESC
I ALDESC["No Allergy" S C0QLIST("NoAllergy",DFN)=""
E S C0QLIST("HasAllergy",DFN)=""
I $D(MDITEM) D ;
. S C0QLIST("HasMed",DFN)=""
E S G1("NoMed",DFN)=""
;S G1("MedDescription")=$G(MDDESC)
Q
;
NHIN ; SHOW THE NHIN ARRAY FOR THIS PATIENT
Q:DFN=137!14
D EN^C0CNHIN(.G,DFN,"")
ZWR G
K G
;
QUIT ;end of WARD
;
;
DIS;
N DFN,DTE,EXDTE S DTE=""
F D Q:DTE=""
. S DTE=$O(^DGPM("B",DTE))
. Q:'DTE
. Q:DTE<3110703
. S EXDTE=$$FMTE^XLFDT(DTE)
. N PTFM S PTFM=""
. D
. . S PTFM=$O(^DGPM("B",DTE,PTFM))
. . Q:'PTFM
. . S DFN=$P(^DGPM(PTFM,0),U,3)
. . D DEMO
. . D PROBLEM
. . D ALLERGY
. . D MEDS
. . D SMOKING
. . D VITALS
. . I C0QPR D PRINT
. . I C0QSS D SS
. . I C0QPL D PATLIST
Q
;
C0QPLF() Q 1130580001.301 ; FILE NUMBER FOR C0Q PATIENT LIST FILE
C0QALFN() Q 1130580001.311 ; FILE NUMBER FOR C0Q PATIENT LIST PATIENT SUBFILE
FILE ; FILE THE PATIENT LISTS TO C0Q PATIENT LIST
;
I '$D(C0QLIST) Q ;
N LFN S LFN=$$C0QALFN()
N ZI,ZN
S ZI=""
F S ZI=$O(C0QLIST(ZI)) Q:ZI="" D ;
. S ZN=$O(^C0Q(301,"CATTR",ZI,""))
. I ZN="" D Q ; OOPS
. . W !,"ERROR, ATTRIBUTE NOT FOUND IN PATIENT LIST FILE:"_ZI
. ;S ZN=$$KLNCR(ZN) ; KILL AND RECREATE RECORD ZN
. N C0QNEW,C0QOLD,C0QRSLT
. S C0QNEW=$NA(C0QLIST(ZI)) ; THE NEW PATIENT LIST
. S C0QOLD=$NA(^C0Q(301,ZN,1,"B")) ; THE OLD PATIENT LIST
. D UNITY^C0QSET("C0QRSLT",C0QNEW,C0QOLD) ; FIND WHAT'S NEW
. N ZJ,ZK
. ; FIRST, DELETE THE OLD ONES - NO LONGER IN THE LIST
. K C0QFDA
. S ZJ=""
. F S ZJ=$O(C0QRSLT(2,ZJ)) Q:ZJ="" D ; MARKED WITH A 2 FROM UNITY
. . S ZK=$O(@C0QOLD@(ZJ,"")) ; GET THE IEN OF THE RECORD TO DELETE
. . I ZK="" D Q ; OOPS SHOULDN'T HAPPEN
. . . W !,"INTERNAL ERROR FINDING A PATIENT TO DELETE"
. . . B
. . S C0QFDA(LFN,ZK_","_ZN_",",.01)="@"
. I $D(C0QFDA) D UPDIE ; PROCESS THE DELETIONS
. ; SECOND, PROCESS THE ADDITIONS
. K C0QFDA
. S ZJ="" S ZK=1
. F S ZJ=$O(C0QRSLT(0,ZJ)) Q:ZJ="" D ; PATIENTS TO ADD ARE MARKED WITH 0
. . S C0QFDA(LFN,"+"_ZK_","_ZN_",",.01)=ZJ
. . S ZK=ZK+1
. I $D(C0QFDA) D UPDIE ; PROCESS THE ADDITIONS
;. Q
;. K C0QFDA
;. N ZJ,ZC
;. S ZJ="" S ZC=1
;. F S ZJ=$O(C0QLIST(ZI,ZJ)) Q:ZJ="" D ; FOR EACH PAT IN LIST
;. . S C0QFDA(LFN,"?+"_ZC_","_ZN_",",.01)=ZJ
;. . S ZC=ZC+1
;. D UPDIE
;. W !,"FOUND:"_ZI
Q
;
KLNCR(ZREC) ; KILL AND RECREATE RECORD ZREC IN PATIENT LIST FILE
;
N C0QFDA,ZFN,LIST,ATTR
S ZFN=$$C0QPLF() ; FILE NUMBER FOR C0Q PATIENT LIST FILE
D CLEAN^DILF
S LIST=$$GET1^DIQ(ZFN,ZREC_",",.01) ; MEASURE NAME
S ATTR=$$GET1^DIQ(ZFN,ZREC_",",999) ; ATTRIBUTE
D CLEAN^DILF
K ZERR
S C0QFDA(ZFN,ZREC_",",.01)="@" ; GET READY TO DELETE THE MEASURE
D FILE^DIE(,"C0QFDA","ZERR") ; KILL THE SUBFILE
I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST, INVOKE THE ERROR TRAP IF TASKED
;. W "ERROR",!
;. ZWR ZERR
;. B
K C0QFDA
S C0QFDA(ZFN,"+1,",.01)=LIST ; GET READY TO RECREATE THE RECORD
S C0QFDA(ZFN,"+1,",999)=ATTR ; ATTRIBUTE
D UPDIE ; CREATE THE SUBFILE
N ZR ; NEW IEN FOR THE RECORD
S ZR=$O(^C0Q(301,"CATTR",ATTR,""))
;
Q ZR
;
UPDIE ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS
K ZERR
D CLEAN^DILF
D UPDATE^DIE("","C0QFDA","","ZERR")
I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST, INVOKE THE ERROR TRAP IF TASKED
;. W "ERROR",!
;. ZWR ZERR
;. B
K C0QFDA
Q
;
; WHAT FOLLOWS IS OLD CODE - DELETE WHEN THIS WORKS
;. . N PTNAME S PTNAME=$P(^DPT(DFN,0),U,1)
;. . S PTDOB=$$FMTE^XLFDT($P($G(^DPT(DFN,0)),U,3)) ;date of birth
;. . S PTSEX=$P($G(^DPT(DFN,0)),U,2) ;patient sex
;. . D PID^VADPT ;VADPT call to grab PISD based on PT Eligibility
;. . S PTHRN=$P($G(VA("PID")),U) ;health record number
;. . S PTRLANG=$P($G(^DPT(DFN,256000)),U) ;ptr to language file
;. . I $G(PTRLANG)'="" S PTLANG=$P(^DI(.85,PTRLANG,0),U) ;PLS extrnl
;. . S RACE=""
;. . F D Q:RACE=""
;. . . S RACE=$O(^DPT(DFN,.02,"B",RACE))
;. . . Q:'RACE
;. . . S RACEDSC=$P($G(^DIC(10,RACE,0)),U)
;. . N ETHNDSC
;. . N ETHNDSC S ETHNDSC=""
;. . S ETHN=""
;. . F D Q:ETHN=""
;. . . S ETHN=$O(^DPT(DFN,.06,"B",ETHN))
;. . . Q:'ETHN
;. . . S ETHNDSC=$P($G(^DIC(10.2,ETHN,0)),U)
;. . D LIST^ORQQPL(.PROBL,DFN,"A")
;. . S PBCNT=""
;. . F S PBCNT=$O(PROBL(PBCNT)) Q:PBCNT="" D
;. . . S PBDESC=$P(PROBL(PBCNT),U,2) ;problem description
;. . K PROBL
;. . D LIST^ORQQAL(.ALRGYL,DFN)
;. . S ALCNT=""
;. . F S ALCNT=$O(ALRGYL(ALCNT)) Q:ALCNT="" D
;. . . S ALDESC=$P(ALRGYL(ALCNT),U,2) ;allergy description
;. . K ALRGYL
;. . D COVER^ORWPS(.MEDSL,DFN)
;. . S MDCNT=""
;. . F S MDCNT=$O(MEDSL(MDCNT)) Q:MDCNT="" D
;. . . Q:$P(MEDSL(MDCNT),U,4)'="ACTIVE" ;active medications only
;. . . S MDDESC=$P(MEDSL(MDCNT),U,2) ;medication description
;. . . S MDITEM=$P($G(MEDSL(MDCNT)),U,3)
;. . K MEDSL
;. . W !,"Discharge Date: ",EXDTE
;. . W !,DFN," ",PTNAME
;. . W !,"DOB: ",PTDOB," HRN: ",PTHRN
;. . W !,"Language Spoken: ",$G(PTLANG)
;. . W !,"Race: ",RACEDSC
;. . W !,"Ethnicity: ",ETHNDSC
;. . W !,"Problems: "
;. . W !,PBDESC
;. . W !,"Allergies: "
;. . W !,ALDESC
;. . W !,"Medications: "
;. . I $D(MDITEM) W !,"(",MDITEM,")",MDDESC E W !,MDDESC
;. . W !
;Q
;
;
;
;
END ;end of C0QPRML;

View File

@ -0,0 +1,115 @@
C0QSET ;GPL - SET OPERATIONS ON LISTS ;818/11 8:50pm
;;1.0;MU PACKAGE;;;Build 19
;
;2011 George Lilly glilly@glilly.net - Licensed under the terms of the GNU
;General Public License See attached copy of the License.
;
;This program is free software; you can redistribute it and/or modify
;it under the terms of the GNU General Public License as published by
;the Free Software Foundation; either version 2 of the License, or
;(at your option) any later version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License along
;with this program; if not, write to the Free Software Foundation, Inc.,
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
;
Q
;
TEST ; TEST OF UNITY ROUTINE
;
S A(1)=""
S A(2)=""
S A(3)=""
S B(3)=""
S B(4)=""
D UNITY("C","A","B")
ZWR C
Q
;
TEST2 ; WHICH PATIENTS HAVE MEDICATIONS? WHICH DON'T?
; WHAT BAD PATIENT POINTERS ARE IN THE MEDICATIONS FILE?
S PATS=$NA(^DPT)
S MEDS=$NA(^PS(55))
D UNITY("DELTA",PATS,MEDS)
W !,"PATIENTS WITH NO MEDS",!
ZWR DELTA(0,*)
W !,"BAD POINTERS IN THE MEDS FILE",!
ZWR DELTA(2,*)
Q
;
UNITY(ZRTN,ZNEW,ZOLD) ; RETURNS THE DELTA BETWEEN THE NEW AND OLD LISTS
; ONLY NUMERIC LISTS SUPPORTED. FOR LIST WITH STRINGS SEE UNITYS
; ZRTN,ZNEW AND ZOLD ARE ALL PASSED BY NAME
; FORMAT OF RETURN ARRAY:
; @ZRTN@(0,X)="" ; X IS MISSING FROM OLD
; @ZRTN@(1,Y)="" ; Y IS IN BOTH NEW AND OLD - NOT MISSING
; @ZRTN@(2,Z)="" ; Z IS EXTRA IN OLD - WOULD BEED TO BE DELETED FOR UNITY
N C0QD ; TEMP WORK ARRAY
N ZN S ZN=0 ; COUNT
N ZI S ZI=0
F S ZI=$O(@ZNEW@(ZI)) Q:+ZI=0 D ; FOR EACH ITEM IN NEW
. S C0QD(ZI)=0 ; SET THEM ALL AS 0 MEANING NEW
. S ZN=ZN+1
S @ZRTN@("COUNT")=ZN ; NEW FILE COUNT
S ZI=0
F S ZI=$O(@ZOLD@(ZI)) Q:+ZI=0 D ; FOR EACH ITEM IN OLD
. I $D(C0QD(ZI)) S C0QD(ZI)=1 ; NOT NEW - PRESENT IN NEW AND OLD
. E S C0QD(ZI)=2 ; EXTRA IN OLD - WOULD NEED TO BE DELETED
S ZI=0
F S ZI=$O(C0QD(ZI)) Q:+ZI=0 D ; FOR EACH ITEM
. S @ZRTN@(C0QD(ZI),ZI)="" ; SET RESULTS IN RETURN ARRAY
Q
;
UNITYS(ZRTN,ZNEW,ZOLD) ; RETURNS THE DELTA BETWEEN THE NEW AND OLD LISTS
; THIS VERSION HAS SUPPORT FOR NUMBERS AND STRINGS IN A LIST
; ZRTN,ZNEW AND ZOLD ARE ALL PASSED BY NAME
; FORMAT OF RETURN ARRAY:
; @ZRTN@(0,X)="" ; X IS MISSING FROM OLD
; @ZRTN@(1,Y)="" ; Y IS IN BOTH NEW AND OLD - NOT MISSING
; @ZRTN@(2,Z)="" ; Z IS EXTRA IN OLD - WOULD BEED TO BE DELETED FOR UNITY
N C0QD ; TEMP WORK ARRAY
N ZI S ZI=""
F S ZI=$O(@ZNEW@(ZI)) Q:ZI="" D ; FOR EACH ITEM IN NEW
. S C0QD(ZI)=0 ; SET THEM ALL AS 0 MEANING NEW
S ZI=""
F S ZI=$O(@ZOLD@(ZI)) Q:ZI="" D ; FOR EACH ITEM IN OLD
. I $D(C0QD(ZI)) S C0QD(ZI)=1 ; NOT NEW - PRESENT IN NEW AND OLD
. E S C0QD(ZI)=2 ; EXTRA IN OLD - WOULD NEED TO BE DELETED
S ZI=""
F S ZI=$O(C0QD(ZI)) Q:ZI="" D ; FOR EACH ITEM
. S @ZRTN@(C0QD(ZI),ZI)="" ; SET RESULTS IN RETURN ARRAY
Q
;
AND(ZRTN,ZNEW,ZOLD) ; RETURNS A LIST OF WHAT IS COMMON TO BOTH NEW AND OLD
N ZD
D UNITY("ZD",ZNEW,ZOLD)
M @ZRTN=ZD(1)
Q
;
NAND(ZRTN,ZNEW,ZOLD) ; RETURNS WHAT IS IN A OR B BUT NOT BOTH
N ZD
D UNITY("ZD",ZNEW,ZOLD)
M @ZRTN=ZD(0)
M @ZRTN=ZD(2)
Q
;
AMINUSB(ZRTN,ZA,ZB) ; WHAT'S LEFT IN A AFTER REMOVING B FROM IT
N ZD
D UNITY("ZD",ZA,ZB)
M @ZRTN=ZD(0)
Q
;
OR(ZRTN,ZA,ZB) ; WHAT'S IN A OR B OR BOTH
N ZD
D UNITY("ZD",ZA,ZB)
M @ZRTN=ZD(0)
M @ZRTN=ZD(1)
M @ZRTN=ZD(2)
Q
;
END ;end of C0QSET;

View File

@ -0,0 +1,179 @@
C0QUPDT ; GPL - Quality Reporting List Update Routines ;8/29/11 17:05
;;0.1;C0Q;nopatch;noreleasedate;Build 19
;Copyright 2009 George Lilly. Licensed under the terms of the GNU
;General Public License See attached copy of the License.
;
;This program is free software; you can redistribute it and/or modify
;it under the terms of the GNU General Public License as published by
;the Free Software Foundation; either version 2 of the License, or
;(at your option) any later version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License along
;with this program; if not, write to the Free Software Foundation, Inc.,
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
;
Q
;
C0QQFN() Q 1130580001.101 ; FILE NUMBER FOR C0Q QUALITY MEASURE FILE
C0QMFN() Q 1130580001.201 ; FILE NUMBER FOR C0Q MEASUREMENT FILE
C0QMMFN() Q 1130580001.2011 ; FN FOR MEASURE SUBFILE
C0QMMNFN() Q 1130580001.20111 ; FN FOR NUMERATOR SUBFILE
C0QMMDFN() Q 1130580001.20112 ; FN FOR DENOMINATOR SUBFILE
RLSTFN() Q 810.5 ; FN FOR REMINDER PATIENT LIST FILE
RLSTPFN() Q 810.53 ; FN FOR REMINDER PATIENT LIST PATIENT SUBFILE
C0QALFN() Q 1130580001.311 ; FILE NUMBER FOR C0Q PATIENT LIST PATIENT SUBFILE ;
;
UPDATE(RNT,MSET) ; UPDATE A MEASURE SET BY ADDING NEW ENTRIES TO PATIENT
; LISTS AND DELETING ENTRIES THAT ARE NO LONGER VALID. ALSO UPDATE
; NUMERATOR AND DENOMINATOR COUNTS
; MAKES HEAVY USE OF UNITY^C0QSET TO DETERMINE WHAT TO ADD AND DELETE
;
; THIS IS A REPLACEMENT FOR C0QRPC^C0QMAIN WHICH DELETES THE PATIENT
; LISTS AND RECREATES THEM, WHICH IS A LOT OF UNNECESSARY PROCESSING
;
N ZI S ZI=""
N C0QM ; FOR HOLDING THE MEASURES IN THE SET
D LIST^DIC($$C0QMMFN,","_MSET_",",".01I") ; GET ALL THE MEASURES
D DELIST("C0QM")
N ZII S ZII=""
F S ZII=$O(C0QM(ZII)) Q:ZII="" D ; FOR EACH MEASURE
. S ZI=$P(C0QM(ZII),U,1) ; IEN OF THE MEASURE IN THE C0Q QUALITY MEAS FILE
. S C0QNL=$$GET1^DIQ($$C0QQFN,ZI_",",1,"I") ; NUMERATOR POINTER
. I C0QNL="" D ; CHECK ALTERNATE LIST
. . S C0QNL=$$GET1^DIQ($$C0QQFN,ZI_",",1.1,"I") ; NUMERATOR POINTER
. . I C0QNL'="" S C0QNALT=1
. S C0QDL=$$GET1^DIQ($$C0QQFN,ZI_",",2,"I") ; DENOMINATOR POINTER
. I C0QDL="" D ; CHECK ALTERNATE LIST
. . S C0QDL=$$GET1^DIQ($$C0QQFN,ZI_",",2.1,"I") ; DENOMINATOR POINTER
. . I C0QDL'="" S C0QDALT=1
. ;
. ; FIRST PROCESS THE NUMERATOR
. ;
. N C0QNEW ; REFERENCE TO NEW NUMBERATOR LIST B INDEX
. I $G(C0QNALT)=1 D ; USING ALTERNATE LIST FOR NUMERATOR
. . S C0QNEW=$NA(^C0Q(301,C0QNL,1,"B")) ; B INDEX FOR THIS LIST
. E D ; USE THE REMINDER PACKAGE PATIENT LISTS
. . S C0QNEW=$NA(^PXRMXP(810.5,C0QNL,30,"B")) ; REMINDER LIST PATIENTS
. N C0QOLD ; REFERENCE FOR OLD PATIENT LIST
. S C0QOLD=$NA(^C0Q(201,MSET,5,ZII,1,"B")) ; NUMERATOR LIST IN MEASURE SET
. N C0QRSLT ; ARRAY FOR THE UNITY DIFFERENCES
. D UNITY^C0QSET("C0QRSLT",C0QNEW,C0QOLD) ; FIND THE DIFFERENCES
. N C0QCNT
. S C0QNCNT=$G(C0QRSLT("COUNT"))
. I C0QNCNT="" D ;
. . S C0QNCNT=0 ; DEFAULT COUNT IS ZERO
. . N GZZ S GZZ=""
. . F S GZZ=$O(C0QRSLT(0,GZZ)) Q:GZZ="" D ; EVERY ADD ENTRY
. . . S C0QNCNT=C0QNCNT+1
. . F S GZZ=$O(C0QRSLT(1,GZZ)) Q:GZZ="" D ; EVERY EQUAL ENTRY
. . . S C0QNCNT=C0QNCNT+1
. K C0QFDA ; CLEAR THE FDA
. N C0QONCNT ; OLD COUNT
. S C0QONCNT=$$GET1^DIQ($$C0QMMFN(),ZII_","_MSET_",",1.1)
. I C0QNCNT'=C0QONCNT D ; COUNT HAS CHANGED
. . S C0QFDA($$C0QMMFN(),ZII_","_MSET_",",1.1)=C0QNCNT ; NUMERATOR COUNT
. . D UPDIE ; UPDATE THE NUMERATOR COUNT
. I $D(C0QRSLT) D ;B ;
. . ;ZWR C0QRSLT
. ; FIRST PROCESS DELETIONS
. K C0QFDA ; CLEAR OUT THE FDA
. N ZG,ZIEN S ZG=""
. F S ZG=$O(C0QRSLT(2,ZG)) Q:ZG="" D ; FOR EACH DELETION
. . S ZIEN=$O(@C0QOLD@(ZG,"")) ; IEN OF THE ENTRY
. . I ZIEN="" D Q ; OOPS
. . . W !,"ERROR DELETING ENTRY!! ",ZG
. . S C0QFDA($$C0QMMNFN(),ZIEN_","_ZII_","_MSET_",",.01)="@" ; DELETE
. I $D(C0QFDA) D UPDIE ; PROCESS
. ; SECOND, PROCESS ADDITIONS
. K C0QFDA ; CLEAR OUT THE FDA
. N ZG,ZC S ZG="" S ZC=1
. F S ZG=$O(C0QRSLT(0,ZG)) Q:ZG="" D ; FOR EACH ADDITION
. . S C0QFDA($$C0QMMNFN(),"+"_ZC_","_ZII_","_MSET_",",.01)=ZG ; ADD THE ENTRY
. . S ZC=ZC+1
. I $D(C0QFDA) D UPDIE ; PROCESS
. ;
. ; PROCESS THE DENOMINATOR
. ;
. N C0QNEW ; REFERENCE TO NEW NUMBERATOR LIST B INDEX
. I $G(C0QNALT)=1 D ; USING ALTERNATE LIST FOR NUMERATOR
. . S C0QNEW=$NA(^C0Q(301,C0QDL,1,"B")) ; B INDEX FOR THIS LIST
. E D ; USE THE REMINDER PACKAGE PATIENT LISTS
. . S C0QNEW=$NA(^PXRMXP(810.5,C0QDL,30,"B")) ; REMINDER LIST PATIENTS
. N C0QOLD ; REFERENCE FOR OLD PATIENT LIST
. S C0QOLD=$NA(^C0Q(201,MSET,5,ZII,3,"B")) ; DENOMINATOR LIST IN MEASURE SET
. N C0QRSLT ; ARRAY FOR THE UNITY DIFFERENCES
. D UNITY^C0QSET("C0QRSLT",C0QNEW,C0QOLD) ; FIND THE DIFFERENCES
. N C0QDCNT
. S C0QDCNT=$G(C0QRSLT("COUNT"))
. I C0QDCNT="" D ;
. . S C0QDCNT=0 ; DEFAULT COUNT IS ZERO
. . N GZZ S GZZ=""
. . F S GZZ=$O(C0QRSLT(0,GZZ)) Q:GZZ="" D ; EVERY ADD ENTRY
. . . S C0QDCNT=C0QDCNT+1
. . F S GZZ=$O(C0QRSLT(1,GZZ)) Q:GZZ="" D ; EVERY EQUAL ENTRY
. . . S C0QDCNT=C0QDCNT+1
. K C0QFDA ; CLEAR THE FDA
. N C0QODCNT ; OLD COUNT
. S C0QODCNT=$$GET1^DIQ($$C0QMMFN(),ZII_","_MSET_",",2.1)
. I C0QDCNT'=C0QODCNT D ; COUNT HAS CHANGED
. . S C0QFDA($$C0QMMFN(),ZII_","_MSET_",",2.1)=C0QDCNT ; DENOMINATOR COUNT
. . D UPDIE ; UPDATE THE DENOMINATOR COUNT
. I $D(C0QRSLT) D ;B ;
. . ;ZWR C0QRSLT
. I '$D(C0QRSLT) Q ; NO RESULTS TO USE
. ; FIRST PROCESS DELETIONS
. K C0QFDA ; CLEAR OUT THE FDA
. N ZG,ZIEN S ZG=""
. F S ZG=$O(C0QRSLT(2,ZG)) Q:ZG="" D ; FOR EACH DELETION
. . S ZIEN=$O(@C0QOLD@(ZG,"")) ; IEN OF THE ENTRY
. . I ZIEN="" D Q ; OOPS
. . . W !,"ERROR DELETING ENTRY!! ",ZG
. . S C0QFDA($$C0QMMDFN(),ZIEN_","_ZII_","_MSET_",",.01)="@" ; DELETE
. I $D(C0QFDA) D UPDIE ; PROCESS
. ; SECOND, PROCESS ADDITIONS
. K C0QFDA ; CLEAR OUT THE FDA
. N ZG,ZC S ZG="" S ZC=1
. F S ZG=$O(C0QRSLT(0,ZG)) Q:ZG="" D ; FOR EACH ADDITION
. . S C0QFDA($$C0QMMDFN(),"+"_ZC_","_ZII_","_MSET_",",.01)=ZG ; ADD THE ENTRY
. . S ZC=ZC+1
. I $D(C0QFDA) D UPDIE ; PROCESS
. N C0QPCT ; PERCENT
. I C0QDCNT>0 D ;
. . S C0QPCT=$J(100*C0QNCNT/C0QDCNT,0,0)
. . K C0QFDA
. . S C0QFDA($$C0QMMFN(),ZII_","_MSET_",",3)=C0QPCT ; PERCENT
. . D UPDIE
Q
;
DELIST(RTN) ; DECODES ^TMP("DILIST",$J) INTO
; @RTN@(IEN)=INTERNAL VALUE^EXTERNAL VALUE
; ADDED A B INDEX @RTN@("B",INTERNAL VALUE,IEN)=EXTERNAL VALUE
N ZI,IV,EV,ZDI,ZIEN
S ZI=""
S ZDI=$NA(^TMP("DILIST",$J))
K @RTN
F S ZI=$O(@ZDI@(1,ZI)) Q:ZI="" D ;
. S EV=@ZDI@(1,ZI) ;EXTERNAL VALUE
. S IV=$G(@ZDI@("ID",ZI,.01)) ; INTERNAL VALUE
. S ZIEN=@ZDI@(2,ZI) ; IEN
. S @RTN@(ZIEN)=IV_"^"_EV
. ;S @RTN@("B",IV,ZIEN)=EV
Q
;
UPDIE ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS
K ZERR
D CLEAN^DILF
ZWR C0QFDA
D UPDATE^DIE("","C0QFDA","","ZERR")
I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST, INVOKE THE ERROR TRAP IF TASKED
;. W "ERROR",!
;. ZWR ZERR
;. B
K C0QFDA
Q
;

View File

@ -0,0 +1,58 @@
C0QERTIM ; Time from admission to leaving a hospital location ;
;;0.1;C0Q;;;Build 26
EN ;Get Location
S DIC=42,DIC(0)="AEMQ" D ^DIC I Y<1 G EXIT
S LOCATION=+Y
;Start date
S %DT="AE",%DT("A")="Start DATE: " D ^%DT G:Y=-1 EXIT S START=Y
;End date
S %DT="AE",%DT("A")="Stop DATE: " D ^%DT G:Y=-1 EXIT S STOP=Y
;select device:
S %ZIS="Q" D ^%ZIS G EXIT:POP
I $D(IO("Q")) D G EXIT
. S ZTRTN="DQ^C0QERTIM",ZTDESC="Time from admission to leaving a hospital location"
. S ZTSAVE("LOCATION")="",ZTSAVE("START")="",ZTSAVE("STOP")=""
. D ^%ZTLOAD D HOME^%ZIS K IO("Q")
. Q
DQ ; Get down to business
;sort on admit date/time in file 45, screen on LOSING WARD in sub-file 535.
;^DGPT("AF",date/time,DA)
S PATCOUNT=0,ADMITIME=START
F S ADMITIME=$O(^DGPT("AF",ADMITIME)) Q:ADMITIME'>0 D
. Q:ADMITIME>STOP
. ;FMIN from ADMISSION DATE piece 2
. S X=ADMITIME D H^%DTC S FMINDAY=%H,FMINSEC=%T
. S D0="" F S D0=$O(^DGPT("AF",ADMITIME,D0)) Q:D0'>0 D
. . S D1=0 F S D1=$O(^DGPT(D0,535,D1)) Q:D1'>0 D
. . . ;Losing ward in piece 6 of ^DGPT(D0,535,D1,0)
. . . Q:$P($G(^DGPT(D0,535,D1,0)),U,6)'=LOCATION
. . . ;FMOUT from MOVEMENT DATE on leaving in piece 10
. . . S X=$P($G(^DGPT(D0,535,D1,0)),U,10) D H^%DTC S FMOUTDAY=%H,FMOUTSEC=%T
. . . I FMINDAY=FMOUTDAY S MINUTES=$P((FMOUTSEC-FMINSEC)/60,".")
. . . I FMINDAY'=FMOUTDAY D
. . . . S DIFFDAY=FMOUTDAY-FMINDAY
. . . . S MINUTES=1440*(DIFFDAY-1)+$P((FMOUTSEC+86400-FMINSEC)/60,".")
. . . . Q
. . . S PATCOUNT=PATCOUNT+1
. . . S ^TMP($J,"PATIENTS",$P(^DPT(+^DGPT(D0,0),0),U))=MINUTES
. . . S ^TMP($J,"MINUTES",MINUTES)=1+$G(^TMP($J,"MINUTES",MINUTES))
. . . Q
. . Q
. Q
U IO W @IOF
;list median time from Admission to leaving hospital LOCATION
S MID=$P(PATCOUNT/2,"."),SUM=0
S MEDIAN=0 F S MEDIAN=$O(^TMP($J,"MINUTES",MEDIAN)) Q:MEDIAN'>0 D
. S SUM=SUM+^TMP($J,"MINUTES",MEDIAN) Q:SUM>MID
. Q
W "The median time spent in ",$P(^DIC(42,LOCATION,0),U)," is ",MEDIAN," minutes.",!
W !,"Patient",?40,"Minutes in ",$P(^DIC(42,LOCATION,0),U)
;list patient and time from admission to leaving the location
S PATIENT="" F S PATIENT=$O(^TMP($J,"PATIENTS",PATIENT)) Q:PATIENT="" D
. W !,PATIENT,?40," ",^TMP($J,"PATIENTS",PATIENT)
EXIT ; DO CLEANUP
S:$D(ZTQUEUED) ZTREQ="@"
K DIC,START,STOP,LOCATION,PATCOUNT,ADMITIME,FMINDAY,FMINSEC,FMOUTDAY,FMOUTSEC
K POP,D0,D1,DIFFDAY,MINUTES,MID,MEDIAN,PATIENT,^TMP($J)
Q

View File

@ -0,0 +1,118 @@
C0QGMRAD ;HIRMFO/RM,WAA-UTILITY TO GATHER PATIENT DATA ;1/15/98 13:47
;;4.0;Adverse Reaction Tracking;**2,10**;Mar 29, 1996;Build 26
EN1 ; ENTRY TO GATHER PATIENT A/AR DATA
;INPUT VARIABLES:
;
; DFN Pointer to Patient file.
; GMRA (OPTIONAL) A^B^C DEFAULT="0^0^111^0" **LOCAL
; where A = 0 return all reactions (allergic/non-allergic).
; 1 return allergies only.
; 2 return non-allergies only.
; B = 0 return all data (verified or non-verified).
; 1 return only verified data.
; 2 return only non-verified data.
; C = X_Y_Z
; where X, Y, and Z are either 0 or 1. 1 would mean to
; return an Adverse Reaction of that particular type,
; and zero means do not return an Adverse Reaction of
; that type.
; X is for TYPE=OTHER
; Y is for TYPE=FOOD
; Z is for TYPE=DRUG.
; E.g., 001 (return drug only), 111 (returns all types),
; and 010 (returns food only).
; **LOCAL
; D = 0 return both Observed and Historical
; 1 return only Observed
; **LOCAL
;OUTPUT VARIABLES:
; GMRAL = 1 if patient has Adverse Reaction
; 0 if patient has no known Adverse Reaction
; null if patient has not been asked about Adverse Reaction
; GMRAL(PTR TO 120.8) = A^B^C^D^E^F^G^H^I
; where A = Pointer to Patient file.
; B = Free text of causative agent.
; *C = Type of reaction, where D is drug, F is food, and O is
; other.
; D = 1 if Adverse Reaction has been verified
; 0 if Adverse Reaction has not been verified
; E = 0 if this is an allergic reaction
; 1 if this is not an allergic reaction
; **F = the mechanism of reaction in the format:
; External format;Internal format
; (ALLERGY;0, PHARMACOLOGIC;2, UNKNOWN;U).
; G = Type of reaction.
; where D = drug
; DF = drug/food
; DFO = drug/food/other
; DO = drug/other
; F = food
; FO = food/other
; O = other
; H = the mechanism of reaction in the format:
; External format;Internal format
; (ALLERGY;A, PHARMACOLOGIC;P, UNKNOWN;U)
; I = IEN and Global root of reactant (stored in piece B above)
; set equal to the GMR ALLERGY field (#1) of the PATIENT
; ALLERGY file (#120.8)
; GMRAL(PTR TO 120.8,"S",COUNT) = S
; where COUNT = number 1 to number of signs/symptoms for this
; reaction.
; S = a sign/symptom for this reaction in the format:
; External format;Internal format
;
;* NOTE: This piece will no longer be supported after 9/1/97,
; Please use piece G.
;** NOTE: This piece will no longer be supported after 9/1/97,
; Please use piece H.
;
N GMRAOTH
Q:'$D(DFN) S:'$D(GMRA)#2 GMRA="0^0^111^1" K GMRAL
DPT ;
;Read NKA Node in file 120.86
S GMRAL=$P($G(^GMR(120.86,DFN,0)),U,2)
;Do not set GMRAL array if patient is unassessed or NKA.
I GMRAL=0 Q ;PATIENT HAS NO KNOWN ALLERGIES
F GMRAREC=0:0 S GMRAREC=$O(^GMR(120.8,"B",DFN,GMRAREC)) Q:GMRAREC'>0 S GMRANODE=$S($D(^GMR(120.8,GMRAREC,0)):^(0),1:"") D:GMRANODE SETAL
I GMRAL=1,+$O(GMRAL(0))'>0 S GMRAL=0 ;if flag is set to 1 (reactions exist), then make certain the reactions are passed in the GMRAL array
K GMRA,GMRANODE,GMRAOSOF,GMRAREC,GMRATCNT
Q
SETAL ;
N %,GMRAI,GMRASIGN
;Q:'$P(GMRANODE,"^",12)&'$D(GMRAOSOF) ;IF NOT SIGNED OFF MARK IT
Q:+$G(^GMR(120.8,GMRAREC,"ER"))&'$D(GMRAERR) ;IF ENTERED IN ERROR QUIT
I GMRAL'=1 S GMRAL=1 ; PATIENT HAS ALLERGIES
S GMRAI=0 ; BEGIN CHECK FOR ADR/ALL CRITERIA
I $P(GMRA,"^",4),$P(GMRANODE,"^",6)="h" Q ;QUIT IF HISTORICAL EXCLUDED **LOCAL
I '$P(GMRA,"^") S GMRAI=1
E I $P(GMRA,"^")=1 S:$F("AU",$P(GMRANODE,"^",14))>1 GMRAI=1
E S:$F("P",$P(GMRANODE,"^",14))>1 GMRAI=1
Q:'GMRAI ; QUIT IF ADR/ALL CRITERIA NOT MET
Q:2-$P(GMRA,"^",2)=(1-$P(GMRANODE,"^",16)) ;QUIT IF VER/NON VER CRITERIA NOT MET
S GMRAI=0 ; BEGIN CHECK FOR ALLERGY TYPE CRITERIA
F %=1:1:3 I $E($P(GMRA,"^",3),%),$P(GMRANODE,"^",20)[$E("OFD",%) S GMRAI=1 Q
Q:'GMRAI ; QUIT IF ALLERGY TYPE CRITERIA NOT MET
D PASS(GMRAREC,.GMRAL)
Q
PASS(GMRAREC,GMRAL) ; Data filer
; This subroutine will store all the patient date for a reaction is an
; array.
; Input:
; GMRAREC = The IEN for the entry in 120.8
;Output:
; GMRAL(GMRAREC) the array entry for the record
;
N GMRANODE
S GMRANODE=$G(^GMR(120.8,GMRAREC,0)) Q:GMRANODE=""
S %=$P(GMRANODE,"^",14)
S GMRAL(GMRAREC)=$P(GMRANODE,"^",1,2)_"^"_$E($P(GMRANODE,"^",20))_"^"_+$P(GMRANODE,"^",16)_"^"_$S(%="A"!(%="U"):0,1:1)
S GMRAL(GMRAREC)=GMRAL(GMRAREC)_"^"_$S(%="A":"ALLERGY;0",%="P":"PHARMACOLOGIC;2",%="U":"UNKNOWN;U",1:"")_"^"_$P(GMRANODE,"^",20)_"^"_$S(%="A":"ALLERGY;A",%="P":"PHARMACOLOGIC;P",%="U":"UNKNOWN;U",1:"")
S GMRAL(GMRAREC)=GMRAL(GMRAREC)_"^"_$P(GMRANODE,"^",3)
Q:'$O(^GMR(120.8,GMRAREC,10,0)) ;QUIT IF NO SIGNS/SYMPTOMS
S:'$D(GMRAOTH) GMRAOTH=$O(^GMRD(120.83,"B","OTHER REACTION",0))
S GMRAX=0,GMRAY=1 F S GMRAX=$O(^GMR(120.8,GMRAREC,10,GMRAX)) Q:GMRAX<1 D I GMRAZ'="" S GMRAL(GMRAREC,"S",GMRAY)=GMRAZ(1),GMRAY=GMRAY+1
.S GMRAZ=$G(^GMR(120.8,GMRAREC,10,GMRAX,0))
.S GMRAZ(1)=$S(+GMRAZ'=GMRAOTH:$P($G(^GMRD(120.83,+GMRAZ,0)),U)_";"_+GMRAZ,1:$P(GMRAZ,U,2)_";"_+GMRAZ)
.Q
K GMRAX,GMRAY,GMRAZ
Q

View File

@ -0,0 +1,26 @@
C0QGMTSA ; SLC/DLT,KER - Brief Adverse Reaction/Allergy ; 02/27/2002
;;2.7;Health Summary;**28,49**;Oct 20, 1995;Build 26
;
; External References
; DBIA 10096 ^%ZOSF("TEST"
; DBIA 10099 EN1^GMRADPT **LOCAL NOW EN1^C0QGMRAD
;
ALLRG ; Allergies
N I,Z,X,SEQ,GMTSA,ALLRG K GMTSA S (SEQ,ALLRG)=0 S X="C0QGMRAD" X ^%ZOSF("TEST")
I $T D Q:$D(GMTSQIT)
. D GETALLRG I ALLRG D
. . D CKP^GMTSUP Q:$D(GMTSQIT) W ?3,"Allergy/Reaction: " D ALLRGP
Q
ALLRGP ; Allergy Print
D CKP^GMTSUP Q:$D(GMTSQIT) W ?21 S X=0
F I=0:0 S I=$O(GMTSA(I)) Q:I="" D Q:$D(GMTSQIT)
. S X=X+1 W:X>1 ", " W:(77)'>($X+$L(GMTSA(I))) !
. D CKP^GMTSUP Q:$D(GMTSQIT) W GMTSA(I)
Q:$D(GMTSQIT) D CKP^GMTSUP Q:$D(GMTSQIT) W ! Q
GETALLRG ; Get Allergies
N GMI,GMJ,GMRAL D EN1^C0QGMRAD I GMRAL="" S ALLRG=0 Q
I GMRAL="0" S ALLRG=1,GMTSA(1)="No Known Allergies" Q
S ALLRG=1,GMI=0 F S GMI=$O(GMRAL(GMI)) Q:GMI'>0 D
. S GMTSA(GMI)=$P(GMRAL(GMI),U,2)
. S GMJ=0 F S GMJ=$O(GMTSA(GMJ)) Q:GMJ'>0 I GMI'=GMJ,(GMTSA(GMI)=$G(GMTSA(GMJ))) K GMTSA(GMI) Q
Q

View File

@ -0,0 +1,101 @@
C0QGMTSG ; SLC/DLT,KER - Allergies ; 01/06/2003
;;2.7;Health Summary;**9,28,49,58**;Oct 20, 1995;Build 26
;
; External References
; DBIA 10096 ^%ZOSF("TEST"
; DBIA 10035 ^DPT(
; DBIA 905 ^GMR(120.8
; DBIA 2056 $$GET1^DIQ (file #120.86 and #200)
; DBIA 10011 ^DIWP
; DBIA 10099 EN1^GMRADPT **LOCAL changed to C0QGMRAD
; DBIA 10060 ^VA(200,
; DBIA 3449 ^GMR(120.86,
;
ALLRG ; Allergies
N X,GMTSALAS,GMTSALAD,GMTSALAW,GMTSALAT,GMTSAV,GMTSAFN,GMRAL,GMTSAL
N GMTSALNM,GMTSCNT,GMTSEACT,GMTSLN,GMTSMECH,GMTSPRT,GMTSTY,CC,C,KK
N ALLRG,TITLE,JJ K GMTSA S (SEQ,ALLRG)=0,TITLE="ALLERGY/ADVERSE REACTION (AR)"
S X="C0QGMRAD" X ^%ZOSF("TEST")
I $T D Q:$D(GMTSQIT)
. D GETALLRG D:ALLRG TITLE,ALLRGP D:'ALLRG&($L($G(GMTSALAS))) TITLE,NKA
I 'ALLRG,'$L($G(GMTSALAS)) D
. I $D(GMTSPNF)&('ALLRG) D CKP^GMTSUP Q:$D(GMTSQIT) W "Unknown, please evaluate",!
K ALL,CC,CCC,CD,DIWF,DIWL,DIWR,GMTSALF,GMTSALNM,GMTSNODE,GMTSPRT,I,II,JJ,KK,L,M,MX,N,Z,X,SEQ,GMTSA,ALLRG,TITLE,GMRA,GMRAL,GMTSEACT,GMTSMECH,GMTSTY,GMTSPFN,GMTSAL,GMTSCNT,GMTSLN,ODT
Q
ALLRGP ; Allergy Print
S II="" F S II=$O(GMTSAL(II)) Q:II']"" I $O(GMTSAL(II,""))]"" D
. D CKP^GMTSUP Q:$D(GMTSQIT) W !?2,$S(II="D":"Drug:",II="DF":"Drug/Food:",II="DFO":"Drug/Food/Other:",II="DO":"Drug/Other:",II="F":"Food:",II="FO":"Food/Other:",II="O":"Other:",1:II_":")
. S JJ="" F S JJ=$O(GMTSAL(II,JJ)) Q:JJ="" D
.. N WKK S KK="" F S KK=$O(GMTSAL(II,JJ,KK)) Q:KK="" D
... S L=0 F S L=$O(GMTSAL(II,JJ,KK,L)) Q:'L D CKP^GMTSUP Q:$D(GMTSQIT) D AUTOV W !?5,JJ_": " S:$L(KK)>30 WKK=KK,WKK=$$WRAP^GMTSORC(WKK,30) W ?24,$S($L(KK)>30:$P(WKK,"|"),1:KK) D
.... I GMTSAV=1 W " (AV"
.... E W $S($P(GMTSAL(II,JJ,KK,L),U,5)=1:" (V",$P(GMTSAL(II,JJ,KK,L),U,5)=0:" (NV",1:"")
.... W $S($P($G(^GMR(120.8,GMTSALNM,0)),U,6)="h":"/Historical)",$P($G(^(0)),U,6)="o":"/Observed)",1:")")
.... I $L($P($G(WKK),"|",2)) D CKP^GMTSUP Q:$D(GMTSQIT) W !,?24,$P(WKK,"|",2)
.... S (M,MX,ALL)=0 F S M=$O(GMTSAL(II,JJ,KK,L,"S",M)) Q:M="" D Q:$D(GMTSQIT)
..... I ALL=0 D CKP^GMTSUP Q:$D(GMTSQIT) W !?27
..... S MX=MX+1
..... W:MX>1 ", "
..... S N=$P(GMTSAL(II,JJ,KK,L,"S",M),";")
..... S ALL=1 I (74)'>($X+$L(N)) D CKP^GMTSUP Q:$D(GMTSQIT) W !,?27,N Q
..... S ALL=1 W N
.... D SIGBLK($P(GMTSAFN,U,5))
.... D CKP^GMTSUP Q:$D(GMTSQIT) W !,?24,"Date/Time: " S ODT=$P(GMTSAFN,U,4) S X=ODT D REGDTM4^GMTSU W X,!
....S CC="" F S CC=$O(^GMR(120.8,GMTSALNM,26,"B",CC)) Q:CC="" D CKP^GMTSUP Q:$D(GMTSQIT) W !,?24,"Comments at: " S X=CC D REGDTM4^GMTSU S CD=X S CCC=0 F S CCC=$O(^GMR(120.8,GMTSALNM,26,"B",CC,CCC)) Q:'CCC D TEXT
Q
NKA ; No known allergies
D CKP^GMTSUP Q:$D(GMTSQIT) W:$L($G(GMTSALAS))!($L($G(GMTSALAD))) !
D CKP^GMTSUP Q:$D(GMTSQIT) W:$L($G(GMTSALAS)) ?22,$G(GMTSALAS),!
D CKP^GMTSUP Q:$D(GMTSQIT) W:$L($G(GMTSALAS))!($L($G(GMTSALAD)))!($L($G(GMTSALAW))) ?24,"Assessment date: ",$G(GMTSALAD),!
D CKP^GMTSUP Q:$D(GMTSQIT) W:$L($G(GMTSALAW)) ?28,"Assessed by: ",GMTSALAW,!
D CKP^GMTSUP Q:$D(GMTSQIT) W:$L($G(GMTSALAW))&($L($G(GMTSALAT))) ?34,"Title: ",GMTSALAT,!
Q
GETALLRG ; Get Allergies
S GMRA="0^0^111^1" D EN1^C0QGMRAD I GMRAL="" S ALLRG=0 Q
I +($G(DFN))>0,+($G(GMRAL))=0 D ALLAS S ALLRG=0 Q
I $D(GMRAL)>9 D
. S I=0 F GMTSCNT=1:1 S I=$O(GMRAL(I)) Q:'I D
.. S GMTSTY=$P(GMRAL(I),U,7) Q:GMTSTY']""
.. S GMTSEACT=$P(GMRAL(I),U,2) Q:GMTSEACT']""
.. S GMTSMECH=$P($P(GMRAL(I),U,8),";")
.. S:GMTSMECH']"" GMTSMECH="UNKNOWN"
.. S GMTSAL(GMTSTY,GMTSMECH,GMTSEACT,GMTSCNT)=I_"^"_GMRAL(I)
.. S JJ=0 F S JJ=$O(GMRAL(I,"S",JJ)) Q:'JJ S GMTSAL(GMTSTY,GMTSMECH,GMTSEACT,GMTSCNT,"S",JJ)=GMRAL(I,"S",JJ)
.. S ALLRG=1
Q
ALLAS ; Allergy Assessment
N X,GMTSALG1,GMTSALG2,GMTSALG3,GMTSAU S (GMTSALAS,GMTSALAD,GMTSALAW)="" S GMTSALAS="No known allergies"
S GMTSALAD=$$GET1^DIQ(120.86,+($G(DFN)),3,"I",,"GMTSALG2") S:$D(GMTSALG2) GMTSALAD="" S:+GMTSALAD=0 GMTSALAD=""
I +GMTSALAD>0 S X=GMTSALAD D REGDT4^GMTSU S GMTSALAD=X
S GMTSAU=$$GET1^DIQ(120.86,+($G(DFN)),2,"I")
S GMTSALAW=$$GET1^DIQ(200,(+GMTSAU_","),.01,"E",,"GMTSALG3")
S GMTSALAT=$$GET1^DIQ(200,(+GMTSAU_","),20.3)
S:$D(GMTSALG3) (GMTSALAW,GMTSALAT)=""
Q
AUTOV ; Autoverify
S GMTSAV=0,GMTSALNM=$P(GMTSAL(II,JJ,KK,L),U),GMTSAFN=$G(^GMR(120.8,GMTSALNM,0))
I $P(GMTSAFN,U,18)="",$P(GMTSAFN,U,16)=1 S GMTSAV=1
Q
TITLE ; Print title
D CKP^GMTSUP Q:$D(GMTSQIT)
I $D(GMTSPNF) W ?21,TITLE,!
E W ?21,"Title: ",TITLE,!
Q
TEXT ; Setup for print of allergy comments
W ?31,CD D CKP^GMTSUP Q:$D(GMTSQIT)
K ^UTILITY($J,"W") S GMTSLN=0 F S GMTSLN=$O(^GMR(120.8,GMTSALNM,26,CCC,2,GMTSLN)) Q:'GMTSLN S GMTSPRT=^GMR(120.8,GMTSALNM,26,CCC,2,GMTSLN,0) D FORMAT
I $D(^UTILITY($J,"W")) F GMTSLN=1:1:^UTILITY($J,"W",DIWL) D LINE Q:$D(GMTSQIT)
K ^UTILITY($J,"W")
Q:'GMTSLN
W ! Q
FORMAT ; Formats each line
S DIWL=3,DIWR=80,DIWF="C58",X=GMTSPRT D ^DIWP
Q
LINE ; Writes formatted lines of text
D CKP^GMTSUP Q:$D(GMTSQIT) W !,?24,^UTILITY($J,"W",DIWL,GMTSLN,0)
Q
SIGBLK(GMTSALF) ; Signature block
Q:+GMTSALF'>0 N GMTSSB,GMTSST,GMTSSN S GMTSSB=$$GET1^DIQ(200,(+GMTSALF_","),20.2),GMTSST=$$GET1^DIQ(200,(+GMTSALF_","),20.3),GMTSSN=$$GET1^DIQ(200,(+GMTSALF_","),.01)
D CKP^GMTSUP Q:$D(GMTSQIT) W !!,?24,"Originator: ",$S(GMTSSB'="":GMTSSB,1:GMTSSN)
D CKP^GMTSUP Q:$D(GMTSQIT) W:$L(GMTSST) !,?24,"Title: ",GMTSST
Q

View File

@ -0,0 +1,91 @@
C0QHF ; GPL - Health Factor Utility Routines ;9/02/11 17:05
;;0.1;C0Q;nopatch;noreleasedate;Build 26
;Copyright 2011 George Lilly. Licensed under the terms of the GNU
;General Public License See attached copy of the License.
;
;This program is free software; you can redistribute it and/or modify
;it under the terms of the GNU General Public License as published by
;the Free Software Foundation; either version 2 of the License, or
;(at your option) any later version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License along
;with this program; if not, write to the Free Software Foundation, Inc.,
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
;
Q
;
; these routines are for quick lookups on HEALTH FACTOR and V HEALTH FACTOR
; files...
;
; from the DD:
;STANDARD DATA DICTIONARY #9000010.23 -- V HEALTH FACTORS FILE
;STORED IN ^AUPNVHF( (6744 ENTRIES)
;CROSS REFERENCED BY: PATIENT NAME(AATOO), HEALTH FACTOR(AATOO1), VISIT(AD),
; VISIT(AV10), HEALTH FACTOR(B), PATIENT NAME(C)
;
;STANDARD DATA DICTIONARY #9999999.64 -- HEALTH FACTORS FILE
;STORED IN ^AUTTHF( (8656 ENTRIES)
;CROSS REFERENCED BY: CATEGORY(AC), ENTRY TYPE(AD), FACTOR(B), SYNONYM(D)
;
HFYN(DFN,C0QHF) ; EXTRINSIC RETURNS 1 (YES) OR 0 (NO) IF A PATIENT
; HAS A HEALTH FACTOR
N ZI,ZJ,ZR
S ZI=$O(^AUTTHF("B",C0QHF,"")) ; HEALTH FACTOR IEN
I ZI="" D Q 0 ;
. W !,"BAD HEALTH FACTOR: ",C0QHF
I $D(^AUPNVHF("AA",DFN,ZI)) S ZR=1
E S ZR=0
Q ZR
;
HFIEN(ZHF) ; EXTRINSIC RETURNS THE IEN OF THE HEALTHFACTOR
N ZI
S ZI=$O(^AUTTHF("B",ZHF,"")) ; HEALTH FACTOR IEN
Q ZI
;
VHFIEN(DFN,ZHF) ; EXTRINSIC RETURNS THE LAST IEN OF THIS HEALTH FACTOR
; FOR THE PATIENT
N ZG,ZJ,ZK
S ZG=$$HFIEN(ZHF)
I ZG="" Q ; OPPS HEALTH FACTOR NOT FOUND
S ZJ=$O(^AUPNVHF("AA",DFN,ZG,""),-1) ;DATE
S ZK=$O(^AUPNVHF("AA",DFN,ZG,ZJ,"")) ;IEN
Q ZK
;
HFCAT(RTN,DFN,C0QHFCAT) ; C0QFHCAT IS A HEALTH FACTOR CATEGORY
; RTN IS PASSED BY REFERENCE AND RETURNS AN ARRAY OF HEALTH FACTORS
; THAT THE PATIENT HAS IN THE CATEGORY. RETURNS NULL IF NONE
; FORMAT RNT(HEALTH FACTOR IEN,HEALTH FACTOR NAME)=""
N ZI
S ZI=$O(^AUTTHF("B",C0QHFCAT,"")) ; HEALTH FACTOR CATEGORY IEN
N C0QN,C0QO,C0QR
S C0QO=$NA(^AUPNVHF("AA",DFN)) ; ALL THE PATIENT'S HEALTH FACTORS
S C0QN=$NA(^AUTTHF("AC",ZI)) ; ALL HEALTH FACTORS IN THIS CATEGORY
D UNITY^C0QSET("C0QR",C0QN,C0QO) ; THE DIFFERENCE
K RTN ; CLEAR THE RETURN ARRAY
N ZJ S ZJ=""
F S ZJ=$O(C0QR(1,ZJ)) Q:ZJ="" D ; FOR ALL HEALTH FACTOR MATCHES
. S RTN(ZJ,$P(^AUTTHF(ZJ,0),"^",1))=""
Q
;
HFLCAT(RTN,C0QHFCAT) ; RETURNS A LIST OF PATIENTS WHO HAVE A HEALTH FACTOR
; IN THE C0QHFCAT CATEGORY. RTN IS PASSED BY REFERENCE
; THIS WILL BE HARD TO DO WITHOUT SOME NEW INDEXES
Q
;
HFLPAT(RTN,C0QHF) ; RETURNS A LIST OF PATIENTS WHO HAVE A SPECIFIC HEALTH
; FACTOR. RTN IS PASSED BY REFERENCE
; THIS ONE ALSO WILL BE HARD TO DO QUICKLY WITHOUT A NEW INDEX
Q
;
INDEXES(DDREF) ;PRINT THE INDEXES ACTUALLY ON FILE DDREF
; IE D INDEXES($NA(^DD))
N ZI
S ZI="A"
F S ZI=$O(@DDREF@(ZI)) Q:ZI="" W !,ZI
Q
;

View File

@ -0,0 +1,52 @@
C0QIMMUN ;Prep Immunization Order data for HL7 Message creation ;
;;0.1;C0Q;nopatch;noreleasedate;Build 26
; ^XTMP("C0QIMMUN",0)=purge date^create date
; ^XTMP("C0QIMMUN",order_date,order#,item_name)=item_value
; ^XTMP("C0QIMMUN","LASTORDR")=last order processed
FIND ; Find the next set of immunization orders
N X1,X2,X,%,%DT,%H,%T,NOW,ORDER,LASTORDR,SUBSC,DIR
S LASTORDR=+$G(^XTMP("C0QIMMUN","LASTORDR"))
W !,"The ""Last Order"" from which to begin checking for Immunization orders is: ",LASTORDR
S DIR("A")="Do you want to reset that value"
S DIR(0)="Y",DIR("B")="NO" D ^DIR D:Y=1
. S DIR("A")="What value shall be used?"
. S DIR(0)="NO",DIR("B")=LASTORDR D ^DIR
. W:Y'>0 !,"We'll skip reseting it then."
. D:Y>0
. . S LASTORDR=+Y
. . L +^XTMP("C0QIMMUN")
. . S X1=DT,X2=365 D C^%DTC
. . S ^XTMP("C0QIMMUN",0)=X_U_DT
. . S ^XTMP("C0QIMMUN","LASTORDR")=LASTORDR
. . L -^XTMP("C0QIMMUN")
. . Q
. Q
S DIR("A")="Ready to prep more immunization orders for HL7 messages"
S DIR(0)="Y",DIR("B")="YES" D ^DIR Q:Y'=1
L +^XTMP("C0QIMMUN")
I '$D(^XTMP("C0QIMMUN",0)) D
. S X1=DT,X2=365 D C^%DTC
. S ^XTMP("C0QIMMUN",0)=X_U_DT
. S ^XTMP("C0QIMMUN","LASTORDR")=0
S ORDER=^XTMP("C0QIMMUN","LASTORDR")
F S ORDER=$O(^OR(100,ORDER)) Q:ORDER'>0 D
. S LASTORDR=ORDER
. D:$D(^OR(100,ORDER,4.5,"ID","ORZ HL7")) GOTONE
. Q
S ^XTMP("C0QIMMUN","LASTORDR")=LASTORDR
W !,"Done",!,"Last Order processed: ",LASTORDR,!
L -^XTMP("C0QIMMUN")
Q
GOTONE ; Take the order number and move the relevant HL7 information into ^XTMP
S NOW=$P(^OR(100,ORDER,0),U,7)
S ^XTMP("C0QIMMUN",NOW,ORDER,"PATIENT")=$P(^OR(100,ORDER,0),U,2)
S ^XTMP("C0QIMMUN",NOW,ORDER,"LOCATION")=$P(^OR(100,ORDER,0),U,10)
S ^XTMP("C0QIMMUN",NOW,ORDER,"ORDEREDBY")=$P(^OR(100,ORDER,0),U,6)
S ENTRY=0 F S ENTRY=$O(^OR(100,ORDER,4.5,ENTRY)) Q:ENTRY'>0 D
. S SUBSC=$P($G(^OR(100,ORDER,4.5,ENTRY,0)),U,4)
. Q:'$L(SUBSC)
. I SUBSC'="TIME" S ^XTMP("C0QIMMUN",NOW,ORDER,SUBSC)=^OR(100,ORDER,4.5,ENTRY,1)
. E S X=^OR(100,ORDER,4.5,ENTRY,1),%DT="TS" D ^%DT S ^XTMP("C0QIMMUN",NOW,ORDER,SUBSC)=Y
. Q
S ^XTMP("C0QIMMUN",NOW,ORDER,"ORDERTEXT")=$G(^OR(100,ORDER,8,1,.1,1,0))
Q

View File

@ -0,0 +1,72 @@
C0QINIT ; GPL - Quality Reporting Initialization Routines ;12/01/11 17:05
;;0.1;C0Q;nopatch;noreleasedate;Build 26
;Copyright 2011 George Lilly. Licensed under the terms of the GNU
;General Public License See attached copy of the License.
;
;This program is free software; you can redistribute it and/or modify
;it under the terms of the GNU General Public License as published by
;the Free Software Foundation; either version 2 of the License, or
;(at your option) any later version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License along
;with this program; if not, write to the Free Software Foundation, Inc.,
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
;
Q
;
C0QQFN() Q 1130580001.101 ; FILE NUMBER FOR C0Q QUALITY MEASURE FILE
C0QMFN() Q 1130580001.201 ; FILE NUMBER FOR C0Q MEASUREMENT FILE
C0QMMFN() Q 1130580001.2011 ; FN FOR MEASURE SUBFILE
C0QMMNFN() Q 1130580001.20111 ; FN FOR NUMERATOR SUBFILE
C0QMMDFN() Q 1130580001.20112 ; FN FOR DENOMINATOR SUBFILE
RLSTFN() Q 810.5 ; FN FOR REMINDER PATIENT LIST FILE
RLSTPFN() Q 810.53 ; FN FOR REMINDER PATIENT LIST PATIENT SUBFILE
C0QALFN() Q 1130580001.311 ; FILE NUMBER FOR C0Q PATIENT LIST PATIENT SUBFILE ;
;
COPYQ ; INTERACTIVE COPY OF A QUALITY MEASURE
N FN
S FN=$$C0QQFN
S DIC=FN,DIC(0)="AEMQ" D ^DIC
I Y<1 Q ; EXIT
S C0QIEN=$P(Y,U)
;N G,ZWP
D GETS^DIQ(FN,C0QIEN,"**","EI","G")
M ZWP=G(FN,C0QIEN_",",.61)
; GET READY TO CREATE THE NEW COPY
; FIRST FIND OUT THE NEW NAME
N QNAME
S QNAME=G(FN,C0QIEN_",",.01,"E")
S DIR(0)="F^3:240"
S DIR("A")="New Measure Name"
S DIR("B")=QNAME
D ^DIR
I Y="^" Q ;
N QNEW
S QNEW=Y
K C0QFDA
N ZI S ZI=""
F S ZI=$O(G(FN,C0QIEN_",",ZI)) Q:ZI="" D ; FOR EACH FIELD
. I ZI=.01 D Q ; THE NEW NAME
. . S C0QFDA(FN,"+1,",.01)=QNEW ; NEW MEASURE NAME
. I ZI=3.1 Q ; SKIP THE COMPUTED FIELD
. S C0QFDA(FN,"+1,",ZI)=G(FN,C0QIEN_",",ZI,"I")
D UPDIE ; CREATE THE NEW RECORD
S DIE=$$C0QQFN ; GET READY TO EDIT IT
D EN^DIB ; EDIT THE NEW RECORD
Q
;
UPDIE ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS
K ZERR
D CLEAN^DILF
ZWR C0QFDA
D UPDATE^DIE("","C0QFDA","","ZERR")
I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST,
; INVOKE THE ERROR TRAP IF TASKED
K C0QFDA
Q
;

View File

@ -0,0 +1,356 @@
C0QMAIN ; GPL - Quality Reporting Main Processing ;10/13/10 17:05
;;0.1;C0Q;nopatch;noreleasedate;Build 26
;Copyright 2009 George Lilly. Licensed under the terms of the GNU
;General Public License See attached copy of the License.
;
;This program is free software; you can redistribute it and/or modify
;it under the terms of the GNU General Public License as published by
;the Free Software Foundation; either version 2 of the License, or
;(at your option) any later version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License along
;with this program; if not, write to the Free Software Foundation, Inc.,
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
;
Q
;
C0QQFN() Q 1130580001.101 ; FILE NUMBER FOR C0Q QUALITY MEASURE FILE
C0QMFN() Q 1130580001.201 ; FILE NUMBER FOR C0Q MEASUREMENT FILE
C0QMMFN() Q 1130580001.2011 ; FN FOR MEASURE SUBFILE
C0QMMNFN() Q 1130580001.20111 ; FN FOR NUMERATOR SUBFILE
C0QMMDFN() Q 1130580001.20112 ; FN FOR DENOMINATOR SUBFILE
RLSTFN() Q 810.5 ; FN FOR REMINDER PATIENT LIST FILE
RLSTPFN() Q 810.53 ; FN FOR REMINDER PATIENT LIST PATIENT SUBFILE
C0QALFN() Q 1130580001.311 ; FILE NUMBER FOR C0Q PATIENT LIST PATIENT SUBFILE ;
EXPORT ; EXPORT ENTRY POINT FOR CCR
; Select a patient.
N C0QMS,C0QM,C0QMIEN,C0QNA,C0QNORD
S C0QNORD=3 ; WE WANT DENOMINATORS USE 1 FOR NUMERATORS
S DIC=$$C0QMFN,DIC(0)="AEMQ" D ^DIC
I Y<1 Q ; EXIT
S C0QMS=$P(Y,U,1) ; SET THE MEASURE SET
S DIC=$$C0QQFN,DIC(0)="AEMQ" D ^DIC
I Y<1 Q ; EXIT
S C0QM=$P(Y,U,1) ; SET THE MEASURE IEN
N C0QMN S C0QMN=$P(Y,U,2) ; SET THE MEASURE NAME
S C0QMIEN=$O(^C0Q(201,C0QMS,5,"B",C0QM,""))
S C0QNA=$NA(^C0Q(201,C0QMS,5,C0QMIEN,C0QNORD,"B"))
N ZI S ZI=""
F S ZI=$O(@C0QNA@(ZI)) Q:ZI="" D ;
. W !,ZI
. N ONAME S ONAME=C0QMN_"_"_ZI_"_CCR_V1_0_0.xml"
. D XPAT^C0CCCR(ZI,,,ONAME) ; EXPORT TO A FILE
Q
;
NBYP ; ENTRY POINT FOR COMMAND LINE BY PATIENT MEASURE LISTING
;
S DIC=$$C0QMFN,DIC(0)="AEMQ" D ^DIC
I Y<1 Q ; EXIT
N MSIEN S MSIEN=+Y
W !,"NUMERATOR PATIENT LIST",!
N C0QPAT
D PATS(.C0QPAT,MSIEN,"N") ; GET THE NUMERATOR PATIENT LIST
I $D(C0QPAT) D ; LIST RETURNED
. ;
Q
;
DBYP ; ENTRY POINT FOR COMMAND LINE BY PATIENT MEASURE LISTING
;
S DIC=$$C0QMFN,DIC(0)="AEMQ" D ^DIC
I Y<1 Q ; EXIT
N MSIEN S MSIEN=+Y
N C0QPAT
W !,"DENOMINATOR PATIENT LIST",!
D PATS(.C0QPAT,MSIEN,"D") ; GET THE NUMERATOR PATIENT LIST
I $D(C0QPAT) D ; LIST RETURNED
. ;
. ;
Q
;
ENEXP ; EXTERNAL MENU ENTRY POINT FOR EXP
;
S DIC=$$C0QMFN,DIC(0)="AEMQ" D ^DIC
I Y<1 Q ; EXIT
N MSIEN S MSIEN=+Y
D EXP(MSIEN)
Q
;
EXP(MSET,NOEX) ; EXPORT ALL PATIENTS FOR MEASURE SET IEN MSET
; ALSO, WRITE OUT THE BY PATIENT MEASURE TEXT FILE
; IF NOEX=1, THEN ONLY THE MEASURE TEXT FILE GETS WRITTEN, NO EXPORTS ARE
; DONE
I '$D(NOEX) S NOEX=0
N ZQI,ZARY,ZFN,ODIR
S ZQI=""
D PATS(.ZARY,MSET,"D",1)
S ZFN="MEASURES-BY-PATIENT.txt"
S ODIR=^TMP("C0CCCR","ODIR") ; OUTPUT DIRECTORY
S GARY=$NA(^TMP("C0Q",$J))
K @GARY
M @GARY=ZARY
S GARY1=$NA(@GARY@(1))
N ZY
S ZY=$$OUTPUT^C0CXPATH(GARY1,ZFN,ODIR)
W !,ZY
I NOEX=1 Q ; DO NOT EXPORT
F S ZQI=$O(ZARY(ZQI)) Q:ZQI="" D ; FOR EACH PATIENT
. D XPAT^C0CCCR(+ZARY(ZQI)) ;
Q
;
PATS(ZRTN,MSIEN,NORD,QT) ; BUILDS A LIST OF PATIENTS AND THEIR MEASURES
; FOR MEASURE SET MSET. NORD="N" (DEFAULT) MEANS NUMERATOR PATIENTS
; NORD="D" MEANS DENOMINATOR PATIENTS
; QT=1 MEANS QUIET
I $G(QT)'=1 S QT=0
N ZI,ZJ,ZK,ZIDX,ZN,ZM
S ZN=0 ; COUNT OF PATIENTS
S ZI=""
; GOING TO USE THE NUMERATOR BY PATIENT INDEX
I '$D(NORD) S NORD="N"
I '((NORD="N")!(NORD="D")) S NORD="N"
I NORD="N" S ZIDX=$NA(^C0Q(201,"ANBYP"))
E S ZIDX=$NA(^C0Q(201,"ADBYP"))
F S ZI=$O(@ZIDX@(ZI)) Q:ZI="" D ; FOR EACH PATIENT
. I $O(@ZIDX@(ZI,MSIEN,""))'="" D ; IF PATIENT IS IN THIS SET
. . I 'QT W !,$$GET1^DIQ(2,ZI_",",.01) ;PATIENT NAME
. . S ZN=ZN+1 ; INCREMENT PATIENT COUNT
. . S ZRTN(ZN)=ZI
. E Q ; NEXT PATIENT
. S (ZJ,ZK)=""
. F S ZJ=$O(@ZIDX@(ZI,MSIEN,ZJ)) Q:ZJ="" D ; FOR EACH MEASURE
. . ;S ZL=$O(@ZIDX@(ZI,MSIEN,ZJ,"")) ; MEASURE IS FOURTH
. . S ZK=""
. . S ZK=$$GET1^DIQ($$C0QMMFN,ZJ_","_MSIEN_",",.01,"I")
. . ;W !,"ZK:",ZK," ZJ:",ZJ," ZI",ZI,!
. . S ZM=$$GET1^DIQ($$C0QQFN,ZK_",",.01) ; MEASURE NAME
. . I 'QT W " ",ZM
. . S ZRTN(ZN)=ZRTN(ZN)_" "_ZM
Q
;
EN ; ENTRY POINT FOR COMMAND LINE AND MENU ACCESS TO C0QRPC
;
S DIC=$$C0QMFN,DIC(0)="AEMQ" D ^DIC
I Y<1 Q ; EXIT
N MSIEN S MSIEN=+Y
;D C0QRPC(.G,MSIEN)
D UPDATE^C0QUPDT(.G,MSIEN)
Q
;
EN2 ; SUMMARY ENTRY POINT FOR COMMAND LINE AND MENU ACCESS TO C0QRPC
;
S DIC=$$C0QMFN,DIC(0)="AEMQ" D ^DIC
I Y<1 Q ; EXIT
N MSIEN S MSIEN=+Y
; changed by gpl to call the new UPDATE^C0QUPDT routine instead
D UPDATE^C0QUPDT(.G,MSIEN)
Q
; end gpl change
S C0QSUM=1
D C0QRPC(.G,MSIEN)
; iterate over the measures
S MEASURE=0
F S MEASURE=$O(^C0Q(201,MSIEN,5,MEASURE)) Q:MEASURE'>0 D
. S NUMER=0,DENOM=0
. ; now count the numerator patients
. S P=0 F S P=$O(^C0Q(201,MSIEN,5,MEASURE,1,P)) Q:P'>0 S NUMER=NUMER+1
. S $P(^C0Q(201,MSIEN,5,MEASURE,2),U)=NUMER
. ; and count the denominator patients
. S P=0 F S P=$O(^C0Q(201,MSIEN,5,MEASURE,3,P)) Q:P'>0 S DENOM=DENOM+1
. Q:DENOM=0
. ; and stuff the values
. S $P(^C0Q(201,MSIEN,5,MEASURE,4),U,1,2)=DENOM_U_$J(100*NUMER/DENOM,0,0)
. Q
Q
;
C0QRPC(RTN,MSET,FMT,NOPURGE) ; RPC FORMAT
; MSET IS THE NAME OR IEN OF THE MEASURE SET
; RTN IS THE RETURN ARRAY OF THE RESULTS PASSED BY REFERENCE
; FMT IS THE FORMAT OF THE OUTPUT - "ARRAY" OR "HTML" OR "XML"
; NOTE: ARRAY IS DEFAULT AND THE OTHERS ARE NOT IMPLEMENTED YET
; IF NOPURGE IS 1, PATIENT LISTS WILL NOT BE DELETED BEFORE ADDING
; IF NOPURGE IS 0 OR OMITTED, PATIENT LISTS WILL BE DELETED THEN ADDED
;W !,"LOOKING FOR MEASURE SET ",MSET,!
N ZI S ZI=""
N C0QM ; FOR HOLDING THE MEASURES IN THE SET
D LIST^DIC($$C0QMMFN,","_MSET_",",".01I") ; GET ALL THE MEASURES
D DELIST("C0QM")
N ZII S ZII=0
F S ZII=$O(C0QM(ZII)) Q:+ZII=0 D ; FOR EACH MEASURE
. D CLEARMEA(MSET,ZII) ; FIRST CLEAR OUT THE MEASURE
K C0QM
D CLEAN^DILF
D LIST^DIC($$C0QMMFN,","_MSET_",",".01I") ; GET ALL THE MEASURES AGAIN
D DELIST("C0QM")
F S ZII=$O(C0QM(ZII)) Q:ZII="" D ; FOR EACH MEASURE
. S ZI=$P(C0QM(ZII),U,1) ; IEN OF THE MEASURE IN THE C0Q QUALITY MEAS FILE
. ;W $$GET1^DIQ($$C0QQFN,ZI_",","DISPLAY NAME"),!
. ;N C0QNL,C0QDL ;NUMERATOR AND DENOMINATOR LIST POINTERS
. ;W !,"MEASURE: ",$$GET1^DIQ($$C0QQFN,ZI_",",.01),! ; PRINT THE MEASURE NAME
. ; FOLLOW THE POINTERS TO THE C0Q QUALITYM MEASURE FILE AND GET LIST PTRS
. S C0QNL=$$GET1^DIQ($$C0QQFN,ZI_",",1,"I") ; NUMERATOR POINTER
. I C0QNL="" D ; CHECK ALTERNATE LIST
. . S C0QNL=$$GET1^DIQ($$C0QQFN,ZI_",",1.1,"I") ; NUMERATOR POINTER
. . I C0QNL'="" S C0QNALT=1
. S C0QDL=$$GET1^DIQ($$C0QQFN,ZI_",",2,"I") ; DENOMINATOR POINTER
. I C0QDL="" D ; CHECK ALTERNATE LIST
. . S C0QDL=$$GET1^DIQ($$C0QQFN,ZI_",",2.1,"I") ; DENOMINATOR POINTER
. . I C0QDL'="" S C0QDALT=1
. ; NOW FOLLOW THE LIST POINTERS TO THE REMINDER PATIENT LIST FILE
. ;W "NUMERATOR: ",$$GET1^DIQ($$RLSTFN,C0QNL_",","NAME"),!
. ; FIRST PROCESS THE NUMERATOR
. K ^TMP("DILIST",$J)
. N C0QUFN ; FILE NUMBER TO USE
. I $G(C0QNALT)=1 S C0QUFN=$$C0QALFN()
. E S C0QUFN=$$RLSTPFN
. D LIST^DIC(C0QUFN,","_C0QNL_",",".01I") ; GET THE LIST OF PATIENTS
. ;D DELIST("G") ;
. ;I $D(G) ZWR G
. K C0QNUMP
. S NCNT=$O(^TMP("DILIST",$J,"ID",""),-1) ; NUMERATOR COUNT
. N ZJ S ZJ=""
. F S ZJ=$O(^TMP("DILIST",$J,"ID",ZJ)) Q:ZJ="" D ;
. . S ZDFN=^TMP("DILIST",$J,"ID",ZJ,.01)
. . S C0QNUMP("N",ZJ,ZDFN)=""
. ;I '$G(C0QSUM) ZWR ^TMP("DILIST",$J,1,*) ; LIST THE PATIENT NAMES
. D ADDPATS(MSET,ZII,"C0QNUMP")
. ; NEXT PROCESS THE DENOMINATOR
. ;W "DENOMINATOR: ",$$GET1^DIQ($$RLSTFN,C0QDL_",","NAME"),!
. K ^TMP("DILIST",$J)
. I $G(C0QDALT)=1 S C0QUFN=$$C0QALFN()
. E S C0QUFN=$$RLSTPFN
. D LIST^DIC(C0QUFN,","_C0QDL_",",".01I") ; GET THE LIST OF PATIENTS
. ;D DELIST("G")
. ;I $D(G) ZWR G
. ;S ZJ=""
. S DCNT=$O(^TMP("DILIST",$J,"ID",""),-1) ; DENOMONIATOR COUNT
. K C0QDEMP
. F S ZJ=$O(^TMP("DILIST",$J,"ID",ZJ)) Q:ZJ="" D ;
. . S ZDFN=^TMP("DILIST",$J,"ID",ZJ,.01)
. . S C0QDEMP("D",ZJ,ZDFN)=""
. D ADDPATS(MSET,ZII,"C0QDEMP")
. ;I $G(C0QSUM)'=1 ZWR ^TMP("DILIST",$J,1,*) ; LIST THE PATIENT NAMES
. ;E D ;
. ;. W "NUM CNT: ",NCNT
. ;. W " DEN CNT: ",DCNT,!
Q
;
CLEARMEA(MSET,MEAS) ; DELETE AND THEN RECREATE AS EMPTY THE
; MEASURE MEAS IN MEASURE SET IEN MSET
;
N C0QFDA,MFN,MEASURE
S MFN=$$C0QMMFN() ; FILE NUMBER FOR MEASURE SUBFILE
D CLEAN^DILF
S MEASURE=$$GET1^DIQ(MFN,MEAS_","_MSET_",",.01,"I") ; MEASURE POINTER
D CLEAN^DILF
K ZERR
S C0QFDA(MFN,MEAS_","_MSET_",",.01)="@" ; GET READY TO DELETE THE MEASURE
D FILE^DIE(,"C0QFDA","ZERR") ; KILL THE SUBFILE
I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST, INVOKE THE ERROR TRAP IF TASKED
;. W "ERROR",!
;. ZWR ZERR
;. B
K C0QFDA
S C0QFDA(MFN,"+1,"_MSET_",",.01)=MEASURE ; GET READY TO RECREATE THE SUBFILE
D UPDIE ; CREATE THE SUBFILE
Q
;
ADDPATS(MSET,MEAS,PATS) ;ADD PATIENTS TO NUMERATOR AND DENOMINATOR
; OF MEASURE SET IEN MSET MEASURE IEN MEAS
; PATS IS OF THE FORM @PATS@("N",X,DFN)="" AND @PATS@("D",X,DFN)=""
; WHERE N IS FOR NUMERATOR AND D IS FOR DENOMINATOR AND X 1..N
; IF PATIENTS ARE ALREADY THERE, THEY WILL NOT BE ADDED AGAIN
N C0QI,C0QJ
N C0QFDA
S C0QI=""
F S C0QI=$O(@PATS@("N",C0QI)) Q:C0QI="" D ; FOR EACH NUMERATOR PATIENT
. S C0QFDA($$C0QMMNFN,"?+"_C0QI_","_MEAS_","_MSET_",",.01)=$O(@PATS@("N",C0QI,""))
;W "ADDING NUMERATOR",!
;I $D(C0QFDA) ZWR C0QFDA
I $D(C0QFDA) D UPDIE
K C0QFDA
S C0QI=""
F S C0QI=$O(@PATS@("D",C0QI)) Q:C0QI="" D ; FOR EACH NUMERATOR PATIENT
. S C0QFDA($$C0QMMDFN,"?+"_C0QI_","_MEAS_","_MSET_",",.01)=$O(@PATS@("D",C0QI,""))
;W "ADDING DENOMINATOR",!
;I $D(C0QFDA) ZWR C0QFDA
I $D(C0QFDA) D UPDIE
Q
;
DELIST(RTN) ; DECODES ^TMP("DILIST",$J) INTO
; @RTN@(IEN)=INTERNAL VALUE^EXTERNAL VALUE
N ZI,IV,EV,ZDI,ZIEN
S ZI=""
S ZDI=$NA(^TMP("DILIST",$J))
K @RTN
F S ZI=$O(@ZDI@(1,ZI)) Q:ZI="" D ;
. S EV=@ZDI@(1,ZI) ;EXTERNAL VALUE
. S IV=$G(@ZDI@("ID",ZI,.01)) ; INTERNAL VALUE
. S ZIEN=@ZDI@(2,ZI) ; IEN
. S @RTN@(ZIEN)=IV_"^"_EV
Q
;
DELPATS(MSET,MEAS,NDEL) ; DELETE PATIENTS FROM NUMERATOR AND DENOMINATOR
; FOR A MEASURE (ONLY AFFECTS THE C0Q MEASURES FILE)
; MSET IS THE IEN OF THE MEASURE SET
; MEAS IS THE IEN OF THE MEASURE
; NDEL IS A LIST OF PATIENTS TO NOT DELETE (NOT IMPLEMENTED YET)
; IN THE FORM @NDEL@("N",IEN,DFN)="" FOR NUMERATOR PATIENTS
; AND @NDEL@("D",IEN,DFN)="" FOR DENOMINATOR PATIENTS WHERE IEN IS
; THE IEN OF THE PATIENT RECORD IN THE SUBFILE
; THIS FEATURE WILL ALLOW EFFICIENCIES FOR LONG PATIENT LISTS
; IN THAT PATIENTS THAT ARE GOING TO BE ADDED ARE NOT FIRST DELETED
N C0QI,C0QJ
D LIST^DIC($$C0QMMFN,","_MSET_",")
K C0QFDA
;ZWR ^TMP("DILIST",$J,*)
;ZWR ^TMP("DIERR",$J,*)
;D
Q
;
UPDIE ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS
K ZERR
D CLEAN^DILF
D UPDATE^DIE("","C0QFDA","","ZERR")
I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST, INVOKE THE ERROR TRAP IF TASKED
;. W "ERROR",!
;. ZWR ZERR
;. B
K C0QFDA
Q
;
QUE ;QUE THE RUN OF THE PATIENT LISTS AND THE BUILD THE LISTS OF THE PATIENTS
;AND THEIR MEASURES
S MSIEN=$$GET^XPAR("DIV."_$P($$SITE^VASITE(),U,2),"C0Q MEASUREMENT TO USE")
N ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE
S ZTDESC="CREATE PATIENT LIST"
S ZTRTN="RUN^C0QMAIN"
S ZTSAVE("MSIEN")=""
S ZTIO=""
S ZTDTH=$$NOW^XLFDT
D ^%ZTLOAD
Q
;
RUN ; DO THE REAL WORK
I '$D(MSIEN) S MSIEN=$$GET^XPAR("DIV."_$P($$SITE^VASITE(),U,2),"C0Q MEASUREMENT TO USE")
S BEG=$P(^C0Q(201,MSIEN,4),U,3) ;Begin date
S END=$P(^C0Q(201,MSIEN,4),U,4) ;End date
S PATCREAT="N" ;Secure list - N=No
S PLISTPUG="N" ;Purge list after 5 years - N=No
S PXRMDPAT=0 ;Include deceased patients - N=No
S PXRMTPAT=0 ;Include test patients - N=No
S PXRMNODE="PXRMRULE" ;Node in ^TMP($J,"PXRMRULE"
N ZI S ZI=""
F S ZI=$O(^C0Q(201,MSIEN,5,"B",ZI)) Q:ZI'>0 D ; LOOP THROUGH EACH QM
. S PXRMLSTN=+$P(^C0Q(101,ZI,0),U,2) ; NUMERATOR MEASURE
. S PXRMLSTD=+$P(^C0Q(101,ZI,0),U,3) ; DENOMINATOR MEASURE
. S PXRMRULN=+$P(^PXRMXP(810.5,PXRMLSTN,0),U,6) ; RULES FOR THE LIST
. S PXRMRULD=+$P(^PXRMXP(810.5,PXRMLSTD,0),U,6)
. D RUN^PXRMLCR(PXRMRULD,PXRMLSTD,PXRMNODE,BEG,END,PXRMDPAT,PXRMTPAT)
. D RUN^PXRMLCR(PXRMRULN,PXRMLSTN,PXRMNODE,BEG,END,PXRMDPAT,PXRMTPAT)
D C0QRPC(.G,MSIEN)
Q

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,199 @@
C0QMUERX ; VEN - Analyze ERx Data for Patients ; 5/30/12 10:21am
;;1.0;C0Q;;May 21, 2012;Build 44
QUIT ; No Entry from the top
;
UT ; Unit Tests
N C0QDEBUG S C0QDEBUG=1
W "Testing ^DPT B Index",!
D EN("^DPT(""B"")")
W !,"Testing B Index on a C0Q Patient List",!
D EN("^C0Q(301,4,1,""B"")")
W !,"Testing ^AUPNPAT B Index",!
D EN("^AUPNPAT(""B"")")
W !,"Testing Reminder Patient List B Index",!
D EN("^PXRMXP(810.5,80,30,""B"")")
W !,"Testing upright file ^DPT",!
D EN("^DPT")
W !,"Testing a file with no data",!
D EN("^ALKJSDF")
W !,"Testing a no valid parameters",!
D EN("")
UT2 ; Units Tests 2
N C0QDEBUG S C0QDEBUG=1
D EN("^C0Q(301,4,1,""B"")")
QUIT
UT3 ; Unit test 3
N C0QDEBUG S C0QDEBUG=1
N GN S GN=$NA(^C0Q(301,32,1,"B"))
D EN(GN)
Q
;
EN(C0QLIST) ; PEP - Analyze ERx Data and store
; Parameters:
; C0QLIST - Pass by Name. Global or Local Reference.
; Can be: ^DPT("B") for all patients or ^C0Q(301,2,1,"B") for a specific patient list
; Future: Can be a search template on file 2 or 9000001
;
; Check if XML Soap Message is installed
I '$D(^C0PX("B","GETMEDS6")) WRITE "GETMEDS6 Soap Message not installed",! QUIT
;
; Check if SOAP^C0PWS2 exists
I '$L($T(SOAP^C0PWS2)) WRITE "C0PWS2 Doesn't exist",! QUIT
;
; Check C0QLIST for sanity. Must be a single node.
IF '($DATA(C0QLIST)#2)!(C0QLIST="") WRITE "You didn't pass the list",! QUIT
;
; Contents must be a Reference with Data
IF '$DATA(@C0QLIST) WRITE "Destination doesn't contain any data",! QUIT
;
; Is this a B index?
NEW C0QB
IF $QSUBSCRIPT(C0QLIST,$QLENGTH(C0QLIST))="B" DO
. SET C0QB=1
. ; DEBUG
. W:$G(C0QDEBUG) "B index passed",!
. ; DEBUG
ELSE SET C0QB=0
;
; Make sure our TMP is empty
K ^TMP($J)
;
; Walk the global
N C0QWALK S C0QWALK=$SELECT(C0QB:"",'C0QB:0) ; Walker
N C0QDONE S C0QDONE=0 ; Finish Flag
FOR SET C0QWALK=$O(@C0QLIST@(C0QWALK)) QUIT:C0QDONE DO
. ; Are we done?
. I C0QB,C0QWALK="" S C0QDONE=1 QUIT ; If in index and we are out, done
. I 'C0QB,'+C0QWALK S C0QDONE=1 QUIT ; If not in index and we are not numeric, done
. ;
. N C0QDFN ; DFN of Patient
. ; If Walking B Index and Index not numeric, grab DFN (assuming ^DPT or ^AUPNPAT)
. ; TODO: Should I check that the global is ^DPT or ^AUPNPAT?
. I C0QB,'+C0QWALK S C0QDFN=$O(@C0QLIST@(C0QWALK,""))
. ; Otherwise, we will assume the contents of the index are the DFNs
. E S C0QDFN=C0QWALK
. I $G(C0QDEBUG) W C0QDFN," "
. ;
. ; Now, check to see if the patient has e-Rx's
. I $$HASERX(C0QDFN) S ^TMP($J,C0QDFN)=""
;
W:$G(C0QDEBUG) ! ;
;
; Loop through collected DFNs, send to WS, and get data back, store in ^TMP($J,DFN)
N C0QDFN S C0QDFN=0
F S C0QDFN=$O(^TMP($J,C0QDFN)) Q:C0QDFN="" DO
. N C0POUT
. W:$G(C0QDEBUG) "Calling GETMEDS6 SOAP Web Service Call for "_C0QDFN,!
. D SOAP^C0PWS2("C0POUT","GETMEDS6",DUZ,C0QDFN)
. Q:$G(C0POUT(1,"RowCount"))=0 ; WS says no data
. M ^TMP($J,C0QDFN)=C0POUT
;
; From the New Crop Meaningful Use documentation:
; Appendix G: Meaningful Use Certification FAQ Question 10
;
; DENOMINATOR NUMERATOR
; DeaClassCode = 0, 9 DeaClassCode = 0, 9
; PharmacyType = 1 PharmacyType = 1
; PharmacyDetailType = 1, 2 PharmacyDetailType = 1, 2
; FinalDestinationType = 1, 2, 3, 4 FinalDestinationType = 3, 4
; FinalStatusType = 1, 4, 5 FinalStatusType = 1, 5
;
; DeMorgan's Law
; NOT(A or B) = NOT(A) and NOT(B)
; So to collect prescriptions for which DeaClassCode is 0 or 9
; We exclude all those who are not 0 AND not 9.
; See: http://en.wikipedia.org/wiki/De_Morgan%27s_laws#Negation_of_a_disjunction
;
; The algorithms below use an Onion Peeling method. Any prescription which
; fails makes you jump to the next prescription.
; The "Onion levels" are:
; DeaClassCode, PharamcyType, PharmacyDetailType, FinalDestinationType, FinalStatusType
;
; Now walk through collected DFNs and accumulate MU stats
;
; WARNING: Naked References below
;
N C0QDFN,C0QRXNO S (C0QDFN,C0QRXNO)=0
N C0QD S C0QD=0 ; Denominator
;
; Calculate Denominator below
F S C0QDFN=$O(^TMP($J,C0QDFN)) Q:C0QDFN="" DO
. F S C0QRXNO=$O(^TMP($J,C0QDFN,C0QRXNO)) Q:C0QRXNO="" DO
.. W:$G(C0QDEBUG) "Patient "_C0QDFN_" Rx "_C0QRXNO,!
.. ;
.. I ^(C0QRXNO,"DeaClassCode") ; Change $REFERENCE
.. ;
.. N DEA S DEA=^("DeaClassCode")
.. W:$G(C0QDEBUG) "DeaClassCode: "_DEA,!
.. Q:((DEA'=0)&(DEA'=9))
.. ;
.. N PT S PT=^("PharmacyType")
.. W:$G(C0QDEBUG) "PharmacyType: "_PT,!
.. Q:(PT'=1)
.. ;
.. N PDT S PDT=^("PharmacyDetailType")
.. W:$G(C0QDEBUG) "PharmacyDetailType: "_PDT,!
.. Q:((PDT'=1)&(PDT'=2))
.. ;
.. N FDT S FDT=^("FinalDestinationType")
.. W:$G(C0QDEBUG) "FinalDestinationType: "_FDT,!
.. Q:((FDT'=1)&(FDT'=2)&(FDT'=3)&(FDT'=4))
.. ;
.. N FST S FST=^("FinalStatusType")
.. W:$G(C0QDEBUG) "FinalStatusType: "_FST,!
.. Q:((FST'=1)&(FST'=4)&(FST'=5))
.. ;
.. W:$G(C0QDEBUG) "Adding to Denominator",!
.. S C0QD=C0QD+1
;
; Calculate Numerator below
N C0QDFN,C0QRXNO S (C0QDFN,C0QRXNO)=0
N C0QN S C0QN=0 ; Numerator
F S C0QDFN=$O(^TMP($J,C0QDFN)) Q:C0QDFN="" DO
. F S C0QRXNO=$O(^TMP($J,C0QDFN,C0QRXNO)) Q:C0QRXNO="" DO
.. W:$G(C0QDEBUG) "Patient "_C0QDFN_" Rx "_C0QRXNO,!
.. ;
.. I ^(C0QRXNO,"DeaClassCode") ; Change $REFERENCE
.. ;
.. N DEA S DEA=^("DeaClassCode")
.. W:$G(C0QDEBUG) "DeaClassCode: "_DEA,!
.. Q:((DEA'=0)&(DEA'=9))
.. ;
.. N PT S PT=^("PharmacyType")
.. W:$G(C0QDEBUG) "PharmacyType: "_PT,!
.. Q:(PT'=1)
.. ;
.. N PDT S PDT=^("PharmacyDetailType")
.. W:$G(C0QDEBUG) "PharmacyDetailType: "_PDT,!
.. Q:((PDT'=1)&(PDT'=2))
.. ;
.. N FDT S FDT=^("FinalDestinationType")
.. W:$G(C0QDEBUG) "FinalDestinationType: "_FDT,!
.. Q:((FDT'=3)&(FDT'=4))
.. ;
.. N FST S FST=^("FinalStatusType")
.. W:$G(C0QDEBUG) "FinalStatusType: "_FST,!
.. Q:((FST'=1)&(FST'=5))
.. ;
.. W:$G(C0QDEBUG) "Adding to Numerator",!
.. S C0QN=C0QN+1
;
S ^TMP($J)=C0QN_U_C0QD
;
; TODO: Over here, do something with the numerator and denominator..
; Probably store them somewhere.
;
I '$G(C0QDEBUG) K ^TMP($J) ; Empty out in production not testing
QUIT
;
HASERX(DFN) ; $$ - Private; Has E-Prescriptions?
; Parameters
; - DFN by Value
; Output
; 0 or 1 (false or true)
N ZI S ZI=""
N ZERX S ZERX=$NA(^PS(55,DFN,"NVA"))
N DONE,HASERX
F S ZI=$O(@ZERX@(ZI)) Q:ZI="" Q:$G(DONE) D
. I $G(@ZERX@(ZI,1,1,0))["E-Rx Web" S (DONE,HASERX)=1
Q +$G(HASERX)

View File

@ -0,0 +1,116 @@
C0QNOTES ;GPL - Utility to look up patient notes ;9/5/11 8:50pm
;;1.0;MU PACKAGE;;;Build 26
;
;2011 George Lilly <glilly@glilly.net> - Licensed under the terms of the GNU
;General Public License See attached copy of the License.
;
;This program is free software; you can redistribute it and/or modify
;it under the terms of the GNU General Public License as published by
;the Free Software Foundation; either version 2 of the License, or
;(at your option) any later version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License along
;with this program; if not, write to the Free Software Foundation, Inc.,
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
;
Q
HASNTYN(ZNTYP,DFN) ; EXTRINSIC 1 YES 0 NO DOES THE PATIENT DFN HAVE
; NOTE TYPE ZNTYP
N C0QN,C0QO
S C0QO=$NA(^TIU(8925.1,"B",ZNTYP)) ; ALL DOCUMENT DEFS FOR THIS NAME
S C0QN=$NA(^TIU(8925,"AA",DFN)) ; NOTES THE PATIENT HAS
N C0QR
D UNITY^C0QSET("C0QR",C0QN,C0QO) ; DOES PATIENT HAVE THE NOTE?
N ZR
I $D(C0QR(1)) S ZR=1
E S ZR=0
Q ZR
;
TESTNT(DFN) ; TEST THE NTTXT ROUTINE
W !,"MEDICATION RECON IN ER NURSE NOTE"
I $$NTTXT("ER NURSE NOTE","MEDICATION RECONCILIATION COMPLET",DFN) W " FOUND"
E W " NOT FOUND"
W !,"Medication Recon in MED/SURG NURSING ADMISSION ASSESSMENT"
I $$NTTXT("MED/SURG NURSING ADMISSION ASSESSMENT","Medication Reconcilation complete",DFN) W "FOUND"
E W " NOT FOUND"
Q
;
NTTXT(NTTITLE,NTTXT,DFN) ; EXTRINSIC 1 YES 0 NO DOES PATIENT HAVE
; TEXT NTTXT IN NOTE TITLE NTTITLE
N C0QNTA,C0QTYP
S C0QDFMT=$O(^TIU(8925.1,"B",NTTITLE,"")) ; DOCUMENT FORMAT IEN
S C0QNTA=$NA(^TIU(8925,"AA",DFN,C0QDFMT)) ; ARRAY OF NOTES OF THIS TYPE FOR
;^TIU(8925,"AA",15393,1808,6889171,375262)=""
N ZI,ZN,ZD,ZL
S ZD="" ; DATE OF THE THE NOTE
N FOUND S FOUND=0
F S ZD=$O(@C0QNTA@(ZD)) Q:FOUND Q:ZD="" D ; FOR EACH DATE
. S ZN=""
. F S ZN=$O(@C0QNTA@(ZD,ZN)) Q:FOUND Q:ZN="" D ; EACH NOTE
. . W !,"NOTE ",ZN," ",$G(^TIU(8925,ZN,"TEXT",1,0))
. . S ZI=0 ; WANT TO STAR ON LINE 1
. . S ZL=$NA(^TIU(8925,ZN,"TEXT"))
. . F S ZI=$O(@ZL@(ZI)) Q:+ZI=0 D ;
. . . I $P($G(@ZL@(ZI,0)),NTTXT,2)'="" S FOUND=1 D ;
. . . . W "**********",$G(@ZL@(ZI,0)),!
Q FOUND ; IT'S THAT SIMPLE... PLEASE LEAVE SOME TEXT AT THE END OF WHAT
; YOU SEARCH FOR...gpl ... for example is this is the note title:
; MED/SURG NURSING ADMISSION ASSESSMENT
;and this is the text you want: Medication Reconcilation completed.
; search for: Medication Reconcilation complete
; that will leave the "d." in piece two of the line
;
; or for this note:
;ER NURSE NOTE
; and this text:
;MEDICATION RECONCILIATION COMPLETED
; search for MEDICATION RECONCILIATION COMPLET
; which will leave the "ED" in piece 2
TXTALL(ZRTN,ZTARY,DFN) ; EXTRINSIC WHICH SEARCHES ALL OF A PATIENT'S NOTES
; FOR AN ARRAY OF TEXT MATCHES. ZRTN IS PASSED BY REFERENCE AND IS LIKE
; AN RPC RETURN. ZTARY IS PASSED BY REFERENCE AND HAS THE FORMAT
; ZTARY(1,"TEXT1")="" ZTARY(2,"TEXT2")="" ETC
N C0QTYP,C0QDFMT
;S C0QDFMT=$O(^TIU(8925.1,"B",NTTITLE,"")) ; DOCUMENT FORMAT IEN
S C0QNTA=$NA(^TIU(8925,"AA",DFN)) ; ARRAY OF NOTES FOR
;^TIU(8925,"AA",15393,1808,6889171,375262)=""
N ZI,ZJ,ZN,ZD,ZL,ZT,NTTXT,ZC,ZTYP
S ZT=""
F S ZT=$O(@C0QNTA@(ZT)) Q:ZT="" D ;
. S ZTYP=$$GET1^DIQ(8925.1,ZT_",",.01) ; NAME OF NOTE TITLE
. S ZD="" ; DATE OF THE THE NOTE
. N FOUND S FOUND=0
. F S ZD=$O(@C0QNTA@(ZT,ZD)) Q:FOUND Q:ZD="" D ; FOR EACH DATE
. . S ZN=""
. . F S ZN=$O(@C0QNTA@(ZT,ZD,ZN)) Q:FOUND Q:ZN="" D ; EACH NOTE
. . . W !,"NOTE ",ZN," ",$G(^TIU(8925,ZN,"TEXT",1,0))
. . . S ZI=0 ; WANT TO STAR ON LINE 1
. . . S ZL=$NA(^TIU(8925,ZN,"TEXT"))
. . . F S ZI=$O(@ZL@(ZI)) Q:+ZI=0 D ;
. . . . S ZJ="" ; INDEX FOR SEARCH TERMS
. . . . F S ZJ=$O(ZTARY(ZJ)) Q:ZJ="" D ; FOR EACH SEARCH TERM
. . . . . S ATTR=$O(ZTARY(ZJ,""))
. . . . . S NTTXT=$O(ZTARY(ZJ,ATTR,""))
. . . . . I $P($G(@ZL@(ZI,0)),NTTXT,2)'="" S FOUND=1 D ;
. . . . . . W "**********",$G(@ZL@(ZI,0)),!
. . . . . . S ZC=$O(ZRTN(""),-1) ; NEXT COUNT
. . . . . . I ZC="" S ZC=1
. . . . . . E S ZC=ZC+1
. . . . . . S ZRTN(ZC,ATTR,ZTYP,ZN,NTTXT)=$G(@ZL@(ZI,0))
Q $G(FOUND) ; IT'S THAT SIMPLE... PLEASE LEAVE SOME TEXT AT THE END OF WHAT
;
TESTALL ;
S GT(1,"HasSmokingStatus","SMOK")=""
S GT(2,"HasSmokingStatus","Smok")=""
S GT(3,"HasSmokingStatus","smok")=""
S GT(4,"HasMedRecon","MEDICATION RECONCILIATION COMPLET")=""
S GT(5,"HasMedRecon","Medication Reconcilation Complete")=""
W $$TXTALL(.G,.GT,2) ; CHECK ALL PATIENT 2'S NOTEST FOR SMOKING
ZWR G
Q
;

View File

@ -0,0 +1,180 @@
C0QPQRI ; GPL - GENERATES A PQRI XML FILE ;6/14/11 17:05
;;0.1;C0C;nopatch;noreleasedate;Build 26
;Copyright 2011 George Lilly. Licensed under the terms of the GNU
;General Public License See attached copy of the License.
;
;This program is free software; you can redistribute it and/or modify
;it under the terms of the GNU General Public License as published by
;the Free Software Foundation; either version 2 of the License, or
;(at your option) any later version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License along
;with this program; if not, write to the Free Software Foundation, Inc.,
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
;
Q
;
C0QQFN() Q 1130580001.101 ; FILE NUMBER FOR C0Q QUALITY MEASURE FILE
C0QMFN() Q 1130580001.201 ; FILE NUMBER FOR C0Q MEASUREMENT FILE
C0QMMFN() Q 1130580001.2011 ; FN FOR MEASURE SUBFILE
C0QMMNFN() Q 1130580001.20111 ; FN FOR NUMERATOR SUBFILE
C0QMMDFN() Q 1130580001.20112 ; FN FOR DENOMINATOR SUBFILE
RLSTFN() Q 810.5 ; FN FOR REMINDER PATIENT LIST FILE
RLSTPFN() Q 810.53 ; FN FOR REMINDER PATIENT LIST PATIENT SUBFILE
;
EN ;
; lets try some hard coded values for now
N C0QVAR
;
; first, the values that occur only once for the file
;
S C0QVAR("create-by")="RegistryA"
S C0QVAR("create-date")="12-10-2010"
S C0QVAR("create-time")="14:27"
S C0QVAR("file-number")=1
S C0QVAR("number-of-files")=9
S C0QVAR("version")="1.0"
;
; registry values
;
S C0QVAR("registry-id")=125789123
S C0QVAR("registry-name")="Model Registry"
S C0QVAR("submission-method")="C"
;
; values for each provider
;
S C0QVAR("npi")=12011989
S C0QVAR("tin")=387682321
S C0QVAR("waiver-signed")="Y"
S C0QVAR("encounter-from-date")="06-13-2010"
S C0QVAR("encounter-to-date")="12-10-2010"
;
; values for each measure group
;
S C0QVAR("ffs-patient-count")=2
S C0QVAR("group-eligible-instances")=30
S C0QVAR("group-reporting-rate")=66.67
S C0QVAR("group-reporting-rate-numerator")=20
;
; for each measure
;
S C0QVAR("pqri-measure-number")=128
S C0QVAR("eligible-instances")=100
S C0QVAR("meets-performance-instances")=18
S C0QVAR("performance-exclusion-instances")=0
S C0QVAR("performance-not-met-instances")=10
S C0QVAR("performance-rate")="90.00"
S C0QVAR("reporting-rate")="28.00"
;
;
N ZG,ZV
D GETTEMP^C0CMXP("ZG","PQRIXML") ; GET THE TEMPLATE
D BIND^C0CSOAP("ZV","C0QVAR","PQRIXML") ; GET BINDING VALUES
D MAP^C0CXPATH("ZG","ZV","ZO") ; MAP THE XML
D MEA("GG","GGG") ; GET THE MEASURES
N GB ; BUILD LIST
D QUEUE^C0CXPATH("GB","ZO",1,30) ; first part of pqri.xml
D QUEUE^C0CXPATH("GB","GG",2,$O(GG(""),-1)-1) ; the measures
D QUEUE^C0CXPATH("GB","ZO",$O(ZO(""),-1)-2,$O(ZO(""),-1)) ; LAST LINES
D BUILD^C0CXPATH("GB","GZO") ; BUILD THE XML
N ZI S ZI=0
F S ZI=$O(ZO(ZI)) Q:ZI="" D ; FOR EACH LINE OF XML
. W !,GZO(ZI) ; WRITE OUT THE XML
N GN,GN1,GD S GN=$NA(^TMP("C0QXML",$J))
K @GN
K ZO(0) ; GET RID OF LINE COUNT
M @GN=GZO
S GN1=$NA(@GN@(1))
S GD=$G(^TMP("C0CCCR","ODIR")) ; CONVENIENT OUTPUT DIRECTORY
W $$OUTPUT^C0CXPATH(GN1,"pqri.xml",GD)
K @GN ; DONT NEED IT ANYMORE
Q
;
INSERT(ZARY,ZONE) ; INSERT ONE MEASURE INTO THE ARRAY
;
;N GGG
S GGG="//submission/measure-group ID='C'/provider/pqri-measure" ;XPATH
D INSINNER^COCXPATH(ZARY,GGG,ZONE) ; INSERT XML
Q
;
PQRI(ZOUT,KEEP) ; RETURN THE NHIN ARRAY FOR THE PQRI XML TEMPLATE
;
N ZG
S ZG=$NA(^TMP("PQRIXML",$J))
K @ZG
D GETXML^C0CMXP(ZG,"PQRIXML") ; GET THE XML FROM C0C MISC XML
N C0CDOCID
S C0CDOCID=$$PARSE^C0CDOM(ZG,"PQRIXML") ; PARSE THE XML
D DOMO^C0CDOM(C0CDOCID,"/","ZOUT","GIDX","GARY",,"//submission") ; BLD ARRAYS
I '$G(KEEP) K GIDX,GARY ; GET RID OF THE ARRAYS UNLESS KEEP=1
Q
;
PROCESS(ZRSLT,ZXML,ZREDUCE,KEEP) ; PARSE AND RUN DOMO ON XML
; ZRTN IS PASSED BY REFERENCE
; ZXML IS PASSED BY NAME
; IF KEEP IS 1, GARY AND GIDX ARE NOT KILLED
;
N ZG
S ZG=$NA(^TMP("C0CXML",$J))
K @ZG
M @ZG=@ZXML
S C0CDOCID=$$PARSE^C0CDOM(ZG,"NHINARRAY") ; PARSE WITH MXML
D DOMO^C0CDOM(C0CDOCID,"/","ZRSLT","GIDX","GARY",,$G(ZREDUCE)) ; BLD ARRAYS
I '$G(KEEP) K GIDX,GARY,@ZG ; GET RID OF THE ARRAYS UNLESS KEEP=1
Q
;
GETFM(RTN,ZREC) ; GET THE QUALITY MEASURES ARRAY
;
I '$D(ZREC) S ZREC=7 ; OUTPATIENT CERTIFICATION SET
;N GPL
D LIST^DIC($$C0QMMFN(),","_ZREC_",",".01;1.1;2.1;3;",,,,,,,,"GPL")
N ZI S ZI=""
F S ZI=$O(GPL("DILIST","ID",ZI)) Q:ZI="" D ;
. S @RTN@(ZI,"measure")=GPL("DILIST","ID",ZI,.01)
. N ZMIEN,ZMEAIEN,ZRNAME
. S ZMIEN=GPL("DILIST",2,ZI) ; IEN OF MEASURE IN MEASURE FILE
. ;S ZMEAIEN=$$GET1^DIQ($$C0QMMFN(),ZMIEN_","_ZREC_",",.01,"I") ; MEASURE
. S ZRNAME=$$GET1^DIQ($$C0QMMFN(),ZMIEN_","_ZREC_",",".01:.8") ; MEASURE
. ;S @RTN@(ZI,"reportingName")=$$GET1^DIQ($$C0QQFN(),ZMEAIEN_",",.8) ; RNAME
. S @RTN@(ZI,"reportingName")=ZRNAME ; A SHORTCUT TO THE REPORTING NAME
. S @RTN@(ZI,"reportingNumber")=$P(ZRNAME,"NQF",2) ; NQF0001 -> 0001
. S @RTN@(ZI,"denominator")=+GPL("DILIST","ID",ZI,2.1)
. S @RTN@(ZI,"numerator")=+GPL("DILIST","ID",ZI,1.1)
. N ZNUM,ZDEM,ZPCT
. S (ZNUM,ZDEM,ZPCT)=0
. S ZDEM=+GPL("DILIST","ID",ZI,2.1)
. S ZNUM=+GPL("DILIST","ID",ZI,1.1)
. I ZDEM>0 S ZPCT=((ZNUM*100)/ZDEM)
. S @RTN@(ZI,"percent")=$P(ZPCT,".",1)
. S @RTN@(ZI,"ien")=ZI
;ZWR GPL
Q
;
MEA(ZOUT,ZIN) ; CREATE XML FROM THE MEASURES ARRAY
;
D GETFM(ZIN) ; GET THE MEASURES
;N G
;N ZI,ZJ
S ZI=""
F S ZI=$O(@ZIN@(ZI)) Q:ZI="" D ;
. N ZDEN,ZNUM,ZPCT
. S ZDEN=$G(@ZIN@(ZI,"denominator"))
. S ZNUM=$G(@ZIN@(ZI,"numerator"))
. S ZPCT=$G(@ZIN@(ZI,"percent"))
. S G("pqri-measure",ZI,"eligible-instances")=ZDEN
. S G("pqri-measure",ZI,"meets-performance-instances")=ZNUM
. S G("pqri-measure",ZI,"performance-exclusion-instances")=0
. S G("pqri-measure",ZI,"performance-not-met-instances")=ZDEN-ZNUM
. S G("pqri-measure",ZI,"performance-rate")=ZPCT
. S G("pqri-measure",ZI,"pqri-measure-number")="NQF "_@ZIN@(ZI,"reportingNumber")
. S G("pqri-measure",ZI,"reporting-rate")=ZPCT
K ^TMP("MXMLDOM",$J)
S C0CDOCID=$$DOMI^C0CDOM("G",1,"root")
D OUTXML^C0CDOM(ZOUT,C0CDOCID,1)
Q
;

View File

@ -0,0 +1,690 @@
C0QPRML ;JJOH/ZAG/GPL - Patient Reminder List ;7/5/11 8:50pm
;;1.0;MU PACKAGE;;;Build 26
;
;2011 Zach Gonzales<zach@linux.com> - Licensed under the terms of the GNU
;General Public License See attached copy of the License.
;
;This program is free software; you can redistribute it and/or modify
;it under the terms of the GNU General Public License as published by
;the Free Software Foundation; either version 2 of the License, or
;(at your option) any later version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License along
;with this program; if not, write to the Free Software Foundation, Inc.,
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
;
BUILD ; CALL ALL AND DIS AND BUILD THE GRSLT ARRAY or print or create
; patient lists
;N GRSLT ; ARRAY FOR RESULTS
I '$D(C0QSS) S C0QSS=0 ;default don't build spreadsheet array
I '$D(C0QPR) S C0QPR=0 ;default don't print out results
I '$D(C0QPL) S C0QPL=1 ;default do create patient lists
N G1 ; ONE SET OF VALUES - RNF1 FORMAT
; INITIALIZE LISTS
; this is done so that if there are no matching patients, the patient list
; will be zeroed out
S C0QLIST("HasDemographics")=""
S C0QLIST("Patient")=""
S C0QLIST("HasProblem")=""
S C0QLIST("HasAllergy")=""
S C0QLIST("HasMed")=""
S C0QLIST("HasVitalSigns")=""
S C0QLIST("HasMedOrders")=""
S C0QLIST("HasSmokingStatus")=""
D ALL ; all currently admitted patients in the hospital
D DIS ; all patients discharged since the reporting period began
I C0QSS ZWR GRSLT
I C0QPL D ;
. D FILE ; FILE THE PATIENT LISTS
. D UPDATE^C0QUPDT(.G,8) ; UPDATE THE MU MEASUREMENT SET
. D UPDATE^C0QUPDT(.G,9) ; UPDATE THE MU MEASUREMENT SET
Q
;
ALL ;retrieve active inpatients
N WARD S WARD=""
F D Q:WARD=""
. S WARD=$O(^DIC(42,"B",WARD)) ;ward name
. Q:WARD=""
. N WIEN S WIEN=""
. F S WIEN=$O(^DIC(42,"B",WARD,WIEN)) Q:'WIEN D ;wards IEN
. . S WARDNAME=$P(^DIC(42,WIEN,0),U,2) ;ward name
. . N DFN,RB S DFN=""
. . F S DFN=$O(^DPT("CN",WARD,+DFN)) Q:'DFN D ;DFN of patient on ward
. . . D DEMO
. . . D PROBLEM
. . . D ALLERGY
. . . D MEDS4
. . . D RECON2
. . . D ADVDIR
. . . D SMOKING
. . . D VITALS
. . . D VTE1
. . . D EDTIME
. . . I C0QPR D PRINT
. . . I C0QSS D SS
. . . I C0QPL D PATLIST
Q
;
DEMO ; patient demographics
K PTDOB
N PTNAME,PTSEX,PTHRN,PTRLANG,PTLANG,RACE,RACEDSC,ETHN,ETHNDSC,RB
S PTNAME=$P(^DPT(DFN,0),U) ;patient name
S PTDOB=$$FMTE^XLFDT($P($G(^DPT(DFN,0)),U,3)) ;date of birth
S PTSEX=$P($G(^DPT(DFN,0)),U,2) ;patient sex
D PID^VADPT ;VADPT call to grab PISD based on PT Eligibility
S PTHRN=$P($G(VA("PID")),U) ;health record number
S PTRLANG=$P($G(^DPT(DFN,256000)),U) ;ptr to language file
I $G(PTRLANG)'="" S PTLANG=$P(^DI(.85,PTRLANG,0),U) ;PLS extrnl
S RACE=""
F D Q:RACE=""
. S RACE=$O(^DPT(DFN,.02,"B",RACE)) ;race code IEN
. Q:'RACE
. S RACEDSC=$P($G(^DIC(10,RACE,0)),U) ;race description
S ETHN=""
F D Q:ETHN=""
. S ETHN=$O(^DPT(DFN,.06,"B",ETHN)) ;ethnicity IEN
. Q:'ETHN
. S ETHNDSC=$P($G(^DIC(10.2,ETHN,0)),U) ;ethnincity description
S RB=$P($G(^DPT(DFN,.101)),U) ;room and bed
N DEMOYN S DEMOYN=1
I $G(PTSEX)="" S DEMOYN=0
I $G(PTDOB)="" S DEMOYN=0
I $G(PTHRN)="" S DEMOYN=0
I $G(PTLANG)="" S DEMOYN=0
I $G(RACEDSC)="" S DEMOYN=0
I $G(ETHNDSC)="" S DEMOYN=0
I DEMOYN S C0QLIST("HasDemographics",DFN)=""
E S C0QLIST("FailedDemographics",DFN)=""
Q
;
PROBLEM ; PATIENT PROBLEMS
D LIST^ORQQPL(.PROBL,DFN,"A")
S PBCNT=""
F S PBCNT=$O(PROBL(PBCNT)) Q:PBCNT="" D
. S PBDESC=$P(PROBL(PBCNT),U,2) ;problem description
K PROBL
Q
;
ALLERGY ; ALLERGY LIST
D LIST^ORQQAL(.ALRGYL,DFN)
S ALCNT=""
F S ALCNT=$O(ALRGYL(ALCNT)) Q:ALCNT="" D
. S ALDESC=$P(ALRGYL(ALCNT),U,2) ;allergy description
K ALRGYL
Q
;
MEDS ; MEDICATIONS
;
I DFN=97 D Q ;
. S MDCNT=271
K MEDSL
D EN^C0CNHIN(.MEDSL,DFN,"MED;") ; GET THE MEDS FROM THE NHIN API
; can't use COVER^ORWPS even though it's fast.. we need to detect
; if the medications are Inpatient to compute the CPOE measure
; we will use the NHINV routines for this purpose
;D COVER^ORWPS(.MEDSL,DFN)
S MDCNT="" S HASINP=0
F S MDCNT=$O(MEDSL("med",MDCNT)) Q:MDCNT="" D
. ;Q:$P(MEDSL(MDCNT),U,4)'="ACTIVE" ;active medications only
. Q:MEDSL("med",MDCNT,"status@value")'="active"
. ;S MDDESC=$P(MEDSL(MDCNT),U,2) ;medication description
. S MDDESC=$G(MEDSL("med",MDCNT,"products.product@name"))
. ;S MDITEM=$P($G(MEDSL(MDCNT)),U,3)
. S MDITEM=$G(MEDSL("med",MDCNT,"sig")) ; i think this is what meditem is
. I MEDSL("med",MDCNT,"vaType@value")="I" S HASINP=1
I HASINP D ; THE PATIENT HAS AN INPATIENT MED
. S C0QLIST("HasMedOrders",DFN)="" ; an inpatient drug indicates CPOE
E S C0QLIST("NoMedOrders",DFN)="" ; this will be different for outpatient
K MEDSL
Q
;
MEDS2 ; MEDICATIONS
;
K MEDSL,MDDESC,MDITEM
D COVER^ORWPS(.MEDSL,DFN) ; CPRS MED LIST
I '$D(MEDSL) D ;
. S C0QLIST("NoMedOrders",DFN)=""
. I $$HFYN^C0QHF(DFN,"MEDS HAVE BEEN REVIEWED") D ;
. . S C0QLIST("HasMed",DFN)=""
. E S C0QLIST("NoMed",DFN)=""
S MDCNT="" S HASINP=0
F S MDCNT=$O(MEDSL(MDCNT)) Q:MDCNT="" D ;
. ;Q:$P(MEDSL(MDCNT),U,4)'="ACTIVE" ;active medications only
. ;S C0QLIST("HasMedOrders",DFN)=""
. S C0QLIST("HasMed",DFN)=""
. S MDDESC=$P(MEDSL(MDCNT),U,2) ;medication description
. S MDITEM=$P($G(MEDSL(MDCNT)),U,3)
. I $P($P(MEDSL(MDCNT),"^",1),";",2)="I" S HASINP=1
I HASINP D ; THE PATIENT HAS AN INPATIENT MED
. S C0QLIST("HasMedOrders",DFN)="" ; an inpatient drug indicates CPOE
E S C0QLIST("NoMedOrders",DFN)="" ; this will be different for outpatient
K MEDSL
Q
;
MEDS3 ; USE THE REMINDER INDEX ^PXRMINDX TO CHECK FOR MEDS
;
S C0QPXRM=$NA(^PXRMINDX(55,"PI")) ; REMINDER INDEX FOR DRUGS
I $D(@C0QPXRM@(DFN)) D ; HAS MEDS
. S C0QLIST("HasMed",DFN)=""
. S C0QLIST("HasMedOrders",DFN)=""
E D ; NO MEDS
. S C0QLIST("NoMed",DFN)=""
. S C0QLIST("NoMedOrders",DFN)=""
Q
;
MEDS4 ; USE OCL^PSOORRL TO GET ALL MEDS
N BEG,END
S BEG=$$DT^C0PCUR("JULY 3,2011")
S END=$$DT^C0PCUR("NOW")
D OCL^PSOORRL(DFN,BEG,END) ;DBIA #2400
N C0QMEDS
M C0QMEDS=^TMP("PS",$J) ; MEDS RETURNED FROM CALL
N FOUND
N ZI
I '$D(C0QMEDS(1)) D Q ; QUIT IF NO MEDS
. S C0QLIST("NoMed",DFN)=""
E D ; HAS MEDS
. S C0QLIST("HasMed",DFN)=""
S ZI="" S FOUND=0
F S ZI=$O(C0QMEDS(ZI)) Q:ZI="" D ; FOR EACH MED
. N ZM
. S ZM=$G(C0QMEDS(ZI,0)) ;THE MEDICATION
. I $P($P(ZM,"^",1),";",2)="I" D ; IE 1U;I FOR AN INPATIENT UNIT DOSE
. . S FOUND=1
I FOUND S C0QLIST("HasMedOrders",DFN)="" ; MET CPOE MEASURE
E S C0QLIST("NoMedOrders",DFN)=""
Q
;
RECON ; MEDICATIONS RECONCILIATION
;
I $$HASNTYN^C0QNOTES("MED/SURG NURSING ADMISSION ASSESSMENT",DFN) D ;
. S C0QLIST("XferOfCare",DFN)="" ; transfer of care patient
N HASRECON S HASRECON=0
N GT,G
S GT(4,"HasMedRecon","MEDICATION RECONCILIATION COMPLET")=""
S GT(5,"HasMedRecon","Medication Reconcilation Complete")=""
I $$TXTALL^C0QNOTES(.G,.GT,DFN) D ; SEARCH ALL NOTES FOR MED RECON
. S HASRECON=1
;N ZT
;S ZT="MEDICATION RECONCILIATION COMPLET"
;I $$NTTXT^C0QNOTES("ER NURSE NOTE",ZT,DFN) D ;
;. S HASRECON=1
;E D ;
;. S ZT="Medication Reconcilation Complete"
;. I $$NTTXT^C0QNOTES("MED/SURG NURSING ADMISSION ASSESSMENT",ZT,DFN) D ;
;. . S HASRECON=1
;I $$HFYN^C0QHF("MEDS HAVE BEEN REVIEWED",DFN) S HASRECON=1
I HASRECON D ;
. S C0QLIST("HasMedRecon",DFN)=""
E S C0QLIST("NoMedRecon",DFN)=""
Q
;
RECON2 ; USE HEALTH FACTORS FOR MEDICATION RECONCILIATION
I $$HASNTYN^C0QNOTES("MED/SURG NURSING ADMISSION ASSESSMENT",DFN) D ;
. S C0QLIST("XferOfCare",DFN)="" ; transfer of care patient
I $$HFYN^C0QHF(DFN,"Medication Reconciliation Completed: Yes") D ;
. S C0QLIST("HasMedRecon",DFN)=""
E S C0QLIST("NoMedRecon",DFN)=""
Q
;
ADVDIR ; ADVANCE DIRECTIVE
;
I $$AGE^C0QUTIL(DFN)>64 D ; ONLY FOR PATIENTS 65 AND OLDER
. S C0QLIST("Over65",DFN)=""
. I $$HASNTYN^C0QNOTES("ADVANCE DIRECTIVE",DFN) D ;
. . S C0QLIST("HasAdvanceDirective",DFN)=""
. E D ;
. . S C0QLIST("NoAdvanceDirective",DFN)=""
Q
;
SMOKING ;
I $$INLIST("HasSmokingStatus",DFN) D Q ; ALREADY HAS SMOKING STATUS CHECK
. S C0QLIST("HasSmokingStatus",DFN)=""
. S C0QLIST("Over12",DFN)=""
I $$INLIST("NoSmokingStatus",DFN) D Q ; ALREADY HAS SMOKING STATUS CHECK
. S C0QLIST("NoSmokingStatus",DFN)=""
. S C0QLIST("Over12",DFN)=""
N C0QSMOKE,C0QSYN
S C0QSYN=0
I $$AGE^C0QUTIL(DFN)<13 Q ; DON'T CHECK UNDER AGE 13
D HFCAT^C0QHF(.C0QSMOKE,DFN,"TOBACCO") ; GET ALL HEALTH FACTORS FOR THE
; PATIENT IN THE CATEGORY OF TOBACCO
I $D(C0QSMOKE) S C0QSYN=1
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smokeless Tobacco <1 Yr Ago")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smokeless Tobacco > 20 Yrs Ago")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smokeless Tobacco: 1-5 Yrs Ago")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smokeless Tobacco: 10-20 Yrs Ago")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smokeless Tobacco: 5-10 Yrs Ago")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smoking")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smoking < 1 Yr Ago")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smoking > 20 Yrs Ago")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smoking: 1-5 Yrs Ago")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smoking: 10-20 Yrs Ago")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smoking: 5-10 Yrs Ago")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKELESS TOBACCO USER")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKELESS: 1-5 YRS AGO")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKELESS: 10-20 YRS AGO")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKELESS: 5-10 YRS AGO")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKELESS: < 1 YR AGO")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKELESS: > 20 YRS AGO")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER 10-20 YRS")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER 20+ YRS")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER < 1 YR")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER < 1 YR AGO")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER > 20 YRS AGO")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER: 1-5 YRS")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER: 1-5 YRS AGO")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER: 10-20 YRS AGO")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER: 5-10 YRS")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER: 5-10 YRS AGO")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKELESS TOBACCO USER")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"LIFETIME NON-SMOKER")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smokeless Tobacco User")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker (PMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoke Exposure/2nd Hand Exposure")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 1-5 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 10-20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 5-10 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For < 1 Yr")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For > 20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Tobacco User")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 1-5 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 10-20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 5-10 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for < 1 Yr")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for > 20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoker (HPI)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (FMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (PMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking Cessation (OPH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"LIFETIME NON-SMOKER")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smokeless Tobacco User")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker (PMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoke Exposure/2nd Hand Exposure")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 1-5 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 10-20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 5-10 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For < 1 Yr")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For > 20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Tobacco User")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 1-5 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 10-20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 5-10 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for < 1 Yr")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for > 20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoker (HPI)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (FMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (PMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Non-Smoker")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"LIFETIME NON-SMOKER")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smokeless Tobacco User")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker (PMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoke Exposure/2nd Hand Exposure")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 1-5 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 10-20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 5-10 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For < 1 Yr")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For > 20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Tobacco User")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 1-5 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 10-20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 5-10 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for < 1 Yr")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for > 20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoker (HPI)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (FMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (PMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"LIFETIME NON-SMOKER")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smokeless Tobacco User")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker (PMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoke Exposure/2nd Hand Exposure")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 1-5 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 10-20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 5-10 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For < 1 Yr")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For > 20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Tobacco User")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 1-5 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 10-20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 5-10 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for < 1 Yr")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for > 20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoker (HPI)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (FMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (PMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Non-Smoker")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"LIFETIME NON-SMOKER")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smokeless Tobacco User")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker (PMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoke Exposure/2nd Hand Exposure")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 1-5 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 10-20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 5-10 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For < 1 Yr")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For > 20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Tobacco User")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 1-5 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 10-20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 5-10 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for < 1 Yr")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for > 20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoker (HPI)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (FMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (PMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Non-Smoker")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Non-Smoker (PMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Non-Tobacco User")
S C0QLIST("Over12",DFN)=""
N GT
S GT(1,"HasSmokingStatus","SMOK")=""
S GT(2,"HasSmokingStatus","Smok")=""
S GT(3,"HasSmokingStatus","smok")=""
;N ZT
;S ZT="Smok"
;S:'C0QSYN C0QSYN=$$NTTXT^C0QNOTES("ER NURSE NOTE",ZT,DFN) ;
I 'C0QSYN D ;
. N G
. S OK=$$TXTALL^C0QNOTES(.G,.GT,DFN)
. I $D(G) S C0QSYN=1
I C0QSYN S C0QLIST("HasSmokingStatus",DFN)=""
E S C0QLIST("NoSmokingStatus",DFN)=""
Q
;
VITALS ;
;
N C0QSDT,C0QEDT
D DT^DILF(,"JULY 3,2011",.C0QSDT) ; START DATE
D DT^DILF(,"T",.C0QEDT) ; END DATE TODAY
D VITALS^ORQQVI(.VITRSLT,DFN,C0QSDT,C0QEDT) ; CALL FAST VITALS
I $D(VITRSLT) D ;ZWR VITRSLT B ;
. I VITRSLT(1)["No vitals found." S C0QLIST("NoVitalSigns",DFN)=""
. E S C0QLIST("HasVitalSigns",DFN)=""
Q
;
VTE1 ; VTE PROPHYLAXIS WITHIN 24HRS OF ARRIVAL
;
I $$HFYN^C0QHF(DFN,"VTE PROPHYLAXIS WITHIN 24HRS OF ARRIVAL") D ;
. S C0QLIST("HasVTE24",DFN)=""
E S C0QLIST("NoVTE24",DFN)=""
Q
;
EDTIME ; CHECK FOR EMERGENCY DEPT TIME FACTORS
N FOUND
S FOUND=0
I $$HFYN^C0QHF(DFN,"ED ARRIVAL TIME") S FOUND=1
I '$$HFYN^C0QHF(DFN,"ED DEPARTURE TIME") S FOUND=0
I '$$HFYN^C0QHF(DFN,"TIME DECISION TO ADMIT MADE") S FOUND=0
I FOUND D ;
. S C0QLIST("HasEDtime",DFN)=""
E S C0QLIST("NoEDtime",DFN)=""
Q
;
INLIST(ZLIST,DFN) ; EXTRINSIC FOR IS PATIENT ALREADY IN LIST ZLIST
N ZL,ZR
S ZL=$O(^C0Q(301,"CATTR",ZLIST,"")) ; IEN OF LIST IN C0Q PATIENT LIST FILE
I ZL="" Q 0 ; LIST DOES NOT EXIST
S ZR=0 ; ASSUME NOT IN LIST
I $D(^C0Q(301,ZL,1,"B",DFN)) S ZR=1 ; PATIENT IS IN LIST
Q ZR
;
PRINT ; PRINT TO SCREEN
I $D(WARD) W !!,WARD_"-"_WARDNAME_" "_RB_": "_PTNAME_"("_PTSEX_") "
I $D(EXDTE) D ;
. W !,"Discharge Date: ",EXDTE
. W !,DFN," ",PTNAME
W !,"DOB: ",PTDOB," HRN: ",PTHRN
W !,"Language Spoken: ",$G(PTLANG)
W !,"Race: ",RACEDSC
W !,"Ethnicity: ",$G(ETHNDSC)
W !,"Problems: "
W !,PBDESC
W !,"Allergies: "
W !,ALDESC
W !,"Medications: "
W !
Q
;
SS ; CREATE SPREADSHEET ARRAY
S G1("Patient")=DFN
I $D(WARD) D ;
. S G1("WardName")=WARDNAME
. S G1("RoomAndBed")=RB
I $D(EXDTE) D ;
. S G1("DischargeDate")=EXDTE
S G1("PatientName")=PTNAME
S G1("Gender")=PTSEX
S G1("DateOfBirth")=PTDOB
S G1("HealthRecordNumber")=PTHRN
S G1("LanguageSpoken")=$G(PTLANG)
S G1("Race")=RACEDSC
S G1("Ehtnicity")=$G(ETHNDSC)
S G1("Problem")=PBDESC
I PBDESC["No problems found" S G1("HasProblem")=0
E S G1("HasProblem")=1
S G1("Allergies")=ALDESC
I ALDESC["No Allergy" S G1("HasAllergy")=0
E S G1("HasAllergy")=1
I $D(MDITEM) D ;
. S G1("HasMed")=1
E S G1("HasMed")=0
S G1("MedDescription")=$G(MDDESC)
I $D(MDITEM) W !,"("_MDITEM_")"_MDDESC E W !,MDDESC
D RNF1TO2B^C0CRNF("GRSLT","G1")
K G1
Q ; DON'T WANT TO DO THE NHIN STUFF NOW
;
PATLIST ; CREATE PATIENT LISTS
S C0QLIST("Patient",DFN)="" ; THE PATIENT LIST
N DEMOYN S DEMOYN=1
I $G(PTSEX)="" S DEMOYN=0
I $G(PTDOB)="" S DEMOYN=0
I $G(PTHRN)="" S DEMOYN=0
I $G(PTLANG)="" S DEMOYN=0
I $G(RACEDSC)="" S DEMOYN=0
I $G(ETHNDSC)="" S DEMOYN=0
;I DEMOYN S C0QLIST("HasDemographics",DFN)=""
;E S C0QLIST("FailedDemographics",DFN)=""
;S G1("Gender")=PTSEX
;S G1("DateOfBirth")=PTDOB
;S G1("HealthRecordNumber")=PTHRN
;S G1("LanguageSpoken")=$G(PTLANG)
;S G1("Race")=RACEDSC
;S G1("Ehtnicity")=$G(ETHNDSC)
S G1("Problem")=PBDESC
I PBDESC["No problems found" S C0QLIST("NoProblem",DFN)=""
E S C0QLIST("HasProblem",DFN)=""
;S G1("Allergies")=ALDESC
I ALDESC["No Allergy" S C0QLIST("NoAllergy",DFN)=""
E S C0QLIST("HasAllergy",DFN)=""
;I $D(MDITEM) D ;
;. S C0QLIST("HasMed",DFN)=""
;E S G1("NoMed",DFN)=""
;S G1("MedDescription")=$G(MDDESC)
Q
;
NHIN ; SHOW THE NHIN ARRAY FOR THIS PATIENT
Q:DFN=137!14
D EN^C0CNHIN(.G,DFN,"")
ZWR G
K G
;
QUIT ;end of WARD
;
;
DIS;
N DFN,DTE,EXDTE S DTE=""
F D Q:DTE=""
. S DTE=$O(^DGPM("B",DTE))
. Q:'DTE
. Q:$P(DTE,".")<3110703
. S EXDTE=$$FMTE^XLFDT(DTE)
. N PTFM S PTFM=""
. D
. . S PTFM=$O(^DGPM("B",DTE,PTFM))
. . Q:'PTFM
. . S DFN=$P(^DGPM(PTFM,0),U,3)
. . S C0QLIST("Patient",DFN)=""
. . D DEMO
. . D PROBLEM
. . D ALLERGY
. . D MEDS4
. . D RECON2
. . D ADVDIR
. . D SMOKING
. . D VITALS
. . D VTE1
. . D EDTIME
. . I C0QPR D PRINT
. . I C0QSS D SS
. . I C0QPL D PATLIST
Q
;
C0QPLF() Q 1130580001.301 ; FILE NUMBER FOR C0Q PATIENT LIST FILE
C0QALFN() Q 1130580001.311 ; FILE NUMBER FOR C0Q PATIENT LIST PATIENT SUBFILE
FILE ; FILE THE PATIENT LISTS TO C0Q PATIENT LIST
;
I '$D(C0QLIST) Q ;
N LFN S LFN=$$C0QALFN()
N ZI,ZN
S ZI=""
F S ZI=$O(C0QLIST(ZI)) Q:ZI="" D ;
. S ZN=$O(^C0Q(301,"CATTR",ZI,""))
. I ZN="" D Q ; OOPS
. . W !,"ERROR, ATTRIBUTE NOT FOUND IN PATIENT LIST FILE:"_ZI
. ;S ZN=$$KLNCR(ZN) ; KILL AND RECREATE RECORD ZN
. N C0QNEW,C0QOLD,C0QRSLT
. S C0QNEW=$NA(C0QLIST(ZI)) ; THE NEW PATIENT LIST
. S C0QOLD=$NA(^C0Q(301,ZN,1,"B")) ; THE OLD PATIENT LIST
. D UNITY^C0QSET("C0QRSLT",C0QNEW,C0QOLD) ; FIND WHAT'S NEW
. N ZJ,ZK
. ; FIRST, DELETE THE OLD ONES - NO LONGER IN THE LIST
. K C0QFDA
. S ZJ=""
. F S ZJ=$O(C0QRSLT(2,ZJ)) Q:ZJ="" D ; MARKED WITH A 2 FROM UNITY
. . S ZK=$O(@C0QOLD@(ZJ,"")) ; GET THE IEN OF THE RECORD TO DELETE
. . I ZK="" D Q ; OOPS SHOULDN'T HAPPEN
. . . W !,"INTERNAL ERROR FINDING A PATIENT TO DELETE"
. . . B
. . S C0QFDA(LFN,ZK_","_ZN_",",.01)="@"
. I $D(C0QFDA) D UPDIE ; PROCESS THE DELETIONS
. ; SECOND, PROCESS THE ADDITIONS
. K C0QFDA
. S ZJ="" S ZK=1
. F S ZJ=$O(C0QRSLT(0,ZJ)) Q:ZJ="" D ; PATIENTS TO ADD ARE MARKED WITH 0
. . S C0QFDA(LFN,"+"_ZK_","_ZN_",",.01)=ZJ
. . S ZK=ZK+1
. I $D(C0QFDA) D UPDIE ; PROCESS THE ADDITIONS
;. Q
;. K C0QFDA
;. N ZJ,ZC
;. S ZJ="" S ZC=1
;. F S ZJ=$O(C0QLIST(ZI,ZJ)) Q:ZJ="" D ; FOR EACH PAT IN LIST
;. . S C0QFDA(LFN,"?+"_ZC_","_ZN_",",.01)=ZJ
;. . S ZC=ZC+1
;. D UPDIE
;. W !,"FOUND:"_ZI
Q
;
KLNCR(ZREC) ; KILL AND RECREATE RECORD ZREC IN PATIENT LIST FILE
;
N C0QFDA,ZFN,LIST,ATTR
S ZFN=$$C0QPLF() ; FILE NUMBER FOR C0Q PATIENT LIST FILE
D CLEAN^DILF
S LIST=$$GET1^DIQ(ZFN,ZREC_",",.01) ; MEASURE NAME
S ATTR=$$GET1^DIQ(ZFN,ZREC_",",999) ; ATTRIBUTE
D CLEAN^DILF
K ZERR
S C0QFDA(ZFN,ZREC_",",.01)="@" ; GET READY TO DELETE THE MEASURE
D FILE^DIE(,"C0QFDA","ZERR") ; KILL THE SUBFILE
I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST, INVOKE THE ERROR TRAP IF TASKED
;. W "ERROR",!
;. ZWR ZERR
;. B
K C0QFDA
S C0QFDA(ZFN,"+1,",.01)=LIST ; GET READY TO RECREATE THE RECORD
S C0QFDA(ZFN,"+1,",999)=ATTR ; ATTRIBUTE
D UPDIE ; CREATE THE SUBFILE
N ZR ; NEW IEN FOR THE RECORD
S ZR=$O(^C0Q(301,"CATTR",ATTR,""))
;
Q ZR
;
UPDIE ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS
K ZERR
D CLEAN^DILF
D UPDATE^DIE("","C0QFDA","","ZERR")
I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST, INVOKE THE ERROR TRAP IF TASKED
;. W "ERROR",!
;. ZWR ZERR
;. B
K C0QFDA
Q
;
; WHAT FOLLOWS IS OLD CODE - DELETE WHEN THIS WORKS
;. . N PTNAME S PTNAME=$P(^DPT(DFN,0),U,1)
;. . S PTDOB=$$FMTE^XLFDT($P($G(^DPT(DFN,0)),U,3)) ;date of birth
;. . S PTSEX=$P($G(^DPT(DFN,0)),U,2) ;patient sex
;. . D PID^VADPT ;VADPT call to grab PISD based on PT Eligibility
;. . S PTHRN=$P($G(VA("PID")),U) ;health record number
;. . S PTRLANG=$P($G(^DPT(DFN,256000)),U) ;ptr to language file
;. . I $G(PTRLANG)'="" S PTLANG=$P(^DI(.85,PTRLANG,0),U) ;PLS extrnl
;. . S RACE=""
;. . F D Q:RACE=""
;. . . S RACE=$O(^DPT(DFN,.02,"B",RACE))
;. . . Q:'RACE
;. . . S RACEDSC=$P($G(^DIC(10,RACE,0)),U)
;. . N ETHNDSC
;. . N ETHNDSC S ETHNDSC=""
;. . S ETHN=""
;. . F D Q:ETHN=""
;. . . S ETHN=$O(^DPT(DFN,.06,"B",ETHN))
;. . . Q:'ETHN
;. . . S ETHNDSC=$P($G(^DIC(10.2,ETHN,0)),U)
;. . D LIST^ORQQPL(.PROBL,DFN,"A")
;. . S PBCNT=""
;. . F S PBCNT=$O(PROBL(PBCNT)) Q:PBCNT="" D
;. . . S PBDESC=$P(PROBL(PBCNT),U,2) ;problem description
;. . K PROBL
;. . D LIST^ORQQAL(.ALRGYL,DFN)
;. . S ALCNT=""
;. . F S ALCNT=$O(ALRGYL(ALCNT)) Q:ALCNT="" D
;. . . S ALDESC=$P(ALRGYL(ALCNT),U,2) ;allergy description
;. . K ALRGYL
;. . D COVER^ORWPS(.MEDSL,DFN)
;. . S MDCNT=""
;. . F S MDCNT=$O(MEDSL(MDCNT)) Q:MDCNT="" D
;. . . Q:$P(MEDSL(MDCNT),U,4)'="ACTIVE" ;active medications only
;. . . S MDDESC=$P(MEDSL(MDCNT),U,2) ;medication description
;. . . S MDITEM=$P($G(MEDSL(MDCNT)),U,3)
;. . K MEDSL
;. . W !,"Discharge Date: ",EXDTE
;. . W !,DFN," ",PTNAME
;. . W !,"DOB: ",PTDOB," HRN: ",PTHRN
;. . W !,"Language Spoken: ",$G(PTLANG)
;. . W !,"Race: ",RACEDSC
;. . W !,"Ethnicity: ",ETHNDSC
;. . W !,"Problems: "
;. . W !,PBDESC
;. . W !,"Allergies: "
;. . W !,ALDESC
;. . W !,"Medications: "
;. . I $D(MDITEM) W !,"(",MDITEM,")",MDDESC E W !,MDDESC
;. . W !
;Q
;
;
;
;
END ;end of C0QPRML;

View File

@ -0,0 +1,115 @@
C0QSET ;GPL - SET OPERATIONS ON LISTS ;818/11 8:50pm
;;1.0;MU PACKAGE;;;Build 26
;
;2011 George Lilly glilly@glilly.net - Licensed under the terms of the GNU
;General Public License See attached copy of the License.
;
;This program is free software; you can redistribute it and/or modify
;it under the terms of the GNU General Public License as published by
;the Free Software Foundation; either version 2 of the License, or
;(at your option) any later version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License along
;with this program; if not, write to the Free Software Foundation, Inc.,
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
;
Q
;
TEST ; TEST OF UNITY ROUTINE
;
S A(1)=""
S A(2)=""
S A(3)=""
S B(3)=""
S B(4)=""
D UNITY("C","A","B")
ZWR C
Q
;
TEST2 ; WHICH PATIENTS HAVE MEDICATIONS? WHICH DON'T?
; WHAT BAD PATIENT POINTERS ARE IN THE MEDICATIONS FILE?
S PATS=$NA(^DPT)
S MEDS=$NA(^PS(55))
D UNITY("DELTA",PATS,MEDS)
W !,"PATIENTS WITH NO MEDS",!
ZWR DELTA(0,*)
W !,"BAD POINTERS IN THE MEDS FILE",!
ZWR DELTA(2,*)
Q
;
UNITY(ZRTN,ZNEW,ZOLD) ; RETURNS THE DELTA BETWEEN THE NEW AND OLD LISTS
; ONLY NUMERIC LISTS SUPPORTED. FOR LIST WITH STRINGS SEE UNITYS
; ZRTN,ZNEW AND ZOLD ARE ALL PASSED BY NAME
; FORMAT OF RETURN ARRAY:
; @ZRTN@(0,X)="" ; X IS MISSING FROM OLD
; @ZRTN@(1,Y)="" ; Y IS IN BOTH NEW AND OLD - NOT MISSING
; @ZRTN@(2,Z)="" ; Z IS EXTRA IN OLD - WOULD BEED TO BE DELETED FOR UNITY
N C0QD ; TEMP WORK ARRAY
N ZN S ZN=0 ; COUNT
N ZI S ZI=0
F S ZI=$O(@ZNEW@(ZI)) Q:+ZI=0 D ; FOR EACH ITEM IN NEW
. S C0QD(ZI)=0 ; SET THEM ALL AS 0 MEANING NEW
. S ZN=ZN+1
S @ZRTN@("COUNT")=ZN ; NEW FILE COUNT
S ZI=0
F S ZI=$O(@ZOLD@(ZI)) Q:+ZI=0 D ; FOR EACH ITEM IN OLD
. I $D(C0QD(ZI)) S C0QD(ZI)=1 ; NOT NEW - PRESENT IN NEW AND OLD
. E S C0QD(ZI)=2 ; EXTRA IN OLD - WOULD NEED TO BE DELETED
S ZI=0
F S ZI=$O(C0QD(ZI)) Q:+ZI=0 D ; FOR EACH ITEM
. S @ZRTN@(C0QD(ZI),ZI)="" ; SET RESULTS IN RETURN ARRAY
Q
;
UNITYS(ZRTN,ZNEW,ZOLD) ; RETURNS THE DELTA BETWEEN THE NEW AND OLD LISTS
; THIS VERSION HAS SUPPORT FOR NUMBERS AND STRINGS IN A LIST
; ZRTN,ZNEW AND ZOLD ARE ALL PASSED BY NAME
; FORMAT OF RETURN ARRAY:
; @ZRTN@(0,X)="" ; X IS MISSING FROM OLD
; @ZRTN@(1,Y)="" ; Y IS IN BOTH NEW AND OLD - NOT MISSING
; @ZRTN@(2,Z)="" ; Z IS EXTRA IN OLD - WOULD BEED TO BE DELETED FOR UNITY
N C0QD ; TEMP WORK ARRAY
N ZI S ZI=""
F S ZI=$O(@ZNEW@(ZI)) Q:ZI="" D ; FOR EACH ITEM IN NEW
. S C0QD(ZI)=0 ; SET THEM ALL AS 0 MEANING NEW
S ZI=""
F S ZI=$O(@ZOLD@(ZI)) Q:ZI="" D ; FOR EACH ITEM IN OLD
. I $D(C0QD(ZI)) S C0QD(ZI)=1 ; NOT NEW - PRESENT IN NEW AND OLD
. E S C0QD(ZI)=2 ; EXTRA IN OLD - WOULD NEED TO BE DELETED
S ZI=""
F S ZI=$O(C0QD(ZI)) Q:ZI="" D ; FOR EACH ITEM
. S @ZRTN@(C0QD(ZI),ZI)="" ; SET RESULTS IN RETURN ARRAY
Q
;
AND(ZRTN,ZNEW,ZOLD) ; RETURNS A LIST OF WHAT IS COMMON TO BOTH NEW AND OLD
N ZD
D UNITY("ZD",ZNEW,ZOLD)
M @ZRTN=ZD(1)
Q
;
NAND(ZRTN,ZNEW,ZOLD) ; RETURNS WHAT IS IN A OR B BUT NOT BOTH
N ZD
D UNITY("ZD",ZNEW,ZOLD)
M @ZRTN=ZD(0)
M @ZRTN=ZD(2)
Q
;
AMINUSB(ZRTN,ZA,ZB) ; WHAT'S LEFT IN A AFTER REMOVING B FROM IT
N ZD
D UNITY("ZD",ZA,ZB)
M @ZRTN=ZD(0)
Q
;
OR(ZRTN,ZA,ZB) ; WHAT'S IN A OR B OR BOTH
N ZD
D UNITY("ZD",ZA,ZB)
M @ZRTN=ZD(0)
M @ZRTN=ZD(1)
M @ZRTN=ZD(2)
Q
;
END ;end of C0QSET;

View File

@ -0,0 +1,509 @@
C0PTEST ; ERX/GPL - eRx Refill utilities ; 3/19/10 11:53am
;;0.1;C0P;nopatch;noreleasedate;Build 26
;Copyright 2009,2010 George Lilly. Licensed under the terms of the GNU
;General Public License See attached copy of the License.
;
;This program is free software; you can redistribute it and/or modify
;it under the terms of the GNU General Public License as published by
;the Free Software Foundation; either version 2 of the License, or
;(at your option) any later version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License along
;with this program; if not, write to the Free Software Foundation, Inc.,
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
;
Q
;
TESTMEDS ; PRINT OUT MEDICATIONS FOR INPATIENTS WITH MEDS BUT NO INPATIENT
; MEDS
S ZI=""
D BUILD^C0QPRML
S GNEW=$NA(C0QLIST("NoMedOrders"))
S GOLD=$NA(C0QLIST("HasMed"))
K G
D UNITY^C0QSET("G",GNEW,GOLD)
F S ZI=$O(G(1,ZI)) Q:ZI="" D ; FOR EACH PATIENT IN BOTH LISTS
. K GG
. D COVER^ORWPS(.GG,ZI) ; GET MED LIST
. W !,"PATIENT: ",ZI,!
. ZWR GG
Q
;
TESTREQ(ZDUZ,ZDFN) ; TEST REFILL REQUEST
I '$D(ZDFN) S ZDFN=""
D REFREQ("ZG",ZDUZ,ZDFN)
W !
ZWR C0PRXML
Q
;
REFREQ(GRTN,IDUZ,IDFN) ; MAKE A WEB SERVICE CALL TO GENERATE A REFIL REQUEST
;
N GPL,C0PFARY,GVOR
D ENCREQ("GPL",IDUZ,IDFN)
S GVOR("XMLIN")=GPL
S GVOR("ORIG-FILL-DATE")=""
S GVOR("CREATE-MED-YN")="0"
;D EN^C0PMAIN("GG","GURL",IDUZ,IDFN,"GENREFILL","GVOR")
D INITXPF^C0PWS2("C0PFARY")
D SOAP^C0PWS2("GRTN","GENREFILL",IDUZ,IDFN,"GVOR")
;D SOAP^C0CSOAP("GRTN","GENREFILL",,,"GG","C0PFARY") ;
Q
;
GG1 ; IDENTIFY ORPHAN NODES IN ^PS(55,DFN,"NVA",
S ZI="" S BAD="" S ZN=0
F S ZI=$O(^PS(55,ZI)) Q:ZI="" D ;
. S ZJ=""
. F S ZJ=$O(^PS(55,ZI,"NVA",ZJ)) Q:ZJ="" D ; FOR EACH NVA DRUG
. . I $D(^PS(55,ZI,"NVA",ZJ,1,7,0)) D ; IF THE CODES NODE EXISTS
. . . I '$D(^PS(55,ZI,"NVA",ZJ,1,0)) D ; I NO ZERO NODE
. . . . S BAD(ZI,ZJ)=""
. . . . S ZN=ZN+1
K ^G
M ^G("BAD")=BAD
ZWR BAD
W !,"BAD COUNT: ",ZN
Q
;
GG2 ; DISPLAY THE BAD NODES
S ZI=""
F S ZI=$O(^G("BAD",ZI)) Q:ZI="" D ;
. S ZJ=""
. F S ZJ=$O(^G("BAD",ZI,ZJ)) Q:ZJ="" D ;
. . W !,^PS(55,ZI,"NVA",ZJ,1,7,0)
. . I $D(^PS(55,ZI,"NVA",ZJ,1,0)) W !,"ERROR, DRUG EXISTS!"
Q
;
GGKILL ; KILL THE BAD NODES
S ZI=""
F S ZI=$O(^G("BAD",ZI)) Q:ZI="" D ;
. S ZJ=""
. F S ZJ=$O(^G("BAD",ZI,ZJ)) Q:ZJ="" D ;
. . W !,^PS(55,ZI,"NVA",ZJ,1,7,0)
. . I $D(^PS(55,ZI,"NVA",ZJ,1,0)) D Q ;
. . . W !," ERROR, DRUG EXISTS!"
. . . W !," NODE NOT KILLED, PLEASE REVIEW"
. . K ^PS(55,ZI,"NVA",ZJ,1,7,0)
. . W !," BAD NODE KILLED"
Q
;
GTEST ; TESTING RENEWAL PROCESSING
K G
D SOAP^C0PWS2("G","REFILLS",135,961)
S ZI=""
F S ZI=$O(G(ZI)) Q:ZI="" D ;
. S ZG=G(ZI,"RenewalRequestGuid")
. I ZG="" W !,"ERROR NULL GUID"
. S ZT=$O(^TMP("C0E","INDEX",ZG,""))
. I ZT'="" D ; HAVE A TOKEN
. . S ZM1=G(ZI,"DrugInfo")
. . S ZM2=^TMP("C0E","TOKEN",ZT,"renewalToken")
. . S ZM3=^TMP("C0E","TOKEN",ZT,"medication")
. . W !,!,"GUID:",ZG,!," TOKEN: ",ZT
. . W !,"DRUG1: ",ZM1,!," DRUG2: ",ZM2,!," DRUG3: ",ZM3
. . ;ZWR ^TMP("C0E","TOKEN",ZT,*)
Q
;
GTEST2 ; SECOND TEST - FINDING INCONSISTANCIES IN RENEWAL ALERTS
S ZI=""
S ZN=0
S ZTMP=$NA(^TMP("C0E","TOKEN"))
F S ZI=$O(@ZTMP@(ZI)) Q:ZI="" D ; FOR EACH TOKEN
. I @ZTMP@(ZI,"C0PRenewalName")["request for" D ; MED WHERE NAME SHOULD BE
. . W !,!,"TOKEN:",ZI
. . W !,"GUID:",@ZTMP@(ZI,"C0PGuid")
. . W !,@ZTMP@(ZI,"C0PRenewalName")
. . W !,@ZTMP@(ZI,"medication")
. . W !,@ZTMP@(ZI,"renewalToken")
. . S ISTR=@ZTMP@(ZI,"renewalToken")
. . S IDUZ=@ZTMP@(ZI,"IDUZ")
. . S ZALRT=$P(ISTR,";",3) ; RENEWAL TOKEN
. . S ^G2(IDUZ,ZALRT,ISTR)=""
. . S ZN=ZN+1
W !,!,"NUMBER OF TOKENS:",ZN
Q
;
GTEST3 ; USE ^G2 TO TRY AND FIND THE ALERTS
;
S ZDUZ=""
F S ZDUZ=$O(^G2(ZDUZ)) Q:ZDUZ="" D ;
. S ZALRT=""
. F S ZALRT=$O(^G2(ZDUZ,ZALRT)) Q:ZALRT="" D ;
. . W !,!,ZALRT
. . W !,$G(^XTV(8992,ZDUZ,"XQA",ZALRT,0))
. . S NXTALRT=$O(^XTV(8992,ZDUZ,"XQA",ZALRT)) ; NEXT ALERT
. . W !,"NEXT:",NXTALRT
. . I NXTALRT'="" W !,$G(^XTV(8992,ZDUZ,"XQA",NXTALRT,0))
Q
;
GINDEX ; INDEX THE ^TMP("C0E","TOKEN") ARRAY BY GUID
S ZI=""
S ZN=0
F S ZI=$O(^TMP("C0E","TOKEN",ZI)) Q:ZI="" D ;
. S ZG=^TMP("C0E","TOKEN",ZI,"C0PGuid")
. S ^TMP("C0E","INDEX",ZG,ZI)=""
. S ZN=ZN+1
W !,"NUMBER OF TOKENS: ",ZN
Q
;
ENCREQ(ZRTN,ZDUZ,ZDFN) ; ENCODE AN NCSCRIPT RENEWAL REQUEST
;
D GENTEST("GPL","GURL",ZDUZ,ZDFN,1)
;S ZI=""
;S GPL(1)="RxInput="_GPL(1)
S ZI=0 ;
;F S ZI=$O(GPL(ZI)) Q:ZI="" D ; MAKE IT XML SAFE
;. S GPL(ZI)=$$SYMENC^MXMLUTL(GPL(ZI))
;. W !,GPL(ZI)
S ZI=0
S G=""
K GPL(0) ; GET RID OF LINE COUNT
F S ZI=$O(GPL(ZI)) Q:ZI="" D ;
. S G=G_GPL(ZI)
S @ZRTN=$$ENCODE^RGUTUU(G)
;S @ZRTN=G
Q
;
CERTTEST ; GENERATE XML FILES FOR NEWCROP CERTIFICATION
;
N ZII
S ZDFN=18 ; TEST PATIENT TO USE
F ZII=154,155,156,157 D ; IENS OF SUBSCRIBER PROFILES
. D CERTONE(ZII,ZDFN)
Q
;
CERTONE(ZI,ZDFN) ; GENERATE ONE XML FILE
N ZN
D EN^C0PMAIN("C0PG1","G2",ZI,ZDFN) ; GET THE NCSCRIPT
S ZN=$P($P(^VA(200,ZI,0),U,1),",",2) ; GIVEN NAME OF USER
; ON OUR SYSTEM THESE ARE ERX,DOCTOR ERX,MID-LEVEL ERX,NURSE AND ERX,MANAGER
S ZN=ZN_".xml" ; APPEND .xml extension
K C0PG1(0)
S ZDIR=^TMP("C0CCCR","ODIR")
W !,$$OUTPUT^C0CXPATH("C0PG1(1)",ZN,ZDIR)
Q
;
GENTEST(RTNXML,RTNURL,ZDUZ,ZDFN,ZFILE) ; GENERATE A TEST
; CLICK-THROUGH HTLM FILE FOR
; GENERATING REFILL REQUESTS , XML IS RETURNED IN RTN,PASSED BY NAME
; IF ZFILE IS 1, THE FILE IS WRITTEN TO HOST FILE
D EN^C0PMAIN("C0PG1","G2",ZDUZ,ZDFN) ; GET THE NCSCRIPT
;D GETMEDS("G6",ZDFN) ;GET MEDICATIONS
;D QUERY^C0CXPATH("G6","//NewPrescription[1]","G7") ;JUST THE FIRST ONE
;D INSERT^C0CXPATH("C0PG1","G7","//NCScript")
K C0PG1(0)
M @RTNXML=C0PG1 ;
S ZDIR=^TMP("C0CCCR","ODIR")
I $G(ZFILE)=1 W $$OUTPUT^C0CXPATH("C0PG1(1)","REFILL-"_ZDFN_".xml",ZDIR)
Q
;
GETMEDS(OUTARY,ZDFN) ; GET THE PATIENT'S MEDS AND PUT INTO XML
;
N ZG,ZG2,ZB,ZN
S DEBUG=0
D GETTEMP^C0PWS2("ZG","OUTMEDS") ;GET THE MEDICATIONS TEMPLATE
D SOAP^C0PWS2("ZG2","GETMEDS",$$PRIMARY^C0PMAIN(),ZDFN) ; GET MEDS
I '$D(ZG2) Q ; SHOULDN'T HAPPEN
I ZG2(1,"Status")'="OK" D Q ; BAD RETURN FROM WEB SERVER
. W $G(ZG2(1,"Message")),!
N ZI S ZI=""
S ZN=$NA(^TMP("C0PREFIL",$J))
K @ZN
F S ZI=$O(ZG2(ZI)) Q:ZI="" D ; FOR EACH MED
. N ZV
. S ZV=$NA(@ZN@("DATA",ZI))
. S ZX=$NA(@ZN@("XML",ZI))
. S @ZV@("dispenseNumber")=$G(ZG2(ZI,"Dispense"))
. S @ZV@("dosage")="Take "_$G(ZG2(ZI,"DosageNumberDescription"))_" "_$G(ZG2(ZI,"Route"))_" "_$G(ZG2(ZI,"DosageFrequencyDescription"))
. S @ZV@("drugIdentifier")=ZG2(ZI,"DrugID")
. S @ZV@("drugIdentifierType")="FDB"
. S @ZV@("pharmacistMessage")="No childproof caps please"
. S @ZV@("pharmacyIdentifier")=1231212
. S @ZV@("refillCount")=ZG2(ZI,"Refills")
. S @ZV@("substitution")="SubstitutionAllowed"
. D MAP^C0CXPATH("ZG",ZV,ZX)
. D QUEUE^C0CXPATH("ZB",ZX,2,$O(@ZX@(""),-1))
D BUILD^C0CXPATH("ZB",OUTARY)
K @ZN ;CLEAN UP
Q
;
;B
;
;D GET^C0PCUR(.ZG2,ZDFN) ; GET THE MEDS FOR THIS PATIENT
;D EXTRACT^C0CALERT("ZG",ZDFN,"ZG2","ALGYCBK^C0PALGY3(ALTVMAP,A1)")
S ZN=$O(ZR(""),-1) ;NUMBER OF LINES IN OUTPUT
D QUEUE^C0CXPATH("ZB","ZG2",2,ZN-1)
D BUILD^C0CXPATH("ZB",OUTARY)
Q
;
RGUIDS(ZARY,ZDUZ) ; RETURNS AN ARRAY OF ALL REFILL REQUEST GUIDS FOR
; DUZ ZDUZ. ZARY IS PASSED BY NAME
; FORMAT IS @ZARY@("GUID")=IEN
; THIS ROUTINE IS REUSED FOR THE STATUS ROUTINE - INCOMPLETE ORDERS
N ZI,ZJ,ZK,ZL,ZM,ZN
S ZI=0
;F S ZI=$O(^XTV(8992.1,"R",ZDUZ,ZI)) Q:ZI="" D ; ALL ALERT FOR DUZ
F S ZI=$O(^XTV(8992,ZDUZ,"XQA",ZI)) Q:ZI="" D ; USE XQA MULTIPLE
. S ZL=^XTV(8992,ZDUZ,"XQA",ZI,0) ;
. S ZM=$P(ZL,U,2) ; RECORD ID
. S ZN=$O(^XTV(8992.1,"B",ZM,"")) ;IEN OF ALERT TRACKING RECORD
. S ZK=$$GET1^DIQ(8992.1,ZN_",",.03)
. I ZK'["OR,1130" Q ; NOT OUR PACKAGE - ALL ERX ALERTS START WITH 1130
. ; 11305 IS FOR REFILLS
. ; 11306 IS FOR INCOMPLETE ORDERS
. S ZJ=""
. S ZJ=$$GET1^DIQ(8992.1,ZN_",",2)
. I ZJ="" Q
. ; FOR RENEWALS (11305) NEED TO PULL THE GUID OUT - IT IS THE FIRST PIECE
. ; OTHERWISE USE THE ENTIRE STRING. FOR INCOMPLETE ORDERS THIS WILL
. ; INCLUDE THE MED AND PRESCRIPTION DATE
. I ZK["OR,11305" S ZJ=$P(ZJ,"^",1) ; FIRST PIECE IS THE GUILD GUID^DOB^SEX
. S @ZARY@(ZJ)=ZN
Q
;
EN ; BATCH ENTRY POINT FOR REFILL (RENEWAL) STATUS AND FAILEDFAX CHECKING
D REFILL
K ZRSLT
;D STATUS ; ALSO RUN CHECK FOR INCOMPLETE ORDERS
D FAILFAX ; ALSO RUN CHECK FOR FAILED FAXES
Q
;
REFILL ; PULL REFILL REQUESTS AND POST ALERTS
;
N ZDUZ ; USER NUMBER UNDER WHICH WE BUILD THE WEB SERVICE CALL
N ZDFN ; PATIENT NUMBER USED TO BUILD THE WEB SERVICE CALL
S ZDUZ=$$PRIMARY^C0PMAIN() ; PRIMARY ERX USER FOR BATCH CALLS
;S ZDUZ=DUZ ; SHOULD CHANGE THIS FOR PRODUCTION TO A "BATCH" USER
S ZDFN="" ; NO PATIENT NEEDED FOR THESE CALLS
; S ZDFN=18 ; SHOULD NOT NEED THIS BE MAKE THE CALL - FIX IN EN^C0PMAIN
N ZRSLT
D SOAP^C0PWS2("ZRSLT","REFILLS",ZDUZ,ZDFN) ; WS CALL TO RETURN REFILS
;S XXX=YYY ;
I $G(ZRSLT(1,"Status"))'="OK" Q ; NO ROWS WERE RETURNED
I $G(ZRSLT(1,"RowCount"))=0 Q ; NO ROWS WERE RETURNED
D NOTIPURG^XQALBUTL(11305) ; DELETE ALL CURRENT REFILL ALERTS
S C0PNPIF=$$GET1^DIQ(C0PAF,C0PACCT_",",8,"I") ; LEGACY FLAG TO USE NPI FOR SID
N ZI S ZI=0
N ZAPACK S ZAPACK="OR" ; ALERT PACKAGE CODE
N ZADFN S ZADFN=0 ; DFN TO ASSOCIATE ALERT WITH - WE DON'T KNOW THIS
N ZACODE S ZACODE=11305 ; IEN TO OE/RR NOTIFICATIONS file for eRx Refills
F S ZI=$O(ZRSLT(ZI)) Q:+ZI=0 D ; FOR EACH RETURNED REFILL REQUEST
. N ZSID S ZSID=ZRSLT(ZI,"ExternalDoctorId") ; NPI FOR SUBSCRIBER
. I C0PNPIF'=1 S ZDUZ=$O(^VA(200,"AC0PSID",ZSID,"")) ; GUID SID
. E S ZDUZ=$O(^VA(200,"C0PNPI",ZSID,"")) ; DUZ FOR SUBSCRIBER
. S ZRSLT("DUZ",ZDUZ,ZI)=""
N ZJ S ZJ=""
F S ZJ=$O(ZRSLT("DUZ",ZJ)) Q:ZJ="" D ; FOR EACH PROVIDER
. N ZGUIDS
. D RGUIDS("ZGUIDS",ZJ) ; GET ARRAY OF CURRENT ACTIVE GUIDS
. S ZI=""
. F S ZI=$O(ZRSLT("DUZ",ZJ,ZI)) Q:ZI="" D ; FOR EACH REQUEST
. . N ZRRG S ZRRG=ZRSLT(ZI,"RenewalRequestGuid") ;renewal request number
. . I $D(ZGUIDS(ZRRG)) D Q ; THIS REQUEST IS A DUPLICATE, SKIP IT
. . . W ZRRG_" IS A DUP",!
. . N ZDATE S ZDATE=$P(ZRSLT(ZI,"ReceivedTimestamp")," ",1) ;DATE RECEIVED
. . I $G(^TMP("C0P","TestNoMatch"))=1 D ;
. . . S ZRSLT(ZI,"PatientMiddleName")="XXX" ;TESTING NO MATCH REMOVE ME
. . ;I DUZ=135 S ZRSLT(ZI,"PatientMiddleName")="Uta" ;TESTING NO MATCH REMOVE
. . N ZPAT S ZPAT=$G(ZRSLT(ZI,"PatientLastName"))_","_$G(ZRSLT(ZI,"PatientFirstName")) ; PATIENT NAME LAST,FIRST
. . I $G(ZRSLT(ZI,"PatientMiddleName"))'="" S ZPAT=ZPAT_" "_$G(ZRSLT(ZI,"PatientMiddleName"))
. . S ZDOB=$G(ZRSLT(ZI,"PatientDOB")) ;patient date of birth
. . S ZSEX=$G(ZRSLT(ZI,"PatientGender")) ;patient gender
. . S ZADFN=$$PATMAT(ZPAT,ZDOB,ZSEX) ; TRY AND MATCH THE PATIENT
. . ;W "DFN="_ZADFN," ",ZI,!
. . N ZXQAID S ZXQAID=ZAPACK_","_ZADFN_","_ZACODE ; FORMAT FOR P1 OF XQAID
. . N ZMED S ZMED=ZRSLT(ZI,"DrugInfo")
. . ;S XQA(ZDUZ)="" ; WHO TO SEND THE ALERT TO
. . I '$D(^TMP("C0P","AlertVerify")) S XQA(ZJ)="" ; WHO TO SEND THE ALERT TO
. . E D ; AlertVerify sends alerts only to testers, not recipients
. . . ; use this when installing eRx to verify ewd installation
. . . N ZZZ S ZZZ=""
. . . F S ZZZ=$O(^TMP("C0P","AlertVerify",ZZZ)) Q:ZZZ="" D ; WHICH DUZ
. . . . S XQA(ZZZ)="" ; MARK THIS USER TO RECIEVE ALERTS
. . ;S XQA(135)="" ; ALWAYS SEND TO GPL
. . ;S XQA(148)="" ; ALWAYS SEND TO RICH
. . N ZP6 ; STRING THAT CPRS WILL RETURN FOR MATCHING
. . I ZADFN=0 D ; NO MATCH
. . . S XQAMSG="no match: ): [eRx] "_ZPAT_" Renewal request for "_ZMED
. . . S ZP6=ZPAT_" Renewal request for "_ZMED
. . E D ;
. . . S XQAMSG=ZPAT_": ): [eRx] Renewal request for "_ZMED
. . . S ZP6="Renewal request for "_ZMED
. . ;S XQAMSG=$E(XQAMSG,1,70) ; TRUNCATE TO 70 CHARS
. . S XQAID=ZXQAID ; PACKAGE IDENTIFIER
. . ;S XQADATA=ZRRG ; THE GUID OF THE REQUEST. NEEDED TO PROCESS THE ALERT
. . S XQADATA=ZRRG_"^"_ZDOB_"^"_ZSEX ; SAVE DOB AND SEX WITH GUID
. . W "SENDING",XQAID_" "_XQADATA,!
. . D SETUP^XQALERT ; MAKE THE CALL TO SET THE ALERT
K ZRSLT
;D STATUS ; ALSO RUN CHECK FOR INCOMPLETE ORDERS
;D FAILFAX ; ALSO RUN CHECK FOR FAILED FAXES
Q
;
PATMAT(ZNAME,INDOB,INSEX) ;EXTRINSIC TO TRY AND MATCH THE PATIENT
; RETURNS ZERO IF NO EXACT MATCH IS FOUND
N ZP
S ZP=$O(^DPT("B",ZNAME,""))
I ZP="" Q 0 ; EXACT MATCH NOT FOUND ON NAME
; CHECK DATE OF BIRTH
;W "CHECKING DATE OF BIRTH",!
N DOB
S DOB=$$GET1^DIQ(2,ZP_",",.03,"I") ; PATIENT'S DATE OF BIRTH IN VISTA
N ZD ;INCOMING DATE OF BIRTH IS IN YYYYMMDD FORMAT
S ZD=($E(INDOB,1,4)-1700)_$E(INDOB,5,8) ; DATE OF BIRTH CONVERTED TO FM FORMAT
;W ZD_" "_DOB,!
I +ZD'=+DOB Q 0 ; DATE OF BIRTH DOES NOT MATCH
;
; CHECK GENDER
;W "CHECKING GENDER",!
N GENDER
S GENDER=$$GET1^DIQ(2,ZP_",",.02,"I") ; PATIENT'S GENDER IN VISTA
;W GENDER_INSEX,!
I GENDER'=INSEX Q 0 ;GENDER DOESN'T MATCH
Q ZP
;
STATUS ; BATCH CALL TO RETRIEVE ERX ACCOUNT STATUS
; RETURNS UNFINISHED ORDERS FOR ALL PROVIDERS
; AND SENDS STATUS ALERTS
N VOR
S VOR("STATUS-SECTION-TYPE")="AllDoctorReview"
S VOR("SORT-ORDER")="A"
S VOR("INCLUDE-SCHEMA")="N"
S ZDUZ=$$PRIMARY^C0PMAIN() ; PRIMARY ERX USER FOR BATCH CALLS
K ZRSLT
; D SOAP^C0PWS1("ZRSLT","STATUS",ZDUZ,"","VOR")
D SOAP^C0PWS2("ZRSLT","STATUS",ZDUZ,"","VOR")
I '$D(ZRSLT) Q ; SHOULDN'T HAPPEN
I $G(ZRSLT(1,"DrugInfo"))="" Q ; NO ROWS
S C0PNPIF=$$GET1^DIQ(C0PAF,C0PACCT_",",8,"I") ; LEGACY FLAG TO USE NPI FOR SID
N ZI S ZI=0
N ZAPACK S ZAPACK="OR" ; ALERT PACKAGE CODE
N ZADFN S ZADFN=0 ; DFN TO ASSOCIATE ALERT WITH - WE DON'T KNOW THIS
N ZACODE S ZACODE=11306 ; IEN TO OE/RR NOTIFICATIONS file for eRx incomplete
; orders
F S ZI=$O(ZRSLT(ZI)) Q:+ZI=0 D ; FOR EACH RETURNED REFILL REQUEST
. N ZSID S ZSID=$G(ZRSLT(ZI,"ExternalDoctorId")) ; NPI FOR SUBSCRIBER
. I ZSID="" Q ; NO EXTERNAL ID FOR THIS STATUS
. I C0PNPIF'=1 S ZDUZ=$O(^VA(200,"AC0PSID",ZSID,"")) ; GUID SID
. E S ZDUZ=$O(^VA(200,"C0PNPI",ZSID,"")) ; DUZ FOR SUBSCRIBER
. S ZRSLT("DUZ",ZDUZ,ZI)=""
N ZJ S ZJ=""
D RMSTATUS ; REMOVE ALL STATUS ALERTS
F S ZJ=$O(ZRSLT("DUZ",ZJ)) Q:ZJ="" D ; FOR EACH PROVIDER
. N ZGUIDS
. D RGUIDS("ZGUIDS",ZJ) ; GET ARRAY OF CURRENT ACTIVE ALERTS
. S ZI=""
. F S ZI=$O(ZRSLT("DUZ",ZJ,ZI)) Q:ZI="" D ; FOR EACH REQUEST
. . N ZRRG S ZRRG=$G(ZRSLT(ZI,"DrugInfo")) ; first piece of XQDATA
. . S $P(ZRRG,"^",2)=$G(ZRSLT(ZI,"PrescriptionDate")) ; second piece
. . I $D(ZGUIDS(ZRRG)) D Q ; THIS REQUEST IS A DUPLICATE, SKIP IT
. . . ;W ZRRG_" IS A DUP",!
. . I ZRRG="^" D Q ; THIS IS AN ERROR
. . . B
. . N ZDATE S ZDATE=$P($G(ZRSLT(ZI,"PrescriptionDate"))," ",1) ;
. . N ZPAT S ZPAT=$G(ZRSLT(ZI,"ExternalPatientId")) ; format PATIENTDFN
. . I ZPAT="" Q ;THIS IS AN ERROR
. . S ZADFN=$P(ZPAT,"PATIENT",2) ; EXTRACT THE DFN
. . S ZPAT=$$GET1^DIQ(2,ZADFN_",",.01) ;PATIENT'S NAME
. . ;W "DFN="_ZADFN," ",ZI,!
. . N ZXQAID S ZXQAID=ZAPACK_","_ZADFN_","_ZACODE ; FORMAT FOR P1 OF XQAID
. . N ZMED S ZMED=ZRSLT(ZI,"DrugInfo")
. . ;S XQA(ZDUZ)="" ; WHO TO SEND THE ALERT TO
. . S XQA(ZJ)="" ; WHO TO SEND THE ALERT TO
. . ;S XQA(135)="" ; ALWAYS SEND TO GPL
. . ;S XQA(148)="" ; ALWAYS SEND TO RICH
. . N ZP6 ; STRING THAT CPRS WILL RETURN FOR MATCHING
. . I ZADFN=0 D ; NO MATCH
. . . S XQAMSG="no match: ): [eRx] "_ZPAT_" Incomplete Order for "_ZMED
. . . S ZP6=ZPAT_" Incomplete Order for "_ZMED
. . E D ;
. . . S XQAMSG=ZPAT_": ): [eRx] Incomplete Order for "_ZMED
. . . S ZP6="Incomplete Order for "_ZMED
. . ;S XQAMSG=$E(XQAMSG,1,70) ; TRUNCATE TO 70 CHARS
. . S XQAID=ZXQAID ; PACKAGE IDENTIFIER
. . S XQADATA=ZRRG ; THE GUID OF THE REQUEST. NEEDED TO PROCESS THE ALERT
. . D SETUP^XQALERT ; MAKE THE CALL TO SET THE ALERT
Q
;
RMSTATUS ; DELETES ALL STATUS ALERTS FOR ALL USERS (THEY WILL BE
; RESTORED NEXT TIME STATUS^C0PREFIL IS RUN - IN ERX BATCH
D NOTIPURG^XQALBUTL(11306) ;
W !,"ALL ERX STATUS ALERTS HAVE BEEN DELETED"
Q
;
FAILFAX ; BATCH CALL TO RETRIEVE ERX FAILED FAX STATUS
; RETURNS A COUNT OF FAILED FAXES AND AN ARRAY OF PATIENTS
N VOR,ZRSLT
S VOR("STATUS-SECTION-TYPE")="FailedFax"
;S VOR("ACCOUNT-PARTNERNAME")="demo"
S VOR("SORT-ORDER")="A"
S VOR("INCLUDE-SCHEMA")="N"
S ZDUZ=$$PRIMARY^C0PMAIN() ; PRIMARY ERX USER FOR BATCH CALLS
D SOAP^C0PWS1("ZRSLT","STATUS",ZDUZ,"","VOR")
N ZCOUNT
S ZCOUNT=$O(ZRSLT(""),-1) ; HOW MANY FAILED FAXES
I +ZCOUNT=0 Q ; NO FAILED FAXES
;I $G(ZRSLT(1,"RowCount"))=0 Q ; NO FAILED FAXES
;I $G(ZRSLT(1,"RowCount"))="" Q ; SHOULD NOT HAPPEN
N XQA,XQAMSG,XQAID,XQAKILL
S XQAID="C0P" ; GOING TO FIRST KILL ALL FAILED FAX ALERTS
D DELETEA^XQALERT ; KILL ALL FAILED FAX ALERTS
S XQA("G.ERX HELP DESK")=""
;S XQA(135)=""
S XQAID="C0P"
S XQAMSG="eRx: "_ZCOUNT_" Failed Faxes on ePrescribing"
D SETUP^XQALERT ; CREATE NEW FAILED FAX ALERTS TO THE MAILGROUP
Q
;
RUN ; USED TO PROCESS AN ALERT. THIS ROUTINE IS LISTED IN
; 0E/RR CPRS NOTIFICATIONS AS THE ROUTINE TO RUN TO PROCESS
; A C0P ERX ALERT
W "MADE IT TO RUN C0PREFIL",!
W XQADATA
B
Q
;
GETALRT(ZARY,ZID) ; LOOKS UP AN ALERT BY USING THE "RECORDID" FROM CPRS,
; PASSED BY VALUE IN ZID. RESULTS ARE RETURNED IN ZARY, PASSED BY NAME
;N ZIEN
;S ZIEN=$O(^XTV(8992.1,"B",ZID,"")) ;IEN IN THE ALERT TRACKING FILE
;I ZIEN="" W "ERROR RETRIEVING ALERT",! Q ;
D GETN^C0CRNF(ZARY,8992.1,ZID,"B") ; GET ALL THE ALERT FIELDS
; THE FORMAT IS @ZARY@("DATA FOR PROCESSING")="FILE^FIELD^VALUE"
; ALL POPULATED FIELDS (BUT NOT SUBFILES) ARE RETURNED
Q
;
UPDIE ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS
K ZERR
D CLEAN^DILF
D UPDATE^DIE("","C0PFDA","","ZERR")
I $D(ZERR) D ;
. W "ERROR",!
. ZWR ZERR
. B
K C0PFDA
Q
;
FIND ; FIND ALL CURRENT ALERTS
N ZI S ZI="" ; DUZ
F S ZI=$O(^XTV(8992,"AXQAN","OR,0,11305",ZI)) Q:ZI="" D ;
. N ZJ S ZJ="" ; TIME STAMP
. F S ZJ=$O(^XTV(8992,"AXQAN","OR,0,11305",ZI,ZJ)) Q:ZJ="" D ;
. . N ZZ,ZT
. . S ZZ=$G(^XTV(8992,ZI,"XQA",ZJ,0))
. . S ZT=$P(ZZ,U,2)
. . Q:ZT=""
. . S ZG=$O(^XTV(8992.1,"B",ZT,""))
. . Q:ZG=""
. . S ZGUID=$G(^XTV(8992.1,ZG,2))
. . Q:ZGUID=""
. . S ZGUID=$P(ZGUID,U,1)
. . W !,ZI," ",ZJ," ",ZT," ",ZG," ",ZGUID
. . ;ZWR ^XTV(8992.1,ZG,*)
. . S G(ZJ,ZT,ZGUID)=""
Q
;

View File

@ -0,0 +1,201 @@
C0QUPDT ; GPL - Quality Reporting List Update Routines ;8/29/11 17:05
;;0.1;C0Q;nopatch;noreleasedate;Build 26
;Copyright 2009 George Lilly. Licensed under the terms of the GNU
;General Public License See attached copy of the License.
;
;This program is free software; you can redistribute it and/or modify
;it under the terms of the GNU General Public License as published by
;the Free Software Foundation; either version 2 of the License, or
;(at your option) any later version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License along
;with this program; if not, write to the Free Software Foundation, Inc.,
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
;
Q
;
C0QQFN() Q 1130580001.101 ; FILE NUMBER FOR C0Q QUALITY MEASURE FILE
C0QMFN() Q 1130580001.201 ; FILE NUMBER FOR C0Q MEASUREMENT FILE
C0QMMFN() Q 1130580001.2011 ; FN FOR MEASURE SUBFILE
C0QMMNFN() Q 1130580001.20111 ; FN FOR NUMERATOR SUBFILE
C0QMMDFN() Q 1130580001.20112 ; FN FOR DENOMINATOR SUBFILE
RLSTFN() Q 810.5 ; FN FOR REMINDER PATIENT LIST FILE
RLSTPFN() Q 810.53 ; FN FOR REMINDER PATIENT LIST PATIENT SUBFILE
C0QPLF() Q 1130580001.301 ; C0Q PATIENT LIST FILE
C0QALFN() Q 1130580001.311 ; FILE NUMBER FOR C0Q PATIENT LIST PATIENT SUBFILE ;
;
UPDATE(RNT,MSET) ; UPDATE A MEASURE SET BY ADDING NEW ENTRIES TO PATIENT
; LISTS AND DELETING ENTRIES THAT ARE NO LONGER VALID. ALSO UPDATE
; NUMERATOR AND DENOMINATOR COUNTS
; MAKES HEAVY USE OF UNITY^C0QSET TO DETERMINE WHAT TO ADD AND DELETE
;
; THIS IS A REPLACEMENT FOR C0QRPC^C0QMAIN WHICH DELETES THE PATIENT
; LISTS AND RECREATES THEM, WHICH IS A LOT OF UNNECESSARY PROCESSING
;
N ZI S ZI=""
N C0QM ; FOR HOLDING THE MEASURES IN THE SET
I $$GET1^DIQ($$C0QMFN,MSET_",",.05,"I")="Y" D Q ; IS IT LOCKED?
. W !,"ERROR MEASURE SET IS LOCKED, EXITING"
D LIST^DIC($$C0QMMFN,","_MSET_",",".01I;1.2I;2.2I") ; GET ALL THE MEASURES
D DELIST("C0QM")
N ZII S ZII=""
F S ZII=$O(C0QM(ZII)) Q:ZII="" D ; FOR EACH MEASURE
. N C0QNL,C0QDL,C0QFLTN,C0QFLTD
. S C0QFLTN=$P(C0QM(ZII),U,3) ;IEN OF NUMERATOR FILTER LIST
. S C0QFLTD=$P(C0QM(ZII),U,4) ; IEN OF DENOMINATOR FILTER LIST
. S ZI=$P(C0QM(ZII),U,1) ; IEN OF THE MEASURE IN THE C0Q QUALITY MEAS FILE
. S C0QNL=$$GET1^DIQ($$C0QQFN,ZI_",",1,"I") ; NUMERATOR POINTER
. I C0QNL="" D ; CHECK ALTERNATE LIST
. . S C0QNL=$$GET1^DIQ($$C0QQFN,ZI_",",1.1,"I") ; NUMERATOR POINTER
. . I C0QNL'="" S C0QNALT=1
. S C0QDL=$$GET1^DIQ($$C0QQFN,ZI_",",2,"I") ; DENOMINATOR POINTER
. I C0QDL="" D ; CHECK ALTERNATE LIST
. . S C0QDL=$$GET1^DIQ($$C0QQFN,ZI_",",2.1,"I") ; DENOMINATOR POINTER
. . I C0QDL'="" S C0QDALT=1
. ;
. ; FIRST PROCESS THE NUMERATOR
. ;
. N C0QNEW ; REFERENCE TO NEW NUMBERATOR LIST B INDEX
. I $G(C0QNALT)=1 D ; USING ALTERNATE LIST FOR NUMERATOR
. . S C0QNEW=$NA(^C0Q(301,C0QNL,1,"B")) ; B INDEX FOR THIS LIST
. E D ; USE THE REMINDER PACKAGE PATIENT LISTS
. . S C0QNEW=$NA(^PXRMXP(810.5,C0QNL,30,"B")) ; REMINDER LIST PATIENTS
. I C0QFLTN'="" D ; USE A NUMERATOR FILTER LIST
. . N ZNEW
. . S ZNEW=$NA(^C0Q(301,C0QFLTN,1,"B")) ; B INDEX OF FILTER LIST
. . K C0QFLTRD
. . D AND^C0QSET("C0QFLTRD",ZNEW,C0QNEW)
. . S C0QNEW="C0QFLTRD"
. N C0QOLD ; REFERENCE FOR OLD PATIENT LIST
. S C0QOLD=$NA(^C0Q(201,MSET,5,ZII,1,"B")) ; NUMERATOR LIST IN MEASURE SET
. N C0QRSLT ; ARRAY FOR THE UNITY DIFFERENCES
. D UNITY^C0QSET("C0QRSLT",C0QNEW,C0QOLD) ; FIND THE DIFFERENCES
. N C0QCNT
. S C0QNCNT=$G(C0QRSLT("COUNT"))
. I C0QNCNT="" D ;
. . S C0QNCNT=0 ; DEFAULT COUNT IS ZERO
. . N GZZ S GZZ=""
. . F S GZZ=$O(C0QRSLT(0,GZZ)) Q:GZZ="" D ; EVERY ADD ENTRY
. . . S C0QNCNT=C0QNCNT+1
. . F S GZZ=$O(C0QRSLT(1,GZZ)) Q:GZZ="" D ; EVERY EQUAL ENTRY
. . . S C0QNCNT=C0QNCNT+1
. K C0QFDA ; CLEAR THE FDA
. N C0QONCNT ; OLD COUNT
. S C0QONCNT=$$GET1^DIQ($$C0QMMFN(),ZII_","_MSET_",",1.1)
. I C0QNCNT'=C0QONCNT D ; COUNT HAS CHANGED
. . S C0QFDA($$C0QMMFN(),ZII_","_MSET_",",1.1)=C0QNCNT ; NUMERATOR COUNT
. . D UPDIE ; UPDATE THE NUMERATOR COUNT
. I $D(C0QRSLT) D ;B ;
. . ;ZWR C0QRSLT
. ; FIRST PROCESS DELETIONS
. K C0QFDA ; CLEAR OUT THE FDA
. N ZG,ZIEN S ZG=""
. F S ZG=$O(C0QRSLT(2,ZG)) Q:ZG="" D ; FOR EACH DELETION
. . S ZIEN=$O(@C0QOLD@(ZG,"")) ; IEN OF THE ENTRY
. . I ZIEN="" D Q ; OOPS
. . . W !,"ERROR DELETING ENTRY!! ",ZG
. . S C0QFDA($$C0QMMNFN(),ZIEN_","_ZII_","_MSET_",",.01)="@" ; DELETE
. I $D(C0QFDA) D UPDIE ; PROCESS
. ; SECOND, PROCESS ADDITIONS
. K C0QFDA ; CLEAR OUT THE FDA
. N ZG,ZC S ZG="" S ZC=1
. F S ZG=$O(C0QRSLT(0,ZG)) Q:ZG="" D ; FOR EACH ADDITION
. . S C0QFDA($$C0QMMNFN(),"+"_ZC_","_ZII_","_MSET_",",.01)=ZG ; ADD THE ENTRY
. . S ZC=ZC+1
. I $D(C0QFDA) D UPDIE ; PROCESS
. ;
. ; PROCESS THE DENOMINATOR
. ;
. N C0QNEW ; REFERENCE TO NEW NUMBERATOR LIST B INDEX
. I $G(C0QNALT)=1 D ; USING ALTERNATE LIST FOR NUMERATOR
. . S C0QNEW=$NA(^C0Q(301,C0QDL,1,"B")) ; B INDEX FOR THIS LIST
. E D ; USE THE REMINDER PACKAGE PATIENT LISTS
. . S C0QNEW=$NA(^PXRMXP(810.5,C0QDL,30,"B")) ; REMINDER LIST PATIENTS
. I C0QFLTD'="" D ; USE A DENOMINATOR FILTER LIST
. . N ZNEW
. . S ZNEW=$NA(^C0Q(301,C0QFLTD,1,"B")) ; B INDEX OF FILTER LIST
. . K C0QFLTRD
. . D AND^C0QSET("C0QFLTRD",ZNEW,C0QNEW)
. . S C0QNEW="C0QFLTRD"
. N C0QOLD ; REFERENCE FOR OLD PATIENT LIST
. S C0QOLD=$NA(^C0Q(201,MSET,5,ZII,3,"B")) ; DENOMINATOR LIST IN MEASURE SET
. N C0QRSLT ; ARRAY FOR THE UNITY DIFFERENCES
. D UNITY^C0QSET("C0QRSLT",C0QNEW,C0QOLD) ; FIND THE DIFFERENCES
. N C0QDCNT
. S C0QDCNT=$G(C0QRSLT("COUNT"))
. I C0QDCNT="" D ;
. . S C0QDCNT=0 ; DEFAULT COUNT IS ZERO
. . N GZZ S GZZ=""
. . F S GZZ=$O(C0QRSLT(0,GZZ)) Q:GZZ="" D ; EVERY ADD ENTRY
. . . S C0QDCNT=C0QDCNT+1
. . F S GZZ=$O(C0QRSLT(1,GZZ)) Q:GZZ="" D ; EVERY EQUAL ENTRY
. . . S C0QDCNT=C0QDCNT+1
. K C0QFDA ; CLEAR THE FDA
. N C0QODCNT ; OLD COUNT
. S C0QODCNT=$$GET1^DIQ($$C0QMMFN(),ZII_","_MSET_",",2.1)
. I C0QDCNT'=C0QODCNT D ; COUNT HAS CHANGED
. . S C0QFDA($$C0QMMFN(),ZII_","_MSET_",",2.1)=C0QDCNT ; DENOMINATOR COUNT
. . D UPDIE ; UPDATE THE DENOMINATOR COUNT
. I $D(C0QRSLT) D ;B ;
. . ;ZWR C0QRSLT
. I '$D(C0QRSLT) Q ; NO RESULTS TO USE
. ; FIRST PROCESS DELETIONS
. K C0QFDA ; CLEAR OUT THE FDA
. N ZG,ZIEN S ZG=""
. F S ZG=$O(C0QRSLT(2,ZG)) Q:ZG="" D ; FOR EACH DELETION
. . S ZIEN=$O(@C0QOLD@(ZG,"")) ; IEN OF THE ENTRY
. . I ZIEN="" D Q ; OOPS
. . . W !,"ERROR DELETING ENTRY!! ",ZG
. . S C0QFDA($$C0QMMDFN(),ZIEN_","_ZII_","_MSET_",",.01)="@" ; DELETE
. I $D(C0QFDA) D UPDIE ; PROCESS
. ; SECOND, PROCESS ADDITIONS
. K C0QFDA ; CLEAR OUT THE FDA
. N ZG,ZC S ZG="" S ZC=1
. F S ZG=$O(C0QRSLT(0,ZG)) Q:ZG="" D ; FOR EACH ADDITION
. . S C0QFDA($$C0QMMDFN(),"+"_ZC_","_ZII_","_MSET_",",.01)=ZG ; ADD THE ENTRY
. . S ZC=ZC+1
. I $D(C0QFDA) D UPDIE ; PROCESS
. N C0QPCT ; PERCENT
. D ;
. . I C0QDCNT>0 D ;
. . . S C0QPCT=$J(100*C0QNCNT/C0QDCNT,0,0)
. . E S C0QPCT=0
. . K C0QFDA
. . S C0QFDA($$C0QMMFN(),ZII_","_MSET_",",3)=C0QPCT ; PERCENT
. . D UPDIE
Q
;
DELIST(RTN) ; DECODES ^TMP("DILIST",$J) INTO
; @RTN@(IEN)=INTERNAL VALUE^EXTERNAL VALUE
; ADDED A B INDEX @RTN@("B",INTERNAL VALUE,IEN)=EXTERNAL VALUE
N ZI,IV,EV,ZDI,ZIEN,FLTN,FLTD
S ZI=""
S ZDI=$NA(^TMP("DILIST",$J))
K @RTN
F S ZI=$O(@ZDI@(1,ZI)) Q:ZI="" D ;
. S EV=@ZDI@(1,ZI) ;EXTERNAL VALUE
. S IV=$G(@ZDI@("ID",ZI,.01)) ; INTERNAL VALUE
. S FLTN=$G(@ZDI@("ID",ZI,1.2)) ; NUMERATOR FILTER LIST
. S FLTD=$G(@ZDI@("ID",ZI,2.2)) ; DENOMINATOR FILTER LIST
. S ZIEN=@ZDI@(2,ZI) ; IEN
. S @RTN@(ZIEN)=IV_"^"_EV_"^"_FLTN_"^"_FLTD
. ;S @RTN@("B",IV,ZIEN)=EV
Q
;
UPDIE ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS
K ZERR
D CLEAN^DILF
ZWR C0QFDA
D UPDATE^DIE("","C0QFDA","","ZERR")
I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST, INVOKE THE ERROR TRAP IF TASKED
;. W "ERROR",!
;. ZWR ZERR
;. B
K C0QFDA
Q
;

View File

@ -0,0 +1,75 @@
C0QUTIL ;JJOH/ZAG/GPL - Utilities for C0Q Package ;9/2/11 4:30pm
;;1.0;MU PACKAGE;;;Build 26
;
;2011 Licensed under the terms of the GNU General Public License
;See attached copy of the License.
;
;This program is free software; you can redistribute it and/or modify
;it under the terms of the GNU General Public License as published by
;the Free Software Foundation; either version 2 of the License, or
;(at your option) any later version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License along
;with this program; if not, write to the Free Software Foundation, Inc.,
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
;
AGE(DFN) ; return current age in years and months
;
Q:'$G(DFN) ;quit if no there is no patient
N DOB S DOB=$P(^DPT(+DFN,0),U,3) ;date of birth
N YRS
N DOD S DOD=+$G(^DPT(9,.35)) ;check for date of death
I 'DOD D
. N CDTE S CDTE=DT ;current date
. S YRS=$E(CDTE,1,3)-$E(DOB,1,3)-($E(CDTE,4,7)<$E(DOB,4,7))
E D
. S YRS=$E(DOD,1,3)-$E(DOB,1,3)-($E(DOD,4,7)<$E(DOB,4,7))
;
;Come back here and fix MONTHS and DAYS
;N CM S CM=+$E(DT,4,5) ;current month
;N CD S CD=+$E(DT,6,7) ;current day
;N BM S BM=+$E(DOB,4,5) ;birth month
;N BD S BD=+$E(DOB,6,7) ;birth day
;
;N DAYS S DAYS=""
;
Q YRS ;_"y" gpl ..just want the number
;
;
DTDIFF(ZD1,ZT1,ZD2,ZT2,SHOW) ; extrinsic which returns the number of minutes
; between 2 dates. ZD1 and ZD2 are fileman dates
; ZT1 AND ZT2 are valid times (military time) ie 20:10
; IF SHOW=1 DEBUGGING INTERMEDIATE VALUES WILL BE DISPLAYED
I '$D(SHOW) S SHOW=0
N GT1,GT2,GDT1,GDT2
I ZT1[":" D ;
. S GT1=($P(ZT1,":",1)*3600)+($P(ZT1,":",2)*60) ; SECONDS
. S GT2=($P(ZT2,":",1)*3600)+($P(ZT2,":",2)*60) ; SECONDS
E D ;
. S GT1=($E(ZT1,1,2)*3600)+($E(ZT1,3,4)*60)
. S GT2=($E(ZT2,1,2)*3600)+($E(ZT2,3,4)*60)
;W:SHOW !,"SECONDS: ",GT1," ",GT2
;S %=GT1 D S^%DTC ; FILEMAN TIME
;S GDT1=ZD1_% ; FILEMAN DATE AND TIME
;S %=GT2 D S^%DTC ; FILEMAN TIME
;S GDT2=ZD2_% ; FILEMAN DATE AND TIME
S GDT1=ZD1_"."_ZT1
S GDT2=ZD2_"."_ZT2
W:SHOW !,"FILEMAN: ",GDT1," ",GDT2
N ZH1,ZH2
S ZH1=$$FMTH^XLFDT(GDT1) ; $H FORMAT
S ZH2=$$FMTH^XLFDT(GDT2) ; $H FORMAT
W:SHOW !,"$H: ",ZH1," ",ZH2
N ZSECS,ZMIN
S ZSECS=$$HDIFF^XLFDT(ZH1,ZH2,2) ; DIFFERENCE IN $H
W:SHOW !,"DIFF: ",ZSECS
S ZMIN=ZSECS/60 ; DIFFERENCE IN MINUTES
W:SHOW !,"MIN: ",ZMIN
Q ZMIN
;
END ;end of C0QUTIL

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,336 @@
TYPE: SINGLE PACKAGE TRACK NATIONALLY: YES
NATIONAL PACKAGE: QUALITY MEASURES ALPHA/BETA TESTING: NO
DESCRIPTION:
Summary
=======
This build contains the reminder rules and extracts for use with the
Quality Measures package for reporting for Meaningful use Stage I. It
also installs reminder dialogs for use in populating data for some of the
Outpatient Measures.
Source, Copyright, & Licensing:
===============================
This patch to WorldVistA 2.0 was produced by Sam Habiel on a copy of Dew
Drop and tested on a virgin instance of WV EHR 3-09 patched with PXRM 2.0
patches 12 and 17. The build was produced in July 2012.
Copyright WorldVistA 2012.
Licensed under GPL version 2 or later. Find it here:
http://www.gnu.org/licenses/gpl-2.0.html
Released through VISTA Forum.
Functionality:
==============
This patch installs the following reminder rules and selectively extracts
for these Meaningful Use Stage I measure.
NQF 0024-alt-core_wt-kids
NQF 0013-core-HTN
NQF 0028a-core-tobacco-access
NQF 0028b-core-tobaocc-intervention
NQF 0041-alt-core-flu
NQF 0059-option1-DM-Hbalc
NQF 0061-option3-DM-BP
NQF 0064-option2-DM-LDL
NQF 0495 (Education 1 for Inpatient)
NQF 0497 (Education 2 for Inpatient)
MU Inpatient Stroke Measures (contains labs)
- NQF 0435
- NQF 0436
- NQF 0437
- NQF 0438
- NQF 0439
- NQF 0440
- NQF 0441
MU Inpatient Venous Thombotic Embolism Measures (contains labs)
- NQF 0371
- NQF 0372
- NQF 0373
- NQF 0374
- NQF 0375
- NQF 0376
- NQF 0421-core-adult-weight (contains reminder extracts)
- NQF 0038-alt-core-childImms (contains reminder extracts)
In addition, the following CPRS dialogs are sent in this patch.
- MU NQF0421 BMI DI
- MU NQF0041 INFLUENZA MANAGEMENT DI
- MU NQF0038 IMMUNE MANAGEMENT DI
- MU NQF0028AB MANAGEMENT DI
- MU SMOKING STATUS DI
All of this is installed automatically, except if the labs transported in
the dialog cannot be found, the installer will be prompted to rematch
them.
Package Elements:
=================
This build transports and installs the following REMINDER EXCHANGE
entries:
MU NQF0013 HTN_MK 07/06/2011@15:08:53
MU NQF0024-ALL 07/31/2012@17:49:03
MU NQF0028 TOBACCO_MK 07/06/2011@15:14:49
MU NQF0028AB MANAGEMENT DI 06/08/2011@16:50:31
MU NQF0038 CHILD IMM SMH 07/27/2012@17:48:33
MU NQF0041 FLU_MK 07/06/2011@15:26:59
MU NQF0059_61_64_SMH 07/16/2012@10:46:17
MU NQF0421 ADULT BMI SMH 07/26/2012@11:00:17
MU STROKE 2.3.4.5.6.8.10 SMH 07/18/2012@10:33:53
MU NQF 0495 ED-1 07/17/2012@11:47:55
MU NQF 0497 ED-2 07/17/2012@11:50:23
MU VTE 1.2.3.4.5.6 SMH 07/20/2012@09:48:30
MU CPRS HELP DIS 08/01/2012@18:32:29
Routines:
=========
C0Q1P2 (Transport and KIDS install routine)
The second line of each of these routines now looks like:
;;1.0;QUALITY MEASURES;**2**;July 13, 2112;Build 21
Documentation:
<None besides this KIDS description>
Test Sites:
===========
<None>
Compliance:
===========
This software complies with the VA MUMPS Programming Standards and
Conventions (version 3 April 2007).
Installation Instructions:
==========================
Pre-installation:
Prerequisite patches:
- PXRM*2.0*12 (Download from VA FOIA Site; part of a Multibuild)
- PXRM*2.0*17 (Download from VA FOIA Site; part of a Multibuild)
- TMG*1.0*17 (Download from Trac Server:
https://trac.opensourcevista.net/svn/PGC/tags/TMG-PGC/)
For a successful installation, you need to be sure that the labs that
the Inpatient Measures rely on exist. If not, the Lab ADPAC needs to
create them. These labs are:
- LDL CHOLESTEROL
- PLT
- INR
If these don't exist by the same name as above, the installer will be
asked to rematch them.
Users can remain on the system while this patch is installed.
Install Time - less than 5 minutes
The Pre-installation routine PRE^C0Q1P2 will delete existing Reminder
Exchange entries with the same name.
1. LOAD TRANSPORT GLOBAL
Choose the PackMan message containing this patch and invoke the
INSTALL/CHECK MESSAGE PackMan option to unload the build, or
Use the Load a Distribution option in KIDS to load it from a
host file.
2. START UP KIDS
Start up the Kernel Installation and Distribution System Menu
[XPD MAIN]:
Edits and Distribution ...
Utilities ...
Installation ...
Select Kernel Installation & Distribution System Option: INStallation
---
Load a Distribution
Print Transport Global
Compare Transport Global to Current System
Verify Checksums in Transport Global
Install Package(s)
Restart Install of Package(s)
Unload a Distribution
Backup a Transport Global
Select Installation Option:
3. Select Installation Option:
NOTE: The following are OPTIONAL - (When prompted for the INSTALL
NAME, enter C0Q*1.0*2):
a. Backup a Transport Global - This option will create a backup
message of any routines exported with this patch. It will not
backup any other changes such as DD's or templates.
b. Compare Transport Global to Current System - This option will
allow you to view all changes that will be made when this patch
is installed. It compares all components of this patch
(routines, DD's, templates, etc.).
c. Verify Checksums in Transport Global - This option will allow
you to ensure the integrity of the routines that are in the
transport global.
4. Select Installation Option: Install Package(s)
**This is the step to start the installation of this KIDS patch:
a. Choose the Install Package(s) option to start the patch install
and enter "C0Q*1.0*2" at the INSTALL NAME prompt.
b. When prompted 'Want KIDS to Rebuild Menu Trees Upon Completion of
Install? NO//' answer NO
c. When prompted 'Want KIDS to INHIBIT LOGONs during the install?
NO//' answer NO
d. When prompted 'Want to DISABLE Scheduled Options, Menu Options,
and Protocols? NO//' answer NO
The Post-installation routine POST^C0Q1P2 will install the Reminder
Exchange entries.
Here is an example installation log. It includes lab replacements.
Select INSTALL NAME: C0Q*1.0*2 Loaded from Distribution Loaded
from D
istribution 8/3/12@14:23:27
=> SDFGHJKL; ;Created on Aug 03, 2012@11:14:09
This Distribution was loaded on Aug 03, 2012@14:23:27 with header of
SDFGHJKL; ;Created on Aug 03, 2012@11:14:09
It consisted of the following Install(s):
C0Q*1.0*2
Checking C0Q*1.0*2 for overlap with VOE 1.0 . OK
No overlap found
Checking C0Q*1.0*2 for overlap with VOE 1.1 . OK
No overlap found
Checking C0Q*1.0*2 for overlap with NO HOME 1.0 . OK
No overlap found
Checking Install for Package C0Q*1.0*2
Install Questions for C0Q*1.0*2
Incoming Files:
811.8 REMINDER EXCHANGE (including data)
Note: You already have the 'REMINDER EXCHANGE' File.
I will OVERWRITE your data with mine.
Want KIDS to INHIBIT LOGONs during the install? NO//
Want to DISABLE Scheduled Options, Menu Options, and Protocols? NO//
Enter the Device you want to print the Install messages.
You can queue the install by enter a 'Q' at the device prompt.
Enter a '^' to abort the install.
DEVICE: HOME// PHOME HOME PRINTER
Install Started for C0Q*1.0*2 :
Aug 03, 2012@14:23:33
Build Distribution Date: Aug 03, 2012
Installing Routines:..
Aug 03, 2012@14:23:33
Running Pre-Install Routine: PRE^C0Q1P2.
Installing Data Dictionaries: ..
Aug 03, 2012@14:23:34
Installing Data:
Aug 03, 2012@14:23:35
Running Post-Install Routine: POST^C0Q1P2.
Installing reminder exchange entry MU NQF0024-ALL
Installing reminder exchange entry MU NQF0013 HTN_MK
Installing reminder exchange entry MU NQF0028 TOBACCO_MK
Installing reminder exchange entry MU NQF0041 FLU_MK
Installing reminder exchange entry MU NQF0059_61_64_SMH
Installing reminder exchange entry MU NQF 0495 ED-1
Installing reminder exchange entry MU NQF 0497 ED-2
Installing reminder exchange entry MU STROKE 2.3.4.5.6.8.10 SMH
Installing reminder exchange entry MU VTE 1.2.3.4.5.6 SMH
Finding LT.INR does not exist, what do you want to do?
Select one of the following:
D Delete
P Replace with an existing entry
Q Quit the install
Enter response: P Replace with an existing entry
Select LABORATORY TEST NAME: SAM INR
Finding LT.INR does not exist, what do you want to do?
Select one of the following:
D Delete
P Replace with an existing entry
Q Quit the install
Enter response: P Replace with an existing entry
Select LABORATORY TEST NAME: SAM INR
Installing reminder exchange entry MU NQF0421 ADULT BMI SMH
Installing reminder exchange entry MU NQF0038 CHILD IMM SMH
Installing reminder exchange entry MU CPRS HELP DIS
Updating Routine file......
Updating KIDS files.......
C0Q*1.0*2 Installed.
Aug 03, 2012@14:24:27
Not a VA primary domain
NO Install Message sent
After installation, make sure you install C0Q*1.0*3, which relies on
this patch.
ENVIRONMENT CHECK: DELETE ENV ROUTINE:
PRE-INIT ROUTINE: PRE^C0Q1P2 DELETE PRE-INIT ROUTINE: No
POST-INIT ROUTINE: POST^C0Q1P2 DELETE POST-INIT ROUTINE: No
PRE-TRANSPORT RTN:
UP SEND DATA USER
DATE SEC. COMES SITE RSLV OVER
FILE # FILE NAME DD CODE W/FILE DATA PTRS RIDE
-------------------------------------------------------------------------------
811.8 REMINDER EXCHANGE YES YES YES OVER NO NO
DATA SCREEN: I $$EXFINC^C0Q1P2(Y)
INSTALL QUESTIONS:
Default Rebuild Menu Trees Upon Completion of Install: NO
Default INHIBIT LOGONs during the install: NO
Default DISABLE Scheduled Options, Menu Options, and Protocols: NO
REQUIRED BUILDS: ACTION:
PXRM*2.0*12 Don't install, leave global
PXRM*2.0*17 Don't install, leave global
TMG*1.0*17 Don't install, leave global

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,201 @@
TYPE: SINGLE PACKAGE TRACK NATIONALLY: YES
NATIONAL PACKAGE: QUALITY MEASURES ALPHA/BETA TESTING: NO
Summary
=======
This build contains the Quality Measures file (#1130580001.101) fully
populated with the Reminder Rule Sets and if applicable Reminder Extract
definitions for use with the Quality Measures package for reporting for
Meaningful use Stage I.
Source, Copyright, & Licensing:
===============================
This patch to WorldVistA 2.0 was produced by Sam Habiel on a copy of Dew
Drop and tested on a virgin instance of WV EHR 3-09 patched with PXRM 2.0
patches 12 and 17. The build was produced in July 2012.
Copyright WorldVistA 2012.
Licensed under GPL version 2 or later. Find it here:
http://www.gnu.org/licenses/gpl-2.0.html
Released through VISTA Forum.
Functionality:
==============
This patch is a pure data patch. It only installs reference data in the C0Q
QUALITY MEASURE file (#1130580001.101). It relies on Reminder Package data
(specifically rule sets and extracts) sent in C0Q*1.0*2.
Package Elements:
=================
This build transports entries in the C0Q QUALITY MEASURE file.
Routines:
=========
<None>
Documentation:
<None besides this KIDS description>
Test Sites:
===========
<None>
Compliance:
===========
This software complies with the VA MUMPS Programming Standards and
Conventions (version 3 April 2007).
Installation Instructions:
==========================
Pre-installation:
Prerequisite patches: (both found on the trac server here:
https://trac.opensourcevista.net/svn/qrda/C0Q/trunk/kids/)
C0Q*1.0*2
QUALITY MEASURES 1.0
Users can remain on the system while this patch is installed.
Install Time - less than 1 minute.
1. LOAD TRANSPORT GLOBAL
Choose the PackMan message containing this patch and invoke the
INSTALL/CHECK MESSAGE PackMan option to unload the build, or
Use the Load a Distribution option in KIDS to load it from a
host file.
2. START UP KIDS
Start up the Kernel Installation and Distribution System Menu
[XPD MAIN]:
Edits and Distribution ...
Utilities ...
Installation ...
Select Kernel Installation & Distribution System Option: INStallation
---
Load a Distribution
Print Transport Global
Compare Transport Global to Current System
Verify Checksums in Transport Global
Install Package(s)
Restart Install of Package(s)
Unload a Distribution
Backup a Transport Global
Select Installation Option:
3. Select Installation Option:
NOTE: The following are OPTIONAL - (When prompted for the INSTALL
NAME, enter C0Q*1.0*3):
a. Backup a Transport Global - This option will create a backup
message of any routines exported with this patch. It will not
backup any other changes such as DD's or templates.
b. Compare Transport Global to Current System - This option will
allow you to view all changes that will be made when this patch
is installed. It compares all components of this patch
(routines, DD's, templates, etc.).
c. Verify Checksums in Transport Global - This option will allow
you to ensure the integrity of the routines that are in the
transport global.
4. Select Installation Option: Install Package(s)
**This is the step to start the installation of this KIDS patch:
a. Choose the Install Package(s) option to start the patch install
and enter "C0Q*1.0*3" at the INSTALL NAME prompt.
b. When prompted 'Want KIDS to Rebuild Menu Trees Upon Completion of
Install? NO//' answer NO
c. When prompted 'Want KIDS to INHIBIT LOGONs during the install?
NO//' answer NO
d. When prompted 'Want to DISABLE Scheduled Options, Menu Options,
and Protocols? NO//' answer NO
Here is an example installation log.
Select INSTALL NAME: C0Q*1.0*3 Loaded from Distribution Loaded from Di
stribution 8/3/12@16:32:30
=> SDFGHJKL ;Created on Aug 03, 2012@16:31:28
This Distribution was loaded on Aug 03, 2012@16:32:30 with header of
SDFGHJKL ;Created on Aug 03, 2012@16:31:28
It consisted of the following Install(s):
C0Q*1.0*3
Checking C0Q*1.0*3 for overlap with VOE 1.0 . OK
No overlap found
Checking C0Q*1.0*3 for overlap with VOE 1.1 . OK
No overlap found
Checking C0Q*1.0*3 for overlap with NO HOME 1.0 . OK
No overlap found
Checking Install for Package C0Q*1.0*3
Install Questions for C0Q*1.0*3
Incoming Files:
1130580001.101C0Q QUALITY MEASURE (including data)
Note: You already have the 'C0Q QUALITY MEASURE' File.
I will OVERWRITE your data with mine.
Want KIDS to INHIBIT LOGONs during the install? NO//
Want to DISABLE Scheduled Options, Menu Options, and Protocols? NO//
Enter the Device you want to print the Install messages.
You can queue the install by enter a 'Q' at the device prompt.
Enter a '^' to abort the install.
DEVICE: HOME// PHOME HOME PRINTER
Install Started for C0Q*1.0*3 :
Aug 03, 2012@16:35:24
Build Distribution Date: Aug 03, 2012
Installing Routines:.
Aug 03, 2012@16:35:24
Installing Data Dictionaries: ..
Aug 03, 2012@16:35:24
Installing Data:
Aug 03, 2012@16:35:24
Updating Routine file.....
Updating KIDS files.......
C0Q*1.0*3 Installed.
Aug 03, 2012@16:35:24
Not a VA primary domain
NO Install Message sent
ENVIRONMENT CHECK: DELETE ENV ROUTINE:
PRE-INIT ROUTINE: DELETE PRE-INIT ROUTINE:
POST-INIT ROUTINE: DELETE POST-INIT ROUTINE:
PRE-TRANSPORT RTN:
UP SEND DATA USER
DATE SEC. COMES SITE RSLV OVER
FILE # FILE NAME DD CODE W/FILE DATA PTRS RIDE
-------------------------------------------------------------------------------
1130580001.101C0Q QUALITY MEASURE YES YES YES OVER YES NO
REQUIRED BUILDS: ACTION:
C0Q*1.0*2 Don't install, leave global
QUALITY MEASURES 1.0 Don't install, leave global

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,462 @@
Source, Copyright, & Licensing:
===============================
This patch to WorldVistA 2.0 was produced in Dew Drop
by George Lily on 24 August 2012 and released through VISTA Forum.
(C) 2012 George Lilly
Licensed under GPL 2.
Functionality:
==============
This patch adds the ability to generate modified CCRs
containing a QUALITY measure section that looks like
this:
<QUALITY>
<MEASURE_SET>
<ID>1.3.6.1.4.1.33895.1.1.31.1.2.1</ID>
<MEASURES>
<MEASURE>1.3.6.1.4.1.33895.1.2.16001.1.2.2</MEASURE>
<MEASURE>1.3.6.1.4.1.33895.1.2.16002.1.2.2</MEASURE>
<MEASURE>1.3.6.1.4.1.33895.1.2.16004.1.2.2</MEASURE>
<MEASURE>1.3.6.1.4.1.33895.1.2.16008.1.2.2</MEASURE>
</MEASURES>
</MEASURE_SET>
</QUALITY>
This enables you to create a QRDA document in the C32 format to submit to CMS
containing these measures. The C32 document will be generated by an XSLT
transform from the CCR document.
The driving force behind the creation of this patch, as well as the
documentation of the actual QRDA documents to send to CMS can be found here:
http://qualitynet.org/dcs/ContentServer?c=Page&pagename=QnetPublic%2FPage%2FQnetTier3&cid=1228772217179
Specifically, this sentence:
"One part of meeting the requirements for Stage I Meaningful Use may include
submitting Clinical Quality Measures (CQMs) electronically using the QRDA
Category I file format."
Package Elements:
=================
PACKAGE: C0Q*1.0*4 Aug 24, 2012 12:02 pm PAGE 1
-------------------------------------------------------------------------------
TYPE: SINGLE PACKAGE TRACK NATIONALLY: YES
NATIONAL PACKAGE: QUALITY MEASURES ALPHA/BETA TESTING: NO
DESCRIPTION:
QRDA Support.
ENVIRONMENT CHECK: DELETE ENV ROUTINE:
PRE-INIT ROUTINE: DELETE PRE-INIT ROUTINE:
POST-INIT ROUTINE: DELETE POST-INIT ROUTINE:
PRE-TRANSPORT RTN: TRAN^C0Q1P4
UP SEND DATA USER
DATE SEC. COMES SITE RSLV OVER
FILE # FILE NAME DD CODE W/FILE DATA PTRS RIDE
-------------------------------------------------------------------------------
1130580001.101C0Q QUALITY MEASURE YES YES YES OVER YES NO
1130580001.201C0Q MEASUREMENT SET YES YES YES OVER YES NO
1130580001.401C0Q PARAMETER YES YES NO NO
Partial DD: subDD: 1130580001.401fld: 5.1
fld: 5.2
fld: 5.3
INPUT TEMPLATE: ACTION:
C0Q EDIT INPATIENT PARMS FILE #1130580001.401SEND TO SITE
C0Q EDIT MEASURE SET FILE #1130580001.201 SEND TO SITE
ROUTINE: ACTION:
C0QQRDA SEND TO SITE
OPTION: ACTION:
C0Q EXPORT INPATIENT QRDA CCRS SEND TO SITE
C0Q QRDA MENU SEND TO SITE
C0Q QUALITY MEASUREMENT MENU USE AS LINK FOR MENU ITEMS
INSTALL QUESTIONS:
Default Rebuild Menu Trees Upon Completion of Install: YES
Default INHIBIT LOGONs during the install: NO
Default DISABLE Scheduled Options, Menu Options, and Protocols: NO
REQUIRED BUILDS: ACTION:
CCD/CCR GENERATION UTILITIES 1.2 Don't install, leave global
QUALITY MEASURES 1.0 Don't install, leave global
Summary of Changes to package:
- Population of QRDA TEMPLATE ROOT field in all of the C0Q QUALITY MEASUREs
for Inpatients, as follows:
NAME QRDA TEMPLATE ROOT NUMERATOR RULE SET
----------------------------------------------------------------------------------
MU HOS NQF 0495 2.16.840.1.113883.3.249.11.14.2.1.2.2 MU ED-1 NUMER RS
MU HOS NQF 0497 2.16.840.1.113883.3.249.11.14.3.1.2.2 MU ED-2 NUMER RS
MU HOS NQF 0435 1.3.6.1.4.1.33895.1.2.16001.1.2.2 MU STK-2 NUMER RS
MU HOS NQF 0436 1.3.6.1.4.1.33895.1.2.16002.1.2.2 MU STK-3 NUMER RS
MU HOS NQF 0437 1.3.6.1.4.1.33895.1.2.16003.1.2.2 MU STK-4 NUMER RS
MU HOS NQF 0438 1.3.6.1.4.1.33895.1.2.16004.1.2.2 MU STK-5 NUMER RS
MU HOS NQF 0439 1.3.6.1.4.1.33895.1.2.16005.1.2.2 MU STK-6 NUMER RS
MU HOS NQF 0440 1.3.6.1.4.1.33895.1.2.16007.1.2.2 MU STK-8 NUMER RS
MU HOS NQF 0441 1.3.6.1.4.1.33895.1.2.16008.1.2.2 MU STK-10 NUMER RS
MU HOS NQF 0371 1.3.6.1.4.1.33895.1.2.15971.1.2.2 MU VTE-1 NUMER RS
MU HOS NQF 0372 1.3.6.1.4.1.33895.1.2.15972.1.2.2 MU VTE-2 NUMER RS
MU HOS NQF 0373 1.3.6.1.4.1.33895.1.2.15973.1.2.2 MU VTE-3 NUMER RS
MU HOS NQF 0374 1.3.6.1.4.1.33895.1.2.15974.1.2.2 MU VTE-4 NUMER RS
MU HOS NQF 0375 1.3.6.1.4.1.33895.1.2.15975.1.2.2 MU VTE-5 NUMER RS
MU HOS NQF 0376 1.3.6.1.4.1.33895.1.2.15976.1.2.2 MU VTE-6 NUMER RS
- Change of C0Q MEASUREMENT file name to C0Q MEASUREMENT SET
- Addition of QRDA TEMPLATE ROOT field to C0Q MEASUREMENT SET
- Creation of three Measurement Sets in the C0Q MEASUREMENT SET as follows:
NAME: ED CMS REPORTING MEASURES
QRDA TEMPLATE ROOT: 2.16.840.1.113883.3.249.11.14.1.1.1
BEGIN DATE: JAN 1,2012 END DATE: DEC 13,2012
MEASURE: MU HOS NQF 0495
MEASURE: MU HOS NQF 0497
MU YEAR KEY: MU12
NAME: STK CMS REPORTING MEASURES
QRDA TEMPLATE ROOT: 1.3.6.1.4.1.33895.1.1.31.1.2.1
BEGIN DATE: JAN 1,2012 END DATE: DEC 31,2012
MEASURE: MU HOS NQF 0435
MEASURE: MU HOS NQF 0436
MEASURE: MU HOS NQF 0437
MEASURE: MU HOS NQF 0438
MEASURE: MU HOS NQF 0439
MEASURE: MU HOS NQF 0440
MEASURE: MU HOS NQF 0441
MU YEAR KEY: MU12
NAME: VTE CMS REPORTING MEASURES
QRDA TEMPLATE ROOT: 1.3.6.1.4.1.33895.1.1.32.1.2.1
BEGIN DATE: JAN 1,2012 END DATE: DEC 31,2012
MEASURE: MU HOS NQF 0371
MEASURE: MU HOS NQF 0372
MEASURE: MU HOS NQF 0373
MEASURE: MU HOS NQF 0374
MEASURE: MU HOS NQF 0375
MEASURE: MU HOS NQF 0376
MU YEAR KEY: MU12
- Creation of supporting fields in the C0Q PARAMETER file to drive generation
of the QRDA documents.
- VTE CMS MEASUREMENT SET
- STK CMS MEASUREMENT SET
- ED CMS MEASUREMENT SET
- Modification of existing input templates to support the new fields created.
C0Q EDIT INPATIENT PARMS FILE #1130580001.401
C0Q EDIT MEASURE SET FILE #1130580001.201
- Routine C0QQRDA to drive the generation of the QRDA documents.
- Menu option to call EN^C0QQRDA:
-> C0Q QUALITY MEASUREMENT MENU
Parent: C0Q QRDA MENU
Routine Versioning:
The second line of each of these routines now looks like:
;;1.0;QUALITY MEASURES;**4**;May 21, 2012;Build 28
The following checksums can be checked with CHECK1^XTSUMBLD:
Routine Before After Patch List
------- ----------- ------------ ---------------------------------
C0QQRDA 89943644 **4**
Documentation:
==============
None at this moment.
Test Sites:
===========
None at this moment.
Compliance:
===========
This software complies with the VA MUMPS Programming Standards and
Conventions (version 3 April 2007).
Installation Instructions:
==========================
Install Time - less than 1 minute
1. LOAD TRANSPORT GLOBAL
Choose the PackMan message containing this patch and invoke the
INSTALL/CHECK MESSAGE PackMan option to unload the build.
2. START UP KIDS
Start up the Kernel Installation and Distribution System Menu
[XPD MAIN]:
Edits and Distribution ...
Utilities ...
Installation ...
Select Kernel Installation & Distribution System Option: INStallation
---
Load a Distribution
Print Transport Global
Compare Transport Global to Current System
Verify Checksums in Transport Global
Install Package(s)
Restart Install of Package(s)
Unload a Distribution
Backup a Transport Global
Select Installation Option:
3. Select Installation Option:
NOTE: The following are OPTIONAL - (When prompted for the INSTALL
NAME, enter C0Q*1.0*4):
a. Backup a Transport Global - This option will create a backup
message of any routines exported with this patch. It will not
backup any other changes such as DD's or templates.
b. Compare Transport Global to Current System - This option will
allow you to view all changes that will be made when this patch
is installed. It compares all components of this patch
(routines, DD's, templates, etc.).
c. Verify Checksums in Transport Global - This option will allow
you to ensure the integrity of the routines that are in the
transport global.
4. Select Installation Option: Install Package(s)
**This is the step to start the installation of this KIDS patch:
a. Choose the Install Package(s) option to start the patch install
and enter "C0Q*1.0*4" at the INSTALL NAME prompt.
b. When asked, 'Shall I write over your C0Q MEASUREMENTS File? YES//'
Answer YES. The file is just renamed, that's why KIDS asks you to
overwrite it.
c. When prompted 'Want KIDS to Rebuild Menu Trees Upon Completion of
Install? YES//' answer YES
d. When prompted 'Want KIDS to INHIBIT LOGONs during the install?
NO//' answer NO
e. When prompted 'Want to DISABLE Scheduled Options, Menu Options,
and Protocols? NO//' answer NO
Installation Example:
Select Installation Option: 6 Install Package(s)
Select INSTALL NAME: C0Q*1.0*4 Loaded from Distribution Loaded from D
istribution 8/24/12@10:05
=> INPATIENT CMS QRDA GENERATION SUPPORT ;Created on Aug 02, 2012@10:40:
This Distribution was loaded on Aug 24, 2012@10:05 with header of
INPATIENT CMS QRDA GENERATION SUPPORT ;Created on Aug 02, 2012@10:40:23
It consisted of the following Install(s):
C0Q*1.0*4
Checking C0Q*1.0*4 for overlap with VOE 1.0 .... OK
No overlap found
Checking C0Q*1.0*4 for overlap with VOE 1.1 .... OK
No overlap found
Checking C0Q*1.0*4 for overlap with NO HOME 1.0 .... OK
No overlap found
Checking Install for Package C0Q*1.0*4
Install Questions for C0Q*1.0*4
Incoming Files:
1130580001.101C0Q QUALITY MEASURE (including data)
Note: You already have the 'C0Q QUALITY MEASURE' File.
I will OVERWRITE your data with mine.
1130580001.201C0Q MEASUREMENT SET (including data)
*BUT YOU ALREADY HAVE 'C0Q MEASUREMENTS' AS FILE #1130580001.201!
Shall I write over your C0Q MEASUREMENTS File? YES//
I will OVERWRITE your data with mine.
1130580001.401C0Q PARAMETER (Partial Definition)
Note: You already have the 'C0Q PARAMETER' File.
Want KIDS to Rebuild Menu Trees Upon Completion of Install? YES//
Want KIDS to INHIBIT LOGONs during the install? NO//
Want to DISABLE Scheduled Options, Menu Options, and Protocols? NO//
Enter the Device you want to print the Install messages.
You can queue the install by enter a 'Q' at the device prompt.
Enter a '^' to abort the install.
DEVICE: HOME// PHOME HOME PRINTER
Install Started for C0Q*1.0*4 :
Aug 24, 2012@10:08:54
Build Distribution Date: Aug 02, 2012
Installing Routines:..
Aug 24, 2012@10:08:54
Installing Data Dictionaries: ....
Aug 24, 2012@10:08:55
Installing Data:
Aug 24, 2012@10:08:55
Installing PACKAGE COMPONENTS:
Installing INPUT TEMPLATE...
Installing OPTION....
Aug 24, 2012@10:08:55
Updating Routine file......
Updating KIDS files.......
C0Q*1.0*4 Installed.
Aug 24, 2012@10:08:55
Not a VA primary domain
NO Install Message sent
Call MENU rebuild
Starting Menu Rebuild: Aug 24, 2012@10:08:57
Collecting primary menus in the New Person file...
Primary menus found in the New Person file
------------------------------------------
OPTION NAME MENU TEXT # OF LAST LAST
USERS USED BUILT
EVE Systems Manager Menu 25 08/24/12 08/06/12
XUCORE Core Applications 3 08/14/12 08/06/12
XUSERTOOLS User's Toolbox 3 06/28/11 08/06/12
XMUSER MailMan Menu 1 06/03/11 08/06/12
DG REGISTRATION MENURegistration Menu 1 06/21/11 08/06/12
DGZ REGISTRATION MENU
EHR Registration Menu 39 07/09/12 08/06/12
XUZEVE STARTUP FUNCTIONS 1 11/16/05 08/06/12
Building secondary menu trees....
Merging.... done.
Menu Rebuild Complete: Aug 24, 2012@10:09:01
Brief Usage Instructions:
====================================
Before running the QRDA option, you need to set-up your inpatient parameters.
You need AT LEAST a Parameter Name, an MU Year, and a Parameter Type in order
for the software to pick up the parameter's presence. If you already have it
set-up, you don't need to perform this step. Please note that the software does
a reverse $Order through the MU years and will only pick the latest one.
---
Select SETUP QUALITY REPORTING Option: INP EDIT PARMS
Select C0Q PARAMETER NAME: ?
to exit:
You may enter a new C0Q PARAMETER, if you wish
NAME MUST BE 3-30 CHARACTERS, NOT NUMERIC OR STARTING WITH
PUNCTUATION
Select C0Q PARAMETER NAME: INPATIENT
Are you adding 'INPATIENT' as a new C0Q PARAMETER (the 1ST)? No// Y (Yes)
NAME: INPATIENT//
MEASUREMENT PERIOD KEY: MU12
PARAMETER TYPE: INP INPATIENT
INP MU MEASUREMENT SET:
INP QUALITY MEASUREMENT SET:
VTE CMS MEASUREMENT SET:
STK CMS MEASUREMENT SET:
ED CMS MEASUREMENT SET:
Select SUBSCRIBER:
---
Next, the you can invoke the menu option as follows, but you may not get any
CCRs to generate. The option will run EN^C0QQRDA which will look up the
installed measure sets and try to set-up your parameters correctly. If you
re-named the installed measure sets, this step will fail and you will need to
populate them manually in the parameters.
---
Select QUALITY MEASUREMENT MENU Option: QRDA MENU
Select QRDA MENU Option: EXPORT INPATIENT QRDA MEASURES AS CCRS
Trying to automatically set-up measure sets in parameters
...Set-up complete
This program collects patients from the denominators of the measures
STK, VTE, and ED and outputs modified CCR files to the kernel default
directory (probably /tmp/).
This will take some time to execute.
Which measure set would you like to produce QRDA documents for?
Choose to Run [V]TE Measure Set, [S]TK Measure Set, or
[E]D Measure Set. Or you can choose to run [A]ll of them.
Measure to calculate: (V/S/E/A): VTE
10: VTE CMS REPORTING MEASURES^1.3.6.1.4.1.33895.1.1.32.1.2.1
---
The patient list to generate the CCRs is ultimately taken from the Patient
Lists pointed to from the C0Q QUALITY MEASURE file for each of the measures
being processed in the VTE, ED, or STK Measure Set. At this point of package
development, you must run these measures manually in the reminders package and
then populate the Numerator Patient List field and the Denominator Patient List
field for each of these measures. The software per CMS regs picks up the
patients in the denominator once the measure set is processed.
A successful execution looks like this:
---
Select QRDA MENU Option: EXPORT INPATIENT QRDA MEASURES AS CCRS
This program collects patients from the denominators of the measures
STK, VTE, and ED and outputs modified CCR files to the kernel default
directory (probably /tmp/).
This will take some time to execute.
Which measure set would you like to produce QRDA documents for?
Choose to Run [V]TE Measure Set, [S]TK Measure Set, or
[E]D Measure Set. Or you can choose to run [A]ll of them.
Measure to calculate: (V/S/E/A): V
10: VTE CMS REPORTING MEASURES^1.3.6.1.4.1.33895.1.1.32.1.2.1C0QFDA(1130580001.2
011,"6,10,",3)=33
Prosessing DFN 97
RUNNING D EXTRACT^C0CPROBS(IXML,DFN,OXML)
NULL RESULT FROM LIST^ORQQPL3
RUNNING D EXTRACT^C0CALERT(IXML,DFN,OXML)
RUNNING D EXTRACT^C0CMED(IXML,DFN,OXML)
RUNNING D MAP^C0CIMMU(IXML,DFN,OXML)
NULL RESULT FROM IMMUN^PXRHS03
RUNNING D EXTRACT^C0CVITAL(IXML,DFN,OXML)
VITALS START: T LIMIT: T-360
RUNNING D MAP^C0CLABS(IXML,DFN,OXML)
I MAPPED
VARS:^TMP("C0CCCR",9097,"RESULTS")
DFN:97
LAB LOOKUP FAILED, NO SSN
RUNNING D EXTRACT^C0CPROC(IXML,DFN,OXML)
RUNNING D EXTRACT^C0CENC(IXML,DFN,OXML)
PROCESSING:PATIENT 97
PROCESSING:PROVIDER 8
PROCESSING:SYSTEM 1
1^WROTE FILE: VTE_QRDA_CCR_DFN0000000097.XML TO /tmp/
---

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,472 @@
DHCP Patch Display Page: 1
=============================================================================
Run Date: SEP 17, 2012 Designation: C0Q*1*1 TEST v
Package : QUALITY MEASURES Priority : MANDATORY
Version : 1 Status : UNDER DEVELOPMENT
=============================================================================
Subject: E-Rx MU Measures
Category: ROUTINE
ENHANCEMENT
Description:
===========
Source, Copyright, & Licensing:
===============================
This patch to WorldVistA 2.0 was produced by George Lilly on 14 June 2012
and released through VISTA Forum.
Copyright: Build documentation and C0QMUERX routine (c) George Lilly
2012.
License: Package C0Q has license of GPL 2.0.
Functionality:
==============
DESCRIPTION:
Addition of ePrescribing MU measure and code to support it.
Dependencies:
This build needs C0P*1*4 for the new WebService entry that gets MU
data from New Crop. It's not a technical dependency; the code will
function without it, but it won't perform ERx calculations.
This build requires the base C0Q 1.0 to be installed.
This build performs the following:
Routines:
1. Adds routine C0QMUERX for calculation of ePrescribing stats.
2. Mods routine C0QMU12 to call C0QMUERX for the ERX measure for
Outpatients.
3. Mods routine C0QUPDT to handle the special case of ePrescribing stats.
Also, some checks and quits so that we won't crash if no patient lists
are associated with a measure (general bug fix).
Support Tickets:
<None>
Package Elements:
=================
Data Dictionary:
1. File C0Q PARAMETER has two new indexes (used by ERXCOUNT^C0QUPDT)
AMMS REGULAR
Field: EP MU MEASUREMENT SET (1130580001.401,2)
Description: Indexes the IEN of the Measurement Set. Used so that we can
walk back to a parameter when processing a specific IEN.
You can get the IEN of the measurement set using
$O(^C0Q(401,"AMMS",MSIEN,"")).
1)= S ^C0Q(401,"AMMS",$E(X,1,30),DA)=""
2)= K ^C0Q(401,"AMMS",$E(X,1,30),DA)
3)= USED BY THE CODE. SEE DESCRIPTION.
AQMS REGULAR
Field: EP QUALITY MEASUREMENT SET (1130580001.401,2.1)
Description: Indexes the IEN of the Measurement Set. Used so that we can
walk back to a parameter when processing a specific IEN.
You can get the IEN of the measurement set using
$O(^C0Q(401,"AQMS",MSIEN,"")).
1)= S ^C0Q(401,"AQMS",$E(X,1,30),DA)=""
2)= K ^C0Q(401,"AQMS",$E(X,1,30),DA)
3)= USED BY THE CODE. SEE DESCRIPTION.
2. File C0Q QUALITY MEASURE has a new field, MEASURE TYPE (#4) used by
UPDATE^C0QUPDT
1130580001.101,4MEASURE TYPE 0;5 SET
'P' FOR Performance;
'Q' FOR Quality;
'E' FOR Electronic Prescribing Performance;
LAST EDITED: MAY 30, 2012
HELP-PROMPT: Enter a code P, Q or E
DESCRIPTION: This field designates the measure type. It can
be P, Q or M.
P is for Performance. Performance measures are
MU measures to measure how meaningfully used an
EMR is. An example of a performance measure is
whether allergies are documented in the EMR.
Performance measures reference a Patient List
created by this package.
Q is for Quality Measures. Quality measures are
MU measures to assess how well the patients are
cared for. An example of a quality measure is
whether Hemoglobin A1c Poor Control. Quality
measures reference Patient Lists in the
Reminders package.
E is for Electronic Prescribing. This is a
Performance measure, except that it is handled
differently than the rest. Instead of the
numerators and denominators being lists of
patients as with all the other measurements,
they are a number of prescriptions. That's why
we have a special flag for it. It references a
Patient List created by this package. The
numerator and denominators are stored in
subfiles for each patient.
TECHNICAL DESCR: As of version C0P*1.0*1, the software doesn't
use this field except to check for an
electronic prescribing type (code E).
I anticipate using this field for other
purposes in the future.
DATA:
The entry MU EP ERX for processing ePrescribing stats in C0Q QUALITY
MEASURE is sent to destination sites. This entry has MEASURE TYPE set to
E so that it is processed by the routine UPDATE^C0QUPDT.
UP SEND DATA USER
DATE SEC. COMES SITE RSLV OVER
FILE # FILE NAME DD CODE W/FILE DATA PTRS RIDE
-------------------------------------------------------------------------------
1130580001.101C0Q QUALITY MEASURE YES YES YES OVER NO NO
DATA SCREEN: I $P(^(0),U)="MU EP ERX"
1130580001.401C0Q PARAMETER YES NO NO NO
Partial DD: subDD: 1130580001.401fld: 2
fld: 2.1
INPUT TEMPLATE:
C0Q EDIT MU MEASURE adds the new field MEASURE TYPE mentioned above to
allow editing of measures
INPUT TEMPLATE: ACTION:
C0Q EDIT MU MEASURE FILE #1130580001.101 SEND TO SITE
ENVIRONMENT CHECK: DELETE ENV ROUTINE:
PRE-INIT ROUTINE: DELETE PRE-INIT ROUTINE:
POST-INIT ROUTINE: POST^C0Q1P1 DELETE POST-INIT ROUTINE: No
PRE-TRANSPORT RTN:
ROUTINE: ACTION:
C0QMU12 SEND TO SITE
C0QMUERX SEND TO SITE
C0QUPDT SEND TO SITE
INSTALL QUESTIONS:
Default Rebuild Menu Trees Upon Completion of Install: NO
Default INHIBIT LOGONs during the install: NO
Default DISABLE Scheduled Options, Menu Options, and Protocols: NO
REQUIRED BUILDS: ACTION:
QUALITY MEASURES 1.0 Don't install, leave global
Documentation:
==============
<None at this moment>
Test Sites:
===========
<None at this moment>
Tested by George Lilly on smart2 (dEWDrop) environment
Compliance:
===========
Complies with the SACC. One routine has a code size or 15076,
and fails the code size check.
Installation Instructions:
==========================
Install Time - less than 1 minute
1. LOAD TRANSPORT GLOBAL
Choose the PackMan message containing this patch and invoke the
INSTALL/CHECK MESSAGE PackMan option to unload the build.
2. START UP KIDS
Start up the Kernel Installation and Distribution System Menu
[XPD MAIN]:
Edits and Distribution ...
Utilities ...
Installation ...
Select Kernel Installation & Distribution System Option: INStallation
---
Load a Distribution
Print Transport Global
Compare Transport Global to Current System
Verify Checksums in Transport Global
Install Package(s)
Restart Install of Package(s)
Unload a Distribution
Backup a Transport Global
Select Installation Option:
3. Select Installation Option:
NOTE: The following are OPTIONAL - (When prompted for the INSTALL
NAME, enter C0Q*1.0*1):
a. Backup a Transport Global - This option will create a backup
message of any routines exported with this patch. It will not
backup any other changes such as DD's or templates.
b. Compare Transport Global to Current System - This option will
allow you to view all changes that will be made when this patch
is installed. It compares all components of this patch
(routines, DD's, templates, etc.).
c. Verify Checksums in Transport Global - This option will allow
you to ensure the integrity of the routines that are in the
transport global.
4. Select Installation Option: Install Package(s)
**This is the step to start the installation of this KIDS patch:
a. Choose the Install Package(s) option to start the patch install
and enter "C0Q*1.0*1" at the INSTALL NAME prompt.
b. When prompted 'Want KIDS to Rebuild Menu Trees Upon Completion of
Install? NO//' answer NO
c. When prompted 'Want KIDS to INHIBIT LOGONs during the install?
NO//' answer NO
d. When prompted 'Want to DISABLE Scheduled Options, Menu Options,
and Protocols? NO//' answer NO
The post installation routine POST^C0Q1P1 will perform the following
tasks:
1. Re-index C0P PARAMETERS file fields EP MU MEASUREMENT SET
(1130580001.401,2) and EP QUALITY MEASUREMENT SET (1130580001.401,2.1)
to make the AMMS and AQMS indeces respectively.
Post-installation instructions
==============================
1. If you don't have New Crop eRx installed, there won't be any effects.
The C0Q code will behave like before.
2. If you don't have C0P*1.0*4 installed, again, the C0Q code will behave
as before the patch.
3. Once you install C0P*1.0*4 with this patch (C0Q*1.0*1), the code will
loop through all Outpatients who have an ERx. The actual patients are
determined via your outpatient parameters. If your parameters reference a
clinic location that already has patients with ERxs, you don't need to do
anything to make the code run. It will run automatically; and it's time
consuming; before you run it though, make sure to do #4.
4. In order for you to see a print out of the eRx measures, you
need to add the Measure MU EP ERX to the Measure Set used in the EP MU
MEASUREMENT SET field in your Outpatient Parameters. You must do this
before you run this for the first time.
Example of Set-up:
Select QUALITY MEASUREMENT MENU Option: ?
COPY OVER PATIENT LISTS
ED-1 COMPUTATION
ED-2 COMPUTATION
EP UPDATE MU MEASURES
INP UPDATE MU MEASURES
PQRI MENU ...
PQRI PRINT XML
PRINT C0Q MEASURES
QRDA MENU ...
SETUP QUALITY REPORTING ...
Enter ?? for more options, ??? for brief descriptions, ?OPTION for help
text.
Select QUALITY MEASUREMENT MENU Option: setUP QUALITY REPORTING
Select SETUP QUALITY REPORTING Option: ?
DISPLAY QUALITY MEASURES
EDIT SUPERUSERS
EP EDIT PARMS
INP EDIT PARMS
MEASURE SET EDIT
MU MEASURE EDIT
QUALITY MEASURE EDIT
Enter ?? for more options, ??? for brief descriptions, ?OPTION for help
text.
Select SETUP QUALITY REPORTING Option: ep edit PARMS
Select C0Q PARAMETER NAME: OUTPATIENT
NAME: OUTPATIENT//
MEASUREMENT PERIOD KEY: MU12//
PARAMETER TYPE: OUTPATIENT//
EP MU MEASUREMENT SET: OUTPATIENT MEASURE SET//
EP QUALITY MEASUREMENT SET:
Select CLINIC: DR OFFICE//
PATIENT LIST LABEL:
Select SUBSCRIBER:
Select C0Q PARAMETER NAME:
Select SETUP QUALITY REPORTING Option: measure set EDIT
Select C0Q MEASUREMENT SET NAME: outpaTIENT MEASURE SET
NAME: OUTPATIENT MEASURE SET Replace
BEGIN DATE: JUN 12,2001//
END DATE: MAY 25,2012//
LOCKED:
MU YEAR KEY: MU12//
QRDA TEMPLATE ROOT:
Select MEASURE: MU EP ERX//
MEASURE: MU EP ERX//
NUMERATOR FILTER LIST:
DENOMINATOR FILTER LIST:
Select MEASURE:
Select C0Q MEASUREMENT SET NAME:
Select SETUP QUALITY REPORTING Option:
Select QUALITY MEASUREMENT MENU Option: ?
COPY OVER PATIENT LISTS
ED-1 COMPUTATION
ED-2 COMPUTATION
EP UPDATE MU MEASURES
INP UPDATE MU MEASURES
PQRI MENU ...
PQRI PRINT XML
PRINT C0Q MEASURES
QRDA MENU ...
SETUP QUALITY REPORTING ...
Enter ?? for more options, ??? for brief descriptions, ?OPTION for help
text.
Select QUALITY MEASUREMENT MENU Option: ep updATE MU MEASURES
Sep 16, 2012@86:54:61
Jan 03, 2008@80:85:41
Jan 01, 2008@81:59:42
Nov 25, 2005@86:89:76
Nov 25, 2005@85:87:58
Nov 24, 2005@79:68:87
Aug 01, 2005@91:59:64
Aug 2005@84:91:51
Aug 2005@84:78:82
Jul 28, 2005@88:55:64
Jul 28, 2005@88:46:85
Jul 28, 2005@87:95:55
Jul 27, 2005@87:79:80
Jul 27, 2005@83:83:97
Jul 26, 2005@88:78:96
Jul 26, 2005@88:75:45
Jul 26, 2005@88:58:60
Jul 26, 2005@88:52:62
Jul 26, 2005@88:50:59
Jul 26, 2005@88:49:74
Jul 26, 2005@84:54:55
Jul 24, 2005@91:62:76
Jul 23, 2005@88:98:45
Jul 23, 2005@85:77:89
Jul 23, 2005@83:77:71
Jul 23, 2005@82:82:99
Jul 23, 2005@82:66:61
Jul 22, 2005@83:85:46
Jul 22, 2005@82:82:92
Jul 22, 2005@82:75:99
Jul 21, 2005@89:50:71
Jul 21, 2005@83:53:48
Jul 20, 2005@91:43:44
Jul 20, 2005@87:89:46
Jul 20, 2005@84:60:78
Jul 20, 2005@84:60:71
Jul 19, 2005@89:92:54
Jul 19, 2005@89:55:97
Jul 18, 2005@92:58:51
Jul 18, 2005@91:47:87
Jul 18, 2005@88:67:86
Jul 18, 2005@88:63:92
Jul 18, 2005@86:64:88
Jul 18, 2005@84:56:82
Jul 18, 2005@84:45:52
Jul 17, 2005@82:42:51
Jul 14, 2005@84:00
Jul 07, 2005@86:97
Jul 2005@85:62:77B index passed
4
Calling GETMEDS6 SOAP Web Service Call for 4
Patient 4 Rx 1
DeaClassCode: 0
PharmacyType: 1
PharmacyDetailType: 1
FinalDestinationType: 2
FinalStatusType: 2
Patient 4 Rx 2
DeaClassCode: 0
PharmacyType: 0
Patient 4 Rx 3
DeaClassCode: 0
PharmacyType: 1
PharmacyDetailType: 1
FinalDestinationType: 2
FinalStatusType: 2
Patient 4 Rx 4
DeaClassCode: 0
PharmacyType: 0
IENs ?+14,1,17, ready to file
Saving ERXDEN of 0 for Patient MOUSE,MICKEY (4)
Fileman Data Array
C0QFDA(1130580001.3111,"?+14,1,17,",.01): ERXDEN
C0QFDA(1130580001.3111,"?+14,1,17,",.02): 0
Patient 4 Rx 1
DeaClassCode: 0
PharmacyType: 1
PharmacyDetailType: 1
FinalDestinationType: 2
Patient 4 Rx 2
DeaClassCode: 0
PharmacyType: 0
Patient 4 Rx 3
DeaClassCode: 0
PharmacyType: 1
PharmacyDetailType: 1
FinalDestinationType: 2
Patient 4 Rx 4
DeaClassCode: 0
PharmacyType: 0
IENs ?+14,1,17, ready to file
Saving ERXNUM of 0 for Patient MOUSE,MICKEY (4)
Fileman Data Array
C0QFDA(1130580001.3111,"?+14,1,17,",.01): ERXNUM
C0QFDA(1130580001.3111,"?+14,1,17,",.02): 0
C0QFDA(1130580001.2011,"1,7,",3)=100
Processing E-Prescribing Counts
DFN Denominator Numerator
4 0 0
=== ===
0 0
Routine Information:
====================
The second line of each of these routines now looks like:
;;1.0;QUALITY MEASURES;**[Patch List]**;May 21, 2012;Build 33
The checksums below are new checksums, and
can be checked with CHECK1^XTSUMBLD.
Routine Name: C0Q1P1
Before: n/a After: B541473 **1**
Routine Name: C0QMU12
Before: n/a After:B266254568 **1**
Routine Name: C0QMUERX
Before: n/a After: B83723794 **1**
Routine Name: C0QUPDT
Before: n/a After: B78393601 **1**
=============================================================================
User Information:
Entered By : HABIEL,SAM Date Entered : JUN 11,2012
Completed By: LILLY,GEORGE Date Completed: JUN 14,2012
Released By : Date Released :
=============================================================================

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,216 @@
DHCP Patch Display Page: 1
=============================================================================
Run Date: OCT 18, 2012 Designation: C0Q*1*5 TEST v
Package : QUALITY MEASURES Priority : MANDATORY
Version : 1 Status : UNDER DEVELOPMENT
=============================================================================
Subject: Miscellaneous and necessary bug fixes
Category: ROUTINE
OTHER
Description:
===========
TYPE: SINGLE PACKAGE TRACK NATIONALLY: YES
NATIONAL PACKAGE: QUALITY MEASURES ALPHA/BETA TESTING: NO
DESCRIPTION:
============
Written by Sam Habiel on 17 October 2012 and released through VISTA Forum.
Licensed under package license (currently GPL 2.0)
FUNCTIONALITY:
==============
This build fixes various bugs in the Quality Measurements package
discovered during testing.
1. Empty lists are created in advance for Outpatients. Previously, they
were not created, even though an entry point existed (INITCLST).
2. The Vitals lookup code that calls CPRS code didn't include today.
This was fixed by adding .999999 to today's date.
3. File security (@ sign everywhere) didn't permit normal users to edit
the file. Previous, I defeated the @ sign protection by setting DLAYGO.
However, DLAYGO got killed by Fileman after each edit, which meant that
you can only edit one entry at a time before heading back out and back in
to edit another entry. After discussion with Fileman developers, the
proper way to do this was to not to use DLAYGO but rather remove the @
signs for Read, Write, and Laygo in the Files Definitions.
- File list where protections were changed.
--> C0Q MEASUREMENT SET (1130580001.201)
--> C0Q QUALITY MEASURE (1130580001.101)
--> C0Q PARAMETER (1130580001.401)
- Options which don't use DLAYGO anymore.
--> EDIT SUPERUSERS [C0Q EDIT SUPERUSERS]
--> EP EDIT PARMS [C0Q EDIT OUTPATIENT PARMS]
--> INP EDIT PARMS [C0Q EDIT INP PARMS]
--> MEASURE SET EDIT [C0Q EDIT MEASURE SET]
--> MU MEASURE EDIT [C0Q EDIT MU MEASURE]
--> QUALITY MEASURE EDIT [C0Q EDIT QUALITY MEASURE]
4. The Outpatient Quality Measurement Set which is specified in the
Parameters was being completely ignored. This is fixed.
5. The variable C0QNALT was not being newed in C0QUPDT. It acts as a flag
indicating the type of measure (Performance vs Quality Measure). Since it
was left lying around, a Quality Measure was mistakenly interpreted as a
performance measure, giving you a result of zero, since there is no
data for this Quality Measure.
6. The option that executes the logic for Outpatients C0Q EP UPDATE MU
MEASURES didn't display the time on the dates of the Visits being
processed correctly. This patch fixes this.
SUPPORT TICKETS:
================
None
PACKAGE ELEMENTS:
=================
ENVIRONMENT CHECK: DELETE ENV ROUTINE:
PRE-INIT ROUTINE: DELETE PRE-INIT ROUTINE:
POST-INIT ROUTINE: POST^C0Q1P5 DELETE POST-INIT ROUTINE: No
PRE-TRANSPORT RTN: TRAN^C0Q1P5
UP SEND DATA USER
DATE SEC. COMES SITE RSLV OVER
FILE # FILE NAME DD CODE W/FILE DATA PTRS RIDE
-------------------------------------------------------------------------------
1130580001.101C0Q QUALITY MEASURE YES YES NO
1130580001.201C0Q MEASUREMENT SET YES YES NO
UP SEND DATA USER
DATE SEC. COMES SITE RSLV OVER
FILE # FILE NAME DD CODE W/FILE DATA PTRS RIDE
-------------------------------------------------------------------------------
1130580001.401C0Q PARAMETER YES YES NO
ROUTINE: ACTION:
C0Q1P5 SEND TO SITE
C0QMU12 SEND TO SITE
C0QUPDT SEND TO SITE
OPTION: ACTION:
C0Q EDIT INP PARMS SEND TO SITE
C0Q EDIT MEASURE SET SEND TO SITE
C0Q EDIT MU MEASURE SEND TO SITE
C0Q EDIT OUTPATIENT PARMS SEND TO SITE
C0Q EDIT QUALITY MEASURE SEND TO SITE
C0Q EDIT SUPERUSERS SEND TO SITE
DOCUMENTATION:
==============
http://www.vistapedia.com/index.php/C0Q_Quality_Reporting_1.0
COMPLIANCE:
===========
This software complies with the VA MUMPS Programming Standards and
Conventions (version 3 April 2007), except for the following:
C0QMU12 * * 541 Lines, 18707 Bytes, Checksum: B280797584
S - Routine code exceeds SACC maximum size of 15000 (15513).
Blood Bank Clearance: This software doesn't interact with the Blood Bank module.
Installation Instructions:
==========================
Install Time - less than 1 minute.
1. LOAD TRANSPORT GLOBAL
Choose the PackMan message containing this patch and invoke the
INSTALL/CHECK MESSAGE PackMan option to unload the build.
2. START UP KIDS
Start up the Kernel Installation and Distribution System Menu
[XPD MAIN]:
Edits and Distribution ...
Utilities ...
Installation ...
Select Kernel Installation & Distribution System Option: INStallation
---
Load a Distribution
Print Transport Global
Compare Transport Global to Current System
Verify Checksums in Transport Global
Install Package(s)
Restart Install of Package(s)
Unload a Distribution
Backup a Transport Global
Select Installation Option:
3. Select Installation Option:
NOTE: The following are OPTIONAL - (When prompted for the INSTALL
NAME, enter C0Q*1.0*5):
a. Backup a Transport Global - This option will create a backup
message of any routines exported with this patch. It will not
backup any other changes such as DD's or templates.
b. Compare Transport Global to Current System - This option will
allow you to view all changes that will be made when this patch
is installed. It compares all components of this patch
(routines, DD's, templates, etc.).
c. Verify Checksums in Transport Global - This option will allow
you to ensure the integrity of the routines that are in the
transport global.
4. Select Installation Option: Install Package(s)
**This is the step to start the installation of this KIDS patch:
a. Choose the Install Package(s) option to start the patch install
and enter "C0Q*1.0*5" at the INSTALL NAME prompt. As part of the
Environment Check routine, the message below will display
b. When prompted 'Want KIDS to Rebuild Menu Trees Upon Completion of
Install? NO//' answer NO
c. When prompted 'Want KIDS to INHIBIT LOGONs during the install?
NO//' answer NO
d. When prompted 'Want to DISABLE Scheduled Options, Menu Options,
and Protocols? NO//' answer NO
5. Post installation: No post installation tasks are necessary.
Routine Information:
====================
The second line of each of these routines now looks like:
;;1.0;QUALITY MEASURES;**[Patch List]**;Oct 17, 2012;Build 9
The checksums below are new checksums, and
can be checked with CHECK1^XTSUMBLD.
Routine Name: C0Q1P5
Before: n/a After: B619258 **5**
Routine Name: C0QMU12
Before: n/a After:B280797584 **1,5**
Routine Name: C0QUPDT
Before: n/a After: B78768309 **1,5**
Routine list of preceding patches: 1
=============================================================================
User Information:
Entered By : HABIEL,SAM Date Entered : OCT 18,2012
Completed By: Date Completed:
Released By : Date Released :
=============================================================================

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,244 @@
Build Manifest
TYPE: SINGLE PACKAGE TRACK NATIONALLY: NO
NATIONAL PACKAGE: QUALITY MEASURES ALPHA/BETA TESTING: NO
DESCRIPTION:
The C0Q Quality Reporting Package is a mumps-based addition to VistA for
reporting Meaningful Use and Quality Measurements. The package supports
both inpatient and outpatient reporting, and computes the Meaningful Use
measures from patient records. For Quality Measurements, the reporting
package relies on the VistA Reminders Patient Lists as the source for its
reporting.
Installation and Use instructions can be found here:
http://vistapedia.net/index.php?title=C0Q_Quality_Reporting_1.0
ENVIRONMENT CHECK: DELETE ENV ROUTINE:
PRE-INIT ROUTINE: PRE^C0QKIDS DELETE PRE-INIT ROUTINE: No
POST-INIT ROUTINE: POST^C0QKIDS DELETE POST-INIT ROUTINE: No
PRE-TRANSPORT RTN: TRAN^C0QKIDS
UP SEND DATA USER
DATE SEC. COMES SITE RSLV OVER
FILE # FILE NAME DD CODE W/FILE DATA PTRS RIDE
-------------------------------------------------------------------------------
178.301 C0C XML MISC YES YES YES OVER NO NO
1130580001.101C0Q QUALITY MEASURE YES YES YES REPL NO NO
1130580001.201C0Q MEASUREMENTS YES YES NO
1130580001.301C0Q PATIENT LIST YES YES NO
1130580001.401C0Q PARAMETER YES YES NO
PRINT TEMPLATE: ACTION:
C0Q EP SETUP FILE #1130580001.201 SEND TO SITE
C0Q HOS MEASURES FILE #1130580001.201 SEND TO SITE
C0Q MEASUREMENT REPORT FILE #1130580001.201 SEND TO SITE
C0Q PRINT BY PATIENT FILE #1130580001.201 SEND TO SITE
C0Q PRINT MEASUREMENT SET FILE #1130580001.201SEND TO SITE
C0Q PRINT QUALITY MEASURES FILE #1130580001.101SEND TO SITE
INPUT TEMPLATE: ACTION:
C0Q EDIT INPATIENT PARMS FILE #1130580001.401SEND TO SITE
C0Q EDIT MEASURE SET FILE #1130580001.201 SEND TO SITE
C0Q EDIT MU MEASURE FILE #1130580001.101 SEND TO SITE
C0Q EDIT OUPATIENT PARMS FILE #1130580001.401SEND TO SITE
C0Q EDIT QUALITY MEASURE FILE #1130580001.101SEND TO SITE
C0Q EDIT SUPERUSERS FILE #1130580001.401 SEND TO SITE
C0Q MEASUREMENT SET DEFINE FILE #1130580001.201SEND TO SITE
ROUTINE: ACTION:
C0QERTIM SEND TO SITE
C0QGMRAD SEND TO SITE
C0QGMTSA SEND TO SITE
C0QGMTSG SEND TO SITE
C0QHF SEND TO SITE
C0QIMMUN SEND TO SITE
C0QINIT SEND TO SITE
C0QMAIN SEND TO SITE
C0QMU12 SEND TO SITE
C0QMU121 SEND TO SITE
C0QMU122 SEND TO SITE
C0QNOTES SEND TO SITE
C0QPQRI SEND TO SITE
C0QSET SEND TO SITE
C0QUPDT SEND TO SITE
C0QUTIL SEND TO SITE
OPTION: ACTION:
C0Q BY PATIENT NUMERATOR SEND TO SITE
C0Q COPY PATIENT LISTS SEND TO SITE
C0Q DENOMINATOR PATIENT LIST SEND TO SITE
C0Q DISPLAY QUALITY MEASURES SEND TO SITE
C0Q ED1 COMPUTATION SEND TO SITE
C0Q ED2 COMPUTATION SEND TO SITE
C0Q EDIT INP PARMS SEND TO SITE
C0Q EDIT MEASURE SET SEND TO SITE
C0Q EDIT MU MEASURE SEND TO SITE
C0Q EDIT OUTPATIENT PARMS SEND TO SITE
C0Q EDIT QUALITY MEASURE SEND TO SITE
C0Q EDIT SUPERUSERS SEND TO SITE
C0Q EP UPDATE MU MEASURES SEND TO SITE
C0Q EXPORT CCR BY MEASURE SEND TO SITE
C0Q EXPORT MEASURE SET SEND TO SITE
C0Q INP UPDATE MU MEASURES SEND TO SITE
C0Q LIST MEASURE SET SEND TO SITE
C0Q PQRI MENU SEND TO SITE
C0Q PRINT MEASURES SEND TO SITE
C0Q PRINT PQRI XML SEND TO SITE
C0Q QUALITY MEASUREMENT MENU SEND TO SITE
C0Q SETUP QUALITY REPORTING SEND TO SITE
C0Q UPDATE QUALITY MEASUREMENT SEND TO SITE
INSTALL QUESTIONS:
Default Rebuild Menu Trees Upon Completion of Install: YES
REQUIRED BUILDS: ACTION:
CCD/CCR GENERATION UTILITIES 1.2 Don't install, leave global
Install transcript:
Select Installation Option: 1 Load a Distribution
Enter a Host File: QUALITY_MEASURES_1P0.KID
KIDS Distribution saved on Jul 31, 2012@17:18:02
Comment: QUALITY MEASURES 1.0 T12
This Distribution contains Transport Globals for the following Package(s):
QUALITY MEASURES 1.0
Distribution OK!
Want to Continue with Load? YES//
Loading Distribution...
QUALITY MEASURES 1.0
Use INSTALL NAME: QUALITY MEASURES 1.0 to install this Distribution.
Select Installation Option: 6 Install Package(s)
Select INSTALL NAME: qui ??
Select INSTALL NAME: quaLITY MEASURES 1.0 Loaded from Distribution Loa
ded from Distribution 10/2/12@15:44:27
=> QUALITY MEASURES 1.0 T12 ;Created on Jul 31, 2012@17:18:02
This Distribution was loaded on Oct 02, 2012@15:44:27 with header of
QUALITY MEASURES 1.0 T12 ;Created on Jul 31, 2012@17:18:02
It consisted of the following Install(s):
QUALITY MEASURES 1.0
Checking QUALITY MEASURES 1.0 for overlap with VOE 1.0 ..... OK
No overlap found
Checking QUALITY MEASURES 1.0 for overlap with VOE 1.1 ..... OK
No overlap found
Checking QUALITY MEASURES 1.0 for overlap with NO HOME 1.0 ..... OK
No overlap found
Checking Install for Package QUALITY MEASURES 1.0
Install Questions for QUALITY MEASURES 1.0
Incoming Files:
178.301 C0C XML MISC (including data)
Note: You already have the 'C0C XML MISC' File.
I will OVERWRITE your data with mine.
1130580001.101C0Q QUALITY MEASURE (including data)
1130580001.201C0Q MEASUREMENTS
1130580001.301C0Q PATIENT LIST
1130580001.401C0Q PARAMETER
Want KIDS to Rebuild Menu Trees Upon Completion of Install? YES//
Want KIDS to INHIBIT LOGONs during the install? NO//
Want to DISABLE Scheduled Options, Menu Options, and Protocols? NO//
Enter the Device you want to print the Install messages.
You can queue the install by enter a 'Q' at the device prompt.
Enter a '^' to abort the install.
DEVICE: HOME// phome HOME PRINTER
Install Started for QUALITY MEASURES 1.0 :
Oct 02, 2012@15:44:40
Build Distribution Date: Jul 31, 2012
Installing Routines:..................
Oct 02, 2012@15:44:41
Running Pre-Install Routine: PRE^C0QKIDS.
Installing Data Dictionaries: ......
Oct 02, 2012@15:44:41
Installing Data:
Oct 02, 2012@15:44:41
Installing PACKAGE COMPONENTS:
Installing PRINT TEMPLATE.......
Installing INPUT TEMPLATE........
Installing OPTION........................
Oct 02, 2012@15:44:42
Running Post-Install Routine: POST^C0QKIDS.
Adding data to C0Q MEASUREMENTS
Updating Routine file......
Updating KIDS files.......
QUALITY MEASURES 1.0 Installed.
Oct 02, 2012@15:44:42
NO Install Message sent
Call MENU rebuild
Starting Menu Rebuild: Oct 02, 2012@15:44:44
Collecting primary menus in the New Person file...
Primary menus found in the New Person file
------------------------------------------
OPTION NAME MENU TEXT # OF LAST LAST
USERS USED BUILT
EVE Systems Manager Menu 14 10/02/12 08/31/11
XUCORE Core Applications 2 09/02/05 08/31/11
XMUSER MailMan Menu 1 12/19/05 08/31/11
DGZ REGISTRATION MENU
EHR Registration Menu 40 04/09/12 08/31/11
XUZEVE STARTUP FUNCTIONS 1 11/16/05 08/31/11
Building secondary menu trees....
Merging.... done.
Menu Rebuild Complete: Oct 02, 2012@15:44:46

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,336 @@
TYPE: SINGLE PACKAGE TRACK NATIONALLY: YES
NATIONAL PACKAGE: QUALITY MEASURES ALPHA/BETA TESTING: NO
DESCRIPTION:
Summary
=======
This build contains the reminder rules and extracts for use with the
Quality Measures package for reporting for Meaningful use Stage I. It
also installs reminder dialogs for use in populating data for some of the
Outpatient Measures.
Source, Copyright, & Licensing:
===============================
This patch to WorldVistA 2.0 was produced by Sam Habiel on a copy of Dew
Drop and tested on a virgin instance of WV EHR 3-09 patched with PXRM 2.0
patches 12 and 17. The build was produced in July 2012.
Copyright WorldVistA 2012.
Licensed under GPL version 2 or later. Find it here:
http://www.gnu.org/licenses/gpl-2.0.html
Released through VISTA Forum.
Functionality:
==============
This patch installs the following reminder rules and selectively extracts
for these Meaningful Use Stage I measure.
NQF 0024-alt-core_wt-kids
NQF 0013-core-HTN
NQF 0028a-core-tobacco-access
NQF 0028b-core-tobaocc-intervention
NQF 0041-alt-core-flu
NQF 0059-option1-DM-Hbalc
NQF 0061-option3-DM-BP
NQF 0064-option2-DM-LDL
NQF 0495 (Education 1 for Inpatient)
NQF 0497 (Education 2 for Inpatient)
MU Inpatient Stroke Measures (contains labs)
- NQF 0435
- NQF 0436
- NQF 0437
- NQF 0438
- NQF 0439
- NQF 0440
- NQF 0441
MU Inpatient Venous Thombotic Embolism Measures (contains labs)
- NQF 0371
- NQF 0372
- NQF 0373
- NQF 0374
- NQF 0375
- NQF 0376
- NQF 0421-core-adult-weight (contains reminder extracts)
- NQF 0038-alt-core-childImms (contains reminder extracts)
In addition, the following CPRS dialogs are sent in this patch.
- MU NQF0421 BMI DI
- MU NQF0041 INFLUENZA MANAGEMENT DI
- MU NQF0038 IMMUNE MANAGEMENT DI
- MU NQF0028AB MANAGEMENT DI
- MU SMOKING STATUS DI
All of this is installed automatically, except if the labs transported in
the dialog cannot be found, the installer will be prompted to rematch
them.
Package Elements:
=================
This build transports and installs the following REMINDER EXCHANGE
entries:
MU NQF0013 HTN_MK 07/06/2011@15:08:53
MU NQF0024-ALL 07/31/2012@17:49:03
MU NQF0028 TOBACCO_MK 07/06/2011@15:14:49
MU NQF0028AB MANAGEMENT DI 06/08/2011@16:50:31
MU NQF0038 CHILD IMM SMH 07/27/2012@17:48:33
MU NQF0041 FLU_MK 07/06/2011@15:26:59
MU NQF0059_61_64_SMH 07/16/2012@10:46:17
MU NQF0421 ADULT BMI SMH 07/26/2012@11:00:17
MU STROKE 2.3.4.5.6.8.10 SMH 07/18/2012@10:33:53
MU NQF 0495 ED-1 07/17/2012@11:47:55
MU NQF 0497 ED-2 07/17/2012@11:50:23
MU VTE 1.2.3.4.5.6 SMH 07/20/2012@09:48:30
MU CPRS HELP DIS 08/01/2012@18:32:29
Routines:
=========
C0Q1P2 (Transport and KIDS install routine)
The second line of each of these routines now looks like:
;;1.0;QUALITY MEASURES;**2**;July 13, 2112;Build 21
Documentation:
<None besides this KIDS description>
Test Sites:
===========
<None>
Compliance:
===========
This software complies with the VA MUMPS Programming Standards and
Conventions (version 3 April 2007).
Installation Instructions:
==========================
Pre-installation:
Prerequisite patches:
- PXRM*2.0*12 (Download from VA FOIA Site; part of a Multibuild)
- PXRM*2.0*17 (Download from VA FOIA Site; part of a Multibuild)
- TMG*1.0*17 (Download from Trac Server:
https://trac.opensourcevista.net/svn/PGC/tags/TMG-PGC/)
For a successful installation, you need to be sure that the labs that
the Inpatient Measures rely on exist. If not, the Lab ADPAC needs to
create them. These labs are:
- LDL CHOLESTEROL
- PLT
- INR
If these don't exist by the same name as above, the installer will be
asked to rematch them.
Users can remain on the system while this patch is installed.
Install Time - less than 5 minutes
The Pre-installation routine PRE^C0Q1P2 will delete existing Reminder
Exchange entries with the same name.
1. LOAD TRANSPORT GLOBAL
Choose the PackMan message containing this patch and invoke the
INSTALL/CHECK MESSAGE PackMan option to unload the build, or
Use the Load a Distribution option in KIDS to load it from a
host file.
2. START UP KIDS
Start up the Kernel Installation and Distribution System Menu
[XPD MAIN]:
Edits and Distribution ...
Utilities ...
Installation ...
Select Kernel Installation & Distribution System Option: INStallation
---
Load a Distribution
Print Transport Global
Compare Transport Global to Current System
Verify Checksums in Transport Global
Install Package(s)
Restart Install of Package(s)
Unload a Distribution
Backup a Transport Global
Select Installation Option:
3. Select Installation Option:
NOTE: The following are OPTIONAL - (When prompted for the INSTALL
NAME, enter C0Q*1.0*2):
a. Backup a Transport Global - This option will create a backup
message of any routines exported with this patch. It will not
backup any other changes such as DD's or templates.
b. Compare Transport Global to Current System - This option will
allow you to view all changes that will be made when this patch
is installed. It compares all components of this patch
(routines, DD's, templates, etc.).
c. Verify Checksums in Transport Global - This option will allow
you to ensure the integrity of the routines that are in the
transport global.
4. Select Installation Option: Install Package(s)
**This is the step to start the installation of this KIDS patch:
a. Choose the Install Package(s) option to start the patch install
and enter "C0Q*1.0*2" at the INSTALL NAME prompt.
b. When prompted 'Want KIDS to Rebuild Menu Trees Upon Completion of
Install? NO//' answer NO
c. When prompted 'Want KIDS to INHIBIT LOGONs during the install?
NO//' answer NO
d. When prompted 'Want to DISABLE Scheduled Options, Menu Options,
and Protocols? NO//' answer NO
The Post-installation routine POST^C0Q1P2 will install the Reminder
Exchange entries.
Here is an example installation log. It includes lab replacements.
Select INSTALL NAME: C0Q*1.0*2 Loaded from Distribution Loaded
from D
istribution 8/3/12@14:23:27
=> SDFGHJKL; ;Created on Aug 03, 2012@11:14:09
This Distribution was loaded on Aug 03, 2012@14:23:27 with header of
SDFGHJKL; ;Created on Aug 03, 2012@11:14:09
It consisted of the following Install(s):
C0Q*1.0*2
Checking C0Q*1.0*2 for overlap with VOE 1.0 . OK
No overlap found
Checking C0Q*1.0*2 for overlap with VOE 1.1 . OK
No overlap found
Checking C0Q*1.0*2 for overlap with NO HOME 1.0 . OK
No overlap found
Checking Install for Package C0Q*1.0*2
Install Questions for C0Q*1.0*2
Incoming Files:
811.8 REMINDER EXCHANGE (including data)
Note: You already have the 'REMINDER EXCHANGE' File.
I will OVERWRITE your data with mine.
Want KIDS to INHIBIT LOGONs during the install? NO//
Want to DISABLE Scheduled Options, Menu Options, and Protocols? NO//
Enter the Device you want to print the Install messages.
You can queue the install by enter a 'Q' at the device prompt.
Enter a '^' to abort the install.
DEVICE: HOME// PHOME HOME PRINTER
Install Started for C0Q*1.0*2 :
Aug 03, 2012@14:23:33
Build Distribution Date: Aug 03, 2012
Installing Routines:..
Aug 03, 2012@14:23:33
Running Pre-Install Routine: PRE^C0Q1P2.
Installing Data Dictionaries: ..
Aug 03, 2012@14:23:34
Installing Data:
Aug 03, 2012@14:23:35
Running Post-Install Routine: POST^C0Q1P2.
Installing reminder exchange entry MU NQF0024-ALL
Installing reminder exchange entry MU NQF0013 HTN_MK
Installing reminder exchange entry MU NQF0028 TOBACCO_MK
Installing reminder exchange entry MU NQF0041 FLU_MK
Installing reminder exchange entry MU NQF0059_61_64_SMH
Installing reminder exchange entry MU NQF 0495 ED-1
Installing reminder exchange entry MU NQF 0497 ED-2
Installing reminder exchange entry MU STROKE 2.3.4.5.6.8.10 SMH
Installing reminder exchange entry MU VTE 1.2.3.4.5.6 SMH
Finding LT.INR does not exist, what do you want to do?
Select one of the following:
D Delete
P Replace with an existing entry
Q Quit the install
Enter response: P Replace with an existing entry
Select LABORATORY TEST NAME: SAM INR
Finding LT.INR does not exist, what do you want to do?
Select one of the following:
D Delete
P Replace with an existing entry
Q Quit the install
Enter response: P Replace with an existing entry
Select LABORATORY TEST NAME: SAM INR
Installing reminder exchange entry MU NQF0421 ADULT BMI SMH
Installing reminder exchange entry MU NQF0038 CHILD IMM SMH
Installing reminder exchange entry MU CPRS HELP DIS
Updating Routine file......
Updating KIDS files.......
C0Q*1.0*2 Installed.
Aug 03, 2012@14:24:27
Not a VA primary domain
NO Install Message sent
After installation, make sure you install C0Q*1.0*3, which relies on
this patch.
ENVIRONMENT CHECK: DELETE ENV ROUTINE:
PRE-INIT ROUTINE: PRE^C0Q1P2 DELETE PRE-INIT ROUTINE: No
POST-INIT ROUTINE: POST^C0Q1P2 DELETE POST-INIT ROUTINE: No
PRE-TRANSPORT RTN:
UP SEND DATA USER
DATE SEC. COMES SITE RSLV OVER
FILE # FILE NAME DD CODE W/FILE DATA PTRS RIDE
-------------------------------------------------------------------------------
811.8 REMINDER EXCHANGE YES YES YES OVER NO NO
DATA SCREEN: I $$EXFINC^C0Q1P2(Y)
INSTALL QUESTIONS:
Default Rebuild Menu Trees Upon Completion of Install: NO
Default INHIBIT LOGONs during the install: NO
Default DISABLE Scheduled Options, Menu Options, and Protocols: NO
REQUIRED BUILDS: ACTION:
PXRM*2.0*12 Don't install, leave global
PXRM*2.0*17 Don't install, leave global
TMG*1.0*17 Don't install, leave global

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,201 @@
TYPE: SINGLE PACKAGE TRACK NATIONALLY: YES
NATIONAL PACKAGE: QUALITY MEASURES ALPHA/BETA TESTING: NO
Summary
=======
This build contains the Quality Measures file (#1130580001.101) fully
populated with the Reminder Rule Sets and if applicable Reminder Extract
definitions for use with the Quality Measures package for reporting for
Meaningful use Stage I.
Source, Copyright, & Licensing:
===============================
This patch to WorldVistA 2.0 was produced by Sam Habiel on a copy of Dew
Drop and tested on a virgin instance of WV EHR 3-09 patched with PXRM 2.0
patches 12 and 17. The build was produced in July 2012.
Copyright WorldVistA 2012.
Licensed under GPL version 2 or later. Find it here:
http://www.gnu.org/licenses/gpl-2.0.html
Released through VISTA Forum.
Functionality:
==============
This patch is a pure data patch. It only installs reference data in the C0Q
QUALITY MEASURE file (#1130580001.101). It relies on Reminder Package data
(specifically rule sets and extracts) sent in C0Q*1.0*2.
Package Elements:
=================
This build transports entries in the C0Q QUALITY MEASURE file.
Routines:
=========
<None>
Documentation:
<None besides this KIDS description>
Test Sites:
===========
<None>
Compliance:
===========
This software complies with the VA MUMPS Programming Standards and
Conventions (version 3 April 2007).
Installation Instructions:
==========================
Pre-installation:
Prerequisite patches: (both found on the trac server here:
https://trac.opensourcevista.net/svn/qrda/C0Q/trunk/kids/)
C0Q*1.0*2
QUALITY MEASURES 1.0
Users can remain on the system while this patch is installed.
Install Time - less than 1 minute.
1. LOAD TRANSPORT GLOBAL
Choose the PackMan message containing this patch and invoke the
INSTALL/CHECK MESSAGE PackMan option to unload the build, or
Use the Load a Distribution option in KIDS to load it from a
host file.
2. START UP KIDS
Start up the Kernel Installation and Distribution System Menu
[XPD MAIN]:
Edits and Distribution ...
Utilities ...
Installation ...
Select Kernel Installation & Distribution System Option: INStallation
---
Load a Distribution
Print Transport Global
Compare Transport Global to Current System
Verify Checksums in Transport Global
Install Package(s)
Restart Install of Package(s)
Unload a Distribution
Backup a Transport Global
Select Installation Option:
3. Select Installation Option:
NOTE: The following are OPTIONAL - (When prompted for the INSTALL
NAME, enter C0Q*1.0*3):
a. Backup a Transport Global - This option will create a backup
message of any routines exported with this patch. It will not
backup any other changes such as DD's or templates.
b. Compare Transport Global to Current System - This option will
allow you to view all changes that will be made when this patch
is installed. It compares all components of this patch
(routines, DD's, templates, etc.).
c. Verify Checksums in Transport Global - This option will allow
you to ensure the integrity of the routines that are in the
transport global.
4. Select Installation Option: Install Package(s)
**This is the step to start the installation of this KIDS patch:
a. Choose the Install Package(s) option to start the patch install
and enter "C0Q*1.0*3" at the INSTALL NAME prompt.
b. When prompted 'Want KIDS to Rebuild Menu Trees Upon Completion of
Install? NO//' answer NO
c. When prompted 'Want KIDS to INHIBIT LOGONs during the install?
NO//' answer NO
d. When prompted 'Want to DISABLE Scheduled Options, Menu Options,
and Protocols? NO//' answer NO
Here is an example installation log.
Select INSTALL NAME: C0Q*1.0*3 Loaded from Distribution Loaded from Di
stribution 8/3/12@16:32:30
=> SDFGHJKL ;Created on Aug 03, 2012@16:31:28
This Distribution was loaded on Aug 03, 2012@16:32:30 with header of
SDFGHJKL ;Created on Aug 03, 2012@16:31:28
It consisted of the following Install(s):
C0Q*1.0*3
Checking C0Q*1.0*3 for overlap with VOE 1.0 . OK
No overlap found
Checking C0Q*1.0*3 for overlap with VOE 1.1 . OK
No overlap found
Checking C0Q*1.0*3 for overlap with NO HOME 1.0 . OK
No overlap found
Checking Install for Package C0Q*1.0*3
Install Questions for C0Q*1.0*3
Incoming Files:
1130580001.101C0Q QUALITY MEASURE (including data)
Note: You already have the 'C0Q QUALITY MEASURE' File.
I will OVERWRITE your data with mine.
Want KIDS to INHIBIT LOGONs during the install? NO//
Want to DISABLE Scheduled Options, Menu Options, and Protocols? NO//
Enter the Device you want to print the Install messages.
You can queue the install by enter a 'Q' at the device prompt.
Enter a '^' to abort the install.
DEVICE: HOME// PHOME HOME PRINTER
Install Started for C0Q*1.0*3 :
Aug 03, 2012@16:35:24
Build Distribution Date: Aug 03, 2012
Installing Routines:.
Aug 03, 2012@16:35:24
Installing Data Dictionaries: ..
Aug 03, 2012@16:35:24
Installing Data:
Aug 03, 2012@16:35:24
Updating Routine file.....
Updating KIDS files.......
C0Q*1.0*3 Installed.
Aug 03, 2012@16:35:24
Not a VA primary domain
NO Install Message sent
ENVIRONMENT CHECK: DELETE ENV ROUTINE:
PRE-INIT ROUTINE: DELETE PRE-INIT ROUTINE:
POST-INIT ROUTINE: DELETE POST-INIT ROUTINE:
PRE-TRANSPORT RTN:
UP SEND DATA USER
DATE SEC. COMES SITE RSLV OVER
FILE # FILE NAME DD CODE W/FILE DATA PTRS RIDE
-------------------------------------------------------------------------------
1130580001.101C0Q QUALITY MEASURE YES YES YES OVER YES NO
REQUIRED BUILDS: ACTION:
C0Q*1.0*2 Don't install, leave global
QUALITY MEASURES 1.0 Don't install, leave global

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,462 @@
Source, Copyright, & Licensing:
===============================
This patch to WorldVistA 2.0 was produced in Dew Drop
by George Lily on 24 August 2012 and released through VISTA Forum.
(C) 2012 George Lilly
Licensed under GPL 2.
Functionality:
==============
This patch adds the ability to generate modified CCRs
containing a QUALITY measure section that looks like
this:
<QUALITY>
<MEASURE_SET>
<ID>1.3.6.1.4.1.33895.1.1.31.1.2.1</ID>
<MEASURES>
<MEASURE>1.3.6.1.4.1.33895.1.2.16001.1.2.2</MEASURE>
<MEASURE>1.3.6.1.4.1.33895.1.2.16002.1.2.2</MEASURE>
<MEASURE>1.3.6.1.4.1.33895.1.2.16004.1.2.2</MEASURE>
<MEASURE>1.3.6.1.4.1.33895.1.2.16008.1.2.2</MEASURE>
</MEASURES>
</MEASURE_SET>
</QUALITY>
This enables you to create a QRDA document in the C32 format to submit to CMS
containing these measures. The C32 document will be generated by an XSLT
transform from the CCR document.
The driving force behind the creation of this patch, as well as the
documentation of the actual QRDA documents to send to CMS can be found here:
http://qualitynet.org/dcs/ContentServer?c=Page&pagename=QnetPublic%2FPage%2FQnetTier3&cid=1228772217179
Specifically, this sentence:
"One part of meeting the requirements for Stage I Meaningful Use may include
submitting Clinical Quality Measures (CQMs) electronically using the QRDA
Category I file format."
Package Elements:
=================
PACKAGE: C0Q*1.0*4 Aug 24, 2012 12:02 pm PAGE 1
-------------------------------------------------------------------------------
TYPE: SINGLE PACKAGE TRACK NATIONALLY: YES
NATIONAL PACKAGE: QUALITY MEASURES ALPHA/BETA TESTING: NO
DESCRIPTION:
QRDA Support.
ENVIRONMENT CHECK: DELETE ENV ROUTINE:
PRE-INIT ROUTINE: DELETE PRE-INIT ROUTINE:
POST-INIT ROUTINE: DELETE POST-INIT ROUTINE:
PRE-TRANSPORT RTN: TRAN^C0Q1P4
UP SEND DATA USER
DATE SEC. COMES SITE RSLV OVER
FILE # FILE NAME DD CODE W/FILE DATA PTRS RIDE
-------------------------------------------------------------------------------
1130580001.101C0Q QUALITY MEASURE YES YES YES OVER YES NO
1130580001.201C0Q MEASUREMENT SET YES YES YES OVER YES NO
1130580001.401C0Q PARAMETER YES YES NO NO
Partial DD: subDD: 1130580001.401fld: 5.1
fld: 5.2
fld: 5.3
INPUT TEMPLATE: ACTION:
C0Q EDIT INPATIENT PARMS FILE #1130580001.401SEND TO SITE
C0Q EDIT MEASURE SET FILE #1130580001.201 SEND TO SITE
ROUTINE: ACTION:
C0QQRDA SEND TO SITE
OPTION: ACTION:
C0Q EXPORT INPATIENT QRDA CCRS SEND TO SITE
C0Q QRDA MENU SEND TO SITE
C0Q QUALITY MEASUREMENT MENU USE AS LINK FOR MENU ITEMS
INSTALL QUESTIONS:
Default Rebuild Menu Trees Upon Completion of Install: YES
Default INHIBIT LOGONs during the install: NO
Default DISABLE Scheduled Options, Menu Options, and Protocols: NO
REQUIRED BUILDS: ACTION:
CCD/CCR GENERATION UTILITIES 1.2 Don't install, leave global
QUALITY MEASURES 1.0 Don't install, leave global
Summary of Changes to package:
- Population of QRDA TEMPLATE ROOT field in all of the C0Q QUALITY MEASUREs
for Inpatients, as follows:
NAME QRDA TEMPLATE ROOT NUMERATOR RULE SET
----------------------------------------------------------------------------------
MU HOS NQF 0495 2.16.840.1.113883.3.249.11.14.2.1.2.2 MU ED-1 NUMER RS
MU HOS NQF 0497 2.16.840.1.113883.3.249.11.14.3.1.2.2 MU ED-2 NUMER RS
MU HOS NQF 0435 1.3.6.1.4.1.33895.1.2.16001.1.2.2 MU STK-2 NUMER RS
MU HOS NQF 0436 1.3.6.1.4.1.33895.1.2.16002.1.2.2 MU STK-3 NUMER RS
MU HOS NQF 0437 1.3.6.1.4.1.33895.1.2.16003.1.2.2 MU STK-4 NUMER RS
MU HOS NQF 0438 1.3.6.1.4.1.33895.1.2.16004.1.2.2 MU STK-5 NUMER RS
MU HOS NQF 0439 1.3.6.1.4.1.33895.1.2.16005.1.2.2 MU STK-6 NUMER RS
MU HOS NQF 0440 1.3.6.1.4.1.33895.1.2.16007.1.2.2 MU STK-8 NUMER RS
MU HOS NQF 0441 1.3.6.1.4.1.33895.1.2.16008.1.2.2 MU STK-10 NUMER RS
MU HOS NQF 0371 1.3.6.1.4.1.33895.1.2.15971.1.2.2 MU VTE-1 NUMER RS
MU HOS NQF 0372 1.3.6.1.4.1.33895.1.2.15972.1.2.2 MU VTE-2 NUMER RS
MU HOS NQF 0373 1.3.6.1.4.1.33895.1.2.15973.1.2.2 MU VTE-3 NUMER RS
MU HOS NQF 0374 1.3.6.1.4.1.33895.1.2.15974.1.2.2 MU VTE-4 NUMER RS
MU HOS NQF 0375 1.3.6.1.4.1.33895.1.2.15975.1.2.2 MU VTE-5 NUMER RS
MU HOS NQF 0376 1.3.6.1.4.1.33895.1.2.15976.1.2.2 MU VTE-6 NUMER RS
- Change of C0Q MEASUREMENT file name to C0Q MEASUREMENT SET
- Addition of QRDA TEMPLATE ROOT field to C0Q MEASUREMENT SET
- Creation of three Measurement Sets in the C0Q MEASUREMENT SET as follows:
NAME: ED CMS REPORTING MEASURES
QRDA TEMPLATE ROOT: 2.16.840.1.113883.3.249.11.14.1.1.1
BEGIN DATE: JAN 1,2012 END DATE: DEC 13,2012
MEASURE: MU HOS NQF 0495
MEASURE: MU HOS NQF 0497
MU YEAR KEY: MU12
NAME: STK CMS REPORTING MEASURES
QRDA TEMPLATE ROOT: 1.3.6.1.4.1.33895.1.1.31.1.2.1
BEGIN DATE: JAN 1,2012 END DATE: DEC 31,2012
MEASURE: MU HOS NQF 0435
MEASURE: MU HOS NQF 0436
MEASURE: MU HOS NQF 0437
MEASURE: MU HOS NQF 0438
MEASURE: MU HOS NQF 0439
MEASURE: MU HOS NQF 0440
MEASURE: MU HOS NQF 0441
MU YEAR KEY: MU12
NAME: VTE CMS REPORTING MEASURES
QRDA TEMPLATE ROOT: 1.3.6.1.4.1.33895.1.1.32.1.2.1
BEGIN DATE: JAN 1,2012 END DATE: DEC 31,2012
MEASURE: MU HOS NQF 0371
MEASURE: MU HOS NQF 0372
MEASURE: MU HOS NQF 0373
MEASURE: MU HOS NQF 0374
MEASURE: MU HOS NQF 0375
MEASURE: MU HOS NQF 0376
MU YEAR KEY: MU12
- Creation of supporting fields in the C0Q PARAMETER file to drive generation
of the QRDA documents.
- VTE CMS MEASUREMENT SET
- STK CMS MEASUREMENT SET
- ED CMS MEASUREMENT SET
- Modification of existing input templates to support the new fields created.
C0Q EDIT INPATIENT PARMS FILE #1130580001.401
C0Q EDIT MEASURE SET FILE #1130580001.201
- Routine C0QQRDA to drive the generation of the QRDA documents.
- Menu option to call EN^C0QQRDA:
-> C0Q QUALITY MEASUREMENT MENU
Parent: C0Q QRDA MENU
Routine Versioning:
The second line of each of these routines now looks like:
;;1.0;QUALITY MEASURES;**4**;May 21, 2012;Build 28
The following checksums can be checked with CHECK1^XTSUMBLD:
Routine Before After Patch List
------- ----------- ------------ ---------------------------------
C0QQRDA 89943644 **4**
Documentation:
==============
None at this moment.
Test Sites:
===========
None at this moment.
Compliance:
===========
This software complies with the VA MUMPS Programming Standards and
Conventions (version 3 April 2007).
Installation Instructions:
==========================
Install Time - less than 1 minute
1. LOAD TRANSPORT GLOBAL
Choose the PackMan message containing this patch and invoke the
INSTALL/CHECK MESSAGE PackMan option to unload the build.
2. START UP KIDS
Start up the Kernel Installation and Distribution System Menu
[XPD MAIN]:
Edits and Distribution ...
Utilities ...
Installation ...
Select Kernel Installation & Distribution System Option: INStallation
---
Load a Distribution
Print Transport Global
Compare Transport Global to Current System
Verify Checksums in Transport Global
Install Package(s)
Restart Install of Package(s)
Unload a Distribution
Backup a Transport Global
Select Installation Option:
3. Select Installation Option:
NOTE: The following are OPTIONAL - (When prompted for the INSTALL
NAME, enter C0Q*1.0*4):
a. Backup a Transport Global - This option will create a backup
message of any routines exported with this patch. It will not
backup any other changes such as DD's or templates.
b. Compare Transport Global to Current System - This option will
allow you to view all changes that will be made when this patch
is installed. It compares all components of this patch
(routines, DD's, templates, etc.).
c. Verify Checksums in Transport Global - This option will allow
you to ensure the integrity of the routines that are in the
transport global.
4. Select Installation Option: Install Package(s)
**This is the step to start the installation of this KIDS patch:
a. Choose the Install Package(s) option to start the patch install
and enter "C0Q*1.0*4" at the INSTALL NAME prompt.
b. When asked, 'Shall I write over your C0Q MEASUREMENTS File? YES//'
Answer YES. The file is just renamed, that's why KIDS asks you to
overwrite it.
c. When prompted 'Want KIDS to Rebuild Menu Trees Upon Completion of
Install? YES//' answer YES
d. When prompted 'Want KIDS to INHIBIT LOGONs during the install?
NO//' answer NO
e. When prompted 'Want to DISABLE Scheduled Options, Menu Options,
and Protocols? NO//' answer NO
Installation Example:
Select Installation Option: 6 Install Package(s)
Select INSTALL NAME: C0Q*1.0*4 Loaded from Distribution Loaded from D
istribution 8/24/12@10:05
=> INPATIENT CMS QRDA GENERATION SUPPORT ;Created on Aug 02, 2012@10:40:
This Distribution was loaded on Aug 24, 2012@10:05 with header of
INPATIENT CMS QRDA GENERATION SUPPORT ;Created on Aug 02, 2012@10:40:23
It consisted of the following Install(s):
C0Q*1.0*4
Checking C0Q*1.0*4 for overlap with VOE 1.0 .... OK
No overlap found
Checking C0Q*1.0*4 for overlap with VOE 1.1 .... OK
No overlap found
Checking C0Q*1.0*4 for overlap with NO HOME 1.0 .... OK
No overlap found
Checking Install for Package C0Q*1.0*4
Install Questions for C0Q*1.0*4
Incoming Files:
1130580001.101C0Q QUALITY MEASURE (including data)
Note: You already have the 'C0Q QUALITY MEASURE' File.
I will OVERWRITE your data with mine.
1130580001.201C0Q MEASUREMENT SET (including data)
*BUT YOU ALREADY HAVE 'C0Q MEASUREMENTS' AS FILE #1130580001.201!
Shall I write over your C0Q MEASUREMENTS File? YES//
I will OVERWRITE your data with mine.
1130580001.401C0Q PARAMETER (Partial Definition)
Note: You already have the 'C0Q PARAMETER' File.
Want KIDS to Rebuild Menu Trees Upon Completion of Install? YES//
Want KIDS to INHIBIT LOGONs during the install? NO//
Want to DISABLE Scheduled Options, Menu Options, and Protocols? NO//
Enter the Device you want to print the Install messages.
You can queue the install by enter a 'Q' at the device prompt.
Enter a '^' to abort the install.
DEVICE: HOME// PHOME HOME PRINTER
Install Started for C0Q*1.0*4 :
Aug 24, 2012@10:08:54
Build Distribution Date: Aug 02, 2012
Installing Routines:..
Aug 24, 2012@10:08:54
Installing Data Dictionaries: ....
Aug 24, 2012@10:08:55
Installing Data:
Aug 24, 2012@10:08:55
Installing PACKAGE COMPONENTS:
Installing INPUT TEMPLATE...
Installing OPTION....
Aug 24, 2012@10:08:55
Updating Routine file......
Updating KIDS files.......
C0Q*1.0*4 Installed.
Aug 24, 2012@10:08:55
Not a VA primary domain
NO Install Message sent
Call MENU rebuild
Starting Menu Rebuild: Aug 24, 2012@10:08:57
Collecting primary menus in the New Person file...
Primary menus found in the New Person file
------------------------------------------
OPTION NAME MENU TEXT # OF LAST LAST
USERS USED BUILT
EVE Systems Manager Menu 25 08/24/12 08/06/12
XUCORE Core Applications 3 08/14/12 08/06/12
XUSERTOOLS User's Toolbox 3 06/28/11 08/06/12
XMUSER MailMan Menu 1 06/03/11 08/06/12
DG REGISTRATION MENURegistration Menu 1 06/21/11 08/06/12
DGZ REGISTRATION MENU
EHR Registration Menu 39 07/09/12 08/06/12
XUZEVE STARTUP FUNCTIONS 1 11/16/05 08/06/12
Building secondary menu trees....
Merging.... done.
Menu Rebuild Complete: Aug 24, 2012@10:09:01
Brief Usage Instructions:
====================================
Before running the QRDA option, you need to set-up your inpatient parameters.
You need AT LEAST a Parameter Name, an MU Year, and a Parameter Type in order
for the software to pick up the parameter's presence. If you already have it
set-up, you don't need to perform this step. Please note that the software does
a reverse $Order through the MU years and will only pick the latest one.
---
Select SETUP QUALITY REPORTING Option: INP EDIT PARMS
Select C0Q PARAMETER NAME: ?
to exit:
You may enter a new C0Q PARAMETER, if you wish
NAME MUST BE 3-30 CHARACTERS, NOT NUMERIC OR STARTING WITH
PUNCTUATION
Select C0Q PARAMETER NAME: INPATIENT
Are you adding 'INPATIENT' as a new C0Q PARAMETER (the 1ST)? No// Y (Yes)
NAME: INPATIENT//
MEASUREMENT PERIOD KEY: MU12
PARAMETER TYPE: INP INPATIENT
INP MU MEASUREMENT SET:
INP QUALITY MEASUREMENT SET:
VTE CMS MEASUREMENT SET:
STK CMS MEASUREMENT SET:
ED CMS MEASUREMENT SET:
Select SUBSCRIBER:
---
Next, the you can invoke the menu option as follows, but you may not get any
CCRs to generate. The option will run EN^C0QQRDA which will look up the
installed measure sets and try to set-up your parameters correctly. If you
re-named the installed measure sets, this step will fail and you will need to
populate them manually in the parameters.
---
Select QUALITY MEASUREMENT MENU Option: QRDA MENU
Select QRDA MENU Option: EXPORT INPATIENT QRDA MEASURES AS CCRS
Trying to automatically set-up measure sets in parameters
...Set-up complete
This program collects patients from the denominators of the measures
STK, VTE, and ED and outputs modified CCR files to the kernel default
directory (probably /tmp/).
This will take some time to execute.
Which measure set would you like to produce QRDA documents for?
Choose to Run [V]TE Measure Set, [S]TK Measure Set, or
[E]D Measure Set. Or you can choose to run [A]ll of them.
Measure to calculate: (V/S/E/A): VTE
10: VTE CMS REPORTING MEASURES^1.3.6.1.4.1.33895.1.1.32.1.2.1
---
The patient list to generate the CCRs is ultimately taken from the Patient
Lists pointed to from the C0Q QUALITY MEASURE file for each of the measures
being processed in the VTE, ED, or STK Measure Set. At this point of package
development, you must run these measures manually in the reminders package and
then populate the Numerator Patient List field and the Denominator Patient List
field for each of these measures. The software per CMS regs picks up the
patients in the denominator once the measure set is processed.
A successful execution looks like this:
---
Select QRDA MENU Option: EXPORT INPATIENT QRDA MEASURES AS CCRS
This program collects patients from the denominators of the measures
STK, VTE, and ED and outputs modified CCR files to the kernel default
directory (probably /tmp/).
This will take some time to execute.
Which measure set would you like to produce QRDA documents for?
Choose to Run [V]TE Measure Set, [S]TK Measure Set, or
[E]D Measure Set. Or you can choose to run [A]ll of them.
Measure to calculate: (V/S/E/A): V
10: VTE CMS REPORTING MEASURES^1.3.6.1.4.1.33895.1.1.32.1.2.1C0QFDA(1130580001.2
011,"6,10,",3)=33
Prosessing DFN 97
RUNNING D EXTRACT^C0CPROBS(IXML,DFN,OXML)
NULL RESULT FROM LIST^ORQQPL3
RUNNING D EXTRACT^C0CALERT(IXML,DFN,OXML)
RUNNING D EXTRACT^C0CMED(IXML,DFN,OXML)
RUNNING D MAP^C0CIMMU(IXML,DFN,OXML)
NULL RESULT FROM IMMUN^PXRHS03
RUNNING D EXTRACT^C0CVITAL(IXML,DFN,OXML)
VITALS START: T LIMIT: T-360
RUNNING D MAP^C0CLABS(IXML,DFN,OXML)
I MAPPED
VARS:^TMP("C0CCCR",9097,"RESULTS")
DFN:97
LAB LOOKUP FAILED, NO SSN
RUNNING D EXTRACT^C0CPROC(IXML,DFN,OXML)
RUNNING D EXTRACT^C0CENC(IXML,DFN,OXML)
PROCESSING:PATIENT 97
PROCESSING:PROVIDER 8
PROCESSING:SYSTEM 1
1^WROTE FILE: VTE_QRDA_CCR_DFN0000000097.XML TO /tmp/
---

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,472 @@
DHCP Patch Display Page: 1
=============================================================================
Run Date: SEP 17, 2012 Designation: C0Q*1*1 TEST v
Package : QUALITY MEASURES Priority : MANDATORY
Version : 1 Status : UNDER DEVELOPMENT
=============================================================================
Subject: E-Rx MU Measures
Category: ROUTINE
ENHANCEMENT
Description:
===========
Source, Copyright, & Licensing:
===============================
This patch to WorldVistA 2.0 was produced by George Lilly on 14 June 2012
and released through VISTA Forum.
Copyright: Build documentation and C0QMUERX routine (c) George Lilly
2012.
License: Package C0Q has license of GPL 2.0.
Functionality:
==============
DESCRIPTION:
Addition of ePrescribing MU measure and code to support it.
Dependencies:
This build needs C0P*1*4 for the new WebService entry that gets MU
data from New Crop. It's not a technical dependency; the code will
function without it, but it won't perform ERx calculations.
This build requires the base C0Q 1.0 to be installed.
This build performs the following:
Routines:
1. Adds routine C0QMUERX for calculation of ePrescribing stats.
2. Mods routine C0QMU12 to call C0QMUERX for the ERX measure for
Outpatients.
3. Mods routine C0QUPDT to handle the special case of ePrescribing stats.
Also, some checks and quits so that we won't crash if no patient lists
are associated with a measure (general bug fix).
Support Tickets:
<None>
Package Elements:
=================
Data Dictionary:
1. File C0Q PARAMETER has two new indexes (used by ERXCOUNT^C0QUPDT)
AMMS REGULAR
Field: EP MU MEASUREMENT SET (1130580001.401,2)
Description: Indexes the IEN of the Measurement Set. Used so that we can
walk back to a parameter when processing a specific IEN.
You can get the IEN of the measurement set using
$O(^C0Q(401,"AMMS",MSIEN,"")).
1)= S ^C0Q(401,"AMMS",$E(X,1,30),DA)=""
2)= K ^C0Q(401,"AMMS",$E(X,1,30),DA)
3)= USED BY THE CODE. SEE DESCRIPTION.
AQMS REGULAR
Field: EP QUALITY MEASUREMENT SET (1130580001.401,2.1)
Description: Indexes the IEN of the Measurement Set. Used so that we can
walk back to a parameter when processing a specific IEN.
You can get the IEN of the measurement set using
$O(^C0Q(401,"AQMS",MSIEN,"")).
1)= S ^C0Q(401,"AQMS",$E(X,1,30),DA)=""
2)= K ^C0Q(401,"AQMS",$E(X,1,30),DA)
3)= USED BY THE CODE. SEE DESCRIPTION.
2. File C0Q QUALITY MEASURE has a new field, MEASURE TYPE (#4) used by
UPDATE^C0QUPDT
1130580001.101,4MEASURE TYPE 0;5 SET
'P' FOR Performance;
'Q' FOR Quality;
'E' FOR Electronic Prescribing Performance;
LAST EDITED: MAY 30, 2012
HELP-PROMPT: Enter a code P, Q or E
DESCRIPTION: This field designates the measure type. It can
be P, Q or M.
P is for Performance. Performance measures are
MU measures to measure how meaningfully used an
EMR is. An example of a performance measure is
whether allergies are documented in the EMR.
Performance measures reference a Patient List
created by this package.
Q is for Quality Measures. Quality measures are
MU measures to assess how well the patients are
cared for. An example of a quality measure is
whether Hemoglobin A1c Poor Control. Quality
measures reference Patient Lists in the
Reminders package.
E is for Electronic Prescribing. This is a
Performance measure, except that it is handled
differently than the rest. Instead of the
numerators and denominators being lists of
patients as with all the other measurements,
they are a number of prescriptions. That's why
we have a special flag for it. It references a
Patient List created by this package. The
numerator and denominators are stored in
subfiles for each patient.
TECHNICAL DESCR: As of version C0P*1.0*1, the software doesn't
use this field except to check for an
electronic prescribing type (code E).
I anticipate using this field for other
purposes in the future.
DATA:
The entry MU EP ERX for processing ePrescribing stats in C0Q QUALITY
MEASURE is sent to destination sites. This entry has MEASURE TYPE set to
E so that it is processed by the routine UPDATE^C0QUPDT.
UP SEND DATA USER
DATE SEC. COMES SITE RSLV OVER
FILE # FILE NAME DD CODE W/FILE DATA PTRS RIDE
-------------------------------------------------------------------------------
1130580001.101C0Q QUALITY MEASURE YES YES YES OVER NO NO
DATA SCREEN: I $P(^(0),U)="MU EP ERX"
1130580001.401C0Q PARAMETER YES NO NO NO
Partial DD: subDD: 1130580001.401fld: 2
fld: 2.1
INPUT TEMPLATE:
C0Q EDIT MU MEASURE adds the new field MEASURE TYPE mentioned above to
allow editing of measures
INPUT TEMPLATE: ACTION:
C0Q EDIT MU MEASURE FILE #1130580001.101 SEND TO SITE
ENVIRONMENT CHECK: DELETE ENV ROUTINE:
PRE-INIT ROUTINE: DELETE PRE-INIT ROUTINE:
POST-INIT ROUTINE: POST^C0Q1P1 DELETE POST-INIT ROUTINE: No
PRE-TRANSPORT RTN:
ROUTINE: ACTION:
C0QMU12 SEND TO SITE
C0QMUERX SEND TO SITE
C0QUPDT SEND TO SITE
INSTALL QUESTIONS:
Default Rebuild Menu Trees Upon Completion of Install: NO
Default INHIBIT LOGONs during the install: NO
Default DISABLE Scheduled Options, Menu Options, and Protocols: NO
REQUIRED BUILDS: ACTION:
QUALITY MEASURES 1.0 Don't install, leave global
Documentation:
==============
<None at this moment>
Test Sites:
===========
<None at this moment>
Tested by George Lilly on smart2 (dEWDrop) environment
Compliance:
===========
Complies with the SACC. One routine has a code size or 15076,
and fails the code size check.
Installation Instructions:
==========================
Install Time - less than 1 minute
1. LOAD TRANSPORT GLOBAL
Choose the PackMan message containing this patch and invoke the
INSTALL/CHECK MESSAGE PackMan option to unload the build.
2. START UP KIDS
Start up the Kernel Installation and Distribution System Menu
[XPD MAIN]:
Edits and Distribution ...
Utilities ...
Installation ...
Select Kernel Installation & Distribution System Option: INStallation
---
Load a Distribution
Print Transport Global
Compare Transport Global to Current System
Verify Checksums in Transport Global
Install Package(s)
Restart Install of Package(s)
Unload a Distribution
Backup a Transport Global
Select Installation Option:
3. Select Installation Option:
NOTE: The following are OPTIONAL - (When prompted for the INSTALL
NAME, enter C0Q*1.0*1):
a. Backup a Transport Global - This option will create a backup
message of any routines exported with this patch. It will not
backup any other changes such as DD's or templates.
b. Compare Transport Global to Current System - This option will
allow you to view all changes that will be made when this patch
is installed. It compares all components of this patch
(routines, DD's, templates, etc.).
c. Verify Checksums in Transport Global - This option will allow
you to ensure the integrity of the routines that are in the
transport global.
4. Select Installation Option: Install Package(s)
**This is the step to start the installation of this KIDS patch:
a. Choose the Install Package(s) option to start the patch install
and enter "C0Q*1.0*1" at the INSTALL NAME prompt.
b. When prompted 'Want KIDS to Rebuild Menu Trees Upon Completion of
Install? NO//' answer NO
c. When prompted 'Want KIDS to INHIBIT LOGONs during the install?
NO//' answer NO
d. When prompted 'Want to DISABLE Scheduled Options, Menu Options,
and Protocols? NO//' answer NO
The post installation routine POST^C0Q1P1 will perform the following
tasks:
1. Re-index C0P PARAMETERS file fields EP MU MEASUREMENT SET
(1130580001.401,2) and EP QUALITY MEASUREMENT SET (1130580001.401,2.1)
to make the AMMS and AQMS indeces respectively.
Post-installation instructions
==============================
1. If you don't have New Crop eRx installed, there won't be any effects.
The C0Q code will behave like before.
2. If you don't have C0P*1.0*4 installed, again, the C0Q code will behave
as before the patch.
3. Once you install C0P*1.0*4 with this patch (C0Q*1.0*1), the code will
loop through all Outpatients who have an ERx. The actual patients are
determined via your outpatient parameters. If your parameters reference a
clinic location that already has patients with ERxs, you don't need to do
anything to make the code run. It will run automatically; and it's time
consuming; before you run it though, make sure to do #4.
4. In order for you to see a print out of the eRx measures, you
need to add the Measure MU EP ERX to the Measure Set used in the EP MU
MEASUREMENT SET field in your Outpatient Parameters. You must do this
before you run this for the first time.
Example of Set-up:
Select QUALITY MEASUREMENT MENU Option: ?
COPY OVER PATIENT LISTS
ED-1 COMPUTATION
ED-2 COMPUTATION
EP UPDATE MU MEASURES
INP UPDATE MU MEASURES
PQRI MENU ...
PQRI PRINT XML
PRINT C0Q MEASURES
QRDA MENU ...
SETUP QUALITY REPORTING ...
Enter ?? for more options, ??? for brief descriptions, ?OPTION for help
text.
Select QUALITY MEASUREMENT MENU Option: setUP QUALITY REPORTING
Select SETUP QUALITY REPORTING Option: ?
DISPLAY QUALITY MEASURES
EDIT SUPERUSERS
EP EDIT PARMS
INP EDIT PARMS
MEASURE SET EDIT
MU MEASURE EDIT
QUALITY MEASURE EDIT
Enter ?? for more options, ??? for brief descriptions, ?OPTION for help
text.
Select SETUP QUALITY REPORTING Option: ep edit PARMS
Select C0Q PARAMETER NAME: OUTPATIENT
NAME: OUTPATIENT//
MEASUREMENT PERIOD KEY: MU12//
PARAMETER TYPE: OUTPATIENT//
EP MU MEASUREMENT SET: OUTPATIENT MEASURE SET//
EP QUALITY MEASUREMENT SET:
Select CLINIC: DR OFFICE//
PATIENT LIST LABEL:
Select SUBSCRIBER:
Select C0Q PARAMETER NAME:
Select SETUP QUALITY REPORTING Option: measure set EDIT
Select C0Q MEASUREMENT SET NAME: outpaTIENT MEASURE SET
NAME: OUTPATIENT MEASURE SET Replace
BEGIN DATE: JUN 12,2001//
END DATE: MAY 25,2012//
LOCKED:
MU YEAR KEY: MU12//
QRDA TEMPLATE ROOT:
Select MEASURE: MU EP ERX//
MEASURE: MU EP ERX//
NUMERATOR FILTER LIST:
DENOMINATOR FILTER LIST:
Select MEASURE:
Select C0Q MEASUREMENT SET NAME:
Select SETUP QUALITY REPORTING Option:
Select QUALITY MEASUREMENT MENU Option: ?
COPY OVER PATIENT LISTS
ED-1 COMPUTATION
ED-2 COMPUTATION
EP UPDATE MU MEASURES
INP UPDATE MU MEASURES
PQRI MENU ...
PQRI PRINT XML
PRINT C0Q MEASURES
QRDA MENU ...
SETUP QUALITY REPORTING ...
Enter ?? for more options, ??? for brief descriptions, ?OPTION for help
text.
Select QUALITY MEASUREMENT MENU Option: ep updATE MU MEASURES
Sep 16, 2012@86:54:61
Jan 03, 2008@80:85:41
Jan 01, 2008@81:59:42
Nov 25, 2005@86:89:76
Nov 25, 2005@85:87:58
Nov 24, 2005@79:68:87
Aug 01, 2005@91:59:64
Aug 2005@84:91:51
Aug 2005@84:78:82
Jul 28, 2005@88:55:64
Jul 28, 2005@88:46:85
Jul 28, 2005@87:95:55
Jul 27, 2005@87:79:80
Jul 27, 2005@83:83:97
Jul 26, 2005@88:78:96
Jul 26, 2005@88:75:45
Jul 26, 2005@88:58:60
Jul 26, 2005@88:52:62
Jul 26, 2005@88:50:59
Jul 26, 2005@88:49:74
Jul 26, 2005@84:54:55
Jul 24, 2005@91:62:76
Jul 23, 2005@88:98:45
Jul 23, 2005@85:77:89
Jul 23, 2005@83:77:71
Jul 23, 2005@82:82:99
Jul 23, 2005@82:66:61
Jul 22, 2005@83:85:46
Jul 22, 2005@82:82:92
Jul 22, 2005@82:75:99
Jul 21, 2005@89:50:71
Jul 21, 2005@83:53:48
Jul 20, 2005@91:43:44
Jul 20, 2005@87:89:46
Jul 20, 2005@84:60:78
Jul 20, 2005@84:60:71
Jul 19, 2005@89:92:54
Jul 19, 2005@89:55:97
Jul 18, 2005@92:58:51
Jul 18, 2005@91:47:87
Jul 18, 2005@88:67:86
Jul 18, 2005@88:63:92
Jul 18, 2005@86:64:88
Jul 18, 2005@84:56:82
Jul 18, 2005@84:45:52
Jul 17, 2005@82:42:51
Jul 14, 2005@84:00
Jul 07, 2005@86:97
Jul 2005@85:62:77B index passed
4
Calling GETMEDS6 SOAP Web Service Call for 4
Patient 4 Rx 1
DeaClassCode: 0
PharmacyType: 1
PharmacyDetailType: 1
FinalDestinationType: 2
FinalStatusType: 2
Patient 4 Rx 2
DeaClassCode: 0
PharmacyType: 0
Patient 4 Rx 3
DeaClassCode: 0
PharmacyType: 1
PharmacyDetailType: 1
FinalDestinationType: 2
FinalStatusType: 2
Patient 4 Rx 4
DeaClassCode: 0
PharmacyType: 0
IENs ?+14,1,17, ready to file
Saving ERXDEN of 0 for Patient MOUSE,MICKEY (4)
Fileman Data Array
C0QFDA(1130580001.3111,"?+14,1,17,",.01): ERXDEN
C0QFDA(1130580001.3111,"?+14,1,17,",.02): 0
Patient 4 Rx 1
DeaClassCode: 0
PharmacyType: 1
PharmacyDetailType: 1
FinalDestinationType: 2
Patient 4 Rx 2
DeaClassCode: 0
PharmacyType: 0
Patient 4 Rx 3
DeaClassCode: 0
PharmacyType: 1
PharmacyDetailType: 1
FinalDestinationType: 2
Patient 4 Rx 4
DeaClassCode: 0
PharmacyType: 0
IENs ?+14,1,17, ready to file
Saving ERXNUM of 0 for Patient MOUSE,MICKEY (4)
Fileman Data Array
C0QFDA(1130580001.3111,"?+14,1,17,",.01): ERXNUM
C0QFDA(1130580001.3111,"?+14,1,17,",.02): 0
C0QFDA(1130580001.2011,"1,7,",3)=100
Processing E-Prescribing Counts
DFN Denominator Numerator
4 0 0
=== ===
0 0
Routine Information:
====================
The second line of each of these routines now looks like:
;;1.0;QUALITY MEASURES;**[Patch List]**;May 21, 2012;Build 33
The checksums below are new checksums, and
can be checked with CHECK1^XTSUMBLD.
Routine Name: C0Q1P1
Before: n/a After: B541473 **1**
Routine Name: C0QMU12
Before: n/a After:B266254568 **1**
Routine Name: C0QMUERX
Before: n/a After: B83723794 **1**
Routine Name: C0QUPDT
Before: n/a After: B78393601 **1**
=============================================================================
User Information:
Entered By : HABIEL,SAM Date Entered : JUN 11,2012
Completed By: LILLY,GEORGE Date Completed: JUN 14,2012
Released By : Date Released :
=============================================================================

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,216 @@
DHCP Patch Display Page: 1
=============================================================================
Run Date: OCT 18, 2012 Designation: C0Q*1*5 TEST v
Package : QUALITY MEASURES Priority : MANDATORY
Version : 1 Status : UNDER DEVELOPMENT
=============================================================================
Subject: Miscellaneous and necessary bug fixes
Category: ROUTINE
OTHER
Description:
===========
TYPE: SINGLE PACKAGE TRACK NATIONALLY: YES
NATIONAL PACKAGE: QUALITY MEASURES ALPHA/BETA TESTING: NO
DESCRIPTION:
============
Written by Sam Habiel on 17 October 2012 and released through VISTA Forum.
Licensed under package license (currently GPL 2.0)
FUNCTIONALITY:
==============
This build fixes various bugs in the Quality Measurements package
discovered during testing.
1. Empty lists are created in advance for Outpatients. Previously, they
were not created, even though an entry point existed (INITCLST).
2. The Vitals lookup code that calls CPRS code didn't include today.
This was fixed by adding .999999 to today's date.
3. File security (@ sign everywhere) didn't permit normal users to edit
the file. Previous, I defeated the @ sign protection by setting DLAYGO.
However, DLAYGO got killed by Fileman after each edit, which meant that
you can only edit one entry at a time before heading back out and back in
to edit another entry. After discussion with Fileman developers, the
proper way to do this was to not to use DLAYGO but rather remove the @
signs for Read, Write, and Laygo in the Files Definitions.
- File list where protections were changed.
--> C0Q MEASUREMENT SET (1130580001.201)
--> C0Q QUALITY MEASURE (1130580001.101)
--> C0Q PARAMETER (1130580001.401)
- Options which don't use DLAYGO anymore.
--> EDIT SUPERUSERS [C0Q EDIT SUPERUSERS]
--> EP EDIT PARMS [C0Q EDIT OUTPATIENT PARMS]
--> INP EDIT PARMS [C0Q EDIT INP PARMS]
--> MEASURE SET EDIT [C0Q EDIT MEASURE SET]
--> MU MEASURE EDIT [C0Q EDIT MU MEASURE]
--> QUALITY MEASURE EDIT [C0Q EDIT QUALITY MEASURE]
4. The Outpatient Quality Measurement Set which is specified in the
Parameters was being completely ignored. This is fixed.
5. The variable C0QNALT was not being newed in C0QUPDT. It acts as a flag
indicating the type of measure (Performance vs Quality Measure). Since it
was left lying around, a Quality Measure was mistakenly interpreted as a
performance measure, giving you a result of zero, since there is no
data for this Quality Measure.
6. The option that executes the logic for Outpatients C0Q EP UPDATE MU
MEASURES didn't display the time on the dates of the Visits being
processed correctly. This patch fixes this.
SUPPORT TICKETS:
================
None
PACKAGE ELEMENTS:
=================
ENVIRONMENT CHECK: DELETE ENV ROUTINE:
PRE-INIT ROUTINE: DELETE PRE-INIT ROUTINE:
POST-INIT ROUTINE: POST^C0Q1P5 DELETE POST-INIT ROUTINE: No
PRE-TRANSPORT RTN: TRAN^C0Q1P5
UP SEND DATA USER
DATE SEC. COMES SITE RSLV OVER
FILE # FILE NAME DD CODE W/FILE DATA PTRS RIDE
-------------------------------------------------------------------------------
1130580001.101C0Q QUALITY MEASURE YES YES NO
1130580001.201C0Q MEASUREMENT SET YES YES NO
UP SEND DATA USER
DATE SEC. COMES SITE RSLV OVER
FILE # FILE NAME DD CODE W/FILE DATA PTRS RIDE
-------------------------------------------------------------------------------
1130580001.401C0Q PARAMETER YES YES NO
ROUTINE: ACTION:
C0Q1P5 SEND TO SITE
C0QMU12 SEND TO SITE
C0QUPDT SEND TO SITE
OPTION: ACTION:
C0Q EDIT INP PARMS SEND TO SITE
C0Q EDIT MEASURE SET SEND TO SITE
C0Q EDIT MU MEASURE SEND TO SITE
C0Q EDIT OUTPATIENT PARMS SEND TO SITE
C0Q EDIT QUALITY MEASURE SEND TO SITE
C0Q EDIT SUPERUSERS SEND TO SITE
DOCUMENTATION:
==============
http://www.vistapedia.com/index.php/C0Q_Quality_Reporting_1.0
COMPLIANCE:
===========
This software complies with the VA MUMPS Programming Standards and
Conventions (version 3 April 2007), except for the following:
C0QMU12 * * 541 Lines, 18707 Bytes, Checksum: B280797584
S - Routine code exceeds SACC maximum size of 15000 (15513).
Blood Bank Clearance: This software doesn't interact with the Blood Bank module.
Installation Instructions:
==========================
Install Time - less than 1 minute.
1. LOAD TRANSPORT GLOBAL
Choose the PackMan message containing this patch and invoke the
INSTALL/CHECK MESSAGE PackMan option to unload the build.
2. START UP KIDS
Start up the Kernel Installation and Distribution System Menu
[XPD MAIN]:
Edits and Distribution ...
Utilities ...
Installation ...
Select Kernel Installation & Distribution System Option: INStallation
---
Load a Distribution
Print Transport Global
Compare Transport Global to Current System
Verify Checksums in Transport Global
Install Package(s)
Restart Install of Package(s)
Unload a Distribution
Backup a Transport Global
Select Installation Option:
3. Select Installation Option:
NOTE: The following are OPTIONAL - (When prompted for the INSTALL
NAME, enter C0Q*1.0*5):
a. Backup a Transport Global - This option will create a backup
message of any routines exported with this patch. It will not
backup any other changes such as DD's or templates.
b. Compare Transport Global to Current System - This option will
allow you to view all changes that will be made when this patch
is installed. It compares all components of this patch
(routines, DD's, templates, etc.).
c. Verify Checksums in Transport Global - This option will allow
you to ensure the integrity of the routines that are in the
transport global.
4. Select Installation Option: Install Package(s)
**This is the step to start the installation of this KIDS patch:
a. Choose the Install Package(s) option to start the patch install
and enter "C0Q*1.0*5" at the INSTALL NAME prompt. As part of the
Environment Check routine, the message below will display
b. When prompted 'Want KIDS to Rebuild Menu Trees Upon Completion of
Install? NO//' answer NO
c. When prompted 'Want KIDS to INHIBIT LOGONs during the install?
NO//' answer NO
d. When prompted 'Want to DISABLE Scheduled Options, Menu Options,
and Protocols? NO//' answer NO
5. Post installation: No post installation tasks are necessary.
Routine Information:
====================
The second line of each of these routines now looks like:
;;1.0;QUALITY MEASURES;**[Patch List]**;Oct 17, 2012;Build 9
The checksums below are new checksums, and
can be checked with CHECK1^XTSUMBLD.
Routine Name: C0Q1P5
Before: n/a After: B619258 **5**
Routine Name: C0QMU12
Before: n/a After:B280797584 **1,5**
Routine Name: C0QUPDT
Before: n/a After: B78768309 **1,5**
Routine list of preceding patches: 1
=============================================================================
User Information:
Entered By : HABIEL,SAM Date Entered : OCT 18,2012
Completed By: Date Completed:
Released By : Date Released :
=============================================================================

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,469 @@
DHCP Patch Display Page: 1
=============================================================================
Run Date: OCT 23, 2012 Designation: C0Q*1*6 TEST v
Package : QUALITY MEASURES Priority : MANDATORY
Version : 1 Status : UNDER DEVELOPMENT
=============================================================================
Subject: Support for Model Measure Sets
Category: ROUTINE
INPUT TEMPLATE
ENHANCEMENT
Description:
===========
$TXT Created by MANAGER,SYSTEM at BETA.VISTA-OFFICE.ORG (KIDS) on Tuesday, 10/2
3/12 at 13:11
Source, Copyright, & Licensing:
===============================
This patch to WorldVistA 2.0 was produced in a WV 3/09 Environment by George
Lily on 23 October 2012 and released through VISTA Forum.
(C) Geroge Lilly 2012
Licensed under Package License: AGPL v3.
http://www.gnu.org/licenses/agpl-3.0.html
Functionality:
==============
This patch adds support for using model Measurement Sets for creating a new
Measurement Sets based on the model Measurement Sets. Usage instructions will
be found at the end of this patch message.
Support Tickets:
<None>
Package Elements:
=================
UP SEND DATA USER
DATE SEC. COMES SITE RSLV OVER
FILE # FILE NAME DD CODE W/FILE DATA PTRS RIDE
-------------------------------------------------------------------------------
1130580001.401C0Q PARAMETER YES NO NO NO
Partial DD: subDD: 1130580001.401fld: 6.1
fld: 6.2
INPUT TEMPLATE: ACTION:
C0Q EDIT OUPATIENT PARMS FILE #1130580001.401SEND TO SITE
ROUTINE: ACTION:
C0QMU12 SEND TO SITE
C0QMU123 SEND TO SITE
Test Sites:
===========
<None>
Compliance:
===========
This software complies with the VA MUMPS Programming Standards and
Conventions (version 3 April 2007), with the following exception:
C0QMU12 * * 591 Lines, 20662 Bytes, Checksum: B351357107
S - Routine exceeds SACC maximum size of 20000 (20662).
S - Routine code exceeds SACC maximum size of 15000 (16922).
This software has not been tested for 508 compliance.
Installation Instructions:
==========================
Install Time - less than 1 minute
1. LOAD TRANSPORT GLOBAL
Choose the PackMan message containing this patch and invoke the
INSTALL/CHECK MESSAGE PackMan option to unload the build.
2. START UP KIDS
Start up the Kernel Installation and Distribution System Menu
[XPD MAIN]:
Edits and Distribution ...
Utilities ...
Installation ...
Select Kernel Installation & Distribution System Option: INStallation
---
Load a Distribution
Print Transport Global
Compare Transport Global to Current System
Verify Checksums in Transport Global
Install Package(s)
Restart Install of Package(s)
Unload a Distribution
Backup a Transport Global
Select Installation Option:
3. Select Installation Option:
NOTE: The following are OPTIONAL - (When prompted for the INSTALL
NAME, enter C0Q*1.0*6):
a. Backup a Transport Global - This option will create a backup
message of any routines exported with this patch. It will not
backup any other changes such as DD's or templates.
b. Compare Transport Global to Current System - This option will
allow you to view all changes that will be made when this patch
is installed. It compares all components of this patch
(routines, DD's, templates, etc.).
c. Verify Checksums in Transport Global - This option will allow
you to ensure the integrity of the routines that are in the
transport global.
4. Select Installation Option: Install Package(s)
**This is the step to start the installation of this KIDS patch:
a. Choose the Install Package(s) option to start the patch install
and enter "C0Q*1.0*6" at the INSTALL NAME prompt. As part of the
Environment Check routine, the message below will display
b. When prompted 'Want KIDS to Rebuild Menu Trees Upon Completion of
Install? NO//' answer NO
c. When prompted 'Want KIDS to INHIBIT LOGONs during the install?
NO//' answer NO
d. When prompted 'Want to DISABLE Scheduled Options, Menu Options,
and Protocols? NO//' answer NO
Install Transcript:
Select OPTION NAME: XPD MAIN Kernel Installation & Distribution System
Select Kernel Installation & Distribution System Option: INStallation
Select Installation Option: 1 Load a Distribution
Enter a Host File: C0Q*1.0*6
KIDS Distribution saved on Oct 22, 2012@17:41:17
Comment: FRDGHJKLFGHJKL
This Distribution contains Transport Globals for the following Package(s):
C0Q*1.0*6
Distribution OK!
Want to Continue with Load? YES//
Loading Distribution...
C0Q*1.0*6
Use INSTALL NAME: C0Q*1.0*6 to install this Distribution.
Select Installation Option: 6 Install Package(s)
Select INSTALL NAME: C0Q*1.0*6 Loaded from Distribution Loaded from Di
stribution 10/23/12@11:46:32
=> FRDGHJKLFGHJKL ;Created on Oct 22, 2012@17:41:17
This Distribution was loaded on Oct 23, 2012@11:46:32 with header of
FRDGHJKLFGHJKL ;Created on Oct 22, 2012@17:41:17
It consisted of the following Install(s):
C0Q*1.0*6
Checking C0Q*1.0*6 for overlap with VOE 1.0 ... OK
No overlap found
Checking C0Q*1.0*6 for overlap with VOE 1.1 ... OK
No overlap found
Checking C0Q*1.0*6 for overlap with NO HOME 1.0 ... OK
No overlap found
Checking Install for Package C0Q*1.0*6
Install Questions for C0Q*1.0*6
Incoming Files:
1130580001.401C0Q PARAMETER (Partial Definition)
Note: You already have the 'C0Q PARAMETER' File.
Want KIDS to INHIBIT LOGONs during the install? NO//
Want to DISABLE Scheduled Options, Menu Options, and Protocols? NO//
Enter the Device you want to print the Install messages.
You can queue the install by enter a 'Q' at the device prompt.
Enter a '^' to abort the install.
DEVICE: HOME// 0;P-OTHER;80;9999 TELNET
Install Started for C0Q*1.0*6 :
Oct 23, 2012@11:46:53
Build Distribution Date: Oct 22, 2012
Installing Routines:...
Oct 23, 2012@11:46:53
Installing Data Dictionaries: ..
Oct 23, 2012@11:46:54
Installing PACKAGE COMPONENTS:
Installing INPUT TEMPLATE..
Oct 23, 2012@11:46:54
Updating Routine file......
Updating KIDS files.......
C0Q*1.0*6 Installed.
Oct 23, 2012@11:46:54
Not a VA primary domain
NO Install Message sent
Select Installation Option:
----------------------------
Usage instructions:
===================
1. Create two measure sets, one for Performance Measures, and one for Quality
Measures. If you have ones already created for other clinics, you can use them.
It's okay for them to have filter lists, as these will be deleted by the
software when the measure set is being copied.
2. Attach these measure sets to an Outpatient Parameter in the fields: MODEL
PERFORMANCE MEASURE SET and MODEL QUALITY MEASURE SET. NB: The purpose of
these fields is to generate the a measure set to use in the fields EP MU
MEASUREMENT SET and EP QUALITY MEASUREMENT SET, respectively. If you have these
filled out, the Model fields will have no effect.
3. Run the option EP UPDATE MU MEASURES. This create new measure sets based on
the model measure sets and attach the appropriate filter lists.
Miscellaneous remarks: If a model set is replaced and the option to update is
reran, the behavior is not to delete the old created measure set but rather to
merge the contents of the new model set into the old created measure set. I am
not sure if this is the desirable behavior, but that is how it currently works.
Transcript:
Select QUALITY MEASUREMENT MENU Option: ?
COPY OVER PATIENT LISTS
ED-1 COMPUTATION
ED-2 COMPUTATION
EP UPDATE MU MEASURES
INP UPDATE MU MEASURES
PQRI MENU ...
PQRI PRINT XML
PRINT C0Q MEASURES
QRDA MENU ...
SETUP QUALITY REPORTING ...
Enter ?? for more options, ??? for brief descriptions, ?OPTION for help text.
Select QUALITY MEASUREMENT MENU Option: PRINT C0Q MEASURES
Select C0Q MEASUREMENT SET NAME: DR OFF
1 DR OFFICE PERFORMANCE MEASURES
2 DR OFFICE QUALITY MEASURES
CHOOSE 1-2: 1 DR OFFICE PERFORMANCE MEASURES
DEVICE: HOME// TELNET
C0Q MEASUREMENTS LIST OCT 23,2012 12:04 PAGE 1
MEASURE:DISPLAY NAME DENOMINATOR NUMERATOR PERCENTAGE
--------------------------------------------------------------------------------
CPOE 3 0 0.00
PROBLEMS 3 3 100.00
ALLERGIES 3 3 100.00
Select C0Q MEASUREMENT SET NAME: DR OFF
1 DR OFFICE PERFORMANCE MEASURES
2 DR OFFICE QUALITY MEASURES
CHOOSE 1-2: 2 DR OFFICE QUALITY MEASURES
DEVICE: HOME// TELNET
C0Q MEASUREMENTS LIST OCT 23,2012 12:04 PAGE 1
MEASURE:DISPLAY NAME DENOMINATOR NUMERATOR PERCENTAGE
--------------------------------------------------------------------------------
NQF0013 Hypertension: 0 0 0.00
Blood Pressure
Measurement
NQF0028A Tobacco Use 0 0 0.00
Assessment
NQF0028B Tobacco Use 0 0 0.00
Assessment and Cessation
Intervention
Select C0Q MEASUREMENT SET NAME:
Select QUALITY MEASUREMENT MENU Option: SETUP QUALITY REPORTING
Select SETUP QUALITY REPORTING Option: EP EDIT PARMS
Select C0Q PARAMETER NAME: ACME CLINIC #1
Are you adding 'ACME CLINIC #1' as a new C0Q PARAMETER (the 2ND)? No// Y
(Yes)
NAME: ACME CLINIC #1//
MEASUREMENT PERIOD KEY: MU12
PARAMETER TYPE: OU OUTPATIENT
EP MU MEASUREMENT SET:
EP QUALITY MEASUREMENT SET:
Select CLINIC: ACME CLINIC #1
Are you adding 'ACME CLINIC #1' as a new CLINIC (the 1ST for this C0Q PARAMET
ER)? No// Y (Yes)
Select CLINIC:
PATIENT LIST LABEL:
Select SUBSCRIBER:
MODEL PERFORMANCE MEASURE SET: DR,P DR OFFICE PERFORMANCE MEASURES
MODEL QUALITY MEASURE SET: DR,Q DR OFFICE QUALITY MEASURES
Select C0Q PARAMETER NAME:
Select SETUP QUALITY REPORTING Option:
Select QUALITY MEASUREMENT MENU Option: EP UPDATE MU MEASURES
Jan 04, 2008@19:14:59
Jan 02, 2008@18:40:58
Nov 26, 2005@13:10:24
Nov 26, 2005@14:12:42
Nov 25, 2005@20:31:13
Aug 02, 2005@08:40:36
Aug 01, 2005@15:08:49
Aug 01, 2005@15:21:18
Jul 29, 2005@11:44:36
Jul 29, 2005@11:53:15
Jul 29, 2005@12:04:45
Jul 28, 2005@12:20:20
Jul 28, 2005@16:16:03
Jul 27, 2005@11:21:04
Jul 27, 2005@11:24:55
Jul 27, 2005@11:41:40
Jul 27, 2005@11:47:38
Jul 27, 2005@11:49:41
Jul 27, 2005@11:50:26
Jul 27, 2005@15:45:45
Jul 25, 2005@08:37:24
Jul 24, 2005@11:01:55
Jul 24, 2005@14:22:11
Jul 24, 2005@16:22:29
Jul 24, 2005@17:17:01
Jul 24, 2005@17:33:39
Jul 23, 2005@16:14:54
Jul 23, 2005@17:17:08
Jul 23, 2005@17:24:01
Jul 22, 2005@10:49:29
Jul 22, 2005@16:46:52
Jul 21, 2005@08:56:56
Jul 21, 2005@12:10:54
Jul 21, 2005@15:39:22
Jul 21, 2005@15:39:29
Jul 20, 2005@10:07:46
Jul 20, 2005@10:44:03
Jul 19, 2005@07:41:49
Jul 19, 2005@08:52:13
Jul 19, 2005@11:32:14
Jul 19, 2005@11:36:08
Jul 19, 2005@13:35:12
Jul 19, 2005@15:43:18
Jul 19, 2005@15:54:48
Jul 18, 2005@17:57:49
Jul 15, 2005@16:00
Jul 08, 2005@13:03
Jul 01, 2005@14:37:23
Oct 23, 2012@12:02
CREATING MU12-EP-ACME CLINIC #1-PatientC0QFDA(1130580001.2011,"1,13,",3)=0
C0QFDA(1130580001.2011,"2,13,",3)=100
C0QFDA(1130580001.2011,"3,13,",3)=100
C0QFDA(1130580001.2011,"1,14,",3)=0
C0QFDA(1130580001.2011,"2,14,",3)=0
C0QFDA(1130580001.2011,"3,14,",3)=0
C0QFDA(1130580001.2011,"1,15,",1.1)=0
C0QFDA(1130580001.2011,"1,15,",2.1)=1
C0QFDA(1130580001.20112,"+1,1,15,",.01)=3
C0QFDA(1130580001.2011,"1,15,",3)=0
C0QFDA(1130580001.2011,"2,15,",1.1)=1
C0QFDA(1130580001.20111,"+1,2,15,",.01)=3
C0QFDA(1130580001.2011,"2,15,",2.1)=1
C0QFDA(1130580001.20112,"+1,2,15,",.01)=3
C0QFDA(1130580001.2011,"2,15,",3)=100
C0QFDA(1130580001.2011,"3,15,",1.1)=1
C0QFDA(1130580001.20111,"+1,3,15,",.01)=3
C0QFDA(1130580001.2011,"3,15,",2.1)=1
C0QFDA(1130580001.20112,"+1,3,15,",.01)=3
C0QFDA(1130580001.2011,"3,15,",3)=100
C0QFDA(1130580001.2011,"1,16,",1.1)=0
C0QFDA(1130580001.2011,"1,16,",2.1)=0
C0QFDA(1130580001.2011,"1,16,",3)=0
C0QFDA(1130580001.2011,"2,16,",1.1)=0
C0QFDA(1130580001.2011,"2,16,",2.1)=0
C0QFDA(1130580001.2011,"2,16,",3)=0
C0QFDA(1130580001.2011,"3,16,",1.1)=0
C0QFDA(1130580001.2011,"3,16,",2.1)=0
C0QFDA(1130580001.2011,"3,16,",3)=0
Select QUALITY MEASUREMENT MENU Option: PRINT C0Q MEASURES
Select C0Q MEASUREMENT SET NAME: ACME
1 ACME CLINIC #1 PR
2 ACME CLINIC #1 QM
CHOOSE 1-2: 1 ACME CLINIC #1 PR
DEVICE: HOME// TELNET
C0Q MEASUREMENTS LIST OCT 23,2012 12:05 PAGE 1
MEASURE:DISPLAY NAME DENOMINATOR NUMERATOR PERCENTAGE
--------------------------------------------------------------------------------
CPOE 1 0 0.00
PROBLEMS 1 1 100.00
ALLERGIES 1 1 100.00
Select C0Q MEASUREMENT SET NAME: ACME
1 ACME CLINIC #1 PR
2 ACME CLINIC #1 QM
CHOOSE 1-2: 2 ACME CLINIC #1 QM
DEVICE: HOME// TELNET
C0Q MEASUREMENTS LIST OCT 23,2012 12:05 PAGE 1
MEASURE:DISPLAY NAME DENOMINATOR NUMERATOR PERCENTAGE
--------------------------------------------------------------------------------
NQF0013 Hypertension: 0 0 0.00
Blood Pressure
Measurement
NQF0028A Tobacco Use 0 0 0.00
Assessment
NQF0028B Tobacco Use 0 0 0.00
Assessment and Cessation
Intervention
Routine Information:
====================
The second line of each of these routines now looks like:
;;1.0;QUALITY MEASURES;**[Patch List]**;May 21, 2012;Build 2
The checksums below are new checksums, and
can be checked with CHECK1^XTSUMBLD.
Routine Name: C0QMU12
Before: n/a After:B351357107 **1,5,6**
Routine Name: C0QMU123
Before: n/a After: B4208272 **6**
Routine list of preceding patches: 5
=============================================================================
User Information:
Entered By : HABIEL,SAM Date Entered : OCT 23,2012
Completed By: Date Completed:
Released By : Date Released :
=============================================================================

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,4 @@
Documentation for the package as well as installation can be found in
Vistapedia.
http://www.vistapedia.com/index.php/C0Q_Quality_Reporting_1.0

169
qrda/C0Q/trunk/p/C0Q1P2.m Normal file
View File

@ -0,0 +1,169 @@
C0Q1P2 ; VEN/SMH - Kids utilities for C0Q 1.0 patch 2 ; 8/3/12 11:13am
;;1.0;QUALITY MEASURES;**2**;July 13, 2112;
; Licensed under package license. See Documentation for license and
; usage conditions.
;
; PEPs: PRE, POST
;
PRE ; Unified Pre; PEP
D PREREM
QUIT
POST ; Unified Post; PEP
D POSTREM
QUIT
;
; Rest of entry points are private
;
;
ARRAY(MODE,ARRAY) ;List of exchange entries used by delete and install
;
N LN S LN=1
;
; NQF 0024-alt-core_wt-kids
S ARRAY(LN,1)="MU NQF0024-ALL"
I MODE S ARRAY(LN,2)="07/31/2012@17:49:03"
S LN=LN+1
;
; NQF 0013-core-HTN
S ARRAY(LN,1)="MU NQF0013 HTN_MK"
I MODE S ARRAY(LN,2)="07/06/2011@15:08:53"
S LN=LN+1
;
; NQF 0028a-core-tobacco-access
; NQF 0028b-core-tobaocc-intervention
S ARRAY(LN,1)="MU NQF0028 TOBACCO_MK"
I MODE S ARRAY(LN,2)="07/06/2011@15:14:49"
S LN=LN+1
;
; NQF 0041-alt-core-flu
S ARRAY(LN,1)="MU NQF0041 FLU_MK"
I MODE S ARRAY(LN,2)="07/06/2011@15:26:59"
S LN=LN+1
;
; NQF 0059-option1-DM-Hbalc
; NQF 0061-option3-DM-BP
; NQF 0064-option2-DM-LDL
; All are in One Reminder Exchange entry
S ARRAY(LN,1)="MU NQF0059_61_64_SMH"
I MODE S ARRAY(LN,2)="07/16/2012@10:46:17"
S LN=LN+1
;
; Inpatient Education Reminders (popularly known as ED-1 and ED-2)
; NQF 0495
; NQF 0497
S ARRAY(LN,1)="MU NQF 0495 ED-1"
I MODE S ARRAY(LN,2)="07/17/2012@11:47:55"
S LN=LN+1
S ARRAY(LN,1)="MU NQF 0497 ED-2"
I MODE S ARRAY(LN,2)="07/17/2012@11:50:23"
S LN=LN+1
;
; MU Stroke Measures
; NQF 0435
; NQF 0436
; NQF 0437
; NQF 0438
; NQF 0439
; NQF 0440
; NQF 0441
; NB: Contains two Labs! Must rematch if not on your system.
; Installation will become talkative
S ARRAY(LN,1)="MU STROKE 2.3.4.5.6.8.10 SMH"
I MODE S ARRAY(LN,2)="07/18/2012@10:33:53"
S LN=LN+1
;
; MU VTE Measures
; NQF 0371
; NQF 0372
; NQF 0373
; NQF 0374
; NQF 0375
; NQF 0376
; NB: Contains several labs. Must rematch if not on your system.
; Installation will become talkative
S ARRAY(LN,1)="MU VTE 1.2.3.4.5.6 SMH"
I MODE S ARRAY(LN,2)="07/20/2012@09:48:30"
S LN=LN+1
;
;
; NQF 0421-core-adult-weight
; NB: B/c of the presence of patient lists, measures sent as part of
; an extract.
S ARRAY(LN,1)="MU NQF0421 ADULT BMI SMH"
I MODE S ARRAY(LN,2)="07/26/2012@11:00:17"
S LN=LN+1
;
; NQF 0038-alt-core-childImms
; NB: Again because of Patient Lists, measures sent as part of an extract
S ARRAY(LN,1)="MU NQF0038 CHILD IMM SMH"
I MODE S ARRAY(LN,2)="07/27/2012@17:48:33"
S LN=LN+1
;
; CPRS Management Dialogs for Outpatient Stuff
; MU NQF0421 BMI DI
; MU NQF0041 INFLUENZA MANAGEMENT DI
; MU NQF0038 IMMUNE MANAGEMENT DI
; MU NQF0028AB MANAGEMENT DI
; MU SMOKING STATUS DI
S ARRAY(LN,1)="MU CPRS HELP DIS"
I MODE S ARRAY(LN,2)="08/01/2012@18:32:29"
S LN=LN+1
;
QUIT
;
;
;===============================================================
DELEI ;If the Exchange File entry already exists delete it.
N ARRAY,IC,IND,LIST,LUVALUE,NUM
D ARRAY(1,.ARRAY)
S IC=0
F S IC=$O(ARRAY(IC)) Q:'IC D
.S LUVALUE(1)=ARRAY(IC,1)
.D FIND^DIC(811.8,"","","U",.LUVALUE,"","","","","LIST")
.I '$D(LIST) Q
.S NUM=$P(LIST("DILIST",0),U,1)
.I NUM'=0 D
..F IND=1:1:NUM D
... N DA,DIK
... S DIK="^PXD(811.8,"
... S DA=LIST("DILIST",2,IND)
... D ^DIK
Q
;
;===============================================================
EXFINC(Y) ;Return a 1 if the Exchange file entry is in the list to
;include in the build. This is used in the build to determine which
;entries to include.
N ARRAY,FOUND,IEN,IC,LUVALUE
D ARRAY(1,.ARRAY)
S FOUND=0
S IC=0
F S IC=+$O(ARRAY(IC)) Q:(IC=0)!(FOUND) D
. M LUVALUE=ARRAY(IC)
. S IEN=+$$FIND1^DIC(811.8,"","KU",.LUVALUE)
. I IEN=Y S FOUND=1 Q
Q FOUND
;
PREREM ;
D DELEI
Q
POSTREM ;
D SMEXINS
Q
;===============================================================
SMEXINS ;Silent mode install.
N ARRAY,IC,IEN,LUVALUE,PXRMINST
S PXRMINST=1
D ARRAY(1,.ARRAY)
S IC=0
F S IC=$O(ARRAY(IC)) Q:'IC D
.M LUVALUE=ARRAY(IC)
.S IEN=+$$FIND1^DIC(811.8,"","KU",.LUVALUE)
.I IEN'=0 D
.. N TEXT
.. I LUVALUE(1)["PARAMETER" S TEXT="Installing entry "_LUVALUE(1)
.. E S TEXT="Installing reminder exchange entry "_LUVALUE(1)
.. D BMES^XPDUTL(TEXT)
.. D INSTALL^PXRMEXSI(IEN,"I",1)
Q
;

63
qrda/C0Q/trunk/p/C0Q1P4.m Normal file
View File

@ -0,0 +1,63 @@
C0Q1P4 ; GPL - Kids utilities for C0Q 1.0 patch 4 ; 8/2/12 2:46am
;;1.0;QUALITY MEASURES;**4**
TRAN ; Unified Transport
D TRAN101
D TRAN201
QUIT
;
TRAN101 ; Remove Untransportable pointers in C0Q QUALITY MEASURE; Private EP
; NB: I am reaching into KIDS's data here. This may not work for future versions
; of KIDS. However, I am exporting this only; once exported, it should work in
; any version of KIDS.
N XPDIEN S XPDIEN=$QS(XPDGREF,2) ; Get IEN of KIDS Transport Global
N X S X=$NA(^XTMP("XPDT",XPDIEN,"DATA",1130580001.101)) ; KIDS transports our data here
N IEN S IEN=0 ; Looper
F S IEN=$O(@X@(IEN)) Q:'IEN D ; For each IEN, remove the following:
. S $P(@X@(IEN,0),U,2)="" ; Numerator Patient List
. S $P(@X@(IEN,0),U,3)="" ; Denominator Patient List
. S $P(@X@(IEN,7),U,4)="" ; Negative Numerator List
. S $P(@X@(IEN,7),U,2)="" ; Alternate Numerator List
. S $P(@X@(IEN,7),U,3)="" ; Alternate Denominator List
. S $P(@X@(IEN,7),U,5)="" ; Alternate Negative Numerator List
;
; Now oooo how fun I have to remove the pointer resolution data by hand.
; D1 and D2 constitute the "address" of the origin data.
; D1 is the IEN,node
; D2 is the piece.
; Depending on the combination of the node and the piece, we can decide to
; remove the data (how fun). To make it clearer, I will use vars called
; node and piece to be clear. Up above you have a reference of which nodes
; and pieces we want to get rid of. This makes up the "TARGET LIST"
;
; TARGET LIST
N TARLIST
S TARLIST(0,2)=""
S TARLIST(0,3)=""
S TARLIST(7,4)=""
S TARLIST(7,2)=""
S TARLIST(7,3)=""
S TARLIST(7,5)=""
;
N X,SUB
F SUB="FRV1","FRV1K" S X=$NA(^XTMP("XPDT",XPDIEN,SUB,1130580001.101)) D
. N D1,D2 S (D1,D2)=0
. F S D1=$O(@X@(D1)) Q:'D1 F S D2=$O(@X@(D1,D2)) Q:'D2 D
. . N NODE,PIECE
. . S NODE=$P(D1,",",2)
. . S PIECE=D2
. . I $D(TARLIST(NODE,PIECE)) K ^(D2)
QUIT
;
TRAN201 ; Transport 201 (Measurement Sets file)
N XPDIEN S XPDIEN=$QS(XPDGREF,2) ; Get IEN of KIDS Transport Global
N X S X=$NA(^XTMP("XPDT",XPDIEN,"DATA",1130580001.201)) ; KIDS transports our data here
N IEN1 S IEN1=0 ; Looper
F S IEN1=$O(@X@(IEN1)) Q:'IEN1 D
. N IEN2 S IEN2=0
. F S IEN2=$O(@X@(IEN1,5,IEN2)) Q:'IEN2 D
. . N Y S Y=$NA(^(IEN2)) ;Grab the reference
. . K @Y@(1),@Y@(2),@Y@(3),@Y@(4) ; nodes to kill off containing untransportable data
QUIT
;
POST401 ; Post 401

18
qrda/C0Q/trunk/p/C0Q1P5.m Normal file
View File

@ -0,0 +1,18 @@
C0Q1P5 ; VEN/SMH - KIDS not transporting Security Codes; workaround. ; 10/17/12 12:12pm
;;1.0;QUALITY MEASURES;**5**;Oct 17, 2012
;;
; PEPs: TRAN, POST
;
; ZEXCEPT: XPDGREF
TRAN ; Pre-transport hook
M @XPDGREF@(1130580001.101)=^DIC(1130580001.101)
M @XPDGREF@(1130580001.201)=^DIC(1130580001.201)
M @XPDGREF@(1130580001.401)=^DIC(1130580001.401)
QUIT
;
; ZEXCEPT: XPDGREF
POST ; Post-install hook
M ^DIC(1130580001.101)=@XPDGREF@(1130580001.101)
M ^DIC(1130580001.201)=@XPDGREF@(1130580001.201)
M ^DIC(1130580001.401)=@XPDGREF@(1130580001.401)
QUIT

View File

@ -0,0 +1,57 @@
C0QERTIM ; Time from admission to leaving a hospital location ; 5/23/12 2:26pm
;;1.0;C0Q;;May 21, 2012;Build 63
EN ;Get Location
S DIC=42,DIC(0)="AEMQ" D ^DIC I Y<1 G EXIT
S LOCATION=+Y
;Start date
S %DT="AE",%DT("A")="Start DATE: " D ^%DT G:Y=-1 EXIT S START=Y
;End date
S %DT="AE",%DT("A")="Stop DATE: " D ^%DT G:Y=-1 EXIT S STOP=Y
;select device:
S %ZIS="Q" D ^%ZIS G EXIT:POP
I $D(IO("Q")) D G EXIT
. S ZTRTN="DQ^C0QERTIM",ZTDESC="Time from admission to leaving a hospital location"
. S ZTSAVE("LOCATION")="",ZTSAVE("START")="",ZTSAVE("STOP")=""
. D ^%ZTLOAD D HOME^%ZIS K IO("Q")
. Q
DQ ; Get down to business
;sort on admit date/time in file 45, screen on LOSING WARD in sub-file 535.
;^DGPT("AF",date/time,DA)
S PATCOUNT=0,ADMITIME=START
F S ADMITIME=$O(^DGPT("AF",ADMITIME)) Q:ADMITIME'>0 D
. Q:ADMITIME>STOP
. ;FMIN from ADMISSION DATE piece 2
. S X=ADMITIME D H^%DTC S FMINDAY=%H,FMINSEC=%T
. S D0="" F S D0=$O(^DGPT("AF",ADMITIME,D0)) Q:D0'>0 D
. . S D1=0 F S D1=$O(^DGPT(D0,535,D1)) Q:D1'>0 D
. . . ;Losing ward in piece 6 of ^DGPT(D0,535,D1,0)
. . . Q:$P($G(^DGPT(D0,535,D1,0)),U,6)'=LOCATION
. . . ;FMOUT from MOVEMENT DATE on leaving in piece 10
. . . S X=$P($G(^DGPT(D0,535,D1,0)),U,10) D H^%DTC S FMOUTDAY=%H,FMOUTSEC=%T
. . . I FMINDAY=FMOUTDAY S MINUTES=$P((FMOUTSEC-FMINSEC)/60,".")
. . . I FMINDAY'=FMOUTDAY D
. . . . S DIFFDAY=FMOUTDAY-FMINDAY
. . . . S MINUTES=1440*(DIFFDAY-1)+$P((FMOUTSEC+86400-FMINSEC)/60,".")
. . . . Q
. . . S PATCOUNT=PATCOUNT+1
. . . S ^TMP($J,"PATIENTS",$P(^DPT(+^DGPT(D0,0),0),U))=MINUTES
. . . S ^TMP($J,"MINUTES",MINUTES)=1+$G(^TMP($J,"MINUTES",MINUTES))
. . . Q
. . Q
. Q
U IO W @IOF
;list median time from Admission to leaving hospital LOCATION
S MID=$P(PATCOUNT/2,"."),SUM=0
S MEDIAN=0 F S MEDIAN=$O(^TMP($J,"MINUTES",MEDIAN)) Q:MEDIAN'>0 D
. S SUM=SUM+^TMP($J,"MINUTES",MEDIAN) Q:SUM>MID
. Q
W "The median time spent in ",$P(^DIC(42,LOCATION,0),U)," is ",MEDIAN," minutes.",!
W !,"Patient",?40,"Minutes in ",$P(^DIC(42,LOCATION,0),U)
;list patient and time from admission to leaving the location
S PATIENT="" F S PATIENT=$O(^TMP($J,"PATIENTS",PATIENT)) Q:PATIENT="" D
. W !,PATIENT,?40," ",^TMP($J,"PATIENTS",PATIENT)
EXIT ; DO CLEANUP
S:$D(ZTQUEUED) ZTREQ="@"
K DIC,START,STOP,LOCATION,PATCOUNT,ADMITIME,FMINDAY,FMINSEC,FMOUTDAY,FMOUTSEC
K POP,D0,D1,DIFFDAY,MINUTES,MID,MEDIAN,PATIENT,^TMP($J)
Q

94
qrda/C0Q/trunk/p/C0QGEN.m Normal file
View File

@ -0,0 +1,94 @@
C0QGEN ;GPL - Test Patient Reminder List Generator;7/5/11 8:50pm
;;1.0;MU PACKAGE;;;Build 19
;
;2011 George Lilly <glilly@glilly.net> - Licensed under the terms of the GNU
;General Public License See attached copy of the License.
;
;This program is free software; you can redistribute it and/or modify
;it under the terms of the GNU General Public License as published by
;the Free Software Foundation; either version 2 of the License, or
;(at your option) any later version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License along
;with this program; if not, write to the Free Software Foundation, Inc.,
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
;
Q
;
EN ; generate random patient lists for C0Q testing
;
; -- here are the attributes in the C0Q PATIENT LIST file
;
;^C0Q(301,"CATTR","FailedDemographics",9)=""
;^C0Q(301,"CATTR","HasAdvancedDirective",15)=""
;^C0Q(301,"CATTR","HasAllergy",24)=""
;^C0Q(301,"CATTR","HasDemographics",25)=""
;^C0Q(301,"CATTR","HasMed",26)=""
;^C0Q(301,"CATTR","HasMedOrders",10)=""
;^C0Q(301,"CATTR","HasMedRecon",19)=""
;^C0Q(301,"CATTR","HasProblem",27)=""
;^C0Q(301,"CATTR","HasSmokingStatus",12)=""
;^C0Q(301,"CATTR","HasVitalSigns",16)=""
;^C0Q(301,"CATTR","NoAdvancedDirective",17)=""
;^C0Q(301,"CATTR","NoAllergy",28)=""
;^C0Q(301,"CATTR","NoMed",5)=""
;^C0Q(301,"CATTR","NoMedOrders",11)=""
;^C0Q(301,"CATTR","NoMedRecon",20)=""
;^C0Q(301,"CATTR","NoProblem",29)=""
;^C0Q(301,"CATTR","NoSmokingStatus",13)=""
;^C0Q(301,"CATTR","NoVitalSigns",18)=""
;^C0Q(301,"CATTR","Over65",14)=""
;^C0Q(301,"CATTR","Patient",30)=""
;^C0Q(301,"CATTR","XferOfCare",21)=""
N ZI S ZI=0
N ZX,ZY
K C0QLIST ; variable to pass to update
F S ZI=$O(^DPT(ZI)) Q:+ZI=0 D ; for every patient in the database
. ;
. S C0QLIST("Patient",ZI)="" ; everyone is a patient
. ;
. I $$YN(90) S C0QLIST("HasDemographics",ZI)="" ;
. E S C0QLIST("FailedDemographics",ZI)="" ;
. ;
. I $$YN(40) S C0QLIST("HasAdvancedDirective",ZI)="" ;
. E S C0QLIST("NoAdvancedDirective",ZI)="" ;
. ;
. I $$YN(60) S C0QLIST("HasAllergy",ZI)="" ;
. E S C0QLIST("NoAllergy",ZI)="" ;
. ;
. I $$YN(65) S C0QLIST("HasMed",ZI)="" ;
. E S C0QLIST("NoMed",ZI)="" ;
. ;
. I $$YN(80) S C0QLIST("HasMedOrders",ZI)="" ;
. E S C0QLIST("NoMedOrders",ZI)="" ;
. ;
. I $$YN(35) S C0QLIST("HasMedRecon",ZI)="" ;
. E S C0QLIST("NoMedRecon",ZI)="" ;
. ;
. I $$YN(80) S C0QLIST("HasProblem",ZI)="" ;
. E S C0QLIST("NoProblem",ZI)="" ;
. ;
. I $$YN(70) S C0QLIST("HasSmokingStatus",ZI)="" ;
. E S C0QLIST("NoSmokingStatus",ZI)="" ;
. ;
. I $$YN(85) S C0QLIST("HasVitalSigns",ZI)="" ;
. E S C0QLIST("NoVitalSigns",ZI)="" ;
. ;
. I $$YN(20) S C0QLIST("Over65",ZI)="" ;
D FILE^C0QPRML ; update the patient list file
; then update the measure set
D UPDATE^C0QUPDT(.G,8) ; the MU 2011 INP ATTESTATION measure set ien
Q
;
YN(ZPCT) ; extrinsic which says yes or no based on a percent ZPCT
; for example $$YN(70) will say "yes" 70% of the time
N ZN
S ZN=0
I $R(100)<ZPCT S ZN=1
Q ZN
;

118
qrda/C0Q/trunk/p/C0QGMRAD.m Normal file
View File

@ -0,0 +1,118 @@
C0QGMRAD ;HIRMFO/RM,WAA-UTILITY TO GATHER PATIENT DATA ;1/15/98 13:47
;;1.0;C0Q;;May 21, 2012;Build 63
EN1 ; ENTRY TO GATHER PATIENT A/AR DATA
;INPUT VARIABLES:
;
; DFN Pointer to Patient file.
; GMRA (OPTIONAL) A^B^C DEFAULT="0^0^111^0" **LOCAL
; where A = 0 return all reactions (allergic/non-allergic).
; 1 return allergies only.
; 2 return non-allergies only.
; B = 0 return all data (verified or non-verified).
; 1 return only verified data.
; 2 return only non-verified data.
; C = X_Y_Z
; where X, Y, and Z are either 0 or 1. 1 would mean to
; return an Adverse Reaction of that particular type,
; and zero means do not return an Adverse Reaction of
; that type.
; X is for TYPE=OTHER
; Y is for TYPE=FOOD
; Z is for TYPE=DRUG.
; E.g., 001 (return drug only), 111 (returns all types),
; and 010 (returns food only).
; **LOCAL
; D = 0 return both Observed and Historical
; 1 return only Observed
; **LOCAL
;OUTPUT VARIABLES:
; GMRAL = 1 if patient has Adverse Reaction
; 0 if patient has no known Adverse Reaction
; null if patient has not been asked about Adverse Reaction
; GMRAL(PTR TO 120.8) = A^B^C^D^E^F^G^H^I
; where A = Pointer to Patient file.
; B = Free text of causative agent.
; *C = Type of reaction, where D is drug, F is food, and O is
; other.
; D = 1 if Adverse Reaction has been verified
; 0 if Adverse Reaction has not been verified
; E = 0 if this is an allergic reaction
; 1 if this is not an allergic reaction
; **F = the mechanism of reaction in the format:
; External format;Internal format
; (ALLERGY;0, PHARMACOLOGIC;2, UNKNOWN;U).
; G = Type of reaction.
; where D = drug
; DF = drug/food
; DFO = drug/food/other
; DO = drug/other
; F = food
; FO = food/other
; O = other
; H = the mechanism of reaction in the format:
; External format;Internal format
; (ALLERGY;A, PHARMACOLOGIC;P, UNKNOWN;U)
; I = IEN and Global root of reactant (stored in piece B above)
; set equal to the GMR ALLERGY field (#1) of the PATIENT
; ALLERGY file (#120.8)
; GMRAL(PTR TO 120.8,"S",COUNT) = S
; where COUNT = number 1 to number of signs/symptoms for this
; reaction.
; S = a sign/symptom for this reaction in the format:
; External format;Internal format
;
;* NOTE: This piece will no longer be supported after 9/1/97,
; Please use piece G.
;** NOTE: This piece will no longer be supported after 9/1/97,
; Please use piece H.
;
N GMRAOTH
Q:'$D(DFN) S:'$D(GMRA)#2 GMRA="0^0^111^1" K GMRAL
DPT ;
;Read NKA Node in file 120.86
S GMRAL=$P($G(^GMR(120.86,DFN,0)),U,2)
;Do not set GMRAL array if patient is unassessed or NKA.
I GMRAL=0 Q ;PATIENT HAS NO KNOWN ALLERGIES
F GMRAREC=0:0 S GMRAREC=$O(^GMR(120.8,"B",DFN,GMRAREC)) Q:GMRAREC'>0 S GMRANODE=$S($D(^GMR(120.8,GMRAREC,0)):^(0),1:"") D:GMRANODE SETAL
I GMRAL=1,+$O(GMRAL(0))'>0 S GMRAL=0 ;if flag is set to 1 (reactions exist), then make certain the reactions are passed in the GMRAL array
K GMRA,GMRANODE,GMRAOSOF,GMRAREC,GMRATCNT
Q
SETAL ;
N %,GMRAI,GMRASIGN
;Q:'$P(GMRANODE,"^",12)&'$D(GMRAOSOF) ;IF NOT SIGNED OFF MARK IT
Q:+$G(^GMR(120.8,GMRAREC,"ER"))&'$D(GMRAERR) ;IF ENTERED IN ERROR QUIT
I GMRAL'=1 S GMRAL=1 ; PATIENT HAS ALLERGIES
S GMRAI=0 ; BEGIN CHECK FOR ADR/ALL CRITERIA
I $P(GMRA,"^",4),$P(GMRANODE,"^",6)="h" Q ;QUIT IF HISTORICAL EXCLUDED **LOCAL
I '$P(GMRA,"^") S GMRAI=1
E I $P(GMRA,"^")=1 S:$F("AU",$P(GMRANODE,"^",14))>1 GMRAI=1
E S:$F("P",$P(GMRANODE,"^",14))>1 GMRAI=1
Q:'GMRAI ; QUIT IF ADR/ALL CRITERIA NOT MET
Q:2-$P(GMRA,"^",2)=(1-$P(GMRANODE,"^",16)) ;QUIT IF VER/NON VER CRITERIA NOT MET
S GMRAI=0 ; BEGIN CHECK FOR ALLERGY TYPE CRITERIA
F %=1:1:3 I $E($P(GMRA,"^",3),%),$P(GMRANODE,"^",20)[$E("OFD",%) S GMRAI=1 Q
Q:'GMRAI ; QUIT IF ALLERGY TYPE CRITERIA NOT MET
D PASS(GMRAREC,.GMRAL)
Q
PASS(GMRAREC,GMRAL) ; Data filer
; This subroutine will store all the patient date for a reaction is an
; array.
; Input:
; GMRAREC = The IEN for the entry in 120.8
;Output:
; GMRAL(GMRAREC) the array entry for the record
;
N GMRANODE
S GMRANODE=$G(^GMR(120.8,GMRAREC,0)) Q:GMRANODE=""
S %=$P(GMRANODE,"^",14)
S GMRAL(GMRAREC)=$P(GMRANODE,"^",1,2)_"^"_$E($P(GMRANODE,"^",20))_"^"_+$P(GMRANODE,"^",16)_"^"_$S(%="A"!(%="U"):0,1:1)
S GMRAL(GMRAREC)=GMRAL(GMRAREC)_"^"_$S(%="A":"ALLERGY;0",%="P":"PHARMACOLOGIC;2",%="U":"UNKNOWN;U",1:"")_"^"_$P(GMRANODE,"^",20)_"^"_$S(%="A":"ALLERGY;A",%="P":"PHARMACOLOGIC;P",%="U":"UNKNOWN;U",1:"")
S GMRAL(GMRAREC)=GMRAL(GMRAREC)_"^"_$P(GMRANODE,"^",3)
Q:'$O(^GMR(120.8,GMRAREC,10,0)) ;QUIT IF NO SIGNS/SYMPTOMS
S:'$D(GMRAOTH) GMRAOTH=$O(^GMRD(120.83,"B","OTHER REACTION",0))
S GMRAX=0,GMRAY=1 F S GMRAX=$O(^GMR(120.8,GMRAREC,10,GMRAX)) Q:GMRAX<1 D I GMRAZ'="" S GMRAL(GMRAREC,"S",GMRAY)=GMRAZ(1),GMRAY=GMRAY+1
.S GMRAZ=$G(^GMR(120.8,GMRAREC,10,GMRAX,0))
.S GMRAZ(1)=$S(+GMRAZ'=GMRAOTH:$P($G(^GMRD(120.83,+GMRAZ,0)),U)_";"_+GMRAZ,1:$P(GMRAZ,U,2)_";"_+GMRAZ)
.Q
K GMRAX,GMRAY,GMRAZ
Q

View File

@ -0,0 +1,26 @@
C0QGMTSA ; SLC/DLT,KER - Brief Adverse Reaction/Allergy ; 02/27/2002
;;1.0;C0Q;;May 21, 2012;Build 63
;
; External References
; DBIA 10096 ^%ZOSF("TEST"
; DBIA 10099 EN1^GMRADPT **LOCAL NOW EN1^C0QGMRAD
;
ALLRG ; Allergies
N I,Z,X,SEQ,GMTSA,ALLRG K GMTSA S (SEQ,ALLRG)=0 S X="C0QGMRAD" X ^%ZOSF("TEST")
I $T D Q:$D(GMTSQIT)
. D GETALLRG I ALLRG D
. . D CKP^GMTSUP Q:$D(GMTSQIT) W ?3,"Allergy/Reaction: " D ALLRGP
Q
ALLRGP ; Allergy Print
D CKP^GMTSUP Q:$D(GMTSQIT) W ?21 S X=0
F I=0:0 S I=$O(GMTSA(I)) Q:I="" D Q:$D(GMTSQIT)
. S X=X+1 W:X>1 ", " W:(77)'>($X+$L(GMTSA(I))) !
. D CKP^GMTSUP Q:$D(GMTSQIT) W GMTSA(I)
Q:$D(GMTSQIT) D CKP^GMTSUP Q:$D(GMTSQIT) W ! Q
GETALLRG ; Get Allergies
N GMI,GMJ,GMRAL D EN1^C0QGMRAD I GMRAL="" S ALLRG=0 Q
I GMRAL="0" S ALLRG=1,GMTSA(1)="No Known Allergies" Q
S ALLRG=1,GMI=0 F S GMI=$O(GMRAL(GMI)) Q:GMI'>0 D
. S GMTSA(GMI)=$P(GMRAL(GMI),U,2)
. S GMJ=0 F S GMJ=$O(GMTSA(GMJ)) Q:GMJ'>0 I GMI'=GMJ,(GMTSA(GMI)=$G(GMTSA(GMJ))) K GMTSA(GMI) Q
Q

101
qrda/C0Q/trunk/p/C0QGMTSG.m Normal file
View File

@ -0,0 +1,101 @@
C0QGMTSG ; SLC/DLT,KER - Allergies ; 01/06/2003
;;1.0;C0Q;;May 21, 2012;Build 63
;
; External References
; DBIA 10096 ^%ZOSF("TEST"
; DBIA 10035 ^DPT(
; DBIA 905 ^GMR(120.8
; DBIA 2056 $$GET1^DIQ (file #120.86 and #200)
; DBIA 10011 ^DIWP
; DBIA 10099 EN1^GMRADPT **LOCAL changed to C0QGMRAD
; DBIA 10060 ^VA(200,
; DBIA 3449 ^GMR(120.86,
;
ALLRG ; Allergies
N X,GMTSALAS,GMTSALAD,GMTSALAW,GMTSALAT,GMTSAV,GMTSAFN,GMRAL,GMTSAL
N GMTSALNM,GMTSCNT,GMTSEACT,GMTSLN,GMTSMECH,GMTSPRT,GMTSTY,CC,C,KK
N ALLRG,TITLE,JJ K GMTSA S (SEQ,ALLRG)=0,TITLE="ALLERGY/ADVERSE REACTION (AR)"
S X="C0QGMRAD" X ^%ZOSF("TEST")
I $T D Q:$D(GMTSQIT)
. D GETALLRG D:ALLRG TITLE,ALLRGP D:'ALLRG&($L($G(GMTSALAS))) TITLE,NKA
I 'ALLRG,'$L($G(GMTSALAS)) D
. I $D(GMTSPNF)&('ALLRG) D CKP^GMTSUP Q:$D(GMTSQIT) W "Unknown, please evaluate",!
K ALL,CC,CCC,CD,DIWF,DIWL,DIWR,GMTSALF,GMTSALNM,GMTSNODE,GMTSPRT,I,II,JJ,KK,L,M,MX,N,Z,X,SEQ,GMTSA,ALLRG,TITLE,GMRA,GMRAL,GMTSEACT,GMTSMECH,GMTSTY,GMTSPFN,GMTSAL,GMTSCNT,GMTSLN,ODT
Q
ALLRGP ; Allergy Print
S II="" F S II=$O(GMTSAL(II)) Q:II']"" I $O(GMTSAL(II,""))]"" D
. D CKP^GMTSUP Q:$D(GMTSQIT) W !?2,$S(II="D":"Drug:",II="DF":"Drug/Food:",II="DFO":"Drug/Food/Other:",II="DO":"Drug/Other:",II="F":"Food:",II="FO":"Food/Other:",II="O":"Other:",1:II_":")
. S JJ="" F S JJ=$O(GMTSAL(II,JJ)) Q:JJ="" D
.. N WKK S KK="" F S KK=$O(GMTSAL(II,JJ,KK)) Q:KK="" D
... S L=0 F S L=$O(GMTSAL(II,JJ,KK,L)) Q:'L D CKP^GMTSUP Q:$D(GMTSQIT) D AUTOV W !?5,JJ_": " S:$L(KK)>30 WKK=KK,WKK=$$WRAP^GMTSORC(WKK,30) W ?24,$S($L(KK)>30:$P(WKK,"|"),1:KK) D
.... I GMTSAV=1 W " (AV"
.... E W $S($P(GMTSAL(II,JJ,KK,L),U,5)=1:" (V",$P(GMTSAL(II,JJ,KK,L),U,5)=0:" (NV",1:"")
.... W $S($P($G(^GMR(120.8,GMTSALNM,0)),U,6)="h":"/Historical)",$P($G(^(0)),U,6)="o":"/Observed)",1:")")
.... I $L($P($G(WKK),"|",2)) D CKP^GMTSUP Q:$D(GMTSQIT) W !,?24,$P(WKK,"|",2)
.... S (M,MX,ALL)=0 F S M=$O(GMTSAL(II,JJ,KK,L,"S",M)) Q:M="" D Q:$D(GMTSQIT)
..... I ALL=0 D CKP^GMTSUP Q:$D(GMTSQIT) W !?27
..... S MX=MX+1
..... W:MX>1 ", "
..... S N=$P(GMTSAL(II,JJ,KK,L,"S",M),";")
..... S ALL=1 I (74)'>($X+$L(N)) D CKP^GMTSUP Q:$D(GMTSQIT) W !,?27,N Q
..... S ALL=1 W N
.... D SIGBLK($P(GMTSAFN,U,5))
.... D CKP^GMTSUP Q:$D(GMTSQIT) W !,?24,"Date/Time: " S ODT=$P(GMTSAFN,U,4) S X=ODT D REGDTM4^GMTSU W X,!
....S CC="" F S CC=$O(^GMR(120.8,GMTSALNM,26,"B",CC)) Q:CC="" D CKP^GMTSUP Q:$D(GMTSQIT) W !,?24,"Comments at: " S X=CC D REGDTM4^GMTSU S CD=X S CCC=0 F S CCC=$O(^GMR(120.8,GMTSALNM,26,"B",CC,CCC)) Q:'CCC D TEXT
Q
NKA ; No known allergies
D CKP^GMTSUP Q:$D(GMTSQIT) W:$L($G(GMTSALAS))!($L($G(GMTSALAD))) !
D CKP^GMTSUP Q:$D(GMTSQIT) W:$L($G(GMTSALAS)) ?22,$G(GMTSALAS),!
D CKP^GMTSUP Q:$D(GMTSQIT) W:$L($G(GMTSALAS))!($L($G(GMTSALAD)))!($L($G(GMTSALAW))) ?24,"Assessment date: ",$G(GMTSALAD),!
D CKP^GMTSUP Q:$D(GMTSQIT) W:$L($G(GMTSALAW)) ?28,"Assessed by: ",GMTSALAW,!
D CKP^GMTSUP Q:$D(GMTSQIT) W:$L($G(GMTSALAW))&($L($G(GMTSALAT))) ?34,"Title: ",GMTSALAT,!
Q
GETALLRG ; Get Allergies
S GMRA="0^0^111^1" D EN1^C0QGMRAD I GMRAL="" S ALLRG=0 Q
I +($G(DFN))>0,+($G(GMRAL))=0 D ALLAS S ALLRG=0 Q
I $D(GMRAL)>9 D
. S I=0 F GMTSCNT=1:1 S I=$O(GMRAL(I)) Q:'I D
.. S GMTSTY=$P(GMRAL(I),U,7) Q:GMTSTY']""
.. S GMTSEACT=$P(GMRAL(I),U,2) Q:GMTSEACT']""
.. S GMTSMECH=$P($P(GMRAL(I),U,8),";")
.. S:GMTSMECH']"" GMTSMECH="UNKNOWN"
.. S GMTSAL(GMTSTY,GMTSMECH,GMTSEACT,GMTSCNT)=I_"^"_GMRAL(I)
.. S JJ=0 F S JJ=$O(GMRAL(I,"S",JJ)) Q:'JJ S GMTSAL(GMTSTY,GMTSMECH,GMTSEACT,GMTSCNT,"S",JJ)=GMRAL(I,"S",JJ)
.. S ALLRG=1
Q
ALLAS ; Allergy Assessment
N X,GMTSALG1,GMTSALG2,GMTSALG3,GMTSAU S (GMTSALAS,GMTSALAD,GMTSALAW)="" S GMTSALAS="No known allergies"
S GMTSALAD=$$GET1^DIQ(120.86,+($G(DFN)),3,"I",,"GMTSALG2") S:$D(GMTSALG2) GMTSALAD="" S:+GMTSALAD=0 GMTSALAD=""
I +GMTSALAD>0 S X=GMTSALAD D REGDT4^GMTSU S GMTSALAD=X
S GMTSAU=$$GET1^DIQ(120.86,+($G(DFN)),2,"I")
S GMTSALAW=$$GET1^DIQ(200,(+GMTSAU_","),.01,"E",,"GMTSALG3")
S GMTSALAT=$$GET1^DIQ(200,(+GMTSAU_","),20.3)
S:$D(GMTSALG3) (GMTSALAW,GMTSALAT)=""
Q
AUTOV ; Autoverify
S GMTSAV=0,GMTSALNM=$P(GMTSAL(II,JJ,KK,L),U),GMTSAFN=$G(^GMR(120.8,GMTSALNM,0))
I $P(GMTSAFN,U,18)="",$P(GMTSAFN,U,16)=1 S GMTSAV=1
Q
TITLE ; Print title
D CKP^GMTSUP Q:$D(GMTSQIT)
I $D(GMTSPNF) W ?21,TITLE,!
E W ?21,"Title: ",TITLE,!
Q
TEXT ; Setup for print of allergy comments
W ?31,CD D CKP^GMTSUP Q:$D(GMTSQIT)
K ^UTILITY($J,"W") S GMTSLN=0 F S GMTSLN=$O(^GMR(120.8,GMTSALNM,26,CCC,2,GMTSLN)) Q:'GMTSLN S GMTSPRT=^GMR(120.8,GMTSALNM,26,CCC,2,GMTSLN,0) D FORMAT
I $D(^UTILITY($J,"W")) F GMTSLN=1:1:^UTILITY($J,"W",DIWL) D LINE Q:$D(GMTSQIT)
K ^UTILITY($J,"W")
Q:'GMTSLN
W ! Q
FORMAT ; Formats each line
S DIWL=3,DIWR=80,DIWF="C58",X=GMTSPRT D ^DIWP
Q
LINE ; Writes formatted lines of text
D CKP^GMTSUP Q:$D(GMTSQIT) W !,?24,^UTILITY($J,"W",DIWL,GMTSLN,0)
Q
SIGBLK(GMTSALF) ; Signature block
Q:+GMTSALF'>0 N GMTSSB,GMTSST,GMTSSN S GMTSSB=$$GET1^DIQ(200,(+GMTSALF_","),20.2),GMTSST=$$GET1^DIQ(200,(+GMTSALF_","),20.3),GMTSSN=$$GET1^DIQ(200,(+GMTSALF_","),.01)
D CKP^GMTSUP Q:$D(GMTSQIT) W !!,?24,"Originator: ",$S(GMTSSB'="":GMTSSB,1:GMTSSN)
D CKP^GMTSUP Q:$D(GMTSQIT) W:$L(GMTSST) !,?24,"Title: ",GMTSST
Q

91
qrda/C0Q/trunk/p/C0QHF.m Normal file
View File

@ -0,0 +1,91 @@
C0QHF ; GPL - Health Factor Utility Routines ;9/02/11 17:05
;;1.0;C0Q;;May 21, 2012;Build 63
;Copyright 2011 George Lilly. Licensed under the terms of the GNU
;General Public License See attached copy of the License.
;
;This program is free software; you can redistribute it and/or modify
;it under the terms of the GNU General Public License as published by
;the Free Software Foundation; either version 2 of the License, or
;(at your option) any later version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License along
;with this program; if not, write to the Free Software Foundation, Inc.,
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
;
Q
;
; these routines are for quick lookups on HEALTH FACTOR and V HEALTH FACTOR
; files...
;
; from the DD:
;STANDARD DATA DICTIONARY #9000010.23 -- V HEALTH FACTORS FILE
;STORED IN ^AUPNVHF( (6744 ENTRIES)
;CROSS REFERENCED BY: PATIENT NAME(AATOO), HEALTH FACTOR(AATOO1), VISIT(AD),
; VISIT(AV10), HEALTH FACTOR(B), PATIENT NAME(C)
;
;STANDARD DATA DICTIONARY #9999999.64 -- HEALTH FACTORS FILE
;STORED IN ^AUTTHF( (8656 ENTRIES)
;CROSS REFERENCED BY: CATEGORY(AC), ENTRY TYPE(AD), FACTOR(B), SYNONYM(D)
;
HFYN(DFN,C0QHF) ; EXTRINSIC RETURNS 1 (YES) OR 0 (NO) IF A PATIENT
; HAS A HEALTH FACTOR
N ZI,ZJ,ZR
S ZI=$O(^AUTTHF("B",C0QHF,"")) ; HEALTH FACTOR IEN
I ZI="" D Q 0 ;
. W !,"BAD HEALTH FACTOR: ",C0QHF
I $D(^AUPNVHF("AA",DFN,ZI)) S ZR=1
E S ZR=0
Q ZR
;
HFIEN(ZHF) ; EXTRINSIC RETURNS THE IEN OF THE HEALTHFACTOR
N ZI
S ZI=$O(^AUTTHF("B",ZHF,"")) ; HEALTH FACTOR IEN
Q ZI
;
VHFIEN(DFN,ZHF) ; EXTRINSIC RETURNS THE LAST IEN OF THIS HEALTH FACTOR
; FOR THE PATIENT
N ZG,ZJ,ZK
S ZG=$$HFIEN(ZHF)
I ZG="" Q ; OPPS HEALTH FACTOR NOT FOUND
S ZJ=$O(^AUPNVHF("AA",DFN,ZG,""),-1) ;DATE
S ZK=$O(^AUPNVHF("AA",DFN,ZG,ZJ,"")) ;IEN
Q ZK
;
HFCAT(RTN,DFN,C0QHFCAT) ; C0QFHCAT IS A HEALTH FACTOR CATEGORY
; RTN IS PASSED BY REFERENCE AND RETURNS AN ARRAY OF HEALTH FACTORS
; THAT THE PATIENT HAS IN THE CATEGORY. RETURNS NULL IF NONE
; FORMAT RNT(HEALTH FACTOR IEN,HEALTH FACTOR NAME)=""
N ZI
S ZI=$O(^AUTTHF("B",C0QHFCAT,"")) ; HEALTH FACTOR CATEGORY IEN
N C0QN,C0QO,C0QR
S C0QO=$NA(^AUPNVHF("AA",DFN)) ; ALL THE PATIENT'S HEALTH FACTORS
S C0QN=$NA(^AUTTHF("AC",ZI)) ; ALL HEALTH FACTORS IN THIS CATEGORY
D UNITY^C0QSET("C0QR",C0QN,C0QO) ; THE DIFFERENCE
K RTN ; CLEAR THE RETURN ARRAY
N ZJ S ZJ=""
F S ZJ=$O(C0QR(1,ZJ)) Q:ZJ="" D ; FOR ALL HEALTH FACTOR MATCHES
. S RTN(ZJ,$P(^AUTTHF(ZJ,0),"^",1))=""
Q
;
HFLCAT(RTN,C0QHFCAT) ; RETURNS A LIST OF PATIENTS WHO HAVE A HEALTH FACTOR
; IN THE C0QHFCAT CATEGORY. RTN IS PASSED BY REFERENCE
; THIS WILL BE HARD TO DO WITHOUT SOME NEW INDEXES
Q
;
HFLPAT(RTN,C0QHF) ; RETURNS A LIST OF PATIENTS WHO HAVE A SPECIFIC HEALTH
; FACTOR. RTN IS PASSED BY REFERENCE
; THIS ONE ALSO WILL BE HARD TO DO QUICKLY WITHOUT A NEW INDEX
Q
;
INDEXES(DDREF) ;PRINT THE INDEXES ACTUALLY ON FILE DDREF
; IE D INDEXES($NA(^DD))
N ZI
S ZI="A"
F S ZI=$O(@DDREF@(ZI)) Q:ZI="" W !,ZI
Q
;

View File

@ -0,0 +1,57 @@
C0QIMMUN ;Prep Immunization Order data for HL7 Message creation ; 5/23/12 5:40pm
;;1.0;C0Q;;May 21, 2012;Build 63
; ^XTMP("C0QIMMUN",0)=purge date^create date
; ^XTMP("C0QIMMUN",order_date,order#,item_name)=item_value
; ^XTMP("C0QIMMUN","LASTORDR")=last order processed
; Changed by VEN/SMH to add timeout to the locks on May 23 2012
FIND ; Find the next set of immunization orders
N X1,X2,X,%,%DT,%H,%T,NOW,ORDER,LASTORDR,SUBSC,DIR
S LASTORDR=+$G(^XTMP("C0QIMMUN","LASTORDR"))
N C0QFAIL S C0QFAIL=0 ; Lock fail flag
W !,"The ""Last Order"" from which to begin checking for Immunization orders is: ",LASTORDR
S DIR("A")="Do you want to reset that value"
S DIR(0)="Y",DIR("B")="NO" D ^DIR D:Y=1
. S DIR("A")="What value shall be used?"
. S DIR(0)="NO",DIR("B")=LASTORDR D ^DIR
. W:Y'>0 !,"We'll skip reseting it then."
. D:Y>0
. . S LASTORDR=+Y
. . L +^XTMP("C0QIMMUN"):0
. . E S C0QFAIL=1 QUIT
. . S X1=DT,X2=365 D C^%DTC
. . S ^XTMP("C0QIMMUN",0)=X_U_DT
. . S ^XTMP("C0QIMMUN","LASTORDR")=LASTORDR
. . L -^XTMP("C0QIMMUN")
. . Q
. Q
I C0QFAIL W !,"Failed to acquire lock, exiting..." QUIT
S DIR("A")="Ready to prep more immunization orders for HL7 messages"
S DIR(0)="Y",DIR("B")="YES" D ^DIR Q:Y'=1
L +^XTMP("C0QIMMUN"):0
E W !,"Failed to acquire lock; exiting..." QUIT
I '$D(^XTMP("C0QIMMUN",0)) D
. S X1=DT,X2=365 D C^%DTC
. S ^XTMP("C0QIMMUN",0)=X_U_DT
. S ^XTMP("C0QIMMUN","LASTORDR")=0
S ORDER=^XTMP("C0QIMMUN","LASTORDR")
F S ORDER=$O(^OR(100,ORDER)) Q:ORDER'>0 D
. S LASTORDR=ORDER
. D:$D(^OR(100,ORDER,4.5,"ID","ORZ HL7")) GOTONE
. Q
S ^XTMP("C0QIMMUN","LASTORDR")=LASTORDR
W !,"Done",!,"Last Order processed: ",LASTORDR,!
L -^XTMP("C0QIMMUN")
Q
GOTONE ; Take the order number and move the relevant HL7 information into ^XTMP
S NOW=$P(^OR(100,ORDER,0),U,7)
S ^XTMP("C0QIMMUN",NOW,ORDER,"PATIENT")=$P(^OR(100,ORDER,0),U,2)
S ^XTMP("C0QIMMUN",NOW,ORDER,"LOCATION")=$P(^OR(100,ORDER,0),U,10)
S ^XTMP("C0QIMMUN",NOW,ORDER,"ORDEREDBY")=$P(^OR(100,ORDER,0),U,6)
S ENTRY=0 F S ENTRY=$O(^OR(100,ORDER,4.5,ENTRY)) Q:ENTRY'>0 D
. S SUBSC=$P($G(^OR(100,ORDER,4.5,ENTRY,0)),U,4)
. Q:'$L(SUBSC)
. I SUBSC'="TIME" S ^XTMP("C0QIMMUN",NOW,ORDER,SUBSC)=^OR(100,ORDER,4.5,ENTRY,1)
. E S X=^OR(100,ORDER,4.5,ENTRY,1),%DT="TS" D ^%DT S ^XTMP("C0QIMMUN",NOW,ORDER,SUBSC)=Y
. Q
S ^XTMP("C0QIMMUN",NOW,ORDER,"ORDERTEXT")=$G(^OR(100,ORDER,8,1,.1,1,0))
Q

View File

@ -0,0 +1,72 @@
C0QINIT ; GPL - Quality Reporting Initialization Routines ; 7/31/12 8:16am
;;1.0;C0Q;;May 21, 2012;Build 63
;Copyright 2011 George Lilly. Licensed under the terms of the GNU
;General Public License See attached copy of the License.
;
;This program is free software; you can redistribute it and/or modify
;it under the terms of the GNU General Public License as published by
;the Free Software Foundation; either version 2 of the License, or
;(at your option) any later version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License along
;with this program; if not, write to the Free Software Foundation, Inc.,
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
;
Q
;
C0QQFN() Q 1130580001.101 ; FILE NUMBER FOR C0Q QUALITY MEASURE FILE
C0QMFN() Q 1130580001.201 ; FILE NUMBER FOR C0Q MEASUREMENT FILE
C0QMMFN() Q 1130580001.2011 ; FN FOR MEASURE SUBFILE
C0QMMNFN() Q 1130580001.20111 ; FN FOR NUMERATOR SUBFILE
C0QMMDFN() Q 1130580001.20112 ; FN FOR DENOMINATOR SUBFILE
RLSTFN() Q 810.5 ; FN FOR REMINDER PATIENT LIST FILE
RLSTPFN() Q 810.53 ; FN FOR REMINDER PATIENT LIST PATIENT SUBFILE
C0QALFN() Q 1130580001.311 ; FILE NUMBER FOR C0Q PATIENT LIST PATIENT SUBFILE ;
;
COPYQ ; INTERACTIVE COPY OF A QUALITY MEASURE
N FN
S FN=$$C0QQFN
S DIC=FN,DIC(0)="AEMQ" D ^DIC
I Y<1 Q ; EXIT
S C0QIEN=$P(Y,U)
;N G,ZWP
D GETS^DIQ(FN,C0QIEN,"**","EI","G")
M ZWP=G(FN,C0QIEN_",",.61)
; GET READY TO CREATE THE NEW COPY
; FIRST FIND OUT THE NEW NAME
N QNAME
S QNAME=G(FN,C0QIEN_",",.01,"E")
S DIR(0)="F^3:240"
S DIR("A")="New Measure Name"
S DIR("B")=QNAME
D ^DIR
I Y="^" Q ;
N QNEW
S QNEW=Y
K C0QFDA
N ZI S ZI=""
F S ZI=$O(G(FN,C0QIEN_",",ZI)) Q:ZI="" D ; FOR EACH FIELD
. I ZI=.01 D Q ; THE NEW NAME
. . S C0QFDA(FN,"+1,",.01)=QNEW ; NEW MEASURE NAME
. I ZI=3.1 Q ; SKIP THE COMPUTED FIELD
. S C0QFDA(FN,"+1,",ZI)=G(FN,C0QIEN_",",ZI,"I")
D UPDIE ; CREATE THE NEW RECORD
S DIE=$$C0QQFN ; GET READY TO EDIT IT
D EN^DIB ; EDIT THE NEW RECORD
Q
;
UPDIE ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS
K ZERR
D CLEAN^DILF
D ZWRITE^C0QUTIL("C0QFDA")
D UPDATE^DIE("","C0QFDA","","ZERR")
I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST,
; INVOKE THE ERROR TRAP IF TASKED
K C0QFDA
Q
;

214
qrda/C0Q/trunk/p/C0QKIDS.m Normal file
View File

@ -0,0 +1,214 @@
C0QKIDS ; VEN/SMH - Kids Utilities for transporting C0Q data ; 7/31/12 3:01pm
;;1.0;C0Q;;May 21, 2012;Build 63
; Licensed under package license. See Documentation.
;
; PEPs: TRAN, POST, PRE
;
TRAN ; Unified Transport; PEP
; D TRAN301 ; looks like I won't send that file over
D TRAN201 ; C0Q MEASUREMENT
D TRAN101 ; C0Q QUALITY MEASURE
QUIT
POST ; Unified Post; PEP
; D POST301 ; looks like I won't send that file over
; D POST101 ; C0Q QUALITY MEASURE ; As of T11, I won't do that anymore. -->
; I discovered that it will do it on destination systems that are set-up.
; So bad bad bad idea for me to do it in a post-init.
; ... I wrote TRAN101 to do the function of POST101.
D POST201 ; C0Q MEASUREMENT
QUIT
;
PRE ; Unified Pre; PEP
D PRE101
QUIT
;
; << >>
;
TRAN101 ; Remove Untransportable pointers in C0Q QUALITY MEASURE; Private EP
; NB: I am reaching into KIDS's data here. This may not work for future versions
; of KIDS. However, I am exporting this only; once exported, it should work in
; any version of KIDS.
N XPDIEN S XPDIEN=$QS(XPDGREF,2) ; Get IEN of KIDS Transport Global
N X S X=$NA(^XTMP("XPDT",XPDIEN,"DATA",1130580001.101)) ; KIDS transports our data here
N IEN S IEN=0 ; Looper
F S IEN=$O(@X@(IEN)) Q:'IEN D ; For each IEN, remove the following:
. S $P(@X@(IEN,0),U,2)="" ; Numerator Patient List
. S $P(@X@(IEN,0),U,3)="" ; Denominator Patient List
. S $P(@X@(IEN,7),U,4)="" ; Negative Numerator List
. S $P(@X@(IEN,7),U,2)="" ; Alternate Numerator List
. S $P(@X@(IEN,7),U,3)="" ; Alternate Denominator List
. S $P(@X@(IEN,7),U,5)="" ; Alternate Negative Numerator List
QUIT
;
TRAN301 ; Grab FDA for entire file C0Q PATIENT LIST and store in Transport Global; Private EP
; Not used. Dead code.
N C0QIEN S C0QIEN=0 ; IEN walker
N C0QREF1 S C0QREF1=$NAME(^TMP("C0QOLD",$J)) ; Temporary Global Reference
N C0QREF2 S C0QREF2=$NAME(^TMP("C0QNEW",$J)) ; Temporary Global Reference
K @C0QREF1,@C0QREF2 ; Kill that
F S C0QIEN=$O(^C0Q(301,C0QIEN)) Q:'+C0QIEN D
. D GETS^DIQ(1130580001.301,C0QIEN_",","*","",C0QREF1) ; Load FDA's in there
. M @C0QREF2@(1130580001.301,"?+"_C0QIEN_",")=@C0QREF1@(1130580001.301,C0QIEN_",") ; Change IENs to ?+ IENs
M @XPDGREF@("C0Q","1130580001.301")=@C0QREF2 ; Put in Transport Global
K @C0QREF1,@C0QREF2 ; Remove
QUIT
;
TRAN201 ; Grab FDA for 201 C0Q MEASUREMENTS selected fields; Private EP
N C0QIEN S C0QIEN=0 ; IEN walker
N C0QREF1 S C0QREF1=$NAME(^TMP("C0QOLD",$J)) ; Temporary Global Reference
N C0QREF2 S C0QREF2=$NAME(^TMP("C0QNEW",$J)) ; Temporary Global Reference
K @C0QREF1,@C0QREF2 ; Kill that
;
; We need C0QCOUNT so that it wouldn't reuse the numbers, b/c updater wants numbers for every different item
N C0QCOUNT S C0QCOUNT=$O(^C0Q(201," "),-1) ; Counter for SubIENs for destination array; init at highest IEN to prevent dups
F S C0QIEN=$O(^C0Q(201,C0QIEN)) Q:'+C0QIEN D ; Walk IENs
. W "Exporting "_C0QIEN,!
. ; Fields SET NAME, BEGIN DATE, END DATE, LOCKED, USE ALL MEASURES, MU YEAR KEY
. D GETS^DIQ(1130580001.201,C0QIEN_",",".01;.02;.03;.05;.2;.3","",C0QREF1)
. M @C0QREF2@(1130580001.201,"?+"_C0QIEN_",")=@C0QREF1@(1130580001.201,C0QIEN_",") ; Change IENs to ?+ IENs
. N C0QIEN2 S C0QIEN2=0 ; Subfile walker
. F S C0QIEN2=$O(^C0Q(201,C0QIEN,5,C0QIEN2)) Q:'+C0QIEN2 D ; MEASURE subfile
. . W "Exporting IENS "_C0QIEN2_","_C0QIEN_",",!
. . D GETS^DIQ(1130580001.2011,C0QIEN2_","_C0QIEN_",",".01","",C0QREF1) ; MEASURE (#.01)
. . S C0QCOUNT=C0QCOUNT+1 ; Increment the counter for SubIEN (can't reuse)
. . M @C0QREF2@(1130580001.2011,"?+"_C0QCOUNT_","_"?+"_C0QIEN_",")=@C0QREF1@(1130580001.2011,C0QIEN2_","_C0QIEN_",") ; as above
;
M @XPDGREF@("C0Q","1130580001.201")=@C0QREF2 ; Put in transport global
K @C0QREF1,@C0QREF2 ; Remove temp
QUIT
;
POST201 ; File FDA for 201; Private EP
;
; Clean-up data if it already exists!
; ZWRITE ^C0Q(201,:,5,:,0)
; ^C0Q(201,1,5,599,0)=50
; ^C0Q(201,1,5,600,0)=4
; ^C0Q(201,1,5,601,0)=39
; ^C0Q(201,1,5,602,0)=6
; ^C0Q(201,1,5,603,0)=7
; ^C0Q(201,1,5,604,0)=48
; ^C0Q(201,1,5,605,0)=46
;
IF $O(^C0Q(201,0)) DO QUIT ; Quit if data is already there.
. D MES^XPDUTL("Data exists in file C0Q MEASUREMENTS... Not adding new data")
. D MES^XPDUTL("Cleaning up broken pointers in C0Q MEASUREMENTS from deleted data in C0Q QUALITY MEASURE")
. ; This is very hairy code. Run through the 5 multiple in C0Q MEASUREMENT
. ; Grab the IEN in the .01, check if it exists; if not, kill.
. N DA,DIK ; DIK Variables; as well as our looper variables
. S (DA,DA(1))=0 ; Initial looper values
. F S DA(1)=$O(^C0Q(201,DA(1))) Q:'DA(1) D ; Loop through entries
. . D MES^XPDUTL("...Processing entry "_$P(^C0Q(201,DA(1),0),U)) ; msg
. . S DIK="^C0Q(201,"_DA(1)_",5," ; deletion root for the next loop
. . F S DA=$O(^C0Q(201,DA(1),5,DA)) Q:'DA D ; For each Measure
. . . N IEN S IEN=+^C0Q(201,DA(1),5,DA,0) ; Get IEN
. . . I IEN,'$D(^C0Q(101,IEN)) D ; If IEN is numeric, IEN exists in dest file
. . . . D MES^XPDUTL("......Deleting broken pointer "_IEN) ; msg
. . . . D ^DIK ; delete
;
; If new install, add data
;
D MES^XPDUTL("Adding data to C0Q MEASUREMENTS")
N C0QFDA S C0QFDA=$NAME(@XPDGREF@("C0Q","1130580001.201")) ; Grab FDA from Transport Global
N C0QERR ; Error array for filer
D UPDATE^DIE("E",C0QFDA,"","C0QERR") ; File all
I $D(C0QERR) D ; if there's an error, print it out
. D MES^XPDUTL("Couldn't add data into C0Q MEASUREMENTS")
. S C0QERR=$Q(C0QERR)
. F S C0QERR=$Q(@C0QERR) Q:C0QERR="" D MES^XPDUTL(C0QERR_": "_@C0QERR)
QUIT
;
POST301 ; Get FDA from Transport Global and install in destination system for C0Q PATIENT LIST; Private EP
; Not used. Dead code.
N C0QFDA S C0QFDA=$NAME(@XPDGREF@("C0Q","1130580001.301")) ; FDA array name is the global reference
N C0QERR ; Error
D UPDATE^DIE("E",C0QFDA,"","C0QERR") ; File all
I $D(C0QERR) D ; if there's an error, print it out
. D MES^XPDUTL("Couldn't add data into C0Q PATIENT LIST file")
. S C0QERR=$Q(C0QERR)
. F S C0QERR=$Q(@C0QERR) Q:C0QERR="" D MES^XPDUTL(C0QERR_": "_@C0QERR)
QUIT
;
PRE101 ; Clean existing data (from an earlier installation) from measures that are now merged to other measures
; in C0Q QUALITY MEASURE in destination systems; Private EP
;
; Quit if C0Q Quality Measures isn't on the system.
Q:'$D(^C0Q(101))
;
D MES^XPDUTL("Removing subsumed entries in C0Q QUALITY MEASURE")
;
; .01 field values to for records to remove
N C0QLIST
S C0QLIST("TEST M0028A")=""
S C0QLIST("MU EP 0028B")=""
S C0QLIST("M0013")=""
S C0QLIST("M0024")=""
S C0QLIST("M1")=""
S C0QLIST("M3")=""
S C0QLIST("M2")=""
S C0QLIST("M0028")=""
S C0QLIST("M111")=""
S C0QLIST("M112")=""
S C0QLIST("M113")=""
S C0QLIST("M128")=""
S C0QLIST("M5")=""
S C0QLIST("M7")=""
S C0QLIST("M0022")=""
S C0QLIST("12")=""
S C0QLIST("M0038")=""
S C0QLIST("M110")=""
S C0QLIST("MU EP NQF 0070")=""
;
; Root for ^DIK
N DIK S DIK="^C0Q(101,"
;
; Loop through list, find IEN for each one, kill off
N C0QITEM S C0QITEM="" ; Item
F S C0QITEM=$O(C0QLIST(C0QITEM)) Q:C0QITEM="" D ; Loop
. Q:'$DATA(^C0Q(101,"B",C0QITEM)) ; Quit if not present.
. N DA S DA=$O(^C0Q(101,"B",C0QITEM,"")) ; IEN
. ; The original software has MU EP NQF 0070 incorrectly. If the 1 node
. ; has Pneumonia, we want to remove that entry.
. I C0QITEM="MU EP NQF 0070",^C0Q(101,DA,1)'["Pneumonia" QUIT
. D MES^XPDUTL("...Removing "_C0QITEM) ; Message to user
. D ^DIK ; Delete
;
REN ; Rename a bunch of entries
; ("OLD NAME")="NEW NAME"
D MES^XPDUTL("Renaming Old entries in C0Q QUALITY MEASURE")
;
N C0QLIST
S C0QLIST("NQF0038 NUM1 DPT")="MU EP NQF 0038 NUM1 DPT"
S C0QLIST("NQF0038 NUM10")="MU EP NQF 0038 NUM10 FLU"
S C0QLIST("NQF0038 NUM11 COMBO5")="MU EP NQF 0038 NUM11 COMBO5"
S C0QLIST("NQF0038 NUM12 COMBO6")="MU EP NQF 0038 NUM12 COMBO6"
S C0QLIST("NQF0038 NUM2 IPV")="MU EP NQF 0038 NUM2 IPV"
S C0QLIST("NQF0038 NUM3 MMR")="MU EP NQF 0038 NUM3 MMR"
S C0QLIST("NQF0038 NUM4 HiB")="MU EP NQF 0038 NUM4 HiB"
S C0QLIST("NQF0038 NUM5 HEP B")="MU EP NQF 0038 NUM5 HEP B"
S C0QLIST("NQF0038 NUM6 VZV")="MU EP NQF 0038 NUM6 VZV"
S C0QLIST("NQF0038 NUM7 PCV")="MU EP NQF 0038 NUM7 PCV"
S C0QLIST("NQF0038 NUM8 HEP A")="MU EP NQF 0038 NUM8 HEP A"
S C0QLIST("NQF0038 NUM9")="MU EP NQF 0038 NUM9 RV"
S C0QLIST("M124")="PQRI MEASURE 124"
S C0QLIST("M173")="PQRI MEASURE 173"
S C0QLIST("M39")="PQRI MEASURE 39"
S C0QLIST("M47")="PQRI MEASURE 47"
S C0QLIST("M48")="PQRI MEASURE 48"
;
N C0QITEM S C0QITEM="" ; Item
N C0QFDA ; FDA
F S C0QITEM=$O(C0QLIST(C0QITEM)) Q:C0QITEM="" D ; Loop through
. N IEN S IEN=$O(^C0Q(101,"B",C0QITEM,"")) ; Get IEN from File using old name
. I IEN S C0QFDA(1130580001.101,IEN_",",.01)=C0QLIST(C0QITEM) ; If found, put new name in FDA for this IEN
. I IEN D MES^XPDUTL("...Renaming "_C0QITEM_" to "_C0QLIST(C0QITEM)) ; Print message to user
;
N C0QERR ; Error for FILE^DIE
I $D(C0QFDA) D FILE^DIE("E",$NA(C0QFDA),$NA(C0QERR)) ; File if FDA has contents
E D MES^XPDUTL("No entries to rename") ; If nothing, tell user so
;
D:$D(C0QERR) ; If Error, print it
. D MES^XPDUTL("Error Filing Data. FILE^DIE reported:")
. N REF S REF=$NA(C0QERR) ; $Q Reference
. F S REF=$Q(@REF) Q:REF="" D MES^XPDUTL(REF_"="_@REF) ; Loop and Print
;
QUIT

356
qrda/C0Q/trunk/p/C0QMAIN.m Normal file
View File

@ -0,0 +1,356 @@
C0QMAIN ; GPL - Quality Reporting Main Processing ;10/13/10 17:05
;;1.0;C0Q;;May 21, 2012;Build 63
;Copyright 2009 George Lilly. Licensed under the terms of the GNU
;General Public License See attached copy of the License.
;
;This program is free software; you can redistribute it and/or modify
;it under the terms of the GNU General Public License as published by
;the Free Software Foundation; either version 2 of the License, or
;(at your option) any later version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License along
;with this program; if not, write to the Free Software Foundation, Inc.,
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
;
Q
;
C0QQFN() Q 1130580001.101 ; FILE NUMBER FOR C0Q QUALITY MEASURE FILE
C0QMFN() Q 1130580001.201 ; FILE NUMBER FOR C0Q MEASUREMENT FILE
C0QMMFN() Q 1130580001.2011 ; FN FOR MEASURE SUBFILE
C0QMMNFN() Q 1130580001.20111 ; FN FOR NUMERATOR SUBFILE
C0QMMDFN() Q 1130580001.20112 ; FN FOR DENOMINATOR SUBFILE
RLSTFN() Q 810.5 ; FN FOR REMINDER PATIENT LIST FILE
RLSTPFN() Q 810.53 ; FN FOR REMINDER PATIENT LIST PATIENT SUBFILE
C0QALFN() Q 1130580001.311 ; FILE NUMBER FOR C0Q PATIENT LIST PATIENT SUBFILE ;
EXPORT ; EXPORT ENTRY POINT FOR CCR
; Select a patient.
N C0QMS,C0QM,C0QMIEN,C0QNA,C0QNORD
S C0QNORD=3 ; WE WANT DENOMINATORS USE 1 FOR NUMERATORS
S DIC=$$C0QMFN,DIC(0)="AEMQ" D ^DIC
I Y<1 Q ; EXIT
S C0QMS=$P(Y,U,1) ; SET THE MEASURE SET
S DIC=$$C0QQFN,DIC(0)="AEMQ" D ^DIC
I Y<1 Q ; EXIT
S C0QM=$P(Y,U,1) ; SET THE MEASURE IEN
N C0QMN S C0QMN=$P(Y,U,2) ; SET THE MEASURE NAME
S C0QMIEN=$O(^C0Q(201,C0QMS,5,"B",C0QM,""))
S C0QNA=$NA(^C0Q(201,C0QMS,5,C0QMIEN,C0QNORD,"B"))
N ZI S ZI=""
F S ZI=$O(@C0QNA@(ZI)) Q:ZI="" D ;
. W !,ZI
. N ONAME S ONAME=C0QMN_"_"_ZI_"_CCR_V1_0_0.xml"
. D XPAT^C0CCCR(ZI,,,ONAME) ; EXPORT TO A FILE
Q
;
NBYP ; ENTRY POINT FOR COMMAND LINE BY PATIENT MEASURE LISTING
;
S DIC=$$C0QMFN,DIC(0)="AEMQ" D ^DIC
I Y<1 Q ; EXIT
N MSIEN S MSIEN=+Y
W !,"NUMERATOR PATIENT LIST",!
N C0QPAT
D PATS(.C0QPAT,MSIEN,"N") ; GET THE NUMERATOR PATIENT LIST
I $D(C0QPAT) D ; LIST RETURNED
. ;
Q
;
DBYP ; ENTRY POINT FOR COMMAND LINE BY PATIENT MEASURE LISTING
;
S DIC=$$C0QMFN,DIC(0)="AEMQ" D ^DIC
I Y<1 Q ; EXIT
N MSIEN S MSIEN=+Y
N C0QPAT
W !,"DENOMINATOR PATIENT LIST",!
D PATS(.C0QPAT,MSIEN,"D") ; GET THE NUMERATOR PATIENT LIST
I $D(C0QPAT) D ; LIST RETURNED
. ;
. ;
Q
;
ENEXP ; EXTERNAL MENU ENTRY POINT FOR EXP
;
S DIC=$$C0QMFN,DIC(0)="AEMQ" D ^DIC
I Y<1 Q ; EXIT
N MSIEN S MSIEN=+Y
D EXP(MSIEN)
Q
;
EXP(MSET,NOEX) ; EXPORT ALL PATIENTS FOR MEASURE SET IEN MSET
; ALSO, WRITE OUT THE BY PATIENT MEASURE TEXT FILE
; IF NOEX=1, THEN ONLY THE MEASURE TEXT FILE GETS WRITTEN, NO EXPORTS ARE
; DONE
I '$D(NOEX) S NOEX=0
N ZQI,ZARY,ZFN,ODIR
S ZQI=""
D PATS(.ZARY,MSET,"D",1)
S ZFN="MEASURES-BY-PATIENT.txt"
S ODIR=^TMP("C0CCCR","ODIR") ; OUTPUT DIRECTORY
S GARY=$NA(^TMP("C0Q",$J))
K @GARY
M @GARY=ZARY
S GARY1=$NA(@GARY@(1))
N ZY
S ZY=$$OUTPUT^C0CXPATH(GARY1,ZFN,ODIR)
W !,ZY
I NOEX=1 Q ; DO NOT EXPORT
F S ZQI=$O(ZARY(ZQI)) Q:ZQI="" D ; FOR EACH PATIENT
. D XPAT^C0CCCR(+ZARY(ZQI)) ;
Q
;
PATS(ZRTN,MSIEN,NORD,QT) ; BUILDS A LIST OF PATIENTS AND THEIR MEASURES
; FOR MEASURE SET MSET. NORD="N" (DEFAULT) MEANS NUMERATOR PATIENTS
; NORD="D" MEANS DENOMINATOR PATIENTS
; QT=1 MEANS QUIET
I $G(QT)'=1 S QT=0
N ZI,ZJ,ZK,ZIDX,ZN,ZM
S ZN=0 ; COUNT OF PATIENTS
S ZI=""
; GOING TO USE THE NUMERATOR BY PATIENT INDEX
I '$D(NORD) S NORD="N"
I '((NORD="N")!(NORD="D")) S NORD="N"
I NORD="N" S ZIDX=$NA(^C0Q(201,"ANBYP"))
E S ZIDX=$NA(^C0Q(201,"ADBYP"))
F S ZI=$O(@ZIDX@(ZI)) Q:ZI="" D ; FOR EACH PATIENT
. I $O(@ZIDX@(ZI,MSIEN,""))'="" D ; IF PATIENT IS IN THIS SET
. . I 'QT W !,$$GET1^DIQ(2,ZI_",",.01) ;PATIENT NAME
. . S ZN=ZN+1 ; INCREMENT PATIENT COUNT
. . S ZRTN(ZN)=ZI
. E Q ; NEXT PATIENT
. S (ZJ,ZK)=""
. F S ZJ=$O(@ZIDX@(ZI,MSIEN,ZJ)) Q:ZJ="" D ; FOR EACH MEASURE
. . ;S ZL=$O(@ZIDX@(ZI,MSIEN,ZJ,"")) ; MEASURE IS FOURTH
. . S ZK=""
. . S ZK=$$GET1^DIQ($$C0QMMFN,ZJ_","_MSIEN_",",.01,"I")
. . ;W !,"ZK:",ZK," ZJ:",ZJ," ZI",ZI,!
. . S ZM=$$GET1^DIQ($$C0QQFN,ZK_",",.01) ; MEASURE NAME
. . I 'QT W " ",ZM
. . S ZRTN(ZN)=ZRTN(ZN)_" "_ZM
Q
;
EN ; ENTRY POINT FOR COMMAND LINE AND MENU ACCESS TO C0QRPC
;
S DIC=$$C0QMFN,DIC(0)="AEMQ" D ^DIC
I Y<1 Q ; EXIT
N MSIEN S MSIEN=+Y
;D C0QRPC(.G,MSIEN)
D UPDATE^C0QUPDT(.G,MSIEN)
Q
;
EN2 ; SUMMARY ENTRY POINT FOR COMMAND LINE AND MENU ACCESS TO C0QRPC
;
S DIC=$$C0QMFN,DIC(0)="AEMQ" D ^DIC
I Y<1 Q ; EXIT
N MSIEN S MSIEN=+Y
; changed by gpl to call the new UPDATE^C0QUPDT routine instead
D UPDATE^C0QUPDT(.G,MSIEN)
Q
; end gpl change
S C0QSUM=1
D C0QRPC(.G,MSIEN)
; iterate over the measures
S MEASURE=0
F S MEASURE=$O(^C0Q(201,MSIEN,5,MEASURE)) Q:MEASURE'>0 D
. S NUMER=0,DENOM=0
. ; now count the numerator patients
. S P=0 F S P=$O(^C0Q(201,MSIEN,5,MEASURE,1,P)) Q:P'>0 S NUMER=NUMER+1
. S $P(^C0Q(201,MSIEN,5,MEASURE,2),U)=NUMER
. ; and count the denominator patients
. S P=0 F S P=$O(^C0Q(201,MSIEN,5,MEASURE,3,P)) Q:P'>0 S DENOM=DENOM+1
. Q:DENOM=0
. ; and stuff the values
. S $P(^C0Q(201,MSIEN,5,MEASURE,4),U,1,2)=DENOM_U_$J(100*NUMER/DENOM,0,0)
. Q
Q
;
C0QRPC(RTN,MSET,FMT,NOPURGE) ; RPC FORMAT
; MSET IS THE NAME OR IEN OF THE MEASURE SET
; RTN IS THE RETURN ARRAY OF THE RESULTS PASSED BY REFERENCE
; FMT IS THE FORMAT OF THE OUTPUT - "ARRAY" OR "HTML" OR "XML"
; NOTE: ARRAY IS DEFAULT AND THE OTHERS ARE NOT IMPLEMENTED YET
; IF NOPURGE IS 1, PATIENT LISTS WILL NOT BE DELETED BEFORE ADDING
; IF NOPURGE IS 0 OR OMITTED, PATIENT LISTS WILL BE DELETED THEN ADDED
;W !,"LOOKING FOR MEASURE SET ",MSET,!
N ZI S ZI=""
N C0QM ; FOR HOLDING THE MEASURES IN THE SET
D LIST^DIC($$C0QMMFN,","_MSET_",",".01I") ; GET ALL THE MEASURES
D DELIST("C0QM")
N ZII S ZII=0
F S ZII=$O(C0QM(ZII)) Q:+ZII=0 D ; FOR EACH MEASURE
. D CLEARMEA(MSET,ZII) ; FIRST CLEAR OUT THE MEASURE
K C0QM
D CLEAN^DILF
D LIST^DIC($$C0QMMFN,","_MSET_",",".01I") ; GET ALL THE MEASURES AGAIN
D DELIST("C0QM")
F S ZII=$O(C0QM(ZII)) Q:ZII="" D ; FOR EACH MEASURE
. S ZI=$P(C0QM(ZII),U,1) ; IEN OF THE MEASURE IN THE C0Q QUALITY MEAS FILE
. ;W $$GET1^DIQ($$C0QQFN,ZI_",","DISPLAY NAME"),!
. ;N C0QNL,C0QDL ;NUMERATOR AND DENOMINATOR LIST POINTERS
. ;W !,"MEASURE: ",$$GET1^DIQ($$C0QQFN,ZI_",",.01),! ; PRINT THE MEASURE NAME
. ; FOLLOW THE POINTERS TO THE C0Q QUALITYM MEASURE FILE AND GET LIST PTRS
. S C0QNL=$$GET1^DIQ($$C0QQFN,ZI_",",1,"I") ; NUMERATOR POINTER
. I C0QNL="" D ; CHECK ALTERNATE LIST
. . S C0QNL=$$GET1^DIQ($$C0QQFN,ZI_",",1.1,"I") ; NUMERATOR POINTER
. . I C0QNL'="" S C0QNALT=1
. S C0QDL=$$GET1^DIQ($$C0QQFN,ZI_",",2,"I") ; DENOMINATOR POINTER
. I C0QDL="" D ; CHECK ALTERNATE LIST
. . S C0QDL=$$GET1^DIQ($$C0QQFN,ZI_",",2.1,"I") ; DENOMINATOR POINTER
. . I C0QDL'="" S C0QDALT=1
. ; NOW FOLLOW THE LIST POINTERS TO THE REMINDER PATIENT LIST FILE
. ;W "NUMERATOR: ",$$GET1^DIQ($$RLSTFN,C0QNL_",","NAME"),!
. ; FIRST PROCESS THE NUMERATOR
. K ^TMP("DILIST",$J)
. N C0QUFN ; FILE NUMBER TO USE
. I $G(C0QNALT)=1 S C0QUFN=$$C0QALFN()
. E S C0QUFN=$$RLSTPFN
. D LIST^DIC(C0QUFN,","_C0QNL_",",".01I") ; GET THE LIST OF PATIENTS
. ;D DELIST("G") ;
. ;I $D(G) ZWR G
. K C0QNUMP
. S NCNT=$O(^TMP("DILIST",$J,"ID",""),-1) ; NUMERATOR COUNT
. N ZJ S ZJ=""
. F S ZJ=$O(^TMP("DILIST",$J,"ID",ZJ)) Q:ZJ="" D ;
. . S ZDFN=^TMP("DILIST",$J,"ID",ZJ,.01)
. . S C0QNUMP("N",ZJ,ZDFN)=""
. ;I '$G(C0QSUM) ZWR ^TMP("DILIST",$J,1,*) ; LIST THE PATIENT NAMES
. D ADDPATS(MSET,ZII,"C0QNUMP")
. ; NEXT PROCESS THE DENOMINATOR
. ;W "DENOMINATOR: ",$$GET1^DIQ($$RLSTFN,C0QDL_",","NAME"),!
. K ^TMP("DILIST",$J)
. I $G(C0QDALT)=1 S C0QUFN=$$C0QALFN()
. E S C0QUFN=$$RLSTPFN
. D LIST^DIC(C0QUFN,","_C0QDL_",",".01I") ; GET THE LIST OF PATIENTS
. ;D DELIST("G")
. ;I $D(G) ZWR G
. ;S ZJ=""
. S DCNT=$O(^TMP("DILIST",$J,"ID",""),-1) ; DENOMONIATOR COUNT
. K C0QDEMP
. F S ZJ=$O(^TMP("DILIST",$J,"ID",ZJ)) Q:ZJ="" D ;
. . S ZDFN=^TMP("DILIST",$J,"ID",ZJ,.01)
. . S C0QDEMP("D",ZJ,ZDFN)=""
. D ADDPATS(MSET,ZII,"C0QDEMP")
. ;I $G(C0QSUM)'=1 ZWR ^TMP("DILIST",$J,1,*) ; LIST THE PATIENT NAMES
. ;E D ;
. ;. W "NUM CNT: ",NCNT
. ;. W " DEN CNT: ",DCNT,!
Q
;
CLEARMEA(MSET,MEAS) ; DELETE AND THEN RECREATE AS EMPTY THE
; MEASURE MEAS IN MEASURE SET IEN MSET
;
N C0QFDA,MFN,MEASURE
S MFN=$$C0QMMFN() ; FILE NUMBER FOR MEASURE SUBFILE
D CLEAN^DILF
S MEASURE=$$GET1^DIQ(MFN,MEAS_","_MSET_",",.01,"I") ; MEASURE POINTER
D CLEAN^DILF
K ZERR
S C0QFDA(MFN,MEAS_","_MSET_",",.01)="@" ; GET READY TO DELETE THE MEASURE
D FILE^DIE(,"C0QFDA","ZERR") ; KILL THE SUBFILE
I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST, INVOKE THE ERROR TRAP IF TASKED
;. W "ERROR",!
;. ZWR ZERR
;. B
K C0QFDA
S C0QFDA(MFN,"+1,"_MSET_",",.01)=MEASURE ; GET READY TO RECREATE THE SUBFILE
D UPDIE ; CREATE THE SUBFILE
Q
;
ADDPATS(MSET,MEAS,PATS) ;ADD PATIENTS TO NUMERATOR AND DENOMINATOR
; OF MEASURE SET IEN MSET MEASURE IEN MEAS
; PATS IS OF THE FORM @PATS@("N",X,DFN)="" AND @PATS@("D",X,DFN)=""
; WHERE N IS FOR NUMERATOR AND D IS FOR DENOMINATOR AND X 1..N
; IF PATIENTS ARE ALREADY THERE, THEY WILL NOT BE ADDED AGAIN
N C0QI,C0QJ
N C0QFDA
S C0QI=""
F S C0QI=$O(@PATS@("N",C0QI)) Q:C0QI="" D ; FOR EACH NUMERATOR PATIENT
. S C0QFDA($$C0QMMNFN,"?+"_C0QI_","_MEAS_","_MSET_",",.01)=$O(@PATS@("N",C0QI,""))
;W "ADDING NUMERATOR",!
;I $D(C0QFDA) ZWR C0QFDA
I $D(C0QFDA) D UPDIE
K C0QFDA
S C0QI=""
F S C0QI=$O(@PATS@("D",C0QI)) Q:C0QI="" D ; FOR EACH NUMERATOR PATIENT
. S C0QFDA($$C0QMMDFN,"?+"_C0QI_","_MEAS_","_MSET_",",.01)=$O(@PATS@("D",C0QI,""))
;W "ADDING DENOMINATOR",!
;I $D(C0QFDA) ZWR C0QFDA
I $D(C0QFDA) D UPDIE
Q
;
DELIST(RTN) ; DECODES ^TMP("DILIST",$J) INTO
; @RTN@(IEN)=INTERNAL VALUE^EXTERNAL VALUE
N ZI,IV,EV,ZDI,ZIEN
S ZI=""
S ZDI=$NA(^TMP("DILIST",$J))
K @RTN
F S ZI=$O(@ZDI@(1,ZI)) Q:ZI="" D ;
. S EV=@ZDI@(1,ZI) ;EXTERNAL VALUE
. S IV=$G(@ZDI@("ID",ZI,.01)) ; INTERNAL VALUE
. S ZIEN=@ZDI@(2,ZI) ; IEN
. S @RTN@(ZIEN)=IV_"^"_EV
Q
;
DELPATS(MSET,MEAS,NDEL) ; DELETE PATIENTS FROM NUMERATOR AND DENOMINATOR
; FOR A MEASURE (ONLY AFFECTS THE C0Q MEASURES FILE)
; MSET IS THE IEN OF THE MEASURE SET
; MEAS IS THE IEN OF THE MEASURE
; NDEL IS A LIST OF PATIENTS TO NOT DELETE (NOT IMPLEMENTED YET)
; IN THE FORM @NDEL@("N",IEN,DFN)="" FOR NUMERATOR PATIENTS
; AND @NDEL@("D",IEN,DFN)="" FOR DENOMINATOR PATIENTS WHERE IEN IS
; THE IEN OF THE PATIENT RECORD IN THE SUBFILE
; THIS FEATURE WILL ALLOW EFFICIENCIES FOR LONG PATIENT LISTS
; IN THAT PATIENTS THAT ARE GOING TO BE ADDED ARE NOT FIRST DELETED
N C0QI,C0QJ
D LIST^DIC($$C0QMMFN,","_MSET_",")
K C0QFDA
;ZWR ^TMP("DILIST",$J,*)
;ZWR ^TMP("DIERR",$J,*)
;D
Q
;
UPDIE ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS
K ZERR
D CLEAN^DILF
D UPDATE^DIE("","C0QFDA","","ZERR")
I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST, INVOKE THE ERROR TRAP IF TASKED
;. W "ERROR",!
;. ZWR ZERR
;. B
K C0QFDA
Q
;
QUE ;QUE THE RUN OF THE PATIENT LISTS AND THE BUILD THE LISTS OF THE PATIENTS
;AND THEIR MEASURES
S MSIEN=$$GET^XPAR("DIV."_$P($$SITE^VASITE(),U,2),"C0Q MEASUREMENT TO USE")
N ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE
S ZTDESC="CREATE PATIENT LIST"
S ZTRTN="RUN^C0QMAIN"
S ZTSAVE("MSIEN")=""
S ZTIO=""
S ZTDTH=$$NOW^XLFDT
D ^%ZTLOAD
Q
;
RUN ; DO THE REAL WORK
I '$D(MSIEN) S MSIEN=$$GET^XPAR("DIV."_$P($$SITE^VASITE(),U,2),"C0Q MEASUREMENT TO USE")
S BEG=$P(^C0Q(201,MSIEN,4),U,3) ;Begin date
S END=$P(^C0Q(201,MSIEN,4),U,4) ;End date
S PATCREAT="N" ;Secure list - N=No
S PLISTPUG="N" ;Purge list after 5 years - N=No
S PXRMDPAT=0 ;Include deceased patients - N=No
S PXRMTPAT=0 ;Include test patients - N=No
S PXRMNODE="PXRMRULE" ;Node in ^TMP($J,"PXRMRULE"
N ZI S ZI=""
F S ZI=$O(^C0Q(201,MSIEN,5,"B",ZI)) Q:ZI'>0 D ; LOOP THROUGH EACH QM
. S PXRMLSTN=+$P(^C0Q(101,ZI,0),U,2) ; NUMERATOR MEASURE
. S PXRMLSTD=+$P(^C0Q(101,ZI,0),U,3) ; DENOMINATOR MEASURE
. S PXRMRULN=+$P(^PXRMXP(810.5,PXRMLSTN,0),U,6) ; RULES FOR THE LIST
. S PXRMRULD=+$P(^PXRMXP(810.5,PXRMLSTD,0),U,6)
. D RUN^PXRMLCR(PXRMRULD,PXRMLSTD,PXRMNODE,BEG,END,PXRMDPAT,PXRMTPAT)
. D RUN^PXRMLCR(PXRMRULN,PXRMLSTN,PXRMNODE,BEG,END,PXRMDPAT,PXRMTPAT)
D C0QRPC(.G,MSIEN)
Q

210
qrda/C0Q/trunk/p/C0QMAIN2.m Normal file
View File

@ -0,0 +1,210 @@
C0QMAIN ; GPL - Quality Reporting Main Processing ;10/13/10 17:05
;;0.1;C0Q;nopatch;noreleasedate;
;Copyright 2009 George Lilly. Licensed under the terms of the GNU
;General Public License See attached copy of the License.
;
;This program is free software; you can redistribute it and/or modify
;it under the terms of the GNU General Public License as published by
;the Free Software Foundation; either version 2 of the License, or
;(at your option) any later version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License along
;with this program; if not, write to the Free Software Foundation, Inc.,
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
;
Q
;
C0QQFN() Q 1130580001.101 ; FILE NUMBER FOR C0Q QUALITY MEASURE FILE
C0QMFN() Q 1130580001.201 ; FILE NUMBER FOR C0Q MEASUREMENT FILE
C0QMMFN() Q 1130580001.2011 ; FN FOR MEASURE SUBFILE
C0QMMNFN() Q 1130580001.20111 ; FN FOR NUMERATOR SUBFILE
C0QMMDFN() Q 1130580001.20112 ; FN FOR DENOMINATOR SUBFILE
RLSTFN() Q 810.5 ; FN FOR REMINDER PATIENT LIST FILE
RLSTPFN() Q 810.53 ; FN FOR REMINDER PATIENT LIST PATIENT SUBFILE
;
NBYP ; ENTRY POINT FOR COMMAND LINE BY PATIENT MEASURE LISTING
;
S DIC=$$C0QMFN,DIC(0)="AEMQ" D ^DIC
I Y<1 Q ; EXIT
N MSIEN S MSIEN=+Y
W !,"NUMERATOR PATIENT LIST",!
N C0QPAT
D PATS(.C0QPAT,MSIEN,"N") ; GET THE NUMERATOR PATIENT LIST
I $D(C0QPAT) D ; LIST RETURNED
.
. ;
Q
;
DBYP ; ENTRY POINT FOR COMMAND LINE BY PATIENT MEASURE LISTING
;
S DIC=$$C0QMFN,DIC(0)="AEMQ" D ^DIC
I Y<1 Q ; EXIT
N MSIEN S MSIEN=+Y
N C0QPAT
W !,"DENOMINATOR PATIENT LIST",!
D PATS(.C0QPAT,MSIEN,"D") ; GET THE NUMERATOR PATIENT LIST
I $D(C0QPAT) D ; LIST RETURNED
. ;
. ;
Q
;
PATS(ZRTN,MSIEN,NORD,PAT,EFORM) ; BUILDS A LIST OF PATIENTS AND THEIR MEASURES
; FOR MEASURE SET MSIEN. NORD="N" (DEFAULT) MEANS NUMERATOR PATIENTS
; NORD="D" MEANS DENOMINATOR PATIENTS
; PAT IS THE IEN OF A SINGLE PATIENT FOR PROCESSING. IF PAT IS OMMITED OR "*",
; ALL PATIENTS IN THE MEASURE SET NUM/DENOM WILL BE PROCESSED
; EFORM=1 MEANS ZRTN IS IN "EXTERNAL FORMAT" - THIS IS FOR USE AS AN RPC
; EXTERNAL FORMAT IS AN ARRAY OF STRINGS
; ZRTN(x)=DFN^NAME^MEASURE IEN^MEASURE NAME
; ONE FOR EACH MEASURE FOR EACH PATIENT IN THE NUMERATOR/DENOMINATOR
; EFORM=0 (DEFAULT) MEANS "INTERNAL FORMAT" - THIS IS FOR MUMPS CALLS
; ZRTN(DFN,MEASURE IEN)="" IT IS A PAIR OF POINTERS IN INDEX FORMAT
; ONE FOR EACH MEASURE FOR EACH PATIENT IN THE NUMERATOR/DENOMINATOR
;
N ZI,ZJ,ZK,ZIDX
S ZI=""
; GOING TO USE THE NUMERATOR BY PATIENT INDEX
I '$D(NORD) S NORD="N"
I '((NORD="N")!(NORD="D")) S NORD="N"
I NORD="N" S ZIDX=$NA(^C0Q(201,"ANBYP"))
E S ZIDX=$NA(^C0Q(201,"ADBYP"))
F S ZI=$O(@ZIDX@(ZI)) Q:ZI="" D ; FOR EACH PATIENT
. I $O(@ZIDX@(ZI,MSIEN,""))'="" D ; IF PATIENT IS IN THIS SET
. . W !,$$GET1^DIQ(2,ZI_",",.01) ;PATIENT NAME
. E Q ; NEXT PATIENT
. S (ZJ,ZK)=""
. F S ZJ=$O(@ZIDX@(ZI,MSIEN,ZJ)) Q:ZJ="" D ; FOR EACH MEASURE
. . ;S ZL=$O(@ZIDX@(ZI,MSIEN,ZJ,"")) ; MEASURE IS FOURTH
. . S ZK=""
. . S ZK=$$GET1^DIQ($$C0QMMFN,ZJ_","_MSIEN_",",.01,"I")
. . ;W !,"ZK:",ZK," ZJ:",ZJ," ZI",ZI,!
. . W " ",$$GET1^DIQ($$C0QQFN,ZK_",",.01) ; MEASURE NAME
Q
;
EN ; ENTRY POINT FOR COMMAND LINE AND MENU ACCESS TO C0QRPC
;
S DIC=$$C0QMFN,DIC(0)="AEMQ" D ^DIC
I Y<1 Q ; EXIT
N MSIEN S MSIEN=+Y
D C0QRPC(.G,MSIEN)
Q
;
C0QRPC(RTN,MSET,FMT,NOPURGE) ; RPC FORMAT
; MSET IS THE NAME OR IEN OF THE MEASURE SET
; RTN IS THE RETURN ARRAY OF THE RESULTS PASSED BY REFERENCE
; FMT IS THE FORMAT OF THE OUTPUT - "ARRAY" OR "HTML" OR "XML"
; NOTE: ARRAY IS DEFAULT AND THE OTHERS ARE NOT IMPLEMENTED YET
; IF NOPURGE IS 1, PATIENT LISTS WILL NOT BE DELETED BEFORE ADDING
; IF NOPURGE IS 0 OR OMITTED, PATIENT LISTS WILL BE DELETED THEN ADDED
W !,"LOOKING FOR MEASURE SET ",MSET,!
N ZI S ZI=""
N C0QM ; FOR HOLDING THE MEASURES IN THE SET
D LIST^DIC($$C0QMMFN,","_MSET_",",".01I") ; GET ALL THE MEASURES
D DELIST("C0QM")
N ZII S ZII=""
F S ZII=$O(C0QM(ZII)) Q:ZII="" D ; FOR EACH MEASURE
. S ZI=$P(C0QM(ZII),U,1) ; IEN OF THE MEASURE IN THE C0Q QUALITY MEAS FILE
. ;W $$GET1^DIQ($$C0QQFN,ZI_",","DISPLAY NAME"),!
. ;N C0QNL,C0QDL ;NUMERATOR AND DENOMINATOR LIST POINTERS
. W "MEASURE: ",$$GET1^DIQ($$C0QQFN,ZI_",",.01),! ; PRINT THE MEASURE NAME
. ; FOLLOW THE POINTERS TO THE C0Q QUALITY MEASURE FILE AND GET LIST PTRS
. S C0QNL=$$GET1^DIQ($$C0QQFN,ZI_",",1,"I") ; NUMERATOR POINTER
. S C0QDL=$$GET1^DIQ($$C0QQFN,ZI_",",2,"I") ; DENOMINATOR POINTER
. ; NOW FOLLOW THE LIST POINTERS TO THE REMINDER PATIENT LIST FILE
. W "NUMERATOR: ",$$GET1^DIQ($$RLSTFN,C0QNL_",","NAME"),!
. ; FIRST PROCESS THE NUMERATOR
. K ^TMP("DILIST",$J)
. D LIST^DIC($$RLSTPFN,","_C0QNL_",",".01I") ; GET THE LIST OF PATIENTS
. ;D DELIST("G") ;
. ;I $D(G) ZWR G
. K C0QNUMP
. N ZJ S ZJ=""
. F S ZJ=$O(^TMP("DILIST",$J,"ID",ZJ)) Q:ZJ="" D ;
. . S ZDFN=^TMP("DILIST",$J,"ID",ZJ,.01)
. . S C0QNUMP("N",ZJ,ZDFN)=""
. ZWR ^TMP("DILIST",$J,1,*) ; LIST THE PATIENT NAMES
. D ADDPATS(MSET,ZII,"C0QNUMP")
. ; NEXT PROCESS THE DENOMINATOR
. W "DENOMINATOR: ",$$GET1^DIQ($$RLSTFN,C0QDL_",","NAME"),!
. K ^TMP("DILIST",$J)
. D LIST^DIC($$RLSTPFN,","_C0QDL_",",".01I") ; GET THE LIST OF PATIENTS
. ;D DELIST("G")
. ;I $D(G) ZWR G
. ;S ZJ=""
. K C0QDEMP
. F S ZJ=$O(^TMP("DILIST",$J,"ID",ZJ)) Q:ZJ="" D ;
. . S ZDFN=^TMP("DILIST",$J,"ID",ZJ,.01)
. . S C0QDEMP("D",ZJ,ZDFN)=""
. D ADDPATS(MSET,ZII,"C0QDEMP")
. ZWR ^TMP("DILIST",$J,1,*) ; LIST THE PATIENT NAMES
Q
;
ADDPATS(MSET,MEAS,PATS) ;ADD PATIENTS TO NUMERATOR AND DENOMINATOR
; OF MEASURE SET IEN MSET MEASURE IEN MEAS
; PATS IS OF THE FORM @PATS@("N",X,DFN)="" AND @PATS@("D",X,DFN)=""
; WHERE N IS FOR NUMERATOR AND D IS FOR DENOMINATOR AND X 1..N
; IF PATIENTS ARE ALREADY THERE, THEY WILL NOT BE ADDED AGAIN
N C0QI,C0QJ
N C0QFDA
S C0QI=""
F S C0QI=$O(@PATS@("N",C0QI)) Q:C0QI="" D ; FOR EACH NUMERATOR PATIENT
. S C0QFDA($$C0QMMNFN,"?+"_C0QI_","_MEAS_","_MSET_",",.01)=$O(@PATS@("N",C0QI,""))
;W "ADDING NUMERATOR",!
;I $D(C0QFDA) ZWR C0QFDA
I $D(C0QFDA) D UPDIE
K C0QFDA
S C0QI=""
F S C0QI=$O(@PATS@("D",C0QI)) Q:C0QI="" D ; FOR EACH NUMERATOR PATIENT
. S C0QFDA($$C0QMMDFN,"?+"_C0QI_","_MEAS_","_MSET_",",.01)=$O(@PATS@("D",C0QI,""))
;W "ADDING DENOMINATOR",!
;I $D(C0QFDA) ZWR C0QFDA
I $D(C0QFDA) D UPDIE
Q
;
DELIST(RTN) ; DECODES ^TMP("DILIST",$J) INTO
; @RTN@(IEN)=INTERNAL VALUE^EXTERNAL VALUE
N ZI,IV,EV,ZDI,ZIEN
S ZI=""
S ZDI=$NA(^TMP("DILIST",$J))
K @RTN
F S ZI=$O(@ZDI@(1,ZI)) Q:ZI="" D ;
. S EV=@ZDI@(1,ZI) ;EXTERNAL VALUE
. S IV=$G(@ZDI@("ID",ZI,.01)) ; INTERNAL VALUE
. S ZIEN=@ZDI@(2,ZI) ; IEN
. S @RTN@(ZIEN)=IV_"^"_EV
Q
;
DELPATS(MSET,MEAS,NDEL) ; DELETE PATIENTS FROM NUMERATOR AND DENOMINATOR
; FOR A MEASURE (ONLY AFFECTS THE C0Q MEASURES FILE)
; MSET IS THE IEN OF THE MEASURE SET
; MEAS IS THE IEN OF THE MEASURE
; NDEL IS A LIST OF PATIENTS TO NOT DELETE (NOT IMPLEMENTED YET)
; IN THE FORM @NDEL@("N",IEN,DFN)="" FOR NUMERATOR PATIENTS
; AND @NDEL@("D",IEN,DFN)="" FOR DENOMINATOR PATIENTS WHERE IEN IS
; THE IEN OF THE PATIENT RECORD IN THE SUBFILE
; THIS FEATURE WILL ALLOW EFFICIENCIES FOR LONG PATIENT LISTS
; IN THAT PATIENTS THAT ARE GOING TO BE ADDED ARE NOT FIRST DELETED
N C0QI,C0QJ
D LIST^DIC($$C0QMMFN,","_MSET_",")
K C0QFDA
ZWR ^TMP("DILIST",$J,*)
ZWR ^TMP("DIERR",$J,*)
D
Q
;
UPDIE ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS
K ZERR
D CLEAN^DILF
D UPDATE^DIE("","C0QFDA","","ZERR")
I $D(ZERR) D ;
. W "ERROR",!
. ZWR ZERR
. B
K C0QFDA
Q
;

591
qrda/C0Q/trunk/p/C0QMU12.m Normal file
View File

@ -0,0 +1,591 @@
C0QMU12 ;JJOH/ZAG/GPL - Patient Reminder List ; 10/22/12 4:29pm
;;1.0;QUALITY MEASURES;**1,5,6**;May 21, 2012;Build 32
;
;2011 Zach Gonzales<zach@linux.com> - Licensed under the terms of the GNU
;General Public License See attached copy of the License.
;
; GPL - THIS ROUTINE IS A COPY OF JJOHMU11 THAT HAS BEEN MODIFIED
; FOR MEANINGFUL USE CALCULATION FOR FISCAL YEAR 2012 AT OROVILLE HOSPITAL
;
C0QPFN() Q 1130580001.401 ; PARAMETER FILE
C0QPCFN() Q 1130580001.411 ; CLINIC SUBFILE
C0QMFN() Q 1130580001.201 ; FILE NUMBER FOR C0Q MEASUREMENT SET FILE
C0QMMFN() Q 1130580001.2011 ; FN FOR MEASURE SUBFILE
INIT(ZARY,ZTYP) ; INITIALIZE THE PARAMETERS FOR BUILDING PATIENT LISTS
; ZARY IS PASSED BY NAME
; ZTYP IS "INP" OR "EP"
N ZMU S ZMU="MU12" ; THIS IS THE ONLY HARD CODED VALUE LEFT
; TBD - CHANGE IT TO A READ FROM SYSTEM PARAMETERS
K @ZARY ; CLEAR RETURN ARRAY
N ZIEN,ZCNT,ZX
I $O(^C0Q(401,"MUTYP",ZMU,ZTYP,""))="" D Q ; OOPS NO RECORD THERE
. W !,"ERROR, NO PARAMETERS AVAILABLE"
S ZIEN=""
S ZCNT=0
F S ZIEN=$O(^C0Q(401,"MUTYP",ZMU,ZTYP,ZIEN)) Q:ZIEN="" D ;
. S ZCNT=ZCNT+1
. S @ZARY@(ZCNT,"IEN")=ZIEN
. S @ZARY@(ZCNT,"MU")=$$GET1^DIQ($$C0QPFN,ZIEN_",",.02)
. S @ZARY@(ZCNT,"TYPE")=$$GET1^DIQ($$C0QPFN,ZIEN_",",.03)
. ;
. ; Inpatient
. S (ZX,@ZARY@(ZCNT,"InpatientMeasurementSet"))=$$GET1^DIQ($$C0QPFN,ZIEN_",",1,"I")
. S @ZARY@(ZCNT,"InpatientBeginDate")=$$GET1^DIQ($$C0QMFN,ZX_",",.02,"I")
. S @ZARY@(ZCNT,"InpatientEndDate")=$$GET1^DIQ($$C0QMFN,ZX_",",.03,"I")
. S @ZARY@(ZCNT,"InpatientQualitySet")=$$GET1^DIQ($$C0QPFN,ZIEN_",",1.1,"I")
. ;
. ; Outpatient
. S (ZX,@ZARY@(ZCNT,"EPMeasurementSet"))=$$GET1^DIQ($$C0QPFN,ZIEN_",",2,"I")
. S @ZARY@(ZCNT,"EPBeginDate")=$$GET1^DIQ($$C0QMFN,ZX_",",.02,"I")
. S @ZARY@(ZCNT,"EPEndDate")=$$GET1^DIQ($$C0QMFN,ZX_",",.03,"I")
. S @ZARY@(ZCNT,"EPQualitySet")=$$GET1^DIQ($$C0QPFN,ZIEN_",",2.1,"I")
. S @ZARY@(ZCNT,"EPModelPerfSet")=$$GET1^DIQ($$C0QPFN,ZIEN_",",6.1,"I")
. S @ZARY@(ZCNT,"EPModelQualitySet")=$$GET1^DIQ($$C0QPFN,ZIEN_",",6.2,"I")
. ;
. D CLEAN^DILF
. D LIST^DIC($$C0QPCFN,","_ZIEN_",",".01I")
. I $D(^TMP("DIERR",$J)) D Q ; ERROR READING CLINIC LIST
. . W !,"ERROR READING CLINIC PARAMETER LIST"
. M @ZARY@(ZCNT,"CLINICS")=^TMP("DILIST",$J)
;
Q
;
BUILD ; CALL ALL AND DIS AND BUILD THE GRSLT ARRAY or print or create
; patient lists
;N GRSLT ; ARRAY FOR RESULTS
I '$D(C0QSS) S C0QSS=0 ;default don't build spreadsheet array
I '$D(C0QPR) S C0QPR=0 ;default don't print out results
I '$D(C0QPL) S C0QPL=1 ;default do create patient lists
S ZYR="MU12-"
D INITCLST ; initialize C0QLIST
N G1 ; ONE SET OF VALUES - RNF1 FORMAT
N C0QPARM
D INIT("C0QPARM","INP") ; initialize inpatient parms
I $O(C0QPARM(""))="" D Q ; no parms for inpatient
. W !,"No inpatient parameters"
N ZDIV S ZDIV=""
F S ZDIV=$O(C0QPARM(ZDIV)) Q:ZDIV="" D ; for each inpatient division
. D ALL ; all currently admitted patients in the hospital
. D DIS ; all patients discharged since the reporting period began
. I C0QSS D ZWRITE^C0QUTIL("GRSLT")
. ;D ICUPAT ; GENERATE ICU PATIENT LIST
. I C0QPL D ;
. . D FILE ; FILE THE PATIENT LISTS
. . D UPDATE^C0QUPDT(.G,C0QPARM(ZDIV,"InpatientMeasurementSet")) ;
. . D UPDATE^C0QUPDT(.G,C0QPARM(ZDIV,"InpatientQualitySet")) ;
. K C0QLIST
Q
;
INITCLST ; initialize C0QLIST
; INITIALIZE LISTS
; this is done so that if there are no matching patients, the patient list
; will be zeroed out
; K C0QLIST - VEN/SMH - Oops, we kill the previous lists!!!
S C0QLIST(ZYR_"HasDemographics")=""
S C0QLIST(ZYR_"Patient")="" ; VEN/SMH - Is this needed? Not used in EP.
S C0QLIST(ZYR_"HasProblem")=""
S C0QLIST(ZYR_"HasAllergy")=""
S C0QLIST(ZYR_"HasMed")=""
S C0QLIST(ZYR_"HasERX")="" ; VEN/SMH C0Q*1*5
S C0QLIST(ZYR_"HasMedRecon")="" ; VEN/SMH C0Q*1*5
S C0QLIST(ZYR_"HasVitalSigns")=""
S C0QLIST(ZYR_"HasMedOrders")=""
S C0QLIST(ZYR_"HasSmokingStatus")=""
S C0QLIST(ZYR_"ALL-PATIENTS")="" ; VEN/SMH C0Q*1*5
Q
;
ALL ;retrieve active inpatients
N WARD S WARD=""
F D Q:WARD=""
. S WARD=$O(^DIC(42,"B",WARD)) ;ward name
. Q:WARD=""
. N WIEN S WIEN=""
. F S WIEN=$O(^DIC(42,"B",WARD,WIEN)) Q:'WIEN D ;wards IEN
. . S WARDNAME=$P(^DIC(42,WIEN,0),U,2) ;ward name
. . N DFN,RB S DFN=""
. . F S DFN=$O(^DPT("CN",WARD,+DFN)) Q:'DFN D ;DFN of patient on ward
. . . D DEMO^C0QMU122
. . . D PROBLEM
. . . D ALLERGY
. . . D MEDS4
. . . D RECON2
. . . D ADVDIR
. . . D SMOKING
. . . D VITALS
. . . D VTE1
. . . D COD
. . . D EDTIME
. . . I C0QPR D PRINT^C0QMU121
. . . I C0QSS D SS^C0QMU121
. . . I C0QPL D PATLIST^C0QMU121
Q
;
PROBLEM ; PATIENT PROBLEMS
D LIST^ORQQPL(.PROBL,DFN,"A")
S PBCNT=""
F S PBCNT=$O(PROBL(PBCNT)) Q:PBCNT="" D
. S PBDESC=$P(PROBL(PBCNT),U,2) ;problem description
I PBDESC["No problems found" S C0QLIST(ZYR_"NoProblem",DFN)=""
E S C0QLIST(ZYR_"HasProblem",DFN)=""
K PROBL
Q
;
ALLERGY ; ALLERGY LIST
; WANT TO CHANGE ALLERGIES FOR 2012 TO POPULATE THE C0QLIST DIRECTLY. GPL
D LIST^ORQQAL(.ALRGYL,DFN)
S ALCNT=""
F S ALCNT=$O(ALRGYL(ALCNT)) Q:ALCNT="" D
. S ALDESC=$P(ALRGYL(ALCNT),U,2) ;allergy description
I ALDESC["No Allergy" S C0QLIST(ZYR_"NoAllergy",DFN)=""
E S C0QLIST(ZYR_"HasAllergy",DFN)=""
K ALRGYL
Q
;
MEDS4 ; USE OCL^PSOORRL TO GET ALL MEDS
; DELETED MEDS, MEDS2, AND MEDS3 FOR 2012 TO USE ONLY MEDS4
N BEG,END
S BEG=$$DT^C0QUTIL("JULY 3,2011")
S END=$$DT^C0QUTIL("NOW")
D OCL^PSOORRL(DFN,BEG,END) ;DBIA #2400
N C0QMEDS
M C0QMEDS=^TMP("PS",$J) ; MEDS RETURNED FROM CALL
N FOUND
N ZI
I '$D(C0QMEDS(1)) D Q ; QUIT IF NO MEDS
. S C0QLIST(ZYR_"NoMed",DFN)=""
E D ; HAS MEDS
. S C0QLIST(ZYR_"HasMed",DFN)=""
S ZI="" S FOUND=0
F S ZI=$O(C0QMEDS(ZI)) Q:ZI="" D ; FOR EACH MED
. N ZM
. S ZM=$G(C0QMEDS(ZI,0)) ;THE MEDICATION
. I $P($P(ZM,"^",1),";",2)="I" D ; IE 1U;I FOR AN INPATIENT UNIT DOSE
. . S FOUND=1
I FOUND S C0QLIST(ZYR_"HasMedOrders",DFN)="" ; MET CPOE MEASURE
E S C0QLIST(ZYR_"NoMedOrders",DFN)=""
Q
;
RECON ; MEDICATIONS RECONCILIATION
; WANT TO SIMPLIFY MEDS RECON FOR 2012. GPL
;
I $$HASNTYN^C0QNOTES("MED/SURG NURSING ADMISSION ASSESSMENT",DFN) D ;
. S C0QLIST(ZYR_"XferOfCare",DFN)="" ; transfer of care patient
N HASRECON S HASRECON=0
N GT,G
S GT(4,"HasMedRecon","MEDICATION RECONCILIATION COMPLET")=""
S GT(5,"HasMedRecon","Medication Reconcilation Complete")=""
I $$TXTALL^C0QNOTES(.G,.GT,DFN) D ; SEARCH ALL NOTES FOR MED RECON
. S HASRECON=1
;N ZT
;S ZT="MEDICATION RECONCILIATION COMPLET"
;I $$NTTXT^C0QNOTES("ER NURSE NOTE",ZT,DFN) D ;
;. S HASRECON=1
;E D ;
;. S ZT="Medication Reconcilation Complete"
;. I $$NTTXT^C0QNOTES("MED/SURG NURSING ADMISSION ASSESSMENT",ZT,DFN) D ;
;. . S HASRECON=1
;I $$HFYN^C0QHF("MEDS HAVE BEEN REVIEWED",DFN) S HASRECON=1
I HASRECON D ;
. S C0QLIST(ZYR_"HasMedRecon",DFN)=""
E S C0QLIST(ZYR_"NoMedRecon",DFN)=""
Q
;
RECON2 ; USE HEALTH FACTORS FOR MEDICATION RECONCILIATION
I $$HASNTYN^C0QNOTES("MED/SURG NURSING ADMISSION ASSESSMENT",DFN) D ;
. S C0QLIST(ZYR_"XferOfCare",DFN)="" ; transfer of care patient
I $$HFYN^C0QHF(DFN,"Medication Reconciliation Completed: Yes") D ;
. S C0QLIST(ZYR_"HasMedRecon",DFN)=""
E S C0QLIST(ZYR_"NoMedRecon",DFN)=""
Q
;
ERX ; FOR EP, WE LOOK AT ERX MEDS
N ZI S ZI=""
N ZERX S ZERX=$NA(^PS(55,DFN,"NVA"))
F S ZI=$O(@ZERX@(ZI)) Q:ZI="" D ;
. ;B
. I $G(@ZERX@(ZI,1,1,0))["E-Rx Web" D ;
. . S C0QLIST(ZYR_"HasMed",DFN)=""
. . S C0QLIST(ZYR_"HasMedOrders",DFN)=""
. . S C0QLIST(ZYR_"HasERX",DFN)=""
. . S C0QLIST(ZYR_"HasMedRecon",DFN)=""
. E D ;
. . S C0QLIST(ZYR_"NoMed",DFN)=""
. . S C0QLIST(ZYR_"NoMedOrders",DFN)=""
. . S C0QLIST(ZYR_"NoERX",DFN)=""
. . S C0QLIST(ZYR_"NoMedRecon",DFN)=""
Q
;
ADVDIR ; ADVANCE DIRECTIVE
;
I $$AGE^C0QUTIL(DFN)>64 D ; ONLY FOR PATIENTS 65 AND OLDER
. S C0QLIST(ZYR_"Over65",DFN)=""
. I $$HASNTYN^C0QNOTES("ADVANCE DIRECTIVE",DFN) D ;
. . S C0QLIST(ZYR_"HasAdvanceDirective",DFN)=""
. E D ;
. . S C0QLIST(ZYR_"NoAdvanceDirective",DFN)=""
Q
;
SMOKING G SMOKING^C0QMU121
VITALS ;
;
N C0QSDT,C0QEDT
D DT^DILF(,"JULY 3,2011",.C0QSDT) ; START DATE
D DT^DILF(,"T",.C0QEDT) ; END DATE TODAY
S C0QEDT=C0QEDT+.999999 ; Move to the end of the day! VEN/SMH C0Q*1*5
D VITALS^ORQQVI(.VITRSLT,DFN,C0QSDT,C0QEDT) ; CALL FAST VITALS
I $D(VITRSLT) D ;ZWR VITRSLT B ;
. I VITRSLT(1)["No vitals found." S C0QLIST(ZYR_"NoVitalSigns",DFN)=""
. E S C0QLIST(ZYR_"HasVitalSigns",DFN)=""
Q
;
VTE1 ; VTE PROPHYLAXIS WITHIN 24HRS OF ARRIVAL
;
I $$HFYN^C0QHF(DFN,"VTE PROPHYLAXIS WITHIN 24HRS OF ARRIVAL") D ;
. S C0QLIST(ZYR_"HasVTE24",DFN)=""
E S C0QLIST(ZYR_"NoVTE24",DFN)=""
Q
;
;
;
COD ; TEST FOR PRELIMINARY CAUSE OF DEATH NOTE
I $$HASNTYN^C0QNOTES("PRELIMINARY CAUSE OF DEATH",DFN) D ;
. S C0QLIST(ZYR_"CauseOfDeath",DFN)=""
Q
;
EDTIME ; CHECK FOR EMERGENCY DEPT TIME FACTORS
N FOUND
S FOUND=0
I $$HFYN^C0QHF(DFN,"ED ARRIVAL TIME") S FOUND=1
I '$$HFYN^C0QHF(DFN,"ED DEPARTURE TIME") S FOUND=0
I '$$HFYN^C0QHF(DFN,"TIME DECISION TO ADMIT MADE") S FOUND=0
I FOUND D ;
. S C0QLIST(ZYR_"HasEDtime",DFN)=""
E S C0QLIST(ZYR_"NoEDtime",DFN)=""
Q
;
ICUPAT ; CREATE LIST OF ICU PATIENTS
N ZICU
S ZICU=$O(^SC("B","IC","")) ; IEN OF ICU HOSPITAL LOCATION
N ZI,ZJ,ZP
S ZI=""
F S ZI=$O(^AUPNVSIT("AHL",ZICU,ZI)) Q:ZI="" D ; EACH DATE
. S ZJ=""
. F S ZJ=$O(^AUPNVSIT("AHL",ZICU,ZI,ZJ)) Q:ZJ="" D ; EACH VISIT
. . S ZP=$P(^AUPNVSIT(ZJ,0),"^",5) ; DFN
. . S C0QLIST(ZYR_"ICUPatient",ZP)=""
Q
;
FILTER ; CALLED AFTER ALL THE PATIENT LISTS HAVE BEEN FILED
; WILL KILL C0QLIST AND CREATE DERIVATIVE PATIENT LISTS BY FILTERING
K C0QLIST
N ZPAT
S ZPAT=$$PATLN(ZYR_"Patient") ; name of patient list of all patients admitted
; during the reporting period. used to filter other lists
;
; filter ICU patients against ZPAT
N GN,GO,GF
S GN=ZPAT
S GO=$$PATLN(ZYR_"ICUPatient") ; all ICU patient
S GF=$NA(C0QLIST(ZYR_"ICUReporting")) ; the filtered list destination
D AND^C0QSET(GF,GN,GO) ; filter the list with the AND set operation
;
; FILTER VTE-2 DENOMINATOR FOR QUALITY MEASURE
;
S GN=$NA(C0QLIST(ZYR_"ICUReporting")) ; ICU patients admitted inside rpt period
S GO=$$RPATLN("MU VTE-2 DENOM PL") ; TAXONOMY BASED DENOMENATOR
S GF=$NA(C0QLIST(ZYR_"VTE2DEN")) ; NEW DENOMINATOR PL
D AND^C0QSET(GF,GN,GO) ; filter the list with the AND set operation
;
S GN=ZPAT
S GO=$$RPATLN("MU VTE-3 DENOM PL") ; TAXONOMY BASED DENOMENATOR
S GF=$NA(C0QLIST(ZYR_"VTE3DEN")) ; NEW DENOMINATOR PL
D AND^C0QSET(GF,GN,GO) ; filter the list with the AND set operation
;
S GN=ZPAT
S GO=$$RPATLN("MU VTE-4 DENOM PL") ; TAXONOMY BASED DENOMENATOR
S GF=$NA(C0QLIST(ZYR_"VTE4DEN")) ; NEW DENOMINATOR PL
D AND^C0QSET(GF,GN,GO) ; filter the list with the AND set operation
;
S GN=ZPAT
S GO=$$RPATLN("MU VTE-5 DENOM PL") ; TAXONOMY BASED DENOMENATOR
S GF=$NA(C0QLIST(ZYR_"VTE5DEN")) ; NEW DENOMINATOR PL
D AND^C0QSET(GF,GN,GO) ; filter the list with the AND set operation
;
D FILE ; FILE ALL THE PATIENT LISTS
D UPDATE^C0QUPDT(.G,5) ; UPDATE THE HOS 2011 MEANINGFUL USE measure set
Q
;
ED1 ;
S ZYR="MU12-"
D DOTIME^C0QMU121("ED DEPARTURE TIME")
Q
;
ED2 ;
S ZYR="MU12-"
D DOTIME2^C0QMU121("TIME DECISION TO ADMIT MADE")
Q
;
RPATLN(ZLST) ; EXTRINSIC RETURNS THE GLOBAL NAME OF THE REMINDER PATIENT LIST
; WHOSE NAME IS ZLST
N ZIEN,ZN
S ZIEN=$O(^PXRMXP(810.5,"B",ZLST,"")) ; ien of patient list
S ZN=$NA(^PXRMXP(810.5,ZIEN,30,"B")) ; GLOBAL NAME IN REMINDER PATIENT LIST
Q ZN
;
PATLN(ZATTR) ; EXTRINSIC RETURNS THE NAME OF THE PATIENT LIST WITH
; THE ATTRIBUTE ZATTR
N ZIEN,ZN
S ZIEN=$O(^C0Q(301,"CATTR",ZATTR,"")) ; ien of patient list
S ZN=$NA(^C0Q(301,ZIEN,1,"B")) ; NAME OF PATIENT LIST IN C0Q PATIENT LIST
Q ZN
;
INLIST(ZLIST,DFN) ; EXTRINSIC FOR IS PATIENT ALREADY IN LIST ZLIST
N ZL,ZR
S ZL=$O(^C0Q(301,"CATTR",ZLIST,"")) ; IEN OF LIST IN C0Q PATIENT LIST FILE
I ZL="" Q 0 ; LIST DOES NOT EXIST
S ZR=0 ; ASSUME NOT IN LIST
I $D(^C0Q(301,ZL,1,"B",DFN)) S ZR=1 ; PATIENT IS IN LIST
Q ZR
;
LOCPAT(PREFIX,LOC) ;retrieve active outpatients
; PREFIX WILL GO IN C0XLIST(PREFIX_"-PATIENT",DFN)=""
; LOC IS HOSPITAL LOCATION
; Initially, make an empty list (C0Q*1.0*6)
S C0QLIST(PREFIX_"Patient")=""
S ULOC=$O(^SC("B",LOC,"")) ; IEN OF HOSPITAL LOCATION
I ULOC="" D Q ; OOPS
. W !,"HOSPITAL LOCATION NOT FOUND: ",LOC
S IDTE=9999999-DTE ; INVERSE DATE
N ZI
S ZI="" ; BEGIN AT LATEST DATE FOR THIS LOC IN VISIT FILE
F S ZI=$O(^AUPNVSIT("AHL",ULOC,ZI)) Q:(ZI="")!(ZI>IDTE) D ; FOR EACH DATE
. N C0QDATE S C0QDATE=9999999-$P(ZI,".")_"."_$P(ZI,".",2) ; VEN/SMH *5
. W !,$$FMTE^XLFDT(C0QDATE) ; VEN/SMH *5
. I ZI="" Q ;
. N ZJ S ZJ=""
. F S ZJ=$O(^AUPNVSIT("AHL",ULOC,ZI,ZJ)) Q:ZJ="" D ; FOR EACH VISIT
. . S DFN=$$GET1^DIQ(9000010,ZJ,.05,"I") ; PATIENT
. . S C0QLIST(PREFIX_"Patient",DFN)=""
Q
;
EPPAT(ZYR) ; BUILD ALL PATIENT LISTS FOR CLINICS
;
S DTE=3111000
S MUYR=ZYR
N ZC,ZN
S ZN=0
N ZI S ZI=0
F S ZI=$O(^SC(ZI)) Q:+ZI=0 D ; FOR EVERY HOSPITAL LOCATION
. I $$GET1^DIQ(44,ZI_",",2,"I")'="C" Q ; NOT A CLINIC
. S ZC=$$GET1^DIQ(44,ZI_",",.01) ; NAME OF CLINIC
. S ZCIEN=ZI ; IEN OF CLINIC
. S ZN=ZN+1 ; COUNT OF CLINICS
. S PRE=MUYR_"-EP-"_ZC_"-"
. D LOCPAT(PRE,ZC)
W !,"NUMBER OF CLINICS: ",ZN
D FILE ; CREATE ALL THE EP PATIENT LISTS
Q
;
DOEP ; DO EP COMPUTATIONS
S ZYR="MU12-"
N C0QPARM,C0QCLNC
D INIT("C0QPARM","EP") ; INITIALIZE PARAMETERS
K C0QLIST ; CLEAR THE LIST
N ZI S ZI=""
F S ZI=$O(C0QPARM(ZI)) Q:ZI="" D ; FOR EACH EP
. S DTE=C0QPARM(ZI,"EPBeginDate") ; beginning of measurement period
. S EDTE=C0QPARM(ZI,"EPEndDate") ; end of measurement period -- tbd use this
. S C0QCLNC=C0QPARM(ZI,"CLINICS",1,1) ; only one clinic for now
. S PRE=ZYR_"EP-"_C0QCLNC_"-"
. D LOCPAT(PRE,C0QCLNC) ; GET THE PATIENTS
. I $D(DEBUG) D ZWRITE^C0QUTIL("C0QLIST")
. M C0QLIST(ZYR_"EP-ALL-PATIENTS")=C0QLIST(PRE_"Patient")
. ; update parameter list with filter list (1.0*6)
. S C0QPARM(ZI,"FilterListName")=PRE_"Patient"
S DFN=""
S ZYR=ZYR_"EP-"
D INITCLST ; VEN/SMH - Initialize Empty Lists just in case we don't have
; any. C0Q*1*5
F S DFN=$O(C0QLIST(ZYR_"ALL-PATIENTS",DFN)) Q:DFN="" D ; EACH PATIENT
. D DEMO^C0QMU122
. D PROBLEM
. D ALLERGY
. ;D MEDS
. D ERX
. D SMOKING
. D VITALS
D FILE ; FILE THE PATIENT LISTS
;
; Now process eRx MU measures for these patients
; Check for eRx template and code first; if they exist, run the code
I $D(^C0PX("B","GETMEDS6")),$L($T(SOAP^C0PWS2)) DO
. N C0QDEBUG S C0QDEBUG=1 ; This causes the code to print out data;
. D EN^C0QMUERX($$PATLN^C0QMU12(ZYR_"HasERX")) ; Pass the eRx patient list
;
N ZI S ZI=""
F S ZI=$O(C0QPARM(ZI)) Q:ZI="" D ;
. N C0QDEBUG S C0QDEBUG=1 ; This causes the code to print out data;
. I 'C0QPARM(ZI,"EPMeasurementSet"),C0QPARM(ZI,"EPModelPerfSet") D
. . N C0QCLNC S C0QCLNC=C0QPARM(ZI,"CLINICS",1,1)
. . N FLN S FLN=C0QPARM(ZI,"FilterListName")
. . ;
. . ; 1. BUILD New Measure Set from Model Performance Measure Set
. . ; Get IEN back of the newly created measure set.
. . N MSIEN ; Measure Set IEN that gets created
. . S MSIEN=$$CLONE^C0QMU123(C0QPARM(ZI,"EPModelPerfSet"),C0QCLNC,0,FLN)
. . ;
. . ; 2. File Measure Set
. . N C0QFDA S C0QFDA($$C0QPFN(),C0QPARM(ZI,"IEN")_",",2)=MSIEN
. . N C0QERR
. . D FILE^DIE("",$NA(C0QFDA),$NA(C0QERR))
. . I $D(C0QERR) S $EC=",U1,"
. . ;
. . ; 3. Set this IEN to be the one in EPMeasurementSet
. . S C0QPARM(ZI,"EPMeasurementSet")=MSIEN
. . ; DONE
. . ;
. I 'C0QPARM(ZI,"EPQualitySet"),C0QPARM(ZI,"EPModelQualitySet") D
. . N C0QCLNC S C0QCLNC=C0QPARM(ZI,"CLINICS",1,1)
. . N FLN S FLN=C0QPARM(ZI,"FilterListName")
. . ;
. . ; 1. BUILD New Measure Set from Model Performance Measure Set
. . ; Get IEN back of the newly created measure set.
. . N MSIEN ; Measure Set IEN that gets created
. . S MSIEN=$$CLONE^C0QMU123(C0QPARM(ZI,"EPModelQualitySet"),C0QCLNC,1,FLN)
. . ;
. . ; 2. File Measure Set
. . N C0QFDA S C0QFDA($$C0QPFN(),C0QPARM(ZI,"IEN")_",",2.1)=MSIEN
. . N C0QERR
. . D FILE^DIE("",$NA(C0QFDA),$NA(C0QERR))
. . I $D(C0QERR) S $EC=",U1,"
. . ;
. . ; 3. Set this IEN to be the one in EPMeasurementSet
. . S C0QPARM(ZI,"EPQualitySet")=MSIEN
. . ; DONE
. ;
. ; Quit if we still don't have measurement sets
. I 'C0QPARM(ZI,"EPMeasurementSet")&('C0QPARM(ZI,"EPQualitySet")) QUIT
. ;
. D UPDATE^C0QUPDT(.G,C0QPARM(ZI,"EPMeasurementSet")) ; UPDATE THE MU MEASUREMENT SET
. ; VEN/SMH -- Quality Set missing for Outpatient -- adding
. D UPDATE^C0QUPDT(.G,C0QPARM(ZI,"EPQualitySet")) ; C0Q*1*5
Q
;
DIS ;
N DFN,DTE,EXDTE S DTE=""
F D Q:DTE=""
. S DTE=$O(^DGPM("B",DTE))
. Q:'DTE
. ;Q:$P(DTE,".")<3110703
. Q:$P(DTE,".")<3111000 ; NEW BEGIN DATE FOR FISCAL YEAR 2012
. S EXDTE=$$FMTE^XLFDT(DTE)
. N PTFM S PTFM=""
. D
. . S PTFM=$O(^DGPM("B",DTE,PTFM))
. . Q:'PTFM
. . S DFN=$P(^DGPM(PTFM,0),U,3)
. . S C0QLIST(ZYR_"Patient",DFN)=""
. . D DEMO^C0QMU122
. . D PROBLEM
. . D ALLERGY
. . D MEDS4
. . D RECON2
. . D ADVDIR
. . D SMOKING
. . D VITALS
. . ;D:$P(DTE,".")>3110912 VTE1
. . D VTE1
. . D COD
. . D EDTIME
. . I C0QPR D PRINT^C0QMU121
. . I C0QSS D SS^C0QMU121
. . I C0QPL D PATLIST^C0QMU121
Q
;
C0QPLF() Q 1130580001.301 ; FILE NUMBER FOR C0Q PATIENT LIST FILE
C0QALFN() Q 1130580001.311 ; FILE NUMBER FOR C0Q PATIENT LIST PATIENT SUBFILE
FILE ; FILE THE PATIENT LISTS TO C0Q PATIENT LIST
;
I '$D(C0QLIST) Q ;
N LFN S LFN=$$C0QALFN()
N ZI,ZN
S ZI=""
F S ZI=$O(C0QLIST(ZI)) Q:ZI="" D ;
. S ZN=$O(^C0Q(301,"CATTR",ZI,""))
. I ZN="" D ; LIST NOT FOUND, CREATE IT
. . K C0QFDA
. . S FN=$$C0QPLF ; C0Q PATIENT LIST FILE
. . S C0QFDA(FN,"+1,",.01)=ZI
. . S C0QFDA(FN,"+1,",999)=ZI ; ATTRIBUTE
. . W !,"CREATING ",ZI
. . D UPDIE ; ADD THE RECORD
. . S ZN=$O(^C0Q(301,"CATTR",ZI,"")) ; THE NEW IEN
. ;I ZN="" D Q ; OOPS
. ;. W !,"ERROR, ATTRIBUTE NOT FOUND IN PATIENT LIST FILE:"_ZI
. ;S ZN=$$KLNCR(ZN) ; KILL AND RECREATE RECORD ZN
. N C0QNEW,C0QOLD,C0QRSLT
. S C0QNEW=$NA(C0QLIST(ZI)) ; THE NEW PATIENT LIST
. S C0QOLD=$NA(^C0Q(301,ZN,1,"B")) ; THE OLD PATIENT LIST
. D UNITY^C0QSET("C0QRSLT",C0QNEW,C0QOLD) ; FIND WHAT'S NEW
. N ZJ,ZK
. ; FIRST, DELETE THE OLD ONES - NO LONGER IN THE LIST
. K C0QFDA
. S ZJ=""
. F S ZJ=$O(C0QRSLT(2,ZJ)) Q:ZJ="" D ; MARKED WITH A 2 FROM UNITY
. . S ZK=$O(@C0QOLD@(ZJ,"")) ; GET THE IEN OF THE RECORD TO DELETE
. . I ZK="" D Q ; OOPS SHOULDN'T HAPPEN
. . . W !,"INTERNAL ERROR FINDING A PATIENT TO DELETE"
. . . S $EC=",U1130580001," ; smh - instead of a BREAK
. . S C0QFDA(LFN,ZK_","_ZN_",",.01)="@"
. I $D(C0QFDA) D UPDIE ; PROCESS THE DELETIONS
. ; SECOND, PROCESS THE ADDITIONS
. K C0QFDA
. S ZJ="" S ZK=1
. F S ZJ=$O(C0QRSLT(0,ZJ)) Q:ZJ="" D ; PATIENTS TO ADD ARE MARKED WITH 0
. . S C0QFDA(LFN,"+"_ZK_","_ZN_",",.01)=ZJ
. . S ZK=ZK+1
. I $D(C0QFDA) D UPDIE ; PROCESS THE ADDITIONS
;. Q
;. K C0QFDA
;. N ZJ,ZC
;. S ZJ="" S ZC=1
;. F S ZJ=$O(C0QLIST(ZI,ZJ)) Q:ZJ="" D ; FOR EACH PAT IN LIST
;. . S C0QFDA(LFN,"?+"_ZC_","_ZN_",",.01)=ZJ
;. . S ZC=ZC+1
;. D UPDIE
;. W !,"FOUND:"_ZI
Q
;
KLNCR(ZREC) ; KILL AND RECREATE RECORD ZREC IN PATIENT LIST FILE
;
N C0QFDA,ZFN,LIST,ATTR
S ZFN=$$C0QPLF() ; FILE NUMBER FOR C0Q PATIENT LIST FILE
D CLEAN^DILF
S LIST=$$GET1^DIQ(ZFN,ZREC_",",.01) ; MEASURE NAME
S ATTR=$$GET1^DIQ(ZFN,ZREC_",",999) ; ATTRIBUTE
D CLEAN^DILF
K ZERR
S C0QFDA(ZFN,ZREC_",",.01)="@" ; GET READY TO DELETE THE MEASURE
D FILE^DIE(,"C0QFDA","ZERR") ; KILL THE SUBFILE
I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST, INVOKE THE ERROR TRAP IF TASKED
;. W "ERROR",!
;. ZWR ZERR
;. B
K C0QFDA
S C0QFDA(ZFN,"+1,",.01)=LIST ; GET READY TO RECREATE THE RECORD
S C0QFDA(ZFN,"+1,",999)=ATTR ; ATTRIBUTE
D UPDIE ; CREATE THE SUBFILE
N ZR ; NEW IEN FOR THE RECORD
S ZR=$O(^C0Q(301,"CATTR",ATTR,""))
;
Q ZR
;
UPDIE ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS
K ZERR
D CLEAN^DILF
D UPDATE^DIE("","C0QFDA","","ZERR")
I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST, INVOKE THE ERROR TRAP IF TASKED
K C0QFDA
Q
;
END ;end of C0QPRML;

378
qrda/C0Q/trunk/p/C0QMU121.m Normal file
View File

@ -0,0 +1,378 @@
C0QMU121 ;VEN/SMH - Patient Reminder List, cont. ; 7/31/12 12:33pm
;;1.0;C0Q;;May 21, 2012;Build 63
;
; Licensed under package license.
;
SMOKING ; Smoking data collection
; WANT TO CHANGE SMOKING STATUS CHECKING FOR 2012 TO A SIMPLE SET OF
; HEALTH FACTORS. GPL
I $$INLIST^C0QMU12(ZYR_"HasSmokingStatus",DFN) D Q ; ALREADY HAS SMOKING STAT CHECK
. S C0QLIST(ZYR_"HasSmokingStatus",DFN)=""
. S C0QLIST(ZYR_"Over12",DFN)=""
I $$INLIST^C0QMU12(ZYR_"NoSmokingStatus",DFN) D Q ; ALREADY HAS SMOKING STATUS CHECK
. S C0QLIST(ZYR_"NoSmokingStatus",DFN)=""
. S C0QLIST(ZYR_"Over12",DFN)=""
N C0QSMOKE,C0QSYN
S C0QSYN=0
I $$AGE^C0QUTIL(DFN)<13 Q ; DON'T CHECK UNDER AGE 13
D HFCAT^C0QHF(.C0QSMOKE,DFN,"TOBACCO") ; GET ALL HEALTH FACTORS FOR THE
; PATIENT IN THE CATEGORY OF TOBACCO
I $D(C0QSMOKE) S C0QSYN=1
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smokeless Tobacco <1 Yr Ago")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smokeless Tobacco > 20 Yrs Ago")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smokeless Tobacco: 1-5 Yrs Ago")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smokeless Tobacco: 10-20 Yrs Ago")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smokeless Tobacco: 5-10 Yrs Ago")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smoking")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smoking < 1 Yr Ago")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smoking > 20 Yrs Ago")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smoking: 1-5 Yrs Ago")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smoking: 10-20 Yrs Ago")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smoking: 5-10 Yrs Ago")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKELESS TOBACCO USER")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKELESS: 1-5 YRS AGO")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKELESS: 10-20 YRS AGO")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKELESS: 5-10 YRS AGO")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKELESS: < 1 YR AGO")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKELESS: > 20 YRS AGO")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER 10-20 YRS")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER 20+ YRS")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER < 1 YR")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER < 1 YR AGO")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER > 20 YRS AGO")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER: 1-5 YRS")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER: 1-5 YRS AGO")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER: 10-20 YRS AGO")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER: 5-10 YRS")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER: 5-10 YRS AGO")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKELESS TOBACCO USER")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"LIFETIME NON-SMOKER")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smokeless Tobacco User")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker (PMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoke Exposure/2nd Hand Exposure")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 1-5 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 10-20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 5-10 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For < 1 Yr")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For > 20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Tobacco User")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 1-5 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 10-20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 5-10 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for < 1 Yr")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for > 20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoker (HPI)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (FMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (PMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking Cessation (OPH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"LIFETIME NON-SMOKER")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smokeless Tobacco User")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker (PMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoke Exposure/2nd Hand Exposure")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 1-5 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 10-20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 5-10 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For < 1 Yr")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For > 20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Tobacco User")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 1-5 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 10-20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 5-10 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for < 1 Yr")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for > 20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoker (HPI)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (FMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (PMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Non-Smoker")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"LIFETIME NON-SMOKER")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smokeless Tobacco User")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker (PMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoke Exposure/2nd Hand Exposure")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 1-5 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 10-20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 5-10 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For < 1 Yr")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For > 20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Tobacco User")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 1-5 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 10-20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 5-10 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for < 1 Yr")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for > 20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoker (HPI)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (FMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (PMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"LIFETIME NON-SMOKER")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smokeless Tobacco User")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker (PMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoke Exposure/2nd Hand Exposure")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 1-5 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 10-20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 5-10 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For < 1 Yr")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For > 20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Tobacco User")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 1-5 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 10-20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 5-10 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for < 1 Yr")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for > 20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoker (HPI)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (FMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (PMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Non-Smoker")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"LIFETIME NON-SMOKER")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smokeless Tobacco User")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker (PMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoke Exposure/2nd Hand Exposure")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 1-5 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 10-20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 5-10 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For < 1 Yr")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For > 20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Tobacco User")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 1-5 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 10-20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 5-10 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for < 1 Yr")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for > 20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoker (HPI)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (FMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (PMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Non-Smoker")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Non-Smoker (PMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Non-Tobacco User")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Current Smoker - No")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Current Smoker - Yes")
S C0QLIST(ZYR_"Over12",DFN)=""
;N GT
;S GT(1,"HasSmokingStatus","SMOK")=""
;S GT(2,"HasSmokingStatus","Smok")=""
;S GT(3,"HasSmokingStatus","smok")=""
;I 'C0QSYN D ;
;. N G
;. S OK=$$TXTALL^C0QNOTES(.G,.GT,DFN)
;. I $D(G) S C0QSYN=1
I C0QSYN S C0QLIST(ZYR_"HasSmokingStatus",DFN)=""
E S C0QLIST(ZYR_"NoSmokingStatus",DFN)=""
Q
;
DOTIME(ZHF) ; COMPUTE THE MEAN TIME IN THE ED FROM ARRIVAL TO DEPARTURE
; THIS IS A QUALITY MEASURE ED-1 FOR MEANINGFUL USE
; IT PRINTS A REPORT OF EACH PATIENT WITH THE ED TIMES RECORDED
; AND THEIR TIME. AT THE END IT PRINTS THE MEAN TIME
N ZP
S ZP=$$PATLN^C0QMU12(ZYR_"HasEDtime") ; patient list name for patients to process
S ZHFN=9000010.23 ; FILE NUMBER FOR V HEALTH FACTORS
S ZVFN=9000010 ; VISIT FILE NUMBER
K ZARY1,ZARY2
N ZI S ZI=""
S COUNT=0
F S ZI=$O(@ZP@(ZI)) Q:ZI="" D ; FOR EACH PATIENT
. S COUNT=COUNT+1
. N ZA,ZD
. S ZA=$$VHFIEN^C0QHF(ZI,"ED ARRIVAL TIME") ; IEN OF ARRIVAL HEALTH FACTOR
. S ZD=$$VHFIEN^C0QHF(ZI,ZHF) ; IEN OF DEPART HEALTH FACTOR
. N ZAD,ZDD ; ARRIVAL DATE, DEPARTURE DATE
. N ZAC,ZDC ; ARRIVAL COMMENT, DEPARTURE COMMENT
. ; THE COMMENT IS THE TIME XXYY
. N OK,TMP
. S TMP=$$GET1^DIQ(ZHFN,ZA_",",.03,"I") ; VISIT POINTER
. S ZAD=$$GET1^DIQ(ZVFN,TMP_",",.01,"I") ; VISIT DATE
. ;S ZAD=$P(^AUPNVHF(ZA,0),U,3) ; DATE IS PIECE 3
. S TMP=$$GET1^DIQ(ZHFN,ZD_",",.03,"I") ; VISIT POINTER
. S ZDD=$$GET1^DIQ(ZVFN,TMP_",",.01,"I") ; VISIT DATE
. ;S ZDD=$$GET1^DIQ(ZHFN,ZD_",",1201,"I") ; EVENT DATE FIELD
. ;S ZDD=$P(^AUPNVHF(ZD,0),U,3) ; DATE IS PIECE 3
. ;S OK=$$GET1^DIQ(ZHFN,ZA_",",81101,"","ZAC") ; ARRIVAL TIME
. S ZAC=$G(^AUPNVHF(ZA,811)) ; THE TIME
. ;S OK=$$GET1^DIQ(ZHFN,ZD_",",81101,"","ZDC") ; DEPARTURE TIME
. S ZDC=$G(^AUPNVHF(ZD,811)) ; DEPARTURE TIME
. N ZT ; THE TIME DIFFERENCE BETWEEN THE DATES
. W !,!,"PATIENT: ",ZI," ",$P(^DPT(ZI,0),U,1)
. W !,"IN: ",$$FMTE^XLFDT(ZAD_"."_ZAC)," OUT: ",$$FMTE^XLFDT(ZDD_"."_ZDC)
. S G1=($E(ZDC,1,2)*60)+($E(ZDC,3,4))
. S G2=($E(ZAC,1,2)*60)+($E(ZAC,3,4))
. I (ZDD-ZAD)>0 S G1=G1+(((ZDD-ZAD)*24)*60)
. S GTOT=G1-G2
. W !,"TIME: ",GTOT," ESTIMATED"
. S ZT=$$DTDIFF^C0QUTIL(ZDD,ZDC,ZAD,ZAC) ; COMPUTE THE DIFFERENCE IN MINUTES
. W !,"COMPUTED MINUTES: ",ZT
. ;I ZT'=GTOT B ; LET'S FIND OUT WHAT'S WRONG
. I ZT<0 D Q ; SKIP PATIENTS WITH NEGATIVE TIMES
. . W !,"****EXCLUDED****"
. I ZT>400000 D Q ; THESE ARE ERRORS
. . W !,"****EXCLUDED****"
. S ZARY1(ZT,ZI)="" ; ARRAY ORDERED BY MINUTES OF PATIENTS
N ZY,ZZ S ZY="" S ZZ=""
N ZCOUNT S ZCOUNT=0
F S ZY=$O(ZARY1(ZY)) Q:ZY="" D ; FOR EACH TIME
. F S ZZ=$O(ZARY1(ZY,ZZ)) Q:ZZ="" D ; FOR EACH PATIENT WITH THIS TIME
. . S ZCOUNT=ZCOUNT+1
. . S ZARY2(ZCOUNT,ZY,ZZ)=""
. . ;W !,ZCOUNT," PATIENT: ",ZZ," MINUTES: ",ZY
N ZMID
S ZMID=$P(ZCOUNT/2,".")
W !,"NUMBER OF PATIENTS IN REPORT: ",ZCOUNT
W !,"ED ARRIVAL TIME UNTIL ",ZHF
W !,"MEDIAN TIME: ",$O(ZARY2(ZMID,""))
Q
;
DOTIME2(ZHF) ; COMPUTE THE MEAN TIME IN THE ED FROM ARRIVAL TO DEPARTURE
; THIS IS A QUALITY MEASURE ED-1 FOR MEANINGFUL USE
; IT PRINTS A REPORT OF EACH PATIENT WITH THE ED TIMES RECORDED
; AND THEIR TIME. AT THE END IT PRINTS THE MEAN TIME
N ZP
S ZP=$$PATLN^C0QMU12(ZYR_"HasEDtime") ; patient list name for patients to process
S ZHFN=9000010.23 ; FILE NUMBER FOR V HEALTH FACTORS
S ZVFN=9000010 ; VISIT FILE NUMBER
K ZARY1,ZARY2
N ZI S ZI=""
S COUNT=0
F S ZI=$O(@ZP@(ZI)) Q:ZI="" D ; FOR EACH PATIENT
. S COUNT=COUNT+1
. N ZA,ZD
. ;S ZA=$$VHFIEN^C0QHF(ZI,"ED ARRIVAL TIME") ; IEN OF ARRIVAL HEALTH FACTOR
. ;S ZD=$$VHFIEN^C0QHF(ZI,ZHF) ; IEN OF DEPART HEALTH FACTOR
. S ZA=$$VHFIEN^C0QHF(ZI,ZHF) ; IEN OF DEPART HEALTH FACTOR
. S ZD=$$VHFIEN^C0QHF(ZI,"ED DEPARTURE TIME") ; IEN OF ARRIVAL HEALTH FACTOR
. N ZAD,ZDD ; ARRIVAL DATE, DEPARTURE DATE
. N ZAC,ZDC ; ARRIVAL COMMENT, DEPARTURE COMMENT
. ; THE COMMENT IS THE TIME XXYY
. N OK,TMP
. S TMP=$$GET1^DIQ(ZHFN,ZA_",",.03,"I") ; VISIT POINTER
. S ZAD=$$GET1^DIQ(ZVFN,TMP_",",.01,"I") ; VISIT DATE
. ;S ZAD=$P(^AUPNVHF(ZA,0),U,3) ; DATE IS PIECE 3
. S TMP=$$GET1^DIQ(ZHFN,ZD_",",.03,"I") ; VISIT POINTER
. S ZDD=$$GET1^DIQ(ZVFN,TMP_",",.01,"I") ; VISIT DATE
. ;S ZDD=$$GET1^DIQ(ZHFN,ZD_",",1201,"I") ; EVENT DATE FIELD
. ;S ZDD=$P(^AUPNVHF(ZD,0),U,3) ; DATE IS PIECE 3
. ;S OK=$$GET1^DIQ(ZHFN,ZA_",",81101,"","ZAC") ; ARRIVAL TIME
. S ZAC=$G(^AUPNVHF(ZA,811)) ; THE TIME
. ;S OK=$$GET1^DIQ(ZHFN,ZD_",",81101,"","ZDC") ; DEPARTURE TIME
. S ZDC=$G(^AUPNVHF(ZD,811)) ; DEPARTURE TIME
. N ZT ; THE TIME DIFFERENCE BETWEEN THE DATES
. W !,!,"PATIENT: ",ZI," ",$P(^DPT(ZI,0),U,1)
. W !,"IN: ",$$FMTE^XLFDT(ZAD_"."_ZAC)," OUT: ",$$FMTE^XLFDT(ZDD_"."_ZDC)
. S G1=($E(ZDC,1,2)*60)+($E(ZDC,3,4))
. S G2=($E(ZAC,1,2)*60)+($E(ZAC,3,4))
. I (ZDD-ZAD)>0 S G1=G1+(((ZDD-ZAD)*24)*60)
. S GTOT=G1-G2
. W !,"TIME: ",GTOT," ESTIMATED"
. S ZT=$$DTDIFF^C0QUTIL(ZDD,ZDC,ZAD,ZAC) ; COMPUTE THE DIFFERENCE IN MINUTES
. W !,"COMPUTED MINUTES: ",ZT
. ;I ZT'=GTOT B ; LET'S FIND OUT WHAT'S WRONG
. I ZT<0 D Q ; SKIP PATIENTS WITH NEGATIVE TIMES
. . W !,"****EXCLUDED****"
. I ZT>400000 D Q ; THESE ARE ERRORS
. . W !,"****EXCLUDED****"
. S ZARY1(ZT,ZI)="" ; ARRAY ORDERED BY MINUTES OF PATIENTS
N ZY,ZZ S ZY="" S ZZ=""
N ZCOUNT S ZCOUNT=0
F S ZY=$O(ZARY1(ZY)) Q:ZY="" D ; FOR EACH TIME
. F S ZZ=$O(ZARY1(ZY,ZZ)) Q:ZZ="" D ; FOR EACH PATIENT WITH THIS TIME
. . S ZCOUNT=ZCOUNT+1
. . S ZARY2(ZCOUNT,ZY,ZZ)=""
. . ;W !,ZCOUNT," PATIENT: ",ZZ," MINUTES: ",ZY
N ZMID
S ZMID=$P(ZCOUNT/2,".")
W !,"NUMBER OF PATIENTS IN REPORT: ",ZCOUNT
W !,"ED ARRIVAL TIME UNTIL ",ZHF
W !,"MEDIAN TIME: ",$O(ZARY2(ZMID,""))
Q
;
; LOOK AT GETTING RID OF PRINT AND SS AS THEY ARE NOT BEING USED. GPL
; VEN/SMH - Call is used in C0QMU12, perhaps not called.
;
PRINT ; PRINT TO SCREEN
I $D(WARD) W !!,WARD_"-"_WARDNAME_" "_RB_": "_PTNAME_"("_PTSEX_") "
I $D(EXDTE) D ;
. W !,"Discharge Date: ",EXDTE
. W !,DFN," ",PTNAME
W !,"DOB: ",PTDOB," HRN: ",PTHRN
W !,"Language Spoken: ",$G(PTLANG)
W !,"Race: ",RACEDSC
W !,"Ethnicity: ",$G(ETHNDSC)
W !,"Problems: "
W !,PBDESC
W !,"Allergies: "
W !,ALDESC
W !,"Medications: "
W !
Q
;
SS ; CREATE SPREADSHEET ARRAY
S G1("Patient")=DFN
I $D(WARD) D ;
. S G1("WardName")=WARDNAME
. S G1("RoomAndBed")=RB
I $D(EXDTE) D ;
. S G1("DischargeDate")=EXDTE
S G1("PatientName")=PTNAME
S G1("Gender")=PTSEX
S G1("DateOfBirth")=PTDOB
S G1("HealthRecordNumber")=PTHRN
S G1("LanguageSpoken")=$G(PTLANG)
S G1("Race")=RACEDSC
S G1("Ehtnicity")=$G(ETHNDSC)
S G1("Problem")=PBDESC
I PBDESC["No problems found" S G1("HasProblem")=0
E S G1("HasProblem")=1
S G1("Allergies")=ALDESC
I ALDESC["No Allergy" S G1("HasAllergy")=0
E S G1("HasAllergy")=1
I $D(MDITEM) D ;
. S G1("HasMed")=1
E S G1("HasMed")=0
S G1("MedDescription")=$G(MDDESC)
I $D(MDITEM) W !,"("_MDITEM_")"_MDDESC E W !,MDDESC
D RNF1TO2B^C0CRNF("GRSLT","G1")
K G1
Q ; DON'T WANT TO DO THE NHIN STUFF NOW
;
PATLIST ; CREATE PATIENT LISTS
; WANT TO GET RID OF PATLIST AND MOVE FUNCTION TO OTHER ROUTINES. GPL
; VEN/SMH - Call is moved here. Seems to be used in C0QMU12.
; Think about removing at another time.
S C0QLIST(ZYR_"Patient",DFN)="" ; THE PATIENT LIST
N DEMOYN S DEMOYN=1
I $G(PTSEX)="" S DEMOYN=0
I $G(PTDOB)="" S DEMOYN=0
I $G(PTHRN)="" S DEMOYN=0
I $G(PTLANG)="" S DEMOYN=0
I $G(RACEDSC)="" S DEMOYN=0
I $G(ETHNDSC)="" S DEMOYN=0
;I DEMOYN S C0QLIST("HasDemographics",DFN)=""
;E S C0QLIST("FailedDemographics",DFN)=""
;S G1("Gender")=PTSEX
;S G1("DateOfBirth")=PTDOB
;S G1("HealthRecordNumber")=PTHRN
;S G1("LanguageSpoken")=$G(PTLANG)
;S G1("Race")=RACEDSC
;S G1("Ehtnicity")=$G(ETHNDSC)
S G1("Problem")=PBDESC
I PBDESC["No problems found" S C0QLIST(ZYR_"NoProblem",DFN)=""
E S C0QLIST(ZYR_"HasProblem",DFN)=""
;S G1("Allergies")=ALDESC
I ALDESC["No Allergy" S C0QLIST(ZYR_"NoAllergy",DFN)=""
E S C0QLIST(ZYR_"HasAllergy",DFN)=""
;I $D(MDITEM) D ;
;. S C0QLIST("HasMed",DFN)=""
;E S G1("NoMed",DFN)=""
;S G1("MedDescription")=$G(MDDESC)
Q
;
NHIN ; SHOW THE NHIN ARRAY FOR THIS PATIENT
Q:DFN=137!(DFN=14)
D EN^C0CNHIN(.G,DFN,"")
D ZWRITE^C0QUTIL("G")
K G
;
QUIT ;end of WARD
;

View File

@ -0,0 +1,37 @@
C0QMU122 ;VEN/SMH - Patient Reminder List, cont. again ; 7/31/12 12:33pm
;;1.0;C0Q;;May 21, 2012;Build 63
;
; Licensed under package license.
;
DEMO ; patient demographics
K PTDOB
N PTNAME,PTSEX,PTHRN,PTRLANG,PTLANG,RACE,RACEDSC,ETHN,ETHNDSC,RB
S PTNAME=$P(^DPT(DFN,0),U) ;patient name
S PTDOB=$$FMTE^XLFDT($P($G(^DPT(DFN,0)),U,3)) ;date of birth
S PTSEX=$P($G(^DPT(DFN,0)),U,2) ;patient sex
D PID^VADPT ;VADPT call to grab PISD based on PT Eligibility
S PTHRN=$P($G(VA("PID")),U) ;health record number
S PTRLANG=$P($G(^DPT(DFN,256000)),U) ;ptr to language file
I $G(PTRLANG)'="" S PTLANG=$P(^DI(.85,PTRLANG,0),U) ;PLS extrnl
S RACE=""
F D Q:RACE=""
. S RACE=$O(^DPT(DFN,.02,"B",RACE)) ;race code IEN
. Q:'RACE
. S RACEDSC=$P($G(^DIC(10,RACE,0)),U) ;race description
S ETHN=""
F D Q:ETHN=""
. S ETHN=$O(^DPT(DFN,.06,"B",ETHN)) ;ethnicity IEN
. Q:'ETHN
. S ETHNDSC=$P($G(^DIC(10.2,ETHN,0)),U) ;ethnincity description
S RB=$P($G(^DPT(DFN,.101)),U) ;room and bed
N DEMOYN S DEMOYN=1
I $G(PTSEX)="" S DEMOYN=0
I $G(PTDOB)="" S DEMOYN=0
I $G(PTHRN)="" S DEMOYN=0
I $G(PTLANG)="" S DEMOYN=0
I $G(RACEDSC)="" S DEMOYN=0
I $G(ETHNDSC)="" S DEMOYN=0
I DEMOYN S C0QLIST(ZYR_"HasDemographics",DFN)=""
E S C0QLIST(ZYR_"FailedDemographics",DFN)=""
Q
;

View File

@ -0,0 +1,93 @@
C0QMU123 ; VEN/SMH - Clone a Measure Set and give a new name and filter. ; 10/23/12 1:07pm
;;1.0;QUALITY MEASURES;**6**;
; (C) George Lilly. Licensed under AGPL.
QUIT
;
CLONE(MSIEN,CLNNM,ISQM,FLNAME) ; Private $$ ; Clone a measure set into a new one
; Input:
; 1. Measurement Set IEN to clone
; 2. Clinic Name for which this Measurement Set would apply (FT)
; 3. Boolean: Is Quality Measure?
; 4. Filter List Name
;
; Output:
; IEN of Created measure set.
;
; Get data from Model Set
N C0QIENS S C0QIENS=MSIEN_"," ; Input to GETS call
N C0QOUT,C0QERR ; Output Variables in GETS call.
D GETS^DIQ(1130580001.201,C0QIENS,"**","",$NA(C0QOUT),$NA(C0QERR))
;
I $D(C0QERR) S $EC=",U1," ; Crash in case of error. Shouldn't happen.
;
; Deal with D0 stuff first.
; Merge D0 level into a new FDA array.
N C0QNEW ; New FDA
M C0QNEW(1130580001.201,"?+1,")=C0QOUT(1130580001.201,C0QIENS)
;
; Change .01
; NOTE: Field name is 30 characters. But HL is max 30 chars too!
; So we have to truncate it.
; If Is Quality Measure, Use QM, otherwise, use Performance Report.
S C0QNEW(1130580001.201,"?+1,",.01)=$E(CLNNM,1,27)_" "_$S(ISQM:"QM",1:"PR")
;
; Deal with D1 level
N I S I=0 ; Looper
N CNT S CNT=1 ; IENS counter ; Will become 2 and larger. Not to collide with the initial 1.
;
; For each record in D1 level
F S I=$O(C0QOUT(1130580001.2011,I)) Q:'I D
. S CNT=CNT+1
. ; Grab the Measure field
. S C0QNEW(1130580001.2011,"?+"_CNT_",?+1,",.01)=C0QOUT(1130580001.2011,I,.01)
. ;
. ; Put the Filter lists on
. S C0QNEW(1130580001.2011,"?+"_CNT_",?+1,",1.2)=FLNAME
. S C0QNEW(1130580001.2011,"?+"_CNT_",?+1,",2.2)=FLNAME
;
; File Data.
N C0QIEN,C0QERR ; Returned IEN, Error array
D UPDATE^DIE("E",$NA(C0QNEW),$NA(C0QIEN),$NA(C0QERR))
I $D(C0QERR) S $EC=",U1,"
;
Q C0QIEN(1) ; Quit with IEN for ?+1.
;
; SAM(1130580001.201,"17,",.01)="DR OFFICE QM REPORT"
; SAM(1130580001.201,"17,",.02)="AUG 1,2012"
; SAM(1130580001.201,"17,",.03)="OCT 31,2012"
; SAM(1130580001.201,"17,",.04)=""
; SAM(1130580001.201,"17,",.05)=""
; SAM(1130580001.201,"17,",.2)=""
; SAM(1130580001.201,"17,",.3)=""
; SAM(1130580001.201,"17,",.4)=""
; SAM(1130580001.2011,"1,17,",.01)="MU EP NQF 0013"
; SAM(1130580001.2011,"1,17,",1.1)=1
; SAM(1130580001.2011,"1,17,",1.2)="MU12-EP-DR OFFICE-Patient"
; SAM(1130580001.2011,"1,17,",2.1)=1
; SAM(1130580001.2011,"1,17,",2.2)="MU12-EP-DR OFFICE-Patient"
; SAM(1130580001.2011,"1,17,",3)=100
; SAM(1130580001.2011,"2,17,",.01)="MU EP NQF 0028A"
; SAM(1130580001.2011,"2,17,",1.1)=0
; SAM(1130580001.2011,"2,17,",1.2)="MU12-EP-DR OFFICE-Patient"
; SAM(1130580001.2011,"2,17,",2.1)=1
; SAM(1130580001.2011,"2,17,",2.2)="MU12-EP-DR OFFICE-Patient"
; SAM(1130580001.2011,"2,17,",3)=0
; SAM(1130580001.2011,"3,17,",.01)="MU EP NQF 0028B"
; SAM(1130580001.2011,"3,17,",1.1)=0
; SAM(1130580001.2011,"3,17,",1.2)="MU12-EP-DR OFFICE-Patient"
; SAM(1130580001.2011,"3,17,",2.1)=1
; SAM(1130580001.2011,"3,17,",2.2)="MU12-EP-DR OFFICE-Patient"
; SAM(1130580001.2011,"3,17,",3)=0
; SAM(1130580001.2011,"4,17,",.01)="MU EP NQF 0421"
; SAM(1130580001.2011,"4,17,",1.1)=1
; SAM(1130580001.2011,"4,17,",1.2)="MU12-EP-DR OFFICE-Patient"
; SAM(1130580001.2011,"4,17,",2.1)=1
; SAM(1130580001.2011,"4,17,",2.2)="MU12-EP-DR OFFICE-Patient"
; SAM(1130580001.2011,"4,17,",3)=100
; SAM(1130580001.20111,"1,1,17,",.01)="MOUSE,MICKEY"
; SAM(1130580001.20111,"1,4,17,",.01)="MOUSE,MICKEY"
; SAM(1130580001.20112,"1,1,17,",.01)="MOUSE,MICKEY"
; SAM(1130580001.20112,"1,2,17,",.01)="MOUSE,MICKEY"
; SAM(1130580001.20112,"1,3,17,",.01)="MOUSE,MICKEY"
; SAM(1130580001.20112,"1,4,17,",.01)="MOUSE,MICKEY"
;

327
qrda/C0Q/trunk/p/C0QMUERX.m Normal file
View File

@ -0,0 +1,327 @@
C0QMUERX ; VEN - Analyze ERx Data for Patients ; 5/30/12 12:40pm
;;1.0;C0Q;;May 21, 2012;Build 44
QUIT ; No Entry from the top
;
UT ; Unit Tests
N C0QDEBUG S C0QDEBUG=1
W "Testing ^DPT B Index",!
D EN("^DPT(""B"")")
W !,"Testing B Index on a C0Q Patient List",!
D EN("^C0Q(301,4,1,""B"")")
W !,"Testing ^AUPNPAT B Index",!
D EN("^AUPNPAT(""B"")")
W !,"Testing Reminder Patient List B Index",!
D EN("^PXRMXP(810.5,80,30,""B"")")
W !,"Testing upright file ^DPT",!
D EN("^DPT")
W !,"Testing a file with no data",!
D EN("^ALKJSDF")
W !,"Testing a no valid parameters",!
D EN("")
UT2 ; Units Tests 2
N C0QDEBUG S C0QDEBUG=1
D EN("^C0Q(301,4,1,""B"")")
QUIT
UT3 ; More Unit Tests
N C0QDEBUG S C0QDEBUG=1
D EN($$PATLN^C0QMU12("MU12-EP-HasERX"))
W $$COUNT($$PATLN^C0QMU12("MU12-EP-HasERX"))
QUIT
EN(C0QLIST) ; PEP - Analyze ERx Data and store
; Parameters:
; C0QLIST - Pass by Name. Global or Local Reference.
; Can be: ^DPT("B") for all patients or ^C0Q(301,2,1,"B") for a specific patient list
; Future: Can be a search template on file 2 or 9000001
;
; Check if XML Soap Message is installed
I '$D(^C0PX("B","GETMEDS6")) WRITE "GETMEDS6 Soap Message not installed",! QUIT
;
; Check if SOAP^C0PWS2 exists
I '$L($T(SOAP^C0PWS2)) WRITE "C0PWS2 Doesn't exist",! QUIT
;
; Check C0QLIST for sanity. Must be a single node.
IF '($DATA(C0QLIST)#2)!(C0QLIST="") WRITE "You didn't pass the list",! QUIT
;
; Contents must be a Reference with Data
IF '$DATA(@C0QLIST) WRITE "Destination doesn't contain any data",! QUIT
;
; Is this a B index?
NEW C0QB
IF $QSUBSCRIPT(C0QLIST,$QLENGTH(C0QLIST))="B" DO
. SET C0QB=1
. ; DEBUG
. W:$G(C0QDEBUG) "B index passed",!
. ; DEBUG
ELSE SET C0QB=0
;
; Make sure our TMP is empty
K ^TMP($J)
;
; Walk the global
N C0QWALK S C0QWALK=$SELECT(C0QB:"",'C0QB:0) ; Walker, start of $ORDER?
N C0QDONE S C0QDONE=0 ; Finish Flag
FOR SET C0QWALK=$O(@C0QLIST@(C0QWALK)) QUIT:C0QDONE DO
. ; Are we done?
. I C0QB,C0QWALK="" S C0QDONE=1 QUIT ; If in index and we are out, done
. I 'C0QB,'+C0QWALK S C0QDONE=1 QUIT ; If not in index and we are not numeric, done
. ;
. N C0QDFN ; DFN of Patient
. ; If Walking B Index and Index not numeric, grab DFN (assuming ^DPT or ^AUPNPAT)
. ; TODO: Should I check that the global is ^DPT or ^AUPNPAT?
. I C0QB,'+C0QWALK S C0QDFN=$O(@C0QLIST@(C0QWALK,""))
. ; Otherwise, we will assume the contents of the index are the DFNs
. E S C0QDFN=C0QWALK
. I $G(C0QDEBUG) W C0QDFN," "
. ;
. ; Now, check to see if the patient has e-Rx's
. I $$HASERX(C0QDFN) S ^TMP($J,C0QDFN)=""
;
W:$G(C0QDEBUG) ! ;
;
; Loop through collected DFNs, send to WS, and get data back, store in ^TMP($J,DFN)
N C0QDFN S C0QDFN=0
F S C0QDFN=$O(^TMP($J,C0QDFN)) Q:C0QDFN="" DO
. N C0POUT
. W:$G(C0QDEBUG) "Calling GETMEDS6 SOAP Web Service Call for "_C0QDFN,!
. D SOAP^C0PWS2("C0POUT","GETMEDS6",DUZ,C0QDFN)
. Q:$G(C0POUT(1,"RowCount"))=0 ; WS says no data
. M ^TMP($J,C0QDFN)=C0POUT
;
; From the New Crop Meaningful Use documentation:
; Appendix G: Meaningful Use Certification FAQ Question 10
;
; DENOMINATOR NUMERATOR
; DeaClassCode = 0, 9 DeaClassCode = 0, 9
; PharmacyType = 1 PharmacyType = 1
; PharmacyDetailType = 1, 2 PharmacyDetailType = 1, 2
; FinalDestinationType = 1, 2, 3, 4 FinalDestinationType = 3, 4
; FinalStatusType = 1, 4, 5 FinalStatusType = 1, 5
;
; DeMorgan's Law
; NOT(A or B) = NOT(A) and NOT(B)
; So to collect prescriptions for which DeaClassCode is 0 or 9
; We exclude all those who are not 0 AND not 9.
; See: http://en.wikipedia.org/wiki/De_Morgan%27s_laws#Negation_of_a_disjunction
;
; The algorithms below use an Onion Peeling method. Any prescription which
; fails makes you jump to the next prescription.
; The "Onion levels" are:
; DeaClassCode, PharamcyType, PharmacyDetailType, FinalDestinationType, FinalStatusType
;
; Now walk through collected DFNs and accumulate MU stats
;
; WARNING: Naked References below
;
N C0QDFN,C0QRXNO S (C0QDFN,C0QRXNO)=0
N C0QD S C0QD=0 ; Denominator - Overall (cf C0QDP below)
;
; Calculate Denominator below
F S C0QDFN=$O(^TMP($J,C0QDFN)) Q:C0QDFN="" DO
. N C0QDP S C0QDP=0 ; Denominator - Patient Specific
. F S C0QRXNO=$O(^TMP($J,C0QDFN,C0QRXNO)) Q:C0QRXNO="" DO
.. W:$G(C0QDEBUG) "Patient "_C0QDFN_" Rx "_C0QRXNO,!
.. ;
.. I ^(C0QRXNO,"DeaClassCode") ; Change $REFERENCE
.. ;
.. N DEA S DEA=^("DeaClassCode")
.. W:$G(C0QDEBUG) "DeaClassCode: "_DEA,!
.. Q:((DEA'=0)&(DEA'=9))
.. ;
.. N PT S PT=^("PharmacyType")
.. W:$G(C0QDEBUG) "PharmacyType: "_PT,!
.. Q:(PT'=1)
.. ;
.. N PDT S PDT=^("PharmacyDetailType")
.. W:$G(C0QDEBUG) "PharmacyDetailType: "_PDT,!
.. Q:((PDT'=1)&(PDT'=2))
.. ;
.. N FDT S FDT=^("FinalDestinationType")
.. W:$G(C0QDEBUG) "FinalDestinationType: "_FDT,!
.. Q:((FDT'=1)&(FDT'=2)&(FDT'=3)&(FDT'=4))
.. ;
.. N FST S FST=^("FinalStatusType")
.. W:$G(C0QDEBUG) "FinalStatusType: "_FST,!
.. Q:((FST'=1)&(FST'=4)&(FST'=5))
.. ;
.. W:$G(C0QDEBUG) "Adding to Denominator",!
.. S C0QDP=C0QDP+1
.. S C0QD=C0QD+1
. ;
. ; SAVE C0QDP - while it lasts!
. D SAVE(C0QLIST,C0QDFN,"ERXDEN",C0QDP)
;
; Calculate Numerator below
N C0QDFN,C0QRXNO S (C0QDFN,C0QRXNO)=0
N C0QN S C0QN=0 ; Numerator - Overall (cf C0QNP below)
F S C0QDFN=$O(^TMP($J,C0QDFN)) Q:C0QDFN="" DO
. N C0QNP S C0QNP=0 ; Numerator - Patient Specific
. F S C0QRXNO=$O(^TMP($J,C0QDFN,C0QRXNO)) Q:C0QRXNO="" DO
.. W:$G(C0QDEBUG) "Patient "_C0QDFN_" Rx "_C0QRXNO,!
.. ;
.. I ^(C0QRXNO,"DeaClassCode") ; Change $REFERENCE
.. ;
.. N DEA S DEA=^("DeaClassCode")
.. W:$G(C0QDEBUG) "DeaClassCode: "_DEA,!
.. Q:((DEA'=0)&(DEA'=9))
.. ;
.. N PT S PT=^("PharmacyType")
.. W:$G(C0QDEBUG) "PharmacyType: "_PT,!
.. Q:(PT'=1)
.. ;
.. N PDT S PDT=^("PharmacyDetailType")
.. W:$G(C0QDEBUG) "PharmacyDetailType: "_PDT,!
.. Q:((PDT'=1)&(PDT'=2))
.. ;
.. N FDT S FDT=^("FinalDestinationType")
.. W:$G(C0QDEBUG) "FinalDestinationType: "_FDT,!
.. Q:((FDT'=3)&(FDT'=4))
.. ;
.. N FST S FST=^("FinalStatusType")
.. W:$G(C0QDEBUG) "FinalStatusType: "_FST,!
.. Q:((FST'=1)&(FST'=5))
.. ;
.. W:$G(C0QDEBUG) "Adding to Numerator",!
.. S C0QNP=C0QNP+1
.. S C0QN=C0QN+1
. ;
. ; Save C0QNP while it lasts
. D SAVE(C0QLIST,C0QDFN,"ERXNUM",C0QNP)
;
S ^TMP($J)=C0QN_U_C0QD
;
; TODO: Over here, do something with the numerator and denominator..
; Probably store them somewhere.
;
I '$G(C0QDEBUG) K ^TMP($J) ; Empty out in production not testing
QUIT
;
HASERX(DFN) ; $$ - Private; Has E-Prescriptions?
; Parameters
; - DFN by Value
; Output
; 0 or 1 (false or true)
N ZI S ZI=""
N ZERX S ZERX=$NA(^PS(55,DFN,"NVA"))
N DONE,HASERX
F S ZI=$O(@ZERX@(ZI)) Q:ZI="" Q:$G(DONE) D
. I $G(@ZERX@(ZI,1,1,0))["E-Rx Web" S (DONE,HASERX)=1
Q +$G(HASERX)
;
SAVE(C0QLIST,C0QDFN,TYPE,COUNT) ; Proc - Private; Save Count in C0Q(301, file
; Layman's Explanation: Save the denominator or numerator for ePrescribing for
; each of the patients in the Subfile for that patient in ^C0Q(301,
; Still hard to understand though! Here's a demo:
; ^C0Q(301,IEN has a subfile under node 1 which stores the patients. E.g.
; ^C0Q(301,48,1,15,0)=91$
; ^C0Q(301,48,1,16,0)=93$
; ^C0Q(301,48,1,17,0)=173$
;
; I store the numerator and denominator under each of the patients. The numerator
; stands for the number of prescriptions that were electronically transmitted;
; the denominator stands for the numbers of prescriptions that COULD HAVE BEEN
; electronically transmitted. End result for Patient 173 is as follows:
; ^C0Q(301,48,1,17,0)=173
; ^C0Q(301,48,1,17,1,0)="^1130580001.3111^2^2"
; ^C0Q(301,48,1,17,1,1,0)="ERXDEN^0"
; ^C0Q(301,48,1,17,1,2,0)="ERXNUM^0"
; ^C0Q(301,48,1,17,1,"B","ERXDEN",1)=""
; ^C0Q(301,48,1,17,1,"B","ERXNUM",2)=""
;
; Subroutine COUNT (below) goes and counts the data
;
; Params:
; C0QLIST (by val): "B" x-ref where patients are located. Only supports ^C0Q(301, file.
; C0QDFN (by val): Patient DFN for whom to file data.
; TYPE (by val): Either ERXDEN or ERXNUM for eRx Denominator or eRx Numerator
; COUNT (by val): The number to save
;
; First, QUIT if this isn't a Quality Measures List?
; $QS(x,0) gets you the global name
;
; This should give you an idea of what I am dealing with!
;
; ^C0Q(301,48,1,15,0)=91
; ^C0Q(301,48,1,16,0)=93
; ^C0Q(301,48,1,17,0)=173
; ^C0Q(301,48,1,18,0)=174
; ^C0Q(301,48,1,"B",5,1)=""
; ^C0Q(301,48,1,"B",10,2)=""
; ^C0Q(301,48,1,"B",11,3)=""
; ^C0Q(301,48,1,"B",14,4)=""
;
I $QS(C0QLIST,0)'="^C0Q" W:$G(C0QDEBUG) "Not Saving Patient "_C0QDFN,! QUIT
;
; Otherwise, prepare to save
N C0QFDA ; Fileman Data Array
N C0QIENS ; IENS
N L1,L2 ; Top Level, Level 2
S L1=$QS(C0QLIST,2) ; Top Level IEN
S L2=$O(^C0Q(301,L1,1,"B",C0QDFN,"")) ; Patient IEN
S C0QIENS="?+1"_C0QDFN_","_L2_","_L1_"," ; TODO: Here C0QDFN is a dummy for uniqueness in FDA, not meaningful! - DO BETTER!
W:$G(C0QDEBUG) "IENs "_C0QIENS_" ready to file",!
W:$G(C0QDEBUG) "Saving "_TYPE_" of "_COUNT_" for Patient "_$P(^DPT(C0QDFN,0),U)_" ("_C0QDFN_")",!
S C0QFDA(1130580001.3111,C0QIENS,.01)=TYPE
S C0QFDA(1130580001.3111,C0QIENS,.02)=COUNT
;
W:$G(C0QDEBUG) "Fileman Data Array",!
I $G(C0QDEBUG) N % S %=$NA(C0QFDA) F S %=$Q(@%) Q:%="" W %_": "_@%,!
;
N C0QERR ; Errors
D UPDATE^DIE("","C0QFDA","","C0QERR")
;
I $D(C0QERR) DO
. W "Error in filing data",!
. N % S %=$NAME(C0QERR) F S %=$Q(@%) Q:%="" W %_": "_@%,!
;
QUIT
;
COUNT(C0QLIST) ; $$ - Private; Count Numerator and Denominator for a Patient List
; Input: C0QLIST - Pass by Value - Patient Listing B index (only C0Q(301,IEN,1,"B", listing is supported)
; Output: (as string) NUMERATOR/DENOMINATOR
;
I $QS(C0QLIST,0)'="^C0Q" W:$G(C0QDEBUG) "Counting for files other than C0Q(301, not supported ",! QUIT "0/0"
; MEASURE -----------
; IEN ----------- |
; L1 ------| | |
; V V V
; ^C0Q(301,48,1,2,1,1,0)="ERXDEN^0"
; ^C0Q(301,48,1,2,1,2,0)="ERXNUM^0"
; ^C0Q(301,48,1,2,1,"B","ERXDEN",1)=""
; ^C0Q(301,48,1,2,1,"B","ERXNUM",2)=""
; ^C0Q(301,48,1,2,1,"B"
W:$G(C0QDEBUG) "DFN",?20,"Denominator",?40,"Numerator",!
;
N L1 S L1=$QS(C0QLIST,2) ; Top Level IEN
;
N DENTOT,NUMTOT S (DENTOT,NUMTOT)=0 ; Denominator Total, Numerator Total
;
N C0QDFN S C0QDFN=0 ; Walker through B index
F S C0QDFN=$O(^C0Q(301,L1,1,"B",C0QDFN)) Q:C0QDFN="" DO
. N IEN S IEN=$O(^(C0QDFN,"")) ; naked naked - get IEN from B index
. W:$G(C0QDEBUG) C0QDFN
. ;
. ; Denom Processing
. N DENIEN S DENIEN=$O(^C0Q(301,L1,1,IEN,1,"B","ERXDEN","")) ; Denom IEN
. N DEN S DEN=$S(DENIEN:$P(^C0Q(301,L1,1,IEN,1,DENIEN,0),U,2),1:"N/A") ; Denominator
. W:$G(C0QDEBUG) ?20,DEN
. S DENTOT=DENTOT+DEN ; Total it up (N/A becomes zero)
. ;
. N NUMIEN S NUMIEN=$O(^C0Q(301,L1,1,IEN,1,"B","ERXNUM","")) ; Numerator IEN
. N NUM S NUM=$S(NUMIEN:$P(^C0Q(301,L1,1,IEN,1,NUMIEN,0),U,2),1:"N/A") ; Numerator
. W:$G(C0QDEBUG) ?40,NUM
. S NUMTOT=NUMTOT+NUM ; Total it up (N/A becomes zero)
. ;
. w:$G(C0QDEBUG) !
;
; Write the totals
D:$G(C0QDEBUG)
. W ?20,"==="
. W ?40,"==="
. W !
. ;
. W ?20,DENTOT
. W ?40,NUMTOT
. W !
;
; Quit with Numeartor/Denominator
QUIT NUMTOT_"/"_DENTOT

116
qrda/C0Q/trunk/p/C0QNOTES.m Normal file
View File

@ -0,0 +1,116 @@
C0QNOTES ;GPL - Utility to look up patient notes ; 7/31/12 8:17am
;;1.0;C0Q;;May 21, 2012;Build 63
;
;2011 George Lilly <glilly@glilly.net> - Licensed under the terms of the GNU
;General Public License See attached copy of the License.
;
;This program is free software; you can redistribute it and/or modify
;it under the terms of the GNU General Public License as published by
;the Free Software Foundation; either version 2 of the License, or
;(at your option) any later version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License along
;with this program; if not, write to the Free Software Foundation, Inc.,
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
;
Q
HASNTYN(ZNTYP,DFN) ; EXTRINSIC 1 YES 0 NO DOES THE PATIENT DFN HAVE
; NOTE TYPE ZNTYP
N C0QN,C0QO
S C0QO=$NA(^TIU(8925.1,"B",ZNTYP)) ; ALL DOCUMENT DEFS FOR THIS NAME
S C0QN=$NA(^TIU(8925,"AA",DFN)) ; NOTES THE PATIENT HAS
N C0QR
D UNITY^C0QSET("C0QR",C0QN,C0QO) ; DOES PATIENT HAVE THE NOTE?
N ZR
I $D(C0QR(1)) S ZR=1
E S ZR=0
Q ZR
;
TESTNT(DFN) ; TEST THE NTTXT ROUTINE
W !,"MEDICATION RECON IN ER NURSE NOTE"
I $$NTTXT("ER NURSE NOTE","MEDICATION RECONCILIATION COMPLET",DFN) W " FOUND"
E W " NOT FOUND"
W !,"Medication Recon in MED/SURG NURSING ADMISSION ASSESSMENT"
I $$NTTXT("MED/SURG NURSING ADMISSION ASSESSMENT","Medication Reconcilation complete",DFN) W "FOUND"
E W " NOT FOUND"
Q
;
NTTXT(NTTITLE,NTTXT,DFN) ; EXTRINSIC 1 YES 0 NO DOES PATIENT HAVE
; TEXT NTTXT IN NOTE TITLE NTTITLE
N C0QNTA,C0QTYP
S C0QDFMT=$O(^TIU(8925.1,"B",NTTITLE,"")) ; DOCUMENT FORMAT IEN
S C0QNTA=$NA(^TIU(8925,"AA",DFN,C0QDFMT)) ; ARRAY OF NOTES OF THIS TYPE FOR
;^TIU(8925,"AA",15393,1808,6889171,375262)=""
N ZI,ZN,ZD,ZL
S ZD="" ; DATE OF THE THE NOTE
N FOUND S FOUND=0
F S ZD=$O(@C0QNTA@(ZD)) Q:FOUND Q:ZD="" D ; FOR EACH DATE
. S ZN=""
. F S ZN=$O(@C0QNTA@(ZD,ZN)) Q:FOUND Q:ZN="" D ; EACH NOTE
. . W !,"NOTE ",ZN," ",$G(^TIU(8925,ZN,"TEXT",1,0))
. . S ZI=0 ; WANT TO STAR ON LINE 1
. . S ZL=$NA(^TIU(8925,ZN,"TEXT"))
. . F S ZI=$O(@ZL@(ZI)) Q:+ZI=0 D ;
. . . I $P($G(@ZL@(ZI,0)),NTTXT,2)'="" S FOUND=1 D ;
. . . . W "**********",$G(@ZL@(ZI,0)),!
Q FOUND ; IT'S THAT SIMPLE... PLEASE LEAVE SOME TEXT AT THE END OF WHAT
; YOU SEARCH FOR...gpl ... for example is this is the note title:
; MED/SURG NURSING ADMISSION ASSESSMENT
;and this is the text you want: Medication Reconcilation completed.
; search for: Medication Reconcilation complete
; that will leave the "d." in piece two of the line
;
; or for this note:
;ER NURSE NOTE
; and this text:
;MEDICATION RECONCILIATION COMPLETED
; search for MEDICATION RECONCILIATION COMPLET
; which will leave the "ED" in piece 2
TXTALL(ZRTN,ZTARY,DFN) ; EXTRINSIC WHICH SEARCHES ALL OF A PATIENT'S NOTES
; FOR AN ARRAY OF TEXT MATCHES. ZRTN IS PASSED BY REFERENCE AND IS LIKE
; AN RPC RETURN. ZTARY IS PASSED BY REFERENCE AND HAS THE FORMAT
; ZTARY(1,"TEXT1")="" ZTARY(2,"TEXT2")="" ETC
N C0QTYP,C0QDFMT
;S C0QDFMT=$O(^TIU(8925.1,"B",NTTITLE,"")) ; DOCUMENT FORMAT IEN
S C0QNTA=$NA(^TIU(8925,"AA",DFN)) ; ARRAY OF NOTES FOR
;^TIU(8925,"AA",15393,1808,6889171,375262)=""
N ZI,ZJ,ZN,ZD,ZL,ZT,NTTXT,ZC,ZTYP
S ZT=""
F S ZT=$O(@C0QNTA@(ZT)) Q:ZT="" D ;
. S ZTYP=$$GET1^DIQ(8925.1,ZT_",",.01) ; NAME OF NOTE TITLE
. S ZD="" ; DATE OF THE THE NOTE
. N FOUND S FOUND=0
. F S ZD=$O(@C0QNTA@(ZT,ZD)) Q:FOUND Q:ZD="" D ; FOR EACH DATE
. . S ZN=""
. . F S ZN=$O(@C0QNTA@(ZT,ZD,ZN)) Q:FOUND Q:ZN="" D ; EACH NOTE
. . . W !,"NOTE ",ZN," ",$G(^TIU(8925,ZN,"TEXT",1,0))
. . . S ZI=0 ; WANT TO STAR ON LINE 1
. . . S ZL=$NA(^TIU(8925,ZN,"TEXT"))
. . . F S ZI=$O(@ZL@(ZI)) Q:+ZI=0 D ;
. . . . S ZJ="" ; INDEX FOR SEARCH TERMS
. . . . F S ZJ=$O(ZTARY(ZJ)) Q:ZJ="" D ; FOR EACH SEARCH TERM
. . . . . S ATTR=$O(ZTARY(ZJ,""))
. . . . . S NTTXT=$O(ZTARY(ZJ,ATTR,""))
. . . . . I $P($G(@ZL@(ZI,0)),NTTXT,2)'="" S FOUND=1 D ;
. . . . . . W "**********",$G(@ZL@(ZI,0)),!
. . . . . . S ZC=$O(ZRTN(""),-1) ; NEXT COUNT
. . . . . . I ZC="" S ZC=1
. . . . . . E S ZC=ZC+1
. . . . . . S ZRTN(ZC,ATTR,ZTYP,ZN,NTTXT)=$G(@ZL@(ZI,0))
Q $G(FOUND) ; IT'S THAT SIMPLE... PLEASE LEAVE SOME TEXT AT THE END OF WHAT
;
TESTALL ;
S GT(1,"HasSmokingStatus","SMOK")=""
S GT(2,"HasSmokingStatus","Smok")=""
S GT(3,"HasSmokingStatus","smok")=""
S GT(4,"HasMedRecon","MEDICATION RECONCILIATION COMPLET")=""
S GT(5,"HasMedRecon","Medication Reconcilation Complete")=""
W $$TXTALL(.G,.GT,2) ; CHECK ALL PATIENT 2'S NOTEST FOR SMOKING
D ZWRITE^C0QUTIL("G")
Q
;

9
qrda/C0Q/trunk/p/C0QP1.m Normal file
View File

@ -0,0 +1,9 @@
C0QP1 ; VEN/SMH - Inits for Patch 1 ; 6/13/12 4:27pm
;;1.0;C0Q;;May 21, 2012;Build 44
;
POST ; Post-Install hook for Patch 1; PEP
; Fire off the new x-refs for entries in the parameter file
N C0QI S C0QI=0 ; Walk through starting with number 1
F S C0QI=$O(^C0Q(401,C0QI)) Q:'C0QI D
. N DA,DIK S DIK="^C0Q(401,",DIK(1)="2^AMMS",DA=C0QI D EN^DIK
. N DA,DIK S DIK="^C0Q(401,",DIK(1)="2.1^AQMS",DA=C0QI D EN^DIK

180
qrda/C0Q/trunk/p/C0QPQRI.m Normal file
View File

@ -0,0 +1,180 @@
C0QPQRI ; GPL - GENERATES A PQRI XML FILE ; 5/23/12 2:42pm
;;1.0;C0Q;;May 21, 2012;Build 63
;Copyright 2011 George Lilly. Licensed under the terms of the GNU
;General Public License See attached copy of the License.
;
;This program is free software; you can redistribute it and/or modify
;it under the terms of the GNU General Public License as published by
;the Free Software Foundation; either version 2 of the License, or
;(at your option) any later version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License along
;with this program; if not, write to the Free Software Foundation, Inc.,
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
;
Q
;
C0QQFN() Q 1130580001.101 ; FILE NUMBER FOR C0Q QUALITY MEASURE FILE
C0QMFN() Q 1130580001.201 ; FILE NUMBER FOR C0Q MEASUREMENT FILE
C0QMMFN() Q 1130580001.2011 ; FN FOR MEASURE SUBFILE
C0QMMNFN() Q 1130580001.20111 ; FN FOR NUMERATOR SUBFILE
C0QMMDFN() Q 1130580001.20112 ; FN FOR DENOMINATOR SUBFILE
RLSTFN() Q 810.5 ; FN FOR REMINDER PATIENT LIST FILE
RLSTPFN() Q 810.53 ; FN FOR REMINDER PATIENT LIST PATIENT SUBFILE
;
EN ;
; lets try some hard coded values for now
N C0QVAR
;
; first, the values that occur only once for the file
;
S C0QVAR("create-by")="RegistryA"
S C0QVAR("create-date")="12-10-2010"
S C0QVAR("create-time")="14:27"
S C0QVAR("file-number")=1
S C0QVAR("number-of-files")=9
S C0QVAR("version")="1.0"
;
; registry values
;
S C0QVAR("registry-id")=125789123
S C0QVAR("registry-name")="Model Registry"
S C0QVAR("submission-method")="C"
;
; values for each provider
;
S C0QVAR("npi")=12011989
S C0QVAR("tin")=387682321
S C0QVAR("waiver-signed")="Y"
S C0QVAR("encounter-from-date")="06-13-2010"
S C0QVAR("encounter-to-date")="12-10-2010"
;
; values for each measure group
;
S C0QVAR("ffs-patient-count")=2
S C0QVAR("group-eligible-instances")=30
S C0QVAR("group-reporting-rate")=66.67
S C0QVAR("group-reporting-rate-numerator")=20
;
; for each measure
;
S C0QVAR("pqri-measure-number")=128
S C0QVAR("eligible-instances")=100
S C0QVAR("meets-performance-instances")=18
S C0QVAR("performance-exclusion-instances")=0
S C0QVAR("performance-not-met-instances")=10
S C0QVAR("performance-rate")="90.00"
S C0QVAR("reporting-rate")="28.00"
;
;
N ZG,ZV
D GETTEMP^C0CMXP("ZG","PQRIXML") ; GET THE TEMPLATE
D BIND^C0CSOAP("ZV","C0QVAR","PQRIXML") ; GET BINDING VALUES
D MAP^C0CXPATH("ZG","ZV","ZO") ; MAP THE XML
D MEA("GG","GGG") ; GET THE MEASURES
N GB ; BUILD LIST
D QUEUE^C0CXPATH("GB","ZO",1,30) ; first part of pqri.xml
D QUEUE^C0CXPATH("GB","GG",2,$O(GG(""),-1)-1) ; the measures
D QUEUE^C0CXPATH("GB","ZO",$O(ZO(""),-1)-2,$O(ZO(""),-1)) ; LAST LINES
D BUILD^C0CXPATH("GB","GZO") ; BUILD THE XML
N ZI S ZI=0
F S ZI=$O(ZO(ZI)) Q:ZI="" D ; FOR EACH LINE OF XML
. W !,GZO(ZI) ; WRITE OUT THE XML
N GN,GN1,GD S GN=$NA(^TMP("C0QXML",$J))
K @GN
K ZO(0) ; GET RID OF LINE COUNT
M @GN=GZO
S GN1=$NA(@GN@(1))
S GD=$G(^TMP("C0CCCR","ODIR")) ; CONVENIENT OUTPUT DIRECTORY
W $$OUTPUT^C0CXPATH(GN1,"pqri.xml",GD)
K @GN ; DONT NEED IT ANYMORE
Q
;
INSERT(ZARY,ZONE) ; INSERT ONE MEASURE INTO THE ARRAY
;
;N GGG
S GGG="//submission/measure-group ID='C'/provider/pqri-measure" ;XPATH
D INSINNER^C0CXPATH(ZARY,GGG,ZONE) ; INSERT XML
Q
;
PQRI(ZOUT,KEEP) ; RETURN THE NHIN ARRAY FOR THE PQRI XML TEMPLATE
;
N ZG
S ZG=$NA(^TMP("PQRIXML",$J))
K @ZG
D GETXML^C0CMXP(ZG,"PQRIXML") ; GET THE XML FROM C0C MISC XML
N C0CDOCID
S C0CDOCID=$$PARSE^C0CDOM(ZG,"PQRIXML") ; PARSE THE XML
D DOMO^C0CDOM(C0CDOCID,"/","ZOUT","GIDX","GARY",,"//submission") ; BLD ARRAYS
I '$G(KEEP) K GIDX,GARY ; GET RID OF THE ARRAYS UNLESS KEEP=1
Q
;
PROCESS(ZRSLT,ZXML,ZREDUCE,KEEP) ; PARSE AND RUN DOMO ON XML
; ZRTN IS PASSED BY REFERENCE
; ZXML IS PASSED BY NAME
; IF KEEP IS 1, GARY AND GIDX ARE NOT KILLED
;
N ZG
S ZG=$NA(^TMP("C0CXML",$J))
K @ZG
M @ZG=@ZXML
S C0CDOCID=$$PARSE^C0CDOM(ZG,"NHINARRAY") ; PARSE WITH MXML
D DOMO^C0CDOM(C0CDOCID,"/","ZRSLT","GIDX","GARY",,$G(ZREDUCE)) ; BLD ARRAYS
I '$G(KEEP) K GIDX,GARY,@ZG ; GET RID OF THE ARRAYS UNLESS KEEP=1
Q
;
GETFM(RTN,ZREC) ; GET THE QUALITY MEASURES ARRAY
;
I '$D(ZREC) S ZREC=7 ; OUTPATIENT CERTIFICATION SET
;N GPL
D LIST^DIC($$C0QMMFN(),","_ZREC_",",".01;1.1;2.1;3;",,,,,,,,"GPL")
N ZI S ZI=""
F S ZI=$O(GPL("DILIST","ID",ZI)) Q:ZI="" D ;
. S @RTN@(ZI,"measure")=GPL("DILIST","ID",ZI,.01)
. N ZMIEN,ZMEAIEN,ZRNAME
. S ZMIEN=GPL("DILIST",2,ZI) ; IEN OF MEASURE IN MEASURE FILE
. ;S ZMEAIEN=$$GET1^DIQ($$C0QMMFN(),ZMIEN_","_ZREC_",",.01,"I") ; MEASURE
. S ZRNAME=$$GET1^DIQ($$C0QMMFN(),ZMIEN_","_ZREC_",",".01:.8") ; MEASURE
. ;S @RTN@(ZI,"reportingName")=$$GET1^DIQ($$C0QQFN(),ZMEAIEN_",",.8) ; RNAME
. S @RTN@(ZI,"reportingName")=ZRNAME ; A SHORTCUT TO THE REPORTING NAME
. S @RTN@(ZI,"reportingNumber")=$P(ZRNAME,"NQF",2) ; NQF0001 -> 0001
. S @RTN@(ZI,"denominator")=+GPL("DILIST","ID",ZI,2.1)
. S @RTN@(ZI,"numerator")=+GPL("DILIST","ID",ZI,1.1)
. N ZNUM,ZDEM,ZPCT
. S (ZNUM,ZDEM,ZPCT)=0
. S ZDEM=+GPL("DILIST","ID",ZI,2.1)
. S ZNUM=+GPL("DILIST","ID",ZI,1.1)
. I ZDEM>0 S ZPCT=((ZNUM*100)/ZDEM)
. S @RTN@(ZI,"percent")=$P(ZPCT,".",1)
. S @RTN@(ZI,"ien")=ZI
;ZWR GPL
Q
;
MEA(ZOUT,ZIN) ; CREATE XML FROM THE MEASURES ARRAY
;
D GETFM(ZIN) ; GET THE MEASURES
;N G
;N ZI,ZJ
S ZI=""
F S ZI=$O(@ZIN@(ZI)) Q:ZI="" D ;
. N ZDEN,ZNUM,ZPCT
. S ZDEN=$G(@ZIN@(ZI,"denominator"))
. S ZNUM=$G(@ZIN@(ZI,"numerator"))
. S ZPCT=$G(@ZIN@(ZI,"percent"))
. S G("pqri-measure",ZI,"eligible-instances")=ZDEN
. S G("pqri-measure",ZI,"meets-performance-instances")=ZNUM
. S G("pqri-measure",ZI,"performance-exclusion-instances")=0
. S G("pqri-measure",ZI,"performance-not-met-instances")=ZDEN-ZNUM
. S G("pqri-measure",ZI,"performance-rate")=ZPCT
. S G("pqri-measure",ZI,"pqri-measure-number")="NQF "_@ZIN@(ZI,"reportingNumber")
. S G("pqri-measure",ZI,"reporting-rate")=ZPCT
K ^TMP("MXMLDOM",$J)
S C0CDOCID=$$DOMI^C0CDOM("G",1,"root")
D OUTXML^C0CDOM(ZOUT,C0CDOCID,1)
Q
;

690
qrda/C0Q/trunk/p/C0QPRML.m Normal file
View File

@ -0,0 +1,690 @@
C0QPRML ;JJOH/ZAG/GPL - Patient Reminder List ;7/5/11 8:50pm
;;1.0;C0Q;;May 21, 2012;Build 33
;
;2011 Zach Gonzales<zach@linux.com> - Licensed under the terms of the GNU
;General Public License See attached copy of the License.
;
;This program is free software; you can redistribute it and/or modify
;it under the terms of the GNU General Public License as published by
;the Free Software Foundation; either version 2 of the License, or
;(at your option) any later version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License along
;with this program; if not, write to the Free Software Foundation, Inc.,
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
;
BUILD ; CALL ALL AND DIS AND BUILD THE GRSLT ARRAY or print or create
; patient lists
;N GRSLT ; ARRAY FOR RESULTS
I '$D(C0QSS) S C0QSS=0 ;default don't build spreadsheet array
I '$D(C0QPR) S C0QPR=0 ;default don't print out results
I '$D(C0QPL) S C0QPL=1 ;default do create patient lists
N G1 ; ONE SET OF VALUES - RNF1 FORMAT
; INITIALIZE LISTS
; this is done so that if there are no matching patients, the patient list
; will be zeroed out
S C0QLIST("HasDemographics")=""
S C0QLIST("Patient")=""
S C0QLIST("HasProblem")=""
S C0QLIST("HasAllergy")=""
S C0QLIST("HasMed")=""
S C0QLIST("HasVitalSigns")=""
S C0QLIST("HasMedOrders")=""
S C0QLIST("HasSmokingStatus")=""
D ALL ; all currently admitted patients in the hospital
D DIS ; all patients discharged since the reporting period began
I C0QSS ZWR GRSLT
I C0QPL D ;
. D FILE ; FILE THE PATIENT LISTS
. D UPDATE^C0QUPDT(.G,8) ; UPDATE THE MU MEASUREMENT SET
. D UPDATE^C0QUPDT(.G,9) ; UPDATE THE MU MEASUREMENT SET
Q
;
ALL ;retrieve active inpatients
N WARD S WARD=""
F D Q:WARD=""
. S WARD=$O(^DIC(42,"B",WARD)) ;ward name
. Q:WARD=""
. N WIEN S WIEN=""
. F S WIEN=$O(^DIC(42,"B",WARD,WIEN)) Q:'WIEN D ;wards IEN
. . S WARDNAME=$P(^DIC(42,WIEN,0),U,2) ;ward name
. . N DFN,RB S DFN=""
. . F S DFN=$O(^DPT("CN",WARD,+DFN)) Q:'DFN D ;DFN of patient on ward
. . . D DEMO
. . . D PROBLEM
. . . D ALLERGY
. . . D MEDS4
. . . D RECON2
. . . D ADVDIR
. . . D SMOKING
. . . D VITALS
. . . D VTE1
. . . D EDTIME
. . . I C0QPR D PRINT
. . . I C0QSS D SS
. . . I C0QPL D PATLIST
Q
;
DEMO ; patient demographics
K PTDOB
N PTNAME,PTSEX,PTHRN,PTRLANG,PTLANG,RACE,RACEDSC,ETHN,ETHNDSC,RB
S PTNAME=$P(^DPT(DFN,0),U) ;patient name
S PTDOB=$$FMTE^XLFDT($P($G(^DPT(DFN,0)),U,3)) ;date of birth
S PTSEX=$P($G(^DPT(DFN,0)),U,2) ;patient sex
D PID^VADPT ;VADPT call to grab PISD based on PT Eligibility
S PTHRN=$P($G(VA("PID")),U) ;health record number
S PTRLANG=$P($G(^DPT(DFN,256000)),U) ;ptr to language file
I $G(PTRLANG)'="" S PTLANG=$P(^DI(.85,PTRLANG,0),U) ;PLS extrnl
S RACE=""
F D Q:RACE=""
. S RACE=$O(^DPT(DFN,.02,"B",RACE)) ;race code IEN
. Q:'RACE
. S RACEDSC=$P($G(^DIC(10,RACE,0)),U) ;race description
S ETHN=""
F D Q:ETHN=""
. S ETHN=$O(^DPT(DFN,.06,"B",ETHN)) ;ethnicity IEN
. Q:'ETHN
. S ETHNDSC=$P($G(^DIC(10.2,ETHN,0)),U) ;ethnincity description
S RB=$P($G(^DPT(DFN,.101)),U) ;room and bed
N DEMOYN S DEMOYN=1
I $G(PTSEX)="" S DEMOYN=0
I $G(PTDOB)="" S DEMOYN=0
I $G(PTHRN)="" S DEMOYN=0
I $G(PTLANG)="" S DEMOYN=0
I $G(RACEDSC)="" S DEMOYN=0
I $G(ETHNDSC)="" S DEMOYN=0
I DEMOYN S C0QLIST("HasDemographics",DFN)=""
E S C0QLIST("FailedDemographics",DFN)=""
Q
;
PROBLEM ; PATIENT PROBLEMS
D LIST^ORQQPL(.PROBL,DFN,"A")
S PBCNT=""
F S PBCNT=$O(PROBL(PBCNT)) Q:PBCNT="" D
. S PBDESC=$P(PROBL(PBCNT),U,2) ;problem description
K PROBL
Q
;
ALLERGY ; ALLERGY LIST
D LIST^ORQQAL(.ALRGYL,DFN)
S ALCNT=""
F S ALCNT=$O(ALRGYL(ALCNT)) Q:ALCNT="" D
. S ALDESC=$P(ALRGYL(ALCNT),U,2) ;allergy description
K ALRGYL
Q
;
MEDS ; MEDICATIONS
;
I DFN=97 D Q ;
. S MDCNT=271
K MEDSL
D EN^C0CNHIN(.MEDSL,DFN,"MED;") ; GET THE MEDS FROM THE NHIN API
; can't use COVER^ORWPS even though it's fast.. we need to detect
; if the medications are Inpatient to compute the CPOE measure
; we will use the NHINV routines for this purpose
;D COVER^ORWPS(.MEDSL,DFN)
S MDCNT="" S HASINP=0
F S MDCNT=$O(MEDSL("med",MDCNT)) Q:MDCNT="" D
. ;Q:$P(MEDSL(MDCNT),U,4)'="ACTIVE" ;active medications only
. Q:MEDSL("med",MDCNT,"status@value")'="active"
. ;S MDDESC=$P(MEDSL(MDCNT),U,2) ;medication description
. S MDDESC=$G(MEDSL("med",MDCNT,"products.product@name"))
. ;S MDITEM=$P($G(MEDSL(MDCNT)),U,3)
. S MDITEM=$G(MEDSL("med",MDCNT,"sig")) ; i think this is what meditem is
. I MEDSL("med",MDCNT,"vaType@value")="I" S HASINP=1
I HASINP D ; THE PATIENT HAS AN INPATIENT MED
. S C0QLIST("HasMedOrders",DFN)="" ; an inpatient drug indicates CPOE
E S C0QLIST("NoMedOrders",DFN)="" ; this will be different for outpatient
K MEDSL
Q
;
MEDS2 ; MEDICATIONS
;
K MEDSL,MDDESC,MDITEM
D COVER^ORWPS(.MEDSL,DFN) ; CPRS MED LIST
I '$D(MEDSL) D ;
. S C0QLIST("NoMedOrders",DFN)=""
. I $$HFYN^C0QHF(DFN,"MEDS HAVE BEEN REVIEWED") D ;
. . S C0QLIST("HasMed",DFN)=""
. E S C0QLIST("NoMed",DFN)=""
S MDCNT="" S HASINP=0
F S MDCNT=$O(MEDSL(MDCNT)) Q:MDCNT="" D ;
. ;Q:$P(MEDSL(MDCNT),U,4)'="ACTIVE" ;active medications only
. ;S C0QLIST("HasMedOrders",DFN)=""
. S C0QLIST("HasMed",DFN)=""
. S MDDESC=$P(MEDSL(MDCNT),U,2) ;medication description
. S MDITEM=$P($G(MEDSL(MDCNT)),U,3)
. I $P($P(MEDSL(MDCNT),"^",1),";",2)="I" S HASINP=1
I HASINP D ; THE PATIENT HAS AN INPATIENT MED
. S C0QLIST("HasMedOrders",DFN)="" ; an inpatient drug indicates CPOE
E S C0QLIST("NoMedOrders",DFN)="" ; this will be different for outpatient
K MEDSL
Q
;
MEDS3 ; USE THE REMINDER INDEX ^PXRMINDX TO CHECK FOR MEDS
;
S C0QPXRM=$NA(^PXRMINDX(55,"PI")) ; REMINDER INDEX FOR DRUGS
I $D(@C0QPXRM@(DFN)) D ; HAS MEDS
. S C0QLIST("HasMed",DFN)=""
. S C0QLIST("HasMedOrders",DFN)=""
E D ; NO MEDS
. S C0QLIST("NoMed",DFN)=""
. S C0QLIST("NoMedOrders",DFN)=""
Q
;
MEDS4 ; USE OCL^PSOORRL TO GET ALL MEDS
N BEG,END
S BEG=$$DT^C0PCUR("JULY 3,2011")
S END=$$DT^C0PCUR("NOW")
D OCL^PSOORRL(DFN,BEG,END) ;DBIA #2400
N C0QMEDS
M C0QMEDS=^TMP("PS",$J) ; MEDS RETURNED FROM CALL
N FOUND
N ZI
I '$D(C0QMEDS(1)) D Q ; QUIT IF NO MEDS
. S C0QLIST("NoMed",DFN)=""
E D ; HAS MEDS
. S C0QLIST("HasMed",DFN)=""
S ZI="" S FOUND=0
F S ZI=$O(C0QMEDS(ZI)) Q:ZI="" D ; FOR EACH MED
. N ZM
. S ZM=$G(C0QMEDS(ZI,0)) ;THE MEDICATION
. I $P($P(ZM,"^",1),";",2)="I" D ; IE 1U;I FOR AN INPATIENT UNIT DOSE
. . S FOUND=1
I FOUND S C0QLIST("HasMedOrders",DFN)="" ; MET CPOE MEASURE
E S C0QLIST("NoMedOrders",DFN)=""
Q
;
RECON ; MEDICATIONS RECONCILIATION
;
I $$HASNTYN^C0QNOTES("MED/SURG NURSING ADMISSION ASSESSMENT",DFN) D ;
. S C0QLIST("XferOfCare",DFN)="" ; transfer of care patient
N HASRECON S HASRECON=0
N GT,G
S GT(4,"HasMedRecon","MEDICATION RECONCILIATION COMPLET")=""
S GT(5,"HasMedRecon","Medication Reconcilation Complete")=""
I $$TXTALL^C0QNOTES(.G,.GT,DFN) D ; SEARCH ALL NOTES FOR MED RECON
. S HASRECON=1
;N ZT
;S ZT="MEDICATION RECONCILIATION COMPLET"
;I $$NTTXT^C0QNOTES("ER NURSE NOTE",ZT,DFN) D ;
;. S HASRECON=1
;E D ;
;. S ZT="Medication Reconcilation Complete"
;. I $$NTTXT^C0QNOTES("MED/SURG NURSING ADMISSION ASSESSMENT",ZT,DFN) D ;
;. . S HASRECON=1
;I $$HFYN^C0QHF("MEDS HAVE BEEN REVIEWED",DFN) S HASRECON=1
I HASRECON D ;
. S C0QLIST("HasMedRecon",DFN)=""
E S C0QLIST("NoMedRecon",DFN)=""
Q
;
RECON2 ; USE HEALTH FACTORS FOR MEDICATION RECONCILIATION
I $$HASNTYN^C0QNOTES("MED/SURG NURSING ADMISSION ASSESSMENT",DFN) D ;
. S C0QLIST("XferOfCare",DFN)="" ; transfer of care patient
I $$HFYN^C0QHF(DFN,"Medication Reconciliation Completed: Yes") D ;
. S C0QLIST("HasMedRecon",DFN)=""
E S C0QLIST("NoMedRecon",DFN)=""
Q
;
ADVDIR ; ADVANCE DIRECTIVE
;
I $$AGE^C0QUTIL(DFN)>64 D ; ONLY FOR PATIENTS 65 AND OLDER
. S C0QLIST("Over65",DFN)=""
. I $$HASNTYN^C0QNOTES("ADVANCE DIRECTIVE",DFN) D ;
. . S C0QLIST("HasAdvanceDirective",DFN)=""
. E D ;
. . S C0QLIST("NoAdvanceDirective",DFN)=""
Q
;
SMOKING ;
I $$INLIST("HasSmokingStatus",DFN) D Q ; ALREADY HAS SMOKING STATUS CHECK
. S C0QLIST("HasSmokingStatus",DFN)=""
. S C0QLIST("Over12",DFN)=""
I $$INLIST("NoSmokingStatus",DFN) D Q ; ALREADY HAS SMOKING STATUS CHECK
. S C0QLIST("NoSmokingStatus",DFN)=""
. S C0QLIST("Over12",DFN)=""
N C0QSMOKE,C0QSYN
S C0QSYN=0
I $$AGE^C0QUTIL(DFN)<13 Q ; DON'T CHECK UNDER AGE 13
D HFCAT^C0QHF(.C0QSMOKE,DFN,"TOBACCO") ; GET ALL HEALTH FACTORS FOR THE
; PATIENT IN THE CATEGORY OF TOBACCO
I $D(C0QSMOKE) S C0QSYN=1
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smokeless Tobacco <1 Yr Ago")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smokeless Tobacco > 20 Yrs Ago")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smokeless Tobacco: 1-5 Yrs Ago")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smokeless Tobacco: 10-20 Yrs Ago")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smokeless Tobacco: 5-10 Yrs Ago")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smoking")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smoking < 1 Yr Ago")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smoking > 20 Yrs Ago")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smoking: 1-5 Yrs Ago")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smoking: 10-20 Yrs Ago")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smoking: 5-10 Yrs Ago")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKELESS TOBACCO USER")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKELESS: 1-5 YRS AGO")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKELESS: 10-20 YRS AGO")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKELESS: 5-10 YRS AGO")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKELESS: < 1 YR AGO")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKELESS: > 20 YRS AGO")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER 10-20 YRS")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER 20+ YRS")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER < 1 YR")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER < 1 YR AGO")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER > 20 YRS AGO")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER: 1-5 YRS")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER: 1-5 YRS AGO")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER: 10-20 YRS AGO")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER: 5-10 YRS")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER: 5-10 YRS AGO")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKELESS TOBACCO USER")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"LIFETIME NON-SMOKER")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smokeless Tobacco User")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker (PMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoke Exposure/2nd Hand Exposure")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 1-5 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 10-20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 5-10 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For < 1 Yr")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For > 20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Tobacco User")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 1-5 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 10-20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 5-10 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for < 1 Yr")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for > 20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoker (HPI)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (FMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (PMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking Cessation (OPH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"LIFETIME NON-SMOKER")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smokeless Tobacco User")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker (PMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoke Exposure/2nd Hand Exposure")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 1-5 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 10-20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 5-10 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For < 1 Yr")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For > 20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Tobacco User")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 1-5 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 10-20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 5-10 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for < 1 Yr")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for > 20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoker (HPI)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (FMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (PMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Non-Smoker")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"LIFETIME NON-SMOKER")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smokeless Tobacco User")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker (PMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoke Exposure/2nd Hand Exposure")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 1-5 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 10-20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 5-10 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For < 1 Yr")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For > 20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Tobacco User")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 1-5 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 10-20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 5-10 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for < 1 Yr")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for > 20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoker (HPI)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (FMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (PMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"LIFETIME NON-SMOKER")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smokeless Tobacco User")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker (PMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoke Exposure/2nd Hand Exposure")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 1-5 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 10-20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 5-10 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For < 1 Yr")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For > 20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Tobacco User")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 1-5 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 10-20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 5-10 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for < 1 Yr")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for > 20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoker (HPI)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (FMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (PMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Non-Smoker")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"LIFETIME NON-SMOKER")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smokeless Tobacco User")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker (PMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoke Exposure/2nd Hand Exposure")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 1-5 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 10-20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 5-10 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For < 1 Yr")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For > 20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Tobacco User")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 1-5 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 10-20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 5-10 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for < 1 Yr")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for > 20 Yrs")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoker (HPI)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (FMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (PMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Non-Smoker")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Non-Smoker (PMH)")
S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Non-Tobacco User")
S C0QLIST("Over12",DFN)=""
N GT
S GT(1,"HasSmokingStatus","SMOK")=""
S GT(2,"HasSmokingStatus","Smok")=""
S GT(3,"HasSmokingStatus","smok")=""
;N ZT
;S ZT="Smok"
;S:'C0QSYN C0QSYN=$$NTTXT^C0QNOTES("ER NURSE NOTE",ZT,DFN) ;
I 'C0QSYN D ;
. N G
. S OK=$$TXTALL^C0QNOTES(.G,.GT,DFN)
. I $D(G) S C0QSYN=1
I C0QSYN S C0QLIST("HasSmokingStatus",DFN)=""
E S C0QLIST("NoSmokingStatus",DFN)=""
Q
;
VITALS ;
;
N C0QSDT,C0QEDT
D DT^DILF(,"JULY 3,2011",.C0QSDT) ; START DATE
D DT^DILF(,"T",.C0QEDT) ; END DATE TODAY
D VITALS^ORQQVI(.VITRSLT,DFN,C0QSDT,C0QEDT) ; CALL FAST VITALS
I $D(VITRSLT) D ;ZWR VITRSLT B ;
. I VITRSLT(1)["No vitals found." S C0QLIST("NoVitalSigns",DFN)=""
. E S C0QLIST("HasVitalSigns",DFN)=""
Q
;
VTE1 ; VTE PROPHYLAXIS WITHIN 24HRS OF ARRIVAL
;
I $$HFYN^C0QHF(DFN,"VTE PROPHYLAXIS WITHIN 24HRS OF ARRIVAL") D ;
. S C0QLIST("HasVTE24",DFN)=""
E S C0QLIST("NoVTE24",DFN)=""
Q
;
EDTIME ; CHECK FOR EMERGENCY DEPT TIME FACTORS
N FOUND
S FOUND=0
I $$HFYN^C0QHF(DFN,"ED ARRIVAL TIME") S FOUND=1
I '$$HFYN^C0QHF(DFN,"ED DEPARTURE TIME") S FOUND=0
I '$$HFYN^C0QHF(DFN,"TIME DECISION TO ADMIT MADE") S FOUND=0
I FOUND D ;
. S C0QLIST("HasEDtime",DFN)=""
E S C0QLIST("NoEDtime",DFN)=""
Q
;
INLIST(ZLIST,DFN) ; EXTRINSIC FOR IS PATIENT ALREADY IN LIST ZLIST
N ZL,ZR
S ZL=$O(^C0Q(301,"CATTR",ZLIST,"")) ; IEN OF LIST IN C0Q PATIENT LIST FILE
I ZL="" Q 0 ; LIST DOES NOT EXIST
S ZR=0 ; ASSUME NOT IN LIST
I $D(^C0Q(301,ZL,1,"B",DFN)) S ZR=1 ; PATIENT IS IN LIST
Q ZR
;
PRINT ; PRINT TO SCREEN
I $D(WARD) W !!,WARD_"-"_WARDNAME_" "_RB_": "_PTNAME_"("_PTSEX_") "
I $D(EXDTE) D ;
. W !,"Discharge Date: ",EXDTE
. W !,DFN," ",PTNAME
W !,"DOB: ",PTDOB," HRN: ",PTHRN
W !,"Language Spoken: ",$G(PTLANG)
W !,"Race: ",RACEDSC
W !,"Ethnicity: ",$G(ETHNDSC)
W !,"Problems: "
W !,PBDESC
W !,"Allergies: "
W !,ALDESC
W !,"Medications: "
W !
Q
;
SS ; CREATE SPREADSHEET ARRAY
S G1("Patient")=DFN
I $D(WARD) D ;
. S G1("WardName")=WARDNAME
. S G1("RoomAndBed")=RB
I $D(EXDTE) D ;
. S G1("DischargeDate")=EXDTE
S G1("PatientName")=PTNAME
S G1("Gender")=PTSEX
S G1("DateOfBirth")=PTDOB
S G1("HealthRecordNumber")=PTHRN
S G1("LanguageSpoken")=$G(PTLANG)
S G1("Race")=RACEDSC
S G1("Ehtnicity")=$G(ETHNDSC)
S G1("Problem")=PBDESC
I PBDESC["No problems found" S G1("HasProblem")=0
E S G1("HasProblem")=1
S G1("Allergies")=ALDESC
I ALDESC["No Allergy" S G1("HasAllergy")=0
E S G1("HasAllergy")=1
I $D(MDITEM) D ;
. S G1("HasMed")=1
E S G1("HasMed")=0
S G1("MedDescription")=$G(MDDESC)
I $D(MDITEM) W !,"("_MDITEM_")"_MDDESC E W !,MDDESC
D RNF1TO2B^C0CRNF("GRSLT","G1")
K G1
Q ; DON'T WANT TO DO THE NHIN STUFF NOW
;
PATLIST ; CREATE PATIENT LISTS
S C0QLIST("Patient",DFN)="" ; THE PATIENT LIST
N DEMOYN S DEMOYN=1
I $G(PTSEX)="" S DEMOYN=0
I $G(PTDOB)="" S DEMOYN=0
I $G(PTHRN)="" S DEMOYN=0
I $G(PTLANG)="" S DEMOYN=0
I $G(RACEDSC)="" S DEMOYN=0
I $G(ETHNDSC)="" S DEMOYN=0
;I DEMOYN S C0QLIST("HasDemographics",DFN)=""
;E S C0QLIST("FailedDemographics",DFN)=""
;S G1("Gender")=PTSEX
;S G1("DateOfBirth")=PTDOB
;S G1("HealthRecordNumber")=PTHRN
;S G1("LanguageSpoken")=$G(PTLANG)
;S G1("Race")=RACEDSC
;S G1("Ehtnicity")=$G(ETHNDSC)
S G1("Problem")=PBDESC
I PBDESC["No problems found" S C0QLIST("NoProblem",DFN)=""
E S C0QLIST("HasProblem",DFN)=""
;S G1("Allergies")=ALDESC
I ALDESC["No Allergy" S C0QLIST("NoAllergy",DFN)=""
E S C0QLIST("HasAllergy",DFN)=""
;I $D(MDITEM) D ;
;. S C0QLIST("HasMed",DFN)=""
;E S G1("NoMed",DFN)=""
;S G1("MedDescription")=$G(MDDESC)
Q
;
NHIN ; SHOW THE NHIN ARRAY FOR THIS PATIENT
Q:DFN=137!14
D EN^C0CNHIN(.G,DFN,"")
ZWR G
K G
;
QUIT ;end of WARD
;
;
DIS;
N DFN,DTE,EXDTE S DTE=""
F D Q:DTE=""
. S DTE=$O(^DGPM("B",DTE))
. Q:'DTE
. Q:$P(DTE,".")<3110703
. S EXDTE=$$FMTE^XLFDT(DTE)
. N PTFM S PTFM=""
. D
. . S PTFM=$O(^DGPM("B",DTE,PTFM))
. . Q:'PTFM
. . S DFN=$P(^DGPM(PTFM,0),U,3)
. . S C0QLIST("Patient",DFN)=""
. . D DEMO
. . D PROBLEM
. . D ALLERGY
. . D MEDS4
. . D RECON2
. . D ADVDIR
. . D SMOKING
. . D VITALS
. . D VTE1
. . D EDTIME
. . I C0QPR D PRINT
. . I C0QSS D SS
. . I C0QPL D PATLIST
Q
;
C0QPLF() Q 1130580001.301 ; FILE NUMBER FOR C0Q PATIENT LIST FILE
C0QALFN() Q 1130580001.311 ; FILE NUMBER FOR C0Q PATIENT LIST PATIENT SUBFILE
FILE ; FILE THE PATIENT LISTS TO C0Q PATIENT LIST
;
I '$D(C0QLIST) Q ;
N LFN S LFN=$$C0QALFN()
N ZI,ZN
S ZI=""
F S ZI=$O(C0QLIST(ZI)) Q:ZI="" D ;
. S ZN=$O(^C0Q(301,"CATTR",ZI,""))
. I ZN="" D Q ; OOPS
. . W !,"ERROR, ATTRIBUTE NOT FOUND IN PATIENT LIST FILE:"_ZI
. ;S ZN=$$KLNCR(ZN) ; KILL AND RECREATE RECORD ZN
. N C0QNEW,C0QOLD,C0QRSLT
. S C0QNEW=$NA(C0QLIST(ZI)) ; THE NEW PATIENT LIST
. S C0QOLD=$NA(^C0Q(301,ZN,1,"B")) ; THE OLD PATIENT LIST
. D UNITY^C0QSET("C0QRSLT",C0QNEW,C0QOLD) ; FIND WHAT'S NEW
. N ZJ,ZK
. ; FIRST, DELETE THE OLD ONES - NO LONGER IN THE LIST
. K C0QFDA
. S ZJ=""
. F S ZJ=$O(C0QRSLT(2,ZJ)) Q:ZJ="" D ; MARKED WITH A 2 FROM UNITY
. . S ZK=$O(@C0QOLD@(ZJ,"")) ; GET THE IEN OF THE RECORD TO DELETE
. . I ZK="" D Q ; OOPS SHOULDN'T HAPPEN
. . . W !,"INTERNAL ERROR FINDING A PATIENT TO DELETE"
. . . B
. . S C0QFDA(LFN,ZK_","_ZN_",",.01)="@"
. I $D(C0QFDA) D UPDIE ; PROCESS THE DELETIONS
. ; SECOND, PROCESS THE ADDITIONS
. K C0QFDA
. S ZJ="" S ZK=1
. F S ZJ=$O(C0QRSLT(0,ZJ)) Q:ZJ="" D ; PATIENTS TO ADD ARE MARKED WITH 0
. . S C0QFDA(LFN,"+"_ZK_","_ZN_",",.01)=ZJ
. . S ZK=ZK+1
. I $D(C0QFDA) D UPDIE ; PROCESS THE ADDITIONS
;. Q
;. K C0QFDA
;. N ZJ,ZC
;. S ZJ="" S ZC=1
;. F S ZJ=$O(C0QLIST(ZI,ZJ)) Q:ZJ="" D ; FOR EACH PAT IN LIST
;. . S C0QFDA(LFN,"?+"_ZC_","_ZN_",",.01)=ZJ
;. . S ZC=ZC+1
;. D UPDIE
;. W !,"FOUND:"_ZI
Q
;
KLNCR(ZREC) ; KILL AND RECREATE RECORD ZREC IN PATIENT LIST FILE
;
N C0QFDA,ZFN,LIST,ATTR
S ZFN=$$C0QPLF() ; FILE NUMBER FOR C0Q PATIENT LIST FILE
D CLEAN^DILF
S LIST=$$GET1^DIQ(ZFN,ZREC_",",.01) ; MEASURE NAME
S ATTR=$$GET1^DIQ(ZFN,ZREC_",",999) ; ATTRIBUTE
D CLEAN^DILF
K ZERR
S C0QFDA(ZFN,ZREC_",",.01)="@" ; GET READY TO DELETE THE MEASURE
D FILE^DIE(,"C0QFDA","ZERR") ; KILL THE SUBFILE
I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST, INVOKE THE ERROR TRAP IF TASKED
;. W "ERROR",!
;. ZWR ZERR
;. B
K C0QFDA
S C0QFDA(ZFN,"+1,",.01)=LIST ; GET READY TO RECREATE THE RECORD
S C0QFDA(ZFN,"+1,",999)=ATTR ; ATTRIBUTE
D UPDIE ; CREATE THE SUBFILE
N ZR ; NEW IEN FOR THE RECORD
S ZR=$O(^C0Q(301,"CATTR",ATTR,""))
;
Q ZR
;
UPDIE ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS
K ZERR
D CLEAN^DILF
D UPDATE^DIE("","C0QFDA","","ZERR")
I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST, INVOKE THE ERROR TRAP IF TASKED
;. W "ERROR",!
;. ZWR ZERR
;. B
K C0QFDA
Q
;
; WHAT FOLLOWS IS OLD CODE - DELETE WHEN THIS WORKS
;. . N PTNAME S PTNAME=$P(^DPT(DFN,0),U,1)
;. . S PTDOB=$$FMTE^XLFDT($P($G(^DPT(DFN,0)),U,3)) ;date of birth
;. . S PTSEX=$P($G(^DPT(DFN,0)),U,2) ;patient sex
;. . D PID^VADPT ;VADPT call to grab PISD based on PT Eligibility
;. . S PTHRN=$P($G(VA("PID")),U) ;health record number
;. . S PTRLANG=$P($G(^DPT(DFN,256000)),U) ;ptr to language file
;. . I $G(PTRLANG)'="" S PTLANG=$P(^DI(.85,PTRLANG,0),U) ;PLS extrnl
;. . S RACE=""
;. . F D Q:RACE=""
;. . . S RACE=$O(^DPT(DFN,.02,"B",RACE))
;. . . Q:'RACE
;. . . S RACEDSC=$P($G(^DIC(10,RACE,0)),U)
;. . N ETHNDSC
;. . N ETHNDSC S ETHNDSC=""
;. . S ETHN=""
;. . F D Q:ETHN=""
;. . . S ETHN=$O(^DPT(DFN,.06,"B",ETHN))
;. . . Q:'ETHN
;. . . S ETHNDSC=$P($G(^DIC(10.2,ETHN,0)),U)
;. . D LIST^ORQQPL(.PROBL,DFN,"A")
;. . S PBCNT=""
;. . F S PBCNT=$O(PROBL(PBCNT)) Q:PBCNT="" D
;. . . S PBDESC=$P(PROBL(PBCNT),U,2) ;problem description
;. . K PROBL
;. . D LIST^ORQQAL(.ALRGYL,DFN)
;. . S ALCNT=""
;. . F S ALCNT=$O(ALRGYL(ALCNT)) Q:ALCNT="" D
;. . . S ALDESC=$P(ALRGYL(ALCNT),U,2) ;allergy description
;. . K ALRGYL
;. . D COVER^ORWPS(.MEDSL,DFN)
;. . S MDCNT=""
;. . F S MDCNT=$O(MEDSL(MDCNT)) Q:MDCNT="" D
;. . . Q:$P(MEDSL(MDCNT),U,4)'="ACTIVE" ;active medications only
;. . . S MDDESC=$P(MEDSL(MDCNT),U,2) ;medication description
;. . . S MDITEM=$P($G(MEDSL(MDCNT)),U,3)
;. . K MEDSL
;. . W !,"Discharge Date: ",EXDTE
;. . W !,DFN," ",PTNAME
;. . W !,"DOB: ",PTDOB," HRN: ",PTHRN
;. . W !,"Language Spoken: ",$G(PTLANG)
;. . W !,"Race: ",RACEDSC
;. . W !,"Ethnicity: ",ETHNDSC
;. . W !,"Problems: "
;. . W !,PBDESC
;. . W !,"Allergies: "
;. . W !,ALDESC
;. . W !,"Medications: "
;. . I $D(MDITEM) W !,"(",MDITEM,")",MDDESC E W !,MDDESC
;. . W !
;Q
;
;
;
;
END ;end of C0QPRML;

267
qrda/C0Q/trunk/p/C0QQRDA.m Normal file
View File

@ -0,0 +1,267 @@
C0QQRDA ; GPL - Quality Reporting QRDA Processing ; 8/2/12 10:15am
;;1.0;QUALITY MEASURES;**4**;May 21, 2012;Build 28
;Copyright 2012 George Lilly. Licensed under the terms of the GNU
;General Public License See attached copy of the License.
;
;This program is free software; you can redistribute it and/or modify
;it under the terms of the GNU General Public License as published by
;the Free Software Foundation; either version 2 of the License, or
;(at your option) any later version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License along
;with this program; if not, write to the Free Software Foundation, Inc.,
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
;
EN ; Private to this Package; Main Entry Point for this routine
; This EP is interactive or silent depending on params
;
; Check for config errors first; try to set-up.
N % S %=$$CHECKPAR()
I +%=1 D EN^DDIOL($P(%,U,2)) QUIT ; No inpatient pars found... QUIT
I +%=2 D ; No QRDA Measure Sets... try to set it up.
. D EN^DDIOL("Trying to automatically set-up measure sets in parameters")
. N % S %=$$SETUPPAR($$INPPARM())
. I % D EN^DDIOL("Failed to set-up..."_$P(%,U,2))
. E D EN^DDIOL("...Set-up complete")
;
; Print Intro
N %
S %(1)="This program collects patients from the denominators of the measures"
S %(2)="STK, VTE, and ED and outputs modified CCR files to the kernel default"
S %(3)="directory (probably /tmp/)."
S %(4)=""
S %(5)="This will take some time to execute."
S %(6)=""
S %(6,"F")="!!!"
;
D EN^DDIOL(.%)
;
; Ask user which measure set to run
N DIR,DTOUT,DUOUT,X,Y,DIRUT,DIROUT,DA ; DIR variables
S DIR(0)="SB^V:VTE;S:STK;E:ED;A:ALL"
S DIR("A")="Measure to calculate"
S DIR("A",1)="Which measure set would you like to produce QRDA documents for?"
S DIR("A",2)="Choose to Run [V]TE Measure Set, [S]TK Measure Set, or "
S DIR("A",3)="[E]D Measure Set. Or you can choose to run [A]ll of them."
D ^DIR
;
I $G(DTOUT)!$G(DUOUT) QUIT ; Did user hit '^' or time out?
;
; Get the Measure Set IEN which the user has seleted.
; NB: field names start with VTE, STK, or ED; so I can use the output
; of DIR directly.
;
N FLD S FLD=Y(0) ; Grab full text of user choice into var "FLD" for field.
N C0QMSIENS ; Measure set IENs (^ piece); (0) stores the identifier for file names
;looks like this in the end
; C0QMSIENS=1^3^5
; C0QMSIENS(0)="ED^VTE^STK"
;
N INPPARM S INPPARM=$$INPPARM() ; Inpatient Parameter IEN in 401
;
; If not all, grab the measure; else, grab all of them in ^ pieces
I FLD'="ALL" D
. S C0QMSIENS=$$GET1^DIQ(1130580001.401,INPPARM,FLD,"I")
. S C0QMSIENS(0)=FLD
;
E D
. N C0QED S C0QED=$$GET1^DIQ(1130580001.401,INPPARM,"ED","I")
. N C0QVTE S C0QVTE=$$GET1^DIQ(1130580001.401,INPPARM,"VTE","I")
. N C0QSTK S C0QSTK=$$GET1^DIQ(1130580001.401,INPPARM,"STK","I")
. S C0QMSIENS=C0QED_U_C0QVTE_U_C0QSTK
. S C0QMSIENS(0)="ED"_U_"VTE"_U_"STK"
;
;
S:'C0QMSIENS $EC=",U1," ; Debug.Assert that MSIEN is numeric.
;
;
; Do the work
N C0QI ; Counter through the measures
F C0QI=1:1:$L(C0QMSIENS,U) D
. N MSIEN S MSIEN=$P(C0QMSIENS,U,C0QI) ; Measure Set IEN
. N MSNAME S MSNAME=$P(C0QMSIENS(0),U,C0QI) ; Measure Set Name
. N REF S REF=$NAME(^TMP("C0QQRDA",$J)) ; Global for data collection
. K @REF ; Clear global
. D WORK(REF,MSIEN) ; Process Measure Set, collect data in global
. D PRINTXML(REF,MSNAME) ; Generate XML; output to File.
. K @REF ; Clear global
QUIT
;
;SILENTEN(RETURN) ; For future RPC calls...; needs to be reworked.
; N % S %=$$CHECKPAR()
; I % S RETURN(0)=% Q
;
; N DIQUIET S DIQUIET=1
; D EN
; S RETURN(0)=0
; QUIT
;
CHECKPAR() ; Private Proc; Check if environment is okay.
; Output: 0 or +ve^message for error
; 1 -> No Inpatient Parameters found
; 2 -> Measurement Set(s) not found.
;
N INPPARM S INPPARM=$$INPPARM() ; Inpatient Parameters IEN
I 'INPPARM Q 1_U_"No Inpatient Parameters found"
;
; Pointer fields to Measurement Set file, we grab the IENs
N C0QED S C0QED=$$GET1^DIQ(1130580001.401,INPPARM,"ED","I")
N C0QSTK S C0QSTK=$$GET1^DIQ(1130580001.401,INPPARM,"STK","I")
N C0QVTE S C0QVTE=$$GET1^DIQ(1130580001.401,INPPARM,"VTE","I")
;
N TXT S TXT="" ; Error text
I 'C0QED S TXT=TXT_"ED,"
I 'C0QSTK S TXT=TXT_"STK,"
I 'C0QVTE S TXT=TXT_"VTE"
I $E(TXT,$L(TXT))="," S TXT=$E(TXT,1,$L(TXT)-1) ; remove trailing comma
I $L(TXT) Q 2_U_"Measure Sets missing from parameters: "_TXT
;
QUIT 0 ; All okay
;
SETUPPAR(INPPARM) ; Private Proc; Set-up QRDA lists if Inpatient Param is found.
; Input: Inpatient Parameter IEN in C0Q(401, -> C0Q Parameters
; Output: 0 if okay or 1^error description
N C0QFDA
;
N VTEIEN S VTEIEN=$O(^C0Q(201,"B","VTE CMS REPORTING MEASURES",""))
I 'VTEIEN QUIT 1_U_"VTE not found"
N STKIEN S STKIEN=$O(^C0Q(201,"B","STK CMS REPORTING MEASURES",""))
I 'STKIEN QUIT 1_U_"STK not found"
N EDIEN S EDIEN=$O(^C0Q(201,"B","ED CMS REPORTING MEASURES",""))
I 'EDIEN QUIT 1_U_"ED not found"
;
S C0QFDA(1130580001.401,INPPARM_",",5.1)=VTEIEN
S C0QFDA(1130580001.401,INPPARM_",",5.2)=STKIEN
S C0QFDA(1130580001.401,INPPARM_",",5.3)=EDIEN
;
N C0QERR
D FILE^DIE("",$NA(C0QFDA),$NA(C0QERR))
I $D(C0QERR) Q 2_U_C0QERR("DIERR",1,"TEXT",1)
Q 0
;
WORK(C0QREF,C0QMSIEN) ; Private Proc; Process Measure Sets; Collect the data.
; Input/Output: C0QREF -> Global for Output passed by Name
; C0QMSIEN -> (Input): Measurement Set IEN to calculate
;
; Print
D EN^DDIOL(C0QMSIEN_": "_^C0Q(201,C0QMSIEN,0))
D EN^DDIOL("")
;
; Calculate totals and move patients over from individual measures
N A
D UPDATE^C0QUPDT(.A,C0QMSIEN) ; FYI: A isn't used.
;
; Get QRDA code for Measure Set.
N C0QMSQRDA S C0QMSQRDA=$$GET1^DIQ($$C0QMFN^C0QUPDT(),C0QMSIEN_",","QRDA TEMPLATE ROOT")
;
N C0QI S C0QI=0 ; Fileman IEN looper
F S C0QI=$O(^C0Q(201,C0QMSIEN,5,C0QI)) Q:'C0QI D ; For each measure in Measure Set
. ;
. ; Get QRDA code using relational jump
. N C0QMEASUREQRDA S C0QMEASUREQRDA=$$GET1^DIQ($$C0QMMFN^C0QUPDT(),C0QI_","_C0QMSIEN_",",".01:QRDA TEMPLATE ROOT")
. ;
. ; Then collect patients in the denominator, and store in output global
. N C0QP S C0QP=0
. F S C0QP=$O(^C0Q(201,C0QMSIEN,5,C0QI,3,C0QP)) Q:'C0QP D ; For each patient in denominator
. . N C0QDFN S C0QDFN=+^(C0QP,0)
. . S @C0QREF@(C0QDFN,C0QMSQRDA,C0QMEASUREQRDA)=""
QUIT
;
INPPARM() ; $$ Private; Get Inpatient Parameters IEN
; Output: IEN of Inpatient Parameter in C0Q PARAMETER file
;
; Browse this tree of xrefs to get the IEN of INP type (last line here).
; ^C0Q(401,"B","INPATIENT",2)=""
; ^C0Q(401,"B","OUTPATIENT",1)=""
; ^C0Q(401,"MU","MU12",1)=""
; ^C0Q(401,"MU","MU12",2)=""
; ^C0Q(401,"MUTYP","MU12","EP",1)=""
; ^C0Q(401,"MUTYP","MU12","INP",2)=""
;
N MUID S MUID="" ; Looper for MU Year ID
N FOUND S FOUND=0 ; Found flag to get out of loop
N IEN ; Output variable
F S MUID=$O(^C0Q(401,"MUTYP",MUID),-1) Q:MUID="" Q:FOUND D ; Loop backwards
. N TYP S TYP="" ; Type ("EP" or "INP")
. F S TYP=$O(^C0Q(401,"MUTYP",MUID,TYP)) Q:TYP="" Q:FOUND D
. . I TYP="INP" S IEN=$O(^(TYP,"")),FOUND=1 Q ; If found, get IEN, quit out of loops
QUIT +$G(IEN)
;
PRINTXML(C0QREF,C0QMNM) ; Print the XML; Private Proc
; Input: C0QREF -> Global By Name
; C0QMNM -> Measure Name -> Either VTE, STK, ED. For use in filenames.
; Output: modified CCRs are saved in /tmp/
N C0QDFN,C0QMS,C0QM S (C0QDFN,C0QMS,C0QM)="" ; DFN, Measure Set, Measure loopers
F S C0QDFN=$O(@C0QREF@(C0QDFN)) Q:C0QDFN="" D ; For each patient
. ;
. N GREEN S GREEN=$C(27)_"[1;37;42m"
. N RESET S RESET=$C(27)_"[0m"
. D EN^DDIOL(GREEN_"Prosessing DFN "_C0QDFN_RESET,"","!!!")
. D EN^DDIOL("","","!")
. ;
. ; CCR Generatation is next; protected against crashes.
. ; ET set to new value then restored.
. N C0QCCRXML ; CCR XML
. N OLDTRAP S OLDTRAP=$ET
. ; ET: Rollback to this level, write the error in red , clear it, then quit
. N ETTEXT S ETTEXT=$C(27)_"[1;37;41m"_$$EC^%ZOSV_$C(27)_RESET
. N $ES,$ET
. S $ET="W ETTEXT D ^%ZTER G ROLLDOWN^C0QQRDA"
. D CCRRPC^C0CCCR(.C0QCCRXML,C0QDFN) ; Run CCR RPC.
. S $ET=OLDTRAP
. ;
. ;
. ; Quality XML Section generated by hand next...
. N C0QXML ; Generated Quality XML
. D XMLSTORE(.C0QXML,$$OT("QUALITY")) ; Open Tag
. F S C0QMS=$O(@C0QREF@(C0QDFN,C0QMS)) Q:C0QMS="" D ; For each measure set
. . D XMLSTORE(.C0QXML,$$OT("MEASURE_SET")) ; Open tag
. . D XMLSTORE(.C0QXML,$$TAG("ID",C0QMS)) ; Write out set QRDA code
. . D XMLSTORE(.C0QXML,$$OT("MEASURES")) ; Open tag
. . F S C0QM=$O(@C0QREF@(C0QDFN,C0QMS,C0QM)) Q:C0QM="" D ; for each measure
. . . D XMLSTORE(.C0QXML,$$TAG("MEASURE",C0QM)) ; Write <measure> and qrda code
. . D XMLSTORE(.C0QXML,$$CT("MEASURES")) ; Close tag
. . D XMLSTORE(.C0QXML,$$CT("MEASURE_SET")) ; Close tag
. D XMLSTORE(.C0QXML,$$CT("QUALITY")) ; Close tag
. ;
. ;
. ; Insert Quality XML under the root of the CCR document
. D INSERT^C0CXPATH($NA(C0QCCRXML),$NA(C0QXML),"//ContinuityOfCareRecord")
. ;
. ;
. ; Get Kernel Default Directory
. N DEFDIR S DEFDIR=$$DEFDIR^%ZISH()
. ;
. ;
. ; Write out to a file.
. N FN S FN=C0QMNM_"_QRDA_CCR_DFN"_$$RJ^XLFSTR(C0QDFN,10,"0")_".XML" ; File Name
. K C0QCCRXML(0) ; remove zero node; API doesn't support it.
. D EN^DDIOL($$OUTPUT^C0CXPATH($NA(C0QCCRXML(1)),FN,DEFDIR))
QUIT
;
; Quick XML stuff ; All Private
OT(STR) Q "<"_STR_">" ; $$ Open Tag
CT(STR) Q "</"_STR_">" ; $$ Close Tag
TAG(NM,CONTENT) Q "<"_NM_">"_CONTENT_"</"_NM_">" ; $$ Whole tag
;
XMLSTORE(REF,STR) ; Priv Proc - Store XML
; REF -> Save Array. Pass by Reference.
; STR -> What to store. Pass by Value.
; Use like this: D XMLSTORE(.STORE,"<tag>")
; Output: STORE(1)="<tag>"
N L ; Number Subscript to use
S L=$O(REF(" "),-1) S L=L+1 ; Get last number and increment
S REF(L)=STR,REF(0)=L ; Store string in numbered sub, store last number in 0 node (not used here)
QUIT
;
; Following is for formatting printed XML. L passed in Symbol Table and starts at 0.
L1 D WS S L=L+1 Q ; Write space and increment
L2 S L=L-1 D WS Q ; Decrement and Write space
WS X "F I=1:1:L W "" """ Q ; Write Space
; This is for rolling down the stack to the $ES level
ROLLDOWN S $ET="Q:$ES S $EC=""""",$EC=",U99," QUIT

133
qrda/C0Q/trunk/p/C0QRMBMI.m Normal file
View File

@ -0,0 +1,133 @@
C0QRMBMI ; SLC/PKR - National BMI and BSA computed finding; 7/16/12 3:36pm
;;1.0;QUALITY MEASURES;**1**;
;
; VEN/SMH - on July 16 2012
; Added PBMI as a new Computed Finding -- essentially the same as BMI
; PBMI = Percentile BMI;
;
; Copy of Routine PXRMBMI stolen from Patrick Reddington
;
;================================
BMI(DFN,NGET,BDT,EDT,NFOUND,TEST,DATE,DATA,TEXT) ;Multi-occurrence computed
;finding for BMI.
N BMI,HDATE,HT,IND,TDATE,WHL,WT
;Get the list of weight and height measurements.
D WANDHL(DFN,NGET,BDT,EDT,.NFOUND,.WHL)
F IND=1:1:NFOUND D
. S TDATE=$P(WHL(IND),U,1),WT=$P(WHL(IND),U,2)
. S HT=$P(WHL(IND),U,3),HDATE=$P(WHL(IND),U,4)
. S TEST(IND)=1,DATE(IND)=TDATE
. S TEXT(IND)="height measured "_$$EDATE^PXRMDATE(HDATE)
. S BMI=WT/(HT*HT)
. S BMI=$FN(BMI,"",1)
. S (DATA(IND,"VALUE"),DATA(IND,"BMI"))=BMI
Q
;
; VEN/SMH -> Begin addition to routine
PBMI(DFN,NGET,BDT,EDT,NFOUND,TEST,DATE,DATA,TEXT) ; Multi-occurrence computed
; finding for BMI percentile
N BMI,HDATE,HT,IND,TDATE,WHL,WT,BMI
;Get the list of weight and height measurements.
D WANDHL(DFN,NGET,BDT,EDT,.NFOUND,.WHL)
F IND=1:1:NFOUND D
. S TDATE=$P(WHL(IND),U,1),WT=$P(WHL(IND),U,2)
. S HT=$P(WHL(IND),U,3),HDATE=$P(WHL(IND),U,4)
. S TEST(IND)=1,DATE(IND)=TDATE
. S TEXT(IND)="height measured "_$$EDATE^PXRMDATE(HDATE)
. S BMI=WT/(HT*HT)
. N PBMI S PBMI=0 ; BMI Percentile
. N GENDER S GENDER=$P(^DPT(DFN,0),U,2)
. N DOB S DOB=$P(^DPT(DFN,0),U,3)
. N AGE S AGE=$$FMDIFF^XLFDT($$DT^XLFDT(),DOB,1)/365.24 ; Age in yrs
. I $T(BMIPCTL^TMGGRC1)]"" S PBMI=$$BMIPCTL^TMGGRC1(AGE,GENDER,BMI,"")
. S PBMI=+PBMI ; We get a textish result (e.g. 78th percentile)
. S (DATA(IND,"VALUE"),DATA(IND,"BMI%ILE"))=PBMI
Q
; VEN/SMH <- End
;
;================================
BSA(DFN,NGET,BDT,EDT,NFOUND,TEST,DATE,DATA,TEXT) ;Multi-occurrence computed
;finding for BSA. The coefficients have been adjusted for heights
;in cm and weights in kg expect for Boyd where the weight is grams.
;The default is to use the Mosteller formula.
N BSA,FORMULA,HT,IND,TDATE,TYPE,WHL,WT
S TYPE=$S(TEST="":"M",TEST="M":"M",TEST="D":"D",TEST="H":"H",TEST="G":"G",TEST="B":"B",1:"M")
S FORMULA=$S(TYPE="M":"Mosteller",TYPE="B":"Boyd",TYPE="D":"DuBois and Dubois",TYPE="H":"Haycock",TYPE="G":"Gehan and George",1:"Mosteller")_" formula"
;Get the list of weight and height measurements.
D WANDHL(DFN,NGET,BDT,EDT,.NFOUND,.WHL)
F IND=1:1:NFOUND D
. S TDATE=$P(WHL(IND),U,1),WT=$P(WHL(IND),U,2)
. S HT=$P(WHL(IND),U,3),HDATE=$P(WHL(IND),U,4)
. S TEST(IND)=1,DATE(IND)=TDATE
. I TYPE="M" S BSA=$$SQRT^XLFMTH((WT*HT)/36)
. I TYPE="D" S BSA=.20247*$$PWR^XLFMTH(HT,.725)*$$PWR^XLFMTH(WT,.425)
. I TYPE="H" S BSA=.15058*$$PWR^XLFMTH(HT,.3964)*$$PWR^XLFMTH(WT,.5378)
. I TYPE="G" S BSA=.164*$$PWR^XLFMTH(HT,.42246)*$$PWR^XLFMTH(WT,.51456)
. I TYPE="B" D
.. N WEXP
.. S WT=1000*WT
.. S WEXP=.7285-(.0188*$$LOG^XLFMTH(WT))
.. S BSA=.001277*$$PWR^XLFMTH(HT,.3)*$$PWR^XLFMTH(WT,WEXP)
. S BSA=$FN(BSA,"",2)
. S (DATA(IND,"VALUE"),DATA(IND,"BSA"))=BSA
. S TEXT(IND)=FORMULA_", height measured "_$$EDATE^PXRMDATE(HDATE)
Q
;
;================================
GHEIGHT(DFN,WDATE,HT,HDATE) ;Return the height measurement taken on the
;date closest to WDATE (WDATE is the date of the weight measurement). If no height is
;found return -1.
N BCKDATE,DAS,DIFFL,DIFFS,DONE,FWDDATE,TEMP
S (DONE,HDATE)=0,HT=-1
;Check for height measured on same date and time.
S DAS=$O(^PXRMINDX(120.5,"PI",DFN,8,WDATE,""))
I DAS'="" D
. D GETDATA^PXRMVITL(DAS,.TEMP)
. I TEMP("RATE")'=+TEMP("RATE") Q
. S HT=+(TEMP("RATE")*0.0254),HDATE=WDATE,DONE=1
I 'DONE S (BCKDATE,FWDDATE)=WDATE
F Q:DONE D
. S BCKDATE=+$O(^PXRMINDX(120.5,"PI",DFN,8,BCKDATE),-1)
. S FWDDATE=+$O(^PXRMINDX(120.5,"PI",DFN,8,FWDDATE))
. I (BCKDATE=0),(FWDDATE=0) S DONE=1 Q
. S DIFFS=$$FMDIFF^XLFDT(WDATE,BCKDATE,2),DIFFL(DIFFS,BCKDATE)=""
. S DIFFS=$$FMDIFF^XLFDT(FWDDATE,WDATE,2)
. S DIFFS=$S(DIFFS<0:-DIFFS,1:DIFFS),DIFFL(DIFFS,FWDDATE)=""
. S DIFFS=$O(DIFFL("")),HDATE=$O(DIFFL(DIFFS,""))
. I HDATE=0 Q
. S DAS=$O(^PXRMINDX(120.5,"PI",DFN,8,HDATE,""))
. D GETDATA^PXRMVITL(DAS,.TEMP)
. I TEMP("RATE")'=+TEMP("RATE") K DIFFL(DIFFS,HDATE) Q
. S HT=+(TEMP("RATE")*0.0254)
. S DONE=1
Q
;
;================================
WANDHL(DFN,NGET,BDT,EDT,NFOUND,WHL) ;Return an ordered and
;paired list of weight and height measurements. Weight is in kilograms
;and height is in meters.
N DAS,DIFFL,DIFFS,DONE,HT,HDATE,NOCC
N SDIR,TDATE,TEMP,WLIST,WT
S SDIR=$S(NGET>0:-1,1:1)
S NOCC=$S(NGET>0:NGET,1:-NGET)
;Get a list of weight measurements in the date range.
S TDATE=BDT-.000001
F S TDATE=+$O(^PXRMINDX(120.5,"PI",DFN,9,TDATE)) Q:(TDATE=0)!(TDATE>EDT) D
. S DAS=$O(^PXRMINDX(120.5,"PI",DFN,9,TDATE,""))
. S WLIST(TDATE)=DAS
;Get up to NOCC BMI values.
S TDATE="",(DONE,NFOUND)=0
F S TDATE=$O(WLIST(TDATE),SDIR) Q:(DONE)!(TDATE="") D
. S DAS=WLIST(TDATE)
. K TEMP
. D GETDATA^PXRMVITL(DAS,.TEMP)
. I TEMP("RATE")'=+TEMP("RATE") Q
. S WT=+TEMP("RATE")*0.4535924
.;Find the closest height measurement.
. D GHEIGHT(DFN,TDATE,.HT,.HDATE)
. I HT=-1 Q
. S NFOUND=NFOUND+1
. S WHL(NFOUND)=TDATE_U_WT_U_HT_U_HDATE
. I NFOUND=NOCC S DONE=1
Q
;

115
qrda/C0Q/trunk/p/C0QSET.m Normal file
View File

@ -0,0 +1,115 @@
C0QSET ;GPL - SET OPERATIONS ON LISTS ;818/11 8:50pm ; 7/31/12 8:19am
;;1.0;C0Q;;May 21, 2012;Build 63
;
;2011 George Lilly glilly@glilly.net - Licensed under the terms of the GNU
;General Public License See attached copy of the License.
;
;This program is free software; you can redistribute it and/or modify
;it under the terms of the GNU General Public License as published by
;the Free Software Foundation; either version 2 of the License, or
;(at your option) any later version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License along
;with this program; if not, write to the Free Software Foundation, Inc.,
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
;
Q
;
TEST ; TEST OF UNITY ROUTINE
;
S A(1)=""
S A(2)=""
S A(3)=""
S B(3)=""
S B(4)=""
D UNITY("C","A","B")
D ZWRITE^C0QUTIL("C")
Q
;
TEST2 ; WHICH PATIENTS HAVE MEDICATIONS? WHICH DON'T?
; WHAT BAD PATIENT POINTERS ARE IN THE MEDICATIONS FILE?
S PATS=$NA(^DPT)
S MEDS=$NA(^PS(55))
D UNITY("DELTA",PATS,MEDS)
W !,"PATIENTS WITH NO MEDS",!
D ZWRITE^C0QUTIL("DELTA(0,*)")
W !,"BAD POINTERS IN THE MEDS FILE",!
D ZWRITE^C0QUTIL("DELTA(2,*)")
Q
;
UNITY(ZRTN,ZNEW,ZOLD) ; RETURNS THE DELTA BETWEEN THE NEW AND OLD LISTS
; ONLY NUMERIC LISTS SUPPORTED. FOR LIST WITH STRINGS SEE UNITYS
; ZRTN,ZNEW AND ZOLD ARE ALL PASSED BY NAME
; FORMAT OF RETURN ARRAY:
; @ZRTN@(0,X)="" ; X IS MISSING FROM OLD
; @ZRTN@(1,Y)="" ; Y IS IN BOTH NEW AND OLD - NOT MISSING
; @ZRTN@(2,Z)="" ; Z IS EXTRA IN OLD - WOULD BEED TO BE DELETED FOR UNITY
N C0QD ; TEMP WORK ARRAY
N ZN S ZN=0 ; COUNT
N ZI S ZI=0
F S ZI=$O(@ZNEW@(ZI)) Q:+ZI=0 D ; FOR EACH ITEM IN NEW
. S C0QD(ZI)=0 ; SET THEM ALL AS 0 MEANING NEW
. S ZN=ZN+1
S @ZRTN@("COUNT")=ZN ; NEW FILE COUNT
S ZI=0
F S ZI=$O(@ZOLD@(ZI)) Q:+ZI=0 D ; FOR EACH ITEM IN OLD
. I $D(C0QD(ZI)) S C0QD(ZI)=1 ; NOT NEW - PRESENT IN NEW AND OLD
. E S C0QD(ZI)=2 ; EXTRA IN OLD - WOULD NEED TO BE DELETED
S ZI=0
F S ZI=$O(C0QD(ZI)) Q:+ZI=0 D ; FOR EACH ITEM
. S @ZRTN@(C0QD(ZI),ZI)="" ; SET RESULTS IN RETURN ARRAY
Q
;
UNITYS(ZRTN,ZNEW,ZOLD) ; RETURNS THE DELTA BETWEEN THE NEW AND OLD LISTS
; THIS VERSION HAS SUPPORT FOR NUMBERS AND STRINGS IN A LIST
; ZRTN,ZNEW AND ZOLD ARE ALL PASSED BY NAME
; FORMAT OF RETURN ARRAY:
; @ZRTN@(0,X)="" ; X IS MISSING FROM OLD
; @ZRTN@(1,Y)="" ; Y IS IN BOTH NEW AND OLD - NOT MISSING
; @ZRTN@(2,Z)="" ; Z IS EXTRA IN OLD - WOULD BEED TO BE DELETED FOR UNITY
N C0QD ; TEMP WORK ARRAY
N ZI S ZI=""
F S ZI=$O(@ZNEW@(ZI)) Q:ZI="" D ; FOR EACH ITEM IN NEW
. S C0QD(ZI)=0 ; SET THEM ALL AS 0 MEANING NEW
S ZI=""
F S ZI=$O(@ZOLD@(ZI)) Q:ZI="" D ; FOR EACH ITEM IN OLD
. I $D(C0QD(ZI)) S C0QD(ZI)=1 ; NOT NEW - PRESENT IN NEW AND OLD
. E S C0QD(ZI)=2 ; EXTRA IN OLD - WOULD NEED TO BE DELETED
S ZI=""
F S ZI=$O(C0QD(ZI)) Q:ZI="" D ; FOR EACH ITEM
. S @ZRTN@(C0QD(ZI),ZI)="" ; SET RESULTS IN RETURN ARRAY
Q
;
AND(ZRTN,ZNEW,ZOLD) ; RETURNS A LIST OF WHAT IS COMMON TO BOTH NEW AND OLD
N ZD
D UNITY("ZD",ZNEW,ZOLD)
M @ZRTN=ZD(1)
Q
;
NAND(ZRTN,ZNEW,ZOLD) ; RETURNS WHAT IS IN A OR B BUT NOT BOTH
N ZD
D UNITY("ZD",ZNEW,ZOLD)
M @ZRTN=ZD(0)
M @ZRTN=ZD(2)
Q
;
AMINUSB(ZRTN,ZA,ZB) ; WHAT'S LEFT IN A AFTER REMOVING B FROM IT
N ZD
D UNITY("ZD",ZA,ZB)
M @ZRTN=ZD(0)
Q
;
OR(ZRTN,ZA,ZB) ; WHAT'S IN A OR B OR BOTH
N ZD
D UNITY("ZD",ZA,ZB)
M @ZRTN=ZD(0)
M @ZRTN=ZD(1)
M @ZRTN=ZD(2)
Q
;
END ;end of C0QSET;

283
qrda/C0Q/trunk/p/C0QUPDT.m Normal file
View File

@ -0,0 +1,283 @@
C0QUPDT ; GPL - Quality Reporting List Update Routines ; 10/17/12 12:09pm
;;1.0;QUALITY MEASURES;**1,5**;May 21, 2012;Build 32
;Copyright 2009 George Lilly. Licensed under the terms of the GNU
;General Public License See attached copy of the License.
;
;This program is free software; you can redistribute it and/or modify
;it under the terms of the GNU General Public License as published by
;the Free Software Foundation; either version 2 of the License, or
;(at your option) any later version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License along
;with this program; if not, write to the Free Software Foundation, Inc.,
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
;
Q
;
C0QQFN() Q 1130580001.101 ; FILE NUMBER FOR C0Q QUALITY MEASURE FILE
C0QMFN() Q 1130580001.201 ; FILE NUMBER FOR C0Q MEASUREMENT FILE
C0QMMFN() Q 1130580001.2011 ; FN FOR MEASURE SUBFILE
C0QMMNFN() Q 1130580001.20111 ; FN FOR NUMERATOR SUBFILE
C0QMMDFN() Q 1130580001.20112 ; FN FOR DENOMINATOR SUBFILE
RLSTFN() Q 810.5 ; FN FOR REMINDER PATIENT LIST FILE
RLSTPFN() Q 810.53 ; FN FOR REMINDER PATIENT LIST PATIENT SUBFILE
C0QPLF() Q 1130580001.301 ; C0Q PATIENT LIST FILE
C0QALFN() Q 1130580001.311 ; FILE NUMBER FOR C0Q PATIENT LIST PATIENT SUBFILE ;
;
UPDATE(RNT,MSET) ; UPDATE A MEASURE SET BY ADDING NEW ENTRIES TO PATIENT
; LISTS AND DELETING ENTRIES THAT ARE NO LONGER VALID. ALSO UPDATE
; NUMERATOR AND DENOMINATOR COUNTS
; MAKES HEAVY USE OF UNITY^C0QSET TO DETERMINE WHAT TO ADD AND DELETE
;
; THIS IS A REPLACEMENT FOR C0QRPC^C0QMAIN WHICH DELETES THE PATIENT
; LISTS AND RECREATES THEM, WHICH IS A LOT OF UNNECESSARY PROCESSING
;
N ZI S ZI=""
N C0QM ; FOR HOLDING THE MEASURES IN THE SET
I $$GET1^DIQ($$C0QMFN,MSET_",",.05,"I")="Y" D Q ; IS IT LOCKED?
. W !,"ERROR MEASURE SET IS LOCKED, EXITING"
D LIST^DIC($$C0QMMFN,","_MSET_",",".01I;1.2I;2.2I") ; GET ALL THE MEASURES
D DELIST("C0QM")
N ZII S ZII=""
F S ZII=$O(C0QM(ZII)) Q:ZII="" D ; FOR EACH MEASURE
. ;
. ; Special processing for eRx measure.
. I $$GET1^DIQ(1130580001.101,+C0QM(ZII)_",",4,"I")="E" D ERXCOUNT(MSET,ZII) Q
. ;
. ; Otherwise, we go on
. N C0QNL,C0QDL,C0QFLTN,C0QFLTD,C0QNALT ; VEN/SMH - line changed in *5
. S C0QFLTN=$P(C0QM(ZII),U,3) ;IEN OF NUMERATOR FILTER LIST
. S C0QFLTD=$P(C0QM(ZII),U,4) ; IEN OF DENOMINATOR FILTER LIST
. S ZI=$P(C0QM(ZII),U,1) ; IEN OF THE MEASURE IN THE C0Q QUALITY MEAS FILE
. ;
. ; Numerator
. S C0QNL=$$GET1^DIQ($$C0QQFN,ZI_",",1,"I") ; NUMERATOR POINTER
. I C0QNL="" D ; CHECK ALTERNATE LIST
. . S C0QNL=$$GET1^DIQ($$C0QQFN,ZI_",",1.1,"I") ; NUMERATOR POINTER
. . I C0QNL'="" S C0QNALT=1
. I C0QNL="" QUIT ; No Numerator. Can't perform calculation.--smh
. ;
. ; Denominator
. S C0QDL=$$GET1^DIQ($$C0QQFN,ZI_",",2,"I") ; DENOMINATOR POINTER
. I C0QDL="" D ; CHECK ALTERNATE LIST
. . S C0QDL=$$GET1^DIQ($$C0QQFN,ZI_",",2.1,"I") ; DENOMINATOR POINTER
. . I C0QDL'="" S C0QDALT=1
. I C0QDL="" QUIT ; No Denominator. Can't perform calcuation.--smh
. ;
. ; FIRST PROCESS THE NUMERATOR
. ;
. N C0QNEW ; REFERENCE TO NEW NUMBERATOR LIST B INDEX
. I $G(C0QNALT)=1 D ; USING ALTERNATE LIST FOR NUMERATOR
. . S C0QNEW=$NA(^C0Q(301,C0QNL,1,"B")) ; B INDEX FOR THIS LIST
. E D ; USE THE REMINDER PACKAGE PATIENT LISTS
. . S C0QNEW=$NA(^PXRMXP(810.5,C0QNL,30,"B")) ; REMINDER LIST PATIENTS
. I C0QFLTN'="" D ; USE A NUMERATOR FILTER LIST
. . N ZNEW
. . S ZNEW=$NA(^C0Q(301,C0QFLTN,1,"B")) ; B INDEX OF FILTER LIST
. . K C0QFLTRD
. . D AND^C0QSET("C0QFLTRD",ZNEW,C0QNEW)
. . S C0QNEW="C0QFLTRD"
. N C0QOLD ; REFERENCE FOR OLD PATIENT LIST
. S C0QOLD=$NA(^C0Q(201,MSET,5,ZII,1,"B")) ; NUMERATOR LIST IN MEASURE SET
. N C0QRSLT ; ARRAY FOR THE UNITY DIFFERENCES
. D UNITY^C0QSET("C0QRSLT",C0QNEW,C0QOLD) ; FIND THE DIFFERENCES
. N C0QCNT
. S C0QNCNT=$G(C0QRSLT("COUNT"))
. I C0QNCNT="" D ;
. . S C0QNCNT=0 ; DEFAULT COUNT IS ZERO
. . N GZZ S GZZ=""
. . F S GZZ=$O(C0QRSLT(0,GZZ)) Q:GZZ="" D ; EVERY ADD ENTRY
. . . S C0QNCNT=C0QNCNT+1
. . F S GZZ=$O(C0QRSLT(1,GZZ)) Q:GZZ="" D ; EVERY EQUAL ENTRY
. . . S C0QNCNT=C0QNCNT+1
. K C0QFDA ; CLEAR THE FDA
. N C0QONCNT ; OLD COUNT
. S C0QONCNT=$$GET1^DIQ($$C0QMMFN(),ZII_","_MSET_",",1.1)
. I C0QNCNT'=C0QONCNT D ; COUNT HAS CHANGED
. . S C0QFDA($$C0QMMFN(),ZII_","_MSET_",",1.1)=C0QNCNT ; NUMERATOR COUNT
. . D UPDIE ; UPDATE THE NUMERATOR COUNT
. I $D(C0QRSLT) D ;B ;
. . ;ZWR C0QRSLT
. ; FIRST PROCESS DELETIONS
. K C0QFDA ; CLEAR OUT THE FDA
. N ZG,ZIEN S ZG=""
. F S ZG=$O(C0QRSLT(2,ZG)) Q:ZG="" D ; FOR EACH DELETION
. . S ZIEN=$O(@C0QOLD@(ZG,"")) ; IEN OF THE ENTRY
. . I ZIEN="" D Q ; OOPS
. . . W !,"ERROR DELETING ENTRY!! ",ZG
. . S C0QFDA($$C0QMMNFN(),ZIEN_","_ZII_","_MSET_",",.01)="@" ; DELETE
. I $D(C0QFDA) D UPDIE ; PROCESS
. ; SECOND, PROCESS ADDITIONS
. K C0QFDA ; CLEAR OUT THE FDA
. N ZG,ZC S ZG="" S ZC=1
. F S ZG=$O(C0QRSLT(0,ZG)) Q:ZG="" D ; FOR EACH ADDITION
. . S C0QFDA($$C0QMMNFN(),"+"_ZC_","_ZII_","_MSET_",",.01)=ZG ; ADD THE ENTRY
. . S ZC=ZC+1
. I $D(C0QFDA) D UPDIE ; PROCESS
. ;
. ; PROCESS THE DENOMINATOR
. ;
. N C0QNEW ; REFERENCE TO NEW NUMBERATOR LIST B INDEX
. I $G(C0QNALT)=1 D ; USING ALTERNATE LIST FOR NUMERATOR
. . S C0QNEW=$NA(^C0Q(301,C0QDL,1,"B")) ; B INDEX FOR THIS LIST
. E D ; USE THE REMINDER PACKAGE PATIENT LISTS
. . S C0QNEW=$NA(^PXRMXP(810.5,C0QDL,30,"B")) ; REMINDER LIST PATIENTS
. I C0QFLTD'="" D ; USE A DENOMINATOR FILTER LIST
. . N ZNEW
. . S ZNEW=$NA(^C0Q(301,C0QFLTD,1,"B")) ; B INDEX OF FILTER LIST
. . K C0QFLTRD
. . D AND^C0QSET("C0QFLTRD",ZNEW,C0QNEW)
. . S C0QNEW="C0QFLTRD"
. N C0QOLD ; REFERENCE FOR OLD PATIENT LIST
. S C0QOLD=$NA(^C0Q(201,MSET,5,ZII,3,"B")) ; DENOMINATOR LIST IN MEASURE SET
. N C0QRSLT ; ARRAY FOR THE UNITY DIFFERENCES
. D UNITY^C0QSET("C0QRSLT",C0QNEW,C0QOLD) ; FIND THE DIFFERENCES
. N C0QDCNT
. S C0QDCNT=$G(C0QRSLT("COUNT"))
. I C0QDCNT="" D ;
. . S C0QDCNT=0 ; DEFAULT COUNT IS ZERO
. . N GZZ S GZZ=""
. . F S GZZ=$O(C0QRSLT(0,GZZ)) Q:GZZ="" D ; EVERY ADD ENTRY
. . . S C0QDCNT=C0QDCNT+1
. . F S GZZ=$O(C0QRSLT(1,GZZ)) Q:GZZ="" D ; EVERY EQUAL ENTRY
. . . S C0QDCNT=C0QDCNT+1
. K C0QFDA ; CLEAR THE FDA
. N C0QODCNT ; OLD COUNT
. S C0QODCNT=$$GET1^DIQ($$C0QMMFN(),ZII_","_MSET_",",2.1)
. I C0QDCNT'=C0QODCNT D ; COUNT HAS CHANGED
. . S C0QFDA($$C0QMMFN(),ZII_","_MSET_",",2.1)=C0QDCNT ; DENOMINATOR COUNT
. . D UPDIE ; UPDATE THE DENOMINATOR COUNT
. I $D(C0QRSLT) D ;B ;
. . ;ZWR C0QRSLT
. I '$D(C0QRSLT) Q ; NO RESULTS TO USE
. ; FIRST PROCESS DELETIONS
. K C0QFDA ; CLEAR OUT THE FDA
. N ZG,ZIEN S ZG=""
. F S ZG=$O(C0QRSLT(2,ZG)) Q:ZG="" D ; FOR EACH DELETION
. . S ZIEN=$O(@C0QOLD@(ZG,"")) ; IEN OF THE ENTRY
. . I ZIEN="" D Q ; OOPS
. . . W !,"ERROR DELETING ENTRY!! ",ZG
. . S C0QFDA($$C0QMMDFN(),ZIEN_","_ZII_","_MSET_",",.01)="@" ; DELETE
. I $D(C0QFDA) D UPDIE ; PROCESS
. ; SECOND, PROCESS ADDITIONS
. K C0QFDA ; CLEAR OUT THE FDA
. N ZG,ZC S ZG="" S ZC=1
. F S ZG=$O(C0QRSLT(0,ZG)) Q:ZG="" D ; FOR EACH ADDITION
. . S C0QFDA($$C0QMMDFN(),"+"_ZC_","_ZII_","_MSET_",",.01)=ZG ; ADD THE ENTRY
. . S ZC=ZC+1
. I $D(C0QFDA) D UPDIE ; PROCESS
. ;
. ; File Percentage
. N C0QPCT ; PERCENT
. D ;
. . I C0QDCNT>0 D ;
. . . S C0QPCT=$J(100*C0QNCNT/C0QDCNT,0,0)
. . E S C0QPCT=0
. . K C0QFDA
. . S C0QFDA($$C0QMMFN(),ZII_","_MSET_",",3)=C0QPCT ; PERCENT
. . D UPDIE
Q
;
DELIST(RTN) ; DECODES ^TMP("DILIST",$J) INTO
; @RTN@(IEN)=INTERNAL VALUE^EXTERNAL VALUE
; ADDED A B INDEX @RTN@("B",INTERNAL VALUE,IEN)=EXTERNAL VALUE
N ZI,IV,EV,ZDI,ZIEN,FLTN,FLTD
S ZI=""
S ZDI=$NA(^TMP("DILIST",$J))
K @RTN
F S ZI=$O(@ZDI@(1,ZI)) Q:ZI="" D ;
. S EV=@ZDI@(1,ZI) ;EXTERNAL VALUE
. S IV=$G(@ZDI@("ID",ZI,.01)) ; INTERNAL VALUE
. S FLTN=$G(@ZDI@("ID",ZI,1.2)) ; NUMERATOR FILTER LIST
. S FLTD=$G(@ZDI@("ID",ZI,2.2)) ; DENOMINATOR FILTER LIST
. S ZIEN=@ZDI@(2,ZI) ; IEN
. S @RTN@(ZIEN)=IV_"^"_EV_"^"_FLTN_"^"_FLTD
. ;S @RTN@("B",IV,ZIEN)=EV
Q
;
UPDIE ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS
K ZERR
D CLEAN^DILF
D ZWRITE^C0QUTIL("C0QFDA")
D UPDATE^DIE("","C0QFDA","","ZERR")
I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST, INVOKE THE ERROR TRAP IF TASKED
;. W "ERROR",!
;. ZWR ZERR
;. B
K C0QFDA
Q
;
ERXCOUNT(MSETIEN,MIEN) ; Private Proc; Get eRx and file as Numerator, Denominator, and %
; Inputs:
; MSETIEN - Measurement Set IEN - By Value
; MIEN - Measurement IEN inside the Measurement Set - By Value
;
; Optional Symtab input: C0QDEBUG to print out debug messages to STDOUT.
; ZEXCEPT: C0QDEBUG ; For Dr. Ivey's parser.
;
; No check is done to see if the caller is sending bad data. Measurement must be
; in a subfile under Measurement Set.
;
W:$G(C0QDEBUG) "Processing E-Prescribing Counts",!
; Example of Data we go through in the C0Q Parameter File, so the code below
; will make sense.
; ^C0Q(401,"AMMS",2,1)=""
; ^C0Q(401,"AMMS",2,2)=""
; ^C0Q(401,"AQMS",6,2)=""
; ^C0Q(401,"B","INPATIENT",2)=""
; ^C0Q(401,"B","OUTPATIENT",1)=""
; ^C0Q(401,"MU","MU12",1)=""
; ^C0Q(401,"MU","MU12",2)=""
; ^C0Q(401,"MUTYP","MU12","EP",1)=""
; ^C0Q(401,"MUTYP","MU12","INP",2)=""
;
; Get Parameter year from the Parameters file.
; 1. Get parameter associated with this measurement set from AMMS x-ref (new in C0Q*1*1).
N C0QPARAM
N % S %="" F S %=$O(^C0Q(401,"AMMS",MSETIEN,%)) Q:%="" S C0QPARAM(%)=""
;
; 2. Find the year for each of those--store as value of node; IEN still subscript.
N % S %="" F S %=$O(C0QPARAM(%)) Q:%="" S C0QPARAM(%)=$$GET1^DIQ(1130580001.401,%_",",.02)
;
; 3. Now make sure that this parameter that point to an Outpatient Parameters
; WARNING: CONFUSING CODE WRITTEN BY ME AHEAD
; The % loop will stop with a valid value if found; % is used in the lines immediately below
N % S %="" F S %=$O(C0QPARAM(%)) Q:%="" Q:$D(^C0Q(401,"MUTYP",C0QPARAM(%),"EP",%))
;
; 4. If % has a valid IEN (there can be multiple, we take the first), then off we go.
; Otherwise, if it is back to "", we quit.
N MUYEAR
IF '% W "No suitable parameter found. Cannot determine Measurement Year.",! QUIT
ELSE S MUYEAR=C0QPARAM(%)
;
; Now, based on the MU year, construct the patient list name that has the eRx data.
N LISTNAME S LISTNAME=MUYEAR_"-"_"EP"_"-"_"HasERX"
;
; Call the API in C0QMUERX to get the counts already calculated
; Data is returned NUM/DEN
N COUNTS S COUNTS=$$COUNT^C0QMUERX($$PATLN^C0QMU12(LISTNAME))
;
; File the count
N NUM S NUM=$P(COUNTS,"/") ; Numerator
N DEN S DEN=$P(COUNTS,"/",2) ; Denominator
;
; Prepare FDA
N C0QFDA,C0QERR
S C0QFDA($$C0QMMFN(),MIEN_","_MSETIEN_",",1.1)=NUM ; Numerator
S C0QFDA($$C0QMMFN(),MIEN_","_MSETIEN_",",2.1)=DEN ; Denominator
S C0QFDA($$C0QMMFN(),MIEN_","_MSETIEN_",",3)=$S(DEN=0:0,1:$J(100*NUM/DEN,0,0)) ; Percentage; avoid dividing by zero!
;
; File FDA using Filer not updater (editing existing entry only)
D FILE^DIE("ET",$NAME(C0QFDA),$NAME(C0QERR)) ; Flags: External, Transaction
;
; If error, print it out
I $D(C0QERR) DO
. W "Error filing data",!
. N % S %=$NAME(C0QERR) F S %=$Q(@%) Q:%="" W %_": "_@%,!
;
QUIT

129
qrda/C0Q/trunk/p/C0QUTIL.m Normal file
View File

@ -0,0 +1,129 @@
C0QUTIL ;JJOH/ZAG/GPL - Utilities for C0Q Package ; 7/31/12 7:42am
;;1.0;C0Q;;May 21, 2012;Build 63
;
;2011 Licensed under the terms of the GNU General Public License
;See attached copy of the License.
;
;This program is free software; you can redistribute it and/or modify
;it under the terms of the GNU General Public License as published by
;the Free Software Foundation; either version 2 of the License, or
;(at your option) any later version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License along
;with this program; if not, write to the Free Software Foundation, Inc.,
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
;
AGE(DFN) ; return current age in years and months
;
Q:'$G(DFN) ;quit if no there is no patient
N DOB S DOB=$P(^DPT(+DFN,0),U,3) ;date of birth
N YRS
N DOD S DOD=+$G(^DPT(9,.35)) ;check for date of death
I 'DOD D
. N CDTE S CDTE=DT ;current date
. S YRS=$E(CDTE,1,3)-$E(DOB,1,3)-($E(CDTE,4,7)<$E(DOB,4,7))
E D
. S YRS=$E(DOD,1,3)-$E(DOB,1,3)-($E(DOD,4,7)<$E(DOB,4,7))
;
;Come back here and fix MONTHS and DAYS
;N CM S CM=+$E(DT,4,5) ;current month
;N CD S CD=+$E(DT,6,7) ;current day
;N BM S BM=+$E(DOB,4,5) ;birth month
;N BD S BD=+$E(DOB,6,7) ;birth day
;
;N DAYS S DAYS=""
;
Q YRS ;_"y" gpl ..just want the number
;
;
DTDIFF(ZD1,ZT1,ZD2,ZT2,SHOW) ; extrinsic which returns the number of minutes
; between 2 dates. ZD1 and ZD2 are fileman dates
; ZT1 AND ZT2 are valid times (military time) ie 20:10
; IF SHOW=1 DEBUGGING INTERMEDIATE VALUES WILL BE DISPLAYED
I '$D(SHOW) S SHOW=0
N GT1,GT2,GDT1,GDT2
I ZT1[":" D ;
. S GT1=($P(ZT1,":",1)*3600)+($P(ZT1,":",2)*60) ; SECONDS
. S GT2=($P(ZT2,":",1)*3600)+($P(ZT2,":",2)*60) ; SECONDS
E D ;
. S GT1=($E(ZT1,1,2)*3600)+($E(ZT1,3,4)*60)
. S GT2=($E(ZT2,1,2)*3600)+($E(ZT2,3,4)*60)
;W:SHOW !,"SECONDS: ",GT1," ",GT2
;S %=GT1 D S^%DTC ; FILEMAN TIME
;S GDT1=ZD1_% ; FILEMAN DATE AND TIME
;S %=GT2 D S^%DTC ; FILEMAN TIME
;S GDT2=ZD2_% ; FILEMAN DATE AND TIME
S GDT1=ZD1_"."_ZT1
S GDT2=ZD2_"."_ZT2
W:SHOW !,"FILEMAN: ",GDT1," ",GDT2
N ZH1,ZH2
S ZH1=$$FMTH^XLFDT(GDT1) ; $H FORMAT
S ZH2=$$FMTH^XLFDT(GDT2) ; $H FORMAT
W:SHOW !,"$H: ",ZH1," ",ZH2
N ZSECS,ZMIN
S ZSECS=$$HDIFF^XLFDT(ZH1,ZH2,2) ; DIFFERENCE IN $H
W:SHOW !,"DIFF: ",ZSECS
S ZMIN=ZSECS/60 ; DIFFERENCE IN MINUTES
W:SHOW !,"MIN: ",ZMIN
Q ZMIN
;
DT(X) ; -- Returns FM date for X
N Y,%DT S %DT="T",Y="" D:X'="" ^%DT
Q Y
;
ZWRITE(NAME) ; Replacement for ZWRITE ; Public Proc
; Pass NAME by name as a closed reference. lvn and gvn are both supported.
; : syntax is not supported (yet)
N L S L=$L(NAME) ; Name length
I $E(NAME,L-2,L)=",*)" S NAME=$E(NAME,1,L-3)_")" ; If last sub is *, remove it and close the ref
N ORIGLAST S ORIGLAST=$QS(NAME,$QL(NAME)) ; Get last subscript upon which we can't loop further
N ORIGQL S ORIGQL=$QL(NAME) ; Number of subscripts in the original name
I $D(@NAME)#2 W NAME,"=",$$FORMAT(@NAME),! ; Write base if it exists
; $QUERY through the name.
; Stop when we are out.
; Stop when the last subscript of the original name isn't the same as
; the last subscript of the Name.
F S NAME=$Q(@NAME) Q:NAME="" Q:$QS(NAME,ORIGQL)'=ORIGLAST W NAME,"=",$$FORMAT(@NAME),!
QUIT
FORMAT(V) ; Add quotes, replace control characters if necessary; Public $$
;If numeric, nothing to do.
;If no encoding required, then return as quoted string.
;Otherwise, return as an expression with $C()'s and strings.
I +V=V Q V ; If numeric, just return the value.
N QT S QT="""" ; Quote
I $F(V,QT) D ;chk if V contains any Quotes
. S P=0 ;position pointer into V
. F S P=$F(V,QT,P) Q:'P D ;find next "
. . S $E(V,P-1)=QT_QT ;double each "
. . S P=P+1 ;skip over new "
I $$CCC(V) D Q V ; If control character is present do this and quit
. S V=$$RCC(QT_V_QT) ; Replace control characters in "V"
. S:$E(V,1,3)="""""_" $E(V,1,3)="" ; Replace doubled up quotes at start
. S L=$L(V) S:$E(V,L-2,L)="_""""" $E(V,L-2,L)="" ; Replace doubled up quotes at end
Q QT_V_QT ; If no control charactrrs, quit with "V"
;
CCC(S) ;test if S Contains a Control Character or $C(255); Public $$
Q:S?.E1C.E 1
Q:$F(S,$C(255)) 1
Q 0
RCC(NA) ;Replace control chars in NA with $C( ). Returns encoded string; Public $$
Q:'$$CCC(NA) NA ;No embedded ctrl chars
N OUT S OUT="" ;holds output name
N CC S CC=0 ;count ctrl chars in $C(
N C ;temp hold each char
F I=1:1:$L(NA) S C=$E(NA,I) D ;for each char C in NA
. I C'?1C,C'=C255 D S OUT=OUT_C Q ;not a ctrl char
. . I CC S OUT=OUT_")_""",CC=0 ;close up $C(... if one is open
. I CC D
. . I CC=256 S OUT=OUT_")_$C("_$A(C),CC=0 ;max args in one $C(
. . E S OUT=OUT_","_$A(C) ;add next ctrl char to $C(
. E S OUT=OUT_"""_$C("_$A(C)
. S CC=CC+1
. Q
Q OUT
END ;end of C0QUTIL

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:vmu="http://vista.org/mu/"
xmlns:vq="http://vista.org/quality/">
<rdf:Description rdf:about="http://vista.org/mu/measure#hasMedOrders">
<rdf:type rdf:resource="vmu:measure" />
<vmu:label>CPOE for Meds (30%)</vmu:label>
<vmu:attribute>hasMed</vmu:attribute>
<vmu:converse>noMed</vmu:converse>
</rdf:Description>
<rdf:Description rdf:about="http://vista.org/mu/measure#hasAdvanceDirective">
<rdf:type rdf:resource="vmu:measure" />
<vmu:label>Advance Directives (50%)</vmu:label>
<vmu:attribute>hasAdvanceDirective</vmu:attribute>
<vmu:converse>noAdvanceDirective</vmu:converse>
</rdf:Description>
<rdf:Description rdf:about="http://vista.org/mu/measureset#inpatient2012">
<rdf:type>vmu:measureSet</rdf:type>
<vmu:label>Inpatient 2012 Meaningful Use Measures</vmu:label>
<vmu:includes>vmu:measure#hasAdvanceDirective</vmu:includes>
<vmu:includes>vmu:measure#hasMedOrders</vmu:includes>
</rdf:Description>
</rdf:RDF>

View File

@ -0,0 +1,460 @@
<?xml version="1.0" encoding="utf-8"?>
<ClinicalDocument xmlns="urn:hl7-org:v3" xmlns:voc="urn:hl7-org:v3/voc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hl7-org:v3 CDA.xsd">
<realmCode code="US"/>
<typeId root="2.16.840.1.113883.1.3" extension="POCD_HD000040"/>
<templateId root="2.16.840.1.113883.10.20.12"/>
<templateId root="2.16.840.1.113883.3.249.11.100.1"/>
<id root="2.16.840.1.113883.3.543" extension="@@@UUID-DOC@@@"/>
<code code="55182-0" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Quality Measure Report"/>
<title>QRDA Incidence Report</title>
<effectiveTime value="20100703"/>
<confidentialityCode codeSystem="2.16.840.1.113883.5.25" code="N"/>
<languageCode code="en-US"/>
<setId root="2.16.840.1.113883.3.543" extension="@@@UUID-SET@@@"/>
<versionNumber value="1"/>
<recordTarget>
<patientRole>
<id extension="666000200" root="SSN"/>
<addr use="H">
<streetAddressLine>Any Street</streetAddressLine>
<city>Any Town</city>
<state>WEST VIRGINIA</state>
<postalCode/>
</addr>
<telecom use="" value="tel:+1-222-555-8235"/>
<patient>
<name>
<given>MALE-D</given>
<family>MEASURE-TWO</family>
</name>
<administrativeGenderCode displayName="MALE" code="M" codeSystemName="HL7 AdministrativeGender" codeSystem=""/>
<birthTime value="19600101120000"/>
</patient>
</patientRole>
</recordTarget>
<author>
<time value="20100703"/>
<assignedAuthor>
<id root="2.16.840.1.113883.3.249.6" extension="100001"/>
<assignedPerson>
<name>
<given>Nancy</given>
<family>Anthracite</family>
<suffix>MD</suffix>
</name>
</assignedPerson>
<representedOrganization>
<id root="2.16.840.1.113883.3.543" extension="1558574526"/>
<name>WorldVistA Test Clinic</name>
</representedOrganization>
</assignedAuthor>
</author>
<informant>
<assignedEntity>
<id nullFlavor="NA"/>
<representedOrganization>
<id root="2.16.840.1.113883.3.543" extension="1558574526"/>
<name>World VistA Test Clinic</name>
</representedOrganization>
</assignedEntity>
</informant>
<custodian>
<assignedCustodian>
<representedCustodianOrganization>
<id root="2.16.840.1.113883.3.543" extension="1558574526"/>
<name>WorldVistA Test Clinic</name>
</representedCustodianOrganization>
</assignedCustodian>
</custodian>
<legalAuthenticator>
<time value="20100703"/>
<signatureCode code="S"/>
<assignedEntity>
<id root="2.16.840.1.113883.3.543" extension="111111"/>
<assignedPerson>
<name>
<given>Nancy</given>
<family>Anthracite</family>
<suffix>MD</suffix>
</name>
</assignedPerson>
<representedOrganization>
<id root="2.16.840.1.113883.3.543" extension="1558574526"/>
<name>WorldVistA Test Clinic</name>
</representedOrganization>
</assignedEntity>
</legalAuthenticator>
<participant typeCode="PRF">
<functionCode code="PCP" codeSystem="2.16.840.1.113883.5.88"/>
<associatedEntity classCode="PROV">
<id root="2.16.840.1.113883.3.249.6" extension="111111"/>
<associatedPerson>
<name>
<prefix>Dr.</prefix>
<given>Nancy</given>
<family>Anthracite</family>
</name>
</associatedPerson>
</associatedEntity>
</participant>
<component>
<structuredBody>
<component>
<section>
<templateId root="2.16.840.1.113883.3.249.11.50"/>
<code code="55185-3" codeSystem="2.16.840.1.113883.6.1"/>
<title>Measure set: CMS EHR Measure Set</title>
<text>2010 Measures Set Measures</text>
<component>
<section>
<templateId root="2.16.840.1.113883.3.249.11.2"/>
<code code="55186-1" codeSystem="2.16.840.1.113883.6.1"/>
<title>Measure Section</title>
<text>
<list>
<item>CMS Measure #1: Diabetes Mellitus: Hemoglobin A1c Poor Control in Diabetes Mellitus</item>
</list>
</text>
<entry typeCode="DRIV">
<act classCode="ACT" moodCode="DEF">
<id root="2.16.840.1.113883.3.249.11.2"/>
<code code="PQRI-1" codeSystem="2.16.840.1.113883.3.249.12" displayName="Hemoglobin A1c Poor Control in Diabetes Mellitus"/>
<text>Percentage of patients 18 through 75 years with diabetes mellitus who had most recent hemoglobin A1C greater than 9.0%</text>
<statusCode code="completed"/>
</act>
</entry>
<component>
<section>
<code code="55187-9" codeSystem="2.16.840.1.113883.6.1"/>
<title>Reporting Parameters</title>
<text>
<list>
<item>Reporting Period Jan 1, 2010 to Dec 31, 2010</item>
</list>
</text>
<entry>
<act classCode="ACT" moodCode="EVN">
<code code="252116004" codeSystem="2.16.840.1.113883.6.96" displayName="Observation Parameters"/>
<effectiveTime>
<low value="20100101"/>
<high value="20101231"/>
</effectiveTime>
</act>
</entry>
</section>
</component>
<component>
<section>
<code code="55188-7" codeSystem="2.16.840.1.113883.6.1"/>
<title>Patient Data</title>
</section>
</component>
<component>
<section>
<templateId root="2.16.840.1.113883.3.88.11.83.103" assigningAuthorityName="HITSP/C83"/>
<templateId root="1.3.6.1.4.1.19376.1.5.3.1.3.6" assigningAuthorityName="IHE PCC"/>
<templateId root="2.16.840.1.113883.10.20.1.11" assigningAuthorityName="HL7 CCD"/>
<code code="11450-4" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Problem list"/>
<title>Problems</title>
<text>
<table>
<tbody>
<tr>
<th>Type</th>
<th>Date</th>
<th>Code</th>
<th>Description</th>
<th>Status</th>
<th>Source</th>
</tr>
<tr>
<td>Problem</td>
<td>
<table>
<tbody>
<tr xmlns="">
<td>Oct 13, 2010</td>
</tr>
</tbody>
</table>
</td>
<td>250.02 (ICD9CM)
</td>
<td ID="PROBLEM1">Diabetes Mellitus without mention of Complication, type II or unspecified type,</td>
<td>Active</td>
<td>NANCY ANTHRACITE </td>
</tr>
<tr>
<td>Problem</td>
<td>
<table>
<tbody>
<tr xmlns="">
<td>Oct 04, 2010</td>
</tr>
</tbody>
</table>
</td>
<td>250.00 (ICD9CM)
</td>
<td ID="PROBLEM2">Diabetes Mellitus</td>
<td>Active</td>
<td>MATTHEW M KING </td>
</tr>
</tbody>
</table>
</text>
<entry typeCode="DRIV">
<act classCode="ACT" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.27"/>
<id root="PROBLEM1" extension="CCRObjectID"/>
<code nullFlavor="NA"/>
<performer typeCode="PRF">
<assignedEntity>
<id extension="ACTORPROVIDER_10000000020" root="CCRActorID"/>
<addr use="WP">
<streetAddressLine>VA MEDICAL CENTER</streetAddressLine>
<city>ALBANY</city>
<state>NY</state>
<postalCode>12180</postalCode>
</addr>
<telecom/>
<assignedPerson>
<name>
<given>NANCY</given>
<family>ANTHRACITE</family>
</name>
</assignedPerson>
</assignedEntity>
</performer>
<entryRelationship typeCode="SUBJ">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.28" assigningAuthorityName="CCD"/>
<templateId root="2.16.840.1.113883.3.249.11.100.8"/>
<id root="PROBLEM1" extension="CCRObjectID"/>
<code code="55607006" displayName="Problem" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED-CT"/>
<statusCode code="completed"/>
<text>
<reference value="#PROBLEM1"/>
</text>
<effectiveTime>
<low value="20101013"/>
<high nullFlavor="UNK"/>
</effectiveTime>
<value displayName="Diabetes Mellitus without mention of Complication, type II or unspecified type," code="250.02" codeSystemName="ICD9CM" codeSystem=""/>
<entryRelationship typeCode="REFR">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.50"/>
<code code="33999-4" codeSystem="2.16.840.1.113883.6.1" displayName="Status"/>
<statusCode code="completed"/>
<value>
<originalText>Active</originalText>
</value>
</observation>
</entryRelationship>
</observation>
</entryRelationship>
</act>
</entry>
<entry typeCode="DRIV">
<act classCode="ACT" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.27"/>
<id root="PROBLEM2" extension="CCRObjectID"/>
<code nullFlavor="NA"/>
<performer typeCode="PRF">
<assignedEntity>
<id extension="ACTORPROVIDER_10000000183" root="CCRActorID"/>
<addr use="WP">
<streetAddressLine>VA MEDICAL CENTER</streetAddressLine>
<city>ALBANY</city>
<state>NY</state>
<postalCode>12180</postalCode>
</addr>
<telecom/>
<assignedPerson>
<name>
<given>MATTHEW</given>
<given>M</given>
<family>KING</family>
</name>
</assignedPerson>
</assignedEntity>
</performer>
<entryRelationship typeCode="SUBJ">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.28" assigningAuthorityName="CCD"/>
<templateId root="2.16.840.1.113883.3.249.11.100.8"/>
<id root="PROBLEM2" extension="CCRObjectID"/>
<code code="55607006" displayName="Problem" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED-CT"/>
<statusCode code="completed"/>
<text>
<reference value="#PROBLEM2"/>
</text>
<effectiveTime>
<low value="20101004"/>
<high nullFlavor="UNK"/>
</effectiveTime>
<value displayName="Diabetes Mellitus" code="250.00" codeSystemName="ICD9CM" codeSystem=""/>
<entryRelationship typeCode="REFR">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.50"/>
<code code="33999-4" codeSystem="2.16.840.1.113883.6.1" displayName="Status"/>
<statusCode code="completed"/>
<value>
<originalText>Active</originalText>
</value>
</observation>
</entryRelationship>
</observation>
</entryRelationship>
</act>
</entry>
</section>
</component>
<component>
<section>
<templateId root="2.16.840.1.113883.10.20.1.12"/>
<code code="47519-4" codeSystem="2.16.840.1.113883.6.1"/>
<title>Procedures</title>
<text>
<table>
<tbody>
<tr>
<th>Type</th>
<th>Date</th>
<th>Code</th>
<th>Description</th>
<th>Location</th>
<th>Substance</th>
<th>Method</th>
<th>Position</th>
<th>Site</th>
<th>Status</th>
<th>Source</th>
</tr>
<tr id="PROCEDURE_4141_10">
<td/>
<table>
<tbody>
<tr xmlns="">
<td>Procedure Date:
</td>
<td>Oct 14, 2010</td>
</tr>
</tbody>
</table>
<td>99242 (CPT-4)
</td>
<td>INTERMEDIATE (30min)</td>
<td/>
<td/>
<td/>
<td/>
<td/>
<td>Completed</td>
<td>NANCY ANTHRACITE </td>
</tr>
<tr id="PROCEDURE_4092_7">
<td/>
<table>
<tbody>
<tr xmlns="">
<td>Procedure Date:
</td>
<td>Oct 04, 2010</td>
</tr>
</tbody>
</table>
<td>99213 (CPT-4)
</td>
<td>Office/Outpatient Visit of an Established Patient requiring (2 of 3) an Expanded History, an Exam and Medical Decision Making of Low Complexity (CPT-4 99213)</td>
<td/>
<td/>
<td/>
<td/>
<td/>
<td>Completed</td>
<td>MATTHEW M KING </td>
</tr>
</tbody>
</table>
</text>
<entry typeCode="DRIV">
<procedure classCode="PROC" moodCode="EVN">
<templateId root="2.16.840.1.113883.3.88.11.83.17" assigningAuthorityName="HITSP C83"/>
<templateId root="2.16.840.1.113883.10.20.1.29" assigningAuthorityName="CCD"/>
<templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.19" assigningAuthorityName="IHE PCC"/>
<id root="PROCEDURE_4141_10" extension="CCRObjectID"/>
<code displayName="INTERMEDIATE (30min)" code="99242" codeSystemName="CPT-4" codeSystem="2.16.840.1.113883.6.12"/>
<text>
<reference value="#PROCEDURE_4141_10"/>
</text>
<statusCode code="completed"/>
<effectiveTime>
<low value="20101014"/>
<high nullFlavor="UNK"/>
</effectiveTime>
</procedure>
</entry>
<entry typeCode="DRIV">
<procedure classCode="PROC" moodCode="EVN">
<templateId root="2.16.840.1.113883.3.88.11.83.17" assigningAuthorityName="HITSP C83"/>
<templateId root="2.16.840.1.113883.10.20.1.29" assigningAuthorityName="CCD"/>
<templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.19" assigningAuthorityName="IHE PCC"/>
<id root="PROCEDURE_4092_7" extension="CCRObjectID"/>
<code displayName="Office/Outpatient Visit of an Established Patient requiring (2 of 3) an Expanded History, an Exam and Medical Decision Making of Low Complexity (CPT-4 99213)" code="99213" codeSystemName="CPT-4" codeSystem="2.16.840.1.113883.6.12"/>
<text>
<reference value="#PROCEDURE_4092_7"/>
</text>
<statusCode code="completed"/>
<effectiveTime>
<low value="20101004"/>
<high nullFlavor="UNK"/>
</effectiveTime>
</procedure>
</entry>
</section>
</component>
<component>
<section>
<templateId root="2.16.840.1.113883.10.20.1.9"/>
<code code="48768-6" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Payment Sources"/>
<title>Payers</title>
<text/>
<entry typeCode="DRIV">
<act classCode="ACT" moodCode="DEF">
<templateId root="2.16.840.1.113883.10.20.1.20"/>
<id root="2.16.840.1.113883.3.543" extension="@@@UUID-PAYER@@@"/>
<code code="48768-6" codeSystem="2.16.840.1.113883.6.1" displayName="Payment sources"/>
<statusCode code="completed"/>
<entryRelationship typeCode="COMP">
<act classCode="ACT" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.26"/>
<templateId root="2.16.840.1.113883.3.249.11.100.7"/>
<id root="dbbb6311-8a4d-11df-a4ee-0800200c9c66"/>
<code code="PUBLICPOL" codeSystem="2.16.840.1.113883.5.4" displayName="Public Healthcare"/>
<statusCode code="completed"/>
<performer typeCode="PRF">
<assignedEntity>
<id root="2.16.840.1.113883.12.86" extension="MC"/>
</assignedEntity>
</performer>
<participant typeCode="COV">
<participantRole>
<id root="2.16.840.1.113883.4.1" extension="@@SSN@@"/>
<code code="SELF" codeSystem="2.16.840.1.113883.5.111" displayName="Self"/>
</participantRole>
</participant>
</act>
</entryRelationship>
</act>
</entry>
</section>
</component>
</section>
</component>
</section>
</component>
</structuredBody>
</component>
</ClinicalDocument>

View File

@ -0,0 +1,378 @@
<?xml version="1.0" encoding="utf-8"?>
<ClinicalDocument xmlns="urn:hl7-org:v3" xmlns:voc="urn:hl7-org:v3/voc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hl7-org:v3 CDA.xsd">
<realmCode code="US"/>
<typeId root="2.16.840.1.113883.1.3" extension="POCD_HD000040"/>
<templateId root="2.16.840.1.113883.10.20.12"/>
<templateId root="2.16.840.1.113883.3.249.11.100.1"/>
<id root="2.16.840.1.113883.3.543" extension="9c8175e0-e5e7-11df-aca0-93b70eeb415e"/>
<code code="55182-0" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Quality Measure Report"/>
<title>QRDA Incidence Report</title>
<effectiveTime value="20100703"/>
<confidentialityCode codeSystem="2.16.840.1.113883.5.25" code="N"/>
<languageCode code="en-US"/>
<setId root="2.16.840.1.113883.3.543" extension="9c8175e0-e5e7-11df-aca0-93b70eeb415e"/>
<versionNumber value="1"/>
<recordTarget>
<patientRole>
<id extension="666000200" root="2.16.840.1.113883.4.1"/>
<addr use="H">
<streetAddressLine>Any Street</streetAddressLine>
<city>Any Town</city>
<state>WV</state>
<postalCode/>
</addr>
<telecom use="" value="tel:+1-222-555-8235"/>
<patient>
<name>
<given>MALE-D</given>
<family>MEASURE-TWO</family>
</name>
<administrativeGenderCode displayName="MALE" code="M" codeSystemName="HL7 AdministrativeGender" codeSystem="2.16.840.1.113883.5.1"/>
<birthTime value="19600101120000"/>
<raceCode code="2076-8" codeSystem="2.16.840.1.113883.5.104"/>
<ethnicGroupCode code="2186-5" codeSystem="2.16.840.1.113883.5.50"/>
</patient>
<providerOrganization>
<!-- NPI for the provider and this is a real number-->
<id root="2.16.840.1.113883.4.6" extension="1558574525" />
<name>WorldVistA Test Clinic</name>
<!--WVV Address of organization is optional except for the STATE-->
<addr>
<state>MD</state>
<postalCode>20877</postalCode>
</addr>
<!--WVP required asOrganizationPartOf added to sample-->
<asOrganizationPartOf>
<wholeOrganization>
<!-- Tax ID is the extension and this is a dummy numbers-->
<id root="2.16.840.1.113883.4.2" extension="226864459"/>
</wholeOrganization>
</asOrganizationPartOf>
</providerOrganization>
</patientRole>
</recordTarget>
<author>
<time value="20100703"/>
<assignedAuthor>
<id root="2.16.840.1.113883.3.249.6" extension="100001"/>
<assignedPerson>
<name>
<given>Nancy</given>
<family>Anthracite</family>
<suffix>MD</suffix>
</name>
</assignedPerson>
<representedOrganization>
<id root="2.16.840.1.113883.3.543" extension="1558574526"/>
<name>WorldVistA Test Clinic</name>
</representedOrganization>
</assignedAuthor>
</author>
<informant>
<assignedEntity>
<id nullFlavor="NA"/>
<representedOrganization>
<id root="2.16.840.1.113883.3.543" extension="1558574526"/>
<name>World VistA Test Clinic</name>
</representedOrganization>
</assignedEntity>
</informant>
<custodian>
<assignedCustodian>
<representedCustodianOrganization>
<id root="2.16.840.1.113883.3.543" extension="1558574526"/>
<name>WorldVistA Test Clinic</name>
</representedCustodianOrganization>
</assignedCustodian>
</custodian>
<legalAuthenticator>
<time value="20100703"/>
<signatureCode code="S"/>
<assignedEntity>
<id root="2.16.840.1.113883.3.543" extension="111111"/>
<assignedPerson>
<name>
<given>Nancy</given>
<family>Anthracite</family>
<suffix>MD</suffix>
</name>
</assignedPerson>
<representedOrganization>
<id root="2.16.840.1.113883.3.543" extension="1558574526"/>
<name>WorldVistA Test Clinic</name>
</representedOrganization>
</assignedEntity>
</legalAuthenticator>
<participant typeCode="PRF">
<functionCode code="PCP" codeSystem="2.16.840.1.113883.5.88"/>
<associatedEntity classCode="PROV">
<id root="2.16.840.1.113883.3.249.6" extension="111111"/>
<associatedPerson>
<name>
<prefix>Dr.</prefix>
<given>Nancy</given>
<family>Anthracite</family>
</name>
</associatedPerson>
</associatedEntity>
</participant>
<documentationOf>
<serviceEvent>
<code displayName="Office/Outpatient Visit of an Established Patient requiring (2 of 3) an Expanded History, an Exam and Medical Decision Making of Low Complexity (CPT-4 99213)" code="99213" codeSystemName="CPT-4" codeSystem="2.16.840.1.113883.6.12"/>
<effectiveTime>
<low value="20101004"/>
<high value="20101004"/>
</effectiveTime>
<performer typeCode="PRF">
<assignedEntity>
<id root="2.16.840.1.113883.4.6" extension="1558574525"/>
<code code="62247001" codeSystem="2.16.840.1.113883.6.69" codeSystemName="SNM CT" displayName="Internal Medician Specialist"/>
<addr>
<streetAddressLine>123 Maple Ave</streetAddressLine>
<city>Gaithersburg</city>
<state>MD</state>
<postalCode>20877</postalCode>
</addr>
<assignedPerson>
<name>
<given>Nancy</given>
<family>Anthracite</family>
<suffix>MD</suffix>
</name>
</assignedPerson>
</assignedEntity>
</performer>
</serviceEvent>
</documentationOf>
<documentationOf>
<serviceEvent>
<code displayName="INTERMEDIATE (30min)" code="99242" codeSystemName="CPT-4" codeSystem="2.16.840.1.113883.6.12"/>
<effectiveTime>
<low value="20101014"/>
<high value="20101014"/>
</effectiveTime>
<performer typeCode="PRF">
<assignedEntity>
<id root="2.16.840.1.113883.4.6" extension="1558574525"/>
<code code="62247001" codeSystem="2.16.840.1.113883.6.69" codeSystemName="SNM CT" displayName="Internal Medician Specialist"/>
<addr>
<streetAddressLine>123 Maple Ave</streetAddressLine>
<city>Gaithersburg</city>
<state>MD</state>
<postalCode>20877</postalCode>
</addr>
<assignedPerson>
<name>
<given>Nancy</given>
<family>Anthracite</family>
<suffix>MD</suffix>
</name>
</assignedPerson>
</assignedEntity>
</performer>
</serviceEvent>
</documentationOf>
<component>
<structuredBody>
<component>
<section>
<templateId root="2.16.840.1.113883.3.249.11.50"/>
<code code="55185-3" codeSystem="2.16.840.1.113883.6.1"/>
<title>Measure set: CMS EHR Measure Set</title>
<text>2010 Measures Set Measures</text>
<component>
<section>
<templateId root="2.16.840.1.113883.3.249.11.2"/>
<code code="55186-1" codeSystem="2.16.840.1.113883.6.1"/>
<title>Measure Section</title>
<text>
<list>
<item>CMS Measure #1: Diabetes Mellitus: Hemoglobin A1c Poor Control in Diabetes Mellitus</item>
</list>
</text>
<entry typeCode="DRIV">
<act classCode="ACT" moodCode="DEF">
<id root="2.16.840.1.113883.3.249.11.2"/>
<code code="PQRI-1" codeSystem="2.16.840.1.113883.3.249.12" displayName="Hemoglobin A1c Poor Control in Diabetes Mellitus"/>
<text>Percentage of patients 18 through 75 years with diabetes mellitus who had most recent hemoglobin A1C greater than 9.0%</text>
<statusCode code="completed"/>
</act>
</entry>
<component>
<section>
<code code="55187-9" codeSystem="2.16.840.1.113883.6.1"/>
<title>Reporting Parameters</title>
<text>
<list>
<item>Reporting Period Jan 1, 2010 to Dec 31, 2010</item>
</list>
</text>
<entry>
<act classCode="ACT" moodCode="EVN">
<code code="252116004" codeSystem="2.16.840.1.113883.6.96" displayName="Observation Parameters"/>
<effectiveTime>
<low value="20100101"/>
<high value="20101231"/>
</effectiveTime>
</act>
</entry>
</section>
</component>
<component>
<section>
<code code="55188-7" codeSystem="2.16.840.1.113883.6.1"/>
<title>Patient Data</title>
</section>
</component>
<component>
<section>
<templateId root="2.16.840.1.113883.3.88.11.83.103" assigningAuthorityName="HITSP/C83"/>
<templateId root="1.3.6.1.4.1.19376.1.5.3.1.3.6" assigningAuthorityName="IHE PCC"/>
<templateId root="2.16.840.1.113883.10.20.1.11" assigningAuthorityName="HL7 CCD"/>
<code code="11450-4" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Problem list"/>
<title>Problems</title>
<text/>
<entry typeCode="DRIV">
<act classCode="ACT" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.27"/>
<id root="PROBLEM1" extension="CCRObjectID"/>
<code nullFlavor="NA"/>
<performer typeCode="PRF">
<assignedEntity>
<id extension="ACTORPROVIDER_10000000020" root="CCRActorID"/>
<addr use="WP">
<streetAddressLine>VA MEDICAL CENTER</streetAddressLine>
<city>ALBANY</city>
<state>NY</state>
<postalCode>12180</postalCode>
</addr>
<telecom/>
<assignedPerson>
<name>
<given>NANCY</given>
<family>ANTHRACITE</family>
</name>
</assignedPerson>
</assignedEntity>
</performer>
<entryRelationship typeCode="SUBJ">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.28" assigningAuthorityName="CCD"/>
<templateId root="2.16.840.1.113883.3.249.11.100.8"/>
<id root="PROBLEM1" extension="CCRObjectID"/>
<code code="55607006" displayName="Problem" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNM"/>
<statusCode code="completed"/>
<effectiveTime>
<low value="20101013"/>
<high value="20101013"/>
</effectiveTime>
<value xsi:type="CD" displayName="Diabetes Mellitus without mention of Complication, type II or unspecified type," code="250.02" codeSystemName="I9" codeSystem="2.16.840.1.113883.6.103"/>
<entryRelationship typeCode="REFR">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.50"/>
<templateId root="2.16.840.1.113883.3.249.11.100.12"/>
<code code="33999-4" codeSystem="2.16.840.1.113883.6.1" displayName="Status"/>
<statusCode code="completed"/>
<value xsi:type="CE" code="55561003" codeSystem="2.16.840.1.113883.6.96" displayName="Active" codeSystemName="SNM" />
</observation>
</entryRelationship>
</observation>
</entryRelationship>
</act>
</entry>
<entry typeCode="DRIV">
<act classCode="ACT" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.27"/>
<id root="PROBLEM2" extension="CCRObjectID"/>
<code nullFlavor="NA"/>
<performer typeCode="PRF">
<assignedEntity>
<id extension="ACTORPROVIDER_10000000183" root="CCRActorID"/>
<addr use="WP">
<streetAddressLine>VA MEDICAL CENTER</streetAddressLine>
<city>ALBANY</city>
<state>NY</state>
<postalCode>12180</postalCode>
</addr>
<telecom/>
<assignedPerson>
<name>
<given>MATTHEW</given>
<given>M</given>
<family>KING</family>
</name>
</assignedPerson>
</assignedEntity>
</performer>
<entryRelationship typeCode="SUBJ">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.28" assigningAuthorityName="CCD"/>
<templateId root="2.16.840.1.113883.3.249.11.100.8"/>
<id root="PROBLEM2" extension="CCRObjectID"/>
<code code="55607006" displayName="Problem" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNM"/>
<statusCode code="completed"/>
<effectiveTime>
<low value="20101004"/>
<high value="20101004"/>
</effectiveTime>
<value xsi:type="CD" displayName="Diabetes Mellitus" code="250.00" codeSystemName="I9" codeSystem="2.16.840.1.113883.6.103"/>
<entryRelationship typeCode="REFR">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.50"/>
<templateId root="2.16.840.1.113883.3.249.11.100.12"/>
<code code="33999-4" codeSystem="2.16.840.1.113883.6.1" displayName="Status"/>
<statusCode code="completed"/>
<value xsi:type="CE" code="55561003" codeSystem="2.16.840.1.113883.6.96" displayName="Active" codeSystemName="SNM" />
</observation>
</entryRelationship>
</observation>
</entryRelationship>
</act>
</entry>
</section>
</component>
<component>
<section>
<templateId root="2.16.840.1.113883.10.20.1.9"/>
<code code="48768-6" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Payment Sources"/>
<title>Payers</title>
<text/>
<entry typeCode="DRIV">
<act classCode="ACT" moodCode="DEF">
<templateId root="2.16.840.1.113883.10.20.1.20"/>
<id root="2.16.840.1.113883.3.543" extension="9c8175e0-e5e7-11df-aca0-93b70eeb415e"/>
<code code="48768-6" codeSystem="2.16.840.1.113883.6.1" displayName="Payment sources"/>
<statusCode code="completed"/>
<entryRelationship typeCode="COMP">
<act classCode="ACT" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.26"/>
<templateId root="2.16.840.1.113883.3.249.11.100.7"/>
<id root="dbbb6311-8a4d-11df-a4ee-0800200c9c66"/>
<code code="PUBLICPOL" codeSystem="2.16.840.1.113883.5.4" displayName="Public Healthcare"/>
<statusCode code="completed"/>
<performer typeCode="PRF">
<assignedEntity>
<id root="2.16.840.1.113883.12.86" extension="MC"/>
</assignedEntity>
</performer>
<participant typeCode="COV">
<participantRole>
<id root="2.16.840.1.113883.4.1" extension="666000200"/>
<code code="SELF" codeSystem="2.16.840.1.113883.5.111" displayName="Self"/>
</participantRole>
</participant>
</act>
</entryRelationship>
</act>
</entry>
</section>
</component>
</section>
</component>
</section>
</component>
</structuredBody>
</component>
</ClinicalDocument>

View File

@ -0,0 +1,391 @@
<?xml version="1.0" encoding="utf-8"?>
<ClinicalDocument xmlns="urn:hl7-org:v3" xmlns:voc="urn:hl7-org:v3/voc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hl7-org:v3 CDA.xsd">
<realmCode code="US"/>
<typeId root="2.16.840.1.113883.1.3" extension="POCD_HD000040"/>
<templateId root="2.16.840.1.113883.10.20.12"/>
<templateId root="2.16.840.1.113883.3.249.11.100.1"/>
<id root="2.16.840.1.113883.3.543" extension="@@@UUID-DOC@@@"/>
<code code="55182-0" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Quality Measure Report"/>
<title>QRDA Incidence Report</title>
<effectiveTime value="20100703"/>
<confidentialityCode codeSystem="2.16.840.1.113883.5.25" code="N"/>
<languageCode code="en-US"/>
<setId root="2.16.840.1.113883.3.543" extension="@@@UUID-SET@@@"/>
<versionNumber value="1"/>
<recordTarget>
<patientRole>
<id extension="666000669" root="SSN"/>
<addr use="H">
<streetAddressLine>Any Street</streetAddressLine>
<city>Any Town</city>
<state/>
<postalCode/>
</addr>
<telecom/>
<patient>
<name>
<given>OUTPATIENT</given>
<family>SIXTYNINE</family>
</name>
<administrativeGenderCode displayName="MALE" code="M" codeSystemName="HL7 AdministrativeGender" codeSystem=""/>
<birthTime value="19450309120000"/>
</patient>
</patientRole>
</recordTarget>
<author>
<time value="20100703"/>
<assignedAuthor>
<id root="2.16.840.1.113883.3.249.6" extension="100001"/>
<assignedPerson>
<name>
<given>Nancy</given>
<family>Anthracite</family>
<suffix>MD</suffix>
</name>
</assignedPerson>
<representedOrganization>
<id root="2.16.840.1.113883.3.543" extension="1558574526"/>
<name>WorldVistA Test Clinic</name>
</representedOrganization>
</assignedAuthor>
</author>
<informant>
<assignedEntity>
<id nullFlavor="NA"/>
<representedOrganization>
<id root="2.16.840.1.113883.3.543" extension="1558574526"/>
<name>World VistA Test Clinic</name>
</representedOrganization>
</assignedEntity>
</informant>
<custodian>
<assignedCustodian>
<representedCustodianOrganization>
<id root="2.16.840.1.113883.3.543" extension="1558574526"/>
<name>WorldVistA Test Clinic</name>
</representedCustodianOrganization>
</assignedCustodian>
</custodian>
<legalAuthenticator>
<time value="20100703"/>
<signatureCode code="S"/>
<assignedEntity>
<id root="2.16.840.1.113883.3.543" extension="111111"/>
<assignedPerson>
<name>
<given>Nancy</given>
<family>Anthracite</family>
<suffix>MD</suffix>
</name>
</assignedPerson>
<representedOrganization>
<id root="2.16.840.1.113883.3.543" extension="1558574526"/>
<name>WorldVistA Test Clinic</name>
</representedOrganization>
</assignedEntity>
</legalAuthenticator>
<participant typeCode="PRF">
<functionCode code="PCP" codeSystem="2.16.840.1.113883.5.88"/>
<associatedEntity classCode="PROV">
<id root="2.16.840.1.113883.3.249.6" extension="111111"/>
<associatedPerson>
<name>
<prefix>Dr.</prefix>
<given>Nancy</given>
<family>Anthracite</family>
</name>
</associatedPerson>
</associatedEntity>
</participant>
<component>
<structuredBody>
<component>
<section>
<templateId root="2.16.840.1.113883.3.249.11.50"/>
<code code="55185-3" codeSystem="2.16.840.1.113883.6.1"/>
<title>Measure set: CMS EHR Measure Set</title>
<text>2010 Measures Set Measures</text>
<component>
<section>
<templateId root="2.16.840.1.113883.3.249.11.2"/>
<code code="55186-1" codeSystem="2.16.840.1.113883.6.1"/>
<title>Measure Section</title>
<text>
<list>
<item>CMS Measure #1: Diabetes Mellitus: Hemoglobin A1c Poor Control in Diabetes Mellitus</item>
</list>
</text>
<entry typeCode="DRIV">
<act classCode="ACT" moodCode="DEF">
<id root="2.16.840.1.113883.3.249.11.2"/>
<code code="PQRI-1" codeSystem="2.16.840.1.113883.3.249.12" displayName="Hemoglobin A1c Poor Control in Diabetes Mellitus"/>
<text>Percentage of patients 18 through 75 years with diabetes mellitus who had most recent hemoglobin A1C greater than 9.0%</text>
<statusCode code="completed"/>
</act>
</entry>
<component>
<section>
<code code="55187-9" codeSystem="2.16.840.1.113883.6.1"/>
<title>Reporting Parameters</title>
<text>
<list>
<item>Reporting Period Jan 1, 2010 to Dec 31, 2010</item>
</list>
</text>
<entry>
<act classCode="ACT" moodCode="EVN">
<code code="252116004" codeSystem="2.16.840.1.113883.6.96" displayName="Observation Parameters"/>
<effectiveTime>
<low value="20100101"/>
<high value="20101231"/>
</effectiveTime>
</act>
</entry>
</section>
</component>
<component>
<section>
<code code="55188-7" codeSystem="2.16.840.1.113883.6.1"/>
<title>Patient Data</title>
</section>
</component>
<component>
<section>
<templateId root="2.16.840.1.113883.3.88.11.83.103" assigningAuthorityName="HITSP/C83"/>
<templateId root="1.3.6.1.4.1.19376.1.5.3.1.3.6" assigningAuthorityName="IHE PCC"/>
<templateId root="2.16.840.1.113883.10.20.1.11" assigningAuthorityName="HL7 CCD"/>
<code code="11450-4" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Problem list"/>
<title>Problems</title>
<text>
<table>
<tbody>
<tr>
<th>Type</th>
<th>Date</th>
<th>Code</th>
<th>Description</th>
<th>Status</th>
<th>Source</th>
</tr>
<tr>
<td>Problem</td>
<td>
<table>
<tbody>
<tr xmlns="">
<td>Sep 16, 2010</td>
</tr>
</tbody>
</table>
</td>
<td>250.00 (ICD9CM)
</td>
<td ID="PROBLEM1">Diabetes Mellitus without mention of Complication, type II or unspecified type,</td>
<td>Active</td>
<td>MATTHEW M KING </td>
</tr>
</tbody>
</table>
</text>
<entry typeCode="DRIV">
<act classCode="ACT" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.27"/>
<id root="PROBLEM1" extension="CCRObjectID"/>
<code nullFlavor="NA"/>
<performer typeCode="PRF">
<assignedEntity>
<id extension="ACTORPROVIDER_10000000183" root="CCRActorID"/>
<addr use="WP">
<streetAddressLine>VA MEDICAL CENTER</streetAddressLine>
<city>ALBANY</city>
<state>NY</state>
<postalCode>12180</postalCode>
</addr>
<telecom/>
<assignedPerson>
<name>
<given>MATTHEW</given>
<given>M</given>
<family>KING</family>
</name>
</assignedPerson>
</assignedEntity>
</performer>
<entryRelationship typeCode="SUBJ">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.28" assigningAuthorityName="CCD"/>
<templateId root="2.16.840.1.113883.3.249.11.100.8"/>
<id root="PROBLEM1" extension="CCRObjectID"/>
<code code="55607006" displayName="Problem" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED-CT"/>
<statusCode code="completed"/>
<text>
<reference value="#PROBLEM1"/>
</text>
<effectiveTime>
<low value="20100916"/>
<high nullFlavor="UNK"/>
</effectiveTime>
<value displayName="Diabetes Mellitus without mention of Complication, type II or unspecified type," code="250.00" codeSystemName="ICD9CM" codeSystem=""/>
<entryRelationship typeCode="REFR">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.50"/>
<code code="33999-4" codeSystem="2.16.840.1.113883.6.1" displayName="Status"/>
<statusCode code="completed"/>
<value>
<originalText>Active</originalText>
</value>
</observation>
</entryRelationship>
</observation>
</entryRelationship>
</act>
</entry>
</section>
</component>
<component>
<section>
<templateId root="2.16.840.1.113883.10.20.1.12"/>
<code code="47519-4" codeSystem="2.16.840.1.113883.6.1"/>
<title>Procedures</title>
<text>
<table>
<tbody>
<tr>
<th>Type</th>
<th>Date</th>
<th>Code</th>
<th>Description</th>
<th>Location</th>
<th>Substance</th>
<th>Method</th>
<th>Position</th>
<th>Site</th>
<th>Status</th>
<th>Source</th>
</tr>
<tr id="PROCEDURE_4067_7">
<td/>
<table>
<tbody>
<tr xmlns="">
<td>Procedure Date:
</td>
<td>Sep 17, 2010</td>
</tr>
</tbody>
</table>
<td>99213 (CPT-4)
</td>
<td>Office/Outpatient Visit of an Established Patient requiring (2 of 3) an Expanded History, an Exam and Medical Decision Making of Low Complexity (CPT-4 99213)</td>
<td/>
<td/>
<td/>
<td/>
<td/>
<td>Completed</td>
<td>MATTHEW M KING </td>
</tr>
<tr id="PROCEDURE_4066_4">
<td/>
<table>
<tbody>
<tr xmlns="">
<td>Procedure Date:
</td>
<td>Sep 16, 2010</td>
</tr>
</tbody>
</table>
<td>99214 (CPT-4)
</td>
<td>Office/Outpatient Visit of an Established Patient requiring (2 of 3) a Detailed History, an Exam and Medical Decision Making of Moderate Complexity (CPT-4 99214)</td>
<td/>
<td/>
<td/>
<td/>
<td/>
<td>Completed</td>
<td>MATTHEW M KING </td>
</tr>
</tbody>
</table>
</text>
<entry typeCode="DRIV">
<procedure classCode="PROC" moodCode="EVN">
<templateId root="2.16.840.1.113883.3.88.11.83.17" assigningAuthorityName="HITSP C83"/>
<templateId root="2.16.840.1.113883.10.20.1.29" assigningAuthorityName="CCD"/>
<templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.19" assigningAuthorityName="IHE PCC"/>
<id root="PROCEDURE_4067_7" extension="CCRObjectID"/>
<code displayName="Office/Outpatient Visit of an Established Patient requiring (2 of 3) an Expanded History, an Exam and Medical Decision Making of Low Complexity (CPT-4 99213)" code="99213" codeSystemName="CPT-4" codeSystem="2.16.840.1.113883.6.12"/>
<text>
<reference value="#PROCEDURE_4067_7"/>
</text>
<statusCode code="completed"/>
<effectiveTime>
<low value="20100917"/>
<high nullFlavor="UNK"/>
</effectiveTime>
</procedure>
</entry>
<entry typeCode="DRIV">
<procedure classCode="PROC" moodCode="EVN">
<templateId root="2.16.840.1.113883.3.88.11.83.17" assigningAuthorityName="HITSP C83"/>
<templateId root="2.16.840.1.113883.10.20.1.29" assigningAuthorityName="CCD"/>
<templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.19" assigningAuthorityName="IHE PCC"/>
<id root="PROCEDURE_4066_4" extension="CCRObjectID"/>
<code displayName="Office/Outpatient Visit of an Established Patient requiring (2 of 3) a Detailed History, an Exam and Medical Decision Making of Moderate Complexity (CPT-4 99214)" code="99214" codeSystemName="CPT-4" codeSystem="2.16.840.1.113883.6.12"/>
<text>
<reference value="#PROCEDURE_4066_4"/>
</text>
<statusCode code="completed"/>
<effectiveTime>
<low value="20100916"/>
<high nullFlavor="UNK"/>
</effectiveTime>
</procedure>
</entry>
</section>
</component>
<component>
<section>
<templateId root="2.16.840.1.113883.10.20.1.9"/>
<code code="48768-6" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Payment Sources"/>
<title>Payers</title>
<text/>
<entry typeCode="DRIV">
<act classCode="ACT" moodCode="DEF">
<templateId root="2.16.840.1.113883.10.20.1.20"/>
<id root="2.16.840.1.113883.3.543" extension="@@@UUID-PAYER@@@"/>
<code code="48768-6" codeSystem="2.16.840.1.113883.6.1" displayName="Payment sources"/>
<statusCode code="completed"/>
<entryRelationship typeCode="COMP">
<act classCode="ACT" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.26"/>
<templateId root="2.16.840.1.113883.3.249.11.100.7"/>
<id root="dbbb6311-8a4d-11df-a4ee-0800200c9c66"/>
<code code="PUBLICPOL" codeSystem="2.16.840.1.113883.5.4" displayName="Public Healthcare"/>
<statusCode code="completed"/>
<performer typeCode="PRF">
<assignedEntity>
<id root="2.16.840.1.113883.12.86" extension="MC"/>
</assignedEntity>
</performer>
<participant typeCode="COV">
<participantRole>
<id root="2.16.840.1.113883.4.1" extension="@@SSN@@"/>
<code code="SELF" codeSystem="2.16.840.1.113883.5.111" displayName="Self"/>
</participantRole>
</participant>
</act>
</entryRelationship>
</act>
</entry>
</section>
</component>
</section>
</component>
</section>
</component>
</structuredBody>
</component>
</ClinicalDocument>

View File

@ -0,0 +1,330 @@
<?xml version="1.0" encoding="utf-8"?>
<ClinicalDocument xmlns="urn:hl7-org:v3" xmlns:voc="urn:hl7-org:v3/voc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hl7-org:v3 CDA.xsd">
<realmCode code="US"/>
<typeId root="2.16.840.1.113883.1.3" extension="POCD_HD000040"/>
<templateId root="2.16.840.1.113883.10.20.12"/>
<templateId root="2.16.840.1.113883.3.249.11.100.1"/>
<id root="2.16.840.1.113883.3.543" extension="bc1d4d3e-e5e7-11df-8095-df6887f9bf98"/>
<code code="55182-0" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Quality Measure Report"/>
<title>QRDA Incidence Report</title>
<effectiveTime value="20100703"/>
<confidentialityCode codeSystem="2.16.840.1.113883.5.25" code="N"/>
<languageCode code="en-US"/>
<setId root="2.16.840.1.113883.3.543" extension="bc1d4d3e-e5e7-11df-8095-df6887f9bf98"/>
<versionNumber value="1"/>
<recordTarget>
<patientRole>
<id extension="666000669" root="2.16.840.1.113883.4.1"/>
<addr use="H">
<streetAddressLine>Any Street</streetAddressLine>
<city>Any Town</city>
<state/>
<postalCode/>
</addr>
<telecom/>
<patient>
<name>
<given>OUTPATIENT</given>
<family>SIXTYNINE</family>
</name>
<administrativeGenderCode displayName="MALE" code="M" codeSystemName="HL7 AdministrativeGender" codeSystem="2.16.840.1.113883.5.1"/>
<birthTime value="19450309120000"/>
<raceCode code="2076-8" codeSystem="2.16.840.1.113883.5.104"/>
<ethnicGroupCode code="2186-5" codeSystem="2.16.840.1.113883.5.50"/>
</patient>
<providerOrganization>
<!-- NPI for the provider and this is a real number-->
<id root="2.16.840.1.113883.4.6" extension="1558574525" />
<name>WorldVistA Test Clinic</name>
<!--WVV Address of organization is optional except for the STATE-->
<addr>
<state>MD</state>
<postalCode>20877</postalCode>
</addr>
<!--WVP required asOrganizationPartOf added to sample-->
<asOrganizationPartOf>
<wholeOrganization>
<!-- Tax ID is the extension and this is a dummy numbers-->
<id root="2.16.840.1.113883.4.2" extension="226864459"/>
</wholeOrganization>
</asOrganizationPartOf>
</providerOrganization>
</patientRole>
</recordTarget>
<author>
<time value="20100703"/>
<assignedAuthor>
<id root="2.16.840.1.113883.3.249.6" extension="100001"/>
<assignedPerson>
<name>
<given>Nancy</given>
<family>Anthracite</family>
<suffix>MD</suffix>
</name>
</assignedPerson>
<representedOrganization>
<id root="2.16.840.1.113883.3.543" extension="1558574526"/>
<name>WorldVistA Test Clinic</name>
</representedOrganization>
</assignedAuthor>
</author>
<informant>
<assignedEntity>
<id nullFlavor="NA"/>
<representedOrganization>
<id root="2.16.840.1.113883.3.543" extension="1558574526"/>
<name>World VistA Test Clinic</name>
</representedOrganization>
</assignedEntity>
</informant>
<custodian>
<assignedCustodian>
<representedCustodianOrganization>
<id root="2.16.840.1.113883.3.543" extension="1558574526"/>
<name>WorldVistA Test Clinic</name>
</representedCustodianOrganization>
</assignedCustodian>
</custodian>
<legalAuthenticator>
<time value="20100703"/>
<signatureCode code="S"/>
<assignedEntity>
<id root="2.16.840.1.113883.3.543" extension="111111"/>
<assignedPerson>
<name>
<given>Nancy</given>
<family>Anthracite</family>
<suffix>MD</suffix>
</name>
</assignedPerson>
<representedOrganization>
<id root="2.16.840.1.113883.3.543" extension="1558574526"/>
<name>WorldVistA Test Clinic</name>
</representedOrganization>
</assignedEntity>
</legalAuthenticator>
<participant typeCode="PRF">
<functionCode code="PCP" codeSystem="2.16.840.1.113883.5.88"/>
<associatedEntity classCode="PROV">
<id root="2.16.840.1.113883.3.249.6" extension="111111"/>
<associatedPerson>
<name>
<prefix>Dr.</prefix>
<given>Nancy</given>
<family>Anthracite</family>
</name>
</associatedPerson>
</associatedEntity>
</participant>
<documentationOf>
<serviceEvent>
<code displayName="Office/Outpatient Visit of an Established Patient requiring (2 of 3) an Expanded History, an Exam and Medical Decision Making of Low Complexity (CPT-4 99213)" code="99213" codeSystemName="CPT-4" codeSystem="2.16.840.1.113883.6.12"/>
<effectiveTime>
<low value="20100917"/>
<high value="20100917"/>
</effectiveTime>
<performer typeCode="PRF">
<assignedEntity>
<id root="2.16.840.1.113883.4.6" extension="1558574525"/>
<code code="62247001" codeSystem="2.16.840.1.113883.6.69" codeSystemName="SNM CT" displayName="Internal Medician Specialist"/>
<addr>
<streetAddressLine>123 Maple Ave</streetAddressLine>
<city>Gaithersburg</city>
<state>MD</state>
<postalCode>20877</postalCode>
</addr>
<assignedPerson>
<name>
<given>Nancy</given>
<family>Anthracite</family>
<suffix>MD</suffix>
</name>
</assignedPerson>
</assignedEntity>
</performer>
</serviceEvent>
</documentationOf>
<documentationOf>
<serviceEvent>
<code displayName="Office/Outpatient Visit of an Established Patient requiring (2 of 3) a Detailed History, an Exam and Medical Decision Making of Moderate Complexity (CPT-4 99214)" code="99214" codeSystemName="CPT-4" codeSystem="2.16.840.1.113883.6.12"/>
<effectiveTime>
<low value="20100916"/>
<high value="20100916"/>
</effectiveTime>
<performer typeCode="PRF">
<assignedEntity>
<id root="2.16.840.1.113883.4.6" extension="1558574525"/>
<code code="62247001" codeSystem="2.16.840.1.113883.6.69" codeSystemName="SNM CT" displayName="Internal Medician Specialist"/>
<addr>
<streetAddressLine>123 Maple Ave</streetAddressLine>
<city>Gaithersburg</city>
<state>MD</state>
<postalCode>20877</postalCode>
</addr>
<assignedPerson>
<name>
<given>Nancy</given>
<family>Anthracite</family>
<suffix>MD</suffix>
</name>
</assignedPerson>
</assignedEntity>
</performer>
</serviceEvent>
</documentationOf>
<component>
<structuredBody>
<component>
<section>
<templateId root="2.16.840.1.113883.3.249.11.50"/>
<code code="55185-3" codeSystem="2.16.840.1.113883.6.1"/>
<title>Measure set: CMS EHR Measure Set</title>
<text>2010 Measures Set Measures</text>
<component>
<section>
<templateId root="2.16.840.1.113883.3.249.11.2"/>
<code code="55186-1" codeSystem="2.16.840.1.113883.6.1"/>
<title>Measure Section</title>
<text>
<list>
<item>CMS Measure #1: Diabetes Mellitus: Hemoglobin A1c Poor Control in Diabetes Mellitus</item>
</list>
</text>
<entry typeCode="DRIV">
<act classCode="ACT" moodCode="DEF">
<id root="2.16.840.1.113883.3.249.11.2"/>
<code code="PQRI-1" codeSystem="2.16.840.1.113883.3.249.12" displayName="Hemoglobin A1c Poor Control in Diabetes Mellitus"/>
<text>Percentage of patients 18 through 75 years with diabetes mellitus who had most recent hemoglobin A1C greater than 9.0%</text>
<statusCode code="completed"/>
</act>
</entry>
<component>
<section>
<code code="55187-9" codeSystem="2.16.840.1.113883.6.1"/>
<title>Reporting Parameters</title>
<text>
<list>
<item>Reporting Period Jan 1, 2010 to Dec 31, 2010</item>
</list>
</text>
<entry>
<act classCode="ACT" moodCode="EVN">
<code code="252116004" codeSystem="2.16.840.1.113883.6.96" displayName="Observation Parameters"/>
<effectiveTime>
<low value="20100101"/>
<high value="20101231"/>
</effectiveTime>
</act>
</entry>
</section>
</component>
<component>
<section>
<code code="55188-7" codeSystem="2.16.840.1.113883.6.1"/>
<title>Patient Data</title>
</section>
</component>
<component>
<section>
<templateId root="2.16.840.1.113883.3.88.11.83.103" assigningAuthorityName="HITSP/C83"/>
<templateId root="1.3.6.1.4.1.19376.1.5.3.1.3.6" assigningAuthorityName="IHE PCC"/>
<templateId root="2.16.840.1.113883.10.20.1.11" assigningAuthorityName="HL7 CCD"/>
<code code="11450-4" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Problem list"/>
<title>Problems</title>
<text/>
<entry typeCode="DRIV">
<act classCode="ACT" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.27"/>
<id root="PROBLEM1" extension="CCRObjectID"/>
<code nullFlavor="NA"/>
<performer typeCode="PRF">
<assignedEntity>
<id extension="ACTORPROVIDER_10000000183" root="CCRActorID"/>
<addr use="WP">
<streetAddressLine>VA MEDICAL CENTER</streetAddressLine>
<city>ALBANY</city>
<state>NY</state>
<postalCode>12180</postalCode>
</addr>
<telecom/>
<assignedPerson>
<name>
<given>MATTHEW</given>
<given>M</given>
<family>KING</family>
</name>
</assignedPerson>
</assignedEntity>
</performer>
<entryRelationship typeCode="SUBJ">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.28" assigningAuthorityName="CCD"/>
<templateId root="2.16.840.1.113883.3.249.11.100.8"/>
<id root="PROBLEM1" extension="CCRObjectID"/>
<code code="55607006" displayName="Problem" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNM"/>
<statusCode code="completed"/>
<effectiveTime>
<low value="20100916"/>
<high value="20100916"/>
</effectiveTime>
<value xsi:type="CD" displayName="Diabetes Mellitus without mention of Complication, type II or unspecified type," code="250.00" codeSystemName="I9" codeSystem="2.16.840.1.113883.6.103"/>
<entryRelationship typeCode="REFR">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.50"/>
<templateId root="2.16.840.1.113883.3.249.11.100.12"/>
<code code="33999-4" codeSystem="2.16.840.1.113883.6.1" displayName="Status"/>
<statusCode code="completed"/>
<value xsi:type="CE" code="55561003" codeSystem="2.16.840.1.113883.6.96" displayName="Active" codeSystemName="SNM" />
</observation>
</entryRelationship>
</observation>
</entryRelationship>
</act>
</entry>
</section>
</component>
<component>
<section>
<templateId root="2.16.840.1.113883.10.20.1.9"/>
<code code="48768-6" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Payment Sources"/>
<title>Payers</title>
<text/>
<entry typeCode="DRIV">
<act classCode="ACT" moodCode="DEF">
<templateId root="2.16.840.1.113883.10.20.1.20"/>
<id root="2.16.840.1.113883.3.543" extension="bc1d4d3e-e5e7-11df-8095-df6887f9bf98"/>
<code code="48768-6" codeSystem="2.16.840.1.113883.6.1" displayName="Payment sources"/>
<statusCode code="completed"/>
<entryRelationship typeCode="COMP">
<act classCode="ACT" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.26"/>
<templateId root="2.16.840.1.113883.3.249.11.100.7"/>
<id root="dbbb6311-8a4d-11df-a4ee-0800200c9c66"/>
<code code="PUBLICPOL" codeSystem="2.16.840.1.113883.5.4" displayName="Public Healthcare"/>
<statusCode code="completed"/>
<performer typeCode="PRF">
<assignedEntity>
<id root="2.16.840.1.113883.12.86" extension="MC"/>
</assignedEntity>
</performer>
<participant typeCode="COV">
<participantRole>
<id root="2.16.840.1.113883.4.1" extension="666000669"/>
<code code="SELF" codeSystem="2.16.840.1.113883.5.111" displayName="Self"/>
</participantRole>
</participant>
</act>
</entryRelationship>
</act>
</entry>
</section>
</component>
</section>
</component>
</section>
</component>
</structuredBody>
</component>
</ClinicalDocument>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,723 @@
<?xml version="1.0" encoding="utf-8"?>
<ClinicalDocument xmlns="urn:hl7-org:v3" xmlns:voc="urn:hl7-org:v3/voc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hl7-org:v3 CDA.xsd">
<realmCode code="US"/>
<typeId root="2.16.840.1.113883.1.3" extension="POCD_HD000040"/>
<templateId root="2.16.840.1.113883.10.20.12"/>
<templateId root="2.16.840.1.113883.3.249.11.100.1"/>
<id root="2.16.840.1.113883.3.543" extension="c9bec8aa-e5e7-11df-ba06-3b3edcef0468"/>
<code code="55182-0" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Quality Measure Report"/>
<title>QRDA Incidence Report</title>
<effectiveTime value="20100703"/>
<confidentialityCode codeSystem="2.16.840.1.113883.5.25" code="N"/>
<languageCode code="en-US"/>
<setId root="2.16.840.1.113883.3.543" extension="c9bec8aa-e5e7-11df-ba06-3b3edcef0468"/>
<versionNumber value="1"/>
<recordTarget>
<patientRole>
<id extension="002030004" root="2.16.840.1.113883.4.1"/>
<addr use="H">
<streetAddressLine/>
<city/>
<state/>
<postalCode/>
</addr>
<telecom/>
<patient>
<name>
<given>JODY</given>
<given>JEAN</given>
<family>JONES</family>
</name>
<administrativeGenderCode displayName="FEMALE" code="F" codeSystemName="HL7 AdministrativeGender" codeSystem="2.16.840.1.113883.5.1"/>
<birthTime value="19450101120000"/>
<raceCode code="2076-8" codeSystem="2.16.840.1.113883.5.104"/>
<ethnicGroupCode code="2186-5" codeSystem="2.16.840.1.113883.5.50"/>
</patient>
<providerOrganization>
<!-- NPI for the provider and this is a real number-->
<id root="2.16.840.1.113883.4.6" extension="1558574525" />
<name>WorldVistA Test Clinic</name>
<!--WVV Address of organization is optional except for the STATE-->
<addr>
<state>MD</state>
<postalCode>20877</postalCode>
</addr>
<!--WVP required asOrganizationPartOf added to sample-->
<asOrganizationPartOf>
<wholeOrganization>
<!-- Tax ID is the extension and this is a dummy numbers-->
<id root="2.16.840.1.113883.4.2" extension="226864459"/>
</wholeOrganization>
</asOrganizationPartOf>
</providerOrganization>
</patientRole>
</recordTarget>
<author>
<time value="20100703"/>
<assignedAuthor>
<id root="2.16.840.1.113883.3.249.6" extension="100001"/>
<assignedPerson>
<name>
<given>Nancy</given>
<family>Anthracite</family>
<suffix>MD</suffix>
</name>
</assignedPerson>
<representedOrganization>
<id root="2.16.840.1.113883.3.543" extension="1558574526"/>
<name>WorldVistA Test Clinic</name>
</representedOrganization>
</assignedAuthor>
</author>
<informant>
<assignedEntity>
<id nullFlavor="NA"/>
<representedOrganization>
<id root="2.16.840.1.113883.3.543" extension="1558574526"/>
<name>World VistA Test Clinic</name>
</representedOrganization>
</assignedEntity>
</informant>
<custodian>
<assignedCustodian>
<representedCustodianOrganization>
<id root="2.16.840.1.113883.3.543" extension="1558574526"/>
<name>WorldVistA Test Clinic</name>
</representedCustodianOrganization>
</assignedCustodian>
</custodian>
<legalAuthenticator>
<time value="20100703"/>
<signatureCode code="S"/>
<assignedEntity>
<id root="2.16.840.1.113883.3.543" extension="111111"/>
<assignedPerson>
<name>
<given>Nancy</given>
<family>Anthracite</family>
<suffix>MD</suffix>
</name>
</assignedPerson>
<representedOrganization>
<id root="2.16.840.1.113883.3.543" extension="1558574526"/>
<name>WorldVistA Test Clinic</name>
</representedOrganization>
</assignedEntity>
</legalAuthenticator>
<participant typeCode="PRF">
<functionCode code="PCP" codeSystem="2.16.840.1.113883.5.88"/>
<associatedEntity classCode="PROV">
<id root="2.16.840.1.113883.3.249.6" extension="111111"/>
<associatedPerson>
<name>
<prefix>Dr.</prefix>
<given>Nancy</given>
<family>Anthracite</family>
</name>
</associatedPerson>
</associatedEntity>
</participant>
<documentationOf>
<serviceEvent>
<code displayName="EXPANDED, HX &amp; EXAM" code="99202" codeSystemName="CPT-4" codeSystem="2.16.840.1.113883.6.12"/>
<effectiveTime>
<low value="20100828"/>
<high value="20100828"/>
</effectiveTime>
<performer typeCode="PRF">
<assignedEntity>
<id root="2.16.840.1.113883.4.6" extension="1558574525"/>
<code code="62247001" codeSystem="2.16.840.1.113883.6.69" codeSystemName="SNM CT" displayName="Internal Medician Specialist"/>
<addr>
<streetAddressLine>123 Maple Ave</streetAddressLine>
<city>Gaithersburg</city>
<state>MD</state>
<postalCode>20877</postalCode>
</addr>
<assignedPerson>
<name>
<given>Nancy</given>
<family>Anthracite</family>
<suffix>MD</suffix>
</name>
</assignedPerson>
</assignedEntity>
</performer>
</serviceEvent>
</documentationOf>
<documentationOf>
<serviceEvent>
<code displayName="INTERMEDIATE (15min)" code="99213" codeSystemName="CPT-4" codeSystem="2.16.840.1.113883.6.12"/>
<effectiveTime>
<low value="20101017"/>
<high value="20101017"/>
</effectiveTime>
<performer typeCode="PRF">
<assignedEntity>
<id root="2.16.840.1.113883.4.6" extension="1558574525"/>
<code code="62247001" codeSystem="2.16.840.1.113883.6.69" codeSystemName="SNM CT" displayName="Internal Medician Specialist"/>
<addr>
<streetAddressLine>123 Maple Ave</streetAddressLine>
<city>Gaithersburg</city>
<state>MD</state>
<postalCode>20877</postalCode>
</addr>
<assignedPerson>
<name>
<given>Nancy</given>
<family>Anthracite</family>
<suffix>MD</suffix>
</name>
</assignedPerson>
</assignedEntity>
</performer>
</serviceEvent>
</documentationOf>
<documentationOf>
<serviceEvent>
<code displayName="INTERMEDIATE (15min)" code="99213" codeSystemName="CPT-4" codeSystem="2.16.840.1.113883.6.12"/>
<effectiveTime>
<low value="20101006"/>
<high value="20101006"/>
</effectiveTime>
<performer typeCode="PRF">
<assignedEntity>
<id root="2.16.840.1.113883.4.6" extension="1558574525"/>
<code code="62247001" codeSystem="2.16.840.1.113883.6.69" codeSystemName="SNM CT" displayName="Internal Medician Specialist"/>
<addr>
<streetAddressLine>123 Maple Ave</streetAddressLine>
<city>Gaithersburg</city>
<state>MD</state>
<postalCode>20877</postalCode>
</addr>
<assignedPerson>
<name>
<given>Nancy</given>
<family>Anthracite</family>
<suffix>MD</suffix>
</name>
</assignedPerson>
</assignedEntity>
</performer>
</serviceEvent>
</documentationOf>
<documentationOf>
<serviceEvent>
<code displayName="INTERMEDIATE (15min)" code="99213" codeSystemName="CPT-4" codeSystem="2.16.840.1.113883.6.12"/>
<effectiveTime>
<low value="20100904"/>
<high value="20100904"/>
</effectiveTime>
<performer typeCode="PRF">
<assignedEntity>
<id root="2.16.840.1.113883.4.6" extension="1558574525"/>
<code code="62247001" codeSystem="2.16.840.1.113883.6.69" codeSystemName="SNM CT" displayName="Internal Medician Specialist"/>
<addr>
<streetAddressLine>123 Maple Ave</streetAddressLine>
<city>Gaithersburg</city>
<state>MD</state>
<postalCode>20877</postalCode>
</addr>
<assignedPerson>
<name>
<given>Nancy</given>
<family>Anthracite</family>
<suffix>MD</suffix>
</name>
</assignedPerson>
</assignedEntity>
</performer>
</serviceEvent>
</documentationOf>
<documentationOf>
<serviceEvent>
<code displayName="Office/Outpatient Visit of an Established Patient requiring (2 of 3) an Expanded History, an Exam and Medical Decision Making of Low Complexity (CPT-4 99213)" code="99213" codeSystemName="CPT-4" codeSystem="2.16.840.1.113883.6.12"/>
<effectiveTime>
<low value="20100731"/>
<high value="20100731"/>
</effectiveTime>
<performer typeCode="PRF">
<assignedEntity>
<id root="2.16.840.1.113883.4.6" extension="1558574525"/>
<code code="62247001" codeSystem="2.16.840.1.113883.6.69" codeSystemName="SNM CT" displayName="Internal Medician Specialist"/>
<addr>
<streetAddressLine>123 Maple Ave</streetAddressLine>
<city>Gaithersburg</city>
<state>MD</state>
<postalCode>20877</postalCode>
</addr>
<assignedPerson>
<name>
<given>Nancy</given>
<family>Anthracite</family>
<suffix>MD</suffix>
</name>
</assignedPerson>
</assignedEntity>
</performer>
</serviceEvent>
</documentationOf>
<documentationOf>
<serviceEvent>
<code displayName="EXTENDED (25min)" code="99214" codeSystemName="CPT-4" codeSystem="2.16.840.1.113883.6.12"/>
<effectiveTime>
<low value="20101016"/>
<high value="20101016"/>
</effectiveTime>
<performer typeCode="PRF">
<assignedEntity>
<id root="2.16.840.1.113883.4.6" extension="1558574525"/>
<code code="62247001" codeSystem="2.16.840.1.113883.6.69" codeSystemName="SNM CT" displayName="Internal Medician Specialist"/>
<addr>
<streetAddressLine>123 Maple Ave</streetAddressLine>
<city>Gaithersburg</city>
<state>MD</state>
<postalCode>20877</postalCode>
</addr>
<assignedPerson>
<name>
<given>Nancy</given>
<family>Anthracite</family>
<suffix>MD</suffix>
</name>
</assignedPerson>
</assignedEntity>
</performer>
</serviceEvent>
</documentationOf>
<documentationOf>
<serviceEvent>
<code displayName="EXTENDED (25min)" code="99214" codeSystemName="CPT-4" codeSystem="2.16.840.1.113883.6.12"/>
<effectiveTime>
<low value="20101015"/>
<high value="20101015"/>
</effectiveTime>
<performer typeCode="PRF">
<assignedEntity>
<id root="2.16.840.1.113883.4.6" extension="1558574525"/>
<code code="62247001" codeSystem="2.16.840.1.113883.6.69" codeSystemName="SNM CT" displayName="Internal Medician Specialist"/>
<addr>
<streetAddressLine>123 Maple Ave</streetAddressLine>
<city>Gaithersburg</city>
<state>MD</state>
<postalCode>20877</postalCode>
</addr>
<assignedPerson>
<name>
<given>Nancy</given>
<family>Anthracite</family>
<suffix>MD</suffix>
</name>
</assignedPerson>
</assignedEntity>
</performer>
</serviceEvent>
</documentationOf>
<documentationOf>
<serviceEvent>
<code displayName="Office/Outpatient Visit of an Established Patient requiring (2 of 3) a Detailed History, an Exam and Medical Decision Making of Moderate Complexity (CPT-4 99214)" code="99214" codeSystemName="CPT-4" codeSystem="2.16.840.1.113883.6.12"/>
<effectiveTime>
<low value="20100917"/>
<high value="20100917"/>
</effectiveTime>
<performer typeCode="PRF">
<assignedEntity>
<id root="2.16.840.1.113883.4.6" extension="1558574525"/>
<code code="62247001" codeSystem="2.16.840.1.113883.6.69" codeSystemName="SNM CT" displayName="Internal Medician Specialist"/>
<addr>
<streetAddressLine>123 Maple Ave</streetAddressLine>
<city>Gaithersburg</city>
<state>MD</state>
<postalCode>20877</postalCode>
</addr>
<assignedPerson>
<name>
<given>Nancy</given>
<family>Anthracite</family>
<suffix>MD</suffix>
</name>
</assignedPerson>
</assignedEntity>
</performer>
</serviceEvent>
</documentationOf>
<documentationOf>
<serviceEvent>
<code displayName="Office/Outpatient Visit of an Established Patient requiring (2 of 3) a Detailed History, an Exam and Medical Decision Making of Moderate Complexity (CPT-4 99214)" code="99214" codeSystemName="CPT-4" codeSystem="2.16.840.1.113883.6.12"/>
<effectiveTime>
<low value="20100705"/>
<high value="20100705"/>
</effectiveTime>
<performer typeCode="PRF">
<assignedEntity>
<id root="2.16.840.1.113883.4.6" extension="1558574525"/>
<code code="62247001" codeSystem="2.16.840.1.113883.6.69" codeSystemName="SNM CT" displayName="Internal Medician Specialist"/>
<addr>
<streetAddressLine>123 Maple Ave</streetAddressLine>
<city>Gaithersburg</city>
<state>MD</state>
<postalCode>20877</postalCode>
</addr>
<assignedPerson>
<name>
<given>Nancy</given>
<family>Anthracite</family>
<suffix>MD</suffix>
</name>
</assignedPerson>
</assignedEntity>
</performer>
</serviceEvent>
</documentationOf>
<component>
<structuredBody>
<component>
<section>
<templateId root="2.16.840.1.113883.3.249.11.50"/>
<code code="55185-3" codeSystem="2.16.840.1.113883.6.1"/>
<title>Measure set: CMS EHR Measure Set</title>
<text>2010 Measures Set Measures</text>
<component>
<section>
<templateId root="2.16.840.1.113883.3.249.11.2"/>
<code code="55186-1" codeSystem="2.16.840.1.113883.6.1"/>
<title>Measure Section</title>
<text>
<list>
<item>CMS Measure #1: Diabetes Mellitus: Hemoglobin A1c Poor Control in Diabetes Mellitus</item>
</list>
</text>
<entry typeCode="DRIV">
<act classCode="ACT" moodCode="DEF">
<id root="2.16.840.1.113883.3.249.11.2"/>
<code code="PQRI-1" codeSystem="2.16.840.1.113883.3.249.12" displayName="Hemoglobin A1c Poor Control in Diabetes Mellitus"/>
<text>Percentage of patients 18 through 75 years with diabetes mellitus who had most recent hemoglobin A1C greater than 9.0%</text>
<statusCode code="completed"/>
</act>
</entry>
<component>
<section>
<code code="55187-9" codeSystem="2.16.840.1.113883.6.1"/>
<title>Reporting Parameters</title>
<text>
<list>
<item>Reporting Period Jan 1, 2010 to Dec 31, 2010</item>
</list>
</text>
<entry>
<act classCode="ACT" moodCode="EVN">
<code code="252116004" codeSystem="2.16.840.1.113883.6.96" displayName="Observation Parameters"/>
<effectiveTime>
<low value="20100101"/>
<high value="20101231"/>
</effectiveTime>
</act>
</entry>
</section>
</component>
<component>
<section>
<code code="55188-7" codeSystem="2.16.840.1.113883.6.1"/>
<title>Patient Data</title>
</section>
</component>
<component>
<section>
<templateId root="2.16.840.1.113883.3.88.11.83.103" assigningAuthorityName="HITSP/C83"/>
<templateId root="1.3.6.1.4.1.19376.1.5.3.1.3.6" assigningAuthorityName="IHE PCC"/>
<templateId root="2.16.840.1.113883.10.20.1.11" assigningAuthorityName="HL7 CCD"/>
<code code="11450-4" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Problem list"/>
<title>Problems</title>
<text/>
<entry typeCode="DRIV">
<act classCode="ACT" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.27"/>
<id root="PROBLEM1" extension="CCRObjectID"/>
<code nullFlavor="NA"/>
<performer typeCode="PRF">
<assignedEntity>
<id extension="ACTORPROVIDER_10000000183" root="CCRActorID"/>
<addr use="WP">
<streetAddressLine>VA MEDICAL CENTER</streetAddressLine>
<city>ALBANY</city>
<state>NY</state>
<postalCode>12180</postalCode>
</addr>
<telecom/>
<assignedPerson>
<name>
<given>MATTHEW</given>
<given>M</given>
<family>KING</family>
</name>
</assignedPerson>
</assignedEntity>
</performer>
<entryRelationship typeCode="SUBJ">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.28" assigningAuthorityName="CCD"/>
<templateId root="2.16.840.1.113883.3.249.11.100.8"/>
<id root="PROBLEM1" extension="CCRObjectID"/>
<code code="55607006" displayName="Problem" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNM"/>
<statusCode code="completed"/>
<effectiveTime>
<low value="20101016"/>
<high value="20101016"/>
</effectiveTime>
<value xsi:type="CD" displayName="HTN (ICD-9-CM 401.9)" code="401.9" codeSystemName="I9" codeSystem="2.16.840.1.113883.6.103"/>
<entryRelationship typeCode="REFR">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.50"/>
<templateId root="2.16.840.1.113883.3.249.11.100.12"/>
<code code="33999-4" codeSystem="2.16.840.1.113883.6.1" displayName="Status"/>
<statusCode code="completed"/>
<value xsi:type="CE" code="55561003" codeSystem="2.16.840.1.113883.6.96" displayName="Active" codeSystemName="SNM" />
</observation>
</entryRelationship>
</observation>
</entryRelationship>
</act>
</entry>
<entry typeCode="DRIV">
<act classCode="ACT" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.27"/>
<id root="PROBLEM2" extension="CCRObjectID"/>
<code nullFlavor="NA"/>
<performer typeCode="PRF">
<assignedEntity>
<id extension="ACTORPROVIDER_10000000183" root="CCRActorID"/>
<addr use="WP">
<streetAddressLine>VA MEDICAL CENTER</streetAddressLine>
<city>ALBANY</city>
<state>NY</state>
<postalCode>12180</postalCode>
</addr>
<telecom/>
<assignedPerson>
<name>
<given>MATTHEW</given>
<given>M</given>
<family>KING</family>
</name>
</assignedPerson>
</assignedEntity>
</performer>
<entryRelationship typeCode="SUBJ">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.28" assigningAuthorityName="CCD"/>
<templateId root="2.16.840.1.113883.3.249.11.100.8"/>
<id root="PROBLEM2" extension="CCRObjectID"/>
<code code="55607006" displayName="Problem" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNM"/>
<statusCode code="completed"/>
<effectiveTime>
<low value="20101014"/>
<high value="20101014"/>
</effectiveTime>
<value xsi:type="CD" displayName="ANY DEEP VEIN THROMBOSIS" code="453.8" codeSystemName="I9" codeSystem="2.16.840.1.113883.6.103"/>
<entryRelationship typeCode="REFR">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.50"/>
<templateId root="2.16.840.1.113883.3.249.11.100.12"/>
<code code="33999-4" codeSystem="2.16.840.1.113883.6.1" displayName="Status"/>
<statusCode code="completed"/>
<value xsi:type="CE" code="55561003" codeSystem="2.16.840.1.113883.6.96" displayName="Active" codeSystemName="SNM" />
</observation>
</entryRelationship>
</observation>
</entryRelationship>
</act>
</entry>
<entry typeCode="DRIV">
<act classCode="ACT" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.27"/>
<id root="PROBLEM3" extension="CCRObjectID"/>
<code nullFlavor="NA"/>
<performer typeCode="PRF">
<assignedEntity>
<id extension="ACTORPROVIDER_991" root="CCRActorID"/>
<addr use="WP">
<streetAddressLine>VA MEDICAL CENTER</streetAddressLine>
<city>ALBANY</city>
<state>NY</state>
<postalCode>12180</postalCode>
</addr>
<telecom/>
<assignedPerson>
<name>
<prefix>Scholar Extraordinaire</prefix>
<given>EIGHT</given>
<family>PROVIDER</family>
</name>
</assignedPerson>
</assignedEntity>
</performer>
<entryRelationship typeCode="SUBJ">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.28" assigningAuthorityName="CCD"/>
<templateId root="2.16.840.1.113883.3.249.11.100.8"/>
<id root="PROBLEM3" extension="CCRObjectID"/>
<code code="55607006" displayName="Problem" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNM"/>
<statusCode code="completed"/>
<effectiveTime>
<low value="20100904"/>
<high value="20100904"/>
</effectiveTime>
<value xsi:type="CD" displayName="Diabetes Mellitus without mention of Complication, type II or unspecified type," code="250.00" codeSystemName="I9" codeSystem="2.16.840.1.113883.6.103"/>
<entryRelationship typeCode="REFR">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.50"/>
<templateId root="2.16.840.1.113883.3.249.11.100.12"/>
<code code="33999-4" codeSystem="2.16.840.1.113883.6.1" displayName="Status"/>
<statusCode code="completed"/>
<value xsi:type="CE" code="55561003" codeSystem="2.16.840.1.113883.6.96" displayName="Active" codeSystemName="SNM" />
</observation>
</entryRelationship>
</observation>
</entryRelationship>
</act>
</entry>
<entry typeCode="DRIV">
<act classCode="ACT" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.27"/>
<id root="PROBLEM4" extension="CCRObjectID"/>
<code nullFlavor="NA"/>
<performer typeCode="PRF">
<assignedEntity>
<id extension="ACTORPROVIDER_991" root="CCRActorID"/>
<addr use="WP">
<streetAddressLine>VA MEDICAL CENTER</streetAddressLine>
<city>ALBANY</city>
<state>NY</state>
<postalCode>12180</postalCode>
</addr>
<telecom/>
<assignedPerson>
<name>
<prefix>Scholar Extraordinaire</prefix>
<given>EIGHT</given>
<family>PROVIDER</family>
</name>
</assignedPerson>
</assignedEntity>
</performer>
<entryRelationship typeCode="SUBJ">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.28" assigningAuthorityName="CCD"/>
<templateId root="2.16.840.1.113883.3.249.11.100.8"/>
<id root="PROBLEM4" extension="CCRObjectID"/>
<code code="55607006" displayName="Problem" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNM"/>
<statusCode code="completed"/>
<effectiveTime>
<low value="20100705"/>
<high value="20100705"/>
</effectiveTime>
<value xsi:type="CD" displayName="Congestive Heart Failure (ICD-9-CM 428.0)" code="428.0" codeSystemName="I9" codeSystem="2.16.840.1.113883.6.103"/>
<entryRelationship typeCode="REFR">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.50"/>
<templateId root="2.16.840.1.113883.3.249.11.100.12"/>
<code code="33999-4" codeSystem="2.16.840.1.113883.6.1" displayName="Status"/>
<statusCode code="completed"/>
<value xsi:type="CE" code="55561003" codeSystem="2.16.840.1.113883.6.96" displayName="Active" codeSystemName="SNM" />
</observation>
</entryRelationship>
</observation>
</entryRelationship>
</act>
</entry>
<entry typeCode="DRIV">
<act classCode="ACT" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.27"/>
<id root="PROBLEM5" extension="CCRObjectID"/>
<code nullFlavor="NA"/>
<performer typeCode="PRF">
<assignedEntity>
<id extension="ACTORPROVIDER_991" root="CCRActorID"/>
<addr use="WP">
<streetAddressLine>VA MEDICAL CENTER</streetAddressLine>
<city>ALBANY</city>
<state>NY</state>
<postalCode>12180</postalCode>
</addr>
<telecom/>
<assignedPerson>
<name>
<prefix>Scholar Extraordinaire</prefix>
<given>EIGHT</given>
<family>PROVIDER</family>
</name>
</assignedPerson>
</assignedEntity>
</performer>
<entryRelationship typeCode="SUBJ">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.28" assigningAuthorityName="CCD"/>
<templateId root="2.16.840.1.113883.3.249.11.100.8"/>
<id root="PROBLEM5" extension="CCRObjectID"/>
<code code="55607006" displayName="Problem" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNM"/>
<statusCode code="completed"/>
<effectiveTime>
<low value="20100705"/>
<high value="20100705"/>
</effectiveTime>
<value xsi:type="CD" displayName="Postmyocardial infarction syndrome (ICD-9-CM 411.0)" code="411.0" codeSystemName="I9" codeSystem="2.16.840.1.113883.6.103"/>
<entryRelationship typeCode="REFR">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.50"/>
<templateId root="2.16.840.1.113883.3.249.11.100.12"/>
<code code="33999-4" codeSystem="2.16.840.1.113883.6.1" displayName="Status"/>
<statusCode code="completed"/>
<value xsi:type="CE" code="55561003" codeSystem="2.16.840.1.113883.6.96" displayName="Active" codeSystemName="SNM" />
</observation>
</entryRelationship>
</observation>
</entryRelationship>
</act>
</entry>
</section>
</component>
<component>
<section>
<templateId root="2.16.840.1.113883.10.20.1.9"/>
<code code="48768-6" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Payment Sources"/>
<title>Payers</title>
<text/>
<entry typeCode="DRIV">
<act classCode="ACT" moodCode="DEF">
<templateId root="2.16.840.1.113883.10.20.1.20"/>
<id root="2.16.840.1.113883.3.543" extension="c9bec8aa-e5e7-11df-ba06-3b3edcef0468"/>
<code code="48768-6" codeSystem="2.16.840.1.113883.6.1" displayName="Payment sources"/>
<statusCode code="completed"/>
<entryRelationship typeCode="COMP">
<act classCode="ACT" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.26"/>
<templateId root="2.16.840.1.113883.3.249.11.100.7"/>
<id root="dbbb6311-8a4d-11df-a4ee-0800200c9c66"/>
<code code="PUBLICPOL" codeSystem="2.16.840.1.113883.5.4" displayName="Public Healthcare"/>
<statusCode code="completed"/>
<performer typeCode="PRF">
<assignedEntity>
<id root="2.16.840.1.113883.12.86" extension="MC"/>
</assignedEntity>
</performer>
<participant typeCode="COV">
<participantRole>
<id root="2.16.840.1.113883.4.1" extension="002030004"/>
<code code="SELF" codeSystem="2.16.840.1.113883.5.111" displayName="Self"/>
</participantRole>
</participant>
</act>
</entryRelationship>
</act>
</entry>
</section>
</component>
</section>
</component>
</section>
</component>
</structuredBody>
</component>
</ClinicalDocument>

View File

@ -0,0 +1,459 @@
<?xml version="1.0" encoding="utf-8"?>
<ClinicalDocument xmlns="urn:hl7-org:v3" xmlns:voc="urn:hl7-org:v3/voc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hl7-org:v3 CDA.xsd">
<realmCode code="US"/>
<typeId root="2.16.840.1.113883.1.3" extension="POCD_HD000040"/>
<templateId root="2.16.840.1.113883.10.20.12"/>
<templateId root="2.16.840.1.113883.3.249.11.100.1"/>
<id root="2.16.840.1.113883.3.543" extension="@@@UUID-DOC@@@"/>
<code code="55182-0" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Quality Measure Report"/>
<title>QRDA Incidence Report</title>
<effectiveTime value="20100703"/>
<confidentialityCode codeSystem="2.16.840.1.113883.5.25" code="N"/>
<languageCode code="en-US"/>
<setId root="2.16.840.1.113883.3.543" extension="@@@UUID-SET@@@"/>
<versionNumber value="1"/>
<recordTarget>
<patientRole>
<id extension="345982321" root="SSN"/>
<addr use="H">
<streetAddressLine/>
<city/>
<state/>
<postalCode/>
</addr>
<telecom/>
<patient>
<name>
<given>MALE-A</given>
<family>MEASURE-ONE</family>
</name>
<administrativeGenderCode displayName="MALE" code="M" codeSystemName="HL7 AdministrativeGender" codeSystem=""/>
<birthTime value="19600101120000"/>
</patient>
</patientRole>
</recordTarget>
<author>
<time value="20100703"/>
<assignedAuthor>
<id root="2.16.840.1.113883.3.249.6" extension="100001"/>
<assignedPerson>
<name>
<given>Nancy</given>
<family>Anthracite</family>
<suffix>MD</suffix>
</name>
</assignedPerson>
<representedOrganization>
<id root="2.16.840.1.113883.3.543" extension="1558574526"/>
<name>WorldVistA Test Clinic</name>
</representedOrganization>
</assignedAuthor>
</author>
<informant>
<assignedEntity>
<id nullFlavor="NA"/>
<representedOrganization>
<id root="2.16.840.1.113883.3.543" extension="1558574526"/>
<name>World VistA Test Clinic</name>
</representedOrganization>
</assignedEntity>
</informant>
<custodian>
<assignedCustodian>
<representedCustodianOrganization>
<id root="2.16.840.1.113883.3.543" extension="1558574526"/>
<name>WorldVistA Test Clinic</name>
</representedCustodianOrganization>
</assignedCustodian>
</custodian>
<legalAuthenticator>
<time value="20100703"/>
<signatureCode code="S"/>
<assignedEntity>
<id root="2.16.840.1.113883.3.543" extension="111111"/>
<assignedPerson>
<name>
<given>Nancy</given>
<family>Anthracite</family>
<suffix>MD</suffix>
</name>
</assignedPerson>
<representedOrganization>
<id root="2.16.840.1.113883.3.543" extension="1558574526"/>
<name>WorldVistA Test Clinic</name>
</representedOrganization>
</assignedEntity>
</legalAuthenticator>
<participant typeCode="PRF">
<functionCode code="PCP" codeSystem="2.16.840.1.113883.5.88"/>
<associatedEntity classCode="PROV">
<id root="2.16.840.1.113883.3.249.6" extension="111111"/>
<associatedPerson>
<name>
<prefix>Dr.</prefix>
<given>Nancy</given>
<family>Anthracite</family>
</name>
</associatedPerson>
</associatedEntity>
</participant>
<component>
<structuredBody>
<component>
<section>
<templateId root="2.16.840.1.113883.3.249.11.50"/>
<code code="55185-3" codeSystem="2.16.840.1.113883.6.1"/>
<title>Measure set: CMS EHR Measure Set</title>
<text>2010 Measures Set Measures</text>
<component>
<section>
<templateId root="2.16.840.1.113883.3.249.11.2"/>
<code code="55186-1" codeSystem="2.16.840.1.113883.6.1"/>
<title>Measure Section</title>
<text>
<list>
<item>CMS Measure #1: Diabetes Mellitus: Hemoglobin A1c Poor Control in Diabetes Mellitus</item>
</list>
</text>
<entry typeCode="DRIV">
<act classCode="ACT" moodCode="DEF">
<id root="2.16.840.1.113883.3.249.11.2"/>
<code code="PQRI-1" codeSystem="2.16.840.1.113883.3.249.12" displayName="Hemoglobin A1c Poor Control in Diabetes Mellitus"/>
<text>Percentage of patients 18 through 75 years with diabetes mellitus who had most recent hemoglobin A1C greater than 9.0%</text>
<statusCode code="completed"/>
</act>
</entry>
<component>
<section>
<code code="55187-9" codeSystem="2.16.840.1.113883.6.1"/>
<title>Reporting Parameters</title>
<text>
<list>
<item>Reporting Period Jan 1, 2010 to Dec 31, 2010</item>
</list>
</text>
<entry>
<act classCode="ACT" moodCode="EVN">
<code code="252116004" codeSystem="2.16.840.1.113883.6.96" displayName="Observation Parameters"/>
<effectiveTime>
<low value="20100101"/>
<high value="20101231"/>
</effectiveTime>
</act>
</entry>
</section>
</component>
<component>
<section>
<code code="55188-7" codeSystem="2.16.840.1.113883.6.1"/>
<title>Patient Data</title>
</section>
</component>
<component>
<section>
<templateId root="2.16.840.1.113883.3.88.11.83.103" assigningAuthorityName="HITSP/C83"/>
<templateId root="1.3.6.1.4.1.19376.1.5.3.1.3.6" assigningAuthorityName="IHE PCC"/>
<templateId root="2.16.840.1.113883.10.20.1.11" assigningAuthorityName="HL7 CCD"/>
<code code="11450-4" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Problem list"/>
<title>Problems</title>
<text>
<table>
<tbody>
<tr>
<th>Type</th>
<th>Date</th>
<th>Code</th>
<th>Description</th>
<th>Status</th>
<th>Source</th>
</tr>
<tr>
<td>Problem</td>
<td>
<table>
<tbody>
<tr xmlns="">
<td>Oct 14, 2010</td>
</tr>
</tbody>
</table>
</td>
<td>250.00 (ICD9CM)
</td>
<td ID="PROBLEM1">Diabetes (ICD-9-CM 250.00)</td>
<td>Active</td>
<td>NANCY ANTHRACITE </td>
</tr>
<tr>
<td>Problem</td>
<td>
<table>
<tbody>
<tr xmlns="">
<td>Oct 13, 2010</td>
</tr>
</tbody>
</table>
</td>
<td>362.03 (ICD9CM)
</td>
<td ID="PROBLEM2">Nonproliferative Diabetic retinopathy NOS (ICD-9-CM 362.03)</td>
<td>Active</td>
<td>NANCY ANTHRACITE </td>
</tr>
</tbody>
</table>
</text>
<entry typeCode="DRIV">
<act classCode="ACT" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.27"/>
<id root="PROBLEM1" extension="CCRObjectID"/>
<code nullFlavor="NA"/>
<performer typeCode="PRF">
<assignedEntity>
<id extension="ACTORPROVIDER_10000000020" root="CCRActorID"/>
<addr use="WP">
<streetAddressLine>VA MEDICAL CENTER</streetAddressLine>
<city>ALBANY</city>
<state>NY</state>
<postalCode>12180</postalCode>
</addr>
<telecom/>
<assignedPerson>
<name>
<given>NANCY</given>
<family>ANTHRACITE</family>
</name>
</assignedPerson>
</assignedEntity>
</performer>
<entryRelationship typeCode="SUBJ">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.28" assigningAuthorityName="CCD"/>
<templateId root="2.16.840.1.113883.3.249.11.100.8"/>
<id root="PROBLEM1" extension="CCRObjectID"/>
<code code="55607006" displayName="Problem" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED-CT"/>
<statusCode code="completed"/>
<text>
<reference value="#PROBLEM1"/>
</text>
<effectiveTime>
<low value="20101014"/>
<high nullFlavor="UNK"/>
</effectiveTime>
<value displayName="Diabetes (ICD-9-CM 250.00)" code="250.00" codeSystemName="ICD9CM" codeSystem=""/>
<entryRelationship typeCode="REFR">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.50"/>
<code code="33999-4" codeSystem="2.16.840.1.113883.6.1" displayName="Status"/>
<statusCode code="completed"/>
<value>
<originalText>Active</originalText>
</value>
</observation>
</entryRelationship>
</observation>
</entryRelationship>
</act>
</entry>
<entry typeCode="DRIV">
<act classCode="ACT" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.27"/>
<id root="PROBLEM2" extension="CCRObjectID"/>
<code nullFlavor="NA"/>
<performer typeCode="PRF">
<assignedEntity>
<id extension="ACTORPROVIDER_10000000020" root="CCRActorID"/>
<addr use="WP">
<streetAddressLine>VA MEDICAL CENTER</streetAddressLine>
<city>ALBANY</city>
<state>NY</state>
<postalCode>12180</postalCode>
</addr>
<telecom/>
<assignedPerson>
<name>
<given>NANCY</given>
<family>ANTHRACITE</family>
</name>
</assignedPerson>
</assignedEntity>
</performer>
<entryRelationship typeCode="SUBJ">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.28" assigningAuthorityName="CCD"/>
<templateId root="2.16.840.1.113883.3.249.11.100.8"/>
<id root="PROBLEM2" extension="CCRObjectID"/>
<code code="55607006" displayName="Problem" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED-CT"/>
<statusCode code="completed"/>
<text>
<reference value="#PROBLEM2"/>
</text>
<effectiveTime>
<low value="20101013"/>
<high nullFlavor="UNK"/>
</effectiveTime>
<value displayName="Nonproliferative Diabetic retinopathy NOS (ICD-9-CM 362.03)" code="362.03" codeSystemName="ICD9CM" codeSystem=""/>
<entryRelationship typeCode="REFR">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.50"/>
<code code="33999-4" codeSystem="2.16.840.1.113883.6.1" displayName="Status"/>
<statusCode code="completed"/>
<value>
<originalText>Active</originalText>
</value>
</observation>
</entryRelationship>
</observation>
</entryRelationship>
</act>
</entry>
</section>
</component>
<component>
<section>
<templateId root="2.16.840.1.113883.10.20.1.12"/>
<code code="47519-4" codeSystem="2.16.840.1.113883.6.1"/>
<title>Procedures</title>
<text>
<table>
<tbody>
<tr>
<th>Type</th>
<th>Date</th>
<th>Code</th>
<th>Description</th>
<th>Location</th>
<th>Substance</th>
<th>Method</th>
<th>Position</th>
<th>Site</th>
<th>Status</th>
<th>Source</th>
</tr>
<tr id="PROCEDURE_4128_7">
<td/>
<table>
<tbody>
<tr xmlns="">
<td>Procedure Date:
</td>
<td>Oct 14, 2010</td>
</tr>
</tbody>
</table>
<td>99212 (CPT-4)
</td>
<td>LIMITED (10min)</td>
<td/>
<td/>
<td/>
<td/>
<td/>
<td>Completed</td>
<td>NANCY ANTHRACITE </td>
</tr>
<tr id="PROCEDURE_4111_4">
<td/>
<table>
<tbody>
<tr xmlns="">
<td>Procedure Date:
</td>
<td>Oct 13, 2010</td>
</tr>
</tbody>
</table>
<td>99204 (CPT-4)
</td>
<td>COMPREHENSIVE (45min)</td>
<td/>
<td/>
<td/>
<td/>
<td/>
<td>Completed</td>
<td>NANCY ANTHRACITE </td>
</tr>
</tbody>
</table>
</text>
<entry typeCode="DRIV">
<procedure classCode="PROC" moodCode="EVN">
<templateId root="2.16.840.1.113883.3.88.11.83.17" assigningAuthorityName="HITSP C83"/>
<templateId root="2.16.840.1.113883.10.20.1.29" assigningAuthorityName="CCD"/>
<templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.19" assigningAuthorityName="IHE PCC"/>
<id root="PROCEDURE_4128_7" extension="CCRObjectID"/>
<code displayName="LIMITED (10min)" code="99212" codeSystemName="CPT-4" codeSystem="2.16.840.1.113883.6.12"/>
<text>
<reference value="#PROCEDURE_4128_7"/>
</text>
<statusCode code="completed"/>
<effectiveTime>
<low value="20101014"/>
<high nullFlavor="UNK"/>
</effectiveTime>
</procedure>
</entry>
<entry typeCode="DRIV">
<procedure classCode="PROC" moodCode="EVN">
<templateId root="2.16.840.1.113883.3.88.11.83.17" assigningAuthorityName="HITSP C83"/>
<templateId root="2.16.840.1.113883.10.20.1.29" assigningAuthorityName="CCD"/>
<templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.19" assigningAuthorityName="IHE PCC"/>
<id root="PROCEDURE_4111_4" extension="CCRObjectID"/>
<code displayName="COMPREHENSIVE (45min)" code="99204" codeSystemName="CPT-4" codeSystem="2.16.840.1.113883.6.12"/>
<text>
<reference value="#PROCEDURE_4111_4"/>
</text>
<statusCode code="completed"/>
<effectiveTime>
<low value="20101013"/>
<high nullFlavor="UNK"/>
</effectiveTime>
</procedure>
</entry>
</section>
</component>
<component>
<section>
<templateId root="2.16.840.1.113883.10.20.1.9"/>
<code code="48768-6" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Payment Sources"/>
<title>Payers</title>
<text/>
<entry typeCode="DRIV">
<act classCode="ACT" moodCode="DEF">
<templateId root="2.16.840.1.113883.10.20.1.20"/>
<id root="2.16.840.1.113883.3.543" extension="@@@UUID-PAYER@@@"/>
<code code="48768-6" codeSystem="2.16.840.1.113883.6.1" displayName="Payment sources"/>
<statusCode code="completed"/>
<entryRelationship typeCode="COMP">
<act classCode="ACT" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.26"/>
<templateId root="2.16.840.1.113883.3.249.11.100.7"/>
<id root="dbbb6311-8a4d-11df-a4ee-0800200c9c66"/>
<code code="PUBLICPOL" codeSystem="2.16.840.1.113883.5.4" displayName="Public Healthcare"/>
<statusCode code="completed"/>
<performer typeCode="PRF">
<assignedEntity>
<id root="2.16.840.1.113883.12.86" extension="MC"/>
</assignedEntity>
</performer>
<participant typeCode="COV">
<participantRole>
<id root="2.16.840.1.113883.4.1" extension="@@SSN@@"/>
<code code="SELF" codeSystem="2.16.840.1.113883.5.111" displayName="Self"/>
</participantRole>
</participant>
</act>
</entryRelationship>
</act>
</entry>
</section>
</component>
</section>
</component>
</section>
</component>
</structuredBody>
</component>
</ClinicalDocument>

View File

@ -0,0 +1,377 @@
<?xml version="1.0" encoding="utf-8"?>
<ClinicalDocument xmlns="urn:hl7-org:v3" xmlns:voc="urn:hl7-org:v3/voc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hl7-org:v3 CDA.xsd">
<realmCode code="US"/>
<typeId root="2.16.840.1.113883.1.3" extension="POCD_HD000040"/>
<templateId root="2.16.840.1.113883.10.20.12"/>
<templateId root="2.16.840.1.113883.3.249.11.100.1"/>
<id root="2.16.840.1.113883.3.543" extension="d894b664-e5e7-11df-a39b-df28313564e3"/>
<code code="55182-0" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Quality Measure Report"/>
<title>QRDA Incidence Report</title>
<effectiveTime value="20100703"/>
<confidentialityCode codeSystem="2.16.840.1.113883.5.25" code="N"/>
<languageCode code="en-US"/>
<setId root="2.16.840.1.113883.3.543" extension="d894b664-e5e7-11df-a39b-df28313564e3"/>
<versionNumber value="1"/>
<recordTarget>
<patientRole>
<id extension="345982321" root="2.16.840.1.113883.4.1"/>
<addr use="H">
<streetAddressLine/>
<city/>
<state/>
<postalCode/>
</addr>
<telecom/>
<patient>
<name>
<given>MALE-A</given>
<family>MEASURE-ONE</family>
</name>
<administrativeGenderCode displayName="MALE" code="M" codeSystemName="HL7 AdministrativeGender" codeSystem="2.16.840.1.113883.5.1"/>
<birthTime value="19600101120000"/>
<raceCode code="2076-8" codeSystem="2.16.840.1.113883.5.104"/>
<ethnicGroupCode code="2186-5" codeSystem="2.16.840.1.113883.5.50"/>
</patient>
<providerOrganization>
<!-- NPI for the provider and this is a real number-->
<id root="2.16.840.1.113883.4.6" extension="1558574525" />
<name>WorldVistA Test Clinic</name>
<!--WVV Address of organization is optional except for the STATE-->
<addr>
<state>MD</state>
<postalCode>20877</postalCode>
</addr>
<!--WVP required asOrganizationPartOf added to sample-->
<asOrganizationPartOf>
<wholeOrganization>
<!-- Tax ID is the extension and this is a dummy numbers-->
<id root="2.16.840.1.113883.4.2" extension="226864459"/>
</wholeOrganization>
</asOrganizationPartOf>
</providerOrganization>
</patientRole>
</recordTarget>
<author>
<time value="20100703"/>
<assignedAuthor>
<id root="2.16.840.1.113883.3.249.6" extension="100001"/>
<assignedPerson>
<name>
<given>Nancy</given>
<family>Anthracite</family>
<suffix>MD</suffix>
</name>
</assignedPerson>
<representedOrganization>
<id root="2.16.840.1.113883.3.543" extension="1558574526"/>
<name>WorldVistA Test Clinic</name>
</representedOrganization>
</assignedAuthor>
</author>
<informant>
<assignedEntity>
<id nullFlavor="NA"/>
<representedOrganization>
<id root="2.16.840.1.113883.3.543" extension="1558574526"/>
<name>World VistA Test Clinic</name>
</representedOrganization>
</assignedEntity>
</informant>
<custodian>
<assignedCustodian>
<representedCustodianOrganization>
<id root="2.16.840.1.113883.3.543" extension="1558574526"/>
<name>WorldVistA Test Clinic</name>
</representedCustodianOrganization>
</assignedCustodian>
</custodian>
<legalAuthenticator>
<time value="20100703"/>
<signatureCode code="S"/>
<assignedEntity>
<id root="2.16.840.1.113883.3.543" extension="111111"/>
<assignedPerson>
<name>
<given>Nancy</given>
<family>Anthracite</family>
<suffix>MD</suffix>
</name>
</assignedPerson>
<representedOrganization>
<id root="2.16.840.1.113883.3.543" extension="1558574526"/>
<name>WorldVistA Test Clinic</name>
</representedOrganization>
</assignedEntity>
</legalAuthenticator>
<participant typeCode="PRF">
<functionCode code="PCP" codeSystem="2.16.840.1.113883.5.88"/>
<associatedEntity classCode="PROV">
<id root="2.16.840.1.113883.3.249.6" extension="111111"/>
<associatedPerson>
<name>
<prefix>Dr.</prefix>
<given>Nancy</given>
<family>Anthracite</family>
</name>
</associatedPerson>
</associatedEntity>
</participant>
<documentationOf>
<serviceEvent>
<code displayName="COMPREHENSIVE (45min)" code="99204" codeSystemName="CPT-4" codeSystem="2.16.840.1.113883.6.12"/>
<effectiveTime>
<low value="20101013"/>
<high value="20101013"/>
</effectiveTime>
<performer typeCode="PRF">
<assignedEntity>
<id root="2.16.840.1.113883.4.6" extension="1558574525"/>
<code code="62247001" codeSystem="2.16.840.1.113883.6.69" codeSystemName="SNM CT" displayName="Internal Medician Specialist"/>
<addr>
<streetAddressLine>123 Maple Ave</streetAddressLine>
<city>Gaithersburg</city>
<state>MD</state>
<postalCode>20877</postalCode>
</addr>
<assignedPerson>
<name>
<given>Nancy</given>
<family>Anthracite</family>
<suffix>MD</suffix>
</name>
</assignedPerson>
</assignedEntity>
</performer>
</serviceEvent>
</documentationOf>
<documentationOf>
<serviceEvent>
<code displayName="LIMITED (10min)" code="99212" codeSystemName="CPT-4" codeSystem="2.16.840.1.113883.6.12"/>
<effectiveTime>
<low value="20101014"/>
<high value="20101014"/>
</effectiveTime>
<performer typeCode="PRF">
<assignedEntity>
<id root="2.16.840.1.113883.4.6" extension="1558574525"/>
<code code="62247001" codeSystem="2.16.840.1.113883.6.69" codeSystemName="SNM CT" displayName="Internal Medician Specialist"/>
<addr>
<streetAddressLine>123 Maple Ave</streetAddressLine>
<city>Gaithersburg</city>
<state>MD</state>
<postalCode>20877</postalCode>
</addr>
<assignedPerson>
<name>
<given>Nancy</given>
<family>Anthracite</family>
<suffix>MD</suffix>
</name>
</assignedPerson>
</assignedEntity>
</performer>
</serviceEvent>
</documentationOf>
<component>
<structuredBody>
<component>
<section>
<templateId root="2.16.840.1.113883.3.249.11.50"/>
<code code="55185-3" codeSystem="2.16.840.1.113883.6.1"/>
<title>Measure set: CMS EHR Measure Set</title>
<text>2010 Measures Set Measures</text>
<component>
<section>
<templateId root="2.16.840.1.113883.3.249.11.2"/>
<code code="55186-1" codeSystem="2.16.840.1.113883.6.1"/>
<title>Measure Section</title>
<text>
<list>
<item>CMS Measure #1: Diabetes Mellitus: Hemoglobin A1c Poor Control in Diabetes Mellitus</item>
</list>
</text>
<entry typeCode="DRIV">
<act classCode="ACT" moodCode="DEF">
<id root="2.16.840.1.113883.3.249.11.2"/>
<code code="PQRI-1" codeSystem="2.16.840.1.113883.3.249.12" displayName="Hemoglobin A1c Poor Control in Diabetes Mellitus"/>
<text>Percentage of patients 18 through 75 years with diabetes mellitus who had most recent hemoglobin A1C greater than 9.0%</text>
<statusCode code="completed"/>
</act>
</entry>
<component>
<section>
<code code="55187-9" codeSystem="2.16.840.1.113883.6.1"/>
<title>Reporting Parameters</title>
<text>
<list>
<item>Reporting Period Jan 1, 2010 to Dec 31, 2010</item>
</list>
</text>
<entry>
<act classCode="ACT" moodCode="EVN">
<code code="252116004" codeSystem="2.16.840.1.113883.6.96" displayName="Observation Parameters"/>
<effectiveTime>
<low value="20100101"/>
<high value="20101231"/>
</effectiveTime>
</act>
</entry>
</section>
</component>
<component>
<section>
<code code="55188-7" codeSystem="2.16.840.1.113883.6.1"/>
<title>Patient Data</title>
</section>
</component>
<component>
<section>
<templateId root="2.16.840.1.113883.3.88.11.83.103" assigningAuthorityName="HITSP/C83"/>
<templateId root="1.3.6.1.4.1.19376.1.5.3.1.3.6" assigningAuthorityName="IHE PCC"/>
<templateId root="2.16.840.1.113883.10.20.1.11" assigningAuthorityName="HL7 CCD"/>
<code code="11450-4" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Problem list"/>
<title>Problems</title>
<text/>
<entry typeCode="DRIV">
<act classCode="ACT" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.27"/>
<id root="PROBLEM1" extension="CCRObjectID"/>
<code nullFlavor="NA"/>
<performer typeCode="PRF">
<assignedEntity>
<id extension="ACTORPROVIDER_10000000020" root="CCRActorID"/>
<addr use="WP">
<streetAddressLine>VA MEDICAL CENTER</streetAddressLine>
<city>ALBANY</city>
<state>NY</state>
<postalCode>12180</postalCode>
</addr>
<telecom/>
<assignedPerson>
<name>
<given>NANCY</given>
<family>ANTHRACITE</family>
</name>
</assignedPerson>
</assignedEntity>
</performer>
<entryRelationship typeCode="SUBJ">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.28" assigningAuthorityName="CCD"/>
<templateId root="2.16.840.1.113883.3.249.11.100.8"/>
<id root="PROBLEM1" extension="CCRObjectID"/>
<code code="55607006" displayName="Problem" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNM"/>
<statusCode code="completed"/>
<effectiveTime>
<low value="20101014"/>
<high value="20101014"/>
</effectiveTime>
<value xsi:type="CD" displayName="Diabetes (ICD-9-CM 250.00)" code="250.00" codeSystemName="I9" codeSystem="2.16.840.1.113883.6.103"/>
<entryRelationship typeCode="REFR">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.50"/>
<templateId root="2.16.840.1.113883.3.249.11.100.12"/>
<code code="33999-4" codeSystem="2.16.840.1.113883.6.1" displayName="Status"/>
<statusCode code="completed"/>
<value xsi:type="CE" code="55561003" codeSystem="2.16.840.1.113883.6.96" displayName="Active" codeSystemName="SNM" />
</observation>
</entryRelationship>
</observation>
</entryRelationship>
</act>
</entry>
<entry typeCode="DRIV">
<act classCode="ACT" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.27"/>
<id root="PROBLEM2" extension="CCRObjectID"/>
<code nullFlavor="NA"/>
<performer typeCode="PRF">
<assignedEntity>
<id extension="ACTORPROVIDER_10000000020" root="CCRActorID"/>
<addr use="WP">
<streetAddressLine>VA MEDICAL CENTER</streetAddressLine>
<city>ALBANY</city>
<state>NY</state>
<postalCode>12180</postalCode>
</addr>
<telecom/>
<assignedPerson>
<name>
<given>NANCY</given>
<family>ANTHRACITE</family>
</name>
</assignedPerson>
</assignedEntity>
</performer>
<entryRelationship typeCode="SUBJ">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.28" assigningAuthorityName="CCD"/>
<templateId root="2.16.840.1.113883.3.249.11.100.8"/>
<id root="PROBLEM2" extension="CCRObjectID"/>
<code code="55607006" displayName="Problem" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNM"/>
<statusCode code="completed"/>
<effectiveTime>
<low value="20101013"/>
<high value="20101013"/>
</effectiveTime>
<value xsi:type="CD" displayName="Nonproliferative Diabetic retinopathy NOS (ICD-9-CM 362.03)" code="362.03" codeSystemName="I9" codeSystem="2.16.840.1.113883.6.103"/>
<entryRelationship typeCode="REFR">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.50"/>
<templateId root="2.16.840.1.113883.3.249.11.100.12"/>
<code code="33999-4" codeSystem="2.16.840.1.113883.6.1" displayName="Status"/>
<statusCode code="completed"/>
<value xsi:type="CE" code="55561003" codeSystem="2.16.840.1.113883.6.96" displayName="Active" codeSystemName="SNM" />
</observation>
</entryRelationship>
</observation>
</entryRelationship>
</act>
</entry>
</section>
</component>
<component>
<section>
<templateId root="2.16.840.1.113883.10.20.1.9"/>
<code code="48768-6" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Payment Sources"/>
<title>Payers</title>
<text/>
<entry typeCode="DRIV">
<act classCode="ACT" moodCode="DEF">
<templateId root="2.16.840.1.113883.10.20.1.20"/>
<id root="2.16.840.1.113883.3.543" extension="d894b664-e5e7-11df-a39b-df28313564e3"/>
<code code="48768-6" codeSystem="2.16.840.1.113883.6.1" displayName="Payment sources"/>
<statusCode code="completed"/>
<entryRelationship typeCode="COMP">
<act classCode="ACT" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.26"/>
<templateId root="2.16.840.1.113883.3.249.11.100.7"/>
<id root="dbbb6311-8a4d-11df-a4ee-0800200c9c66"/>
<code code="PUBLICPOL" codeSystem="2.16.840.1.113883.5.4" displayName="Public Healthcare"/>
<statusCode code="completed"/>
<performer typeCode="PRF">
<assignedEntity>
<id root="2.16.840.1.113883.12.86" extension="MC"/>
</assignedEntity>
</performer>
<participant typeCode="COV">
<participantRole>
<id root="2.16.840.1.113883.4.1" extension="345982321"/>
<code code="SELF" codeSystem="2.16.840.1.113883.5.111" displayName="Self"/>
</participantRole>
</participant>
</act>
</entryRelationship>
</act>
</entry>
</section>
</component>
</section>
</component>
</section>
</component>
</structuredBody>
</component>
</ClinicalDocument>

Some files were not shown because too many files have changed in this diff Show More