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

RAUTL4.m

Go to the documentation of this file.
  1. RAUTL4 ;HISC/CAH,FPT,GJC AISC/SAW - Utility Routine ; Jan 05, 2022@16:30:37
  1. ;;5.0;Radiology/Nuclear Medicine;**123,186**;Mar 16, 1998;Build 1
  1. ;
  1. ; Supported IA #1252 reference to $$OUTPTPR^SDUTL3 & $$OUTPTAP^SDUTL3 5-P123
  1. ; Supported IA #10035 reference to (^DPT(DFN,.1) 5-P123
  1. ;
  1. ; 5-P123 6/25/2015 MJT RA*5*123 NSR 20140515 add primary care provider if pt is outpatient
  1. ;
  1. EN1 ;ENTRY POINT FOR INPUT TRANSFORM FOR FIELD 5, FILE 74
  1. S RAX=$G(^RARPT(DA,0))
  1. I X="R",$D(^RA(79.1,+$P(^RADPT(+$P(RAX,U,2),"DT",(9999999.9999-$P(RAX,U,3)),0),U,4),0)),$P(^(0),U,17)'["Y" K X W !,"This Imaging Location does not allow the use of 'RELEASED/NOT VERIFIED' status!" G EXIT
  1. G EXIT:X'="V" S RACI=$S($D(RACNI):+RACNI,1:+$O(^RADPT(+$P(RAX,U,2),"DT",9999999.9999-$P(RAX,U,3),"P","B",+$P(RAX,U,4),0)))
  1. I '$D(^RADPT(+$P(RAX,U,2),"DT",9999999.9999-$P(RAX,U,3),"P",RACI,0)) K X W !?3,"Exam information is missing. Unable to continue." G EXIT
  1. S RA0=^RADPT(+$P(RAX,U,2),"DT",9999999.9999-$P(RAX,U,3),"P",RACI,0),RAY=$S($D(^RAMIS(71,+$P(RA0,U,2),0)):$P(^(0),U,7),1:"N")
  1. I RAY'["Y",$D(^VA(200,+$P(RA0,U,12),0)) S RAY=$S($D(^("RA")):$P(^("RA"),U),1:"N")
  1. I RAY["Y",'$D(^VA(200,+$P(RA0,U,15),0)) K X W !?3,"Staff review is required to verify this report!" G EXIT
  1. I '$P(RA0,U,12),'$P(RA0,U,15) K X W !?3,"You must have at least an interpreting 'resident' or 'staff' entered before you can verify this report!" G EXIT
  1. I $D(^RA(79,+$P(^RADPT(+$P(RAX,U,2),"DT",(9999999.9999-$P(RAX,U,3)),0),U,3),.1)),$P(^(.1),U,16)="Y",$O(^RARPT(DA,"I",0))<0 K X W !?3,"An impression was not entered. Verifying is not allowed!"
  1. ; Handle the situation where a report moves from no report status
  1. ; (null) to a report status of verified. This situation happens at
  1. ; sites when creating stub reports through the Imaging software.
  1. I $P(RAX,"^",5)="",(X="V") D
  1. . X:$D(^DD(74,5,1,2,2))#2 ^(2) ; kill 'ARES' xref
  1. . X:$D(^DD(74,5,1,3,2))#2 ^(2) ; kill 'ASTF' xref
  1. . Q
  1. EXIT K RA0,RAX,RAY Q
  1. ASK ;Prompt for range of entries, parse response
  1. ;INPUT VARIABLES: ;ch
  1. ; RAF1: If defined, a list or range of numbers are permitted i.e,
  1. ; 1,2,3-8. If not defined, only single number input is permitted.
  1. ; RACNT=highest possible number in range
  1. ; ^TMP($J,"RAEX",n)=array of acceptable numeric responses
  1. ;OUTPUT VARIABLES:
  1. ; RADUP(n)=array of all selected numeric responses
  1. K RADUP S (RAERR,RAI)=0
  1. S X=$$USRSEL($D(RAF1)#2,$G(RACNT)) Q:X="^"!(X="")
  1. ; X returns: a single # -OR- a list of #'s i.e, 1-3,8 or 2,3,4 -OR- '^'
  1. I '$D(RAF1),'$D(^TMP($J,"RAEX",+X)) W !!?3,*7,"Item ",+X," is not a valid selection.",! G ASK
  1. I '$D(RAF1) S X=+X,Y=^TMP($J,"RAEX",+X) Q
  1. PARSE ; Parse out the list of numbers entered by the user.
  1. S RAI=RAI+1,RAPAR=$P(X,",",RAI) G EX:RAPAR="" I RAPAR?.N1"-".N S RADASH="" F RASEL=$P(RAPAR,"-"):1:$P(RAPAR,"-",2) D CHK G ASK:RAERR
  1. I '$D(RADASH) S RASEL=RAPAR D CHK
  1. K RADASH G ASK:RAERR,PARSE
  1. ;
  1. CHK I $D(RADASH),+$P(RAPAR,"-",2)<+$P(RAPAR,"-") S RAERR=1 W !?3,*7,"Invalid range of numbers specified." Q
  1. I RASEL'?.N!(RASEL'=+RASEL)!(RASEL?16.N.E) D Q
  1. . W !?3,$C(7),"Item ",RASEL," is not a valid selection.",!
  1. . S RAERR=1
  1. . Q
  1. I '$D(^TMP($J,"RAEX",RASEL)) W !?3,*7,"Item ",RASEL," is not a valid selection.",! S RAERR=1 Q
  1. I $D(RADUP(RASEL)) W !?3,*7,"Item ",RASEL," was already selected.",! S RAERR=1 Q
  1. S RADUP(RASEL)="" Q
  1. EX S X="" I 'RAERR,$D(RADUP) S X=1
  1. Q
  1. ;
  1. UPPER ;Convert X to uppercase letters, return as Y
  1. S Y=$$UP^XLFSTR(X)
  1. Q
  1. ORDEL ; Inform the 'Rad' user that the 'Order' field is null!
  1. ; Called from the [RA STATUS ENTRY] template.
  1. W !!?5,"The value for the 'Order' field has been deleted, this"
  1. W !?5,"Examination Status is now inactive/invalid. Please use"
  1. W !?5,"the 'List Exams with Inactive/Invalid Statuses' option to"
  1. W !?5,"generate a report showing all inactive/invalid exams.",!,$C(7)
  1. Q
  1. EMAIL ; Sent the message off to the req. physician
  1. Q:'$D(DUZ)#2 ; DUZ not defined!
  1. Q:'($D(^TMP($J,"RA AUTOE"))\10) ; no report data, abort
  1. N DUZ,XMDUZ,XMSUB,XMTEXT,XMY S XMDUZ=.5
  1. S XMTEXT="^TMP($J,""RA AUTOE"","
  1. S XMSUB="Rad/Nuc Med Report ("_$P($G(^RARPT(RA74IEN,0)),"^")_")"
  1. ; *** NSR 20140515 Start Mod add primary care provider if pt is outpatient 5-P123 ***
  1. ; *** Also sends to associate provider if one identified ; 5-P123
  1. S DFN=$P(RA74(0),U,2)
  1. I '$D(^DPT(DFN,.1)) S RAPCP=$$OUTPTPR^SDUTL3(DFN) S:RAPCP'="" XMY($P(RAPCP,U,1))="" S RAAP=$$OUTPTAP^SDUTL3(DFN) S:RAAP'="" XMY($P(RAAP,U,1))="" ; 5-P123
  1. S XMY(RARPHYS)="" D ^XMD K ^TMP($J,"RA AUTOE")
  1. K RAAP,RAPCP ; 5-P123
  1. ; *** NSR 20140515 End Mod add primary care provider if pt is outpatient 5-P123 ***
  1. Q
  1. ENV() ; Check the current environment the software is running under.
  1. ; If package is being installed DO NOT fire off message (0)
  1. ; If package wide variables are missing, DO NOT fire off message (0)
  1. Q:'$D(RACCESS(DUZ))\10!('$D(RAIMGTY))!('$D(RAMDIV))!('$D(RAMDV))!('$D(RAMLC)) 0 ; not in package
  1. Q:$D(XPDNM) 0 ; in environment check OR pre/post install routine
  1. Q 1
  1. INCR(X) ; increment a variable by one
  1. S X=X+1,RAACNT=X
  1. Q RAACNT
  1. ;
  1. USRSEL(RABOOL,RACNT) ; Allows the user to select a number or list of
  1. ; numbers within a certain range.
  1. ; Vars: RABOOL=1 if a list of #'s can be entered i.e, 1-3,8 -or- 2,3,4
  1. ; =0 a single number is the only valid input
  1. ; RACNT=the upper value within the valid range of numbers
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
  1. S DIR("A",1)="Type a '^' to STOP, or"
  1. S DIR("A")="CHOOSE FROM 1-"_RACNT_": "
  1. I RABOOL D ; setup DIR to accept a list of #'s within our range
  1. . S DIR(0)="LACO^1:"_RACNT_":0",DIR("?",1)="Please enter a number or range of numbers seperated by a dash,",DIR("?")="or two or more numbers seperated by a combination of commas and dashes."
  1. . Q
  1. E D ; setup DIR to accept a single number within our range
  1. . S DIR(0)="NAO^1:"_RACNT_":0",DIR("?",1)="Enter the number corresponding to the exam you wish to select.",DIR("?")="A list or range of numbers will not be accepted."
  1. . Q
  1. D ^DIR S:$D(DTOUT)!($D(DUOUT)) Y="^" ; exit iff timeout or '^'
  1. ; this code effects the selection of exam record data when presented
  1. ; to the user from options: 'Profile of Rad/Nuc Med Exams', 'Case
  1. ; No. Exam Edit' & 'Select Report to Print by Patient'.
  1. ; Called from ^RAPTLU (patient exam lookup)
  1. S:$E(Y,$L(Y))="," Y=$$COMMA(Y)
  1. Q Y
  1. COMMA(Y) ; If the last character in a string is a comma, strip it off
  1. ; example: 1-100, becomes 1-100
  1. N RA F RA=$L(Y):-1 Q:$E(Y,RA)'=","
  1. Q $E(Y,1,RA)
  1. ;
  1. ASKFILM(RAITYP,RAY3) ;do higher exam statuses have ASK FOR FILM DATA?
  1. ;set to 'Y' (YES)? <case sensitive> p186
  1. ;Input: RAITYP = imaging type (external)
  1. ; RAY3 = 0 node EXAMINATIONS multiple (#70.03)
  1. ;
  1. ;return: 'X' 0 for don't ask; 1 ask
  1. N RAIEN,RAORD,X,Y S X=0
  1. S (RAORD,Y)=$P($G(^RA(72,+$P(RAY3,U,3),0)),U,3)
  1. ;note: RAORD is order # for current status
  1. F S Y=$O(^RA(72,"AA",RAITYP,Y)) Q:Y="" D Q:X=1
  1. .S RAIEN=$O(^RA(72,"AA",RAITYP,Y,0)) ;IEN file 72
  1. .;^DD(72,.24,0)="ASK FOR FILM DATA?^RS^Y:YES;N:NO;^.2;4^Q
  1. .S:$P($G(^RA(72,RAIEN,.2)),U,4)="Y" X=1
  1. .Q
  1. Q X
  1. ;