- PSJ431P ;HPS/DSK - PSJ*5.0*431 PATCH POST INSTALL ROUTINE ;Apr 20, 2022@17:40
- ;;5.0;INPATIENT MEDICATIONS;**431**;16 DEC 97;Build 5
- ;
- Q
- ;
- ;This routine checks for any unit dose or IV "zero level" subscripts
- ;which do not have the sub-file indicator field populated.
- ;
- EN ;
- N PSJDUZ
- S ZTRTN="START^PSJ431P"
- S ZTDESC="PSJ*5.0*431 Post-Install Routine"
- S ZTIO="",ZTDTH=$H
- S PSJDUZ=DUZ
- S ZTSAVE("PSJDUZ")=""
- D ^%ZTLOAD
- W !!,"PSJ*5.0*431 Post-Install Routine has been tasked."
- W !,"TASK NUMBER: ",$G(ZTSK)
- W !!,"The installer will receive a MailMan message"
- W !,"when the search completes.",!
- Q
- ;
- START ;
- N PSJPT,PSJCOUNT,PSJUDCT,PSJIVCT
- ;Kill in case install re-started for some reason.
- K ^XTMP("PSJ431 POST")
- S ^XTMP("PSJ431 POST",0)=$$FMADD^XLFDT(DT,60)_"^"_DT_"^PSJ*5.0*431 Post-Install Routine"
- S ^XTMP("PSJ431 POST",1)="Any internal entry number (IEN) in the PHARMACY PATIENT (#55) file which was"
- S ^XTMP("PSJ431 POST",2)="missing a sub-file entry for Unit Dose (subscript 5) or IV (subscript ""IV"")"
- S ^XTMP("PSJ431 POST",3)="is listed as a subscript under ""UD"" or ""IV""."
- S (PSJPT,PSJCOUNT,PSJUDCT,PSJIVCT)=0
- F S PSJPT=$O(^PS(55,PSJPT)) Q:'PSJPT D
- . S PSJCOUNT=PSJCOUNT+1
- . ;It might not be necessary to pause so as to not consume
- . ;system resources. But pausing anyway to be on the safe side.
- . I PSJCOUNT#50000=0 H 15
- . I $D(^PS(55,PSJPT,5,0)),$P(^(0),"^",2)="" D
- . . S $P(^PS(55,PSJPT,5,0),"^",2)="55.06IA"
- . . S PSJUDCT=PSJUDCT+1
- . . S ^XTMP("PSJ431 POST","UD",PSJPT)=""
- . I $D(^PS(55,PSJPT,"IV",0)),$P(^(0),"^",2)="" D
- . . S $P(^PS(55,PSJPT,"IV",0),"^",2)=55.01
- . . S PSJIVCT=PSJIVCT+1
- . . S ^XTMP("PSJ431 POST","IV",PSJPT)=""
- ;Set total counts for Unit Dose (5) and IV entries which were corrected.
- S ^XTMP("PSJ431 POST","UD")=$S(PSJUDCT=0:"None",1:PSJUDCT)
- S ^XTMP("PSJ431 POST","IV")=$S(PSJIVCT=0:"None",1:PSJIVCT)
- D XTMP,MAIL
- S:$D(ZTQUEUED) ZTREQ="@"
- Q
- ;
- XTMP ;Generate MailMan message and keep in ^XTMP for 60 days
- N PSJSUB
- S PSJSUB="PSJ431 MAILMAN MESSAGE"
- ;Kill in case install re-started for some reason.
- K ^XTMP(PSJSUB)
- S ^XTMP(PSJSUB,0)=$$FMADD^XLFDT(DT,60)_"^"_DT_"^PSJ*5.0*431 POST INSTALL"
- S ^XTMP(PSJSUB,1)=" "
- S ^XTMP(PSJSUB,2)="The post-install routine for PSJ*5.0*431 has completed."
- S ^XTMP(PSJSUB,3)=" "
- S ^XTMP(PSJSUB,4)="The number of instances in the PHARMACY PATIENT (#55) file which"
- S ^XTMP(PSJSUB,5)="were missing sub-file entries in the second piece of the zero"
- S ^XTMP(PSJSUB,6)="node for Unit Dose (subscript 5) and IV (subscript ""IV"") are:"
- S ^XTMP(PSJSUB,7)=" "
- S ^XTMP(PSJSUB,8)="Unit Dose: "_^XTMP("PSJ431 POST","UD")
- S ^XTMP(PSJSUB,9)=" IV: "_^XTMP("PSJ431 POST","IV")
- S ^XTMP(PSJSUB,10)=" "
- I PSJUDCT>0!(PSJIVCT>0) D
- . S ^XTMP(PSJSUB,11)="The appropriate sub-file entries have been filed if they were missing."
- . S ^XTMP(PSJSUB,12)="Details as to which instances were missing sub-file entries can be"
- . S ^XTMP(PSJSUB,13)="found in ^XTMP(""PSJ431 POST"" for the next 60 days."
- Q
- ;
- MAIL ;
- N PSJMY,PSJMIN,PSJMSUB,PSJTEXT
- S PSJMY(PSJDUZ)=""
- S PSJMIN("FROM")="PSJ*5.0*431 Post-Install Routine PSJ431P"
- S PSJMSUB="PSJ*5.0*431 Post-Install Findings"
- S PSJTEXT="^XTMP(""PSJ431 MAILMAN MESSAGE"")"
- D SENDMSG^XMXAPI(PSJDUZ,PSJMSUB,PSJTEXT,.PSJMY,.PSJMIN,"","")
- Q
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSJ431P 3371 printed Apr 23, 2025@18:20:23 Page 2
- PSJ431P ;HPS/DSK - PSJ*5.0*431 PATCH POST INSTALL ROUTINE ;Apr 20, 2022@17:40
- +1 ;;5.0;INPATIENT MEDICATIONS;**431**;16 DEC 97;Build 5
- +2 ;
- +3 QUIT
- +4 ;
- +5 ;This routine checks for any unit dose or IV "zero level" subscripts
- +6 ;which do not have the sub-file indicator field populated.
- +7 ;
- EN ;
- +1 NEW PSJDUZ
- +2 SET ZTRTN="START^PSJ431P"
- +3 SET ZTDESC="PSJ*5.0*431 Post-Install Routine"
- +4 SET ZTIO=""
- SET ZTDTH=$HOROLOG
- +5 SET PSJDUZ=DUZ
- +6 SET ZTSAVE("PSJDUZ")=""
- +7 DO ^%ZTLOAD
- +8 WRITE !!,"PSJ*5.0*431 Post-Install Routine has been tasked."
- +9 WRITE !,"TASK NUMBER: ",$GET(ZTSK)
- +10 WRITE !!,"The installer will receive a MailMan message"
- +11 WRITE !,"when the search completes.",!
- +12 QUIT
- +13 ;
- START ;
- +1 NEW PSJPT,PSJCOUNT,PSJUDCT,PSJIVCT
- +2 ;Kill in case install re-started for some reason.
- +3 KILL ^XTMP("PSJ431 POST")
- +4 SET ^XTMP("PSJ431 POST",0)=$$FMADD^XLFDT(DT,60)_"^"_DT_"^PSJ*5.0*431 Post-Install Routine"
- +5 SET ^XTMP("PSJ431 POST",1)="Any internal entry number (IEN) in the PHARMACY PATIENT (#55) file which was"
- +6 SET ^XTMP("PSJ431 POST",2)="missing a sub-file entry for Unit Dose (subscript 5) or IV (subscript ""IV"")"
- +7 SET ^XTMP("PSJ431 POST",3)="is listed as a subscript under ""UD"" or ""IV""."
- +8 SET (PSJPT,PSJCOUNT,PSJUDCT,PSJIVCT)=0
- +9 FOR
- SET PSJPT=$ORDER(^PS(55,PSJPT))
- if 'PSJPT
- QUIT
- Begin DoDot:1
- +10 SET PSJCOUNT=PSJCOUNT+1
- +11 ;It might not be necessary to pause so as to not consume
- +12 ;system resources. But pausing anyway to be on the safe side.
- +13 IF PSJCOUNT#50000=0
- HANG 15
- +14 IF $DATA(^PS(55,PSJPT,5,0))
- IF $PIECE(^(0),"^",2)=""
- Begin DoDot:2
- +15 SET $PIECE(^PS(55,PSJPT,5,0),"^",2)="55.06IA"
- +16 SET PSJUDCT=PSJUDCT+1
- +17 SET ^XTMP("PSJ431 POST","UD",PSJPT)=""
- End DoDot:2
- +18 IF $DATA(^PS(55,PSJPT,"IV",0))
- IF $PIECE(^(0),"^",2)=""
- Begin DoDot:2
- +19 SET $PIECE(^PS(55,PSJPT,"IV",0),"^",2)=55.01
- +20 SET PSJIVCT=PSJIVCT+1
- +21 SET ^XTMP("PSJ431 POST","IV",PSJPT)=""
- End DoDot:2
- End DoDot:1
- +22 ;Set total counts for Unit Dose (5) and IV entries which were corrected.
- +23 SET ^XTMP("PSJ431 POST","UD")=$SELECT(PSJUDCT=0:"None",1:PSJUDCT)
- +24 SET ^XTMP("PSJ431 POST","IV")=$SELECT(PSJIVCT=0:"None",1:PSJIVCT)
- +25 DO XTMP
- DO MAIL
- +26 if $DATA(ZTQUEUED)
- SET ZTREQ="@"
- +27 QUIT
- +28 ;
- XTMP ;Generate MailMan message and keep in ^XTMP for 60 days
- +1 NEW PSJSUB
- +2 SET PSJSUB="PSJ431 MAILMAN MESSAGE"
- +3 ;Kill in case install re-started for some reason.
- +4 KILL ^XTMP(PSJSUB)
- +5 SET ^XTMP(PSJSUB,0)=$$FMADD^XLFDT(DT,60)_"^"_DT_"^PSJ*5.0*431 POST INSTALL"
- +6 SET ^XTMP(PSJSUB,1)=" "
- +7 SET ^XTMP(PSJSUB,2)="The post-install routine for PSJ*5.0*431 has completed."
- +8 SET ^XTMP(PSJSUB,3)=" "
- +9 SET ^XTMP(PSJSUB,4)="The number of instances in the PHARMACY PATIENT (#55) file which"
- +10 SET ^XTMP(PSJSUB,5)="were missing sub-file entries in the second piece of the zero"
- +11 SET ^XTMP(PSJSUB,6)="node for Unit Dose (subscript 5) and IV (subscript ""IV"") are:"
- +12 SET ^XTMP(PSJSUB,7)=" "
- +13 SET ^XTMP(PSJSUB,8)="Unit Dose: "_^XTMP("PSJ431 POST","UD")
- +14 SET ^XTMP(PSJSUB,9)=" IV: "_^XTMP("PSJ431 POST","IV")
- +15 SET ^XTMP(PSJSUB,10)=" "
- +16 IF PSJUDCT>0!(PSJIVCT>0)
- Begin DoDot:1
- +17 SET ^XTMP(PSJSUB,11)="The appropriate sub-file entries have been filed if they were missing."
- +18 SET ^XTMP(PSJSUB,12)="Details as to which instances were missing sub-file entries can be"
- +19 SET ^XTMP(PSJSUB,13)="found in ^XTMP(""PSJ431 POST"" for the next 60 days."
- End DoDot:1
- +20 QUIT
- +21 ;
- MAIL ;
- +1 NEW PSJMY,PSJMIN,PSJMSUB,PSJTEXT
- +2 SET PSJMY(PSJDUZ)=""
- +3 SET PSJMIN("FROM")="PSJ*5.0*431 Post-Install Routine PSJ431P"
- +4 SET PSJMSUB="PSJ*5.0*431 Post-Install Findings"
- +5 SET PSJTEXT="^XTMP(""PSJ431 MAILMAN MESSAGE"")"
- +6 DO SENDMSG^XMXAPI(PSJDUZ,PSJMSUB,PSJTEXT,.PSJMY,.PSJMIN,"","")
- +7 QUIT