Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: APCM14E8

APCM14E8.m

Go to the documentation of this file.
  1. APCM14E8 ;IHS/CMI/LAB - IHS MU;
  1. ;;1.0;IHS MU PERFORMANCE REPORTS;**5,6**;MAR 26, 2012;Build 65
  1. ;;;;;;Build 3
  1. ;
  1. LAB ;EP - CALCULATE LAB
  1. ;for each provider count each lab in the time period, loop through patients for visits in time period
  1. K ^TMP($J,"PATSRX")
  1. K APCMLABS
  1. D TOTLAB
  1. NEW APCMP,N,F
  1. S (APCMD1,APCMN1)=0
  1. I APCMRPTT=1 S APCMP=0 F S APCMP=$O(APCMPRV(APCMP)) Q:APCMP'=+APCMP D
  1. .I '$P($G(APCMLABS(APCMP)),U,1) D Q
  1. ..S F=$P(^APCM14OB(APCMIC,0),U,11) D S^APCM14E1(APCMRPT,APCMIC,"Provider is excluded from this measure as he/she did not order any lab tests with results during the EHR reporting period.",APCMP,APCMRPTT,APCMTIME,F,1) Q
  1. .;set denominator value into field
  1. .S F=$P(^APCM14OB(APCMIC,0),U,8) ;denom field for this measure
  1. .S N=$P($G(APCMLABS(APCMP)),U,1) ;returns # of LABS^# not Structured data
  1. .D S^APCM14E1(APCMRPT,APCMIC,N,APCMP,APCMRPTT,APCMTIME,F)
  1. .;now set patient list for this provider
  1. .S P=0 F S P=$O(^TMP($J,"PATSRX",APCMP,P)) Q:P'=+P D
  1. ..;Q:'$P(^TMP($J,"PATSRX",APCMP,P),U,1)
  1. ..I $P(^TMP($J,"PATSRX",APCMP,P),U,1)=$P(^TMP($J,"PATSRX",APCMP,P),U,2) S APCMVALU="# Labs: "_$P(^TMP($J,"PATSRX",APCMP,P),U,1)_"|||"_" # w/structured result: "_+$P(^TMP($J,"PATSRX",APCMP,P),U,2)_"|||1" D Q
  1. ...S DFN=P D SETLIST^APCM14E1 Q
  1. ..S S="",APCMVALU="No Structured Result: "
  1. ..F S S=$O(^TMP($J,"PATSRX",APCMP,P,"SCRIPTS",S)) Q:S="" D
  1. ...I '$D(^TMP($J,"PATSRX",APCMP,P,"ELEC",S)) D
  1. ....S APCMVALU=APCMVALU_S_";"
  1. ..S DFN=P,APCMVALU="# of Labs: "_$P(^TMP($J,"PATSRX",APCMP,P),U,1)_" # w/structured results: "_+$P(^TMP($J,"PATSRX",APCMP,P),U,2)_"|||"_APCMVALU,$P(APCMVALU,"|||",3)=0 D SETLIST^APCM14E1
  1. .;numerator?
  1. .S F=$P(^APCM14OB(APCMIC,0),U,9)
  1. .S N=$P($G(APCMLABS(APCMP)),U,2)
  1. .D S^APCM14E1(APCMRPT,APCMIC,N,APCMP,APCMRPTT,APCMTIME,F)
  1. K ^TMP($J,"PATSRX")
  1. Q
  1. TOTLAB ;EP - ep LAB
  1. ;SET ARRAY APCMLABS to APCMLABS(prov ien)=denom^numer
  1. ;IF DENOM =0 THEN PROVIDER EXCLUSION
  1. NEW ID,C,Y,X,D,S,N,A,B,R,PAT,ED,APCMLAB,APCMX,APCML,PAR
  1. S ED=9999999-APCMBDAT,ED=ED_".9999"
  1. S SD=9999999-APCMEDAT
  1. S C=0,N=0,PAT=""
  1. S LABSNO=""
  1. S T=$O(^ATXLAB("B","BGP PAP SMEAR TAX",0))
  1. S PAT="" F S PAT=$O(^AUPNVSIT("AA",PAT)) Q:PAT'=+PAT D TOTLAB1
  1. Q
  1. TOTLAB1 ;
  1. NEW APCMLAB,APCMLAB1
  1. S APCMLAB="APCMLAB"
  1. D ALLLAB^APCM24EB(PAT,APCMBDAT,APCMEDAT,,,,.APCMLAB)
  1. ;reorder by IEN of v lab
  1. K APCMLAB1
  1. S APCMX=0 F S APCMX=$O(APCMLAB(APCMX)) Q:APCMX'=+APCMX D
  1. .S V=$P(APCMLAB(APCMX),U,5) ;VISIT IEN
  1. .S Y=$P(APCMLAB(APCMX),U,4) ;V LAB IEN
  1. .Q:'$D(^AUPNVSIT(V,0)) ;NO VISIT??
  1. .Q:"AOSM"'[$P(^AUPNVSIT(V,0),U,7)
  1. .S C=$$CLINIC^APCLV(V,"C")
  1. .Q:C=30 ;ER
  1. .S R=$P($G(^AUPNVLAB(Y,12)),U,2) ;ORDERING PROVIDER
  1. .Q:'R ;no ordering provider - CAN'T ASSIGN TO AN EP
  1. .I '$D(APCMPRV(R)) Q ;not a provider of interest FOR THIS REPROT
  1. .;Q:$P($P($G(^AUPNVLAB(Y,12)),U,1),".")>APCMEDAT ;collection date after time period
  1. .;Q:$P($P($G(^AUPNVLAB(Y,12)),U,1),".")<APCMBDAT ;collection date before time period
  1. .S A=$P(^AUPNVLAB(Y,0),U,1) ;test pointer
  1. .I T,$D(^ATXLAB(T,21,"B",A)) Q ;it's a pap smear
  1. .I $$UP^XLFSTR($$VAL^XBDIQ1(9000010.09,Y,.01))="PAP SMEAR" Q ;it's a pap smear
  1. .I $$UP^XLFSTR($P(^AUPNVLAB(Y,0),U,4))="CANC" Q
  1. .I $O(^LAB(60,A,2,0)) Q ;this is the v lab for the panel
  1. .I '$D(APCMLABS(R)) S APCMLABS(R)=""
  1. .S $P(APCMLABS(R),U,1)=$P(APCMLABS(R),U,1)+1,$P(^TMP($J,"PATSRX",R,PAT),U,1)=$P($G(^TMP($J,"PATSRX",R,PAT)),U,1)+1,^TMP($J,"PATSRX",R,PAT,"SCRIPTS",$$VAL^XBDIQ1(9000010.09,Y,1201)_" "_$$VAL^XBDIQ1(9000010.09,Y,.01))=""
  1. .;now check numerator
  1. .Q:$P($G(^AUPNVLAB(Y,11)),U,9)'="R" ;if status not resulted it doesn't make the numerator
  1. .I $$UP^XLFSTR($P(^AUPNVLAB(Y,0),U,4))="COMMENT",'$$HASCOM(Y) Q
  1. .S $P(APCMLABS(R),U,2)=$P(APCMLABS(R),U,2)+1,$P(^TMP($J,"PATSRX",R,PAT),U,2)=$P($G(^TMP($J,"PATSRX",R,PAT)),U,2)+1 S ^TMP($J,"PATSRX",R,PAT,"ELEC",$$VAL^XBDIQ1(9000010.09,Y,1201)_" "_$$VAL^XBDIQ1(9000010.09,Y,.01))="" ;S N=N+G Q ;S N=N+G
  1. Q
  1. ;
  1. HASCOM(L) ;ARE THERE ANY COMMENTS
  1. I '$D(^AUPNVLAB(L,21)) Q 0
  1. NEW B,G
  1. S G=0
  1. S B=0 F S B=$O(^AUPNVLAB(L,21,B)) Q:B'=+B I ^AUPNVLAB(L,21,B,0)]"" S G=1 ;has comment
  1. Q G