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

RA148PST.m

Go to the documentation of this file.
  1. RA148PST ;ABV/MKN - Post Install;10/5/2018 11:28 AM
  1. ;;5.0;Radiology/Nuclear Medicine;**148**;Mar 16, 1998;Build 59
  1. ;
  1. Q
  1. ;
  1. EN ;
  1. ;First change the name of the seven -AUTO consult services (files #123.5 and #101.43),
  1. ;if they exist, to move the hyphen
  1. ; Example: "COMMUNITY CARE IMAGING-CT-AUTO" to "COMMUNITY CARE-IMAGING CT-AUTO"
  1. ;
  1. N DA,DIE,DR,ORN,RAFROM,RAI,RATO,X
  1. F RAI=1:1 S X=$T(LIST+RAI) Q:X=" ;//" S RAFROM=$P(X,";",2),RATO=$P(X,";",3) D
  1. .S DA=$O(^GMR(123.5,"B",RAFROM,"")) D:DA
  1. ..S DIE="^GMR(123.5,",DR=".01///"_RATO D ^DIE
  1. .S DA=$O(^ORD(101.43,"B",$E(RAFROM,1,30),"")) D:DA
  1. ..S X=$$GET1^DIQ(101.43,DA_",",.01)
  1. ..I X=RAFROM S DIE="^ORD(101.43,",DR=".01///"_RATO_";1.1///"_RATO D ^DIE
  1. ;
  1. D QUEUE
  1. ;
  1. Q
  1. ;
  1. LIST ;
  1. ;COMMUNITY CARE IMAGING-CT-AUTO;COMMUNITY CARE-IMAGING CT-AUTO
  1. ;COMMUNITY CARE IMAGING-MAMMOGRAPHY DIAGNOSTIC-AUTO;COMMUNITY CARE-IMAGING MAMMOGRAPHY DIAGNOSTIC-AUTO
  1. ;COMMUNITY CARE IMAGING-MAMMOGRAPHY SCREEN-AUTO;COMMUNITY CARE-IMAGING MAMMOGRAPHY SCREEN-AUTO
  1. ;COMMUNITY CARE IMAGING-MAGNETIC RESONANCE IMAGING-AUTO;COMMUNITY CARE-IMAGING MAGNETIC RESONANCE IMAGING-AUTO
  1. ;COMMUNITY CARE IMAGING-NUCLEAR MEDICINE-AUTO;COMMUNITY CARE-IMAGING NUCLEAR MEDICINE-AUTO
  1. ;COMMUNITY CARE IMAGING-GENERAL RADIOLOGY-AUTO;COMMUNITY CARE-IMAGING GENERAL RADIOLOGY-AUTO
  1. ;COMMUNITY CARE IMAGING-ULTRASOUND-AUTO;COMMUNITY CARE-IMAGING ULTRASOUND-AUTO
  1. ;//
  1. QUEUE ;
  1. N ZTRTN,ZTDESC,ZTREQ,ZTIO,ZTDTH,ZTSK
  1. D BMES^XPDUTL("Calling TaskMan to create background job to change service name where needed in")
  1. D BMES^XPDUTL(" Order Actions multiple of file #100")
  1. S ZTRTN="CHGORAC^RA148PST",ZTDESC="Change service name where needed in Order Actions multiple of file #100",ZTIO="",ZTDTH=$H
  1. D ^%ZTLOAD I '$G(ZTSK) D BMES^XPDUTL("Unable to create TaskMan job - run CHGORAC^RA148PST after install finishes") Q
  1. D BMES^XPDUTL("Post-install queued as task #"_$G(ZTSK))
  1. Q
  1. ;
  1. CHGORAC ;
  1. ;Find orders where the name of the consult might need to be changed in the ORDER ACTIONS multiple
  1. ; Example: "COMMUNITY CARE IMAGING-CT-AUTO" to "COMMUNITY CARE-IMAGING CT-AUTO"
  1. ;
  1. N CT,CTXTMP,CTXTMPPP,DA,IEN,ORACT,ORDATE,ORN,X,X1,X2,XTMP,XTMPPP
  1. S DA=$$NOW^XLFDT,X1=DA,X2=90 D C^%DTC
  1. S XTMP=$NA(^XTMP("RA148PST "_$$FMTE^XLFDT(DA,"5PZ")_" "_$J)),(CT,CTXTMP,CTXTMPPP)=0
  1. K @XTMP S @XTMP@(0)=X_U_DA_U_"List of ORDER ACTION records in file #100 where the name of the consult service was changed"
  1. S XTMPPP=$NA(^XTMP("RA148PST-PP "_$$FMTE^XLFDT(DA,"5PZ")_" "_$J))
  1. K @XTMPPP S @XTMPPP@(0)=X_U_DA_U_"Records Pre and Post"
  1. S ORDATE="3180101" F S ORDATE=$O(^OR(100,"AF",ORDATE)) Q:'ORDATE S IEN=0 D
  1. .F S IEN=$O(^OR(100,"AF",ORDATE,IEN)) Q:'IEN D
  1. ..S ORACT=0 F S ORACT=$O(^OR(100,"AF",ORDATE,IEN,ORACT)) Q:'ORACT D
  1. ...S ORN=0 F S ORN=$O(^OR(100,IEN,8,ORACT,.1,ORN)) Q:'ORN S X=^(ORN,0) D CHKORDAC(X)
  1. S CTXTMP=CTXTMP+1
  1. I 'CT S @XTMP@(CTXTMP)="No records found that needed changing"
  1. E S @XTMP@(CTXTMP)="End of run: "_CT_" record"_$S(CT>1:"s",1:"")_" found and changed"
  1. S ZTREQ="@"
  1. K X S X(1)="RA*5.0*148 - the background job has finished changing the consult records."
  1. I CT=0 S X(2)="No records were changed."
  1. E S X(2)=CT_" record"_$S(CT>1:"s were",1:" was")_" changed"
  1. D MSG(.X)
  1. Q
  1. ;
  1. CHKORDAC(IN) ;
  1. N FROM,I,OR0,ORPNA,TO,Y,Z
  1. F I=1:1 S X=$T(LIST+I) Q:X=" ;//" S FROM=$P(X,";",2),TO=$P(X,";",3) D
  1. .S Y=$F(IN,FROM) Q:'Y
  1. .S Z=$E(IN,1,(Y-$L(FROM))-1)_TO_$E(IN,Y,$L(IN))
  1. .S OR0=$G(^OR(100,IEN,0))
  1. .I OR0="" S ORPNA="Not Known"
  1. .E S ORPNA=$$GET1^DIQ(100,IEN_",",.02,"E")
  1. .S CT=CT+1,CTXTMP=CTXTMP+1,@XTMP@(CTXTMP)=CT_". "_ORPNA_" Order IEN:"_IEN_" Consult to Service/Specialty changed:"
  1. .S CTXTMP=CTXTMP+1,@XTMP@(CTXTMP)=" from "_FROM_" to "_TO
  1. .S CTXTMPPP=CTXTMPPP+1,@XTMPPP@(CTXTMPPP)="^OR(100,"_IEN_",8,"_ORACT_",.1,"_ORN_",0)"
  1. .S @XTMPPP@(CTXTMPPP,1)=^OR(100,IEN,8,ORACT,.1,ORN,0)
  1. .S @XTMPPP@(CTXTMPPP,2)=Z
  1. .S ^OR(100,IEN,8,ORACT,.1,ORN,0)=Z
  1. Q
  1. ;
  1. MSG(SUB) ;create and send message
  1. N XMDUZ,XMSUB,XMZ,XMTEXT,XMY
  1. N IEN,A,B,C,LNCNT S (IEN,A,B,C)=0,LNCNT=1
  1. S XMY(DUZ)=""
  1. S XMDUZ=DUZ
  1. S XMSUB="RA*5.0*148 Post-install"
  1. D XMZ^XMA2 ; call Create Message Module
  1. S XMTEXT="XMTEXT"
  1. M XMTEXT=SUB
  1. D ENL^XMD
  1. D ENT1^XMD
  1. Q
  1. ;