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

MAGJLS4.m

Go to the documentation of this file.
  1. MAGJLS4 ;WIRMFO/JHC - VistARad RPCs--History List ; 10/17/2022
  1. ;;3.0;IMAGING;**18,76,101,341**;Dec 21, 2022;Build 28
  1. ;;Per VHA Directive 2004-038, this routine should not be modified.
  1. ;; +---------------------------------------------------------------+
  1. ;; | Property of the US Government. |
  1. ;; | No permission to copy or redistribute this software is given. |
  1. ;; | Use of unreleased versions of this software requires the user |
  1. ;; | to execute a written test agreement with the VistA Imaging |
  1. ;; | Development Office of the Department of Veterans Affairs, |
  1. ;; | telephone (301) 734-0100. |
  1. ;; | |
  1. ;; | The Food and Drug Administration classifies this software as |
  1. ;; | a medical device. As such, it may not be changed in any way. |
  1. ;; | Modifications to this software may result in an adulterated |
  1. ;; | medical device under 21CFR820, the use of which is considered |
  1. ;; | to be a violation of US Federal Statutes. |
  1. ;; +---------------------------------------------------------------+
  1. ;;
  1. ;; ISI IMAGING;**99**
  1. Q
  1. ERR N ERR S ERR=$$EC^%ZOSV S ^TMP($J,"RET",0)="0^4~"_ERR
  1. S MAGGRY=$NA(^TMP($J,"RET"))
  1. D @^%ZOSF("ERRTN")
  1. Q:$Q 1 Q
  1. ;
  1. ; Subroutines for Vistarad History List functions
  1. ; Entry Points:
  1. ; HIST -- All History List rpcs go here
  1. ;
  1. HIST(MAGGRY,PARAMS,DATA) ; History List RPC: MAGJ HISTORYLIST
  1. ; PARAMS--TXID ^ TXDUZ ^ TXDIV
  1. ; TXID: Required; designates action to take; see below
  1. ; TXDUZ: Optional; if supplied, get data for another user (Read Only)
  1. ; TXDIV: Optional; if supplied, get data for another division (Read Only)
  1. ; Note: for now, TXDIV is forced to the Logon Division
  1. ; DATA--(optional) array of input data; depends on TXID; see subroutines by TXID
  1. ;
  1. N $ETRAP,$ESTACK S $ETRAP="D ERR^MAGJLS4"
  1. N TXID,TXDUZ,TXDIV,UPDATEOK,DIQUIET,REPLY
  1. K ^TMP($J,"RET")
  1. S TXID=+PARAMS,TXDUZ=+$P(PARAMS,U,2),TXDIV=+$P(PARAMS,U,3)
  1. I 'TXDUZ S TXDUZ=DUZ
  1. S UPDATEOK=TXDUZ=DUZ
  1. S TXDIV=DUZ(2) ; Force to Logon Division for now
  1. S REPLY="0^1~Performing History List operation."
  1. I 'TXID!'("1,2,3"[TXID) S REPLY="0^4~Invalid History List operation requested." G HISTZ
  1. I '$D(DATA)&(TXID=1!TXID=3) S REPLY="0^4~No data supplied for History List update/delete." G HISTZ
  1. I 'UPDATEOK&("1,3"[TXID) S REPLY="0^4~The current History List may not be updated by the current user." G HISTZ
  1. S DIQUIET=1 D DT^DICRW
  1. I TXID=1 D HISTADD(.DATA,TXDUZ,TXDIV) G HISTZ
  1. I TXID=2 D HISTUPD(TXDUZ,TXDIV) D HISTGET(TXDUZ,TXDIV) G HISTZ
  1. I TXID=3 D HISTDEL(.DATA,TXDUZ,TXDIV) G HISTZ
  1. ; I TXID=4 D HISTUPD(TXDUZ,TXDIV) G HISTZ ; for now, do this function with txid 2
  1. HISTZ ;
  1. I 'REPLY S MAGGRY=$NA(^TMP($J,"RET")),@MAGGRY@(0)=REPLY
  1. E ; maggry otherwise has been set by called subroutine
  1. Q
  1. ;
  1. HISTADD(DATA,TXDUZ,TXDIV) ; add records
  1. N IDATA,ILOOP,CT,NOGO,EXID,HISDAT,HISTIEN,MAGRACNT,TS
  1. S IDATA="",CT=0,NOGO=0
  1. F ILOOP=0:1 S IDATA=$O(DATA(IDATA)) Q:IDATA="" D
  1. . S EXID=$P(DATA(IDATA),"|"),HISDAT=$P(DATA(IDATA),"|",2)
  1. . F I=1:1:4 I '+$P(EXID,U,I) S NOGO=1 Q
  1. . I NOGO Q
  1. . L +^XTMP("MAGJ2","HISTORY",TXDUZ,TXDIV):2
  1. . E Q
  1. . S X=$G(^XTMP("MAGJ2","HISTORY",TXDUZ,TXDIV,0)),HISTIEN=+$P(X,U)+1,$P(^(0),U)=HISTIEN
  1. . L -^XTMP("MAGJ2","HISTORY",TXDUZ,TXDIV)
  1. . S ^XTMP("MAGJ2","HISTORY",TXDUZ,TXDIV,0,"ADD",HISTIEN)="|"_EXID_"|"_HISTIEN_U_HISDAT_"|"
  1. . S CT=CT+1
  1. I 'CT S REPLY="0^3~"_$S(ILOOP:"Unable to add records",1:"No records to add")_" to History List." Q
  1. S MAGRACNT=0 D ACTIVE^MAGJLS2(.MAGGRY,9996)
  1. S X=@MAGGRY@(0),X=+X_U_"1~"_$$HISTTL(TXDUZ,TXDIV),@MAGGRY@(0)=X
  1. S TS="" F I=2,0 S TS=TS_$S(TS="":"",1:U)_$$HTFM^XLFDT($H+I,0)
  1. S ^XTMP("MAGJ2",0)=TS_U_"VistaRad List Compile"
  1. S REPLY=1
  1. Q
  1. ;
  1. HISTTL(TXDUZ,TXDIV) ; Build list title string
  1. N LSTTL
  1. S LSTTL="HISTORY LIST for "_$$USERINF^MAGJUTL3(TXDUZ,.01)_" at "_"Station #"_$$STATN^MAGJEX1(TXDIV)
  1. S LSTTL=LSTTL_"|"_TXDUZ ; provide report's DUZ to client
  1. Q LSTTL
  1. ;
  1. HISTGET(TXDUZ,TXDIV) ; Get full History List for input user for division txdiv
  1. N MAGLST,LSTTL,LSTID,MAGLST
  1. S TXDUZ=$G(TXDUZ,DUZ)
  1. S TXDIV=$G(TXDIV,DUZ(2))
  1. N DATA01 S DATA01=9996 ; ISI
  1. D PARAMS^MAGJLS2B(9996)
  1. I 'LSTID S REPLY="0^4~Problem with History List Compile." Q
  1. S LSTTL=$$HISTTL(TXDUZ,DUZ(2))
  1. S X=$O(^XTMP("MAGJ2","HISTORY",TXDUZ,TXDIV,0))
  1. I 'X S REPLY="0^1~No exams found for: "_LSTTL Q
  1. S MAGLST=$NA(^XTMP("MAGJ2","HISTORY",TXDUZ,TXDIV))
  1. D LSTOUT^MAGJLS2B(.MAGGRY,LSTID,MAGLST)
  1. S REPLY=1
  1. Q
  1. ;
  1. HISTDEL(DATA,TXDUZ,TXDIV) ; delete records
  1. N IDATA,CT,HISTIEN,ALLDONE,LAST
  1. S IDATA="",CT=0,ALLDONE=0
  1. L +^XTMP("MAGJ2","HISTORY",TXDUZ,TXDIV):2
  1. E S REPLY="0^2~Unable to access HISTORY File for deleting records; try again later." Q
  1. S MAGGRY=$NA(^TMP($J,"RET"))
  1. F S IDATA=$O(DATA(IDATA)) Q:IDATA=""!ALLDONE D
  1. . S HISTIEN=$P(DATA(IDATA),U)
  1. . I HISTIEN,$D(^XTMP("MAGJ2","HISTORY",TXDUZ,TXDIV,HISTIEN)) K ^(HISTIEN) S CT=CT+1,@MAGGRY@(CT)=HISTIEN Q
  1. . E I HISTIEN="ALL" S HISTIEN=0 D S ALLDONE=1
  1. . . F S HISTIEN=$O(^XTMP("MAGJ2","HISTORY",TXDUZ,TXDIV,HISTIEN)) Q:'HISTIEN K ^(HISTIEN) S CT=CT+1,@MAGGRY@(CT)=HISTIEN
  1. I '$D(^XTMP("MAGJ2","HISTORY",TXDUZ,TXDIV,0,"ADD")) S X=$O(^XTMP("MAGJ2","HISTORY",TXDUZ,TXDIV,""),-1),^(0)=X_U_X
  1. L -^XTMP("MAGJ2","HISTORY",TXDUZ,TXDIV)
  1. I 'CT S REPLY="0^3~No HISTORY List records found to delete."
  1. E S REPLY=CT_"^1~"_CT_" HISTORY List records deleted."
  1. S @MAGGRY@(0)=REPLY
  1. S REPLY=1
  1. Q
  1. ;
  1. HISTUPD(TXDUZ,TXDIV) ; Update selected fields in History List
  1. N LSTTL,CT,NOHIT,RAST,STATUS,REMOTE,RIST1,RIST2,RIST,RISTISME
  1. N EXID,HISTIEN,RARPT,RADFN,RADTI,RACNI,XX1,XX2,T,X,DELETED,HDATE
  1. S CT=0,NOHIT=0
  1. S TXDUZ=$G(TXDUZ,DUZ)
  1. S TXDIV=$G(TXDIV,DUZ(2))
  1. S LSTTL=$$HISTTL(TXDUZ,DUZ(2))
  1. S X=$O(^XTMP("MAGJ2","HISTORY",TXDUZ,TXDIV,0))
  1. I 'X S REPLY="0^1~No exams found for: "_LSTTL Q
  1. L +^XTMP("MAGJ2","HISTORY",TXDUZ,TXDIV):2
  1. E S REPLY="0^2~Unable to access HISTORY File for updating records; try again later." Q
  1. S HISTIEN=0
  1. F S HISTIEN=$O(^XTMP("MAGJ2","HISTORY",TXDUZ,TXDIV,HISTIEN)) Q:'HISTIEN S XX1=$G(^(HISTIEN,1)),XX2=$G(^(2)) D
  1. . S EXID=$P(XX2,"|",2),RARPT=+$P(EXID,U,4),RADFN=+$P(EXID,U),RADTI=+$P(EXID,U,2),RACNI=+$P(EXID,U,3)
  1. . ; <*> Below is for phase 1 Alpha, til have final user setting for this <*> to be removed
  1. . ; Age limit parameter to be passed in with txid 2 rpc call; setting is on client <*>
  1. . S HDATE=$P(XX2,U,13) D Q:DELETED
  1. . . S DELETED=0,HDATE=$P(HDATE,"@")
  1. . . S X=HDATE,%DT="" D ^%DT K %DT
  1. . . I $$FMTH^XLFDT(Y,1)<($H-3) K ^XTMP("MAGJ2","HISTORY",TXDUZ,TXDIV,HISTIEN) S DELETED=1 Q
  1. . ; <*> End of temp change
  1. . I RARPT,RADFN,RADTI,RACNI
  1. . E S NOHIT=NOHIT+1 Q
  1. . D IMGINFO^MAGJUTL2(RARPT,.X) S REMOTE=$P(X,U,4)
  1. . S X=$G(^RADPT(RADFN,"DT",RADTI,"P",RACNI,0))
  1. . I X="" Q ; rad exam deleted
  1. . S RAST=$P(X,U,3),RIST1=$P(X,U,12),RIST2=$P(X,U,15)
  1. . S STATUS=$S(RAST:$P(^RA(72,RAST,0),U),1:"")
  1. . S (RIST,RISTISME)=""
  1. . I RIST1!RIST2 S X=$$RIST^MAGJUTL1(RIST1,RIST2),RIST=$P(X,U),RISTISME=$P(X,U,2)
  1. . S RISTISME=$$RISTISME^MAGJLS2B(RISTISME)
  1. . S $P(XX1,U,16)=RAST,$P(XX1,U,8)=STATUS,$P(XX1,U,12)=REMOTE
  1. . S T=$P(XX2,"|"),$P(T,U,3)=RIST,$P(T,U,7)=RISTISME,$P(XX2,"|")=T
  1. . S ^XTMP("MAGJ2","HISTORY",TXDUZ,TXDIV,HISTIEN,1)=XX1,^(2)=XX2
  1. . S CT=CT+1
  1. S X=$O(^XTMP("MAGJ2","HISTORY",TXDUZ,TXDIV,""),-1),^(0)=X_U_X ; <*> for phase 1 alpha only?
  1. L -^XTMP("MAGJ2","HISTORY",TXDUZ,TXDIV)
  1. S REPLY="0^1~HISTORY File records updated." Q
  1. Q
  1. ;
  1. END Q ;