| 1 | WV14PST ;HCIOFO/FT-WV*1*14 POST INSTALL/Transfer Sexual Trauma Data to DG MST Module ;4/4/01  11:41
 | 
|---|
| 2 |  ;;1.0;WOMEN'S HEALTH;**14**;Sep 30, 1998
 | 
|---|
| 3 |  ;
 | 
|---|
| 4 |  ; This routine uses the following IAs:
 | 
|---|
| 5 |  ; #1625 - $$GET^XUA4A72      (supported)
 | 
|---|
| 6 |  ; #2716 - $$GETSTAT^DGMSTAPI (supported)
 | 
|---|
| 7 |  ; #2716 - $$NEWSTAT^DGMSTAPI (supported)
 | 
|---|
| 8 |  ; #1157 - $$DELETE^XPDMENU   (supported)
 | 
|---|
| 9 |  ;
 | 
|---|
| 10 | DESC ; Description of post install
 | 
|---|
| 11 |  ; This post install converts the WH Sexual Trauma data (File 790,
 | 
|---|
| 12 |  ; Field .27) into a Military Sexual Trauma (MST) value and a Civilian
 | 
|---|
| 13 |  ; Sexual Trauma (CST) value. The MST value is then transferred to the
 | 
|---|
| 14 |  ; Registration package. The CST value is stored in the Women's Health
 | 
|---|
| 15 |  ; package. The MST module tracks data for veterans only. Data for
 | 
|---|
| 16 |  ; non-veterans is not added to the MST module. WH patients whose Sexual
 | 
|---|
| 17 |  ; Trauma value is 'Military', 'Civilian', 'Both' or 'None' will have
 | 
|---|
| 18 |  ; that value translated into a MST value and added to the MST module.
 | 
|---|
| 19 |  ;  WH value      MST value     CST value
 | 
|---|
| 20 |  ;  --------      ---------     ---------
 | 
|---|
| 21 |  ;  Military      Yes           No
 | 
|---|
| 22 |  ;  Civilian      No            Yes
 | 
|---|
| 23 |  ;  Both          Yes           Yes
 | 
|---|
| 24 |  ;  None          No            No
 | 
|---|
| 25 |  ;  <null>        no transfer   Unknown
 | 
|---|
| 26 |  ;
 | 
|---|
| 27 |  ; NOTE: If a WH patient is already in the MST module with a value of
 | 
|---|
| 28 |  ; 'Yes' then no additional MST entry is made. Also, if a WH patient
 | 
|---|
| 29 |  ; is already in the MST module with a value of 'No' and the WH Sexual
 | 
|---|
| 30 |  ; Trauma value is 'None' or 'Civilian' then no additional MST entry
 | 
|---|
| 31 |  ; is made.
 | 
|---|
| 32 |  ; The provider who determined the value must be stored in the MST
 | 
|---|
| 33 |  ; module. If the case manager associated with the patient or the user
 | 
|---|
| 34 |  ; running this option is a provider, then the case manager or the user
 | 
|---|
| 35 |  ; is identified as the provider who did the screening. If neither is
 | 
|---|
| 36 |  ; a provider, then that patient's data is not added to the MST module.
 | 
|---|
| 37 |  ; This option will display a list of WH patients whose data was added
 | 
|---|
| 38 |  ; to the MST module. It will also display a list of WH patients whose
 | 
|---|
| 39 |  ; data could not be added to the MST module. These lists are then sent
 | 
|---|
| 40 |  ; to the case managers in a MailMan message.
 | 
|---|
| 41 |  ;
 | 
|---|
| 42 | EN ; Run in the background
 | 
|---|
| 43 |  N WVMESAGE,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE
 | 
|---|
| 44 |  S ZTRTN="Q^WV14PST",ZTDESC="WV*1*14 INSTALLED"
 | 
|---|
| 45 |  S ZTIO="",ZTDTH=$H
 | 
|---|
| 46 |  D ^%ZTLOAD
 | 
|---|
| 47 |  S WVMESAGE="The post-installation will run as background job #"_$G(ZTSK)
 | 
|---|
| 48 |  D MES^XPDUTL(WVMESAGE)
 | 
|---|
| 49 |  Q
 | 
