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

RAORDR2.m

Go to the documentation of this file.
RAORDR2 ;ABV/SCR/MKN - Refer Pending/Hold Requests Reason for Request ; Jul 08, 2022@13:00:02
 ;;5.0;Radiology/Nuclear Medicine;**148,161,170,190**;Mar 16, 1998;Build 1
 ;
 ; Routine/File         IA          Type
 ; -------------------------------------
 ; DETAIL^ORWOR        NONE
 ; ^OR(100             5771,6475     (C)
 ;
 ;
GETREAS ;Get Reason
 N RAARRAY,RACOUNT,RAERR,RAFILE,RAI,RAL,RAMED,RANEXT,RARTRN1
 S RAIENS=RAOIFN_","
 S RAFILE=100.008 ;get order actions
 S RAFIELDS=".01;.1;2;3;4;5;6;12;13;16;17" ;only using .01,2,3,5,6,12
 S RACOUNT=1,RANEXT=0
 F  S RANEXT=$O(^OR(100,RAORDIEN,8,RANEXT)) Q:'+RANEXT  D
 .S RAIENS=RANEXT_","_RAORDIEN_","
 .S RAFIELDS=".01;2;3;7;12;13;21;22;"
 .D GETS^DIQ(RAFILE,RAIENS,RAFIELDS,"E","RARTRN1","RAERR")
 S RAX=$O(^RA(75.2,"B","COMMUNITY CARE APPT",""))
 D:RAX?1.N
 .S ORDIALOG("WP",RAWPN,1,RACOUNT,0)="",RACOUNT=RACOUNT+1
 .S ORDIALOG("WP",RAWPN,1,RACOUNT,0)="  ** Radiology Order placed on hold due to COMMUNITY CARE APPT **",RACOUNT=RACOUNT+1
 .S ORDIALOG("WP",RAWPN,1,RACOUNT,0)="",RACOUNT=RACOUNT+1
 .S ORDIALOG("WP",RAWPN,1,RACOUNT,0)="  Date/Time Ordered: "_$G(RARTRN1(100.008,RAIENS,.01,"E"))_" "_$G(RARTRN1(100.008,RAIENS,2,"E"))_" order entered by "_$G(RARTRN1(100.008,RAIENS,3,"E"))
 .S ORDIALOG("WP",RAWPN,1,RACOUNT+1,0)=""
 .S RACOUNT=RACOUNT+2
 .S ORDIALOG("WP",RAWPN,1,RACOUNT,0)="  Nature of Order: "_$G(RARTRN1(100.008,RAIENS,12,"E"))
 .S ORDIALOG("WP",RAWPN,1,RACOUNT+1,0)=""
 .S RACOUNT=RACOUNT+2
 .S ORDIALOG("WP",RAWPN,1,RACOUNT,0)="  Elec Signature: "_$G(RARTRN1(100.008,RAIENS,5,"E"))_" on "_$G(RARTRN1(100.008,RAIENS,6,"E"))
 S ORDIALOG("WP",RAWPN,1,RACOUNT+1,0)=""
 S RACOUNT=RACOUNT+2
 D GETINFO^RAORDR(.RAARAY) Q:RAQUIT
 S ORDIALOG("WP",RAWPN,1,RACOUNT,0)="  Justification for Community Care:"
 S RACOUNT=RACOUNT+1
 ;P170 - CC Justifications redone
 S ORDIALOG("WP",RAWPN,1,RACOUNT,0)="    "_$P(RAREAS,U,2)
 I $D(RAEXP) D
 .K RAL D BRKLINE^RAORDR(.RAL,"    "_RAEXP,70)
 .D SETLINES
 .Q
 S ORDIALOG("WP",RAWPN,1,RACOUNT+1,0)=""
 S RACOUNT=RACOUNT+2
 S ORDIALOG("WP",RAWPN,1,RACOUNT,0)="  Type of Service: "_$P(RAARAY("TYPEOFSERVICE"),U,2)
 S ORDIALOG("WP",RAWPN,1,RACOUNT+1,0)=""
 S RACOUNT=RACOUNT+2
 S RANEXT=0
 S ORDIALOG("WP",RAWPN,1,RACOUNT,0)="  Category: "_RAORTYP
 S ORDIALOG("WP",RAWPN,1,RACOUNT+1,0)=""
 S RACOUNT=RACOUNT+2
 S ORDIALOG("WP",RAWPN,1,RACOUNT,0)="  Ordering Location: "_RAORDLOC
 S ORDIALOG("WP",RAWPN,1,RACOUNT+1,0)=""
 S RACOUNT=RACOUNT+2
 I RAORPRE'="" D
 .S ORDIALOG("WP",RAWPN,1,RACOUNT,0)="  Pre-Op Scheduled Date/Time: "_RAORPRE
 .S ORDIALOG("WP",RAWPN,1,RACOUNT+1,0)=""
 .S RACOUNT=RACOUNT+2
 I RAORPREG'="" D 
 .S ORDIALOG("WP",RAWPN,1,RACOUNT,0)="  Pregnant: "_RAORPREG
 .S ORDIALOG("WP",RAWPN,1,RACOUNT+1,0)=""
 .S RACOUNT=RACOUNT+2
 S ORDIALOG("WP",RAWPN,1,RACOUNT,0)="  Date Desired (not guaranteed): "_RAORWANT
 S ORDIALOG("WP",RAWPN,1,RACOUNT+1,0)=""
 S RACOUNT=RACOUNT+2
 I $G(RAARAY("THIRDPARTY")) D
 .S ORDIALOG("WP",RAWPN,1,RACOUNT,0)="  Third Party: "_$P(RAARAY("THIRDPARTY"),U,2)
 .S ORDIALOG("WP",RAWPN,1,RACOUNT+1,0)=""
 .S RACOUNT=RACOUNT+2
 I $G(RAARAY("TRAUMA")) D
 .S ORDIALOG("WP",RAWPN,1,RACOUNT,0)="  History of Trauma :"_$P(RAARAY("TRAUMA"),U,2)
 .S RANEXT=0
 .F  S RANEXT=$O(RAARAY("TRAUMA",RANEXT)) Q:RANEXT=""  D
 . .S ORDIALOG("WP",RAWPN,1,RACOUNT+1,0)=""
 . .S RACOUNT=RACOUNT+2
 . .S ORDIALOG("WP",RAWPN,1,RACOUNT,0)=RAARAY("TRAUMA",RANEXT)
 D ORDDET
 Q
 ;
ORDDET ;Get Order Detail
 N RACR,RAHDORD,RAN,RAHDORD,RAOUT,RAX,RAY
 S RAX="",$P(RAX,"-",79)=""
 S ORDIALOG("WP",RAWPN,1,RACOUNT,0)=" ",RACOUNT=RACOUNT+1
 S RAY="Radiology order details "
 S ORDIALOG("WP",RAWPN,1,RACOUNT,0)=RAY_$E(RAX,1,79-$L(RAY)),RACOUNT=RACOUNT+1
 S RAY="Radiology order IEN:"_RAORDIEN
 S ORDIALOG("WP",RAWPN,1,RACOUNT,0)=RAY,RACOUNT=RACOUNT+1
 S ORDIALOG("WP",RAWPN,1,RACOUNT,0)="",RACOUNT=RACOUNT+1
 D DETAIL^ORWOR(.RAOUT,RAORDIEN,RAORVP)
 S RAN=0 F  S RAN=$O(@RAOUT@(RAN)) Q:'RAN  D
 .S ORDIALOG("WP",RAWPN,1,RACOUNT,0)=@RAOUT@(RAN),RACOUNT=RACOUNT+1,ORDIALOG("WP",RAWPN,1,RACOUNT,0)="",RACOUNT=RACOUNT+1
 S RAY="RAD"_$E(RAX,1,76)
 S ORDIALOG("WP",RAWPN,1,RACOUNT,0)=RAY,RACOUNT=RACOUNT+1,ORDIALOG("WP",RAWPN,1,RACOUNT,0)="",RACOUNT=RACOUNT+1
 Q
 ;
SETLINES ;
 S RAI="" F  S RAI=$O(RAL(RAI)) Q:'RAI  S RACOUNT=RACOUNT+1,ORDIALOG("WP",RAWPN,1,RACOUNT,0)="    "_RAL(RAI)
 Q
 ;
GETILOC(RAITYP) ;p170 returns imaging location
 ;It's possible for the order to not have a 'submit to' location, in which case we'll try to
 ;determine a location based on imaging type and user's division or prompt the user.
 ;Also come here if I-LOC from order has no CCC
 ;RAITYP   :Imaging Type from the radiology order (#79.2)
 ;Returns an Imaging Location (#79.1)
 Q:'$D(RAITYP)
 N RAOILOC,RAIL,RAILS,RAS,RASOC,RAUDIV S RAUDIV=DUZ(2) I $D(RAUDIV) D
 .S RAIL="" F  Q:$G(RAOILOC)]""  S RAIL=$O(^RA(79,RAUDIV,"L","B",RAIL)) Q:RAIL=""  D
 ..I RAITYP=$$GET1^DIQ(79.1,RAIL,6,"I")&($O(^RA(79.1,RAIL,"CON",0))) S RAOILOC=RAIL
 ..Q
 .Q
 I $G(RAOILOC)="" D  ;still no location?  Lets prompt the user...
 .D LOCSCRN
 .I $D(RAILS) D
 ..W !,"Please select the "_$$GET1^DIQ(79.2,RAITYP,.01)_" location you want to use.",!
 ..S (RAS,RASOC)="" F  S RAS=$O(RAILS(RAS)) Q:RAS=""  D
 ...S RASOC=RASOC_RAS
 ...Q
 ..N DIR,Y,DIRUT S DIR(0)="S^"_RASOC D ^DIR Q:$D(DIRUT)
 ..S RAOILOC=$G(RAILS(+Y_":"_Y(0)_";"))
 ..Q
 .E  W !!,"There are no consult titles associated with "_$$GET1^DIQ(79.2,RAITYP,.01)_".",!,"Please contact your Radiology ADPAC." Q
 .Q
 Q $S($G(RAOILOC)>0:RAOILOC,1:0)
CCCHK(RADA,RAY) ;p161 -input transform for entering cc consults to the Imaging Location
 ;Matched on I-TYPE for location and Naming Convention.
 ;Ex: COMMUNITY CARE-IMAGING GENERAL RADIOLOGY-AUTO
 ;Allows for site identifier appension
 ;RADA = ILOC
 N RAITYP,RACON,RASTR,RAM
 S RAITYP=$$GET1^DIQ(79.1,RADA,6) S:RAITYP="CT SCAN" RAITYP="CT"
 S RASTR=$P(^GMR(123.5,RAY,0),U)
 S RACON="COMMUNITY CARE-IMAGING "_RAITYP
 I RAITYP="MAMMOGRAPHY" Q $S(($P(RASTR," DIAGNOSTIC-AUTO",1)=RACON)!($P(RASTR," SCREEN-AUTO",1)=RACON):1,1:0)
 E  Q $S($P(RASTR,"-AUTO",1)=RACON:1,1:0)
 ;
LOCSCRN() ;Screen for user prompt to select the i-loc for the order referral
 N RAI,RAC S (RAI,RAC)=0
 F  S RAI=$O(^RA(79.1,"BIMG",RAITYP,RAI)) Q:RAI=""  D
 .Q:$P(^RA(79.1,RAI,0),U,19)]""  ;inactive
 .Q:'$O(^RA(79.1,RAI,"CON",0))  ;no CCC
 .S RAC=RAC+1 ;ctr
 .S RAILS(RAC_":"_$$GET1^DIQ(79.1,RAI,.01)_";")=RAI
 .Q
 Q