WV14PST1 ;HCIOFO/FT-WV*1*14/Print Sexual Trauma Data Transfer to DG MST Module (cont.) ;4/3/01  16:11
 ;;1.0;WOMEN'S HEALTH;**14**;Sep 30, 1998
 ;
EMAIL ; Create report in mail message
 S WVDASHES=$$REPEAT^XLFSTR("-",79) ;line of dashes
 S WVSPACES=$$REPEAT^XLFSTR(" ",79) ;line of spaces
 S WVDATE=$$FMTE^XLFDT($$NOW^XLFDT(),"2") ;current date & time
 S WVUSER=$$PERSON^WVUTL1(DUZ) ;user's name
 D INTRO
 D HDRY
 I '$D(^TMP($J,"WVYES")) D NONEY
 I $D(^TMP($J,"WVYES")) D YES
 D HDRN
 I '$D(^TMP($J,"WVNO")) D NONEN
 I $D(^TMP($J,"WVNO")) D NO
 D SEND
 Q
HDRY ; header for entries added to MST
 S ^TMP($J,"WVMSG",+$$LINE())=" "
 S ^TMP($J,"WVMSG",+$$LINE())="Patient Data Added to MST Module"
 S ^TMP($J,"WVMSG",+$$LINE())="Report Run by: "_WVUSER
 S ^TMP($J,"WVMSG",+$$LINE())="     Run Date: "_WVDATE
 S ^TMP($J,"WVMSG",+$$LINE())=$$FILLER(55,0)_"DETERMINING"
 S WVX="  PATIENT"
 S WVX=WVX_$$FILLER(34,$L(WVX))_"WH VALUE"
 S WVX=WVX_$$FILLER(44,$L(WVX))_"MST VALUE"
 S WVX=WVX_$$FILLER(55,$L(WVX))_"PROVIDER"
 S ^TMP($J,"WVMSG",+$$LINE())=WVX
 S ^TMP($J,"WVMSG",+$$LINE())=WVDASHES
 Q
HDRN ; header for entries not added to MST
 S ^TMP($J,"WVMSG",+$$LINE())=" "
 S ^TMP($J,"WVMSG",+$$LINE())=" "
 S ^TMP($J,"WVMSG",+$$LINE())="Patient Data Not Added to MST Module"
 S ^TMP($J,"WVMSG",+$$LINE())="Report Run by: "_WVUSER
 S ^TMP($J,"WVMSG",+$$LINE())="     Run Date: "_WVDATE
 S ^TMP($J,"WVMSG",+$$LINE())=" "
 S WVX="  PATIENT"
 S WVX=WVX_$$FILLER(34,$L(WVX))_"WH VALUE"
 S WVX=WVX_$$FILLER(44,$L(WVX))_"REASON DATA NOT ADDED"
 S ^TMP($J,"WVMSG",+$$LINE())=WVX
 S ^TMP($J,"WVMSG",+$$LINE())=WVDASHES
 Q
NONEY ; no wh patient data was added to MST module
 S ^TMP($J,"WVMSG",+$$LINE())="<No Women's Health patient data was added to the MST module>"
 S ^TMP($J,"WVMSG",+$$LINE())="<of the Registration package.>"
 Q
NONEN ; no unsuccessful attempts to add MST data
 S ^TMP($J,"WVMSG",+$$LINE())="<All Women's Health patient data that could be added to the MST>"
 S ^TMP($J,"WVMSG",+$$LINE())="<module was added successfully.>"
 Q
