- RORX023 ;ALB/TMK - HCV SUSTAINED VIROLOGIC RESPONSE REPORT ;7/21/11 1:04pm
- ;;1.5;CLINICAL CASE REGISTRIES;**24,31**;Feb 17, 2006;Build 62
- ;
- ;******************************************************************************
- ; --- ROUTINE MODIFICATION LOG ---
- ;
- ;PKG/PATCH DATE DEVELOPER MODIFICATION
- ;----------- ---------- ----------- ----------------------------------------
- ;ROR*1.5*24 JUN 2014 T KOPP Created report
- ;ROR*1.5*31 MAY 2017 M FERRARESE Adding PACT, PCP, and AGE/DOB as additional
- ; identifiers.
- ;******************************************************************************
- ;
- Q
- ;
- ;***** OUTPUTS THE REPORT HEADER
- ;
- ; PARTAG Reference (IEN) to the parent tag
- ;
- ; Return Values:
- ; <0 Error code
- ; >0 IEN of the HEADER element
- ;
- ;;PATIENTS(#,NAME,LAST4,HCV_DATE,HCV,GT,LAST_TAKEN,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="ALL"
- ;;PATIENTS(#,NAME,LAST4,AGE,HCV_DATE,HCV,GT,LAST_TAKEN,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="AGE"
- ;;PATIENTS(#,NAME,LAST4,DOB,HCV_DATE,HCV,GT,LAST_TAKEN,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="DOB"
- ;
- N HEADER,RC
- S HEADER=$$HEADER^RORXU002(.RORTSK,PARTAG)
- Q:HEADER<0 HEADER
- S RC=$$TBLDEF^RORXU002("HEADER^RORX023",HEADER)
- Q $S(RC<0:RC,1:HEADER)
- ;
- ;***** COMPILES THE "SUSTAINED VIROLOGIC RESPONSE" REPORT
- ; REPORT CODE: 023
- ;
- ; .RORTSK Task number and task parameters
- ;
- ; The ^TMP("RORX023",$J) global node is used by this function.
- ;
- ; ^TMP("RORX023",$J,
- ; "PAT",
- ; DFN, Patient descriptor
- ; ^01: Last 4 digits of SSN
- ; ^02: Patient name
- ; ^03: empty
- ; ^04: National ICN
- ; ^05: Patient Care Team
- ; ^06: Priamary Care Provider
- ; ^07: Age/DOB
- ; "LR",
- ; Category,
- ; Date(inverse) = Result
- ;
- ; "RX",
- ; Last Taken Date) = ""
- ;
- ; Return Values:
- ; <0 Error code
- ; 0 Ok
- ;
- HCVSVR(RORTSK) ;
- N RORLTST ; Closed root of the list of lab tests for the
- ; ; Lab search API
- N RORREG ; Registry IEN
- N RORSDT ; Pharmacy start date
- N ROREDT ; Pharmacy end date
- N RORXGRP ; List of drug groups
- N RORXL ; Closed root of the drug list for the pharmacy
- ; ; search API
- N ECNT,NSPT,RC,SFLAGS,TMP,BUF,RORXEDT,RORXSDT
- N REPORT,PARAMS,ELEMENT ;XML parent variables
- ;
- S (RORXL,RORLTST)="",(ECNT,RC)=0
- K ^TMP("RORX023",$J)
- ;--- Root node of the report
- S REPORT=$$ADDVAL^RORTSK11(RORTSK,"REPORT")
- Q:REPORT<0 REPORT
- ;
- ;--- Get and prepare the report parameters
- D
- . S RORREG=$$PARAM^RORTSK01("REGIEN") ; Registry IEN
- . S PARAMS=$$PARAMS^RORXU002(.RORTSK,REPORT,.RORXSDT,.RORXEDT,.SFLAGS)
- . Q:PARAMS<0
- . S TMP=""
- . F S TMP=$O(BUF(TMP)) Q:TMP="" D Q:RC<0
- . . S RC=$$ADDATTR^RORTSK11(RORTSK,ELEMENT,TMP,BUF(TMP))
- . ;--- Report header
- . S RC=$$HEADER(REPORT) Q:RC<0
- . ;--- Query the registry
- . D TPPSETUP^RORTSK01(80)
- . S RC=$$QUERY^RORX023A(REPORT,SFLAGS,.NSPT)
- . I RC Q:RC<0 S ECNT=ECNT+RC
- . ;--- Store the results
- . D TPPSETUP^RORTSK01(20)
- . S RC=$$STORE^RORX023A(REPORT,NSPT)
- . I RC Q:RC<0 S ECNT=ECNT+RC
- ;
- ;--- Cleanup
- K ^TMP("RORX023",$J)
- ;
- Q $S(RC<0:RC,ECNT>0:-43,1:0)
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRORX023 3595 printed Mar 13, 2025@20:49:39 Page 2
- RORX023 ;ALB/TMK - HCV SUSTAINED VIROLOGIC RESPONSE REPORT ;7/21/11 1:04pm
- +1 ;;1.5;CLINICAL CASE REGISTRIES;**24,31**;Feb 17, 2006;Build 62
- +2 ;
- +3 ;******************************************************************************
- +4 ; --- ROUTINE MODIFICATION LOG ---
- +5 ;
- +6 ;PKG/PATCH DATE DEVELOPER MODIFICATION
- +7 ;----------- ---------- ----------- ----------------------------------------
- +8 ;ROR*1.5*24 JUN 2014 T KOPP Created report
- +9 ;ROR*1.5*31 MAY 2017 M FERRARESE Adding PACT, PCP, and AGE/DOB as additional
- +10 ; identifiers.
- +11 ;******************************************************************************
- +12 ;
- +13 QUIT
- +14 ;
- +15 ;***** OUTPUTS THE REPORT HEADER
- +16 ;
- +17 ; PARTAG Reference (IEN) to the parent tag
- +18 ;
- +19 ; Return Values:
- +20 ; <0 Error code
- +21 ; >0 IEN of the HEADER element
- +22 ;
- +1 ;;PATIENTS(#,NAME,LAST4,HCV_DATE,HCV,GT,LAST_TAKEN,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="ALL"
- +2 ;;PATIENTS(#,NAME,LAST4,AGE,HCV_DATE,HCV,GT,LAST_TAKEN,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="AGE"
- +3 ;;PATIENTS(#,NAME,LAST4,DOB,HCV_DATE,HCV,GT,LAST_TAKEN,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="DOB"
- +4 ;
- +5 NEW HEADER,RC
- +6 SET HEADER=$$HEADER^RORXU002(.RORTSK,PARTAG)
- +7 if HEADER<0
- QUIT HEADER
- +8 SET RC=$$TBLDEF^RORXU002("HEADER^RORX023",HEADER)
- +9 QUIT $SELECT(RC<0:RC,1:HEADER)
- +10 ;
- +11 ;***** COMPILES THE "SUSTAINED VIROLOGIC RESPONSE" REPORT
- +12 ; REPORT CODE: 023
- +13 ;
- +14 ; .RORTSK Task number and task parameters
- +15 ;
- +16 ; The ^TMP("RORX023",$J) global node is used by this function.
- +17 ;
- +18 ; ^TMP("RORX023",$J,
- +19 ; "PAT",
- +20 ; DFN, Patient descriptor
- +21 ; ^01: Last 4 digits of SSN
- +22 ; ^02: Patient name
- +23 ; ^03: empty
- +24 ; ^04: National ICN
- +25 ; ^05: Patient Care Team
- +26 ; ^06: Priamary Care Provider
- +27 ; ^07: Age/DOB
- +28 ; "LR",
- +29 ; Category,
- +30 ; Date(inverse) = Result
- +31 ;
- +32 ; "RX",
- +33 ; Last Taken Date) = ""
- +34 ;
- +35 ; Return Values:
- +36 ; <0 Error code
- +37 ; 0 Ok
- +38 ;
- HCVSVR(RORTSK) ;
- +1 ; Closed root of the list of lab tests for the
- NEW RORLTST
- +2 ; ; Lab search API
- +3 ; Registry IEN
- NEW RORREG
- +4 ; Pharmacy start date
- NEW RORSDT
- +5 ; Pharmacy end date
- NEW ROREDT
- +6 ; List of drug groups
- NEW RORXGRP
- +7 ; Closed root of the drug list for the pharmacy
- NEW RORXL
- +8 ; ; search API
- +9 NEW ECNT,NSPT,RC,SFLAGS,TMP,BUF,RORXEDT,RORXSDT
- +10 ;XML parent variables
- NEW REPORT,PARAMS,ELEMENT
- +11 ;
- +12 SET (RORXL,RORLTST)=""
- SET (ECNT,RC)=0
- +13 KILL ^TMP("RORX023",$JOB)
- +14 ;--- Root node of the report
- +15 SET REPORT=$$ADDVAL^RORTSK11(RORTSK,"REPORT")
- +16 if REPORT<0
- QUIT REPORT
- +17 ;
- +18 ;--- Get and prepare the report parameters
- +19 Begin DoDot:1
- +20 ; Registry IEN
- SET RORREG=$$PARAM^RORTSK01("REGIEN")
- +21 SET PARAMS=$$PARAMS^RORXU002(.RORTSK,REPORT,.RORXSDT,.RORXEDT,.SFLAGS)
- +22 if PARAMS<0
- QUIT
- +23 SET TMP=""
- +24 FOR
- SET TMP=$ORDER(BUF(TMP))
- if TMP=""
- QUIT
- Begin DoDot:2
- +25 SET RC=$$ADDATTR^RORTSK11(RORTSK,ELEMENT,TMP,BUF(TMP))
- End DoDot:2
- if RC<0
- QUIT
- +26 ;--- Report header
- +27 SET RC=$$HEADER(REPORT)
- if RC<0
- QUIT
- +28 ;--- Query the registry
- +29 DO TPPSETUP^RORTSK01(80)
- +30 SET RC=$$QUERY^RORX023A(REPORT,SFLAGS,.NSPT)
- +31 IF RC
- if RC<0
- QUIT
- SET ECNT=ECNT+RC
- +32 ;--- Store the results
- +33 DO TPPSETUP^RORTSK01(20)
- +34 SET RC=$$STORE^RORX023A(REPORT,NSPT)
- +35 IF RC
- if RC<0
- QUIT
- SET ECNT=ECNT+RC
- End DoDot:1
- +36 ;
- +37 ;--- Cleanup
- +38 KILL ^TMP("RORX023",$JOB)
- +39 ;
- +40 QUIT $SELECT(RC<0:RC,ECNT>0:-43,1:0)