|---|
| 50 | Q ; Entry point for the background job
 | 
|---|
| 51 |  D REMOVE
 | 
|---|
| 52 |  D START
 | 
|---|
| 53 |  D DELETE
 | 
|---|
| 54 |  D EXIT
 | 
|---|
| 55 |  Q
 | 
|---|
| 56 | EXIT ; Exit and clean up
 | 
|---|
| 57 |  K ^TMP($J)
 | 
|---|
| 58 |  K WVCST,WVDASHES,WVDATE,WVDFN,WVDGMST,WVDUZ,WVFLAG,WVLINE,WVMGR,WVMGRN
 | 
|---|
| 59 |  K WVMGRO,WVMSG,WVNAME,WVNODE,WVPROV,WVREASON,WVSPACES,WVSSN,WVST
 | 
|---|
| 60 |  K WVTITLEN,WVTITLEY,WVUSER,WVX
 | 
|---|
| 61 |  K X,XMDUN,XMDUZ,XMSUB,XMTEXT,XMY,XMZ,Y
 | 
|---|
| 62 |  Q
 | 
|---|
| 63 | START ; Loop through FILE 790
 | 
|---|
| 64 |  I $D(ZTQUEUED) S ZTREQ="@"
 | 
|---|
| 65 |  K ^TMP($J)
 | 
|---|
| 66 |  S WVDFN=0
 | 
|---|
| 67 |  F  S WVDFN=$O(^WV(790,WVDFN)) Q:'WVDFN  D SET
 | 
|---|
| 68 |  D EMAIL^WV14PST1 ;send email to case manager(s).
 | 
|---|
| 69 |  Q
 | 
|---|
| 70 | SET ; Set tmp global
 | 
|---|
| 71 |  S WVNODE=$G(^WV(790,WVDFN,0)) Q:WVNODE=""
 | 
|---|
| 72 |  S WVST=$P(WVNODE,U,27) ;WH sexual trauma value
 | 
|---|
| 73 |  ; determine CST value
 | 
|---|
| 74 |  S WVCST=$S(WVST="C":"Y",WVST="B":"Y",WVST="N":"N",WVST="M":"N",1:"U")
 | 
|---|
| 75 |  S:$P(WVNODE,U,28)="" $P(^WV(790,WVDFN,0),U,28)=WVCST ;set CST value
 | 
|---|
| 76 |  S $P(^WV(790,WVDFN,0),U,27)="" ;null out (new) MST field
 | 
|---|
| 77 |  Q:WVST=""  ;no value to transfer to Registration
 | 
|---|
| 78 |  Q:$$VET^WVUTL1A(WVDFN)'="Yes"  ;veterans only
 | 
|---|
| 79 |  S WVMGR=$P(WVNODE,U,10) ;case manager ien
 | 
|---|
| 80 |  I '$D(XMY(WVMGR)) S XMY(WVMGR)="" ;send message to these case mgrs
 | 
|---|
| 81 |  ; $$GETSTAT^DGMSTAPI supported API - IA #2716
 | 
|---|
| 82 |  S WVDGMST=$$GETSTAT^DGMSTAPI(WVDFN) ;get MST value from Registration
 | 
|---|
| 83 |  Q:+WVDGMST=-1  ;couldn't retrieve MST status (i.e., DFN is null)
 | 
|---|
| 84 |  S WVDGMST=$E($P(WVDGMST,U,2),1)
 | 
|---|
| 85 |  Q:WVDGMST="Y"  ;MST already set to YES                                
 | 
|---|
| 86 |  I WVST="N",WVDGMST="N" Q  ;both are NO, don't update MST
 | 
|---|
| 87 |  I WVST="C",WVDGMST="N" Q  ;Civilian & No, don't update MST
 | 
|---|
| 88 |  S WVDGMST=$$CONVERT(WVST)
 | 
|---|
| 89 |  Q:WVDGMST=""  ;not an MST value                                        
 | 
|---|
| 90 |  S WVMGRN=$$PERSON^WVUTL1(WVMGR) ;case manager name
 | 
|---|
| 91 |  S WVPROV=$$PROVIDER(DUZ,WVMGR)
 | 
|---|
| 92 |  S WVNAME=$$NAME^WVUTL1(WVDFN) ;patient name
 | 