YES ; List patient data successfully added to MST module
 S (WVMGRN,WVMGRO)=""
 F  S WVMGRN=$O(^TMP($J,"WVYES",WVMGRN)) Q:WVMGRN=""  S WVMGR=0 F  S WVMGR=$O(^TMP($J,"WVYES",WVMGRN,WVMGR)) Q:'WVMGR  D
 .I WVMGRN'=WVMGRO S ^TMP($J,"WVMSG",+$$LINE())="CASE MGR: "_WVMGRN S WVMGRO=WVMGRN ;identify cm
 .S WVNAME=""
 .F  S WVNAME=$O(^TMP($J,"WVYES",WVMGRN,WVMGR,WVNAME)) Q:WVNAME=""  S WVDFN=0 F  S WVDFN=$O(^TMP($J,"WVYES",WVMGRN,WVMGR,WVNAME,WVDFN)) Q:'WVDFN  D
 ..S WVNODE=^TMP($J,"WVYES",WVMGRN,WVMGR,WVNAME,WVDFN)
 ..S WVST=$P(WVNODE,U,1),WVDGMST=$P(WVNODE,U,2),WVPROV=$P(WVNODE,U,3)
 ..S WVSSN=$P(WVNODE,U,4)
 ..S WVX="  "_WVNAME
 ..S WVX=WVX_$$FILLER(34,$L(WVX))_WVST
 ..S WVX=WVX_$$FILLER(44,$L(WVX))_WVDGMST
 ..S WVX=WVX_$$FILLER(54,$L(WVX))_WVPROV
 ..S ^TMP($J,"WVMSG",+$$LINE())=WVX
 ..S ^TMP($J,"WVMSG",+$$LINE())="  ("_WVSSN_")"
 ..Q
 .Q
 Q
NO ; List patient data not added to MST module and reason it wasn't added
 S (WVMGRN,WVMGRO)=""
 F  S WVMGRN=$O(^TMP($J,"WVNO",WVMGRN)) Q:WVMGRN=""  S WVMGR=0 F  S WVMGR=$O(^TMP($J,"WVNO",WVMGRN,WVMGR)) Q:'WVMGR  D
 .I WVMGRN'=WVMGRO D
 ..S ^TMP($J,"WVMSG",+$$LINE())="CASE MGR: "_WVMGRN S WVMGRO=WVMGRN ;identify cm
 .S WVNAME=""
 .F  S WVNAME=$O(^TMP($J,"WVNO",WVMGRN,WVMGR,WVNAME)) Q:WVNAME=""  S WVDFN=0 F  S WVDFN=$O(^TMP($J,"WVNO",WVMGRN,WVMGR,WVNAME,WVDFN)) Q:'WVDFN  D
 ..S WVNODE=^TMP($J,"WVNO",WVMGRN,WVMGR,WVNAME,WVDFN)
 ..S WVST=$P(WVNODE,U,1),WVSSN=$P(WVNODE,U,4),WVREASON=$P(WVNODE,U,5)
 ..S WVX="  "_WVNAME
 ..S WVX=WVX_$$FILLER(34,$L(WVX))_WVST
 ..S WVX=WVX_$$FILLER(44,$L(WVX))_WVREASON
 ..S ^TMP($J,"WVMSG",+$$LINE())=WVX
 ..S ^TMP($J,"WVMSG",+$$LINE())="  ("_WVSSN_")"
 ..Q
 .Q
 Q
LINE() ; Increment line counter by 1
 S WVLINE=+$G(WVLINE)+1
 Q WVLINE
 ;
FILLER(L,S) ; Returns the number of spaces desired.
 ; L - larger number
 ; S - smaller number
 ; WVSPACES must be defined.
 I '$D(WVSPACES) Q ""
 Q $E(WVSPACES,1,L-S)
 ;
SEND ; Send mail message to case managers
 S XMDUZ=.5 ;message sender
 S XMSUB="Women's Health patch #14 installed"
 S XMTEXT="^TMP($J,""WVMSG"","
 D ^XMD
 Q
