KIDS Distribution saved on Jun 13, 2012@17:53:55 C0Q 1.0 T1 PATCH 1 **KIDS**:C0Q*1.0T1*1^ **INSTALL NAME** C0Q*1.0T1*1 "BLD",7937,0) C0Q*1.0T1*1^QUALITY MEASURES^0^3120613^y "BLD",7937,1,0) ^^90^90^3120613^^ "BLD",7937,1,1,0) ePrescribing MU measure in this package. "BLD",7937,1,2,0) "BLD",7937,1,3,0) Dependencies: "BLD",7937,1,4,0) This build requires C0P*1*4 for the new WebService entry that gets MU "BLD",7937,1,5,0) data from New Crop. "BLD",7937,1,6,0) This build requires the base C0Q 1.0 to be installed. "BLD",7937,1,7,0) "BLD",7937,1,8,0) This build performs the following: "BLD",7937,1,9,0) Routines: "BLD",7937,1,10,0) 1. Adds routine C0QMUERX for calculation of ePrescribing stats. "BLD",7937,1,11,0) 2. Mods routine C0QMU12 to call C0QMUERX for the ERX measure for "BLD",7937,1,12,0) Outpatients. "BLD",7937,1,13,0) 3. Mods routine C0QUPDT to handle the special case of ePrescribing stats. "BLD",7937,1,14,0) Also, some checks and quits so that we won't crash if no patient lists "BLD",7937,1,15,0) are associated with the measure. "BLD",7937,1,16,0) "BLD",7937,1,17,0) Data Dictionary: "BLD",7937,1,18,0) 1. File C0Q PARAMETER has two new indexes: "BLD",7937,1,19,0) AMMS REGULAR "BLD",7937,1,20,0) Field: EP MU MEASUREMENT SET (1130580001.401,2) "BLD",7937,1,21,0) Description: Indexes the IEN of the Measurement Set. Used so that we can "BLD",7937,1,22,0) walk back to a parameter when processing a specific IEN. "BLD",7937,1,23,0) "BLD",7937,1,24,0) You can get the IEN of the measurement set using "BLD",7937,1,25,0) $O(^C0Q(401,"AMMS",MSIEN,"")). "BLD",7937,1,26,0) 1)= S ^C0Q(401,"AMMS",$E(X,1,30),DA)="" "BLD",7937,1,27,0) 2)= K ^C0Q(401,"AMMS",$E(X,1,30),DA) "BLD",7937,1,28,0) 3)= USED BY THE CODE. SEE DESCRIPTION. "BLD",7937,1,29,0) "BLD",7937,1,30,0) AQMS REGULAR "BLD",7937,1,31,0) Field: EP QUALITY MEASUREMENT SET (1130580001.401,2.1) "BLD",7937,1,32,0) Description: Indexes the IEN of the Measurement Set. Used so that we can "BLD",7937,1,33,0) walk back to a parameter when processing a specific IEN. "BLD",7937,1,34,0) "BLD",7937,1,35,0) You can get the IEN of the measurement set using "BLD",7937,1,36,0) $O(^C0Q(401,"AQMS",MSIEN,"")). "BLD",7937,1,37,0) 1)= S ^C0Q(401,"AQMS",$E(X,1,30),DA)="" "BLD",7937,1,38,0) 2)= K ^C0Q(401,"AQMS",$E(X,1,30),DA) "BLD",7937,1,39,0) 3)= USED BY THE CODE. SEE DESCRIPTION. "BLD",7937,1,40,0) "BLD",7937,1,41,0) 2. File C0Q QUALITY MEASURE has a new field, MEASURE TYPE (#4): "BLD",7937,1,42,0) "BLD",7937,1,43,0) 1130580001.101,4MEASURE TYPE 0;5 SET "BLD",7937,1,44,0) "BLD",7937,1,45,0) 'P' FOR Performance; "BLD",7937,1,46,0) 'Q' FOR Quality; "BLD",7937,1,47,0) 'E' FOR Electronic Prescribing Performance; "BLD",7937,1,48,0) LAST EDITED: MAY 30, 2012 "BLD",7937,1,49,0) HELP-PROMPT: Enter a code P, Q or E "BLD",7937,1,50,0) DESCRIPTION: This field designates the measure type. It can "BLD",7937,1,51,0) be P, Q or M. "BLD",7937,1,52,0) "BLD",7937,1,53,0) P is for Performance. Performance measures are "BLD",7937,1,54,0) MU measures to measure how meaningfully used an "BLD",7937,1,55,0) EMR is. An example of a performance measure is "BLD",7937,1,56,0) whether allergies are documented in the EMR. "BLD",7937,1,57,0) Performance measures reference a Patient List "BLD",7937,1,58,0) created by this package. "BLD",7937,1,59,0) "BLD",7937,1,60,0) Q is for Quality Measures. Quality measures are "BLD",7937,1,61,0) MU measures to assess how well the patients are "BLD",7937,1,62,0) cared for. An example of a quality measure is "BLD",7937,1,63,0) whether Hemoglobin A1c Poor Control. Quality "BLD",7937,1,64,0) measures reference Patient Lists in the "BLD",7937,1,65,0) Reminders package. "BLD",7937,1,66,0) "BLD",7937,1,67,0) E is for Electronic Prescribing. This is a "BLD",7937,1,68,0) Performance measure, except that it is handled "BLD",7937,1,69,0) differently than the rest. Instead of the "BLD",7937,1,70,0) numerators and denominators being lists of "BLD",7937,1,71,0) patients as with all the other measurements, "BLD",7937,1,72,0) they are a number of prescriptions. That's why "BLD",7937,1,73,0) we have a special flag for it. It references a "BLD",7937,1,74,0) Patient List created by this package. The "BLD",7937,1,75,0) numerator and denominators are stored in "BLD",7937,1,76,0) subfiles for each patient. "BLD",7937,1,77,0) "BLD",7937,1,78,0) TECHNICAL DESCR: As of version C0P*1.0*1, the software doesn't "BLD",7937,1,79,0) use this field except to check for an "BLD",7937,1,80,0) electronic prescribing type (code E). "BLD",7937,1,81,0) "BLD",7937,1,82,0) I anticipate using this field for other "BLD",7937,1,83,0) purposes in the future. "BLD",7937,1,84,0) "BLD",7937,1,85,0) INPUT TEMPLATE: "BLD",7937,1,86,0) C0Q EDIT MU MEASURE adds the new field MEASURE TYPE mentioned above. "BLD",7937,1,87,0) "BLD",7937,1,88,0) DATA: "BLD",7937,1,89,0) The entry MU EP ERX for processing ePrescribing stats in C0Q QUALITY "BLD",7937,1,90,0) MEASURE is sent to destination sites. "BLD",7937,4,0) ^9.64PA^1130580001.101^2 "BLD",7937,4,1130580001.101,0) 1130580001.101 "BLD",7937,4,1130580001.101,222) y^y^f^^n^^y^o^n "BLD",7937,4,1130580001.101,224) I $P(^(0),U)="MU EP ERX" "BLD",7937,4,1130580001.401,0) 1130580001.401 "BLD",7937,4,1130580001.401,2,0) ^9.641^1130580001.401^1 "BLD",7937,4,1130580001.401,2,1130580001.401,0) C0Q PARAMETER (File-top level) "BLD",7937,4,1130580001.401,2,1130580001.401,1,0) ^9.6411^2.1^2 "BLD",7937,4,1130580001.401,2,1130580001.401,1,2,0) EP MU MEASUREMENT SET "BLD",7937,4,1130580001.401,2,1130580001.401,1,2.1,0) EP QUALITY MEASUREMENT SET "BLD",7937,4,1130580001.401,222) y^n^p^^^^n^^n "BLD",7937,4,1130580001.401,224) "BLD",7937,4,"APDD",1130580001.401,1130580001.401) "BLD",7937,4,"APDD",1130580001.401,1130580001.401,2) "BLD",7937,4,"APDD",1130580001.401,1130580001.401,2.1) "BLD",7937,4,"B",1130580001.101,1130580001.101) "BLD",7937,4,"B",1130580001.401,1130580001.401) "BLD",7937,6.3) 29 "BLD",7937,"ABPKG") n "BLD",7937,"INIT") POST^C0QP1 "BLD",7937,"KRN",0) ^9.67PA^779.2^20 "BLD",7937,"KRN",.4,0) .4 "BLD",7937,"KRN",.4,"NM",0) ^9.68A^^0 "BLD",7937,"KRN",.401,0) .401 "BLD",7937,"KRN",.401,"NM",0) ^9.68A^^ "BLD",7937,"KRN",.402,0) .402 "BLD",7937,"KRN",.402,"NM",0) ^9.68A^1^1 "BLD",7937,"KRN",.402,"NM",1,0) C0Q EDIT MU MEASURE FILE #1130580001.101^1130580001.101^0 "BLD",7937,"KRN",.402,"NM","B","C0Q EDIT MU MEASURE FILE #1130580001.101",1) "BLD",7937,"KRN",.403,0) .403 "BLD",7937,"KRN",.5,0) .5 "BLD",7937,"KRN",.84,0) .84 "BLD",7937,"KRN",3.6,0) 3.6 "BLD",7937,"KRN",3.8,0) 3.8 "BLD",7937,"KRN",9.2,0) 9.2 "BLD",7937,"KRN",9.8,0) 9.8 "BLD",7937,"KRN",9.8,"NM",0) ^9.68A^3^3 "BLD",7937,"KRN",9.8,"NM",1,0) C0QMUERX^^0^B83718518 "BLD",7937,"KRN",9.8,"NM",2,0) C0QUPDT^^0^B79261186 "BLD",7937,"KRN",9.8,"NM",3,0) C0QMU12^^0^B952450497 "BLD",7937,"KRN",9.8,"NM","B","C0QMU12",3) "BLD",7937,"KRN",9.8,"NM","B","C0QMUERX",1) "BLD",7937,"KRN",9.8,"NM","B","C0QUPDT",2) "BLD",7937,"KRN",19,0) 19 "BLD",7937,"KRN",19,"NM",0) ^9.68A^^0 "BLD",7937,"KRN",19.1,0) 19.1 "BLD",7937,"KRN",101,0) 101 "BLD",7937,"KRN",409.61,0) 409.61 "BLD",7937,"KRN",771,0) 771 "BLD",7937,"KRN",779.2,0) 779.2 "BLD",7937,"KRN",870,0) 870 "BLD",7937,"KRN",8989.51,0) 8989.51 "BLD",7937,"KRN",8989.52,0) 8989.52 "BLD",7937,"KRN",8994,0) 8994 "BLD",7937,"KRN","B",.4,.4) "BLD",7937,"KRN","B",.401,.401) "BLD",7937,"KRN","B",.402,.402) "BLD",7937,"KRN","B",.403,.403) "BLD",7937,"KRN","B",.5,.5) "BLD",7937,"KRN","B",.84,.84) "BLD",7937,"KRN","B",3.6,3.6) "BLD",7937,"KRN","B",3.8,3.8) "BLD",7937,"KRN","B",9.2,9.2) "BLD",7937,"KRN","B",9.8,9.8) "BLD",7937,"KRN","B",19,19) "BLD",7937,"KRN","B",19.1,19.1) "BLD",7937,"KRN","B",101,101) "BLD",7937,"KRN","B",409.61,409.61) "BLD",7937,"KRN","B",771,771) "BLD",7937,"KRN","B",779.2,779.2) "BLD",7937,"KRN","B",870,870) "BLD",7937,"KRN","B",8989.51,8989.51) "BLD",7937,"KRN","B",8989.52,8989.52) "BLD",7937,"KRN","B",8994,8994) "BLD",7937,"QDEF") ^^^^NO^^^^NO^^NO "BLD",7937,"QUES",0) ^9.62^^ "BLD",7937,"REQB",0) ^9.611^2^2 "BLD",7937,"REQB",1,0) C0P*1.0*4^2 "BLD",7937,"REQB",2,0) C0Q 1.0^2 "BLD",7937,"REQB","B","C0P*1.0*4",1) "BLD",7937,"REQB","B","C0Q 1.0",2) "DATA",1130580001.101,104,0) MU EP ERX^^^^E "DATA",1130580001.101,104,1) More than 40% of all permissible prescriptions written by the EP are transmitted electronically using certified EHR technology. "DATA",1130580001.101,104,5) Eligibile Prescriptions transmitted electronically "DATA",1130580001.101,104,6,0) ^1130580001.111^6^6^3120613^^ "DATA",1130580001.101,104,6,1,0) Final Rule Text: § 170.304(b). "DATA",1130580001.101,104,6,2,0) Electronic prescribing. Enable a user to electronically generate "DATA",1130580001.101,104,6,3,0) and transmit prescriptions and prescription-related information "DATA",1130580001.101,104,6,4,0) in accordance with: "DATA",1130580001.101,104,6,5,0) (1) The standard specified in § 170.205(b)(1) or § 170.205(b)(2); and "DATA",1130580001.101,104,6,6,0) (2) The standard specified in 170.207(d). "DATA",1130580001.101,104,7) ^^^^^MU12 "FIA",1130580001.101) C0Q QUALITY MEASURE "FIA",1130580001.101,0) ^C0Q(101, "FIA",1130580001.101,0,0) 1130580001.101I "FIA",1130580001.101,0,1) y^y^f^^n^^y^o^n "FIA",1130580001.101,0,10) "FIA",1130580001.101,0,11) I $P(^(0),U)="MU EP ERX" "FIA",1130580001.101,0,"RLRO") "FIA",1130580001.101,0,"VR") 1.0T1^C0Q "FIA",1130580001.101,1130580001.101) 0 "FIA",1130580001.101,1130580001.111) 0 "FIA",1130580001.401) C0Q PARAMETER "FIA",1130580001.401,0) ^C0Q(401, "FIA",1130580001.401,0,0) 1130580001.401 "FIA",1130580001.401,0,1) y^n^p^^^^n^^n "FIA",1130580001.401,0,10) "FIA",1130580001.401,0,11) "FIA",1130580001.401,0,"RLRO") "FIA",1130580001.401,0,"VR") 1.0T1^C0Q "FIA",1130580001.401,1130580001.401) 1 "FIA",1130580001.401,1130580001.401,2) "FIA",1130580001.401,1130580001.401,2.1) "INIT") POST^C0QP1 "IX",1130580001.101,1130580001.101,"MU",0) 1130580001.101^MU^MEANINGFUL USE YEAR KEY^R^^F^IR^I^1130580001.101^^^^^LS "IX",1130580001.101,1130580001.101,"MU",1) S ^C0Q(101,"MU",$E(X,1,30),DA)="" "IX",1130580001.101,1130580001.101,"MU",2) K ^C0Q(101,"MU",$E(X,1,30),DA) "IX",1130580001.101,1130580001.101,"MU",2.5) K ^C0Q(101,"MU") "IX",1130580001.101,1130580001.101,"MU",11.1,0) ^.114IA^1^1 "IX",1130580001.101,1130580001.101,"MU",11.1,1,0) 1^F^1130580001.101^.3^30^1^F "KRN",.402,1746,-1) 0^1 "KRN",.402,1746,0) C0Q EDIT MU MEASURE^3120530.1643^@^1130580001.101^^@^3120613 "KRN",.402,1746,"DR",1,1130580001.101) .01;4;.3;.5;.61;.7;.8;1.1;2.1; "MBREQ") 0 "ORD",7,.402) .402;7;;;EDEOUT^DIFROMSO(.402,DA,"",XPDA);FPRE^DIFROMSI(.402,"",XPDA);EPRE^DIFROMSI(.402,DA,$E("N",$G(XPDNEW)),XPDA,"",OLDA);;EPOST^DIFROMSI(.402,DA,"",XPDA);DEL^DIFROMSK(.402,"",%) "ORD",7,.402,0) INPUT TEMPLATE "PKG",213,-1) 1^1 "PKG",213,0) QUALITY MEASURES^C0Q^Tracks and Prints Quality Measures "PKG",213,20,0) ^9.402P^^ "PKG",213,22,0) ^9.49I^1^1 "PKG",213,22,1,0) 1.0T1 "PKG",213,22,1,"PAH",1,0) 1^3120613 "PKG",213,22,1,"PAH",1,1,0) ^^90^90^3120613 "PKG",213,22,1,"PAH",1,1,1,0) ePrescribing MU measure in this package. "PKG",213,22,1,"PAH",1,1,2,0) "PKG",213,22,1,"PAH",1,1,3,0) Dependencies: "PKG",213,22,1,"PAH",1,1,4,0) This build requires C0P*1*4 for the new WebService entry that gets MU "PKG",213,22,1,"PAH",1,1,5,0) data from New Crop. "PKG",213,22,1,"PAH",1,1,6,0) This build requires the base C0Q 1.0 to be installed. "PKG",213,22,1,"PAH",1,1,7,0) "PKG",213,22,1,"PAH",1,1,8,0) This build performs the following: "PKG",213,22,1,"PAH",1,1,9,0) Routines: "PKG",213,22,1,"PAH",1,1,10,0) 1. Adds routine C0QMUERX for calculation of ePrescribing stats. "PKG",213,22,1,"PAH",1,1,11,0) 2. Mods routine C0QMU12 to call C0QMUERX for the ERX measure for "PKG",213,22,1,"PAH",1,1,12,0) Outpatients. "PKG",213,22,1,"PAH",1,1,13,0) 3. Mods routine C0QUPDT to handle the special case of ePrescribing stats. "PKG",213,22,1,"PAH",1,1,14,0) Also, some checks and quits so that we won't crash if no patient lists "PKG",213,22,1,"PAH",1,1,15,0) are associated with the measure. "PKG",213,22,1,"PAH",1,1,16,0) "PKG",213,22,1,"PAH",1,1,17,0) Data Dictionary: "PKG",213,22,1,"PAH",1,1,18,0) 1. File C0Q PARAMETER has two new indexes: "PKG",213,22,1,"PAH",1,1,19,0) AMMS REGULAR "PKG",213,22,1,"PAH",1,1,20,0) Field: EP MU MEASUREMENT SET (1130580001.401,2) "PKG",213,22,1,"PAH",1,1,21,0) Description: Indexes the IEN of the Measurement Set. Used so that we can "PKG",213,22,1,"PAH",1,1,22,0) walk back to a parameter when processing a specific IEN. "PKG",213,22,1,"PAH",1,1,23,0) "PKG",213,22,1,"PAH",1,1,24,0) You can get the IEN of the measurement set using "PKG",213,22,1,"PAH",1,1,25,0) $O(^C0Q(401,"AMMS",MSIEN,"")). "PKG",213,22,1,"PAH",1,1,26,0) 1)= S ^C0Q(401,"AMMS",$E(X,1,30),DA)="" "PKG",213,22,1,"PAH",1,1,27,0) 2)= K ^C0Q(401,"AMMS",$E(X,1,30),DA) "PKG",213,22,1,"PAH",1,1,28,0) 3)= USED BY THE CODE. SEE DESCRIPTION. "PKG",213,22,1,"PAH",1,1,29,0) "PKG",213,22,1,"PAH",1,1,30,0) AQMS REGULAR "PKG",213,22,1,"PAH",1,1,31,0) Field: EP QUALITY MEASUREMENT SET (1130580001.401,2.1) "PKG",213,22,1,"PAH",1,1,32,0) Description: Indexes the IEN of the Measurement Set. Used so that we can "PKG",213,22,1,"PAH",1,1,33,0) walk back to a parameter when processing a specific IEN. "PKG",213,22,1,"PAH",1,1,34,0) "PKG",213,22,1,"PAH",1,1,35,0) You can get the IEN of the measurement set using "PKG",213,22,1,"PAH",1,1,36,0) $O(^C0Q(401,"AQMS",MSIEN,"")). "PKG",213,22,1,"PAH",1,1,37,0) 1)= S ^C0Q(401,"AQMS",$E(X,1,30),DA)="" "PKG",213,22,1,"PAH",1,1,38,0) 2)= K ^C0Q(401,"AQMS",$E(X,1,30),DA) "PKG",213,22,1,"PAH",1,1,39,0) 3)= USED BY THE CODE. SEE DESCRIPTION. "PKG",213,22,1,"PAH",1,1,40,0) "PKG",213,22,1,"PAH",1,1,41,0) 2. File C0Q QUALITY MEASURE has a new field, MEASURE TYPE (#4): "PKG",213,22,1,"PAH",1,1,42,0) "PKG",213,22,1,"PAH",1,1,43,0) 1130580001.101,4MEASURE TYPE 0;5 SET "PKG",213,22,1,"PAH",1,1,44,0) "PKG",213,22,1,"PAH",1,1,45,0) 'P' FOR Performance; "PKG",213,22,1,"PAH",1,1,46,0) 'Q' FOR Quality; "PKG",213,22,1,"PAH",1,1,47,0) 'E' FOR Electronic Prescribing Performance; "PKG",213,22,1,"PAH",1,1,48,0) LAST EDITED: MAY 30, 2012 "PKG",213,22,1,"PAH",1,1,49,0) HELP-PROMPT: Enter a code P, Q or E "PKG",213,22,1,"PAH",1,1,50,0) DESCRIPTION: This field designates the measure type. It can "PKG",213,22,1,"PAH",1,1,51,0) be P, Q or M. "PKG",213,22,1,"PAH",1,1,52,0) "PKG",213,22,1,"PAH",1,1,53,0) P is for Performance. Performance measures are "PKG",213,22,1,"PAH",1,1,54,0) MU measures to measure how meaningfully used an "PKG",213,22,1,"PAH",1,1,55,0) EMR is. An example of a performance measure is "PKG",213,22,1,"PAH",1,1,56,0) whether allergies are documented in the EMR. "PKG",213,22,1,"PAH",1,1,57,0) Performance measures reference a Patient List "PKG",213,22,1,"PAH",1,1,58,0) created by this package. "PKG",213,22,1,"PAH",1,1,59,0) "PKG",213,22,1,"PAH",1,1,60,0) Q is for Quality Measures. Quality measures are "PKG",213,22,1,"PAH",1,1,61,0) MU measures to assess how well the patients are "PKG",213,22,1,"PAH",1,1,62,0) cared for. An example of a quality measure is "PKG",213,22,1,"PAH",1,1,63,0) whether Hemoglobin A1c Poor Control. Quality "PKG",213,22,1,"PAH",1,1,64,0) measures reference Patient Lists in the "PKG",213,22,1,"PAH",1,1,65,0) Reminders package. "PKG",213,22,1,"PAH",1,1,66,0) "PKG",213,22,1,"PAH",1,1,67,0) E is for Electronic Prescribing. This is a "PKG",213,22,1,"PAH",1,1,68,0) Performance measure, except that it is handled "PKG",213,22,1,"PAH",1,1,69,0) differently than the rest. Instead of the "PKG",213,22,1,"PAH",1,1,70,0) numerators and denominators being lists of "PKG",213,22,1,"PAH",1,1,71,0) patients as with all the other measurements, "PKG",213,22,1,"PAH",1,1,72,0) they are a number of prescriptions. That's why "PKG",213,22,1,"PAH",1,1,73,0) we have a special flag for it. It references a "PKG",213,22,1,"PAH",1,1,74,0) Patient List created by this package. The "PKG",213,22,1,"PAH",1,1,75,0) numerator and denominators are stored in "PKG",213,22,1,"PAH",1,1,76,0) subfiles for each patient. "PKG",213,22,1,"PAH",1,1,77,0) "PKG",213,22,1,"PAH",1,1,78,0) TECHNICAL DESCR: As of version C0P*1.0*1, the software doesn't "PKG",213,22,1,"PAH",1,1,79,0) use this field except to check for an "PKG",213,22,1,"PAH",1,1,80,0) electronic prescribing type (code E). "PKG",213,22,1,"PAH",1,1,81,0) "PKG",213,22,1,"PAH",1,1,82,0) I anticipate using this field for other "PKG",213,22,1,"PAH",1,1,83,0) purposes in the future. "PKG",213,22,1,"PAH",1,1,84,0) "PKG",213,22,1,"PAH",1,1,85,0) INPUT TEMPLATE: "PKG",213,22,1,"PAH",1,1,86,0) C0Q EDIT MU MEASURE adds the new field MEASURE TYPE mentioned above. "PKG",213,22,1,"PAH",1,1,87,0) "PKG",213,22,1,"PAH",1,1,88,0) DATA: "PKG",213,22,1,"PAH",1,1,89,0) The entry MU EP ERX for processing ePrescribing stats in C0Q QUALITY "PKG",213,22,1,"PAH",1,1,90,0) MEASURE is sent to destination sites. "QUES","XPF1",0) Y "QUES","XPF1","??") ^D REP^XPDH "QUES","XPF1","A") Shall I write over your |FLAG| File "QUES","XPF1","B") YES "QUES","XPF1","M") D XPF1^XPDIQ "QUES","XPF2",0) Y "QUES","XPF2","??") ^D DTA^XPDH "QUES","XPF2","A") Want my data |FLAG| yours "QUES","XPF2","B") YES "QUES","XPF2","M") D XPF2^XPDIQ "QUES","XPI1",0) YO "QUES","XPI1","??") ^D INHIBIT^XPDH "QUES","XPI1","A") Want KIDS to INHIBIT LOGONs during the install "QUES","XPI1","B") NO "QUES","XPI1","M") D XPI1^XPDIQ "QUES","XPM1",0) PO^VA(200,:EM "QUES","XPM1","??") ^D MG^XPDH "QUES","XPM1","A") Enter the Coordinator for Mail Group '|FLAG|' "QUES","XPM1","B") "QUES","XPM1","M") D XPM1^XPDIQ "QUES","XPO1",0) Y "QUES","XPO1","??") ^D MENU^XPDH "QUES","XPO1","A") Want KIDS to Rebuild Menu Trees Upon Completion of Install "QUES","XPO1","B") NO "QUES","XPO1","M") D XPO1^XPDIQ "QUES","XPZ1",0) Y "QUES","XPZ1","??") ^D OPT^XPDH "QUES","XPZ1","A") Want to DISABLE Scheduled Options, Menu Options, and Protocols "QUES","XPZ1","B") NO "QUES","XPZ1","M") D XPZ1^XPDIQ "QUES","XPZ2",0) Y "QUES","XPZ2","??") ^D RTN^XPDH "QUES","XPZ2","A") Want to MOVE routines to other CPUs "QUES","XPZ2","B") NO "QUES","XPZ2","M") D XPZ2^XPDIQ "RTN") 4 "RTN","C0QMU12") 0^3^B952450497 "RTN","C0QMU12",1,0) C0QMU12 ;JJOH/ZAG/GPL - Patient Reminder List ; 6/13/12 12:38pm "RTN","C0QMU12",2,0) ;;1.0;C0Q;;May 21, 2012;Build 29 "RTN","C0QMU12",3,0) ; "RTN","C0QMU12",4,0) ;2011 Zach Gonzales - Licensed under the terms of the GNU "RTN","C0QMU12",5,0) ;General Public License See attached copy of the License. "RTN","C0QMU12",6,0) ; "RTN","C0QMU12",7,0) ;This program is free software; you can redistribute it and/or modify "RTN","C0QMU12",8,0) ;it under the terms of the GNU General Public License as published by "RTN","C0QMU12",9,0) ;the Free Software Foundation; either version 2 of the License, or "RTN","C0QMU12",10,0) ;(at your option) any later version. "RTN","C0QMU12",11,0) ; "RTN","C0QMU12",12,0) ;This program is distributed in the hope that it will be useful, "RTN","C0QMU12",13,0) ;but WITHOUT ANY WARRANTY; without even the implied warranty of "RTN","C0QMU12",14,0) ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the "RTN","C0QMU12",15,0) ;GNU General Public License for more details. "RTN","C0QMU12",16,0) ; "RTN","C0QMU12",17,0) ;You should have received a copy of the GNU General Public License along "RTN","C0QMU12",18,0) ;with this program; if not, write to the Free Software Foundation, Inc., "RTN","C0QMU12",19,0) ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. "RTN","C0QMU12",20,0) ; "RTN","C0QMU12",21,0) ; GPL - THIS ROUTINE IS A COPY OF JJOHMU11 THAT HAS BEEN MODIFIED "RTN","C0QMU12",22,0) ; FOR MEANINGFUL USE CALCULATION FOR FISCAL YEAR 2012 AT OROVILLE HOSPITAL "RTN","C0QMU12",23,0) ; "RTN","C0QMU12",24,0) C0QPFN() Q 1130580001.401 ; PARAMETER FILE "RTN","C0QMU12",25,0) C0QPCFN() Q 1130580001.411 ; CLINIC SUBFILE "RTN","C0QMU12",26,0) C0QMFN() Q 1130580001.201 ; FILE NUMBER FOR C0Q MEASUREMENT FILE "RTN","C0QMU12",27,0) C0QMMFN() Q 1130580001.2011 ; FN FOR MEASURE SUBFILE "RTN","C0QMU12",28,0) INIT(ZARY,ZTYP) ; INITIALIZE THE PARAMETERS FOR BUILDING PATIENT LISTS "RTN","C0QMU12",29,0) ; ZARY IS PASSED BY NAME "RTN","C0QMU12",30,0) ; ZTYP IS "INP" OR "EP" "RTN","C0QMU12",31,0) N ZMU S ZMU="MU12" ; THIS IS THE ONLY HARD CODED VALUE LEFT "RTN","C0QMU12",32,0) ; TBD - CHANGE IT TO A READ FROM SYSTEM PARAMETERS "RTN","C0QMU12",33,0) K @ZARY ; CLEAR RETURN ARRAY "RTN","C0QMU12",34,0) N ZIEN,ZCNT,ZX "RTN","C0QMU12",35,0) I $O(^C0Q(401,"MUTYP",ZMU,ZTYP,""))="" D Q ; OOPS NO RECORD THERE "RTN","C0QMU12",36,0) . W !,"ERROR, NO PARAMETERS AVAILABLE" "RTN","C0QMU12",37,0) S ZIEN="" "RTN","C0QMU12",38,0) S ZCNT=0 "RTN","C0QMU12",39,0) F S ZIEN=$O(^C0Q(401,"MUTYP",ZMU,ZTYP,ZIEN)) Q:ZIEN="" D ; "RTN","C0QMU12",40,0) . S ZCNT=ZCNT+1 "RTN","C0QMU12",41,0) . S @ZARY@(ZCNT,"MU")=$$GET1^DIQ($$C0QPFN,ZIEN_",",.02) "RTN","C0QMU12",42,0) . S @ZARY@(ZCNT,"TYPE")=$$GET1^DIQ($$C0QPFN,ZIEN_",",.03) "RTN","C0QMU12",43,0) . S ZX=$$GET1^DIQ($$C0QPFN,ZIEN_",",1,"I") "RTN","C0QMU12",44,0) . S @ZARY@(ZCNT,"InpatientMeasurementSet")=ZX "RTN","C0QMU12",45,0) . S @ZARY@(ZCNT,"InpatientBeginDate")=$$GET1^DIQ($$C0QMFN,ZX_",",.02,"I") "RTN","C0QMU12",46,0) . S @ZARY@(ZCNT,"InpatientEndDate")=$$GET1^DIQ($$C0QMFN,ZX_",",.03,"I") "RTN","C0QMU12",47,0) . S @ZARY@(ZCNT,"InpatientQualitySet")=$$GET1^DIQ($$C0QPFN,ZIEN_",",1.1,"I") "RTN","C0QMU12",48,0) . S ZX=$$GET1^DIQ($$C0QPFN,ZIEN_",",2,"I") "RTN","C0QMU12",49,0) . S @ZARY@(ZCNT,"EPMeasurementSet")=ZX "RTN","C0QMU12",50,0) . S @ZARY@(ZCNT,"EPBeginDate")=$$GET1^DIQ($$C0QMFN,ZX_",",.02,"I") "RTN","C0QMU12",51,0) . S @ZARY@(ZCNT,"EPEndDate")=$$GET1^DIQ($$C0QMFN,ZX_",",.03,"I") "RTN","C0QMU12",52,0) . S @ZARY@(ZCNT,"EPQualitySet")=$$GET1^DIQ($$C0QPFN,ZIEN_",",2.1,"I") "RTN","C0QMU12",53,0) . S @ZARY@(ZCNT,"InpatientQualitySet")=$$GET1^DIQ($$C0QPFN,ZIEN_",",1.1,"I") "RTN","C0QMU12",54,0) . D CLEAN^DILF "RTN","C0QMU12",55,0) . D LIST^DIC($$C0QPCFN,","_ZIEN_",",".01I") "RTN","C0QMU12",56,0) . I $D(^TMP("DIERR",$J)) D Q ; ERROR READING CLINIC LIST "RTN","C0QMU12",57,0) . . W !,"ERROR READING CLINIC PARAMETER LIST" "RTN","C0QMU12",58,0) . M @ZARY@(ZCNT,"CLINICS")=^TMP("DILIST",$J) "RTN","C0QMU12",59,0) ; "RTN","C0QMU12",60,0) Q "RTN","C0QMU12",61,0) ; "RTN","C0QMU12",62,0) BUILD ; CALL ALL AND DIS AND BUILD THE GRSLT ARRAY or print or create "RTN","C0QMU12",63,0) ; patient lists "RTN","C0QMU12",64,0) ;N GRSLT ; ARRAY FOR RESULTS "RTN","C0QMU12",65,0) I '$D(C0QSS) S C0QSS=0 ;default don't build spreadsheet array "RTN","C0QMU12",66,0) I '$D(C0QPR) S C0QPR=0 ;default don't print out results "RTN","C0QMU12",67,0) I '$D(C0QPL) S C0QPL=1 ;default do create patient lists "RTN","C0QMU12",68,0) S ZYR="MU12-" "RTN","C0QMU12",69,0) D INITCLST ; initialize C0QLIST "RTN","C0QMU12",70,0) N G1 ; ONE SET OF VALUES - RNF1 FORMAT "RTN","C0QMU12",71,0) N C0QPARM "RTN","C0QMU12",72,0) D INIT("C0QPARM","INP") ; initialize inpatient parms "RTN","C0QMU12",73,0) I $O(C0QPARM(""))="" D Q ; no parms for inpatient "RTN","C0QMU12",74,0) . W !,"No inpatient parameters" "RTN","C0QMU12",75,0) N ZDIV S ZDIV="" "RTN","C0QMU12",76,0) F S ZDIV=$O(C0QPARM(ZDIV)) Q:ZDIV="" D ; for each inpatient division "RTN","C0QMU12",77,0) . D ALL ; all currently admitted patients in the hospital "RTN","C0QMU12",78,0) . D DIS ; all patients discharged since the reporting period began "RTN","C0QMU12",79,0) . I C0QSS ZWRITE GRSLT "RTN","C0QMU12",80,0) . ;D ICUPAT ; GENERATE ICU PATIENT LIST "RTN","C0QMU12",81,0) . I C0QPL D ; "RTN","C0QMU12",82,0) . . D FILE ; FILE THE PATIENT LISTS "RTN","C0QMU12",83,0) . . D UPDATE^C0QUPDT(.G,C0QPARM(ZDIV,"InpatientMeasurementSet")) ; "RTN","C0QMU12",84,0) . . D UPDATE^C0QUPDT(.G,C0QPARM(ZDIV,"InpatientQualitySet")) ; "RTN","C0QMU12",85,0) . K C0QLIST "RTN","C0QMU12",86,0) Q "RTN","C0QMU12",87,0) ; "RTN","C0QMU12",88,0) INITCLST ; initialize C0QLIST "RTN","C0QMU12",89,0) ; INITIALIZE LISTS "RTN","C0QMU12",90,0) ; this is done so that if there are no matching patients, the patient list "RTN","C0QMU12",91,0) ; will be zeroed out "RTN","C0QMU12",92,0) K C0QLIST "RTN","C0QMU12",93,0) S C0QLIST(ZYR_"HasDemographics")="" "RTN","C0QMU12",94,0) S C0QLIST(ZYR_"Patient")="" "RTN","C0QMU12",95,0) S C0QLIST(ZYR_"HasProblem")="" "RTN","C0QMU12",96,0) S C0QLIST(ZYR_"HasAllergy")="" "RTN","C0QMU12",97,0) S C0QLIST(ZYR_"HasMed")="" "RTN","C0QMU12",98,0) S C0QLIST(ZYR_"HasVitalSigns")="" "RTN","C0QMU12",99,0) S C0QLIST(ZYR_"HasMedOrders")="" "RTN","C0QMU12",100,0) S C0QLIST(ZYR_"HasSmokingStatus")="" "RTN","C0QMU12",101,0) Q "RTN","C0QMU12",102,0) ; "RTN","C0QMU12",103,0) ALL ;retrieve active inpatients "RTN","C0QMU12",104,0) N WARD S WARD="" "RTN","C0QMU12",105,0) F D Q:WARD="" "RTN","C0QMU12",106,0) . S WARD=$O(^DIC(42,"B",WARD)) ;ward name "RTN","C0QMU12",107,0) . Q:WARD="" "RTN","C0QMU12",108,0) . N WIEN S WIEN="" "RTN","C0QMU12",109,0) . F S WIEN=$O(^DIC(42,"B",WARD,WIEN)) Q:'WIEN D ;wards IEN "RTN","C0QMU12",110,0) . . S WARDNAME=$P(^DIC(42,WIEN,0),U,2) ;ward name "RTN","C0QMU12",111,0) . . N DFN,RB S DFN="" "RTN","C0QMU12",112,0) . . F S DFN=$O(^DPT("CN",WARD,+DFN)) Q:'DFN D ;DFN of patient on ward "RTN","C0QMU12",113,0) . . . D DEMO "RTN","C0QMU12",114,0) . . . D PROBLEM "RTN","C0QMU12",115,0) . . . D ALLERGY "RTN","C0QMU12",116,0) . . . D MEDS4 "RTN","C0QMU12",117,0) . . . D RECON2 "RTN","C0QMU12",118,0) . . . D ADVDIR "RTN","C0QMU12",119,0) . . . D SMOKING "RTN","C0QMU12",120,0) . . . D VITALS "RTN","C0QMU12",121,0) . . . D VTE1 "RTN","C0QMU12",122,0) . . . D COD "RTN","C0QMU12",123,0) . . . D EDTIME "RTN","C0QMU12",124,0) . . . I C0QPR D PRINT "RTN","C0QMU12",125,0) . . . I C0QSS D SS "RTN","C0QMU12",126,0) . . . I C0QPL D PATLIST "RTN","C0QMU12",127,0) Q "RTN","C0QMU12",128,0) ; "RTN","C0QMU12",129,0) DEMO ; patient demographics "RTN","C0QMU12",130,0) K PTDOB "RTN","C0QMU12",131,0) N PTNAME,PTSEX,PTHRN,PTRLANG,PTLANG,RACE,RACEDSC,ETHN,ETHNDSC,RB "RTN","C0QMU12",132,0) S PTNAME=$P(^DPT(DFN,0),U) ;patient name "RTN","C0QMU12",133,0) S PTDOB=$$FMTE^XLFDT($P($G(^DPT(DFN,0)),U,3)) ;date of birth "RTN","C0QMU12",134,0) S PTSEX=$P($G(^DPT(DFN,0)),U,2) ;patient sex "RTN","C0QMU12",135,0) D PID^VADPT ;VADPT call to grab PISD based on PT Eligibility "RTN","C0QMU12",136,0) S PTHRN=$P($G(VA("PID")),U) ;health record number "RTN","C0QMU12",137,0) S PTRLANG=$P($G(^DPT(DFN,256000)),U) ;ptr to language file "RTN","C0QMU12",138,0) I $G(PTRLANG)'="" S PTLANG=$P(^DI(.85,PTRLANG,0),U) ;PLS extrnl "RTN","C0QMU12",139,0) S RACE="" "RTN","C0QMU12",140,0) F D Q:RACE="" "RTN","C0QMU12",141,0) . S RACE=$O(^DPT(DFN,.02,"B",RACE)) ;race code IEN "RTN","C0QMU12",142,0) . Q:'RACE "RTN","C0QMU12",143,0) . S RACEDSC=$P($G(^DIC(10,RACE,0)),U) ;race description "RTN","C0QMU12",144,0) S ETHN="" "RTN","C0QMU12",145,0) F D Q:ETHN="" "RTN","C0QMU12",146,0) . S ETHN=$O(^DPT(DFN,.06,"B",ETHN)) ;ethnicity IEN "RTN","C0QMU12",147,0) . Q:'ETHN "RTN","C0QMU12",148,0) . S ETHNDSC=$P($G(^DIC(10.2,ETHN,0)),U) ;ethnincity description "RTN","C0QMU12",149,0) S RB=$P($G(^DPT(DFN,.101)),U) ;room and bed "RTN","C0QMU12",150,0) N DEMOYN S DEMOYN=1 "RTN","C0QMU12",151,0) I $G(PTSEX)="" S DEMOYN=0 "RTN","C0QMU12",152,0) I $G(PTDOB)="" S DEMOYN=0 "RTN","C0QMU12",153,0) I $G(PTHRN)="" S DEMOYN=0 "RTN","C0QMU12",154,0) I $G(PTLANG)="" S DEMOYN=0 "RTN","C0QMU12",155,0) I $G(RACEDSC)="" S DEMOYN=0 "RTN","C0QMU12",156,0) I $G(ETHNDSC)="" S DEMOYN=0 "RTN","C0QMU12",157,0) I DEMOYN S C0QLIST(ZYR_"HasDemographics",DFN)="" "RTN","C0QMU12",158,0) E S C0QLIST(ZYR_"FailedDemographics",DFN)="" "RTN","C0QMU12",159,0) Q "RTN","C0QMU12",160,0) ; "RTN","C0QMU12",161,0) PROBLEM ; PATIENT PROBLEMS "RTN","C0QMU12",162,0) D LIST^ORQQPL(.PROBL,DFN,"A") "RTN","C0QMU12",163,0) S PBCNT="" "RTN","C0QMU12",164,0) F S PBCNT=$O(PROBL(PBCNT)) Q:PBCNT="" D "RTN","C0QMU12",165,0) . S PBDESC=$P(PROBL(PBCNT),U,2) ;problem description "RTN","C0QMU12",166,0) I PBDESC["No problems found" S C0QLIST(ZYR_"NoProblem",DFN)="" "RTN","C0QMU12",167,0) E S C0QLIST(ZYR_"HasProblem",DFN)="" "RTN","C0QMU12",168,0) K PROBL "RTN","C0QMU12",169,0) Q "RTN","C0QMU12",170,0) ; "RTN","C0QMU12",171,0) ALLERGY ; ALLERGY LIST "RTN","C0QMU12",172,0) ; WANT TO CHANGE ALLERGIES FOR 2012 TO POPULATE THE C0QLIST DIRECTLY. GPL "RTN","C0QMU12",173,0) D LIST^ORQQAL(.ALRGYL,DFN) "RTN","C0QMU12",174,0) S ALCNT="" "RTN","C0QMU12",175,0) F S ALCNT=$O(ALRGYL(ALCNT)) Q:ALCNT="" D "RTN","C0QMU12",176,0) . S ALDESC=$P(ALRGYL(ALCNT),U,2) ;allergy description "RTN","C0QMU12",177,0) I ALDESC["No Allergy" S C0QLIST(ZYR_"NoAllergy",DFN)="" "RTN","C0QMU12",178,0) E S C0QLIST(ZYR_"HasAllergy",DFN)="" "RTN","C0QMU12",179,0) K ALRGYL "RTN","C0QMU12",180,0) Q "RTN","C0QMU12",181,0) ; "RTN","C0QMU12",182,0) MEDS4 ; USE OCL^PSOORRL TO GET ALL MEDS "RTN","C0QMU12",183,0) ; DELETED MEDS, MEDS2, AND MEDS3 FOR 2012 TO USE ONLY MEDS4 "RTN","C0QMU12",184,0) N BEG,END "RTN","C0QMU12",185,0) S BEG=$$DT^C0QUTIL("JULY 3,2011") "RTN","C0QMU12",186,0) S END=$$DT^C0QUTIL("NOW") "RTN","C0QMU12",187,0) D OCL^PSOORRL(DFN,BEG,END) ;DBIA #2400 "RTN","C0QMU12",188,0) N C0QMEDS "RTN","C0QMU12",189,0) M C0QMEDS=^TMP("PS",$J) ; MEDS RETURNED FROM CALL "RTN","C0QMU12",190,0) N FOUND "RTN","C0QMU12",191,0) N ZI "RTN","C0QMU12",192,0) I '$D(C0QMEDS(1)) D Q ; QUIT IF NO MEDS "RTN","C0QMU12",193,0) . S C0QLIST(ZYR_"NoMed",DFN)="" "RTN","C0QMU12",194,0) E D ; HAS MEDS "RTN","C0QMU12",195,0) . S C0QLIST(ZYR_"HasMed",DFN)="" "RTN","C0QMU12",196,0) S ZI="" S FOUND=0 "RTN","C0QMU12",197,0) F S ZI=$O(C0QMEDS(ZI)) Q:ZI="" D ; FOR EACH MED "RTN","C0QMU12",198,0) . N ZM "RTN","C0QMU12",199,0) . S ZM=$G(C0QMEDS(ZI,0)) ;THE MEDICATION "RTN","C0QMU12",200,0) . I $P($P(ZM,"^",1),";",2)="I" D ; IE 1U;I FOR AN INPATIENT UNIT DOSE "RTN","C0QMU12",201,0) . . S FOUND=1 "RTN","C0QMU12",202,0) I FOUND S C0QLIST(ZYR_"HasMedOrders",DFN)="" ; MET CPOE MEASURE "RTN","C0QMU12",203,0) E S C0QLIST(ZYR_"NoMedOrders",DFN)="" "RTN","C0QMU12",204,0) Q "RTN","C0QMU12",205,0) ; "RTN","C0QMU12",206,0) RECON ; MEDICATIONS RECONCILIATION "RTN","C0QMU12",207,0) ; WANT TO SIMPLIFY MEDS RECON FOR 2012. GPL "RTN","C0QMU12",208,0) ; "RTN","C0QMU12",209,0) I $$HASNTYN^C0QNOTES("MED/SURG NURSING ADMISSION ASSESSMENT",DFN) D ; "RTN","C0QMU12",210,0) . S C0QLIST(ZYR_"XferOfCare",DFN)="" ; transfer of care patient "RTN","C0QMU12",211,0) N HASRECON S HASRECON=0 "RTN","C0QMU12",212,0) N GT,G "RTN","C0QMU12",213,0) S GT(4,"HasMedRecon","MEDICATION RECONCILIATION COMPLET")="" "RTN","C0QMU12",214,0) S GT(5,"HasMedRecon","Medication Reconcilation Complete")="" "RTN","C0QMU12",215,0) I $$TXTALL^C0QNOTES(.G,.GT,DFN) D ; SEARCH ALL NOTES FOR MED RECON "RTN","C0QMU12",216,0) . S HASRECON=1 "RTN","C0QMU12",217,0) ;N ZT "RTN","C0QMU12",218,0) ;S ZT="MEDICATION RECONCILIATION COMPLET" "RTN","C0QMU12",219,0) ;I $$NTTXT^C0QNOTES("ER NURSE NOTE",ZT,DFN) D ; "RTN","C0QMU12",220,0) ;. S HASRECON=1 "RTN","C0QMU12",221,0) ;E D ; "RTN","C0QMU12",222,0) ;. S ZT="Medication Reconcilation Complete" "RTN","C0QMU12",223,0) ;. I $$NTTXT^C0QNOTES("MED/SURG NURSING ADMISSION ASSESSMENT",ZT,DFN) D ; "RTN","C0QMU12",224,0) ;. . S HASRECON=1 "RTN","C0QMU12",225,0) ;I $$HFYN^C0QHF("MEDS HAVE BEEN REVIEWED",DFN) S HASRECON=1 "RTN","C0QMU12",226,0) I HASRECON D ; "RTN","C0QMU12",227,0) . S C0QLIST(ZYR_"HasMedRecon",DFN)="" "RTN","C0QMU12",228,0) E S C0QLIST(ZYR_"NoMedRecon",DFN)="" "RTN","C0QMU12",229,0) Q "RTN","C0QMU12",230,0) ; "RTN","C0QMU12",231,0) RECON2 ; USE HEALTH FACTORS FOR MEDICATION RECONCILIATION "RTN","C0QMU12",232,0) I $$HASNTYN^C0QNOTES("MED/SURG NURSING ADMISSION ASSESSMENT",DFN) D ; "RTN","C0QMU12",233,0) . S C0QLIST(ZYR_"XferOfCare",DFN)="" ; transfer of care patient "RTN","C0QMU12",234,0) I $$HFYN^C0QHF(DFN,"Medication Reconciliation Completed: Yes") D ; "RTN","C0QMU12",235,0) . S C0QLIST(ZYR_"HasMedRecon",DFN)="" "RTN","C0QMU12",236,0) E S C0QLIST(ZYR_"NoMedRecon",DFN)="" "RTN","C0QMU12",237,0) Q "RTN","C0QMU12",238,0) ; "RTN","C0QMU12",239,0) ERX ; FOR EP, WE LOOK AT ERX MEDS "RTN","C0QMU12",240,0) N ZI S ZI="" "RTN","C0QMU12",241,0) N ZERX S ZERX=$NA(^PS(55,DFN,"NVA")) "RTN","C0QMU12",242,0) F S ZI=$O(@ZERX@(ZI)) Q:ZI="" D ; "RTN","C0QMU12",243,0) . ;B "RTN","C0QMU12",244,0) . I $G(@ZERX@(ZI,1,1,0))["E-Rx Web" D ; "RTN","C0QMU12",245,0) . . S C0QLIST(ZYR_"HasMed",DFN)="" "RTN","C0QMU12",246,0) . . S C0QLIST(ZYR_"HasMedOrders",DFN)="" "RTN","C0QMU12",247,0) . . S C0QLIST(ZYR_"HasERX",DFN)="" "RTN","C0QMU12",248,0) . . S C0QLIST(ZYR_"HasMedRecon",DFN)="" "RTN","C0QMU12",249,0) . E D ; "RTN","C0QMU12",250,0) . . S C0QLIST(ZYR_"NoMed",DFN)="" "RTN","C0QMU12",251,0) . . S C0QLIST(ZYR_"NoMedOrders",DFN)="" "RTN","C0QMU12",252,0) . . S C0QLIST(ZYR_"NoERX",DFN)="" "RTN","C0QMU12",253,0) . . S C0QLIST(ZYR_"NoMedRecon",DFN)="" "RTN","C0QMU12",254,0) Q "RTN","C0QMU12",255,0) ; "RTN","C0QMU12",256,0) ADVDIR ; ADVANCE DIRECTIVE "RTN","C0QMU12",257,0) ; "RTN","C0QMU12",258,0) I $$AGE^C0QUTIL(DFN)>64 D ; ONLY FOR PATIENTS 65 AND OLDER "RTN","C0QMU12",259,0) . S C0QLIST(ZYR_"Over65",DFN)="" "RTN","C0QMU12",260,0) . I $$HASNTYN^C0QNOTES("ADVANCE DIRECTIVE",DFN) D ; "RTN","C0QMU12",261,0) . . S C0QLIST(ZYR_"HasAdvanceDirective",DFN)="" "RTN","C0QMU12",262,0) . E D ; "RTN","C0QMU12",263,0) . . S C0QLIST(ZYR_"NoAdvanceDirective",DFN)="" "RTN","C0QMU12",264,0) Q "RTN","C0QMU12",265,0) ; "RTN","C0QMU12",266,0) SMOKING ; "RTN","C0QMU12",267,0) ; WANT TO CHANGE SMOKING STATUS CHECKING FOR 2012 TO A SIMPLE SET OF "RTN","C0QMU12",268,0) ; HEALTH FACTORS. GPL "RTN","C0QMU12",269,0) I $$INLIST(ZYR_"HasSmokingStatus",DFN) D Q ; ALREADY HAS SMOKING STAT CHECK "RTN","C0QMU12",270,0) . S C0QLIST(ZYR_"HasSmokingStatus",DFN)="" "RTN","C0QMU12",271,0) . S C0QLIST(ZYR_"Over12",DFN)="" "RTN","C0QMU12",272,0) I $$INLIST(ZYR_"NoSmokingStatus",DFN) D Q ; ALREADY HAS SMOKING STATUS CHECK "RTN","C0QMU12",273,0) . S C0QLIST(ZYR_"NoSmokingStatus",DFN)="" "RTN","C0QMU12",274,0) . S C0QLIST(ZYR_"Over12",DFN)="" "RTN","C0QMU12",275,0) N C0QSMOKE,C0QSYN "RTN","C0QMU12",276,0) S C0QSYN=0 "RTN","C0QMU12",277,0) I $$AGE^C0QUTIL(DFN)<13 Q ; DON'T CHECK UNDER AGE 13 "RTN","C0QMU12",278,0) D HFCAT^C0QHF(.C0QSMOKE,DFN,"TOBACCO") ; GET ALL HEALTH FACTORS FOR THE "RTN","C0QMU12",279,0) ; PATIENT IN THE CATEGORY OF TOBACCO "RTN","C0QMU12",280,0) I $D(C0QSMOKE) S C0QSYN=1 "RTN","C0QMU12",281,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smokeless Tobacco <1 Yr Ago") "RTN","C0QMU12",282,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smokeless Tobacco > 20 Yrs Ago") "RTN","C0QMU12",283,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smokeless Tobacco: 1-5 Yrs Ago") "RTN","C0QMU12",284,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smokeless Tobacco: 10-20 Yrs Ago") "RTN","C0QMU12",285,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smokeless Tobacco: 5-10 Yrs Ago") "RTN","C0QMU12",286,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smoking") "RTN","C0QMU12",287,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smoking < 1 Yr Ago") "RTN","C0QMU12",288,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smoking > 20 Yrs Ago") "RTN","C0QMU12",289,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smoking: 1-5 Yrs Ago") "RTN","C0QMU12",290,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smoking: 10-20 Yrs Ago") "RTN","C0QMU12",291,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smoking: 5-10 Yrs Ago") "RTN","C0QMU12",292,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKELESS TOBACCO USER") "RTN","C0QMU12",293,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKELESS: 1-5 YRS AGO") "RTN","C0QMU12",294,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKELESS: 10-20 YRS AGO") "RTN","C0QMU12",295,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKELESS: 5-10 YRS AGO") "RTN","C0QMU12",296,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKELESS: < 1 YR AGO") "RTN","C0QMU12",297,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKELESS: > 20 YRS AGO") "RTN","C0QMU12",298,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER") "RTN","C0QMU12",299,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER 10-20 YRS") "RTN","C0QMU12",300,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER 20+ YRS") "RTN","C0QMU12",301,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER < 1 YR") "RTN","C0QMU12",302,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER < 1 YR AGO") "RTN","C0QMU12",303,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER > 20 YRS AGO") "RTN","C0QMU12",304,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER: 1-5 YRS") "RTN","C0QMU12",305,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER: 1-5 YRS AGO") "RTN","C0QMU12",306,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER: 10-20 YRS AGO") "RTN","C0QMU12",307,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER: 5-10 YRS") "RTN","C0QMU12",308,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER: 5-10 YRS AGO") "RTN","C0QMU12",309,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKELESS TOBACCO USER") "RTN","C0QMU12",310,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"LIFETIME NON-SMOKER") "RTN","C0QMU12",311,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smokeless Tobacco User") "RTN","C0QMU12",312,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker") "RTN","C0QMU12",313,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker (PMH)") "RTN","C0QMU12",314,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoke Exposure/2nd Hand Exposure") "RTN","C0QMU12",315,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 1-5 Yrs") "RTN","C0QMU12",316,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 10-20 Yrs") "RTN","C0QMU12",317,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 5-10 Yrs") "RTN","C0QMU12",318,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For < 1 Yr") "RTN","C0QMU12",319,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For > 20 Yrs") "RTN","C0QMU12",320,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Tobacco User") "RTN","C0QMU12",321,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 1-5 Yrs") "RTN","C0QMU12",322,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 10-20 Yrs") "RTN","C0QMU12",323,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 5-10 Yrs") "RTN","C0QMU12",324,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for < 1 Yr") "RTN","C0QMU12",325,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for > 20 Yrs") "RTN","C0QMU12",326,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoker (HPI)") "RTN","C0QMU12",327,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (FMH)") "RTN","C0QMU12",328,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (PMH)") "RTN","C0QMU12",329,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking Cessation (OPH)") "RTN","C0QMU12",330,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"LIFETIME NON-SMOKER") "RTN","C0QMU12",331,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smokeless Tobacco User") "RTN","C0QMU12",332,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker") "RTN","C0QMU12",333,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker (PMH)") "RTN","C0QMU12",334,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoke Exposure/2nd Hand Exposure") "RTN","C0QMU12",335,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 1-5 Yrs") "RTN","C0QMU12",336,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 10-20 Yrs") "RTN","C0QMU12",337,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 5-10 Yrs") "RTN","C0QMU12",338,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For < 1 Yr") "RTN","C0QMU12",339,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For > 20 Yrs") "RTN","C0QMU12",340,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Tobacco User") "RTN","C0QMU12",341,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 1-5 Yrs") "RTN","C0QMU12",342,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 10-20 Yrs") "RTN","C0QMU12",343,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 5-10 Yrs") "RTN","C0QMU12",344,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for < 1 Yr") "RTN","C0QMU12",345,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for > 20 Yrs") "RTN","C0QMU12",346,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoker (HPI)") "RTN","C0QMU12",347,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (FMH)") "RTN","C0QMU12",348,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (PMH)") "RTN","C0QMU12",349,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Non-Smoker") "RTN","C0QMU12",350,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"LIFETIME NON-SMOKER") "RTN","C0QMU12",351,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smokeless Tobacco User") "RTN","C0QMU12",352,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker") "RTN","C0QMU12",353,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker (PMH)") "RTN","C0QMU12",354,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoke Exposure/2nd Hand Exposure") "RTN","C0QMU12",355,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 1-5 Yrs") "RTN","C0QMU12",356,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 10-20 Yrs") "RTN","C0QMU12",357,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 5-10 Yrs") "RTN","C0QMU12",358,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For < 1 Yr") "RTN","C0QMU12",359,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For > 20 Yrs") "RTN","C0QMU12",360,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Tobacco User") "RTN","C0QMU12",361,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 1-5 Yrs") "RTN","C0QMU12",362,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 10-20 Yrs") "RTN","C0QMU12",363,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 5-10 Yrs") "RTN","C0QMU12",364,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for < 1 Yr") "RTN","C0QMU12",365,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for > 20 Yrs") "RTN","C0QMU12",366,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoker (HPI)") "RTN","C0QMU12",367,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (FMH)") "RTN","C0QMU12",368,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (PMH)") "RTN","C0QMU12",369,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"LIFETIME NON-SMOKER") "RTN","C0QMU12",370,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smokeless Tobacco User") "RTN","C0QMU12",371,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker") "RTN","C0QMU12",372,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker (PMH)") "RTN","C0QMU12",373,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoke Exposure/2nd Hand Exposure") "RTN","C0QMU12",374,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 1-5 Yrs") "RTN","C0QMU12",375,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 10-20 Yrs") "RTN","C0QMU12",376,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 5-10 Yrs") "RTN","C0QMU12",377,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For < 1 Yr") "RTN","C0QMU12",378,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For > 20 Yrs") "RTN","C0QMU12",379,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Tobacco User") "RTN","C0QMU12",380,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 1-5 Yrs") "RTN","C0QMU12",381,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 10-20 Yrs") "RTN","C0QMU12",382,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 5-10 Yrs") "RTN","C0QMU12",383,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for < 1 Yr") "RTN","C0QMU12",384,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for > 20 Yrs") "RTN","C0QMU12",385,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoker (HPI)") "RTN","C0QMU12",386,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (FMH)") "RTN","C0QMU12",387,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (PMH)") "RTN","C0QMU12",388,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Non-Smoker") "RTN","C0QMU12",389,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"LIFETIME NON-SMOKER") "RTN","C0QMU12",390,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smokeless Tobacco User") "RTN","C0QMU12",391,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker") "RTN","C0QMU12",392,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker (PMH)") "RTN","C0QMU12",393,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoke Exposure/2nd Hand Exposure") "RTN","C0QMU12",394,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 1-5 Yrs") "RTN","C0QMU12",395,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 10-20 Yrs") "RTN","C0QMU12",396,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 5-10 Yrs") "RTN","C0QMU12",397,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For < 1 Yr") "RTN","C0QMU12",398,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For > 20 Yrs") "RTN","C0QMU12",399,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Tobacco User") "RTN","C0QMU12",400,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 1-5 Yrs") "RTN","C0QMU12",401,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 10-20 Yrs") "RTN","C0QMU12",402,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 5-10 Yrs") "RTN","C0QMU12",403,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for < 1 Yr") "RTN","C0QMU12",404,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for > 20 Yrs") "RTN","C0QMU12",405,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoker (HPI)") "RTN","C0QMU12",406,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (FMH)") "RTN","C0QMU12",407,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (PMH)") "RTN","C0QMU12",408,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Non-Smoker") "RTN","C0QMU12",409,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Non-Smoker (PMH)") "RTN","C0QMU12",410,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Non-Tobacco User") "RTN","C0QMU12",411,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Current Smoker - No") "RTN","C0QMU12",412,0) S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Current Smoker - Yes") "RTN","C0QMU12",413,0) S C0QLIST(ZYR_"Over12",DFN)="" "RTN","C0QMU12",414,0) ;N GT "RTN","C0QMU12",415,0) ;S GT(1,"HasSmokingStatus","SMOK")="" "RTN","C0QMU12",416,0) ;S GT(2,"HasSmokingStatus","Smok")="" "RTN","C0QMU12",417,0) ;S GT(3,"HasSmokingStatus","smok")="" "RTN","C0QMU12",418,0) ;I 'C0QSYN D ; "RTN","C0QMU12",419,0) ;. N G "RTN","C0QMU12",420,0) ;. S OK=$$TXTALL^C0QNOTES(.G,.GT,DFN) "RTN","C0QMU12",421,0) ;. I $D(G) S C0QSYN=1 "RTN","C0QMU12",422,0) I C0QSYN S C0QLIST(ZYR_"HasSmokingStatus",DFN)="" "RTN","C0QMU12",423,0) E S C0QLIST(ZYR_"NoSmokingStatus",DFN)="" "RTN","C0QMU12",424,0) Q "RTN","C0QMU12",425,0) ; "RTN","C0QMU12",426,0) VITALS ; "RTN","C0QMU12",427,0) ; "RTN","C0QMU12",428,0) N C0QSDT,C0QEDT "RTN","C0QMU12",429,0) D DT^DILF(,"JULY 3,2011",.C0QSDT) ; START DATE "RTN","C0QMU12",430,0) D DT^DILF(,"T",.C0QEDT) ; END DATE TODAY "RTN","C0QMU12",431,0) D VITALS^ORQQVI(.VITRSLT,DFN,C0QSDT,C0QEDT) ; CALL FAST VITALS "RTN","C0QMU12",432,0) I $D(VITRSLT) D ;ZWR VITRSLT B ; "RTN","C0QMU12",433,0) . I VITRSLT(1)["No vitals found." S C0QLIST(ZYR_"NoVitalSigns",DFN)="" "RTN","C0QMU12",434,0) . E S C0QLIST(ZYR_"HasVitalSigns",DFN)="" "RTN","C0QMU12",435,0) Q "RTN","C0QMU12",436,0) ; "RTN","C0QMU12",437,0) VTE1 ; VTE PROPHYLAXIS WITHIN 24HRS OF ARRIVAL "RTN","C0QMU12",438,0) ; "RTN","C0QMU12",439,0) I $$HFYN^C0QHF(DFN,"VTE PROPHYLAXIS WITHIN 24HRS OF ARRIVAL") D ; "RTN","C0QMU12",440,0) . S C0QLIST(ZYR_"HasVTE24",DFN)="" "RTN","C0QMU12",441,0) E S C0QLIST(ZYR_"NoVTE24",DFN)="" "RTN","C0QMU12",442,0) Q "RTN","C0QMU12",443,0) ; "RTN","C0QMU12",444,0) COD ; TEST FOR PRELIMINARY CAUSE OF DEATH NOTE "RTN","C0QMU12",445,0) I $$HASNTYN^C0QNOTES("PRELIMINARY CAUSE OF DEATH",DFN) D ; "RTN","C0QMU12",446,0) . S C0QLIST(ZYR_"CauseOfDeath",DFN)="" "RTN","C0QMU12",447,0) Q "RTN","C0QMU12",448,0) ; "RTN","C0QMU12",449,0) EDTIME ; CHECK FOR EMERGENCY DEPT TIME FACTORS "RTN","C0QMU12",450,0) N FOUND "RTN","C0QMU12",451,0) S FOUND=0 "RTN","C0QMU12",452,0) I $$HFYN^C0QHF(DFN,"ED ARRIVAL TIME") S FOUND=1 "RTN","C0QMU12",453,0) I '$$HFYN^C0QHF(DFN,"ED DEPARTURE TIME") S FOUND=0 "RTN","C0QMU12",454,0) I '$$HFYN^C0QHF(DFN,"TIME DECISION TO ADMIT MADE") S FOUND=0 "RTN","C0QMU12",455,0) I FOUND D ; "RTN","C0QMU12",456,0) . S C0QLIST(ZYR_"HasEDtime",DFN)="" "RTN","C0QMU12",457,0) E S C0QLIST(ZYR_"NoEDtime",DFN)="" "RTN","C0QMU12",458,0) Q "RTN","C0QMU12",459,0) ; "RTN","C0QMU12",460,0) ICUPAT ; CREATE LIST OF ICU PATIENTS "RTN","C0QMU12",461,0) N ZICU "RTN","C0QMU12",462,0) S ZICU=$O(^SC("B","IC","")) ; IEN OF ICU HOSPITAL LOCATION "RTN","C0QMU12",463,0) N ZI,ZJ,ZP "RTN","C0QMU12",464,0) S ZI="" "RTN","C0QMU12",465,0) F S ZI=$O(^AUPNVSIT("AHL",ZICU,ZI)) Q:ZI="" D ; EACH DATE "RTN","C0QMU12",466,0) . S ZJ="" "RTN","C0QMU12",467,0) . F S ZJ=$O(^AUPNVSIT("AHL",ZICU,ZI,ZJ)) Q:ZJ="" D ; EACH VISIT "RTN","C0QMU12",468,0) . . S ZP=$P(^AUPNVSIT(ZJ,0),"^",5) ; DFN "RTN","C0QMU12",469,0) . . S C0QLIST(ZYR_"ICUPatient",ZP)="" "RTN","C0QMU12",470,0) Q "RTN","C0QMU12",471,0) ; "RTN","C0QMU12",472,0) FILTER ; CALLED AFTER ALL THE PATIENT LISTS HAVE BEEN FILED "RTN","C0QMU12",473,0) ; WILL KILL C0QLIST AND CREATE DERIVATIVE PATIENT LISTS BY FILTERING "RTN","C0QMU12",474,0) K C0QLIST "RTN","C0QMU12",475,0) N ZPAT "RTN","C0QMU12",476,0) S ZPAT=$$PATLN(ZYR_"Patient") ; name of patient list of all patients admitted "RTN","C0QMU12",477,0) ; during the reporting period. used to filter other lists "RTN","C0QMU12",478,0) ; "RTN","C0QMU12",479,0) ; filter ICU patients against ZPAT "RTN","C0QMU12",480,0) N GN,GO,GF "RTN","C0QMU12",481,0) S GN=ZPAT "RTN","C0QMU12",482,0) S GO=$$PATLN(ZYR_"ICUPatient") ; all ICU patient "RTN","C0QMU12",483,0) S GF=$NA(C0QLIST(ZYR_"ICUReporting")) ; the filtered list destination "RTN","C0QMU12",484,0) D AND^C0QSET(GF,GN,GO) ; filter the list with the AND set operation "RTN","C0QMU12",485,0) ; "RTN","C0QMU12",486,0) ; FILTER VTE-2 DENOMINATOR FOR QUALITY MEASURE "RTN","C0QMU12",487,0) ; "RTN","C0QMU12",488,0) S GN=$NA(C0QLIST(ZYR_"ICUReporting")) ; ICU patients admitted inside rpt period "RTN","C0QMU12",489,0) S GO=$$RPATLN("MU VTE-2 DENOM PL") ; TAXONOMY BASED DENOMENATOR "RTN","C0QMU12",490,0) S GF=$NA(C0QLIST(ZYR_"VTE2DEN")) ; NEW DENOMINATOR PL "RTN","C0QMU12",491,0) D AND^C0QSET(GF,GN,GO) ; filter the list with the AND set operation "RTN","C0QMU12",492,0) ; "RTN","C0QMU12",493,0) S GN=ZPAT "RTN","C0QMU12",494,0) S GO=$$RPATLN("MU VTE-3 DENOM PL") ; TAXONOMY BASED DENOMENATOR "RTN","C0QMU12",495,0) S GF=$NA(C0QLIST(ZYR_"VTE3DEN")) ; NEW DENOMINATOR PL "RTN","C0QMU12",496,0) D AND^C0QSET(GF,GN,GO) ; filter the list with the AND set operation "RTN","C0QMU12",497,0) ; "RTN","C0QMU12",498,0) S GN=ZPAT "RTN","C0QMU12",499,0) S GO=$$RPATLN("MU VTE-4 DENOM PL") ; TAXONOMY BASED DENOMENATOR "RTN","C0QMU12",500,0) S GF=$NA(C0QLIST(ZYR_"VTE4DEN")) ; NEW DENOMINATOR PL "RTN","C0QMU12",501,0) D AND^C0QSET(GF,GN,GO) ; filter the list with the AND set operation "RTN","C0QMU12",502,0) ; "RTN","C0QMU12",503,0) S GN=ZPAT "RTN","C0QMU12",504,0) S GO=$$RPATLN("MU VTE-5 DENOM PL") ; TAXONOMY BASED DENOMENATOR "RTN","C0QMU12",505,0) S GF=$NA(C0QLIST(ZYR_"VTE5DEN")) ; NEW DENOMINATOR PL "RTN","C0QMU12",506,0) D AND^C0QSET(GF,GN,GO) ; filter the list with the AND set operation "RTN","C0QMU12",507,0) ; "RTN","C0QMU12",508,0) D FILE ; FILE ALL THE PATIENT LISTS "RTN","C0QMU12",509,0) D UPDATE^C0QUPDT(.G,5) ; UPDATE THE HOS 2011 MEANINGFUL USE measure set "RTN","C0QMU12",510,0) Q "RTN","C0QMU12",511,0) ; "RTN","C0QMU12",512,0) ED1 ; "RTN","C0QMU12",513,0) S ZYR="MU12-" "RTN","C0QMU12",514,0) D DOTIME("ED DEPARTURE TIME") "RTN","C0QMU12",515,0) Q "RTN","C0QMU12",516,0) ; "RTN","C0QMU12",517,0) ED2 ; "RTN","C0QMU12",518,0) S ZYR="MU12-" "RTN","C0QMU12",519,0) D DOTIME2("TIME DECISION TO ADMIT MADE") "RTN","C0QMU12",520,0) Q "RTN","C0QMU12",521,0) ; "RTN","C0QMU12",522,0) DOTIME(ZHF) ; COMPUTE THE MEAN TIME IN THE ED FROM ARRIVAL TO DEPARTURE "RTN","C0QMU12",523,0) ; THIS IS A QUALITY MEASURE ED-1 FOR MEANINGFUL USE "RTN","C0QMU12",524,0) ; IT PRINTS A REPORT OF EACH PATIENT WITH THE ED TIMES RECORDED "RTN","C0QMU12",525,0) ; AND THEIR TIME. AT THE END IT PRINTS THE MEAN TIME "RTN","C0QMU12",526,0) N ZP "RTN","C0QMU12",527,0) S ZP=$$PATLN(ZYR_"HasEDtime") ; patient list name for patients to process "RTN","C0QMU12",528,0) S ZHFN=9000010.23 ; FILE NUMBER FOR V HEALTH FACTORS "RTN","C0QMU12",529,0) S ZVFN=9000010 ; VISIT FILE NUMBER "RTN","C0QMU12",530,0) K ZARY1,ZARY2 "RTN","C0QMU12",531,0) N ZI S ZI="" "RTN","C0QMU12",532,0) S COUNT=0 "RTN","C0QMU12",533,0) F S ZI=$O(@ZP@(ZI)) Q:ZI="" D ; FOR EACH PATIENT "RTN","C0QMU12",534,0) . S COUNT=COUNT+1 "RTN","C0QMU12",535,0) . N ZA,ZD "RTN","C0QMU12",536,0) . S ZA=$$VHFIEN^C0QHF(ZI,"ED ARRIVAL TIME") ; IEN OF ARRIVAL HEALTH FACTOR "RTN","C0QMU12",537,0) . S ZD=$$VHFIEN^C0QHF(ZI,ZHF) ; IEN OF DEPART HEALTH FACTOR "RTN","C0QMU12",538,0) . N ZAD,ZDD ; ARRIVAL DATE, DEPARTURE DATE "RTN","C0QMU12",539,0) . N ZAC,ZDC ; ARRIVAL COMMENT, DEPARTURE COMMENT "RTN","C0QMU12",540,0) . ; THE COMMENT IS THE TIME XXYY "RTN","C0QMU12",541,0) . N OK,TMP "RTN","C0QMU12",542,0) . S TMP=$$GET1^DIQ(ZHFN,ZA_",",.03,"I") ; VISIT POINTER "RTN","C0QMU12",543,0) . S ZAD=$$GET1^DIQ(ZVFN,TMP_",",.01,"I") ; VISIT DATE "RTN","C0QMU12",544,0) . ;S ZAD=$P(^AUPNVHF(ZA,0),U,3) ; DATE IS PIECE 3 "RTN","C0QMU12",545,0) . S TMP=$$GET1^DIQ(ZHFN,ZD_",",.03,"I") ; VISIT POINTER "RTN","C0QMU12",546,0) . S ZDD=$$GET1^DIQ(ZVFN,TMP_",",.01,"I") ; VISIT DATE "RTN","C0QMU12",547,0) . ;S ZDD=$$GET1^DIQ(ZHFN,ZD_",",1201,"I") ; EVENT DATE FIELD "RTN","C0QMU12",548,0) . ;S ZDD=$P(^AUPNVHF(ZD,0),U,3) ; DATE IS PIECE 3 "RTN","C0QMU12",549,0) . ;S OK=$$GET1^DIQ(ZHFN,ZA_",",81101,"","ZAC") ; ARRIVAL TIME "RTN","C0QMU12",550,0) . S ZAC=$G(^AUPNVHF(ZA,811)) ; THE TIME "RTN","C0QMU12",551,0) . ;S OK=$$GET1^DIQ(ZHFN,ZD_",",81101,"","ZDC") ; DEPARTURE TIME "RTN","C0QMU12",552,0) . S ZDC=$G(^AUPNVHF(ZD,811)) ; DEPARTURE TIME "RTN","C0QMU12",553,0) . N ZT ; THE TIME DIFFERENCE BETWEEN THE DATES "RTN","C0QMU12",554,0) . W !,!,"PATIENT: ",ZI," ",$P(^DPT(ZI,0),U,1) "RTN","C0QMU12",555,0) . W !,"IN: ",$$FMTE^XLFDT(ZAD_"."_ZAC)," OUT: ",$$FMTE^XLFDT(ZDD_"."_ZDC) "RTN","C0QMU12",556,0) . S G1=($E(ZDC,1,2)*60)+($E(ZDC,3,4)) "RTN","C0QMU12",557,0) . S G2=($E(ZAC,1,2)*60)+($E(ZAC,3,4)) "RTN","C0QMU12",558,0) . I (ZDD-ZAD)>0 S G1=G1+(((ZDD-ZAD)*24)*60) "RTN","C0QMU12",559,0) . S GTOT=G1-G2 "RTN","C0QMU12",560,0) . W !,"TIME: ",GTOT," ESTIMATED" "RTN","C0QMU12",561,0) . S ZT=$$DTDIFF^C0QUTIL(ZDD,ZDC,ZAD,ZAC) ; COMPUTE THE DIFFERENCE IN MINUTES "RTN","C0QMU12",562,0) . W !,"COMPUTED MINUTES: ",ZT "RTN","C0QMU12",563,0) . ;I ZT'=GTOT B ; LET'S FIND OUT WHAT'S WRONG "RTN","C0QMU12",564,0) . I ZT<0 D Q ; SKIP PATIENTS WITH NEGATIVE TIMES "RTN","C0QMU12",565,0) . . W !,"****EXCLUDED****" "RTN","C0QMU12",566,0) . I ZT>400000 D Q ; THESE ARE ERRORS "RTN","C0QMU12",567,0) . . W !,"****EXCLUDED****" "RTN","C0QMU12",568,0) . S ZARY1(ZT,ZI)="" ; ARRAY ORDERED BY MINUTES OF PATIENTS "RTN","C0QMU12",569,0) N ZY,ZZ S ZY="" S ZZ="" "RTN","C0QMU12",570,0) N ZCOUNT S ZCOUNT=0 "RTN","C0QMU12",571,0) F S ZY=$O(ZARY1(ZY)) Q:ZY="" D ; FOR EACH TIME "RTN","C0QMU12",572,0) . F S ZZ=$O(ZARY1(ZY,ZZ)) Q:ZZ="" D ; FOR EACH PATIENT WITH THIS TIME "RTN","C0QMU12",573,0) . . S ZCOUNT=ZCOUNT+1 "RTN","C0QMU12",574,0) . . S ZARY2(ZCOUNT,ZY,ZZ)="" "RTN","C0QMU12",575,0) . . ;W !,ZCOUNT," PATIENT: ",ZZ," MINUTES: ",ZY "RTN","C0QMU12",576,0) N ZMID "RTN","C0QMU12",577,0) S ZMID=$P(ZCOUNT/2,".") "RTN","C0QMU12",578,0) W !,"NUMBER OF PATIENTS IN REPORT: ",ZCOUNT "RTN","C0QMU12",579,0) W !,"ED ARRIVAL TIME UNTIL ",ZHF "RTN","C0QMU12",580,0) W !,"MEDIAN TIME: ",$O(ZARY2(ZMID,"")) "RTN","C0QMU12",581,0) Q "RTN","C0QMU12",582,0) ; "RTN","C0QMU12",583,0) DOTIME2(ZHF) ; COMPUTE THE MEAN TIME IN THE ED FROM ARRIVAL TO DEPARTURE "RTN","C0QMU12",584,0) ; THIS IS A QUALITY MEASURE ED-1 FOR MEANINGFUL USE "RTN","C0QMU12",585,0) ; IT PRINTS A REPORT OF EACH PATIENT WITH THE ED TIMES RECORDED "RTN","C0QMU12",586,0) ; AND THEIR TIME. AT THE END IT PRINTS THE MEAN TIME "RTN","C0QMU12",587,0) N ZP "RTN","C0QMU12",588,0) S ZP=$$PATLN(ZYR_"HasEDtime") ; patient list name for patients to process "RTN","C0QMU12",589,0) S ZHFN=9000010.23 ; FILE NUMBER FOR V HEALTH FACTORS "RTN","C0QMU12",590,0) S ZVFN=9000010 ; VISIT FILE NUMBER "RTN","C0QMU12",591,0) K ZARY1,ZARY2 "RTN","C0QMU12",592,0) N ZI S ZI="" "RTN","C0QMU12",593,0) S COUNT=0 "RTN","C0QMU12",594,0) F S ZI=$O(@ZP@(ZI)) Q:ZI="" D ; FOR EACH PATIENT "RTN","C0QMU12",595,0) . S COUNT=COUNT+1 "RTN","C0QMU12",596,0) . N ZA,ZD "RTN","C0QMU12",597,0) . ;S ZA=$$VHFIEN^C0QHF(ZI,"ED ARRIVAL TIME") ; IEN OF ARRIVAL HEALTH FACTOR "RTN","C0QMU12",598,0) . ;S ZD=$$VHFIEN^C0QHF(ZI,ZHF) ; IEN OF DEPART HEALTH FACTOR "RTN","C0QMU12",599,0) . S ZA=$$VHFIEN^C0QHF(ZI,ZHF) ; IEN OF DEPART HEALTH FACTOR "RTN","C0QMU12",600,0) . S ZD=$$VHFIEN^C0QHF(ZI,"ED DEPARTURE TIME") ; IEN OF ARRIVAL HEALTH FACTOR "RTN","C0QMU12",601,0) . N ZAD,ZDD ; ARRIVAL DATE, DEPARTURE DATE "RTN","C0QMU12",602,0) . N ZAC,ZDC ; ARRIVAL COMMENT, DEPARTURE COMMENT "RTN","C0QMU12",603,0) . ; THE COMMENT IS THE TIME XXYY "RTN","C0QMU12",604,0) . N OK,TMP "RTN","C0QMU12",605,0) . S TMP=$$GET1^DIQ(ZHFN,ZA_",",.03,"I") ; VISIT POINTER "RTN","C0QMU12",606,0) . S ZAD=$$GET1^DIQ(ZVFN,TMP_",",.01,"I") ; VISIT DATE "RTN","C0QMU12",607,0) . ;S ZAD=$P(^AUPNVHF(ZA,0),U,3) ; DATE IS PIECE 3 "RTN","C0QMU12",608,0) . S TMP=$$GET1^DIQ(ZHFN,ZD_",",.03,"I") ; VISIT POINTER "RTN","C0QMU12",609,0) . S ZDD=$$GET1^DIQ(ZVFN,TMP_",",.01,"I") ; VISIT DATE "RTN","C0QMU12",610,0) . ;S ZDD=$$GET1^DIQ(ZHFN,ZD_",",1201,"I") ; EVENT DATE FIELD "RTN","C0QMU12",611,0) . ;S ZDD=$P(^AUPNVHF(ZD,0),U,3) ; DATE IS PIECE 3 "RTN","C0QMU12",612,0) . ;S OK=$$GET1^DIQ(ZHFN,ZA_",",81101,"","ZAC") ; ARRIVAL TIME "RTN","C0QMU12",613,0) . S ZAC=$G(^AUPNVHF(ZA,811)) ; THE TIME "RTN","C0QMU12",614,0) . ;S OK=$$GET1^DIQ(ZHFN,ZD_",",81101,"","ZDC") ; DEPARTURE TIME "RTN","C0QMU12",615,0) . S ZDC=$G(^AUPNVHF(ZD,811)) ; DEPARTURE TIME "RTN","C0QMU12",616,0) . N ZT ; THE TIME DIFFERENCE BETWEEN THE DATES "RTN","C0QMU12",617,0) . W !,!,"PATIENT: ",ZI," ",$P(^DPT(ZI,0),U,1) "RTN","C0QMU12",618,0) . W !,"IN: ",$$FMTE^XLFDT(ZAD_"."_ZAC)," OUT: ",$$FMTE^XLFDT(ZDD_"."_ZDC) "RTN","C0QMU12",619,0) . S G1=($E(ZDC,1,2)*60)+($E(ZDC,3,4)) "RTN","C0QMU12",620,0) . S G2=($E(ZAC,1,2)*60)+($E(ZAC,3,4)) "RTN","C0QMU12",621,0) . I (ZDD-ZAD)>0 S G1=G1+(((ZDD-ZAD)*24)*60) "RTN","C0QMU12",622,0) . S GTOT=G1-G2 "RTN","C0QMU12",623,0) . W !,"TIME: ",GTOT," ESTIMATED" "RTN","C0QMU12",624,0) . S ZT=$$DTDIFF^C0QUTIL(ZDD,ZDC,ZAD,ZAC) ; COMPUTE THE DIFFERENCE IN MINUTES "RTN","C0QMU12",625,0) . W !,"COMPUTED MINUTES: ",ZT "RTN","C0QMU12",626,0) . ;I ZT'=GTOT B ; LET'S FIND OUT WHAT'S WRONG "RTN","C0QMU12",627,0) . I ZT<0 D Q ; SKIP PATIENTS WITH NEGATIVE TIMES "RTN","C0QMU12",628,0) . . W !,"****EXCLUDED****" "RTN","C0QMU12",629,0) . I ZT>400000 D Q ; THESE ARE ERRORS "RTN","C0QMU12",630,0) . . W !,"****EXCLUDED****" "RTN","C0QMU12",631,0) . S ZARY1(ZT,ZI)="" ; ARRAY ORDERED BY MINUTES OF PATIENTS "RTN","C0QMU12",632,0) N ZY,ZZ S ZY="" S ZZ="" "RTN","C0QMU12",633,0) N ZCOUNT S ZCOUNT=0 "RTN","C0QMU12",634,0) F S ZY=$O(ZARY1(ZY)) Q:ZY="" D ; FOR EACH TIME "RTN","C0QMU12",635,0) . F S ZZ=$O(ZARY1(ZY,ZZ)) Q:ZZ="" D ; FOR EACH PATIENT WITH THIS TIME "RTN","C0QMU12",636,0) . . S ZCOUNT=ZCOUNT+1 "RTN","C0QMU12",637,0) . . S ZARY2(ZCOUNT,ZY,ZZ)="" "RTN","C0QMU12",638,0) . . ;W !,ZCOUNT," PATIENT: ",ZZ," MINUTES: ",ZY "RTN","C0QMU12",639,0) N ZMID "RTN","C0QMU12",640,0) S ZMID=$P(ZCOUNT/2,".") "RTN","C0QMU12",641,0) W !,"NUMBER OF PATIENTS IN REPORT: ",ZCOUNT "RTN","C0QMU12",642,0) W !,"ED ARRIVAL TIME UNTIL ",ZHF "RTN","C0QMU12",643,0) W !,"MEDIAN TIME: ",$O(ZARY2(ZMID,"")) "RTN","C0QMU12",644,0) Q "RTN","C0QMU12",645,0) ; "RTN","C0QMU12",646,0) RPATLN(ZLST) ; EXTRINSIC RETURNS THE GLOBAL NAME OF THE REMINDER PATIENT LIST "RTN","C0QMU12",647,0) ; WHOSE NAME IS ZLST "RTN","C0QMU12",648,0) N ZIEN,ZN "RTN","C0QMU12",649,0) S ZIEN=$O(^PXRMXP(810.5,"B",ZLST,"")) ; ien of patient list "RTN","C0QMU12",650,0) S ZN=$NA(^PXRMXP(810.5,ZIEN,30,"B")) ; GLOBAL NAME IN REMINDER PATIENT LIST "RTN","C0QMU12",651,0) Q ZN "RTN","C0QMU12",652,0) ; "RTN","C0QMU12",653,0) PATLN(ZATTR) ; EXTRINSIC RETURNS THE NAME OF THE PATIENT LIST WITH "RTN","C0QMU12",654,0) ; THE ATTRIBUTE ZATTR "RTN","C0QMU12",655,0) N ZIEN,ZN "RTN","C0QMU12",656,0) S ZIEN=$O(^C0Q(301,"CATTR",ZATTR,"")) ; ien of patient list "RTN","C0QMU12",657,0) S ZN=$NA(^C0Q(301,ZIEN,1,"B")) ; NAME OF PATIENT LIST IN C0Q PATIENT LIST "RTN","C0QMU12",658,0) Q ZN "RTN","C0QMU12",659,0) ; "RTN","C0QMU12",660,0) INLIST(ZLIST,DFN) ; EXTRINSIC FOR IS PATIENT ALREADY IN LIST ZLIST "RTN","C0QMU12",661,0) N ZL,ZR "RTN","C0QMU12",662,0) S ZL=$O(^C0Q(301,"CATTR",ZLIST,"")) ; IEN OF LIST IN C0Q PATIENT LIST FILE "RTN","C0QMU12",663,0) I ZL="" Q 0 ; LIST DOES NOT EXIST "RTN","C0QMU12",664,0) S ZR=0 ; ASSUME NOT IN LIST "RTN","C0QMU12",665,0) I $D(^C0Q(301,ZL,1,"B",DFN)) S ZR=1 ; PATIENT IS IN LIST "RTN","C0QMU12",666,0) Q ZR "RTN","C0QMU12",667,0) ; "RTN","C0QMU12",668,0) ; LOOK AT GETTING RID OF PRINT AND SS AS THEY ARE NOT BEING USED. GPL "RTN","C0QMU12",669,0) PRINT ; PRINT TO SCREEN "RTN","C0QMU12",670,0) I $D(WARD) W !!,WARD_"-"_WARDNAME_" "_RB_": "_PTNAME_"("_PTSEX_") " "RTN","C0QMU12",671,0) I $D(EXDTE) D ; "RTN","C0QMU12",672,0) . W !,"Discharge Date: ",EXDTE "RTN","C0QMU12",673,0) . W !,DFN," ",PTNAME "RTN","C0QMU12",674,0) W !,"DOB: ",PTDOB," HRN: ",PTHRN "RTN","C0QMU12",675,0) W !,"Language Spoken: ",$G(PTLANG) "RTN","C0QMU12",676,0) W !,"Race: ",RACEDSC "RTN","C0QMU12",677,0) W !,"Ethnicity: ",$G(ETHNDSC) "RTN","C0QMU12",678,0) W !,"Problems: " "RTN","C0QMU12",679,0) W !,PBDESC "RTN","C0QMU12",680,0) W !,"Allergies: " "RTN","C0QMU12",681,0) W !,ALDESC "RTN","C0QMU12",682,0) W !,"Medications: " "RTN","C0QMU12",683,0) W ! "RTN","C0QMU12",684,0) Q "RTN","C0QMU12",685,0) ; "RTN","C0QMU12",686,0) SS ; CREATE SPREADSHEET ARRAY "RTN","C0QMU12",687,0) S G1("Patient")=DFN "RTN","C0QMU12",688,0) I $D(WARD) D ; "RTN","C0QMU12",689,0) . S G1("WardName")=WARDNAME "RTN","C0QMU12",690,0) . S G1("RoomAndBed")=RB "RTN","C0QMU12",691,0) I $D(EXDTE) D ; "RTN","C0QMU12",692,0) . S G1("DischargeDate")=EXDTE "RTN","C0QMU12",693,0) S G1("PatientName")=PTNAME "RTN","C0QMU12",694,0) S G1("Gender")=PTSEX "RTN","C0QMU12",695,0) S G1("DateOfBirth")=PTDOB "RTN","C0QMU12",696,0) S G1("HealthRecordNumber")=PTHRN "RTN","C0QMU12",697,0) S G1("LanguageSpoken")=$G(PTLANG) "RTN","C0QMU12",698,0) S G1("Race")=RACEDSC "RTN","C0QMU12",699,0) S G1("Ehtnicity")=$G(ETHNDSC) "RTN","C0QMU12",700,0) S G1("Problem")=PBDESC "RTN","C0QMU12",701,0) I PBDESC["No problems found" S G1("HasProblem")=0 "RTN","C0QMU12",702,0) E S G1("HasProblem")=1 "RTN","C0QMU12",703,0) S G1("Allergies")=ALDESC "RTN","C0QMU12",704,0) I ALDESC["No Allergy" S G1("HasAllergy")=0 "RTN","C0QMU12",705,0) E S G1("HasAllergy")=1 "RTN","C0QMU12",706,0) I $D(MDITEM) D ; "RTN","C0QMU12",707,0) . S G1("HasMed")=1 "RTN","C0QMU12",708,0) E S G1("HasMed")=0 "RTN","C0QMU12",709,0) S G1("MedDescription")=$G(MDDESC) "RTN","C0QMU12",710,0) I $D(MDITEM) W !,"("_MDITEM_")"_MDDESC E W !,MDDESC "RTN","C0QMU12",711,0) D RNF1TO2B^C0CRNF("GRSLT","G1") "RTN","C0QMU12",712,0) K G1 "RTN","C0QMU12",713,0) Q ; DON'T WANT TO DO THE NHIN STUFF NOW "RTN","C0QMU12",714,0) ; "RTN","C0QMU12",715,0) PATLIST ; CREATE PATIENT LISTS "RTN","C0QMU12",716,0) ; WANT TO GET RID OF PATLIST AND MOVE FUNCTION TO OTHER ROUTINES. GPL "RTN","C0QMU12",717,0) S C0QLIST(ZYR_"Patient",DFN)="" ; THE PATIENT LIST "RTN","C0QMU12",718,0) N DEMOYN S DEMOYN=1 "RTN","C0QMU12",719,0) I $G(PTSEX)="" S DEMOYN=0 "RTN","C0QMU12",720,0) I $G(PTDOB)="" S DEMOYN=0 "RTN","C0QMU12",721,0) I $G(PTHRN)="" S DEMOYN=0 "RTN","C0QMU12",722,0) I $G(PTLANG)="" S DEMOYN=0 "RTN","C0QMU12",723,0) I $G(RACEDSC)="" S DEMOYN=0 "RTN","C0QMU12",724,0) I $G(ETHNDSC)="" S DEMOYN=0 "RTN","C0QMU12",725,0) ;I DEMOYN S C0QLIST("HasDemographics",DFN)="" "RTN","C0QMU12",726,0) ;E S C0QLIST("FailedDemographics",DFN)="" "RTN","C0QMU12",727,0) ;S G1("Gender")=PTSEX "RTN","C0QMU12",728,0) ;S G1("DateOfBirth")=PTDOB "RTN","C0QMU12",729,0) ;S G1("HealthRecordNumber")=PTHRN "RTN","C0QMU12",730,0) ;S G1("LanguageSpoken")=$G(PTLANG) "RTN","C0QMU12",731,0) ;S G1("Race")=RACEDSC "RTN","C0QMU12",732,0) ;S G1("Ehtnicity")=$G(ETHNDSC) "RTN","C0QMU12",733,0) S G1("Problem")=PBDESC "RTN","C0QMU12",734,0) I PBDESC["No problems found" S C0QLIST(ZYR_"NoProblem",DFN)="" "RTN","C0QMU12",735,0) E S C0QLIST(ZYR_"HasProblem",DFN)="" "RTN","C0QMU12",736,0) ;S G1("Allergies")=ALDESC "RTN","C0QMU12",737,0) I ALDESC["No Allergy" S C0QLIST(ZYR_"NoAllergy",DFN)="" "RTN","C0QMU12",738,0) E S C0QLIST(ZYR_"HasAllergy",DFN)="" "RTN","C0QMU12",739,0) ;I $D(MDITEM) D ; "RTN","C0QMU12",740,0) ;. S C0QLIST("HasMed",DFN)="" "RTN","C0QMU12",741,0) ;E S G1("NoMed",DFN)="" "RTN","C0QMU12",742,0) ;S G1("MedDescription")=$G(MDDESC) "RTN","C0QMU12",743,0) Q "RTN","C0QMU12",744,0) ; "RTN","C0QMU12",745,0) NHIN ; SHOW THE NHIN ARRAY FOR THIS PATIENT "RTN","C0QMU12",746,0) Q:DFN=137!14 "RTN","C0QMU12",747,0) D EN^C0CNHIN(.G,DFN,"") "RTN","C0QMU12",748,0) ZWRITE G "RTN","C0QMU12",749,0) K G "RTN","C0QMU12",750,0) ; "RTN","C0QMU12",751,0) QUIT ;end of WARD "RTN","C0QMU12",752,0) ; "RTN","C0QMU12",753,0) LOCPAT(PREFIX,LOC) ;retrieve active outpatients "RTN","C0QMU12",754,0) ; PREFIX WILL GO IN C0XLIST(PREFIX_"-PATIENT",DFN)="" "RTN","C0QMU12",755,0) ; LOC IS HOSPITAL LOCATION "RTN","C0QMU12",756,0) S ULOC=$O(^SC("B",LOC,"")) ; IEN OF HOSPITAL LOCATION "RTN","C0QMU12",757,0) I ULOC="" D Q ; OOPS "RTN","C0QMU12",758,0) . W !,"HOSPITAL LOCATION NOT FOUND: ",LOC "RTN","C0QMU12",759,0) S IDTE=9999999-DTE ; INVERSE DATE "RTN","C0QMU12",760,0) N ZI "RTN","C0QMU12",761,0) S ZI="" ; BEGIN AT LATEST DATE FOR THIS LOC IN VISIT FILE "RTN","C0QMU12",762,0) F S ZI=$O(^AUPNVSIT("AHL",ULOC,ZI)) Q:(ZI="")!(ZI>IDTE) D ; FOR EACH DATE "RTN","C0QMU12",763,0) . W !,$$FMTE^XLFDT(9999999-ZI) ;B ; "RTN","C0QMU12",764,0) . I ZI="" Q ; "RTN","C0QMU12",765,0) . N ZJ S ZJ="" "RTN","C0QMU12",766,0) . F S ZJ=$O(^AUPNVSIT("AHL",ULOC,ZI,ZJ)) Q:ZJ="" D ; FOR EACH VISIT "RTN","C0QMU12",767,0) . . S DFN=$$GET1^DIQ(9000010,ZJ,.05,"I") ; PATIENT "RTN","C0QMU12",768,0) . . S C0QLIST(PREFIX_"Patient",DFN)="" "RTN","C0QMU12",769,0) Q "RTN","C0QMU12",770,0) ; "RTN","C0QMU12",771,0) EPPAT(ZYR) ; BUILD ALL PATIENT LISTS FOR CLINICS "RTN","C0QMU12",772,0) ; "RTN","C0QMU12",773,0) S DTE=3111000 "RTN","C0QMU12",774,0) S MUYR=ZYR "RTN","C0QMU12",775,0) N ZC,ZN "RTN","C0QMU12",776,0) S ZN=0 "RTN","C0QMU12",777,0) N ZI S ZI=0 "RTN","C0QMU12",778,0) F S ZI=$O(^SC(ZI)) Q:+ZI=0 D ; FOR EVERY HOSPITAL LOCATION "RTN","C0QMU12",779,0) . I $$GET1^DIQ(44,ZI_",",2,"I")'="C" Q ; NOT A CLINIC "RTN","C0QMU12",780,0) . S ZC=$$GET1^DIQ(44,ZI_",",.01) ; NAME OF CLINIC "RTN","C0QMU12",781,0) . S ZCIEN=ZI ; IEN OF CLINIC "RTN","C0QMU12",782,0) . S ZN=ZN+1 ; COUNT OF CLINICS "RTN","C0QMU12",783,0) . S PRE=MUYR_"-EP-"_ZC_"-" "RTN","C0QMU12",784,0) . D LOCPAT(PRE,ZC) "RTN","C0QMU12",785,0) W !,"NUMBER OF CLINICS: ",ZN "RTN","C0QMU12",786,0) D FILE ; CREATE ALL THE EP PATIENT LISTS "RTN","C0QMU12",787,0) Q "RTN","C0QMU12",788,0) ; "RTN","C0QMU12",789,0) DOEP ; DO EP COMPUTATIONS "RTN","C0QMU12",790,0) S ZYR="MU12-" "RTN","C0QMU12",791,0) N C0QPARM,C0QCLNC "RTN","C0QMU12",792,0) D INIT("C0QPARM","EP") ; INITIALIZE PARAMETERS "RTN","C0QMU12",793,0) K C0QLIST ; CLEAR THE LIST "RTN","C0QMU12",794,0) N ZI S ZI="" "RTN","C0QMU12",795,0) F S ZI=$O(C0QPARM(ZI)) Q:ZI="" D ; FOR EACH EP "RTN","C0QMU12",796,0) . S DTE=C0QPARM(ZI,"EPBeginDate") ; beginning of measurement period "RTN","C0QMU12",797,0) . S EDTE=C0QPARM(ZI,"EPEndDate") ; end of measurement period -- tbd use this "RTN","C0QMU12",798,0) . S C0QCLNC=C0QPARM(ZI,"CLINICS",1,1) ; only one clinic for now "RTN","C0QMU12",799,0) . S PRE=ZYR_"EP-"_C0QCLNC_"-" "RTN","C0QMU12",800,0) . D LOCPAT(PRE,C0QCLNC) ; GET THE PATIENTS "RTN","C0QMU12",801,0) . I $D(DEBUG) ZWRITE C0QLIST "RTN","C0QMU12",802,0) . M C0QLIST(ZYR_"EP-ALL-PATIENTS")=C0QLIST(PRE_"Patient") "RTN","C0QMU12",803,0) S DFN="" "RTN","C0QMU12",804,0) S ZYR=ZYR_"EP-" "RTN","C0QMU12",805,0) F S DFN=$O(C0QLIST(ZYR_"ALL-PATIENTS",DFN)) Q:DFN="" D ; EACH PATIENT "RTN","C0QMU12",806,0) . D DEMO "RTN","C0QMU12",807,0) . D PROBLEM "RTN","C0QMU12",808,0) . D ALLERGY "RTN","C0QMU12",809,0) . ;D MEDS "RTN","C0QMU12",810,0) . D ERX "RTN","C0QMU12",811,0) . D SMOKING "RTN","C0QMU12",812,0) . D VITALS "RTN","C0QMU12",813,0) D FILE ; FILE THE PATIENT LISTS "RTN","C0QMU12",814,0) ; "RTN","C0QMU12",815,0) ; Now process eRx MU measures for these patients "RTN","C0QMU12",816,0) ; Check for eRx template and code first; if they exist, run the code "RTN","C0QMU12",817,0) I $D(^C0PX("B","GETMEDS6")),$L($T(SOAP^C0PWS2)) DO "RTN","C0QMU12",818,0) . N C0QDEBUG S C0QDEBUG=1 ; This causes the code to print out data; "RTN","C0QMU12",819,0) . D EN^C0QMUERX($$PATLN^C0QMU12(ZYR_"HasERX")) ; Pass the eRx patient list "RTN","C0QMU12",820,0) ; "RTN","C0QMU12",821,0) N C0QCIEN "RTN","C0QMU12",822,0) S ZI="" "RTN","C0QMU12",823,0) F S ZI=$O(C0QPARM(ZI)) Q:ZI="" D ; "RTN","C0QMU12",824,0) . S C0QCIEN=C0QPARM(ZI,"EPMeasurementSet") ; ien of measurement set "RTN","C0QMU12",825,0) . N C0QDEBUG S C0QDEBUG=1 ; This causes the code to print out data; "RTN","C0QMU12",826,0) . D UPDATE^C0QUPDT(.G,C0QCIEN) ; UPDATE THE MU MEASUREMENT SET "RTN","C0QMU12",827,0) Q "RTN","C0QMU12",828,0) ; "RTN","C0QMU12",829,0) DIS ; "RTN","C0QMU12",830,0) N DFN,DTE,EXDTE S DTE="" "RTN","C0QMU12",831,0) F D Q:DTE="" "RTN","C0QMU12",832,0) . S DTE=$O(^DGPM("B",DTE)) "RTN","C0QMU12",833,0) . Q:'DTE "RTN","C0QMU12",834,0) . ;Q:$P(DTE,".")<3110703 "RTN","C0QMU12",835,0) . Q:$P(DTE,".")<3111000 ; NEW BEGIN DATE FOR FISCAL YEAR 2012 "RTN","C0QMU12",836,0) . S EXDTE=$$FMTE^XLFDT(DTE) "RTN","C0QMU12",837,0) . N PTFM S PTFM="" "RTN","C0QMU12",838,0) . D "RTN","C0QMU12",839,0) . . S PTFM=$O(^DGPM("B",DTE,PTFM)) "RTN","C0QMU12",840,0) . . Q:'PTFM "RTN","C0QMU12",841,0) . . S DFN=$P(^DGPM(PTFM,0),U,3) "RTN","C0QMU12",842,0) . . S C0QLIST(ZYR_"Patient",DFN)="" "RTN","C0QMU12",843,0) . . D DEMO "RTN","C0QMU12",844,0) . . D PROBLEM "RTN","C0QMU12",845,0) . . D ALLERGY "RTN","C0QMU12",846,0) . . D MEDS4 "RTN","C0QMU12",847,0) . . D RECON2 "RTN","C0QMU12",848,0) . . D ADVDIR "RTN","C0QMU12",849,0) . . D SMOKING "RTN","C0QMU12",850,0) . . D VITALS "RTN","C0QMU12",851,0) . . ;D:$P(DTE,".")>3110912 VTE1 "RTN","C0QMU12",852,0) . . D VTE1 "RTN","C0QMU12",853,0) . . D COD "RTN","C0QMU12",854,0) . . D EDTIME "RTN","C0QMU12",855,0) . . I C0QPR D PRINT "RTN","C0QMU12",856,0) . . I C0QSS D SS "RTN","C0QMU12",857,0) . . I C0QPL D PATLIST "RTN","C0QMU12",858,0) Q "RTN","C0QMU12",859,0) ; "RTN","C0QMU12",860,0) C0QPLF() Q 1130580001.301 ; FILE NUMBER FOR C0Q PATIENT LIST FILE "RTN","C0QMU12",861,0) C0QALFN() Q 1130580001.311 ; FILE NUMBER FOR C0Q PATIENT LIST PATIENT SUBFILE "RTN","C0QMU12",862,0) FILE ; FILE THE PATIENT LISTS TO C0Q PATIENT LIST "RTN","C0QMU12",863,0) ; "RTN","C0QMU12",864,0) I '$D(C0QLIST) Q ; "RTN","C0QMU12",865,0) N LFN S LFN=$$C0QALFN() "RTN","C0QMU12",866,0) N ZI,ZN "RTN","C0QMU12",867,0) S ZI="" "RTN","C0QMU12",868,0) F S ZI=$O(C0QLIST(ZI)) Q:ZI="" D ; "RTN","C0QMU12",869,0) . S ZN=$O(^C0Q(301,"CATTR",ZI,"")) "RTN","C0QMU12",870,0) . I ZN="" D ; LIST NOT FOUND, CREATE IT "RTN","C0QMU12",871,0) . . K C0QFDA "RTN","C0QMU12",872,0) . . S FN=$$C0QPLF ; C0Q PATIENT LIST FILE "RTN","C0QMU12",873,0) . . S C0QFDA(FN,"+1,",.01)=ZI "RTN","C0QMU12",874,0) . . S C0QFDA(FN,"+1,",999)=ZI ; ATTRIBUTE "RTN","C0QMU12",875,0) . . W !,"CREATING ",ZI "RTN","C0QMU12",876,0) . . D UPDIE ; ADD THE RECORD "RTN","C0QMU12",877,0) . . S ZN=$O(^C0Q(301,"CATTR",ZI,"")) ; THE NEW IEN "RTN","C0QMU12",878,0) . ;I ZN="" D Q ; OOPS "RTN","C0QMU12",879,0) . ;. W !,"ERROR, ATTRIBUTE NOT FOUND IN PATIENT LIST FILE:"_ZI "RTN","C0QMU12",880,0) . ;S ZN=$$KLNCR(ZN) ; KILL AND RECREATE RECORD ZN "RTN","C0QMU12",881,0) . N C0QNEW,C0QOLD,C0QRSLT "RTN","C0QMU12",882,0) . S C0QNEW=$NA(C0QLIST(ZI)) ; THE NEW PATIENT LIST "RTN","C0QMU12",883,0) . S C0QOLD=$NA(^C0Q(301,ZN,1,"B")) ; THE OLD PATIENT LIST "RTN","C0QMU12",884,0) . D UNITY^C0QSET("C0QRSLT",C0QNEW,C0QOLD) ; FIND WHAT'S NEW "RTN","C0QMU12",885,0) . N ZJ,ZK "RTN","C0QMU12",886,0) . ; FIRST, DELETE THE OLD ONES - NO LONGER IN THE LIST "RTN","C0QMU12",887,0) . K C0QFDA "RTN","C0QMU12",888,0) . S ZJ="" "RTN","C0QMU12",889,0) . F S ZJ=$O(C0QRSLT(2,ZJ)) Q:ZJ="" D ; MARKED WITH A 2 FROM UNITY "RTN","C0QMU12",890,0) . . S ZK=$O(@C0QOLD@(ZJ,"")) ; GET THE IEN OF THE RECORD TO DELETE "RTN","C0QMU12",891,0) . . I ZK="" D Q ; OOPS SHOULDN'T HAPPEN "RTN","C0QMU12",892,0) . . . W !,"INTERNAL ERROR FINDING A PATIENT TO DELETE" "RTN","C0QMU12",893,0) . . . S $EC=",U1130580001," ; smh - instead of a BREAK "RTN","C0QMU12",894,0) . . S C0QFDA(LFN,ZK_","_ZN_",",.01)="@" "RTN","C0QMU12",895,0) . I $D(C0QFDA) D UPDIE ; PROCESS THE DELETIONS "RTN","C0QMU12",896,0) . ; SECOND, PROCESS THE ADDITIONS "RTN","C0QMU12",897,0) . K C0QFDA "RTN","C0QMU12",898,0) . S ZJ="" S ZK=1 "RTN","C0QMU12",899,0) . F S ZJ=$O(C0QRSLT(0,ZJ)) Q:ZJ="" D ; PATIENTS TO ADD ARE MARKED WITH 0 "RTN","C0QMU12",900,0) . . S C0QFDA(LFN,"+"_ZK_","_ZN_",",.01)=ZJ "RTN","C0QMU12",901,0) . . S ZK=ZK+1 "RTN","C0QMU12",902,0) . I $D(C0QFDA) D UPDIE ; PROCESS THE ADDITIONS "RTN","C0QMU12",903,0) ;. Q "RTN","C0QMU12",904,0) ;. K C0QFDA "RTN","C0QMU12",905,0) ;. N ZJ,ZC "RTN","C0QMU12",906,0) ;. S ZJ="" S ZC=1 "RTN","C0QMU12",907,0) ;. F S ZJ=$O(C0QLIST(ZI,ZJ)) Q:ZJ="" D ; FOR EACH PAT IN LIST "RTN","C0QMU12",908,0) ;. . S C0QFDA(LFN,"?+"_ZC_","_ZN_",",.01)=ZJ "RTN","C0QMU12",909,0) ;. . S ZC=ZC+1 "RTN","C0QMU12",910,0) ;. D UPDIE "RTN","C0QMU12",911,0) ;. W !,"FOUND:"_ZI "RTN","C0QMU12",912,0) Q "RTN","C0QMU12",913,0) ; "RTN","C0QMU12",914,0) KLNCR(ZREC) ; KILL AND RECREATE RECORD ZREC IN PATIENT LIST FILE "RTN","C0QMU12",915,0) ; "RTN","C0QMU12",916,0) N C0QFDA,ZFN,LIST,ATTR "RTN","C0QMU12",917,0) S ZFN=$$C0QPLF() ; FILE NUMBER FOR C0Q PATIENT LIST FILE "RTN","C0QMU12",918,0) D CLEAN^DILF "RTN","C0QMU12",919,0) S LIST=$$GET1^DIQ(ZFN,ZREC_",",.01) ; MEASURE NAME "RTN","C0QMU12",920,0) S ATTR=$$GET1^DIQ(ZFN,ZREC_",",999) ; ATTRIBUTE "RTN","C0QMU12",921,0) D CLEAN^DILF "RTN","C0QMU12",922,0) K ZERR "RTN","C0QMU12",923,0) S C0QFDA(ZFN,ZREC_",",.01)="@" ; GET READY TO DELETE THE MEASURE "RTN","C0QMU12",924,0) D FILE^DIE(,"C0QFDA","ZERR") ; KILL THE SUBFILE "RTN","C0QMU12",925,0) I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST, INVOKE THE ERROR TRAP IF TASKED "RTN","C0QMU12",926,0) ;. W "ERROR",! "RTN","C0QMU12",927,0) ;. ZWR ZERR "RTN","C0QMU12",928,0) ;. B "RTN","C0QMU12",929,0) K C0QFDA "RTN","C0QMU12",930,0) S C0QFDA(ZFN,"+1,",.01)=LIST ; GET READY TO RECREATE THE RECORD "RTN","C0QMU12",931,0) S C0QFDA(ZFN,"+1,",999)=ATTR ; ATTRIBUTE "RTN","C0QMU12",932,0) D UPDIE ; CREATE THE SUBFILE "RTN","C0QMU12",933,0) N ZR ; NEW IEN FOR THE RECORD "RTN","C0QMU12",934,0) S ZR=$O(^C0Q(301,"CATTR",ATTR,"")) "RTN","C0QMU12",935,0) ; "RTN","C0QMU12",936,0) Q ZR "RTN","C0QMU12",937,0) ; "RTN","C0QMU12",938,0) UPDIE ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS "RTN","C0QMU12",939,0) K ZERR "RTN","C0QMU12",940,0) D CLEAN^DILF "RTN","C0QMU12",941,0) D UPDATE^DIE("","C0QFDA","","ZERR") "RTN","C0QMU12",942,0) I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST, INVOKE THE ERROR TRAP IF TASKED "RTN","C0QMU12",943,0) ;. W "ERROR",! "RTN","C0QMU12",944,0) ;. ZWR ZERR "RTN","C0QMU12",945,0) ;. B "RTN","C0QMU12",946,0) K C0QFDA "RTN","C0QMU12",947,0) Q "RTN","C0QMU12",948,0) ; "RTN","C0QMU12",949,0) ; WHAT FOLLOWS IS OLD CODE - DELETE WHEN THIS WORKS "RTN","C0QMU12",950,0) ;. . N PTNAME S PTNAME=$P(^DPT(DFN,0),U,1) "RTN","C0QMU12",951,0) ;. . S PTDOB=$$FMTE^XLFDT($P($G(^DPT(DFN,0)),U,3)) ;date of birth "RTN","C0QMU12",952,0) ;. . S PTSEX=$P($G(^DPT(DFN,0)),U,2) ;patient sex "RTN","C0QMU12",953,0) ;. . D PID^VADPT ;VADPT call to grab PISD based on PT Eligibility "RTN","C0QMU12",954,0) ;. . S PTHRN=$P($G(VA("PID")),U) ;health record number "RTN","C0QMU12",955,0) ;. . S PTRLANG=$P($G(^DPT(DFN,256000)),U) ;ptr to language file "RTN","C0QMU12",956,0) ;. . I $G(PTRLANG)'="" S PTLANG=$P(^DI(.85,PTRLANG,0),U) ;PLS extrnl "RTN","C0QMU12",957,0) ;. . S RACE="" "RTN","C0QMU12",958,0) ;. . F D Q:RACE="" "RTN","C0QMU12",959,0) ;. . . S RACE=$O(^DPT(DFN,.02,"B",RACE)) "RTN","C0QMU12",960,0) ;. . . Q:'RACE "RTN","C0QMU12",961,0) ;. . . S RACEDSC=$P($G(^DIC(10,RACE,0)),U) "RTN","C0QMU12",962,0) ;. . N ETHNDSC "RTN","C0QMU12",963,0) ;. . N ETHNDSC S ETHNDSC="" "RTN","C0QMU12",964,0) ;. . S ETHN="" "RTN","C0QMU12",965,0) ;. . F D Q:ETHN="" "RTN","C0QMU12",966,0) ;. . . S ETHN=$O(^DPT(DFN,.06,"B",ETHN)) "RTN","C0QMU12",967,0) ;. . . Q:'ETHN "RTN","C0QMU12",968,0) ;. . . S ETHNDSC=$P($G(^DIC(10.2,ETHN,0)),U) "RTN","C0QMU12",969,0) ;. . D LIST^ORQQPL(.PROBL,DFN,"A") "RTN","C0QMU12",970,0) ;. . S PBCNT="" "RTN","C0QMU12",971,0) ;. . F S PBCNT=$O(PROBL(PBCNT)) Q:PBCNT="" D "RTN","C0QMU12",972,0) ;. . . S PBDESC=$P(PROBL(PBCNT),U,2) ;problem description "RTN","C0QMU12",973,0) ;. . K PROBL "RTN","C0QMU12",974,0) ;. . D LIST^ORQQAL(.ALRGYL,DFN) "RTN","C0QMU12",975,0) ;. . S ALCNT="" "RTN","C0QMU12",976,0) ;. . F S ALCNT=$O(ALRGYL(ALCNT)) Q:ALCNT="" D "RTN","C0QMU12",977,0) ;. . . S ALDESC=$P(ALRGYL(ALCNT),U,2) ;allergy description "RTN","C0QMU12",978,0) ;. . K ALRGYL "RTN","C0QMU12",979,0) ;. . D COVER^ORWPS(.MEDSL,DFN) "RTN","C0QMU12",980,0) ;. . S MDCNT="" "RTN","C0QMU12",981,0) ;. . F S MDCNT=$O(MEDSL(MDCNT)) Q:MDCNT="" D "RTN","C0QMU12",982,0) ;. . . Q:$P(MEDSL(MDCNT),U,4)'="ACTIVE" ;active medications only "RTN","C0QMU12",983,0) ;. . . S MDDESC=$P(MEDSL(MDCNT),U,2) ;medication description "RTN","C0QMU12",984,0) ;. . . S MDITEM=$P($G(MEDSL(MDCNT)),U,3) "RTN","C0QMU12",985,0) ;. . K MEDSL "RTN","C0QMU12",986,0) ;. . W !,"Discharge Date: ",EXDTE "RTN","C0QMU12",987,0) ;. . W !,DFN," ",PTNAME "RTN","C0QMU12",988,0) ;. . W !,"DOB: ",PTDOB," HRN: ",PTHRN "RTN","C0QMU12",989,0) ;. . W !,"Language Spoken: ",$G(PTLANG) "RTN","C0QMU12",990,0) ;. . W !,"Race: ",RACEDSC "RTN","C0QMU12",991,0) ;. . W !,"Ethnicity: ",ETHNDSC "RTN","C0QMU12",992,0) ;. . W !,"Problems: " "RTN","C0QMU12",993,0) ;. . W !,PBDESC "RTN","C0QMU12",994,0) ;. . W !,"Allergies: " "RTN","C0QMU12",995,0) ;. . W !,ALDESC "RTN","C0QMU12",996,0) ;. . W !,"Medications: " "RTN","C0QMU12",997,0) ;. . I $D(MDITEM) W !,"(",MDITEM,")",MDDESC E W !,MDDESC "RTN","C0QMU12",998,0) ;. . W ! "RTN","C0QMU12",999,0) ;Q "RTN","C0QMU12",1000,0) ; "RTN","C0QMU12",1001,0) ; "RTN","C0QMU12",1002,0) ; "RTN","C0QMU12",1003,0) ; "RTN","C0QMU12",1004,0) END ;end of C0QPRML; "RTN","C0QMUERX") 0^1^B83718518 "RTN","C0QMUERX",1,0) C0QMUERX ; VEN - Analyze ERx Data for Patients ; 6/13/12 12:44pm "RTN","C0QMUERX",2,0) ;;1.0;C0Q;;May 21, 2012;Build 29 "RTN","C0QMUERX",3,0) QUIT ; No Entry from the top "RTN","C0QMUERX",4,0) ; "RTN","C0QMUERX",5,0) UT ; Unit Tests "RTN","C0QMUERX",6,0) N C0QDEBUG S C0QDEBUG=1 "RTN","C0QMUERX",7,0) W "Testing ^DPT B Index",! "RTN","C0QMUERX",8,0) D EN("^DPT(""B"")") "RTN","C0QMUERX",9,0) W !,"Testing B Index on a C0Q Patient List",! "RTN","C0QMUERX",10,0) D EN("^C0Q(301,4,1,""B"")") "RTN","C0QMUERX",11,0) W !,"Testing ^AUPNPAT B Index",! "RTN","C0QMUERX",12,0) D EN("^AUPNPAT(""B"")") "RTN","C0QMUERX",13,0) W !,"Testing Reminder Patient List B Index",! "RTN","C0QMUERX",14,0) D EN("^PXRMXP(810.5,80,30,""B"")") "RTN","C0QMUERX",15,0) W !,"Testing upright file ^DPT",! "RTN","C0QMUERX",16,0) D EN("^DPT") "RTN","C0QMUERX",17,0) W !,"Testing a file with no data",! "RTN","C0QMUERX",18,0) D EN("^ALKJSDF") "RTN","C0QMUERX",19,0) W !,"Testing a no valid parameters",! "RTN","C0QMUERX",20,0) D EN("") "RTN","C0QMUERX",21,0) UT2 ; Units Tests 2 "RTN","C0QMUERX",22,0) N C0QDEBUG S C0QDEBUG=1 "RTN","C0QMUERX",23,0) D EN("^C0Q(301,4,1,""B"")") "RTN","C0QMUERX",24,0) QUIT "RTN","C0QMUERX",25,0) UT3 ; More Unit Tests "RTN","C0QMUERX",26,0) N C0QDEBUG S C0QDEBUG=1 "RTN","C0QMUERX",27,0) D EN($$PATLN^C0QMU12("MU12-EP-HasERX")) "RTN","C0QMUERX",28,0) W $$COUNT($$PATLN^C0QMU12("MU12-EP-HasERX")) "RTN","C0QMUERX",29,0) QUIT "RTN","C0QMUERX",30,0) EN(C0QLIST) ; PEP - Analyze ERx Data and store "RTN","C0QMUERX",31,0) ; Parameters: "RTN","C0QMUERX",32,0) ; C0QLIST - Pass by Name. Global or Local Reference. "RTN","C0QMUERX",33,0) ; Can be: ^DPT("B") for all patients or ^C0Q(301,2,1,"B") for a specific patient list "RTN","C0QMUERX",34,0) ; Future: Can be a search template on file 2 or 9000001 "RTN","C0QMUERX",35,0) ; "RTN","C0QMUERX",36,0) ; Check if XML Soap Message is installed "RTN","C0QMUERX",37,0) I '$D(^C0PX("B","GETMEDS6")) WRITE "GETMEDS6 Soap Message not installed",! QUIT "RTN","C0QMUERX",38,0) ; "RTN","C0QMUERX",39,0) ; Check if SOAP^C0PWS2 exists "RTN","C0QMUERX",40,0) I '$L($T(SOAP^C0PWS2)) WRITE "C0PWS2 Doesn't exist",! QUIT "RTN","C0QMUERX",41,0) ; "RTN","C0QMUERX",42,0) ; Check C0QLIST for sanity. Must be a single node. "RTN","C0QMUERX",43,0) IF '($DATA(C0QLIST)#2)!(C0QLIST="") WRITE "You didn't pass the list",! QUIT "RTN","C0QMUERX",44,0) ; "RTN","C0QMUERX",45,0) ; Contents must be a Reference with Data "RTN","C0QMUERX",46,0) IF '$DATA(@C0QLIST) WRITE "Destination doesn't contain any data",! QUIT "RTN","C0QMUERX",47,0) ; "RTN","C0QMUERX",48,0) ; Is this a B index? "RTN","C0QMUERX",49,0) NEW C0QB "RTN","C0QMUERX",50,0) IF $QSUBSCRIPT(C0QLIST,$QLENGTH(C0QLIST))="B" DO "RTN","C0QMUERX",51,0) . SET C0QB=1 "RTN","C0QMUERX",52,0) . ; DEBUG "RTN","C0QMUERX",53,0) . W:$G(C0QDEBUG) "B index passed",! "RTN","C0QMUERX",54,0) . ; DEBUG "RTN","C0QMUERX",55,0) ELSE SET C0QB=0 "RTN","C0QMUERX",56,0) ; "RTN","C0QMUERX",57,0) ; Make sure our TMP is empty "RTN","C0QMUERX",58,0) K ^TMP($J) "RTN","C0QMUERX",59,0) ; "RTN","C0QMUERX",60,0) ; Walk the global "RTN","C0QMUERX",61,0) N C0QWALK S C0QWALK=$SELECT(C0QB:"",'C0QB:0) ; Walker, start of $ORDER? "RTN","C0QMUERX",62,0) N C0QDONE S C0QDONE=0 ; Finish Flag "RTN","C0QMUERX",63,0) FOR SET C0QWALK=$O(@C0QLIST@(C0QWALK)) QUIT:C0QDONE DO "RTN","C0QMUERX",64,0) . ; Are we done? "RTN","C0QMUERX",65,0) . I C0QB,C0QWALK="" S C0QDONE=1 QUIT ; If in index and we are out, done "RTN","C0QMUERX",66,0) . I 'C0QB,'+C0QWALK S C0QDONE=1 QUIT ; If not in index and we are not numeric, done "RTN","C0QMUERX",67,0) . ; "RTN","C0QMUERX",68,0) . N C0QDFN ; DFN of Patient "RTN","C0QMUERX",69,0) . ; If Walking B Index and Index not numeric, grab DFN (assuming ^DPT or ^AUPNPAT) "RTN","C0QMUERX",70,0) . ; TODO: Should I check that the global is ^DPT or ^AUPNPAT? "RTN","C0QMUERX",71,0) . I C0QB,'+C0QWALK S C0QDFN=$O(@C0QLIST@(C0QWALK,"")) "RTN","C0QMUERX",72,0) . ; Otherwise, we will assume the contents of the index are the DFNs "RTN","C0QMUERX",73,0) . E S C0QDFN=C0QWALK "RTN","C0QMUERX",74,0) . I $G(C0QDEBUG) W C0QDFN," " "RTN","C0QMUERX",75,0) . ; "RTN","C0QMUERX",76,0) . ; Now, check to see if the patient has e-Rx's "RTN","C0QMUERX",77,0) . I $$HASERX(C0QDFN) S ^TMP($J,C0QDFN)="" "RTN","C0QMUERX",78,0) ; "RTN","C0QMUERX",79,0) W:$G(C0QDEBUG) ! ; "RTN","C0QMUERX",80,0) ; "RTN","C0QMUERX",81,0) ; Loop through collected DFNs, send to WS, and get data back, store in ^TMP($J,DFN) "RTN","C0QMUERX",82,0) N C0QDFN S C0QDFN=0 "RTN","C0QMUERX",83,0) F S C0QDFN=$O(^TMP($J,C0QDFN)) Q:C0QDFN="" DO "RTN","C0QMUERX",84,0) . N C0POUT "RTN","C0QMUERX",85,0) . W:$G(C0QDEBUG) "Calling GETMEDS6 SOAP Web Service Call for "_C0QDFN,! "RTN","C0QMUERX",86,0) . D SOAP^C0PWS2("C0POUT","GETMEDS6",DUZ,C0QDFN) "RTN","C0QMUERX",87,0) . Q:$G(C0POUT(1,"RowCount"))=0 ; WS says no data "RTN","C0QMUERX",88,0) . M ^TMP($J,C0QDFN)=C0POUT "RTN","C0QMUERX",89,0) ; "RTN","C0QMUERX",90,0) ; From the New Crop Meaningful Use documentation: "RTN","C0QMUERX",91,0) ; Appendix G: Meaningful Use Certification FAQ Question 10 "RTN","C0QMUERX",92,0) ; "RTN","C0QMUERX",93,0) ; DENOMINATOR NUMERATOR "RTN","C0QMUERX",94,0) ; DeaClassCode = 0, 9 DeaClassCode = 0, 9 "RTN","C0QMUERX",95,0) ; PharmacyType = 1 PharmacyType = 1 "RTN","C0QMUERX",96,0) ; PharmacyDetailType = 1, 2 PharmacyDetailType = 1, 2 "RTN","C0QMUERX",97,0) ; FinalDestinationType = 1, 2, 3, 4 FinalDestinationType = 3, 4 "RTN","C0QMUERX",98,0) ; FinalStatusType = 1, 4, 5 FinalStatusType = 1, 5 "RTN","C0QMUERX",99,0) ; "RTN","C0QMUERX",100,0) ; DeMorgan's Law "RTN","C0QMUERX",101,0) ; NOT(A or B) = NOT(A) and NOT(B) "RTN","C0QMUERX",102,0) ; So to collect prescriptions for which DeaClassCode is 0 or 9 "RTN","C0QMUERX",103,0) ; We exclude all those who are not 0 AND not 9. "RTN","C0QMUERX",104,0) ; See: http://en.wikipedia.org/wiki/De_Morgan%27s_laws#Negation_of_a_disjunction "RTN","C0QMUERX",105,0) ; "RTN","C0QMUERX",106,0) ; The algorithms below use an Onion Peeling method. Any prescription which "RTN","C0QMUERX",107,0) ; fails makes you jump to the next prescription. "RTN","C0QMUERX",108,0) ; The "Onion levels" are: "RTN","C0QMUERX",109,0) ; DeaClassCode, PharamcyType, PharmacyDetailType, FinalDestinationType, FinalStatusType "RTN","C0QMUERX",110,0) ; "RTN","C0QMUERX",111,0) ; Now walk through collected DFNs and accumulate MU stats "RTN","C0QMUERX",112,0) ; "RTN","C0QMUERX",113,0) ; WARNING: Naked References below "RTN","C0QMUERX",114,0) ; "RTN","C0QMUERX",115,0) N C0QDFN,C0QRXNO S (C0QDFN,C0QRXNO)=0 "RTN","C0QMUERX",116,0) N C0QD S C0QD=0 ; Denominator - Overall (cf C0QDP below) "RTN","C0QMUERX",117,0) ; "RTN","C0QMUERX",118,0) ; Calculate Denominator below "RTN","C0QMUERX",119,0) F S C0QDFN=$O(^TMP($J,C0QDFN)) Q:C0QDFN="" DO "RTN","C0QMUERX",120,0) . N C0QDP S C0QDP=0 ; Denominator - Patient Specific "RTN","C0QMUERX",121,0) . F S C0QRXNO=$O(^TMP($J,C0QDFN,C0QRXNO)) Q:C0QRXNO="" DO "RTN","C0QMUERX",122,0) .. W:$G(C0QDEBUG) "Patient "_C0QDFN_" Rx "_C0QRXNO,! "RTN","C0QMUERX",123,0) .. ; "RTN","C0QMUERX",124,0) .. I ^(C0QRXNO,"DeaClassCode") ; Change $REFERENCE "RTN","C0QMUERX",125,0) .. ; "RTN","C0QMUERX",126,0) .. N DEA S DEA=^("DeaClassCode") "RTN","C0QMUERX",127,0) .. W:$G(C0QDEBUG) "DeaClassCode: "_DEA,! "RTN","C0QMUERX",128,0) .. Q:((DEA'=0)&(DEA'=9)) "RTN","C0QMUERX",129,0) .. ; "RTN","C0QMUERX",130,0) .. N PT S PT=^("PharmacyType") "RTN","C0QMUERX",131,0) .. W:$G(C0QDEBUG) "PharmacyType: "_PT,! "RTN","C0QMUERX",132,0) .. Q:(PT'=1) "RTN","C0QMUERX",133,0) .. ; "RTN","C0QMUERX",134,0) .. N PDT S PDT=^("PharmacyDetailType") "RTN","C0QMUERX",135,0) .. W:$G(C0QDEBUG) "PharmacyDetailType: "_PDT,! "RTN","C0QMUERX",136,0) .. Q:((PDT'=1)&(PDT'=2)) "RTN","C0QMUERX",137,0) .. ; "RTN","C0QMUERX",138,0) .. N FDT S FDT=^("FinalDestinationType") "RTN","C0QMUERX",139,0) .. W:$G(C0QDEBUG) "FinalDestinationType: "_FDT,! "RTN","C0QMUERX",140,0) .. Q:((FDT'=1)&(FDT'=2)&(FDT'=3)&(FDT'=4)) "RTN","C0QMUERX",141,0) .. ; "RTN","C0QMUERX",142,0) .. N FST S FST=^("FinalStatusType") "RTN","C0QMUERX",143,0) .. W:$G(C0QDEBUG) "FinalStatusType: "_FST,! "RTN","C0QMUERX",144,0) .. Q:((FST'=1)&(FST'=4)&(FST'=5)) "RTN","C0QMUERX",145,0) .. ; "RTN","C0QMUERX",146,0) .. W:$G(C0QDEBUG) "Adding to Denominator",! "RTN","C0QMUERX",147,0) .. S C0QDP=C0QDP+1 "RTN","C0QMUERX",148,0) .. S C0QD=C0QD+1 "RTN","C0QMUERX",149,0) . ; "RTN","C0QMUERX",150,0) . ; SAVE C0QDP - while it lasts! "RTN","C0QMUERX",151,0) . D SAVE(C0QLIST,C0QDFN,"ERXDEN",C0QDP) "RTN","C0QMUERX",152,0) ; "RTN","C0QMUERX",153,0) ; Calculate Numerator below "RTN","C0QMUERX",154,0) N C0QDFN,C0QRXNO S (C0QDFN,C0QRXNO)=0 "RTN","C0QMUERX",155,0) N C0QN S C0QN=0 ; Numerator - Overall (cf C0QNP below) "RTN","C0QMUERX",156,0) F S C0QDFN=$O(^TMP($J,C0QDFN)) Q:C0QDFN="" DO "RTN","C0QMUERX",157,0) . N C0QNP S C0QNP=0 ; Numerator - Patient Specific "RTN","C0QMUERX",158,0) . F S C0QRXNO=$O(^TMP($J,C0QDFN,C0QRXNO)) Q:C0QRXNO="" DO "RTN","C0QMUERX",159,0) .. W:$G(C0QDEBUG) "Patient "_C0QDFN_" Rx "_C0QRXNO,! "RTN","C0QMUERX",160,0) .. ; "RTN","C0QMUERX",161,0) .. I ^(C0QRXNO,"DeaClassCode") ; Change $REFERENCE "RTN","C0QMUERX",162,0) .. ; "RTN","C0QMUERX",163,0) .. N DEA S DEA=^("DeaClassCode") "RTN","C0QMUERX",164,0) .. W:$G(C0QDEBUG) "DeaClassCode: "_DEA,! "RTN","C0QMUERX",165,0) .. Q:((DEA'=0)&(DEA'=9)) "RTN","C0QMUERX",166,0) .. ; "RTN","C0QMUERX",167,0) .. N PT S PT=^("PharmacyType") "RTN","C0QMUERX",168,0) .. W:$G(C0QDEBUG) "PharmacyType: "_PT,! "RTN","C0QMUERX",169,0) .. Q:(PT'=1) "RTN","C0QMUERX",170,0) .. ; "RTN","C0QMUERX",171,0) .. N PDT S PDT=^("PharmacyDetailType") "RTN","C0QMUERX",172,0) .. W:$G(C0QDEBUG) "PharmacyDetailType: "_PDT,! "RTN","C0QMUERX",173,0) .. Q:((PDT'=1)&(PDT'=2)) "RTN","C0QMUERX",174,0) .. ; "RTN","C0QMUERX",175,0) .. N FDT S FDT=^("FinalDestinationType") "RTN","C0QMUERX",176,0) .. W:$G(C0QDEBUG) "FinalDestinationType: "_FDT,! "RTN","C0QMUERX",177,0) .. Q:((FDT'=3)&(FDT'=4)) "RTN","C0QMUERX",178,0) .. ; "RTN","C0QMUERX",179,0) .. N FST S FST=^("FinalStatusType") "RTN","C0QMUERX",180,0) .. W:$G(C0QDEBUG) "FinalStatusType: "_FST,! "RTN","C0QMUERX",181,0) .. Q:((FST'=1)&(FST'=5)) "RTN","C0QMUERX",182,0) .. ; "RTN","C0QMUERX",183,0) .. W:$G(C0QDEBUG) "Adding to Numerator",! "RTN","C0QMUERX",184,0) .. S C0QNP=C0QNP+1 "RTN","C0QMUERX",185,0) .. S C0QN=C0QN+1 "RTN","C0QMUERX",186,0) . ; "RTN","C0QMUERX",187,0) . ; Save C0QNP while it lasts "RTN","C0QMUERX",188,0) . D SAVE(C0QLIST,C0QDFN,"ERXNUM",C0QNP) "RTN","C0QMUERX",189,0) ; "RTN","C0QMUERX",190,0) S ^TMP($J)=C0QN_U_C0QD "RTN","C0QMUERX",191,0) ; "RTN","C0QMUERX",192,0) ; TODO: Over here, do something with the numerator and denominator.. "RTN","C0QMUERX",193,0) ; Probably store them somewhere. "RTN","C0QMUERX",194,0) ; "RTN","C0QMUERX",195,0) I '$G(C0QDEBUG) K ^TMP($J) ; Empty out in production not testing "RTN","C0QMUERX",196,0) QUIT "RTN","C0QMUERX",197,0) ; "RTN","C0QMUERX",198,0) HASERX(DFN) ; $$ - Private; Has E-Prescriptions? "RTN","C0QMUERX",199,0) ; Parameters "RTN","C0QMUERX",200,0) ; - DFN by Value "RTN","C0QMUERX",201,0) ; Output "RTN","C0QMUERX",202,0) ; 0 or 1 (false or true) "RTN","C0QMUERX",203,0) N ZI S ZI="" "RTN","C0QMUERX",204,0) N ZERX S ZERX=$NA(^PS(55,DFN,"NVA")) "RTN","C0QMUERX",205,0) N DONE,HASERX "RTN","C0QMUERX",206,0) F S ZI=$O(@ZERX@(ZI)) Q:ZI="" Q:$G(DONE) D "RTN","C0QMUERX",207,0) . I $G(@ZERX@(ZI,1,1,0))["E-Rx Web" S (DONE,HASERX)=1 "RTN","C0QMUERX",208,0) Q +$G(HASERX) "RTN","C0QMUERX",209,0) ; "RTN","C0QMUERX",210,0) SAVE(C0QLIST,C0QDFN,TYPE,COUNT) ; Proc - Private; Save Count in C0Q(301, file "RTN","C0QMUERX",211,0) ; Layman's Explanation: Save the denominator or numerator for ePrescribing for "RTN","C0QMUERX",212,0) ; each of the patients in the Subfile for that patient in ^C0Q(301, "RTN","C0QMUERX",213,0) ; Still hard to understand though! Here's a demo: "RTN","C0QMUERX",214,0) ; ^C0Q(301,IEN has a subfile under node 1 which stores the patients. E.g. "RTN","C0QMUERX",215,0) ; ^C0Q(301,48,1,15,0)=91$ "RTN","C0QMUERX",216,0) ; ^C0Q(301,48,1,16,0)=93$ "RTN","C0QMUERX",217,0) ; ^C0Q(301,48,1,17,0)=173$ "RTN","C0QMUERX",218,0) ; "RTN","C0QMUERX",219,0) ; I store the numerator and denominator under each of the patients. The numerator "RTN","C0QMUERX",220,0) ; stands for the number of prescriptions that were electronically transmitted; "RTN","C0QMUERX",221,0) ; the denominator stands for the numbers of prescriptions that COULD HAVE BEEN "RTN","C0QMUERX",222,0) ; electronically transmitted. End result for Patient 173 is as follows: "RTN","C0QMUERX",223,0) ; ^C0Q(301,48,1,17,0)=173 "RTN","C0QMUERX",224,0) ; ^C0Q(301,48,1,17,1,0)="^1130580001.3111^2^2" "RTN","C0QMUERX",225,0) ; ^C0Q(301,48,1,17,1,1,0)="ERXDEN^0" "RTN","C0QMUERX",226,0) ; ^C0Q(301,48,1,17,1,2,0)="ERXNUM^0" "RTN","C0QMUERX",227,0) ; ^C0Q(301,48,1,17,1,"B","ERXDEN",1)="" "RTN","C0QMUERX",228,0) ; ^C0Q(301,48,1,17,1,"B","ERXNUM",2)="" "RTN","C0QMUERX",229,0) ; "RTN","C0QMUERX",230,0) ; Subroutine COUNT (below) goes and counts the data "RTN","C0QMUERX",231,0) ; "RTN","C0QMUERX",232,0) ; Params: "RTN","C0QMUERX",233,0) ; C0QLIST (by val): "B" x-ref where patients are located. Only supports ^C0Q(301, file. "RTN","C0QMUERX",234,0) ; C0QDFN (by val): Patient DFN for whom to file data. "RTN","C0QMUERX",235,0) ; TYPE (by val): Either ERXDEN or ERXNUM for eRx Denominator or eRx Numerator "RTN","C0QMUERX",236,0) ; COUNT (by val): The number to save "RTN","C0QMUERX",237,0) ; "RTN","C0QMUERX",238,0) ; First, QUIT if this isn't a Quality Measures List? "RTN","C0QMUERX",239,0) ; $QS(x,0) gets you the global name "RTN","C0QMUERX",240,0) ; "RTN","C0QMUERX",241,0) ; This should give you an idea of what I am dealing with! "RTN","C0QMUERX",242,0) ; "RTN","C0QMUERX",243,0) ; ^C0Q(301,48,1,15,0)=91 "RTN","C0QMUERX",244,0) ; ^C0Q(301,48,1,16,0)=93 "RTN","C0QMUERX",245,0) ; ^C0Q(301,48,1,17,0)=173 "RTN","C0QMUERX",246,0) ; ^C0Q(301,48,1,18,0)=174 "RTN","C0QMUERX",247,0) ; ^C0Q(301,48,1,"B",5,1)="" "RTN","C0QMUERX",248,0) ; ^C0Q(301,48,1,"B",10,2)="" "RTN","C0QMUERX",249,0) ; ^C0Q(301,48,1,"B",11,3)="" "RTN","C0QMUERX",250,0) ; ^C0Q(301,48,1,"B",14,4)="" "RTN","C0QMUERX",251,0) ; "RTN","C0QMUERX",252,0) I $QS(C0QLIST,0)'="^C0Q" W:$G(C0QDEBUG) "Not Saving Patient "_C0QDFN,! QUIT "RTN","C0QMUERX",253,0) ; "RTN","C0QMUERX",254,0) ; Otherwise, prepare to save "RTN","C0QMUERX",255,0) N C0QFDA ; Fileman Data Array "RTN","C0QMUERX",256,0) N C0QIENS ; IENS "RTN","C0QMUERX",257,0) N L1,L2 ; Top Level, Level 2 "RTN","C0QMUERX",258,0) S L1=$QS(C0QLIST,2) ; Top Level IEN "RTN","C0QMUERX",259,0) S L2=$O(^C0Q(301,L1,1,"B",C0QDFN,"")) ; Patient IEN "RTN","C0QMUERX",260,0) S C0QIENS="?+1"_C0QDFN_","_L2_","_L1_"," ; TODO: Here C0QDFN is a dummy for uniqueness in FDA, not meaningful! - DO BETTER! "RTN","C0QMUERX",261,0) W:$G(C0QDEBUG) "IENs "_C0QIENS_" ready to file",! "RTN","C0QMUERX",262,0) W:$G(C0QDEBUG) "Saving "_TYPE_" of "_COUNT_" for Patient "_$P(^DPT(C0QDFN,0),U)_" ("_C0QDFN_")",! "RTN","C0QMUERX",263,0) S C0QFDA(1130580001.3111,C0QIENS,.01)=TYPE "RTN","C0QMUERX",264,0) S C0QFDA(1130580001.3111,C0QIENS,.02)=COUNT "RTN","C0QMUERX",265,0) ; "RTN","C0QMUERX",266,0) W:$G(C0QDEBUG) "Fileman Data Array",! "RTN","C0QMUERX",267,0) I $G(C0QDEBUG) N % S %=$NA(C0QFDA) F S %=$Q(@%) Q:%="" W %_": "_@%,! "RTN","C0QMUERX",268,0) ; "RTN","C0QMUERX",269,0) N C0QERR ; Errors "RTN","C0QMUERX",270,0) D UPDATE^DIE("","C0QFDA","","C0QERR") "RTN","C0QMUERX",271,0) ; "RTN","C0QMUERX",272,0) I $D(C0QERR) DO "RTN","C0QMUERX",273,0) . W "Error in filing data",! "RTN","C0QMUERX",274,0) . N % S %=$NAME(C0QERR) F S %=$Q(@%) Q:%="" W %_": "_@%,! "RTN","C0QMUERX",275,0) ; "RTN","C0QMUERX",276,0) QUIT "RTN","C0QMUERX",277,0) ; "RTN","C0QMUERX",278,0) COUNT(C0QLIST) ; $$ - Private; Count Numerator and Denominator for a Patient List "RTN","C0QMUERX",279,0) ; Input: C0QLIST - Pass by Value - Patient Listing B index (only C0Q(301,IEN,1,"B", listing is supported) "RTN","C0QMUERX",280,0) ; Output: (as string) NUMERATOR/DENOMINATOR "RTN","C0QMUERX",281,0) ; Optional Symtab input: C0QDEBUG to print out debug messages to STDOUT. "RTN","C0QMUERX",282,0) ; "RTN","C0QMUERX",283,0) I $QS(C0QLIST,0)'="^C0Q" W:$G(C0QDEBUG) "Counting for files other than C0Q(301, not supported ",! QUIT "0/0" "RTN","C0QMUERX",284,0) ; MEASURE ----------- "RTN","C0QMUERX",285,0) ; IEN ----------- | "RTN","C0QMUERX",286,0) ; L1 ------| | | "RTN","C0QMUERX",287,0) ; V V V "RTN","C0QMUERX",288,0) ; ^C0Q(301,48,1,2,1,1,0)="ERXDEN^0" "RTN","C0QMUERX",289,0) ; ^C0Q(301,48,1,2,1,2,0)="ERXNUM^0" "RTN","C0QMUERX",290,0) ; ^C0Q(301,48,1,2,1,"B","ERXDEN",1)="" "RTN","C0QMUERX",291,0) ; ^C0Q(301,48,1,2,1,"B","ERXNUM",2)="" "RTN","C0QMUERX",292,0) ; ^C0Q(301,48,1,2,1,"B" "RTN","C0QMUERX",293,0) W:$G(C0QDEBUG) "DFN",?20,"Denominator",?40,"Numerator",! "RTN","C0QMUERX",294,0) ; "RTN","C0QMUERX",295,0) N L1 S L1=$QS(C0QLIST,2) ; Top Level IEN "RTN","C0QMUERX",296,0) ; "RTN","C0QMUERX",297,0) N DENTOT,NUMTOT S (DENTOT,NUMTOT)=0 ; Denominator Total, Numerator Total "RTN","C0QMUERX",298,0) ; "RTN","C0QMUERX",299,0) N C0QDFN S C0QDFN=0 ; Walker through B index "RTN","C0QMUERX",300,0) F S C0QDFN=$O(^C0Q(301,L1,1,"B",C0QDFN)) Q:C0QDFN="" DO "RTN","C0QMUERX",301,0) . N IEN S IEN=$O(^(C0QDFN,"")) ; naked naked - get IEN from B index "RTN","C0QMUERX",302,0) . W:$G(C0QDEBUG) C0QDFN "RTN","C0QMUERX",303,0) . ; "RTN","C0QMUERX",304,0) . ; Denom Processing "RTN","C0QMUERX",305,0) . N DENIEN S DENIEN=$O(^C0Q(301,L1,1,IEN,1,"B","ERXDEN","")) ; Denom IEN "RTN","C0QMUERX",306,0) . N DEN S DEN=$S(DENIEN:$P(^C0Q(301,L1,1,IEN,1,DENIEN,0),U,2),1:"N/A") ; Denominator "RTN","C0QMUERX",307,0) . W:$G(C0QDEBUG) ?20,DEN "RTN","C0QMUERX",308,0) . S DENTOT=DENTOT+DEN ; Total it up (N/A becomes zero) "RTN","C0QMUERX",309,0) . ; "RTN","C0QMUERX",310,0) . N NUMIEN S NUMIEN=$O(^C0Q(301,L1,1,IEN,1,"B","ERXNUM","")) ; Numerator IEN "RTN","C0QMUERX",311,0) . N NUM S NUM=$S(NUMIEN:$P(^C0Q(301,L1,1,IEN,1,NUMIEN,0),U,2),1:"N/A") ; Numerator "RTN","C0QMUERX",312,0) . W:$G(C0QDEBUG) ?40,NUM "RTN","C0QMUERX",313,0) . S NUMTOT=NUMTOT+NUM ; Total it up (N/A becomes zero) "RTN","C0QMUERX",314,0) . ; "RTN","C0QMUERX",315,0) . w:$G(C0QDEBUG) ! "RTN","C0QMUERX",316,0) ; "RTN","C0QMUERX",317,0) ; Write the totals "RTN","C0QMUERX",318,0) D:$G(C0QDEBUG) "RTN","C0QMUERX",319,0) . W ?20,"===" "RTN","C0QMUERX",320,0) . W ?40,"===" "RTN","C0QMUERX",321,0) . W ! "RTN","C0QMUERX",322,0) . ; "RTN","C0QMUERX",323,0) . W ?20,DENTOT "RTN","C0QMUERX",324,0) . W ?40,NUMTOT "RTN","C0QMUERX",325,0) . W ! "RTN","C0QMUERX",326,0) ; "RTN","C0QMUERX",327,0) ; Quit with Numeartor/Denominator "RTN","C0QMUERX",328,0) QUIT NUMTOT_"/"_DENTOT "RTN","C0QP1") 0^^B541099 "RTN","C0QP1",1,0) C0QP1 ; VEN/SMH - Inits for Patch 1 ; 6/13/12 5:33pm "RTN","C0QP1",2,0) ;;1.0;C0Q;;May 21, 2012;Build 29 "RTN","C0QP1",3,0) ; "RTN","C0QP1",4,0) POST ; Post-Install hook for Patch 1; PEP "RTN","C0QP1",5,0) ; Fire off the new x-refs for entries in the parameter file "RTN","C0QP1",6,0) N C0QI S C0QI=0 ; Walk through starting with number 1 "RTN","C0QP1",7,0) F S C0QI=$O(^C0Q(401,C0QI)) Q:'C0QI D "RTN","C0QP1",8,0) . N DA,DIK S DIK="^C0Q(401,",DIK(1)="2^AMMS",DA=C0QI D EN^DIK "RTN","C0QP1",9,0) . N DA,DIK S DIK="^C0Q(401,",DIK(1)="2.1^AQMS",DA=C0QI D EN^DIK "RTN","C0QP1",10,0) QUIT "RTN","C0QUPDT") 0^2^B79261186 "RTN","C0QUPDT",1,0) C0QUPDT ; GPL - Quality Reporting List Update Routines ; 6/13/12 12:42pm "RTN","C0QUPDT",2,0) ;;1.0;C0Q;;May 21, 2012;Build 29 "RTN","C0QUPDT",3,0) ;Copyright 2009 George Lilly. Licensed under the terms of the GNU "RTN","C0QUPDT",4,0) ;General Public License See attached copy of the License. "RTN","C0QUPDT",5,0) ; "RTN","C0QUPDT",6,0) ;This program is free software; you can redistribute it and/or modify "RTN","C0QUPDT",7,0) ;it under the terms of the GNU General Public License as published by "RTN","C0QUPDT",8,0) ;the Free Software Foundation; either version 2 of the License, or "RTN","C0QUPDT",9,0) ;(at your option) any later version. "RTN","C0QUPDT",10,0) ; "RTN","C0QUPDT",11,0) ;This program is distributed in the hope that it will be useful, "RTN","C0QUPDT",12,0) ;but WITHOUT ANY WARRANTY; without even the implied warranty of "RTN","C0QUPDT",13,0) ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the "RTN","C0QUPDT",14,0) ;GNU General Public License for more details. "RTN","C0QUPDT",15,0) ; "RTN","C0QUPDT",16,0) ;You should have received a copy of the GNU General Public License along "RTN","C0QUPDT",17,0) ;with this program; if not, write to the Free Software Foundation, Inc., "RTN","C0QUPDT",18,0) ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. "RTN","C0QUPDT",19,0) ; "RTN","C0QUPDT",20,0) Q "RTN","C0QUPDT",21,0) ; "RTN","C0QUPDT",22,0) C0QQFN() Q 1130580001.101 ; FILE NUMBER FOR C0Q QUALITY MEASURE FILE "RTN","C0QUPDT",23,0) C0QMFN() Q 1130580001.201 ; FILE NUMBER FOR C0Q MEASUREMENT FILE "RTN","C0QUPDT",24,0) C0QMMFN() Q 1130580001.2011 ; FN FOR MEASURE SUBFILE "RTN","C0QUPDT",25,0) C0QMMNFN() Q 1130580001.20111 ; FN FOR NUMERATOR SUBFILE "RTN","C0QUPDT",26,0) C0QMMDFN() Q 1130580001.20112 ; FN FOR DENOMINATOR SUBFILE "RTN","C0QUPDT",27,0) RLSTFN() Q 810.5 ; FN FOR REMINDER PATIENT LIST FILE "RTN","C0QUPDT",28,0) RLSTPFN() Q 810.53 ; FN FOR REMINDER PATIENT LIST PATIENT SUBFILE "RTN","C0QUPDT",29,0) C0QPLF() Q 1130580001.301 ; C0Q PATIENT LIST FILE "RTN","C0QUPDT",30,0) C0QALFN() Q 1130580001.311 ; FILE NUMBER FOR C0Q PATIENT LIST PATIENT SUBFILE ; "RTN","C0QUPDT",31,0) ; "RTN","C0QUPDT",32,0) UPDATE(RNT,MSET) ; UPDATE A MEASURE SET BY ADDING NEW ENTRIES TO PATIENT "RTN","C0QUPDT",33,0) ; LISTS AND DELETING ENTRIES THAT ARE NO LONGER VALID. ALSO UPDATE "RTN","C0QUPDT",34,0) ; NUMERATOR AND DENOMINATOR COUNTS "RTN","C0QUPDT",35,0) ; MAKES HEAVY USE OF UNITY^C0QSET TO DETERMINE WHAT TO ADD AND DELETE "RTN","C0QUPDT",36,0) ; "RTN","C0QUPDT",37,0) ; THIS IS A REPLACEMENT FOR C0QRPC^C0QMAIN WHICH DELETES THE PATIENT "RTN","C0QUPDT",38,0) ; LISTS AND RECREATES THEM, WHICH IS A LOT OF UNNECESSARY PROCESSING "RTN","C0QUPDT",39,0) ; "RTN","C0QUPDT",40,0) N ZI S ZI="" "RTN","C0QUPDT",41,0) N C0QM ; FOR HOLDING THE MEASURES IN THE SET "RTN","C0QUPDT",42,0) I $$GET1^DIQ($$C0QMFN,MSET_",",.05,"I")="Y" D Q ; IS IT LOCKED? "RTN","C0QUPDT",43,0) . W !,"ERROR MEASURE SET IS LOCKED, EXITING" "RTN","C0QUPDT",44,0) D LIST^DIC($$C0QMMFN,","_MSET_",",".01I;1.2I;2.2I") ; GET ALL THE MEASURES "RTN","C0QUPDT",45,0) D DELIST("C0QM") "RTN","C0QUPDT",46,0) N ZII S ZII="" "RTN","C0QUPDT",47,0) F S ZII=$O(C0QM(ZII)) Q:ZII="" D ; FOR EACH MEASURE "RTN","C0QUPDT",48,0) . ; "RTN","C0QUPDT",49,0) . ; Special processing for eRx measure. "RTN","C0QUPDT",50,0) . I $$GET1^DIQ(1130580001.101,+C0QM(ZII)_",",4,"I")="E" D ERXCOUNT(MSET,ZII) Q "RTN","C0QUPDT",51,0) . ; "RTN","C0QUPDT",52,0) . ; Otherwise, we go on "RTN","C0QUPDT",53,0) . N C0QNL,C0QDL,C0QFLTN,C0QFLTD "RTN","C0QUPDT",54,0) . S C0QFLTN=$P(C0QM(ZII),U,3) ;IEN OF NUMERATOR FILTER LIST "RTN","C0QUPDT",55,0) . S C0QFLTD=$P(C0QM(ZII),U,4) ; IEN OF DENOMINATOR FILTER LIST "RTN","C0QUPDT",56,0) . S ZI=$P(C0QM(ZII),U,1) ; IEN OF THE MEASURE IN THE C0Q QUALITY MEAS FILE "RTN","C0QUPDT",57,0) . ; "RTN","C0QUPDT",58,0) . ; Numerator "RTN","C0QUPDT",59,0) . S C0QNL=$$GET1^DIQ($$C0QQFN,ZI_",",1,"I") ; NUMERATOR POINTER "RTN","C0QUPDT",60,0) . I C0QNL="" D ; CHECK ALTERNATE LIST "RTN","C0QUPDT",61,0) . . S C0QNL=$$GET1^DIQ($$C0QQFN,ZI_",",1.1,"I") ; NUMERATOR POINTER "RTN","C0QUPDT",62,0) . . I C0QNL'="" S C0QNALT=1 "RTN","C0QUPDT",63,0) . I C0QNL="" QUIT ; No Numerator. Can't perform calculation.--smh "RTN","C0QUPDT",64,0) . ; "RTN","C0QUPDT",65,0) . ; Denominator "RTN","C0QUPDT",66,0) . S C0QDL=$$GET1^DIQ($$C0QQFN,ZI_",",2,"I") ; DENOMINATOR POINTER "RTN","C0QUPDT",67,0) . I C0QDL="" D ; CHECK ALTERNATE LIST "RTN","C0QUPDT",68,0) . . S C0QDL=$$GET1^DIQ($$C0QQFN,ZI_",",2.1,"I") ; DENOMINATOR POINTER "RTN","C0QUPDT",69,0) . . I C0QDL'="" S C0QDALT=1 "RTN","C0QUPDT",70,0) . I C0QDL="" QUIT ; No Denominator. Can't perform calcuation.--smh "RTN","C0QUPDT",71,0) . ; "RTN","C0QUPDT",72,0) . ; FIRST PROCESS THE NUMERATOR "RTN","C0QUPDT",73,0) . ; "RTN","C0QUPDT",74,0) . N C0QNEW ; REFERENCE TO NEW NUMBERATOR LIST B INDEX "RTN","C0QUPDT",75,0) . I $G(C0QNALT)=1 D ; USING ALTERNATE LIST FOR NUMERATOR "RTN","C0QUPDT",76,0) . . S C0QNEW=$NA(^C0Q(301,C0QNL,1,"B")) ; B INDEX FOR THIS LIST "RTN","C0QUPDT",77,0) . E D ; USE THE REMINDER PACKAGE PATIENT LISTS "RTN","C0QUPDT",78,0) . . S C0QNEW=$NA(^PXRMXP(810.5,C0QNL,30,"B")) ; REMINDER LIST PATIENTS "RTN","C0QUPDT",79,0) . I C0QFLTN'="" D ; USE A NUMERATOR FILTER LIST "RTN","C0QUPDT",80,0) . . N ZNEW "RTN","C0QUPDT",81,0) . . S ZNEW=$NA(^C0Q(301,C0QFLTN,1,"B")) ; B INDEX OF FILTER LIST "RTN","C0QUPDT",82,0) . . K C0QFLTRD "RTN","C0QUPDT",83,0) . . D AND^C0QSET("C0QFLTRD",ZNEW,C0QNEW) "RTN","C0QUPDT",84,0) . . S C0QNEW="C0QFLTRD" "RTN","C0QUPDT",85,0) . N C0QOLD ; REFERENCE FOR OLD PATIENT LIST "RTN","C0QUPDT",86,0) . S C0QOLD=$NA(^C0Q(201,MSET,5,ZII,1,"B")) ; NUMERATOR LIST IN MEASURE SET "RTN","C0QUPDT",87,0) . N C0QRSLT ; ARRAY FOR THE UNITY DIFFERENCES "RTN","C0QUPDT",88,0) . D UNITY^C0QSET("C0QRSLT",C0QNEW,C0QOLD) ; FIND THE DIFFERENCES "RTN","C0QUPDT",89,0) . N C0QCNT "RTN","C0QUPDT",90,0) . S C0QNCNT=$G(C0QRSLT("COUNT")) "RTN","C0QUPDT",91,0) . I C0QNCNT="" D ; "RTN","C0QUPDT",92,0) . . S C0QNCNT=0 ; DEFAULT COUNT IS ZERO "RTN","C0QUPDT",93,0) . . N GZZ S GZZ="" "RTN","C0QUPDT",94,0) . . F S GZZ=$O(C0QRSLT(0,GZZ)) Q:GZZ="" D ; EVERY ADD ENTRY "RTN","C0QUPDT",95,0) . . . S C0QNCNT=C0QNCNT+1 "RTN","C0QUPDT",96,0) . . F S GZZ=$O(C0QRSLT(1,GZZ)) Q:GZZ="" D ; EVERY EQUAL ENTRY "RTN","C0QUPDT",97,0) . . . S C0QNCNT=C0QNCNT+1 "RTN","C0QUPDT",98,0) . K C0QFDA ; CLEAR THE FDA "RTN","C0QUPDT",99,0) . N C0QONCNT ; OLD COUNT "RTN","C0QUPDT",100,0) . S C0QONCNT=$$GET1^DIQ($$C0QMMFN(),ZII_","_MSET_",",1.1) "RTN","C0QUPDT",101,0) . I C0QNCNT'=C0QONCNT D ; COUNT HAS CHANGED "RTN","C0QUPDT",102,0) . . S C0QFDA($$C0QMMFN(),ZII_","_MSET_",",1.1)=C0QNCNT ; NUMERATOR COUNT "RTN","C0QUPDT",103,0) . . D UPDIE ; UPDATE THE NUMERATOR COUNT "RTN","C0QUPDT",104,0) . I $D(C0QRSLT) D ;B ; "RTN","C0QUPDT",105,0) . . ;ZWR C0QRSLT "RTN","C0QUPDT",106,0) . ; FIRST PROCESS DELETIONS "RTN","C0QUPDT",107,0) . K C0QFDA ; CLEAR OUT THE FDA "RTN","C0QUPDT",108,0) . N ZG,ZIEN S ZG="" "RTN","C0QUPDT",109,0) . F S ZG=$O(C0QRSLT(2,ZG)) Q:ZG="" D ; FOR EACH DELETION "RTN","C0QUPDT",110,0) . . S ZIEN=$O(@C0QOLD@(ZG,"")) ; IEN OF THE ENTRY "RTN","C0QUPDT",111,0) . . I ZIEN="" D Q ; OOPS "RTN","C0QUPDT",112,0) . . . W !,"ERROR DELETING ENTRY!! ",ZG "RTN","C0QUPDT",113,0) . . S C0QFDA($$C0QMMNFN(),ZIEN_","_ZII_","_MSET_",",.01)="@" ; DELETE "RTN","C0QUPDT",114,0) . I $D(C0QFDA) D UPDIE ; PROCESS "RTN","C0QUPDT",115,0) . ; SECOND, PROCESS ADDITIONS "RTN","C0QUPDT",116,0) . K C0QFDA ; CLEAR OUT THE FDA "RTN","C0QUPDT",117,0) . N ZG,ZC S ZG="" S ZC=1 "RTN","C0QUPDT",118,0) . F S ZG=$O(C0QRSLT(0,ZG)) Q:ZG="" D ; FOR EACH ADDITION "RTN","C0QUPDT",119,0) . . S C0QFDA($$C0QMMNFN(),"+"_ZC_","_ZII_","_MSET_",",.01)=ZG ; ADD THE ENTRY "RTN","C0QUPDT",120,0) . . S ZC=ZC+1 "RTN","C0QUPDT",121,0) . I $D(C0QFDA) D UPDIE ; PROCESS "RTN","C0QUPDT",122,0) . ; "RTN","C0QUPDT",123,0) . ; PROCESS THE DENOMINATOR "RTN","C0QUPDT",124,0) . ; "RTN","C0QUPDT",125,0) . N C0QNEW ; REFERENCE TO NEW NUMBERATOR LIST B INDEX "RTN","C0QUPDT",126,0) . I $G(C0QNALT)=1 D ; USING ALTERNATE LIST FOR NUMERATOR "RTN","C0QUPDT",127,0) . . S C0QNEW=$NA(^C0Q(301,C0QDL,1,"B")) ; B INDEX FOR THIS LIST "RTN","C0QUPDT",128,0) . E D ; USE THE REMINDER PACKAGE PATIENT LISTS "RTN","C0QUPDT",129,0) . . S C0QNEW=$NA(^PXRMXP(810.5,C0QDL,30,"B")) ; REMINDER LIST PATIENTS "RTN","C0QUPDT",130,0) . I C0QFLTD'="" D ; USE A DENOMINATOR FILTER LIST "RTN","C0QUPDT",131,0) . . N ZNEW "RTN","C0QUPDT",132,0) . . S ZNEW=$NA(^C0Q(301,C0QFLTD,1,"B")) ; B INDEX OF FILTER LIST "RTN","C0QUPDT",133,0) . . K C0QFLTRD "RTN","C0QUPDT",134,0) . . D AND^C0QSET("C0QFLTRD",ZNEW,C0QNEW) "RTN","C0QUPDT",135,0) . . S C0QNEW="C0QFLTRD" "RTN","C0QUPDT",136,0) . N C0QOLD ; REFERENCE FOR OLD PATIENT LIST "RTN","C0QUPDT",137,0) . S C0QOLD=$NA(^C0Q(201,MSET,5,ZII,3,"B")) ; DENOMINATOR LIST IN MEASURE SET "RTN","C0QUPDT",138,0) . N C0QRSLT ; ARRAY FOR THE UNITY DIFFERENCES "RTN","C0QUPDT",139,0) . D UNITY^C0QSET("C0QRSLT",C0QNEW,C0QOLD) ; FIND THE DIFFERENCES "RTN","C0QUPDT",140,0) . N C0QDCNT "RTN","C0QUPDT",141,0) . S C0QDCNT=$G(C0QRSLT("COUNT")) "RTN","C0QUPDT",142,0) . I C0QDCNT="" D ; "RTN","C0QUPDT",143,0) . . S C0QDCNT=0 ; DEFAULT COUNT IS ZERO "RTN","C0QUPDT",144,0) . . N GZZ S GZZ="" "RTN","C0QUPDT",145,0) . . F S GZZ=$O(C0QRSLT(0,GZZ)) Q:GZZ="" D ; EVERY ADD ENTRY "RTN","C0QUPDT",146,0) . . . S C0QDCNT=C0QDCNT+1 "RTN","C0QUPDT",147,0) . . F S GZZ=$O(C0QRSLT(1,GZZ)) Q:GZZ="" D ; EVERY EQUAL ENTRY "RTN","C0QUPDT",148,0) . . . S C0QDCNT=C0QDCNT+1 "RTN","C0QUPDT",149,0) . K C0QFDA ; CLEAR THE FDA "RTN","C0QUPDT",150,0) . N C0QODCNT ; OLD COUNT "RTN","C0QUPDT",151,0) . S C0QODCNT=$$GET1^DIQ($$C0QMMFN(),ZII_","_MSET_",",2.1) "RTN","C0QUPDT",152,0) . I C0QDCNT'=C0QODCNT D ; COUNT HAS CHANGED "RTN","C0QUPDT",153,0) . . S C0QFDA($$C0QMMFN(),ZII_","_MSET_",",2.1)=C0QDCNT ; DENOMINATOR COUNT "RTN","C0QUPDT",154,0) . . D UPDIE ; UPDATE THE DENOMINATOR COUNT "RTN","C0QUPDT",155,0) . I $D(C0QRSLT) D ;B ; "RTN","C0QUPDT",156,0) . . ;ZWR C0QRSLT "RTN","C0QUPDT",157,0) . I '$D(C0QRSLT) Q ; NO RESULTS TO USE "RTN","C0QUPDT",158,0) . ; FIRST PROCESS DELETIONS "RTN","C0QUPDT",159,0) . K C0QFDA ; CLEAR OUT THE FDA "RTN","C0QUPDT",160,0) . N ZG,ZIEN S ZG="" "RTN","C0QUPDT",161,0) . F S ZG=$O(C0QRSLT(2,ZG)) Q:ZG="" D ; FOR EACH DELETION "RTN","C0QUPDT",162,0) . . S ZIEN=$O(@C0QOLD@(ZG,"")) ; IEN OF THE ENTRY "RTN","C0QUPDT",163,0) . . I ZIEN="" D Q ; OOPS "RTN","C0QUPDT",164,0) . . . W !,"ERROR DELETING ENTRY!! ",ZG "RTN","C0QUPDT",165,0) . . S C0QFDA($$C0QMMDFN(),ZIEN_","_ZII_","_MSET_",",.01)="@" ; DELETE "RTN","C0QUPDT",166,0) . I $D(C0QFDA) D UPDIE ; PROCESS "RTN","C0QUPDT",167,0) . ; SECOND, PROCESS ADDITIONS "RTN","C0QUPDT",168,0) . K C0QFDA ; CLEAR OUT THE FDA "RTN","C0QUPDT",169,0) . N ZG,ZC S ZG="" S ZC=1 "RTN","C0QUPDT",170,0) . F S ZG=$O(C0QRSLT(0,ZG)) Q:ZG="" D ; FOR EACH ADDITION "RTN","C0QUPDT",171,0) . . S C0QFDA($$C0QMMDFN(),"+"_ZC_","_ZII_","_MSET_",",.01)=ZG ; ADD THE ENTRY "RTN","C0QUPDT",172,0) . . S ZC=ZC+1 "RTN","C0QUPDT",173,0) . I $D(C0QFDA) D UPDIE ; PROCESS "RTN","C0QUPDT",174,0) . ; "RTN","C0QUPDT",175,0) . ; File Percentage "RTN","C0QUPDT",176,0) . N C0QPCT ; PERCENT "RTN","C0QUPDT",177,0) . D ; "RTN","C0QUPDT",178,0) . . I C0QDCNT>0 D ; "RTN","C0QUPDT",179,0) . . . S C0QPCT=$J(100*C0QNCNT/C0QDCNT,0,0) "RTN","C0QUPDT",180,0) . . E S C0QPCT=0 "RTN","C0QUPDT",181,0) . . K C0QFDA "RTN","C0QUPDT",182,0) . . S C0QFDA($$C0QMMFN(),ZII_","_MSET_",",3)=C0QPCT ; PERCENT "RTN","C0QUPDT",183,0) . . D UPDIE "RTN","C0QUPDT",184,0) Q "RTN","C0QUPDT",185,0) ; "RTN","C0QUPDT",186,0) DELIST(RTN) ; DECODES ^TMP("DILIST",$J) INTO "RTN","C0QUPDT",187,0) ; @RTN@(IEN)=INTERNAL VALUE^EXTERNAL VALUE "RTN","C0QUPDT",188,0) ; ADDED A B INDEX @RTN@("B",INTERNAL VALUE,IEN)=EXTERNAL VALUE "RTN","C0QUPDT",189,0) N ZI,IV,EV,ZDI,ZIEN,FLTN,FLTD "RTN","C0QUPDT",190,0) S ZI="" "RTN","C0QUPDT",191,0) S ZDI=$NA(^TMP("DILIST",$J)) "RTN","C0QUPDT",192,0) K @RTN "RTN","C0QUPDT",193,0) F S ZI=$O(@ZDI@(1,ZI)) Q:ZI="" D ; "RTN","C0QUPDT",194,0) . S EV=@ZDI@(1,ZI) ;EXTERNAL VALUE "RTN","C0QUPDT",195,0) . S IV=$G(@ZDI@("ID",ZI,.01)) ; INTERNAL VALUE "RTN","C0QUPDT",196,0) . S FLTN=$G(@ZDI@("ID",ZI,1.2)) ; NUMERATOR FILTER LIST "RTN","C0QUPDT",197,0) . S FLTD=$G(@ZDI@("ID",ZI,2.2)) ; DENOMINATOR FILTER LIST "RTN","C0QUPDT",198,0) . S ZIEN=@ZDI@(2,ZI) ; IEN "RTN","C0QUPDT",199,0) . S @RTN@(ZIEN)=IV_"^"_EV_"^"_FLTN_"^"_FLTD "RTN","C0QUPDT",200,0) . ;S @RTN@("B",IV,ZIEN)=EV "RTN","C0QUPDT",201,0) Q "RTN","C0QUPDT",202,0) ; "RTN","C0QUPDT",203,0) UPDIE ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS "RTN","C0QUPDT",204,0) K ZERR "RTN","C0QUPDT",205,0) D CLEAN^DILF "RTN","C0QUPDT",206,0) N % S %=$NA(C0QFDA) F S %=$Q(@%) Q:%="" W %_"="_@%,! ; smh instead of zwrite "RTN","C0QUPDT",207,0) D UPDATE^DIE("","C0QFDA","","ZERR") "RTN","C0QUPDT",208,0) I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST, INVOKE THE ERROR TRAP IF TASKED "RTN","C0QUPDT",209,0) ;. W "ERROR",! "RTN","C0QUPDT",210,0) ;. ZWR ZERR "RTN","C0QUPDT",211,0) ;. B "RTN","C0QUPDT",212,0) K C0QFDA "RTN","C0QUPDT",213,0) Q "RTN","C0QUPDT",214,0) ; "RTN","C0QUPDT",215,0) ERXCOUNT(MSETIEN,MIEN) ; Private Proc; Get eRx and file as Numerator, Denominator, and % "RTN","C0QUPDT",216,0) ; Inputs: "RTN","C0QUPDT",217,0) ; MSETIEN - Measurement Set IEN - By Value "RTN","C0QUPDT",218,0) ; MIEN - Measurement IEN inside the Measurement Set - By Value "RTN","C0QUPDT",219,0) ; "RTN","C0QUPDT",220,0) ; Optional Symtab input: C0QDEBUG to print out debug messages to STDOUT. "RTN","C0QUPDT",221,0) ; "RTN","C0QUPDT",222,0) ; No check is done to see if the caller is sending bad data. Measurement must be "RTN","C0QUPDT",223,0) ; in a subfile under Measurement Set. "RTN","C0QUPDT",224,0) ; "RTN","C0QUPDT",225,0) W:$G(C0QDEBUG) "Processing E-Prescribing Counts",! "RTN","C0QUPDT",226,0) ; Example of Data we go through in the C0Q Parameter File, so the code below "RTN","C0QUPDT",227,0) ; will make sense. "RTN","C0QUPDT",228,0) ; ^C0Q(401,"AMMS",2,1)="" "RTN","C0QUPDT",229,0) ; ^C0Q(401,"AMMS",2,2)="" "RTN","C0QUPDT",230,0) ; ^C0Q(401,"AQMS",6,2)="" "RTN","C0QUPDT",231,0) ; ^C0Q(401,"B","INPATIENT",2)="" "RTN","C0QUPDT",232,0) ; ^C0Q(401,"B","OUTPATIENT",1)="" "RTN","C0QUPDT",233,0) ; ^C0Q(401,"MU","MU12",1)="" "RTN","C0QUPDT",234,0) ; ^C0Q(401,"MU","MU12",2)="" "RTN","C0QUPDT",235,0) ; ^C0Q(401,"MUTYP","MU12","EP",1)="" "RTN","C0QUPDT",236,0) ; ^C0Q(401,"MUTYP","MU12","INP",2)="" "RTN","C0QUPDT",237,0) ; "RTN","C0QUPDT",238,0) ; Get Parameter year from the Parameters file. "RTN","C0QUPDT",239,0) ; 1. Get parameter associated with this measurement set from AMMS x-ref (new in C0Q*1*1). "RTN","C0QUPDT",240,0) N C0QPARAM "RTN","C0QUPDT",241,0) N % S %="" F S %=$O(^C0Q(401,"AMMS",MSETIEN,%)) Q:%="" S C0QPARAM(%)="" "RTN","C0QUPDT",242,0) ; "RTN","C0QUPDT",243,0) ; 2. Find the year for each of those--store as value of node; IEN still subscript. "RTN","C0QUPDT",244,0) N % S %="" F S %=$O(C0QPARAM(%)) Q:%="" S C0QPARAM(%)=$$GET1^DIQ(1130580001.401,%_",",.02) "RTN","C0QUPDT",245,0) ; "RTN","C0QUPDT",246,0) ; 3. Now make sure that this parameter that point to an Outpatient Parameters "RTN","C0QUPDT",247,0) ; WARNING: CONFUSING CODE WRITTEN BY ME AHEAD "RTN","C0QUPDT",248,0) ; The % loop will stop with a valid value if found; % is used in the lines immediately below "RTN","C0QUPDT",249,0) N % S %="" F S %=$O(C0QPARAM(%)) Q:%="" Q:$D(^C0Q(401,"MUTYP",C0QPARAM(%),"EP",%)) "RTN","C0QUPDT",250,0) ; "RTN","C0QUPDT",251,0) ; 4. If % has a valid IEN (there can be multiple, we take the first), then off we go. "RTN","C0QUPDT",252,0) ; Otherwise, if it is back to "", we quit. "RTN","C0QUPDT",253,0) N MUYEAR "RTN","C0QUPDT",254,0) IF '% W "No suitable parameter found. Cannot determine Measurement Year.",! QUIT "RTN","C0QUPDT",255,0) ELSE S MUYEAR=C0QPARAM(%) "RTN","C0QUPDT",256,0) ; "RTN","C0QUPDT",257,0) ; Now, based on the MU year, construct the patient list name that has the eRx data. "RTN","C0QUPDT",258,0) N LISTNAME S LISTNAME=MUYEAR_"-"_"EP"_"-"_"HasERX" "RTN","C0QUPDT",259,0) ; "RTN","C0QUPDT",260,0) ; Call the API in C0QMUERX to get the counts already calculated "RTN","C0QUPDT",261,0) ; Data is returned NUM/DEN "RTN","C0QUPDT",262,0) N COUNTS S COUNTS=$$COUNT^C0QMUERX($$PATLN^C0QMU12(LISTNAME)) "RTN","C0QUPDT",263,0) ; "RTN","C0QUPDT",264,0) ; File the count "RTN","C0QUPDT",265,0) N NUM S NUM=$P(COUNTS,"/") ; Numerator "RTN","C0QUPDT",266,0) N DEN S DEN=$P(COUNTS,"/",2) ; Denominator "RTN","C0QUPDT",267,0) ; "RTN","C0QUPDT",268,0) ; Prepare FDA "RTN","C0QUPDT",269,0) N C0QFDA,C0QERR "RTN","C0QUPDT",270,0) S C0QFDA($$C0QMMFN(),MIEN_","_MSETIEN_",",1.1)=NUM ; Numerator "RTN","C0QUPDT",271,0) S C0QFDA($$C0QMMFN(),MIEN_","_MSETIEN_",",2.1)=DEN ; Denominator "RTN","C0QUPDT",272,0) S C0QFDA($$C0QMMFN(),MIEN_","_MSETIEN_",",3)=$S(DEN=0:0,1:$J(100*NUM/DEN,0,0)) ; Percentage; avoid dividing by zero! "RTN","C0QUPDT",273,0) ; "RTN","C0QUPDT",274,0) ; File FDA using Filer not updater (editing existing entry only) "RTN","C0QUPDT",275,0) D FILE^DIE("ET",$NAME(C0QFDA),$NAME(C0QERR)) ; Flags: External, Transaction "RTN","C0QUPDT",276,0) ; "RTN","C0QUPDT",277,0) ; If error, print it out "RTN","C0QUPDT",278,0) I $D(C0QERR) DO "RTN","C0QUPDT",279,0) . W "Error filing data",! "RTN","C0QUPDT",280,0) . N % S %=$NAME(C0QERR) F S %=$Q(@%) Q:%="" W %_": "_@%,! "RTN","C0QUPDT",281,0) ; "RTN","C0QUPDT",282,0) QUIT "SEC","^DD",1130580001.101,1130580001.101,3.1,9) "SEC","^DIC",1130580001.101,1130580001.101,0,"AUDIT") @ "SEC","^DIC",1130580001.101,1130580001.101,0,"DD") @ "SEC","^DIC",1130580001.101,1130580001.101,0,"DEL") @ "SEC","^DIC",1130580001.101,1130580001.101,0,"LAYGO") @ "SEC","^DIC",1130580001.101,1130580001.101,0,"RD") @ "SEC","^DIC",1130580001.101,1130580001.101,0,"WR") @ "VER") 8.0^22.0 "^DD",1130580001.101,1130580001.101,0) FIELD^^4^16 "^DD",1130580001.101,1130580001.101,0,"DDA") N "^DD",1130580001.101,1130580001.101,0,"DT") 3120530 "^DD",1130580001.101,1130580001.101,0,"ID",.7) W:$D(^(5)) " ",$P(^(5),U,1) "^DD",1130580001.101,1130580001.101,0,"IX","B",1130580001.101,.01) "^DD",1130580001.101,1130580001.101,0,"NM","C0Q QUALITY MEASURE") "^DD",1130580001.101,1130580001.101,0,"PT",1130580001.2011,.01) "^DD",1130580001.101,1130580001.101,0,"VRPK") C0Q "^DD",1130580001.101,1130580001.101,.01,0) NAME^RF^^0;1^K:$L(X)>30!($L(X)<1)!'(X'?1P.E) X "^DD",1130580001.101,1130580001.101,.01,.1) MEASURE NAME "^DD",1130580001.101,1130580001.101,.01,1,0) ^.1 "^DD",1130580001.101,1130580001.101,.01,1,1,0) 1130580001.101^B "^DD",1130580001.101,1130580001.101,.01,1,1,1) S ^C0Q(101,"B",$E(X,1,30),DA)="" "^DD",1130580001.101,1130580001.101,.01,1,1,2) K ^C0Q(101,"B",$E(X,1,30),DA) "^DD",1130580001.101,1130580001.101,.01,3) Answer must be 1-30 characters in length "^DD",1130580001.101,1130580001.101,.01,"DT") 3101012 "^DD",1130580001.101,1130580001.101,.3,0) MU YEAR KEY^F^^7;6^K:$L(X)>30!($L(X)<1) X "^DD",1130580001.101,1130580001.101,.3,.1) MEANINGFUL USE YEAR KEY "^DD",1130580001.101,1130580001.101,.3,3) Answer must be 1-30 characters in length. "^DD",1130580001.101,1130580001.101,.3,"DT") 3111201 "^DD",1130580001.101,1130580001.101,.5,0) TITLE^F^^1;1^K:$L(X)>240!($L(X)<3) X "^DD",1130580001.101,1130580001.101,.5,.1) MEASURE TITLE "^DD",1130580001.101,1130580001.101,.5,3) Answer must be 3-240 characters in length "^DD",1130580001.101,1130580001.101,.5,"DT") 3110430 "^DD",1130580001.101,1130580001.101,.61,0) VERY LONG DESCRIPTION^1130580001.111^^6;0 "^DD",1130580001.101,1130580001.101,.7,0) DISPLAY NAME^F^^5;1^K:$L(X)>240!($L(X)<3) X "^DD",1130580001.101,1130580001.101,.7,.1) QRDA DISPLAY NAME "^DD",1130580001.101,1130580001.101,.7,3) Answer must be 3-240 characters in length "^DD",1130580001.101,1130580001.101,.7,"DT") 3101012 "^DD",1130580001.101,1130580001.101,.8,0) REPORTING NAME^F^^7;1^K:$L(X)>30!($L(X)<3) X "^DD",1130580001.101,1130580001.101,.8,.1) REPORTING MEASURE NAME "^DD",1130580001.101,1130580001.101,.8,3) Answer must be 3-30 characters in length "^DD",1130580001.101,1130580001.101,.8,"DT") 3110615 "^DD",1130580001.101,1130580001.101,1,0) NUMERATOR PATIENT LIST^P810.5'^PXRMXP(810.5,^0;2^Q "^DD",1130580001.101,1130580001.101,1,.1) MEASURE NUMERATOR PATIENT LIST "^DD",1130580001.101,1130580001.101,1,"DT") 3101012 "^DD",1130580001.101,1130580001.101,1.1,0) ALTERNATIVE NUMERATOR LIST^P1130580001.301'^C0Q(301,^7;2^Q "^DD",1130580001.101,1130580001.101,1.1,"DT") 3110805 "^DD",1130580001.101,1130580001.101,1.5,0) NEGATIVE NUMERATOR LIST^P810.5'^PXRMXP(810.5,^7;4^Q "^DD",1130580001.101,1130580001.101,1.5,.1) LIST OF PATIENTS THAT DO NOT MEET THE REQUIREMENTS "^DD",1130580001.101,1130580001.101,1.5,"DT") 3110809 "^DD",1130580001.101,1130580001.101,1.51,0) ALTERNATE NEGATIVE NUM LIST^P1130580001.301'^C0Q(301,^7;5^Q "^DD",1130580001.101,1130580001.101,1.51,.1) NEGATIVE NUMERATOR LIST IN C0Q PATIENT LIST FILE "^DD",1130580001.101,1130580001.101,1.51,"DT") 3110809 "^DD",1130580001.101,1130580001.101,2,0) DENOMINATOR PATIENT LIST^P810.5'^PXRMXP(810.5,^0;3^Q "^DD",1130580001.101,1130580001.101,2,.1) MEASURE DENOMINATOR PATIENT LIST "^DD",1130580001.101,1130580001.101,2,"DT") 3101012 "^DD",1130580001.101,1130580001.101,2.1,0) ALTERNATIVE DENOMINATOR LIST^P1130580001.301'^C0Q(301,^7;3^Q "^DD",1130580001.101,1130580001.101,2.1,"DT") 3110805 "^DD",1130580001.101,1130580001.101,3,0) QRDA TEMPLATE ROOT^F^^0;4^K:$L(X)>120!($L(X)<3) X "^DD",1130580001.101,1130580001.101,3,.1) MEASURE TEMPLATE ROOT FOR QRDA DOCUMENT "^DD",1130580001.101,1130580001.101,3,3) Answer must be 3-120 characters in length "^DD",1130580001.101,1130580001.101,3,"DT") 3101012 "^DD",1130580001.101,1130580001.101,3.1,0) QRDA MEASURE SYSTEM OID^CJ^^ ; ^S X="2.16.840.1.113883.3.249.12" "^DD",1130580001.101,1130580001.101,3.1,.1) QRDA SYSTEM OID (FIXED) "^DD",1130580001.101,1130580001.101,3.1,9.01) "^DD",1130580001.101,1130580001.101,3.1,9.1) S X="2.16.840.1.113883.3.249.12" "^DD",1130580001.101,1130580001.101,3.1,"DT") 3101012 "^DD",1130580001.101,1130580001.101,3.2,0) QRDA CODE^F^^4;1^K:$L(X)>80!($L(X)<1) X "^DD",1130580001.101,1130580001.101,3.2,.1) QRDA MEASURE CODE "^DD",1130580001.101,1130580001.101,3.2,3) Answer must be 1-80 characters in length "^DD",1130580001.101,1130580001.101,3.2,"DT") 3101012 "^DD",1130580001.101,1130580001.101,4,0) MEASURE TYPE^S^P:Performance;Q:Quality;E:Electronic Prescribing Performance;^0;5^Q "^DD",1130580001.101,1130580001.101,4,3) Enter a code P, Q or E "^DD",1130580001.101,1130580001.101,4,21,0) ^^19^19^3120530^ "^DD",1130580001.101,1130580001.101,4,21,1,0) This field designates the measure type. It can be P, Q or M. "^DD",1130580001.101,1130580001.101,4,21,2,0) "^DD",1130580001.101,1130580001.101,4,21,3,0) P is for Performance. Performance measures are MU measures to measure "^DD",1130580001.101,1130580001.101,4,21,4,0) how meaningfully used an EMR is. An example of a performance measure "^DD",1130580001.101,1130580001.101,4,21,5,0) is whether allergies are documented in the EMR. Performance measures "^DD",1130580001.101,1130580001.101,4,21,6,0) reference a Patient List created by this package. "^DD",1130580001.101,1130580001.101,4,21,7,0) "^DD",1130580001.101,1130580001.101,4,21,8,0) Q is for Quality Measures. Quality measures are MU measures to assess how "^DD",1130580001.101,1130580001.101,4,21,9,0) well the patients are cared for. An example of a quality measure is "^DD",1130580001.101,1130580001.101,4,21,10,0) whether Hemoglobin A1c Poor Control. Quality measures reference Patient "^DD",1130580001.101,1130580001.101,4,21,11,0) Lists in the Reminders package. "^DD",1130580001.101,1130580001.101,4,21,12,0) "^DD",1130580001.101,1130580001.101,4,21,13,0) E is for Electronic Prescribing. This is a Performance measure, except "^DD",1130580001.101,1130580001.101,4,21,14,0) that it is handled differently than the rest. Instead of the numerators "^DD",1130580001.101,1130580001.101,4,21,15,0) and denominators being lists of patients as with all the other "^DD",1130580001.101,1130580001.101,4,21,16,0) measurements, they are a number of prescriptions. That's why we have a "^DD",1130580001.101,1130580001.101,4,21,17,0) special flag for it. It references a Patient List created by this "^DD",1130580001.101,1130580001.101,4,21,18,0) package. The numerator and denominators are stored in subfiles for each "^DD",1130580001.101,1130580001.101,4,21,19,0) patient. "^DD",1130580001.101,1130580001.101,4,23,0) ^^4^4^3120530^ "^DD",1130580001.101,1130580001.101,4,23,1,0) As of version C0P*1.0*1, the software doesn't use this field except to "^DD",1130580001.101,1130580001.101,4,23,2,0) check for an electronic prescribing type (code E). "^DD",1130580001.101,1130580001.101,4,23,3,0) "^DD",1130580001.101,1130580001.101,4,23,4,0) I anticipate using this field for other purposes in the future. "^DD",1130580001.101,1130580001.101,4,"DT") 3120530 "^DD",1130580001.101,1130580001.111,0) VERY LONG DESCRIPTION SUB-FIELD^^.01^1 "^DD",1130580001.101,1130580001.111,0,"DT") 3101013 "^DD",1130580001.101,1130580001.111,0,"NM","VERY LONG DESCRIPTION") "^DD",1130580001.101,1130580001.111,0,"UP") 1130580001.101 "^DD",1130580001.101,1130580001.111,.01,0) VERY LONG DESCRIPTION^Wx^^0;1 "^DD",1130580001.101,1130580001.111,.01,.1) LONGER DESCRIPTION - IF IT DOESN'T FIT IN .6 "^DD",1130580001.101,1130580001.111,.01,3) LONGER DESCRIPTION - INSTEAD OF LONG DESCRIPTION "^DD",1130580001.101,1130580001.111,.01,"DT") 3101013 "^DD",1130580001.401,1130580001.401,2,0) EP MU MEASUREMENT SET^P1130580001.201'^C0Q(201,^0;6^Q "^DD",1130580001.401,1130580001.401,2,.1) OUTPATIENT MEANINGFUL USE MEASUREMENT SET "^DD",1130580001.401,1130580001.401,2,1,0) ^.1 "^DD",1130580001.401,1130580001.401,2,1,1,0) 1130580001.401^AMMS "^DD",1130580001.401,1130580001.401,2,1,1,1) S ^C0Q(401,"AMMS",$E(X,1,30),DA)="" "^DD",1130580001.401,1130580001.401,2,1,1,2) K ^C0Q(401,"AMMS",$E(X,1,30),DA) "^DD",1130580001.401,1130580001.401,2,1,1,3) USED BY THE CODE. SEE DESCRIPTION. "^DD",1130580001.401,1130580001.401,2,1,1,"%D",0) ^.101^5^5^3120530^^^ "^DD",1130580001.401,1130580001.401,2,1,1,"%D",1,0) Indexes the IEN of the Measurement Set. Used so that we can walk back to "^DD",1130580001.401,1130580001.401,2,1,1,"%D",2,0) a parameter when processing a specific IEN. "^DD",1130580001.401,1130580001.401,2,1,1,"%D",3,0) "^DD",1130580001.401,1130580001.401,2,1,1,"%D",4,0) You can get the IEN of the measurement set using "^DD",1130580001.401,1130580001.401,2,1,1,"%D",5,0) $O(^C0Q(401,"AMMS",MSIEN,"")). "^DD",1130580001.401,1130580001.401,2,1,1,"DT") 3120530 "^DD",1130580001.401,1130580001.401,2,"DT") 3120530 "^DD",1130580001.401,1130580001.401,2.1,0) EP QUALITY MEASUREMENT SET^P1130580001.201'^C0Q(201,^0;7^Q "^DD",1130580001.401,1130580001.401,2.1,.1) OUTPATIENT QUALITY MEASUREMENT SET "^DD",1130580001.401,1130580001.401,2.1,1,0) ^.1 "^DD",1130580001.401,1130580001.401,2.1,1,1,0) 1130580001.401^AQMS "^DD",1130580001.401,1130580001.401,2.1,1,1,1) S ^C0Q(401,"AQMS",$E(X,1,30),DA)="" "^DD",1130580001.401,1130580001.401,2.1,1,1,2) K ^C0Q(401,"AQMS",$E(X,1,30),DA) "^DD",1130580001.401,1130580001.401,2.1,1,1,3) USED BY THE CODE. SEE DESCRIPTION. "^DD",1130580001.401,1130580001.401,2.1,1,1,"%D",0) ^^5^5^3120530^ "^DD",1130580001.401,1130580001.401,2.1,1,1,"%D",1,0) Indexes the IEN of the Measurement Set. Used so that we can walk back to "^DD",1130580001.401,1130580001.401,2.1,1,1,"%D",2,0) a parameter when processing a specific IEN. "^DD",1130580001.401,1130580001.401,2.1,1,1,"%D",3,0) "^DD",1130580001.401,1130580001.401,2.1,1,1,"%D",4,0) You can get the IEN of the measurement set using "^DD",1130580001.401,1130580001.401,2.1,1,1,"%D",5,0) $O(^C0Q(401,"AQMS",MSIEN,"")). "^DD",1130580001.401,1130580001.401,2.1,1,1,"DT") 3120530 "^DD",1130580001.401,1130580001.401,2.1,"DT") 3120530 "^DIC",1130580001.101,1130580001.101,0) C0Q QUALITY MEASURE^1130580001.101 "^DIC",1130580001.101,1130580001.101,0,"GL") ^C0Q(101, "^DIC",1130580001.101,"B","C0Q QUALITY MEASURE",1130580001.101) **END** **END**