|---|
| 93 |  S WVSSN=$$SSN^WVUTL1(WVDFN) ;patient ssn
 | 
|---|
| 94 |  S WVST=$S(WVST="M":"Military",WVST="C":"Civilian",WVST="B":"Both",WVST="N":"None",1:"<no value>")
 | 
|---|
| 95 |  I WVPROV="" S ^TMP($J,"WVNO",WVMGRN,WVMGR,WVNAME,WVDFN)=WVST_U_U_U_WVSSN_U_"Determining Provider Unknown" Q
 | 
|---|
| 96 |  ; $$NEWSTAT^DGMSTAPI supported API - IA 2716
 | 
|---|
| 97 |  ; parameters(dfn,mst status,date/time,provider ien). A null d/t=NOW.
 | 
|---|
| 98 |  S WVFLAG=$$NEWSTAT^DGMSTAPI(WVDFN,WVDGMST,"",WVPROV)
 | 
|---|
| 99 |  ; +WVFLAG will be the ien of the MST entry, if successful
 | 
|---|
| 100 |  I +WVFLAG=-1 S ^TMP($J,"WVNO",WVMGRN,WVMGR,WVNAME,WVDFN)=WVST_U_U_U_WVSSN_U_$P(WVFLAG,U,2) Q  ;no entry made in Registration
 | 
|---|
| 101 |  S WVDGMST=$S(WVDGMST="Y":"Yes",WVDGMST="N":"No",WVDGMST="D":"Declined",WVDGMST="U":"Undefined",1:"<no value>")
 | 
|---|
| 102 |  I WVPROV S WVPROV=$$PERSON^WVUTL1(WVPROV) ;get provider name
 | 
|---|
| 103 |  I +WVFLAG S ^TMP($J,"WVYES",WVMGRN,WVMGR,WVNAME,WVDFN)=WVST_U_WVDGMST_U_WVPROV_U_WVSSN
 | 
|---|
| 104 |  Q
 | 
|---|
| 105 | CONVERT(WVST) ; Convert WH code to MST code
 | 
|---|
| 106 |  ; Convert Military or Both to Yes.
 | 
|---|
| 107 |  ;    "    Civilian or None to No.
 | 
|---|
| 108 |  ; Ignore null.
 | 
|---|
| 109 |  Q $S(WVST="M":"Y",WVST="C":"N",WVST="B":"Y",WVST="N":"N",1:"")
 | 
|---|
| 110 |  ;
 | 
|---|
| 111 | PROVIDER(WVDUZ,WVMGR) ; Determine provider.
 | 
|---|
| 112 |  ; Try case manager first, then try user (i.e., DUZ). 
 | 
|---|
| 113 |  ; $$GET^XUA4A72 supported API - IA #1625
 | 
|---|
| 114 |  I WVMGR I +$$GET^XUA4A72(WVMGR)>0 Q WVMGR
 | 
|---|
| 115 |  I WVDUZ I +$$GET^XUA4A72(WVDUZ)>0 Q WVDUZ
 | 
|---|
| 116 |  Q ""
 | 
|---|
| 117 |  ;
 | 
|---|
| 118 | REMOVE ; Remove [WV ADD TO MST] option from File Maintenance Menu
 | 
|---|
| 119 |  ; Remove [DGMST ENTER NEW MST] option from Patient Management menu
 | 
|---|
| 120 |  N WVFLAG,WVMENU,WVOPTION
 | 
|---|
| 121 |  S WVMENU="WV MENU-PATIENT MANAGEMENT"
 | 
|---|
| 122 |  S WVOPTION="DGMST ENTER NEW MST"
 | 
|---|
| 123 |  S WVFLAG=$$DELETE^XPDMENU(WVMENU,WVOPTION)
 | 
|---|
| 124 |  Q
 | 
|---|
| 125 | DELETE ; Delete the SEXUAL TRAUMA field (FILE 790, Field #.27)
 | 
|---|
| 126 |  N DA,DIK
 | 
|---|
| 127 |  S DIK="^DD(790,",DA=.27,DA(1)=790
 | 
|---|
| 128 |  D ^DIK
 | 
|---|
| 129 |  Q
 | 
|---|