INTRO ; Set message introduction text
 S ^TMP($J,"WVMSG",+$$LINE())="Patch WV*1*14 for the Women's Health (WH) package was installed. This patch"
 S ^TMP($J,"WVMSG",+$$LINE())="modifies the way the WH package stores and retrieves Military Sexual Trauma"
 S ^TMP($J,"WVMSG",+$$LINE())="(MST) data. MST data that was stored in the WH package is now stored in the"
 S ^TMP($J,"WVMSG",+$$LINE())="Registration package. This message identifies WH patients whose MST data was"
 S ^TMP($J,"WVMSG",+$$LINE())="successfully added to the Registration package and those WH patients whose"
 S ^TMP($J,"WVMSG",+$$LINE())="MST data could not be added to the Registration package. If the patient's"
 S ^TMP($J,"WVMSG",+$$LINE())="WH sexual trauma status matched the MST status in the Registration package,"
 S ^TMP($J,"WVMSG",+$$LINE())="then no additional entry was made in the Registration package. MST data was"
 S ^TMP($J,"WVMSG",+$$LINE())="transferred to the Registration package for veterans only. All MST data"
 S ^TMP($J,"WVMSG",+$$LINE())="has been deleted from the WH package. Civilian Sexual Trauma (CST) data"
 S ^TMP($J,"WVMSG",+$$LINE())="continues to be stored in the WH package."
 S ^TMP($J,"WVMSG",+$$LINE())=" "
 S ^TMP($J,"WVMSG",+$$LINE())="To see what other changes were made to the WH reports and displays, please"
 S ^TMP($J,"WVMSG",+$$LINE())="contact your IRMS support person for the WH User Manual changes concerning"
 S ^TMP($J,"WVMSG",+$$LINE())="this patch."
 Q
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HWV14PST1   5678     printed  Sep 23, 2025@20:22:45                                                                                                                                                                                                    Page 2
WV14PST1  ;HCIOFO/FT-WV*1*14/Print Sexual Trauma Data Transfer to DG MST Module (cont.) ;4/3/01  16:11
 +1       ;;1.0;WOMEN'S HEALTH;**14**;Sep 30, 1998
 +2       ;
EMAIL     ; Create report in mail message
 +1       ;line of dashes
           SET WVDASHES=$$REPEAT^XLFSTR("-",79)
 +2       ;line of spaces
           SET WVSPACES=$$REPEAT^XLFSTR(" ",79)
 +3       ;current date & time
           SET WVDATE=$$FMTE^XLFDT($$NOW^XLFDT(),"2")
 +4       ;user's name
           SET WVUSER=$$PERSON^WVUTL1(DUZ)
 +5        DO INTRO
 +6        DO HDRY
 +7        IF '$DATA(^TMP($JOB,"WVYES"))
               DO NONEY
 +8        IF $DATA(^TMP($JOB,"WVYES"))
               DO YES
 +9        DO HDRN
 +10       IF '$DATA(^TMP($JOB,"WVNO"))
               DO NONEN
 +11       IF $DATA(^TMP($JOB,"WVNO"))
               DO NO
 +12       DO SEND
 +13       QUIT 
HDRY      ; header for entries added to MST
 +1        SET ^TMP($JOB,"WVMSG",+$$LINE())=" "
 +2        SET ^TMP($JOB,"WVMSG",+$$LINE())="Patient Data Added to MST Module"
 +3        SET ^TMP($JOB,"WVMSG",+$$LINE())="Report Run by: "_WVUSER
 +4        SET ^TMP($JOB,"WVMSG",+$$LINE())="     Run Date: "_WVDATE
 +5        SET ^TMP($JOB,"WVMSG",+$$LINE())=$$FILLER(55,0)_"DETERMINING"
 +6        SET WVX="  PATIENT"
 +7        SET WVX=WVX_$$FILLER(34,$LENGTH(WVX))_"WH VALUE"
 +8        SET WVX=WVX_$$FILLER(44,$LENGTH(WVX))_"MST VALUE"
 +9        SET WVX=WVX_$$FILLER(55,$LENGTH(WVX))_"PROVIDER"
 +10       SET ^TMP($JOB,"WVMSG",+$$LINE())=WVX
 +11       SET ^TMP($JOB,"WVMSG",+$$LINE())=WVDASHES
 +12       QUIT 
HDRN      ; header for entries not added to MST
 +1        SET ^TMP($JOB,"WVMSG",+$$LINE())=" "
 +2        SET ^TMP($JOB,"WVMSG",+$$LINE())=" "
 +3        SET ^TMP($JOB,"WVMSG",+$$LINE())="Patient Data Not Added to MST Module"
 +4        SET ^TMP($JOB,"WVMSG",+$$LINE())="Report Run by: "_WVUSER
 +5        SET ^TMP($JOB,"WVMSG",+$$LINE())="     Run Date: "_WVDATE
 +6        SET ^TMP($JOB,"WVMSG",+$$LINE())=" "
 +7        SET WVX="  PATIENT"
 +8        SET WVX=WVX_$$FILLER(34,$LENGTH(WVX))_"WH VALUE"
 +9        SET WVX=WVX_$$FILLER(44,$LENGTH(WVX))_"REASON DATA NOT ADDED"
 +10       SET ^TMP($JOB,"WVMSG",+$$LINE())=WVX
 +11       SET ^TMP($JOB,"WVMSG",+$$LINE())=WVDASHES
 +12       QUIT 
