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

BWPROC1.m

Go to the documentation of this file.
BWPROC1 ;IHS/ANMC/MWR - BW ADD/EDIT BW PROCEDURE;25-Feb-2011 17:08;PLS
 ;;2.0;WOMEN'S HEALTH;**7,8,9,11**;MAY 16, 1996
 ;;* MICHAEL REMILLARD, DDS * ALASKA NATIVE MEDICAL CENTER *
 ;;  EDIT A PROCEDURE, ALSO FOLLOW-UP SCREEN.  CALLED BY BWPROC.
 ;
 ;
EDIT2(DA,BWPOP) ;EP
 ;---> EDIT A PROCEDURE.
 ;---> REQUIRED VARIABLES: DA=IEN IN ^BWPCD(.
 S BWPOP=0
 I '$G(DA) D  D OUT^BWUTL3 Q
 .W !,"NO PROCEDURE (DA).  PLEASE CONTACT YOUR SITE MANAGER."
 I '$D(^BWPCD(DA,0)) D  D OUT^BWUTL3 Q
 .W !,"^BWPCD NOT DEFINED.  PLEASE CONTACT YOUR SITE MANAGER."
 S (AUPNPAT,BWDFN)=$P(^BWPCD(DA,0),U,2)
 D SCREEN(DA,.BWPOP)
 ;---> IF ENTRY WAS LOCKED, BWPOP=1.
 Q:BWPOP
 ;
 ;---> NEXT LINES ARE PURELY FOR CDC PURPOSES: IF THIS PROC IS A CBE,
 ;---> AND IF IT WAS STORED UNDER A PAP, UPDATE THE PAP CBE FIELDS.
 I $P(^BWPCD(DA,0),U,4)=27,$$CDC^BWUTL5(DUZ(2)) D
 .;---> QUIT IF NOT STORED UNDER A PAP.
 .Q:'$D(^BWPCD(DA,2))  Q:'$P(^BWPCD(DA,2),U,36)
 .;---> GO UPDATE THE PAP POINTED TO BY FIELD #2.36 OF THIS CBE.
 .D ADDCBE1^BWPROC(DA,$P(^BWPCD(DA,2),U,36))
 Q
 ;
 ;
SCREEN(DA,BWPOP) ;EP
 ;---> EDIT A PROCEDURE WITH SCREENMAN.
 ;---> REQUIRED VARIABLES: DA=IEN IN PROCEDURE FILE.
 ;---> STORE OLD ZERO NODE VALUES IN BWOLD TO COMPARE FOR EDITS,
 ;---> STORE OLD 2 NODE VALUES IN BWOLD2.  IF ZERO NODE HAS CHANGED
 ;---> RE-EXPORT TO PCC; IF ZERO OR 2 NODE CHANGED, FLAG FOR CDC.
 ;
 N BWOLD,BWOLD2,BWPCDN,DDSFILE,DR,Y
 S DDSFILE=9002086.1
 S BWOLD=^BWPCD(DA,0) S:$D(^(2)) BWOLD2=^BWPCD(DA,2)
 ;---> BWCDC=1 IF THIS PROCEDURE SHOULD BE EXPORTED TO CDC.
 S BWPCDN=$P(BWOLD,U,4),BWCDC=$$CDCEXP^BWUTL5(BWPCDN,DUZ(2))
 ;
 ;---> SET DR=TO THE APPROPRIATE FORM.
 D
 .;---> IF THIS IS A COLPOSCOPY-TYPE PROCEDURE, USE FORM-2.
 .I $$COLP^BWUTL4(DA) S DR="[BW PROC-FORM-2-COLP]" Q
 .;
 .;---> IF THIS SITE COLLECTS CDC DATA AND THIS IS A PROCEDURE THAT
 .;---> SHOULD BE EXPORTED (PAP OR MAM) USE FORM-3-CDC-PAP/MAM.
 .I BWCDC!(BWPCDN>24&(BWPCDN<27)) S DR="[BW PROC-FORM-3-CDC-"_$S(BWPCDN=1:"PAP]",1:"MAM]") Q  ;IHS/CMI/THL PATCH 8
 .;---> OTHERWISE, USE FORM 1 (ONLY PAGE 1).
 .I BWPCDN>29,BWPCDN<36 S DR="[BW PROC-FORM-P2]" Q  ;IHS/CMI/THL PATCH 7
 .I BWPCDN=27 S DR="[BW PROC-FORM-1-CBE]" Q
 .I BWPCDN=40 S DR="[BW PROC-FORM-1-HPV]"
 .E  S DR="[BW PROC-FORM-1]" ;IHS/CMI/THL PATCH 7
 ;
 ;---> CALL SCREENMAN.
 D DDS^BWFMAN(DDSFILE,DR,DA,"","",.BWPOP)
 Q:BWPOP
 ;
PCC ;---> PCC EXPORT.
 ;---> QUIT IF THIS IS NOT AN IHS SITE; NO PCC AND NO CDC.
 Q:$$AGENCY^BWUTL5(DUZ(2))'="i"  ;VAMOD
 Q:'$D(DA)  Q:'$D(^BWPCD(DA,0))
 S BWDA=DA,Y=^BWPCD(DA,0) D
 .N DA
 .I '$D(^BWPCD(BWDA,"PCC")) D CREATE^BWPCC(BWDA,DUZ(2),Y) Q
 .I BWOLD'=Y D EDIT^BWPCC(BWDA,DUZ(2),Y,^BWPCD(BWDA,"PCC")) Q
 ;
 ;
CDC ;---> CDC EXPORT.
 ;---> * !NOT CURRENTLY USED.  SAVE IN CASE IMS SWITCHES BACK.
 ;--->    FOR NOW THEY WANT ALL PROCEDURES EXPORTED EACH TIME.
 Q
 S Y=^BWPCD(DA,0)
 ;---> IF PROCEDURE WAS EDITED, THEN CHECK TO FLAG FOR CDC EXPORT.
 I BWOLD'=Y!($S($D(BWOLD2):BWOLD2'=^BWPCD(DA,2),1:0)) D
 .;---> QUIT IF PROCEDURE IS ALREADY MARKED FOR EXPORT.
 .Q:$P(Y,U,17)
 .;---> QUIT IF PROCEDURE RESULT IS ERROR/DISREGARD.
 .Q:$P(Y,U,5)=8
 .;---> QUIT IF SITE NOT EXPORTING OR IF PCD SHOULDN'T BE EXPORTED.
 .Q:'BWCDC
 .;---> FLAG PROCEDURE FOR EXPORT AS AN "UPDATE".
 .D DIE^BWFMAN(9002086.1,".17///2",DA,.BWPOP,1)
 ;
 Q
 ;
 ;
