VistA-FOIAVistA/r/OCCURRENCE_SCREEN-QAO/QAOEDT3.m

44 lines
1.9 KiB
Mathematica

QAOEDT3 ;HISC/DAD-BASIC OCCURRENCE SCREEN DATA EDIT ;6/11/93 15:45
;;3.0;Occurrence Screen;;09/14/1993
EN2 ; *** BASIC OS DATA
S QALIMIT="I $P(^(0),""^"",11)'>0",QAOSPROG="EN3^QAOEDT3" D EN2^QAOEDT
EXIT ;
K %,DA,DIC,DIE,DR,I,LINE,LOC,QA,QADATE,QALIMIT,QAOPCENT,QAOS,QAOSD0
K QAOSDATE,QAOSQUIT,QAOSWHAT,QAOSSCRN,QAUDIT,QAOSWHO,X,Y,QAOSDEAD
K QAOSDATE,QAOSSCRN,QAOSDFN,QAOSIEN,QAOS109,QAORESET,QAOSONE,QAOSPROG
Q
EN3 ; MAIN LOOP
S QAOSWHAT="REVIEWED" D ENDISP^QAOUTL0 S (QAOSQUIT,QAORESET)=0
S X=$G(^QA(741,QAOSD0,0)),QAOSSCRN(0)=+$G(^("SCRN"))
S QAOSDATE(0)=+$P(X,"^",3),QAOSDFN=+X
EDIT K DR S DIE="^QA(741,",DR="19;1;3",DA=QAOSD0 D ^DIE S:$D(Y) QAOSQUIT=1
S QAOSDATE(1)=+$P($G(^QA(741,QAOSD0,0)),"^",3),QAOSSCRN(1)=+$G(^("SCRN"))
S QAOS109=+$O(^QA(741.1,"B",109,0))
D 21,23:QAOSDEAD(0)>1 G:QAOSQUIT=1 AUDIT
I QAORESET S QAOSQUIT=0 G EDIT
K DR S DIE="^QA(741,",DR="4;5;6;7;8;9",DA=QAOSD0
D ^DIE S:$D(Y) QAOSQUIT=1
AUDIT S QAUDIT("FILE")="741^27",QAUDIT("DA")=QAOSD0,QAUDIT("ACTION")="e"
S QAUDIT("COMMENT")="CHANGE BASIC OCCURRENCE DATA" D ^QAQAUDIT
K QAOSDEAD,QAOSDATE,QAOSSCRN,QAOSDFN,QAOSIEN
Q
21 N Y S (QAORESET,QAOSDEAD,QAOSDEAD(0))=0
S QA=$S(QAOSDATE(0)<QAOSDATE(1):QAOSDATE(0),1:QAOSDATE(1))-.0000001
F QAOSDATE=QA:0 S QAOSDATE=$O(^QA(741,"AA",QAOS109,QAOSDATE)) Q:QAOSDATE'>0 F QAOSIEN=0:0 S QAOSIEN=$O(^QA(741,"AA",QAOS109,QAOSDATE,QAOSDFN,QAOSIEN)) Q:QAOSIEN'>0 D 22
Q
22 S X=$G(^QA(741,QAOSIEN,0)) Q:$P(X,"^",11)=2 S Y=+$G(^("SCRN"))
Q:Y'=QAOS109 S QAOSDEAD=X,QAOSDEAD(0)=QAOSDEAD(0)+1
Q:QAOSDATE(1)'>$P(QAOSDEAD,"^",3) S QAOSDEAD(0)=0
W *7,!!?5,"You cannot enter an occurrence date after the date of death "
S Y=$P(QAOSDEAD,"^",3)\1 X ^DD("DD") W Y,".",*7 D RESET
Q
23 N Y W *7
W !!?5,"You cannot enter more than one death for the same patient.",*7
D RESET
Q
RESET W !?5,"Resetting the occurrence date and screen to their original values.",!
K DR S DIE="^QA(741,",DA=QAOSD0
S DR="1///"_QAOSDATE(0)_";3///`"_QAOSSCRN(0)
D ^DIE S QAORESET=1
Q