NONEY     ; no wh patient data was added to MST module
 +1        SET ^TMP($JOB,"WVMSG",+$$LINE())="<No Women's Health patient data was added to the MST module>"
 +2        SET ^TMP($JOB,"WVMSG",+$$LINE())="<of the Registration package.>"
 +3        QUIT 
NONEN     ; no unsuccessful attempts to add MST data
 +1        SET ^TMP($JOB,"WVMSG",+$$LINE())="<All Women's Health patient data that could be added to the MST>"
 +2        SET ^TMP($JOB,"WVMSG",+$$LINE())="<module was added successfully.>"
 +3        QUIT 
YES       ; List patient data successfully added to MST module
 +1        SET (WVMGRN,WVMGRO)=""
 +2        FOR 
               SET WVMGRN=$ORDER(^TMP($JOB,"WVYES",WVMGRN))
               if WVMGRN=""
                   QUIT 
               SET WVMGR=0
               FOR 
                   SET WVMGR=$ORDER(^TMP($JOB,"WVYES",WVMGRN,WVMGR))
                   if 'WVMGR
                       QUIT 
                   Begin DoDot:1
 +3       ;identify cm
                       IF WVMGRN'=WVMGRO
                           SET ^TMP($JOB,"WVMSG",+$$LINE())="CASE MGR: "_WVMGRN
                           SET WVMGRO=WVMGRN
 +4                    SET WVNAME=""
 +5                    FOR 
                           SET WVNAME=$ORDER(^TMP($JOB,"WVYES",WVMGRN,WVMGR,WVNAME))
                           if WVNAME=""
                               QUIT 
                           SET WVDFN=0
                           FOR 
                               SET WVDFN=$ORDER(^TMP($JOB,"WVYES",WVMGRN,WVMGR,WVNAME,WVDFN))
                               if 'WVDFN
                                   QUIT 
                               Begin DoDot:2
 +6                                SET WVNODE=^TMP($JOB,"WVYES",WVMGRN,WVMGR,WVNAME,WVDFN)
 +7                                SET WVST=$PIECE(WVNODE,U,1)
                                   SET WVDGMST=$PIECE(WVNODE,U,2)
                                   SET WVPROV=$PIECE(WVNODE,U,3)
 +8                                SET WVSSN=$PIECE(WVNODE,U,4)
 +9                                SET WVX="  "_WVNAME
 +10                               SET WVX=WVX_$$FILLER(34,$LENGTH(WVX))_WVST
 +11                               SET WVX=WVX_$$FILLER(44,$LENGTH(WVX))_WVDGMST
 +12                               SET WVX=WVX_$$FILLER(54,$LENGTH(WVX))_WVPROV
 +13                               SET ^TMP($JOB,"WVMSG",+$$LINE())=WVX
 +14                               SET ^TMP($JOB,"WVMSG",+$$LINE())="  ("_WVSSN_")"
 +15                               QUIT 
                               End DoDot:2
 +16                   QUIT 
                   End DoDot:1
 +17       QUIT 