FOLLOWUP(BWDA) ;EP
 ;---> PROCEDURE FOLLOW-UP MENU.
 ;---> REQUIRED VARIABLES: BWDA=IEN IN PROCEDURE FILE.
 ;---> BWLOOP TELLS BWNOTIF (ADD NEW NOTIFICATION) NOT TO OFFER TO EDIT
 ;---> CASE DATA, SINCE THAT OPTION IS ALREADY OFFERED IN THIS LOOP.
 S BWLOOP=1 N BWPOP,BWPOP1,DIR,DIRUT,Y
 F  Q:$D(DIRUT)  D
 .S BWTITLE="*  PROCEDURE FOLLOW-UP MENU  *" D CENTERT^BWUTL5(.BWTITLE)
 .W @IOF,!!,BWTITLE
 .;---> PCDVARS (BELOW) PROVIDES: BWACCN,BWDFN,BWPCDN,BWRESN
 .D PCDVARS^BWUTL3(DA,1),HEADER41^BWUTL7
 .S DIR("A")="   Select A, C, E, P, or <return>: "
 .S DIR(0)="SMOA^a:ADD;c:CLOSE;e:EDIT;p:PRINT"
 .W !!?3,"To take a Follow-up action on this procedure, choose:"
 .W !!?5,"A to ADD a NEW Notification for this patient,"
 .W !?5,"C to review and CLOSE any Open Notifications for this patient,"
 .W !?5,"E to EDIT this Patient's Case Data,"
 .W !?5,"P to PRINT all of the information for this Procedure,"
 .D FACE,NORMAL,CBE
 .W !?5,"or press <return> to continue.",!
 .D ^DIR K DIR
 .Q:$D(DIRUT)
 .I Y="a" D NEW^BWNOTIF(BWDFN,BWACCN) Q
 .I Y="c" D FOLLOW^BWBRNOT(BWDFN) Q
 .I Y="e" D SCREEN^BWPATE(BWDFN) Q
 .I Y="p" D TOP^BWPRPCD(BWDA) Q
 .I Y="f" D FOLLUP^BWFACE(BWDFN) Q
 .I Y="q" D NORMALL^BWNOTIF1(BWDFN,BWACCN,BWSPEC,BWSPTX) Q
 .I Y="b" D ADDCBE^BWPROC(BWDFN,BWDA) Q
 W @IOF
 Q
 ;
