source: FOIAVistA/trunk/r/CLINICAL_CASE_REGISTRIES-ROR/RORUTL04.m@ 1397

Last change on this file since 1397 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 1.7 KB
Line 
1RORUTL04 ;HCIOFO/BH - Registry Stat Report ; 1/16/02 12:30pm
2 ;;1.5;CLINICAL CASE REGISTRIES;;Feb 17, 2006
3 ;
4EN1 D COMP
5 D DISPLAY
6 Q
7 ;
8COMP N K2,K4,PATIEN,DATE,TMP,CODE,RULE
9 ;
10 K ^TMP("ROR STAT REPORT")
11 S K2=0
12 F S K2=$O(^RORDATA(798,K2)) Q:'K2 D
13 . S PATIEN=$P(^RORDATA(798,K2,0),"^",1)
14 . S K4=0,CNT=0 K TMP
15 . F S K4=$O(^RORDATA(798,K2,1,K4)) Q:'K4 D
16 . . S CNT=CNT+1
17 . . S DATE=$P(^RORDATA(798,K2,1,K4,0),"^",2)
18 . . S CODE=$P(^RORDATA(798,K2,1,K4,0),"^",1)
19 . . S TMP(DATE)=CODE
20 . I CNT<1 Q ; No selection rules
21 . S K1=""
22 . S K1=$O(TMP(K1))
23 . S RULE=$$GETRULE(.TMP,CNT,K1)
24 . S ^TMP("ROR STAT REPORT",RULE,K1,PATIEN)=""
25 Q
26 ;
27GETRULE(TMP,CNT,K1) ;
28 N MARKER,KK1,RULE1,RESULT
29 I CNT=1 D Q RESULT
30 . S RULE1=TMP(K1)
31 . I RULE1=8 S RESULT="Only_Lab"
32 . I RULE1'=8 S RESULT="Only_ICD9"
33 ;
34 S KK1="",MARKER=0
35 F S KK1=$O(TMP(KK1)) Q:'KK1 D
36 . I TMP(KK1)=8 S MARKER=1
37 S SEL=TMP(K1)
38 I MARKER,SEL=8 Q "BOTHL"
39 I MARKER,SEL'=8 Q "BOTHI"
40 Q "All_ICD9"
41 ;
42DISPLAY ;
43 N STRING,I,RES
44 S STRING="Only_Lab^Only_ICD9^BOTHI^BOTHL^All_ICD9"
45 F I=1:1:5 D
46 . S RES=$P(STRING,"^",I)
47 . D LOOP(RES)
48 Q
49 ;
50LOOP(RES) ;
51 N NAME,SSN,LABEL,DATE,IEN
52 S LABEL=RES
53 I $E(LABEL,1,4)="BOTH" D
54 . I $E(LABEL,5,5)="I" S LABEL="Both_ICD9_&_Lab. ICD9_was_Earliest."
55 . I $E(LABEL,5,5)="L" S LABEL="Both_ICD9_&_Lab. Lab_was_Earliest."
56 W !,"Reason_Added. "_LABEL,!
57 ;
58 S DATE=""
59 I $O(^TMP("ROR STAT REPORT",RES,DATE))="" W "No_data_to_display.",!
60 F S DATE=$O(^TMP("ROR STAT REPORT",RES,DATE)) Q:'DATE D
61 . S IEN=""
62 . F S IEN=$O(^TMP("ROR STAT REPORT",RES,DATE,IEN)) Q:'IEN D
63 . . S NAME=$P(^DPT(IEN,0),"^",1)
64 . . S NAME=$TR(NAME," ","_")
65 . . S SSN=$P(^DPT(IEN,0),"^",9)
66 . . W NAME_" "_SSN_" "_$E(DATE,4,5)_"/"_$E(DATE,6,7)_"/"_$E(DATE,2,3),!
67 ;
68 ;
Note: See TracBrowser for help on using the repository browser.