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

RORX025.m

Go to the documentation of this file.
  1. RORX025 ;ALB/TK,MAF - HEP B VACCINE OR IMMUNITY REPORT ;4/21/16 9:40am
  1. ;;1.5;CLINICAL CASE REGISTRIES;**29,31,33,34**;Feb 17, 2006;Build 45
  1. ;
  1. ;******************************************************************************
  1. ;******************************************************************************
  1. ; --- ROUTINE MODIFICATION LOG ---
  1. ;
  1. ;PKG/PATCH DATE DEVELOPER MODIFICATION
  1. ;----------- ---------- ----------- ----------------------------------------
  1. ;ROR*1.5*29 APR 2016 T KOPP Added 'Hep B vaccine or immunity report'
  1. ;ROR*1.5*31 MAY 2017 M FERRARESE Adding PACT, PCP, and AGE/DOB as additional
  1. ; identifiers.
  1. ;ROR*1.5*33 MAR 2018 M FERRARESE Adding FUTURE APPOINTMENT as additional identifiers.
  1. ;ROR*1.5*34 SEP 2018 M FERRARESE Adding Future Appointment clinic name ; Fix LOINC code table for HEP A/B
  1. ;******************************************************************************
  1. ;******************************************************************************
  1. ;
  1. ;***** COMPILES THE "HEP B VACCINE OR IMMUNITY" REPORT
  1. ; REPORT CODE: 025
  1. ;
  1. ; .RORTSK Task number and task parameters
  1. ;
  1. ; The ^TMP("RORX025",$J) global node is used by this function.
  1. ;
  1. ; ^TMP("RORX025",$J,
  1. ; "PAT",
  1. ; DFN, Patient descriptor
  1. ; ^01: Last 4 digits of SSN
  1. ; ^02: Patient name
  1. ; ^03: Date of Death
  1. ; ^04: ICN
  1. ; ^05: Patient Care Team
  1. ; ^06: Priamary Care Provider
  1. ; ^07: Age/DOB
  1. ; ^08: Future Appt date
  1. ; ^09: Future Appt Clinic
  1. ; "IMM") Result if positive test found or "" if no positive test found
  1. ; ^01: Local lab test name
  1. ; ^02: Collected date (FM)
  1. ; ^03: Lab test result
  1. ; "VAC", Number of results
  1. ; ^01: #
  1. ; VaccineName,
  1. ; VaccineDate) Always null if node exists
  1. ; ^01: Null
  1. ;
  1. ; Return Values:
  1. ; <0 Error code
  1. ; 0 Ok
  1. ;
  1. HEPBRPT(RORTSK) ;
  1. N RORIMM ; Immunity wanted mode (-1|0|1) no|not selected|yes (verified by lab test)
  1. N RORVAC ; Vaccination (-1|0|1) not received|not selected|received (verified by immunization record)
  1. N RORREG ; Registry IEN
  1. N RORVEDT ; Vaccination end date
  1. N RORVSDT ; Vaccination start date
  1. N RORLEDT ; Lab test/LOINC end date
  1. N RORLSDT ; Lab test/LOINC start date
  1. N RORRTN ; Routine to invoke for hep B processing
  1. N RORDAYS ; Future Days patch 33
  1. N RORFUT ; Future Appointment patch 33 & 34
  1. N RORCLIN ; Future Appointment clinic patch 34
  1. ;
  1. N NSPT,RC,REPORT,SFLAGS,TMP
  1. S RC=0,RORRTN="RORX025"
  1. K ^TMP(RORRTN,$J)
  1. ;--- Root node of the report
  1. S REPORT=$$ADDVAL^RORTSK11(RORTSK,"REPORT")
  1. Q:REPORT<0 REPORT
  1. ;
  1. D
  1. . ;--- Get and prepare the report parameters
  1. . S RORREG=$$PARAM^RORTSK01("REGIEN") ; Registry IEN
  1. . S RORVAC=$$RPTMODE^RORX024("HEPBVAC") ; Vaccination option chosen
  1. . S RORIMM=$$RPTMODE^RORX024("HEPBIMM") ; Immunity option chosen
  1. . S RC=$$PARAMS(REPORT,.RORVSDT,.RORVEDT,.SFLAGS) Q:RC<0
  1. . ;--- Report header
  1. . S RC=$$HEADER(REPORT) Q:RC<0
  1. . ;--- Query the registry
  1. . D TPPSETUP^RORTSK01(80)
  1. . S RC=$$QUERY^RORX024A(SFLAGS,.NSPT,RORRTN)
  1. . I RC Q:RC<0
  1. . ;--- Store the results
  1. . D TPPSETUP^RORTSK01(20)
  1. . S RC=$$STORE^RORX024A(REPORT,NSPT,RORRTN)
  1. . I RC Q:RC<0
  1. ;
  1. ;--- Cleanup
  1. K ^TMP(RORRTN,$J)
  1. Q $S(RC<0:RC,1:0)
  1. ;
  1. ;
  1. ;
  1. ;***** OUTPUTS THE REPORT HEADER
  1. ;
  1. ; PARTAG Reference (IEN) to the parent tag
  1. ;
  1. ; Return Values:
  1. ; <0 Error code
  1. ; >0 IEN of the HEADER element
  1. ;
  1. ;;PATIENTS(#,NAME,LAST4,DOD,VAC_NAME,VAC_DATE,LTNAME,DATE,RESULT,ICN,PACT,PCP,FUT_APPT,FUT_CLIN)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="ALL"
  1. ;;PATIENTS(#,NAME,LAST4,AGE,DOD,VAC_NAME,VAC_DATE,LTNAME,DATE,RESULT,ICN,PACT,PCP,FUT_APPT,FUT_CLIN)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="AGE"
  1. ;;PATIENTS(#,NAME,LAST4,DOB,DOD,VAC_NAME,VAC_DATE,LTNAME,DATE,RESULT,ICN,PACT,PCP,FUT_APPT,FUT_CLIN)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="DOB"
  1. ;
  1. N HEADER,LN,RC,CTAG,LTAG
  1. S HEADER=$$HEADER^RORXU002(.RORTSK,PARTAG)
  1. Q:HEADER<0 HEADER
  1. ;automatically build the table defintion(s) listed under the header tag above PATCH 33
  1. ;--- LOINC codes output
  1. I $G(RORIMM) D
  1. . S LTAG=$$ADDVAL^RORTSK11(RORTSK,"LOINC_CODES",,PARTAG)
  1. . S LN=0 F S LN=$O(^TMP("RORX025",$J,"IMM","TYPE",LN)) Q:'LN D
  1. . . S CTAG=$$ADDVAL^RORTSK11(RORTSK,"CODE",,LTAG)
  1. . . D ADDATTR^RORTSK11(RORTSK,CTAG,"CODE",^TMP("RORX025",$J,"IMM","TYPE",LN))
  1. S RC=$$TBLDEF^RORXU002("HEADER^RORX025",HEADER)
  1. Q $S(RC<0:RC,1:HEADER)
  1. ;
  1. ;***** OUTPUTS THE PARAMETERS TO THE REPORT
  1. ;
  1. ; PARTAG Reference (IEN) to the parent tag
  1. ;
  1. ; [.STDT] Start and end dates of the report
  1. ; [.ENDT] are returned via these parameters
  1. ;
  1. ; [.FLAGS] Flags for the $$SKIP^RORXU005 are
  1. ; returned via this parameter
  1. ;
  1. ; Return Values:
  1. ; <0 Error code
  1. ; >0 IEN of the PARAMETERS element
  1. ;
  1. PARAMS(PARTAG,STDT,ENDT,FLAGS) ;
  1. N PARAMS,TMP
  1. S PARAMS=$$PARAMS^RORXU002(.RORTSK,PARTAG,,,.FLAGS)
  1. Q:PARAMS<0 PARAMS
  1. ;--- Process the list of Lab tests/LOINC codes
  1. I $G(RORIMM) D
  1. . D GETIMM^RORX024("RORX025") ;extract the immunity criteria for HEP B
  1. ;--- Process the list of vaccinations
  1. I $G(RORVAC) D
  1. . D GETVAC^RORX024("RORX025") ;extract the vaccine criteria for HEP B
  1. ;---
  1. Q PARAMS
  1. ;
  1. ; -- LOINC codes to check for HEP B immunity
  1. IMMUNITY ; LOINC codes indicating HEP B immunity results by type Line +1 = Surface AB (priority), Line +2 = Core AB
  1. ;;Surface AB^22322-2^10900-9^16935-9^5193-8^5194-6^22323-0^32019-2
  1. ;;Core AB^32685-0^22318-0^13919-6^16933-4^13952-7^22316-4^5187-0^5188-8^22317-2^21005-4
  1. ;;
  1. Q
  1. ;
  1. ; -- List of Hep B vaccines to include
  1. VACCINE ; Hepatitis B vaccine names (% = wild card)
  1. ;;%ENGERIX-B%^%HEP B%^%HEPATITIS B%^HEPATITIS-B%^HEPB%^HEP A&B^HEPA/HEPB%^%HEP A/B%^HEPAB%^HEPATITIS A & B%^HEPATITIS A&B%
  1. ;;HEPATITIS A/B^HEPATITIS AB^TWINRIX%
  1. ;;
  1. Q
  1. ;