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

AQAOPC21.m

Go to the documentation of this file.
  1. AQAOPC21 ; IHS/ORDC/LJF - CALCULATE OCC BY ICD CODES ;
  1. ;;1.01;QAI MANAGEMENT;;OCT 05, 1995
  1. ;
  1. ;This rtn contains the code to find the occurrences for the selected
  1. ;indicator & date range screened by the diagnoses & procedures the
  1. ;user selected.
  1. ;
  1. K ^TMP("AQAOPC2",$J)
  1. S AQAOCNT=0 ;initialize total count
  1. DTLOOP ; >>> loop thru occ file by date for indicator
  1. S AQAODT=AQAOBD-.0001,AQAOEDT=AQAOED_.2400
  1. F S AQAODT=$O(^AQAOC("AA",AQAOIND,AQAODT)) Q:AQAODT="" Q:AQAODT>AQAOEDT D
  1. .S DFN=0
  1. .F S DFN=$O(^AQAOC("AA",AQAOIND,AQAODT,DFN)) Q:DFN="" D
  1. ..S AQAOIFN=0
  1. ..F S AQAOIFN=$O(^AQAOC("AA",AQAOIND,AQAODT,DFN,AQAOIFN)) Q:AQAOIFN="" D
  1. ...Q:'$D(^AQAOC(AQAOIFN,0)) S AQAOSTR=^(0) Q:$P(^(1),U)=2 ;deleted
  1. ...Q:$P(^AQAOC(AQAOIFN,0),U,9)'=DUZ(2) ;PATCH 3
  1. ...Q:$$EXCEP^AQAOLKP(AQAOIFN)
  1. ...I $D(AQAOXSN) Q:$$CHK^AQAOPCX(AQAOXSN)=0 ;spec rev type searches
  1. ...; ;AQAOARS array returned
  1. ...S AQAOFLG=0 D ICDCHK ;check if occ has icd code in range
  1. ...Q:AQAOFLG=0 ;no icd code in ranges
  1. ...S AQAOCNT=AQAOCNT+1 ;increment total cases
  1. ...;
  1. ...S AQAOSUB=0
  1. ...I '$D(AQAOXSN) S ^TMP("AQAOPC2",$J,AQAOSUB,AQAODT,AQAOIFN)="" Q
  1. ...F S AQAOSUB=$O(AQAOARS(AQAOSUB)) Q:AQAOSUB="" D
  1. ....S ^TMP("AQAOPC2",$J,AQAOSUB,AQAODT,AQAOIFN)=""
  1. ;
  1. NEXT ; >>> go to print rtn
  1. G ^AQAOPC22
  1. ;
  1. ;
  1. ICDCHK ; >> SUBRTN to check occ for icd codes in range
  1. I $D(AQAOARR("ALL")),$D(AQAOARR1("ALL")) S AQAOFLG=1 Q ;all codes
  1. F I=8,9 D
  1. .I I=8,$D(AQAOARR("ALL")) S AQAOFLG(I)=1 Q ;bypass dx chk if all dx
  1. .I I=9,$D(AQAOARR1("ALL")) S AQAOFLG(I)=1 Q ;bypass chk if all proc
  1. .S AQAOFLG(I)=0 ;init flag for type of code
  1. .S X=0 F S X=$O(^AQAOCC(I,"AB",AQAOIFN,X)) Q:X'=+X Q:AQAOFLG(I)=1 D
  1. ..Q:'$D(^AQAOCC(I,X,0)) S Y=+^(0) ;set pointer to icd file
  1. ..S AQAOY=$S(I=8:$P(^ICD9(Y,0),U),1:$P(^ICD0(Y,0),U)) ;icd code #
  1. ..S AQAOX=$S(I=8:"AQAOARR(",1:"AQAOARR1(") D RANGE ;is code in range
  1. ..S AQAOFLG(I)=AQAOFLG,AQAOFLG=0
  1. I AQAOFLG(8)=1,AQAOFLG(9)=1 S AQAOFLG=1
  1. Q
  1. ;
  1. ;
  1. RANGE ; >> SUBRTN to check occ code against range selected
  1. S Y=AQAOY-1,AQAOFLG=0
  1. ; ;case1:past AQAOY
  1. F S Y=$O(@(AQAOX_""""_Y_""")")) Q:Y="" Q:AQAOY<+Y Q:AQAOFLG=1 D
  1. .S Z=AQAOX_""""_Y_""")",Z=@Z I AQAOY>+Z Q ;case2:continu loop-too low
  1. .S AQAOFLG=1 Q
  1. Q