1 | RORX014 ;HOIFO/SG - REGISTRY MEDICATIONS REPORT ; 11/25/05 5:57pm
|
---|
2 | ;;1.5;CLINICAL CASE REGISTRIES;;Feb 17, 2006
|
---|
3 | ;
|
---|
4 | Q
|
---|
5 | ;
|
---|
6 | ;***** OUTPUTS THE REPORT HEADER
|
---|
7 | ;
|
---|
8 | ; PARTAG Reference (IEN) to the parent tag
|
---|
9 | ;
|
---|
10 | ; Return Values:
|
---|
11 | ; <0 Error code
|
---|
12 | ; >0 IEN of the HEADER element
|
---|
13 | ;
|
---|
14 | HEADER(PARTAG) ;
|
---|
15 | ;;RXCOMBLST(NP,PATIENTS(NAME,LAST4,DOD))^I $$PARAM^RORTSK01("OPTIONS","COMPLETE")
|
---|
16 | ;;RXCOMBLST(NP,RXCOMB)^I $$PARAM^RORTSK01("OPTIONS","SUMMARY")
|
---|
17 | ;
|
---|
18 | N HEADER,RC
|
---|
19 | S HEADER=$$HEADER^RORXU002(.RORTSK,PARTAG)
|
---|
20 | Q:HEADER<0 HEADER
|
---|
21 | S RC=$$TBLDEF^RORXU002("HEADER^RORX014",HEADER)
|
---|
22 | Q $S(RC<0:RC,1:HEADER)
|
---|
23 | ;
|
---|
24 | ;***** OUTPUTS THE PARAMETERS TO THE REPORT
|
---|
25 | ;
|
---|
26 | ; PARTAG Reference (IEN) to the parent tag
|
---|
27 | ;
|
---|
28 | ; [.STDT] Start and end dates of the report
|
---|
29 | ; [.ENDT] are returned via these parameters
|
---|
30 | ;
|
---|
31 | ; [.FLAGS] Flags for the $$SKIP^RORXU005 are
|
---|
32 | ; returned via this parameter
|
---|
33 | ;
|
---|
34 | ; Return Values:
|
---|
35 | ; <0 Error code
|
---|
36 | ; >0 IEN of the PARAMETERS element
|
---|
37 | ;
|
---|
38 | PARAMS(PARTAG,STDT,ENDT,FLAGS) ;
|
---|
39 | N PARAMS,RC
|
---|
40 | S PARAMS=$$PARAMS^RORXU002(.RORTSK,PARTAG,.STDT,.ENDT,.FLAGS)
|
---|
41 | Q:PARAMS<0 PARAMS
|
---|
42 | ;--- Process the drug list and options
|
---|
43 | S RORTSK("PARAMS","DRUGS","A","REGMEDS")=1
|
---|
44 | S RORTSK("PARAMS","DRUGS","A","AGGR_GENERIC")=1
|
---|
45 | S RC=$$DRUGLST^RORXU007(.RORTSK,PARAMS,.RORXL)
|
---|
46 | Q:RC<0 RC
|
---|
47 | ;--- Success
|
---|
48 | Q PARAMS
|
---|
49 | ;
|
---|
50 | ;***** COMPILES THE "REGISTRY MEDICATIONS" REPORT
|
---|
51 | ; REPORT CODE: 014
|
---|
52 | ;
|
---|
53 | ; .RORTSK Task number and task parameters
|
---|
54 | ;
|
---|
55 | ; The ^TMP("RORX014",$J) global node is used by this function.
|
---|
56 | ;
|
---|
57 | ; ^TMP("RORX014",$J,
|
---|
58 | ; "DRG",
|
---|
59 | ; DrugIEN) Medication name (generic or formulation)
|
---|
60 | ; "RXC",
|
---|
61 | ; RxcIEN,
|
---|
62 | ; 1) List of Drug IEN's separated by ","
|
---|
63 | ; "P" Number of patients
|
---|
64 | ; DFN) Patient Descriptor
|
---|
65 | ; ^01: Las 4 digits of SSN
|
---|
66 | ; ^02: Name
|
---|
67 | ; ^03: Date of Death
|
---|
68 | ; "B",
|
---|
69 | ; RxcNdx,
|
---|
70 | ; RxcIEN) ""
|
---|
71 | ; "P",
|
---|
72 | ; NumOfPat,
|
---|
73 | ; RxcIEN) ""
|
---|
74 | ;
|
---|
75 | ; RxcNdx is the first 100 characters of the list of Drug IEN's.
|
---|
76 | ;
|
---|
77 | ; Return Values:
|
---|
78 | ; <0 Error code
|
---|
79 | ; 0 Ok
|
---|
80 | ;
|
---|
81 | RXCOMB(RORTSK) ;
|
---|
82 | N ROREDT ; End date
|
---|
83 | N ROREDT1 ; End date + 1
|
---|
84 | N RORREG ; Registry IEN
|
---|
85 | N RORSDT ; Start date
|
---|
86 | N RORXL ; Drug list for the pharmacy search API
|
---|
87 | ;
|
---|
88 | N ECNT,NRXC,RC,REPORT,SFLAGS,TMP
|
---|
89 | S RORXL="",(ECNT,RC)=0
|
---|
90 | K ^TMP("RORX014",$J)
|
---|
91 | ;--- Root node of the report
|
---|
92 | S REPORT=$$ADDVAL^RORTSK11(RORTSK,"REPORT")
|
---|
93 | Q:REPORT<0 REPORT
|
---|
94 | ;
|
---|
95 | D
|
---|
96 | . ;--- Get and prepare the report parameters
|
---|
97 | . S RORREG=$$PARAM^RORTSK01("REGIEN")
|
---|
98 | . S RC=$$PARAMS(REPORT,.RORSDT,.ROREDT,.SFLAGS) Q:RC<0
|
---|
99 | . S ROREDT1=$$FMADD^XLFDT(ROREDT\1,1)
|
---|
100 | . ;--- Report header
|
---|
101 | . S RC=$$HEADER(REPORT) Q:RC<0
|
---|
102 | . ;--- Query the registry
|
---|
103 | . D TPPSETUP^RORTSK01(80)
|
---|
104 | . S RC=$$QUERY^RORX014A(SFLAGS)
|
---|
105 | . I RC Q:RC<0 S ECNT=ECNT+RC
|
---|
106 | . ;--- Sort the data
|
---|
107 | . D TPPSETUP^RORTSK01(5)
|
---|
108 | . S RC=$$SORT^RORX014A(.NRXC)
|
---|
109 | . I RC Q:RC<0 S ECNT=ECNT+RC
|
---|
110 | . ;--- Store the results
|
---|
111 | . D TPPSETUP^RORTSK01(15)
|
---|
112 | . S RC=$$STORE^RORX014A(REPORT,NRXC)
|
---|
113 | . I RC Q:RC<0 S ECNT=ECNT+RC
|
---|
114 | ;
|
---|
115 | ;--- Cleanup
|
---|
116 | K ^TMP("RORX014",$J)
|
---|
117 | D FREE^RORTMP(RORXL)
|
---|
118 | Q $S(RC<0:RC,ECNT>0:-43,1:0)
|
---|