NO        ; List patient data not added to MST module and reason it wasn't added
 +1        SET (WVMGRN,WVMGRO)=""
 +2        FOR 
               SET WVMGRN=$ORDER(^TMP($JOB,"WVNO",WVMGRN))
               if WVMGRN=""
                   QUIT 
               SET WVMGR=0
               FOR 
                   SET WVMGR=$ORDER(^TMP($JOB,"WVNO",WVMGRN,WVMGR))
                   if 'WVMGR
                       QUIT 
                   Begin DoDot:1
 +3                    IF WVMGRN'=WVMGRO
                           Begin DoDot:2
 +4       ;identify cm
                               SET ^TMP($JOB,"WVMSG",+$$LINE())="CASE MGR: "_WVMGRN
                               SET WVMGRO=WVMGRN
                           End DoDot:2
 +5                    SET WVNAME=""
 +6                    FOR 
                           SET WVNAME=$ORDER(^TMP($JOB,"WVNO",WVMGRN,WVMGR,WVNAME))
                           if WVNAME=""
                               QUIT 
                           SET WVDFN=0
                           FOR 
                               SET WVDFN=$ORDER(^TMP($JOB,"WVNO",WVMGRN,WVMGR,WVNAME,WVDFN))
                               if 'WVDFN
                                   QUIT 
                               Begin DoDot:2
 +7                                SET WVNODE=^TMP($JOB,"WVNO",WVMGRN,WVMGR,WVNAME,WVDFN)
 +8                                SET WVST=$PIECE(WVNODE,U,1)
                                   SET WVSSN=$PIECE(WVNODE,U,4)
                                   SET WVREASON=$PIECE(WVNODE,U,5)
 +9                                SET WVX="  "_WVNAME
 +10                               SET WVX=WVX_$$FILLER(34,$LENGTH(WVX))_WVST
 +11                               SET WVX=WVX_$$FILLER(44,$LENGTH(WVX))_WVREASON
 +12                               SET ^TMP($JOB,"WVMSG",+$$LINE())=WVX
 +13                               SET ^TMP($JOB,"WVMSG",+$$LINE())="  ("_WVSSN_")"
 +14                               QUIT 
                               End DoDot:2
 +15                   QUIT 
                   End DoDot:1
 +16       QUIT 
LINE()    ; Increment line counter by 1
 +1        SET WVLINE=+$GET(WVLINE)+1
 +2        QUIT WVLINE
 +3       ;
FILLER(L,S) ; Returns the number of spaces desired.
 +1       ; L - larger number
 +2       ; S - smaller number
 +3       ; WVSPACES must be defined.
 +4        IF '$DATA(WVSPACES)
               QUIT ""
 +5        QUIT $EXTRACT(WVSPACES,1,L-S)
 +6       ;
SEND      ; Send mail message to case managers
 +1       ;message sender
           SET XMDUZ=.5
 +2        SET XMSUB="Women's Health patch #14 installed"
 +3        SET XMTEXT="^TMP($J,""WVMSG"","
 +4        DO ^XMD
 +5        QUIT 
INTRO     ; Set message introduction text
 +1        SET ^TMP($JOB,"WVMSG",+$$LINE())="Patch WV*1*14 for the Women's Health (WH) package was installed. This patch"
 +2        SET ^TMP($JOB,"WVMSG",+$$LINE())="modifies the way the WH package stores and retrieves Military Sexual Trauma"
 +3        SET ^TMP($JOB,"WVMSG",+$$LINE())="(MST) data. MST data that was stored in the WH package is now stored in the"
 +4        SET ^TMP($JOB,"WVMSG",+$$LINE())="Registration package. This message identifies WH patients whose MST data was"
 +5        SET ^TMP($JOB,"WVMSG",+$$LINE())="successfully added to the Registration package and those WH patients whose"
 +6        SET ^TMP($JOB,"WVMSG",+$$LINE())="MST data could not be added to the Registration package. If the patient's"
 +7        SET ^TMP($JOB,"WVMSG",+$$LINE())="WH sexual trauma status matched the MST status in the Registration package,"
 +8        SET ^TMP($JOB,"WVMSG",+$$LINE())="then no additional entry was made in the Registration package. MST data was"
 +9        SET ^TMP($JOB,"WVMSG",+$$LINE())="transferred to the Registration package for veterans only. All MST data"
 +10       SET ^TMP($JOB,"WVMSG",+$$LINE())="has been deleted from the WH package. Civilian Sexual Trauma (CST) data"
 +11       SET ^TMP($JOB,"WVMSG",+$$LINE())="continues to be stored in the WH package."
 +12       SET ^TMP($JOB,"WVMSG",+$$LINE())=" "
 +13       SET ^TMP($JOB,"WVMSG",+$$LINE())="To see what other changes were made to the WH reports and displays, please"
 +14       SET ^TMP($JOB,"WVMSG",+$$LINE())="contact your IRMS support person for the WH User Manual changes concerning"
 +15       SET ^TMP($JOB,"WVMSG",+$$LINE())="this patch."
 +16       QUIT