source: WorldVistAEHR/trunk/r/CLINICAL_CASE_REGISTRIES-ROR/RORXU008.m@ 789

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

initial load of WorldVistAEHR

File size: 3.3 KB
Line 
1RORXU008 ;HCIOFO/SG - REPORT PARAMETERS (CONT.) ; 6/21/06 2:08pm
2 ;;1.5;CLINICAL CASE REGISTRIES;**1**;Feb 17, 2006;Build 24
3 ;
4 Q
5 ;
6 ;***** PROCESSES THE LIST OF ICD-9 CODES
7 ;
8 ; .RORTSK Task number and task parameters
9 ;
10 ; PARTAG Reference (IEN) to the parent tag
11 ;
12 ; .ROR8LST Reference to a local variable, which contains a
13 ; closed root of an array. IEN's of ICD-9 codes
14 ; will be returned into this array.
15 ;
16 ; @ROR8LST@(IEN,Group#) = ""
17 ;
18 ; If this parameter is undefined or empty, then a
19 ; temporary buffer is allocated by the $$ALLOC^RORTMP
20 ; function and its root is returned via this parameter.
21 ;
22 ; If all ICD-9 codes are requested (the "ALL" attribute
23 ; of the "ICD9LST" tag), then "*" is returned.
24 ;
25 ; [.GRPLST] Reference to a local variable that will contain
26 ; the list of ICD-9 groups.
27 ;
28 ; GRPLST(
29 ; "C",Group#) = GroupName
30 ; "N",GroupName) = Group#
31 ;
32 ; Return Values:
33 ; <0 Error code
34 ; >0 IEN of the ICD9LST element
35 ;
36ICD9LST(RORTSK,PARTAG,ROR8LST,GRPLST) ;
37 N ATTR,ICD9,ICD9ALL,ICD9OPTS,IEN,LTAG,RC,TMP
38 S ICD9ALL=+$$PARAM^RORTSK01("ICD9LST","ALL")
39 S (LTAG,RC)=0
40 ;
41 ;=== Validate parameters
42 I 'ICD9ALL D K @ROR8LST
43 . S:$G(ROR8LST)="" ROR8LST=$$ALLOC^RORTMP()
44 E S ROR8LST="*"
45 ;
46 ;=== Process the drug options (if present)
47 M ICD9OPTS=RORTSK("PARAMS","ICD9LST","A")
48 I $D(ICD9OPTS)>1 D Q:LTAG'>0 LTAG
49 . S ATTR=$S(ICD9ALL:"ALL",1:"")
50 . S LTAG=$$ADDVAL^RORTSK11(RORTSK,"ICD9LST",ATTR,PARTAG)
51 . Q:LTAG'>0
52 . ;--- Output option attributes
53 . S ATTR="",RC=0
54 . F S ATTR=$O(ICD9OPTS(ATTR)) Q:ATTR="" D Q:RC<0
55 . . S RC=$$ADDATTR^RORTSK11(RORTSK,LTAG,ATTR,"1")
56 . I RC<0 S LTAG=RC Q
57 . S ATTR=$$OPTXT^RORXU002(.ICD9OPTS)
58 . D:ATTR'="" ADDATTR^RORTSK11(RORTSK,LTAG,"DESCR",ATTR)
59 ;
60 ;=== Process the list of ICD-9 codes (if present)
61 I 'ICD9ALL D:$D(RORTSK("PARAMS","ICD9LST","G"))>1
62 . N GRPNAME,GRPTAG,IG,NODE
63 . I LTAG'>0 D Q:LTAG'>0
64 . . S LTAG=$$ADDVAL^RORTSK11(RORTSK,"ICD9LST",,PARTAG)
65 . ;---
66 . S NODE=$NA(RORTSK("PARAMS","ICD9LST","G"))
67 . S GRPNAME="",RC=0
68 . F S GRPNAME=$O(@NODE@(GRPNAME)) Q:GRPNAME="" D Q:RC<0
69 . . S IG=$O(GRPLST("C",""),-1)+1
70 . . S GRPLST("C",IG)=GRPNAME,GRPLST("N",GRPNAME)=IG
71 . . S GRPTAG=$$ADDVAL^RORTSK11(RORTSK,"GROUP",,LTAG)
72 . . I GRPTAG'>0 S RC=GRPTAG Q
73 . . D ADDATTR^RORTSK11(RORTSK,GRPTAG,"NAME",GRPNAME)
74 . . S IEN=0
75 . . F S IEN=$O(@NODE@(GRPNAME,"C",IEN)) Q:IEN'>0 D
76 . . . S ICD9=$P(@NODE@(GRPNAME,"C",IEN),U) Q:ICD9=""
77 . . . D ADDVAL^RORTSK11(RORTSK,"ICD9",ICD9,GRPTAG,,IEN)
78 . . . S @ROR8LST@(IEN,IG)=""
79 ;
80 ;===
81 Q $S(RC<0:RC,1:LTAG)
82 ;
83 ;***** FUNCTION FOR THE PHARMACY SEARCH API
84 ;
85 ; .GRPLST Reference to a local variable that contains a list
86 ; of group codes. It is used to determine if codes
87 ; from all groups were found.
88 ;
89 ; ICD9IEN IEN of the ICD-9 code
90 ;
91 ; ROR8LST Closed root of the ICD-9 list generated by the
92 ; $$ICD9LST^RORXU008 function or "*" for all drugs.
93 ;
94 ; Return Values:
95 ; 0 Ok
96 ; 1 Skip the record
97 ;
98ICDGRCHK(GRPLST,ICD9IEN,ROR8LST) ;
99 Q:ROR8LST="*" 0
100 Q:$D(@ROR8LST@(ICD9IEN))<10 1
101 N GRP S GRP=""
102 F S GRP=$O(@ROR8LST@(ICD9IEN,GRP)) Q:GRP="" K GRPLST(GRP)
103 Q 0
Note: See TracBrowser for help on using the repository browser.