WVTDALRT ;ISP/RFR - TDRUGS STATUS CHANGE ALERTS;Dec 01, 2020@12:39
 ;;1.0;WOMEN'S HEALTH;**24,26**;Sep 30, 1998;Build 624
 Q
ALERT(WVDFN,WVRECIP,WVMSG,WVCOUN,WVORDERS) ;Create and send alert
 ; EN^ORB3 (IA #1362): This component generates the CPRS alert
 ; INPUT: WVDFN - Patient IEN file #2
 ;        WVRECIP - Array of alert recipients IEN file #200
 ;                  WVRECIP(IEN)=""
 ;        WVMSG - Text of the alert
 ;        WVCOUN - 1 to include "Counsel rist/benefit." in alert text
 ;                 0 (default) to not include the text
 ;        WVORDER - Caret-delimited list of orders to display
 I ($G(WVDFN)=""!($D(WVRECIP)<10)!($G(WVMSG)="")!($G(WVORDERS)="")) Q
 N WVORIEN
 S WVCOUN=$G(WVCOUN,0),WVORIEN=$$GETNOTID^ORBSMART("PREG/LACT UNSAFE ORDERS")
 D:WVORIEN>0 EN^ORB3(WVORIEN,WVDFN,"",.WVRECIP,WVMSG_$S(WVCOUN:" Counsel risk/benefit.",1:""),";"_WVORDERS)
 Q
 ;
DELALERT(WVMSG,WVDFN) ;Delete existing alerts containing a specific message
 ; DELETE^XQALERT (IA #10081): This component deletes a single alert
 ; INPUT: WVMSG - Partial text of the alert
 ;        WVDFN - Patient IEN file #2
 N WVNUM,WVALERTS,XQAID
 D GETALRTS(.WVALERTS,$G(WVMSG),$G(WVDFN))
 F WVNUM=1:1:WVALERTS(0)  S XQAID=$G(WVALERTS(WVNUM)) D:XQAID'="" DELETE^XQALERT
 Q
 ;
GETALRTS(WVRETURN,WVMSG,WVDFN) ;Return alert IDs that contain a specific message
 ; PATIENT^XQALERT (IA #10081): This component retrieves all alerts for a patient
 ; INPUT: WVRETURN - reference to array in which to return alert IDs
 ;        WVMSG - Partial text of the alert
 ;        WVDFN - Patient IEN file #2
 ; RETURN: WVRETURN(0)=Number of alert IDs found
 ;         WVRETURN(N)=Alert ID
 ;             where N is a whole number starting at 1 and incrementing by 1
 S WVRETURN(0)=0
 I $G(WVMSG)=""!($G(WVDFN)<1) Q
 N WVNUM
 K ^TMP($J,"WVALERTS")
 D PATIENT^XQALERT($NA(^TMP($J,"WVALERTS")),WVDFN)
 S WVNUM=0 F  S WVNUM=$O(^TMP($J,"WVALERTS",WVNUM)) Q:'WVNUM  D
 .I $P(^TMP($J,"WVALERTS",WVNUM),U)[WVMSG,$P($P(^(WVNUM),U,2),";")="OR,"_WVDFN_",79" D
 ..S WVRETURN(0)=1+WVRETURN(0),WVRETURN(WVRETURN(0))=$P(^TMP($J,"WVALERTS",WVNUM),U,2)
 K ^TMP($J,"WVALERTS")
 Q
LACT(WVDFN,WVLASTAT) ;Entry point for processing lactation status change
 ; CALLED BY: LACTATION STATUS field (#21) of the LACTATIONS multiple field
 ;            (#50) in the WV PATIENT file (#790)
 ; INPUT: WVDFN - Patient IEN file #2
 ;        WVLASTAT - New lacation status
 Q:$G(WVNOALRT)
 I $G(WVDFN)<1!("^1^0^"'[(U_$G(WVLASTAT)_U)) Q
 I WVLASTAT D
 .D REVIEW(WVDFN,"Lactating.",,1)
 I 'WVLASTAT D DELALERT("Lactating.",WVDFN)
 Q
 ;
METHOD(WVDFN,WVDA,WVNEWREC,WVNCON)  ;Entry point for saving contraceptive method(s)
 ; FILE^DIE (IA #2053): This component updates an existing record in a file
 ; UPDATE^DIE (IA #2053): This component creates a new record in a file
 ; INPUT: WVDFN - IEN of the patient in the WV PATIENT file (#790)
 ;        WVDA - reference to FileMan DA array of parent internal entry
 ;               numbers
 ;        WVNEWREC - flag indicating whether parent is new record (1) or existing
 ;                   record (0)
 ;        WVNCON - Reference to array containing new methods used in FileMan
 ;                 FDA format
 ; OUTPUT: -1 - Error; error message returned in second caret piece
 ;         1 - Successfully saved new contraceptive method(s)
 N WVFILE,WVOLESS,WVERROR,WVNLESS,WVENTRY,WVIEN,WVECON,WVPIEN,WVALERTS
 I $G(WVDFN)="" Q -1_U_"Invalid patient identifier"
 I '$D(^WV(790,WVDFN,0)) Q -1_U_"Invalid patient identifier"
 I ('+$G(WVDA))!('+$G(WVDA(1))) Q -1_U_"Invalid parent record identifier"
 S WVPIEN=WVDA,WVPIEN("PREVIOUS")=$S($G(WVNEWREC)=1:$O(^WV(790,WVDFN,4,WVPIEN),-1),1:0)
 S WVOLESS=$$COBP^WVUTL11(WVDFN,$S(WVPIEN("PREVIOUS")>0:WVPIEN("PREVIOUS"),1:WVPIEN))
 Q:$P($G(WVOLESS),U)=-1 WVOLESS
 ;Mark existing methods not in WVNCON for deletion
 S WVIEN=0 F  S WVIEN=$O(^WV(790,WVDFN,4,WVPIEN,3,WVIEN)) Q:'+WVIEN  I '$D(WVNCON(790.17,WVIEN_","_WVPIEN_","_WVDFN_",")) D
 .S WVECON(790.17,WVIEN_","_WVPIEN_","_WVDFN_",",.01)="@"
 ;Move non-new entries from WVNCON into WVECON
 S WVIEN="" F  S WVIEN=$O(WVNCON(790.17,WVIEN)) Q:WVIEN=""  D
 .I $E(WVIEN,1)'="+" M WVECON(790.17,WVIEN)=WVNCON(790.17,WVIEN) K WVNCON(790.17,WVIEN)
 S WVFILE=1
 ;Delete existing methods and save the new/update the existing method(s)
 I $D(WVECON) D FILE^DIE("EK","WVECON","WVERROR")
 I $D(WVERROR) Q "-1"_U_"Unable to update the existing contraceptive methods: "_$$FMERROR^WVUTL11(.WVERROR)
 I $D(WVNCON) D UPDATE^DIE("E","WVNCON",,"WVERROR")
 I $D(WVERROR) Q "-1"_U_"Unable to save the new contraceptive methods: "_$$FMERROR^WVUTL11(.WVERROR)
 ;Pregnant status cannot have contraceptive methods
 I $P($G(^WV(790,WVDFN,4,WVDA,2)),U)=1 D DELALERT($$MTEXT,WVDFN) Q 1
 S WVNLESS=$$COBP^WVUTL11(WVDFN,WVPIEN)
 Q:$P(WVNLESS,U)=-1 WVNLESS
 ; If new method of contraception is less effective then existing method send alert
 I ((WVNLESS<$G(WVOLESS))&(WVNLESS>0))!(+$G(WVOLESS)=0&(WVNLESS=1)) D
 .;Don't send alert if pregnancy is desired
 .I $G(WVNOALRT)!($P($G(^WV(790,WVDFN,4,WVPIEN,2)),U,4)) Q
 .D REVIEW(WVDFN,$$MTEXT,1,,1)
 I (WVNLESS>$G(WVOLESS))!((WVNLESS=0)&(WVOLESS=1)) D DELALERT($$MTEXT,WVDFN)
 Q 1
 ;
MTEXT() ;Entry point to return starting text of notifications sent when the likelihood of
 ;       becoming pregnant changes
 Q "Pregnancy risk high."
PREG(WVDFN,WVPGSTAT) ;Entry point for processing pregnancy status change
 ; CALLED BY: PREGNANCY STATUS field (#11) of the PREGNANCIES multiple field
 ;            (#40) in the WV PATIENT file (#790)
 ; INPUT: WVDFN - Patient IEN file #2
 ;        WVPGSTAT - New pregnancy status
 Q:$G(WVNOALRT)
 I $G(WVDFN)<1!("^1^0^2^"'[(U_$G(WVPGSTAT)_U)) Q
 I WVPGSTAT=1 D REVIEW(WVDFN,"Pregnant.",1,,1)
 I WVPGSTAT'=1 D DELALERT("Pregnant.",WVDFN)
 Q
 ;
REVIEW(WVDFN,WVTEXT,WVCOUN,WVLAC,WVPRG) ;Entry point for reviewing patient's orders
 ; INPUT: WVDFN - Patient IEN file #2
 ;        WVTEXT - The first sentence of the alert text.
 ;        WVCOUN - 1 to include "Counsel rist/benefit." in alert text
 ;                 0 (default) to not include the text
 ;        WVLAC - 1 to indicate calling context is lactation
 ;                0 (default) to indicate calling context is not lactation
 ;        WVPRG - 1 to indicate calling context is pregnancy
 ;                0 (default) to indicate calling context is not pregnancy
 I $G(WVDFN)<1!($G(WVTEXT)="") Q
 S WVTEXT=$G(WVTEXT),WVCOUN=+$G(WVCOUN),WVLAC=+$G(WVLAC),WVPRG=+$G(WVPRG)
 N INPUT,WVRETURN,WVORDCHK,WVORN,WVCMUSED,WVOIN,WVALERTS,WVTXT,WVPROV
 S WVRETURN=$$GETORDRS^WVUTL12(WVDFN,WVLAC)
 S WVORN=0 F  S WVORN=$O(@WVRETURN@(WVORN)) Q:'+WVORN  S WVORDCHK="" F  S WVORDCHK=$O(@WVRETURN@(WVORN,"RULES",WVORDCHK)) Q:WVORDCHK=""  D
 .S WVTXT=WVTEXT
 .I WVLAC Q:WVORDCHK["IMAGING "!(WVORDCHK["PREG ")  D
 ..I $G(@WVRETURN@(WVORN,"IMGAGNT"))=1 S WVCOUN=0,WVTXT=WVTXT_" Imaging agent ordered. Counsel about express/discard milk." Q
 ..S WVCOUN=1,WVTXT=WVTXT_$S(WVORDCHK[1:" Potentially harmful medication.",1:" Medication with undefined risk.")
 .I WVPRG Q:WVORDCHK["LACT "  D
 ..I WVORDCHK["IMAGING" S WVTXT=WVTXT_" Imaging test ordered." Q
 ..S WVTXT=WVTXT_" Potentially harmful medication."
 .S WVPROV=$P($G(@WVRETURN@(WVORN)),U,8) Q:WVPROV=""
 .S WVALERTS(WVTXT,"PROVIDERS",WVPROV)=$S($G(WVALERTS(WVTXT,"PROVIDERS",WVPROV))'="":WVALERTS(WVTXT,"PROVIDERS",WVPROV)_U,1:"")_WVORN
 .S WVALERTS(WVTXT,"WVCOUN")=WVCOUN
 Q:'$D(WVALERTS)
 D DELALERT(WVTEXT,WVDFN)
 S WVTXT="" F  S WVTXT=$O(WVALERTS(WVTXT)) Q:WVTXT=""  S WVPROV=0 F  S WVPROV=$O(WVALERTS(WVTXT,"PROVIDERS",WVPROV)) Q:'+WVPROV  D
 .N WVPROVS S WVPROVS(WVPROV)=""
 .D ALERT(WVDFN,.WVPROVS,WVTXT,WVALERTS(WVTXT,"WVCOUN"),WVALERTS(WVTXT,"PROVIDERS",WVPROV))
 K @WVRETURN
 Q
 ;
TRY(WVDFN,WVTSTAT)  ;Entry point for processing trying to become pregnant
 ; status change
 ; CALLED BY: TRYING TO BECOME PREGNANT field (#14) of the PREGNANCIES multiple field
 ;            (#40) in the WV PATIENT file (#790)
 ; INPUT: WVDFN - Patient IEN file #2
 ;        WVTSTAT - New trying to become pregnant status
 Q:$G(WVNOALRT)
 I $G(WVDFN)<1!("^1^0^"'[(U_$G(WVTSTAT)_U)) Q
 I WVTSTAT D REVIEW(WVDFN,"Pregnancy desired.",1,,1)
 I 'WVTSTAT D DELALERT("Pregnancy desired.",WVDFN)
 Q
 ;
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HWVTDALRT   8353     printed  Sep 23, 2025@20:24:23                                                                                                                                                                                                    Page 2
WVTDALRT  ;ISP/RFR - TDRUGS STATUS CHANGE ALERTS;Dec 01, 2020@12:39
 +1       ;;1.0;WOMEN'S HEALTH;**24,26**;Sep 30, 1998;Build 624
 +2        QUIT 
ALERT(WVDFN,WVRECIP,WVMSG,WVCOUN,WVORDERS) ;Create and send alert
 +1       ; EN^ORB3 (IA #1362): This component generates the CPRS alert
 +2       ; INPUT: WVDFN - Patient IEN file #2
 +3       ;        WVRECIP - Array of alert recipients IEN file #200
 +4       ;                  WVRECIP(IEN)=""
 +5       ;        WVMSG - Text of the alert
 +6       ;        WVCOUN - 1 to include "Counsel rist/benefit." in alert text
 +7       ;                 0 (default) to not include the text
 +8       ;        WVORDER - Caret-delimited list of orders to display
 +9        IF ($GET(WVDFN)=""!($DATA(WVRECIP)<10)!($GET(WVMSG)="")!($GET(WVORDERS)=""))
               QUIT 
 +10       NEW WVORIEN
 +11       SET WVCOUN=$GET(WVCOUN,0)
           SET WVORIEN=$$GETNOTID^ORBSMART("PREG/LACT UNSAFE ORDERS")
 +12       if WVORIEN>0
               DO EN^ORB3(WVORIEN,WVDFN,"",.WVRECIP,WVMSG_$SELECT(WVCOUN:" Counsel risk/benefit.",1:""),";"_WVORDERS)
 +13       QUIT 
 +14      ;
DELALERT(WVMSG,WVDFN) ;Delete existing alerts containing a specific message
 +1       ; DELETE^XQALERT (IA #10081): This component deletes a single alert
 +2       ; INPUT: WVMSG - Partial text of the alert
 +3       ;        WVDFN - Patient IEN file #2
 +4        NEW WVNUM,WVALERTS,XQAID
 +5        DO GETALRTS(.WVALERTS,$GET(WVMSG),$GET(WVDFN))
 +6        FOR WVNUM=1:1:WVALERTS(0)
               SET XQAID=$GET(WVALERTS(WVNUM))
               if XQAID'=""
                   DO DELETE^XQALERT
 +7        QUIT 
 +8       ;
GETALRTS(WVRETURN,WVMSG,WVDFN) ;Return alert IDs that contain a specific message
 +1       ; PATIENT^XQALERT (IA #10081): This component retrieves all alerts for a patient
 +2       ; INPUT: WVRETURN - reference to array in which to return alert IDs
 +3       ;        WVMSG - Partial text of the alert
 +4       ;        WVDFN - Patient IEN file #2
 +5       ; RETURN: WVRETURN(0)=Number of alert IDs found
 +6       ;         WVRETURN(N)=Alert ID
 +7       ;             where N is a whole number starting at 1 and incrementing by 1
 +8        SET WVRETURN(0)=0
 +9        IF $GET(WVMSG)=""!($GET(WVDFN)<1)
               QUIT 
 +10       NEW WVNUM
 +11       KILL ^TMP($JOB,"WVALERTS")
 +12       DO PATIENT^XQALERT($NAME(^TMP($JOB,"WVALERTS")),WVDFN)
 +13       SET WVNUM=0
           FOR 
               SET WVNUM=$ORDER(^TMP($JOB,"WVALERTS",WVNUM))
               if 'WVNUM
                   QUIT 
               Begin DoDot:1
 +14               IF $PIECE(^TMP($JOB,"WVALERTS",WVNUM),U)[WVMSG
                       IF $PIECE($PIECE(^(WVNUM),U,2),";")="OR,"_WVDFN_",79"
                           Begin DoDot:2
 +15                           SET WVRETURN(0)=1+WVRETURN(0)
                               SET WVRETURN(WVRETURN(0))=$PIECE(^TMP($JOB,"WVALERTS",WVNUM),U,2)
                           End DoDot:2
               End DoDot:1
 +16       KILL ^TMP($JOB,"WVALERTS")
 +17       QUIT 
LACT(WVDFN,WVLASTAT) ;Entry point for processing lactation status change
 +1       ; CALLED BY: LACTATION STATUS field (#21) of the LACTATIONS multiple field
 +2       ;            (#50) in the WV PATIENT file (#790)
 +3       ; INPUT: WVDFN - Patient IEN file #2
 +4       ;        WVLASTAT - New lacation status
 +5        if $GET(WVNOALRT)
               QUIT 
 +6        IF $GET(WVDFN)<1!("^1^0^"'[(U_$GET(WVLASTAT)_U))
               QUIT 
 +7        IF WVLASTAT
               Begin DoDot:1
 +8                DO REVIEW(WVDFN,"Lactating.",,1)
               End DoDot:1
 +9        IF 'WVLASTAT
               DO DELALERT("Lactating.",WVDFN)
 +10       QUIT 
 +11      ;
METHOD(WVDFN,WVDA,WVNEWREC,WVNCON) ;Entry point for saving contraceptive method(s)
 +1       ; FILE^DIE (IA #2053): This component updates an existing record in a file
 +2       ; UPDATE^DIE (IA #2053): This component creates a new record in a file
 +3       ; INPUT: WVDFN - IEN of the patient in the WV PATIENT file (#790)
 +4       ;        WVDA - reference to FileMan DA array of parent internal entry
 +5       ;               numbers
 +6       ;        WVNEWREC - flag indicating whether parent is new record (1) or existing
 +7       ;                   record (0)
 +8       ;        WVNCON - Reference to array containing new methods used in FileMan
 +9       ;                 FDA format
 +10      ; OUTPUT: -1 - Error; error message returned in second caret piece
 +11      ;         1 - Successfully saved new contraceptive method(s)
 +12       NEW WVFILE,WVOLESS,WVERROR,WVNLESS,WVENTRY,WVIEN,WVECON,WVPIEN,WVALERTS
 +13       IF $GET(WVDFN)=""
               QUIT -1_U_"Invalid patient identifier"
 +14       IF '$DATA(^WV(790,WVDFN,0))
               QUIT -1_U_"Invalid patient identifier"
 +15       IF ('+$GET(WVDA))!('+$GET(WVDA(1)))
               QUIT -1_U_"Invalid parent record identifier"
 +16       SET WVPIEN=WVDA
           SET WVPIEN("PREVIOUS")=$SELECT($GET(WVNEWREC)=1:$ORDER(^WV(790,WVDFN,4,WVPIEN),-1),1:0)
 +17       SET WVOLESS=$$COBP^WVUTL11(WVDFN,$SELECT(WVPIEN("PREVIOUS")>0:WVPIEN("PREVIOUS"),1:WVPIEN))
 +18       if $PIECE($GET(WVOLESS),U)=-1
               QUIT WVOLESS
 +19      ;Mark existing methods not in WVNCON for deletion
 +20       SET WVIEN=0
           FOR 
               SET WVIEN=$ORDER(^WV(790,WVDFN,4,WVPIEN,3,WVIEN))
               if '+WVIEN
                   QUIT 
               IF '$DATA(WVNCON(790.17,WVIEN_","_WVPIEN_","_WVDFN_","))
                   Begin DoDot:1
 +21                   SET WVECON(790.17,WVIEN_","_WVPIEN_","_WVDFN_",",.01)="@"
                   End DoDot:1
 +22      ;Move non-new entries from WVNCON into WVECON
 +23       SET WVIEN=""
           FOR 
               SET WVIEN=$ORDER(WVNCON(790.17,WVIEN))
               if WVIEN=""
                   QUIT 
               Begin DoDot:1
 +24               IF $EXTRACT(WVIEN,1)'="+"
                       MERGE WVECON(790.17,WVIEN)=WVNCON(790.17,WVIEN)
                       KILL WVNCON(790.17,WVIEN)
               End DoDot:1
 +25       SET WVFILE=1
 +26      ;Delete existing methods and save the new/update the existing method(s)
 +27       IF $DATA(WVECON)
               DO FILE^DIE("EK","WVECON","WVERROR")
 +28       IF $DATA(WVERROR)
               QUIT "-1"_U_"Unable to update the existing contraceptive methods: "_$$FMERROR^WVUTL11(.WVERROR)
 +29       IF $DATA(WVNCON)
               DO UPDATE^DIE("E","WVNCON",,"WVERROR")
 +30       IF $DATA(WVERROR)
               QUIT "-1"_U_"Unable to save the new contraceptive methods: "_$$FMERROR^WVUTL11(.WVERROR)
 +31      ;Pregnant status cannot have contraceptive methods
 +32       IF $PIECE($GET(^WV(790,WVDFN,4,WVDA,2)),U)=1
               DO DELALERT($$MTEXT,WVDFN)
               QUIT 1
 +33       SET WVNLESS=$$COBP^WVUTL11(WVDFN,WVPIEN)
 +34       if $PIECE(WVNLESS,U)=-1
               QUIT WVNLESS
 +35      ; If new method of contraception is less effective then existing method send alert
 +36       IF ((WVNLESS<$GET(WVOLESS))&(WVNLESS>0))!(+$GET(WVOLESS)=0&(WVNLESS=1))
               Begin DoDot:1
 +37      ;Don't send alert if pregnancy is desired
 +38               IF $GET(WVNOALRT)!($PIECE($GET(^WV(790,WVDFN,4,WVPIEN,2)),U,4))
                       QUIT 
 +39               DO REVIEW(WVDFN,$$MTEXT,1,,1)
               End DoDot:1
 +40       IF (WVNLESS>$GET(WVOLESS))!((WVNLESS=0)&(WVOLESS=1))
               DO DELALERT($$MTEXT,WVDFN)
 +41       QUIT 1
 +42      ;
MTEXT()   ;Entry point to return starting text of notifications sent when the likelihood of
 +1       ;       becoming pregnant changes
 +2        QUIT "Pregnancy risk high."
PREG(WVDFN,WVPGSTAT) ;Entry point for processing pregnancy status change
 +1       ; CALLED BY: PREGNANCY STATUS field (#11) of the PREGNANCIES multiple field
 +2       ;            (#40) in the WV PATIENT file (#790)
 +3       ; INPUT: WVDFN - Patient IEN file #2
 +4       ;        WVPGSTAT - New pregnancy status
 +5        if $GET(WVNOALRT)
               QUIT 
 +6        IF $GET(WVDFN)<1!("^1^0^2^"'[(U_$GET(WVPGSTAT)_U))
               QUIT 
 +7        IF WVPGSTAT=1
               DO REVIEW(WVDFN,"Pregnant.",1,,1)
 +8        IF WVPGSTAT'=1
               DO DELALERT("Pregnant.",WVDFN)
 +9        QUIT 
 +10      ;
REVIEW(WVDFN,WVTEXT,WVCOUN,WVLAC,WVPRG) ;Entry point for reviewing patient's orders
 +1       ; INPUT: WVDFN - Patient IEN file #2
 +2       ;        WVTEXT - The first sentence of the alert text.
 +3       ;        WVCOUN - 1 to include "Counsel rist/benefit." in alert text
 +4       ;                 0 (default) to not include the text
 +5       ;        WVLAC - 1 to indicate calling context is lactation
 +6       ;                0 (default) to indicate calling context is not lactation
 +7       ;        WVPRG - 1 to indicate calling context is pregnancy
 +8       ;                0 (default) to indicate calling context is not pregnancy
 +9        IF $GET(WVDFN)<1!($GET(WVTEXT)="")
               QUIT 
 +10       SET WVTEXT=$GET(WVTEXT)
           SET WVCOUN=+$GET(WVCOUN)
           SET WVLAC=+$GET(WVLAC)
           SET WVPRG=+$GET(WVPRG)
 +11       NEW INPUT,WVRETURN,WVORDCHK,WVORN,WVCMUSED,WVOIN,WVALERTS,WVTXT,WVPROV
 +12       SET WVRETURN=$$GETORDRS^WVUTL12(WVDFN,WVLAC)
 +13       SET WVORN=0
           FOR 
               SET WVORN=$ORDER(@WVRETURN@(WVORN))
               if '+WVORN
                   QUIT 
               SET WVORDCHK=""
               FOR 
                   SET WVORDCHK=$ORDER(@WVRETURN@(WVORN,"RULES",WVORDCHK))
                   if WVORDCHK=""
                       QUIT 
                   Begin DoDot:1
 +14                   SET WVTXT=WVTEXT
 +15                   IF WVLAC
                           if WVORDCHK["IMAGING "!(WVORDCHK["PREG ")
                               QUIT 
                           Begin DoDot:2
 +16                           IF $GET(@WVRETURN@(WVORN,"IMGAGNT"))=1
                                   SET WVCOUN=0
                                   SET WVTXT=WVTXT_" Imaging agent ordered. Counsel about express/discard milk."
                                   QUIT 
 +17                           SET WVCOUN=1
                               SET WVTXT=WVTXT_$SELECT(WVORDCHK[1:" Potentially harmful medication.",1:" Medication with undefined risk.")
                           End DoDot:2
 +18                   IF WVPRG
                           if WVORDCHK["LACT "
                               QUIT 
                           Begin DoDot:2
 +19                           IF WVORDCHK["IMAGING"
                                   SET WVTXT=WVTXT_" Imaging test ordered."
                                   QUIT 
 +20                           SET WVTXT=WVTXT_" Potentially harmful medication."
                           End DoDot:2
 +21                   SET WVPROV=$PIECE($GET(@WVRETURN@(WVORN)),U,8)
                       if WVPROV=""
                           QUIT 
 +22                   SET WVALERTS(WVTXT,"PROVIDERS",WVPROV)=$SELECT($GET(WVALERTS(WVTXT,"PROVIDERS",WVPROV))'="":WVALERTS(WVTXT,"PROVIDERS",WVPROV)_U,1:"")_WVORN
 +23                   SET WVALERTS(WVTXT,"WVCOUN")=WVCOUN
                   End DoDot:1
 +24       if '$DATA(WVALERTS)
               QUIT 
 +25       DO DELALERT(WVTEXT,WVDFN)
 +26       SET WVTXT=""
           FOR 
               SET WVTXT=$ORDER(WVALERTS(WVTXT))
               if WVTXT=""
                   QUIT 
               SET WVPROV=0
               FOR 
                   SET WVPROV=$ORDER(WVALERTS(WVTXT,"PROVIDERS",WVPROV))
                   if '+WVPROV
                       QUIT 
                   Begin DoDot:1
 +27                   NEW WVPROVS
                       SET WVPROVS(WVPROV)=""
 +28                   DO ALERT(WVDFN,.WVPROVS,WVTXT,WVALERTS(WVTXT,"WVCOUN"),WVALERTS(WVTXT,"PROVIDERS",WVPROV))
                   End DoDot:1
 +29       KILL @WVRETURN
 +30       QUIT 
 +31      ;
TRY(WVDFN,WVTSTAT) ;Entry point for processing trying to become pregnant
 +1       ; status change
 +2       ; CALLED BY: TRYING TO BECOME PREGNANT field (#14) of the PREGNANCIES multiple field
 +3       ;            (#40) in the WV PATIENT file (#790)
 +4       ; INPUT: WVDFN - Patient IEN file #2
 +5       ;        WVTSTAT - New trying to become pregnant status
 +6        if $GET(WVNOALRT)
               QUIT 
 +7        IF $GET(WVDFN)<1!("^1^0^"'[(U_$GET(WVTSTAT)_U))
               QUIT 
 +8        IF WVTSTAT
               DO REVIEW(WVDFN,"Pregnancy desired.",1,,1)
 +9        IF 'WVTSTAT
               DO DELALERT("Pregnancy desired.",WVDFN)
 +10       QUIT 
 +11      ;