FACE ;EP
 ;---> PRINT A FACE SHEET FOR THIS PATIENT.
 W !?5,"F to display/print this Patient's FACE SHEET,"
 S DIR("A")=$P(DIR("A"),"or")_"F, or <return>: "
 S DIR(0)=DIR(0)_";f:FACE"
 Q
 ;
NORMAL ;EP
 ;---> IF RESULT IS NORMAL, ADD OPTION TO QUEUE NORMAL PAP/MAM LETTER.
 ;---> QUIT IF VARIABLES NOT ADEQUATE.
 N X
 Q:'$G(BWPCDN)!('$G(BWRESN))!('$D(BWACCN))
 ;
 ;---> QUIT IF THE RESULT OF THIS PROCEDURE IS NOT NORMAL.
 Q:$P(^BWDIAG(BWRESN,0),U,21)
 ;
 ;---> FOR PAP BWSPEC=1, FOR ANY TYPE OF MAM BWSPEC=2, OTHERWISE 0.
 S BWSPEC=$S(BWPCDN=1:1,$$PMAM^BWUTL6(BWPCDN):2,1:0)
 ;---> QUIT IF NOT A PAP OR MAM.
 Q:'BWSPEC
 ;
 ;---> QUIT IF THIS IS PAP (OR MAM) AND "AUTOQUEUE NORMAL PAP (OR MAM)
 ;---> LETTERS" IS SET TO "NO" IN THE SITE PARAMETERS.
 Q:'$D(^BWSITE(DUZ(2),0))
 Q:BWSPEC=1&('$P(^BWSITE(DUZ(2),0),U,3))
 Q:BWSPEC=2&('$P(^BWSITE(DUZ(2),0),U,7))
 ;
 ;---> QUIT IF ANY NOTIFICATION ALREADY EXISTS FOR THIS ACCESSION#.
 I $D(^BWNOT("C",BWACCN)) D  Q
 .W !
 .W ?5,"* (One or more Notifications already exist for this Procedure.)"
 ;
 ;---> SET TEXT.
 S BWSPTX=$S(BWSPEC=1:"PAP",BWSPEC=2:"MAM",1:"?")
 W !?5,"Q to QUEUE a """,BWSPTX," Result Normal"" letter "
 W "to be sent to this patient,"
 S DIR("A")=$P(DIR("A"),"or")_"Q, or <return>: "
 S DIR(0)=DIR(0)_";q:QUEUE"
 Q
 ;
CBE ;EP
 ;---> ENTER A NEW CBE FOR THIS PATIENT.
 Q:'$D(^BWSITE(DUZ(2),0))
 Q:'$P(^BWSITE(DUZ(2),0),U,9)
 W !?5,"B to add a Clinical BREAST Exam for this patient,"
 S DIR("A")=$P(DIR("A"),"or")_"B, or <return>: "
 S DIR(0)=DIR(0)_";b:BREAST EXAM"
 Q
 ; Call to expand Pre Action event on main Procedure Edit Form
PREACT ;
 ;D:($P($G(^BWPCD(DA,0)),U,4)'=1) UNED^DDSUTL(16,"","",1,"")
 ;D:($P($G(^BWPCD(DA,0)),U,4)'=27) UNED^DDSUTL(17,"","",1,"")
 D:$$COLP^BWUTL4(DA) HLP^DDSUTL(" * Move to PAGE 2 to edit clinical and pathology findings. ")
 D:$G(BWCDC) HLP^DDSUTL(" * Move to PAGE 2 to edit CDC Treatment data. ")
 Q