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

LRJSML4.m

Go to the documentation of this file.
  1. LRJSML4 ;ALB/GTS - Lab Vista Hospital Location Pre-Patch Utilities;02/24/2010 14:01:37
  1. ;;5.2;LAB SERVICE;**425**;Sep 27, 1994;Build 30
  1. ;
  1. ;
  1. EXTHL(LRES) ;** Create HL output array
  1. ;Create array of active Hospital Locations of type Clinic, Ward, Operating Room
  1. ;Add associated Ward Location to the array
  1. ;Find Room-Beds assocated with the Ward Location
  1. ;
  1. ;INPUT:
  1. ; LRES - Node for array of active locations and room-beds
  1. ;
  1. ;OUTPUT:
  1. ; LRES - List Array of active hospital locations (Clinic, Ward, OR)
  1. ;
  1. ;Set LRES array in the following format:
  1. ;^TMP(545954627,"LRJ SYS",#)=NEW^LOCATION^HL IEN^HL Name^HL Type^Institution^Division^InActive Dt (NULL)^Active Dt(NULL)^Person making change^Chnge Dt/Tm
  1. ;^TMP(545954627,"LRJ SYS",#+1)=NEW^ROOM^HL IEN^HL Name^HL Type^Institution^Division^Room^
  1. ;^TMP(545954627,"LRJ SYS",#+2)=NEW^BED^HL IEN^HL Name^HL Type^Institution^Division^Room^Bed
  1. ;^TMP(545954627,"LRJ SYS",#+3)=NEW^BED^HL IEN^HL Name^HL Type^Institution^Division^Room^Bed
  1. ;
  1. ;IA #10040 allows reference the following fields:
  1. ; Hospital Location #44, Field #.01 [NAME] (LRHLNAME) [FILEMAN]
  1. ; Hospital Location #44, Field #2 [TYPE] (LRHLTYPE) [FILEMAN]
  1. ; Hospital Location #44, Field #3 [INSTITUTION] (LRHLINST) [FILEMAN]
  1. ; Hospital Location #44, Field #3.5 [DIVISION] (LRHLDIV) [FILEMAN]
  1. ; Hospital Location #44, Field #42 [WARD LOCATION FILE POINTER] (LRWPTR) [DIRECT GLOBAL ACCESS]
  1. ; Hospital Location #44, Field #2505 [INACTIVE DATE] (LRINACT) [FILEMAN]
  1. ; Hospital Location #44, Field #2506 [REACTIVATION DATE] (LRREACT) [FILEMAN]
  1. ;
  1. ;IA #1380 allows reference to Room-Bed file:
  1. ; Room-Bed #405.4, Field #.01 [NAME] (LRRMBD) [DIRECT GLOBAL ACCESS]
  1. ; X-Ref on Wards Which Can Assign multiple in Room-Bed file (405.4^W)
  1. ; [^DG(405.4,"W",$E(X,1,30),DA(1),DA)] [DIRECT GLOBAL ACCESS]
  1. ;
  1. NEW LRHLIEN,LRTYPEIN,LRINACTI,LRREACTI,LRNODE,LRNOW
  1. NEW LRLP,LRCHAR
  1. ;Loop HL file screening TYPE and INACTIVE/REACTIVATION dates
  1. ;QUESTION: Does the HLCMS system report items that are not inactive but have future dates?
  1. ;ANSWER: HLCMS reports changes to inactive/active dates.
  1. ; Want to report locations that are now active or will become active in the future.
  1. ; If INACT=NULL then report
  1. ; If INACT'=NULL then...
  1. ; IF ACT>NOW then report [If (INACT<NOW,ACT>NOW)!(INACT>NOW,ACT>NOW)]
  1. ; If INACT>NOW,ACT<NOW then report
  1. ; If INACT<NOW,ACT<NOW,ACT>INACT then report
  1. ;
  1. ;Pull Name, Type, Institution, Division, WL PTR, Inactivation Date, ReActivation Date from file 44
  1. ;Find Room-Beds that have the same WL PTR, check for OOS dates and report if in-service.
  1. DO IOXY^XGF(IOSL-1,53)
  1. WRITE "[Extract Locations..."
  1. SET LRHLIEN=""
  1. SET (LRHLIEN,LRNODE,LRCHAR)=0
  1. D NOW^%DTC
  1. SET LRNOW=%
  1. KILL %,%H,%I,X
  1. FOR SET LRHLIEN=$O(^SC(LRHLIEN)) QUIT:+LRHLIEN'>0 DO
  1. .D HANGCHAR^LRJSMLU(.LRCHAR)
  1. .SET (LRTYPEIN,LRINACTI,LRREACTI)=""
  1. .SET LRTYPEIN=$$GET1^DIQ(44,LRHLIEN_",",2,"I") ;HL Type (INT)
  1. .;
  1. .;IF TYPE IS 'CLINIC', 'WARD', 'OPERATING ROOM'
  1. .IF (LRTYPEIN="C")!(LRTYPEIN="W")!(LRTYPEIN="OR") DO
  1. ..SET LRINACTI=$$GET1^DIQ(44,LRHLIEN_",",2505,"I") ;HL Inact Dte (INT)
  1. ..SET LRREACTI=$$GET1^DIQ(44,LRHLIEN_",",2506,"I") ;HL React Dte (INT)
  1. ..IF LRINACTI="" DO SETARRY(.LRES,.LRNODE,LRHLIEN,LRNOW)
  1. ..IF LRINACTI'="" DO
  1. ...IF LRREACTI>LRNOW DO SETARRY(.LRES,.LRNODE,LRHLIEN,LRNOW)
  1. ...IF LRINACTI>LRNOW,LRREACTI<LRNOW DO SETARRY(.LRES,.LRNODE,LRHLIEN,LRNOW)
  1. ...IF LRINACTI<LRNOW,LRREACTI<LRNOW,LRREACTI>LRINACTI DO SETARRY(.LRES,.LRNODE,LRHLIEN,LRNOW)
  1. QUIT
  1. ;
  1. SETARRY(LRES,LRNODE,LRHLIEN,LRNOW) ;Set Location Array
  1. ;INPUT:
  1. ; LRES - Array to create and return
  1. ; LRNODE - Last node # added to array
  1. ; LRHLIEN - Hospital Location (#44) IEN
  1. ; LRNOW - Date/Time creating array
  1. ;
  1. ;OUTPUT:
  1. ; LRES - Array with Location/Room/Bed nodes added
  1. ;
  1. NEW LRHLNAME,LRHLTYPE,LRINST,LRDIV,LRRMBD,LRINACT,LRREACT,LRWPTR,LRRMBDPT,LRRMOLD,LRBED,LRROOM
  1. SET (LRHLNAME,LRHLTYPE,LRINST,LRDIV,LRRMBD,LRINACT,LRREACT,LRWPTR,LRRMBDPT,LRRMOLD)=""
  1. SET LRNODE=LRNODE+1
  1. SET LRINACT=$$GET1^DIQ(44,LRHLIEN_",",2505) ;HL Inact Dte (EXT)
  1. SET LRREACT=$$GET1^DIQ(44,LRHLIEN_",",2506) ;HL React Dte (EXT)
  1. SET LRHLTYPE=$$GET1^DIQ(44,LRHLIEN_",",2) ;HL Type (EXT)
  1. SET LRHLNAME=$$GET1^DIQ(44,LRHLIEN_",",.01) ;HL Name (EXT)
  1. SET LRINST=$$GET1^DIQ(44,LRHLIEN_",",3) ;HL Inst (EXT)
  1. SET LRDIV=$$GET1^DIQ(44,LRHLIEN_",",3.5) ;HL Div (EXT)
  1. SET LRWPTR=+$P($G(^SC(LRHLIEN,42)),"^") ;Ward Loc PTR (EXT)
  1. SET @LRES@(LRNODE)="NEW^LOCATION^"_LRHLIEN_"^"_LRHLNAME_"^"_LRHLTYPE_"^"_LRINST_"^"_LRDIV_"^"_LRINACT_"^"_LRREACT_"^"_"ADT ADMINISTRATOR <UNKNOWN>"_"^"_LRNOW
  1. FOR SET LRRMBDPT=$O(^DG(405.4,"W",LRWPTR,LRRMBDPT)) QUIT:+LRRMBDPT=0 DO
  1. .SET LRNODE=LRNODE+1
  1. .SET LRRMBD=$P(^DG(405.4,LRRMBDPT,0),"^")
  1. .SET LRROOM=$P(LRRMBD,"-")
  1. .IF LRROOM'=LRRMOLD DO
  1. ..SET @LRES@(LRNODE)="NEW^ROOM^"_LRHLIEN_"^"_LRHLNAME_"^"_LRHLTYPE_"^"_LRINST_"^"_LRDIV_"^"_LRROOM_"^"
  1. ..SET LRRMOLD=LRROOM
  1. ..SET LRNODE=LRNODE+1
  1. .SET LRBED=$P(LRRMBD,"-",2,10)
  1. .SET @LRES@(LRNODE)="NEW^BED^"_LRHLIEN_"^"_LRHLNAME_"^"_LRHLTYPE_"^"_LRINST_"^"_LRDIV_"^"_LRROOM_"^"_LRBED
  1. QUIT
  1. ;
  1. CDRNG ;Protocol: LRJ SYS MAP HL AUDIT QUERY to select the report type
  1. D FULL^VALM1
  1. NEW LRTYPE
  1. SET LRTYPE=$$TYPESEL()
  1. ;
  1. ;Reset screen display
  1. IF LRTYPE'=-1 DO
  1. .DO:LRTYPE="C" INIT
  1. .DO:LRTYPE="I" INIT^LRJSML1
  1. IF LRTYPE=-1 D MSG^LRJSML SET VALMBCK="R"
  1. QUIT
  1. ;
  1. INIT ;* init variables and list array
  1. N LRFROM,LRTO
  1. K ^TMP($J,"LRJ SYS"),^TMP("LRJ SYS USER MANAGER - DATES",$JOB)
  1. K ^TMP("LRJ SYS USER MANAGER - INIT",$JOB)
  1. DO IOXY^XGF(IOSL-1,53)
  1. WRITE "[Extract Locations..."
  1. D CREATRPT(.LRFROM,.LRTO,"^TMP($J,""LRJ SYS"")")
  1. I (+$G(LRFROM)'>0)!(+$G(LRTO)'>0) DO
  1. . S VALMBCK="R"
  1. . S VALMBG=1
  1. I (+$G(LRFROM)>0),(+$G(LRTO)>0) DO
  1. . D CLEAR(LRFROM,LRTO,"^TMP($J,""LRJ SYS"")")
  1. . D HDR^LRJSML
  1. . D MSG^LRJSML
  1. QUIT
  1. ;
  1. CREATRPT(LRFROM,LRTO,LRHLARY) ;Create array of HL changes between selected dates
  1. N DIR
  1. ;
  1. W !!," Enter Hospital Location Extract Date Range...",!
  1. ;
  1. S LRFROM=$$DATEENT("Select Start date: ",,"-NOW")
  1. Q:+LRFROM<1
  1. S LRTO=$$DATEENT(" Select End date: ",LRFROM,"-NOW")
  1. Q:+LRTO<1
  1. SET ^TMP("LRJ SYS USER MANAGER - INIT",$JOB)=0
  1. D HDR^LRJSML
  1. D MSG^LRJSML
  1. ;
  1. ;Call Report API
  1. D BLDREC^LRJSMLA(LRFROM,LRTO,LRHLARY)
  1. ;
  1. Q
  1. ;
  1. DATEENT(LRPRMPT,LRBD,LRED) ;Prompt for extract date
  1. ;INPUT
  1. ; LRPRMPT - Prompt displayed to user
  1. ; LRBD - Begin date of range
  1. ; LRED - End date of range
  1. ;
  1. ;RETURN
  1. ; LRDT
  1. ; SUCCESS: FILEMAN INTERNALLY FORMATED DATE
  1. ; FAILURE: -1
  1. ;
  1. N LRDT,LRGOOD
  1. S LRGOOD=0
  1. S:+$G(LRED)>0 %DT(0)=LRED
  1. S:$G(LRED)["NOW" %DT(0)=LRED
  1. S %DT("A")=LRPRMPT
  1. S %DT("B")="TODAY" ;Default for [Start] date entry
  1. S %DT="AEPST"
  1. D:LRPRMPT["Start" ^%DT ;Prompt for Start date
  1. ;
  1. ;Prompt for End date with conditions
  1. I LRPRMPT["End" DO
  1. . F Q:LRGOOD DO
  1. . . S %DT("B")="NOW" ;Change default for End Date entry
  1. . . D ^%DT
  1. . . W:((Y<LRBD)&(X'="^")&('$D(DTOUT))) " ??",!," End date must follow Begin date!",!
  1. . . S:((Y>LRBD)!(Y=LRBD)!($D(DTOUT))!(X="^")) LRGOOD=1
  1. S LRDT=Y
  1. K Y,%DT
  1. Q LRDT
  1. ;
  1. CLEAR(LRFROM,LRTO,LRHLARY) ;* clean up entries
  1. DO REFRESH(LRFROM,LRTO,LRHLARY)
  1. QUIT
  1. ;
  1. REFRESH(LRFROM,LRTO,LRHLARY) ;* refresh display
  1. DO BUILD(LRFROM,LRTO,LRHLARY)
  1. D MSG^LRJSML
  1. SET VALMBCK="R"
  1. SET VALMBG=1
  1. QUIT
  1. ;
  1. BUILD(LRFROM,LRTO,LRHLARY) ; -- build display array
  1. ;
  1. ;INPUT
  1. ; LRFROM - Start report date (Optional)
  1. ; LRTO - End report date (Optional)
  1. ; LRHLARY - Array of raw data extract (Required)
  1. ;
  1. QUIT:'$D(LRHLARY) ;QUIT if LRHLARY is not defined)
  1. ;
  1. NEW LRSTATUS,LRJERRCT,LRX
  1. DO KILL
  1. DO KILL^VALM10()
  1. SET VALMCNT=0
  1. S LRX=" VistA Hospital Location changes"_$S($D(LRFROM):" from "_LRFROM,1:"")_$S($D(LRTO):" to "_LRTO,1:"")
  1. D ADD^LRJSMLU(.VALMCNT,LRX)
  1. DO CNTRL^VALM10(VALMCNT,1,$LENGTH(LRX)-1,IOUON,IOUOFF_IOINORM)
  1. ;
  1. D KILL
  1. SET ^TMP("LRJ SYS USER MANAGER - DATES",$JOB)=LRFROM_"^"_LRTO
  1. D LISTHL^LRJSML(LRFROM,LRTO,LRHLARY)
  1. ;
  1. ;;D GETLINK^LRJSML1(.VALMCNT,$$GETLINK()) ;;If add function to send HL MFN message, see if can check link here.
  1. Q
  1. ;
  1. KILL ; -- kill off display data array
  1. KILL ^TMP("LRJ SYS MAP HL INIT MGR",$JOB)
  1. QUIT
  1. ;
  1. TYPESEL() ;Select type of report
  1. ;OUTPUT
  1. ; LRJRSLT : "I" - Initialization Extract
  1. ; : "C" - Change Audit Extract
  1. ; : "P" - Inactive Location Extract
  1. ; : -1 - Abort
  1. NEW LRJRSLT
  1. SET LRJRSLT=-1
  1. NEW DIR
  1. SET DIR("A")=" Enter Extract Report Type"
  1. SET DIR(0)="SO^I:Initialization Rpt;C:Location Change Rpt"
  1. SET DIR("?")="^D PROHELP^LRJSML4"
  1. SET DIR("L",1)=" Select one of the following:"
  1. SET DIR("L",2)=" I : Initialization/Current Location Report"
  1. SET DIR("L")=" C : Location Change Report"
  1. DO ^DIR
  1. SET:"ICP"[Y LRJRSLT=Y
  1. SET:($D(DTOUT)!$D(DUOUT)!(Y="")) LRJRSLT=-1
  1. SET:"ICP"'[Y LRJRSLT=-1
  1. KILL DIR,X,Y,DTOUT,DIRUT,DUOUT
  1. QUIT LRJRSLT
  1. ;
  1. PROHELP ;Help with type of report prompt
  1. WRITE !,"Enter 'I' to extract all currently active locations."
  1. WRITE !,"Enter 'C' to extract the location changes for a selected date range."
  1. QUIT