source: WorldVistAEHR/trunk/r/OCCURRENCE_SCREEN-QAO/QAOSENTR.m@ 660

Last change on this file since 660 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 4.1 KB
Line 
1QAOSENTR ;HISC/JES,DAD-ENTER EDIT AN OCCURRENCE ;6/24/93 15:41
2 ;;3.0;Occurrence Screen;;09/14/1993
3 S HELPYN="W !?5,""Please answer Y(es) or N(o)"""
4ASK ;
5 W !!?5,"Do you wish to see list of open occurrences"
6 S %=2,DTOUT=0 D YN^DICN D:%=1 ENLOOK G:%=-1 EXIT I %=0 X HELPYN G ASK
7ENTER ;
8 W ! K DIC S DIC="^DPT(",DIC(0)="AEMQ",DIC("A")="Select PATIENT: "
9 D ^DIC G:Y=-1 EXIT S QANAME=+Y
10DATE ;
11 K %DT S %DT="AETX",%DT(0)="-NOW",%DT("A")="Select OCCURRENCE DATE: "
12 D ^%DT K %DT G:Y=-1 NOTHERE S QADATE=+Y
13DAGAIN ;
14 W !!?5,"Is this the correct date (Y/N)" S %=1,DTOUT=0
15 D YN^DICN G:%=2 DATE G:%=-1 EXIT I %=0 X HELPYN G DAGAIN
16 W ! K DIC S DIC="^QA(741.1,",DIC(0)="AEMQ",DIC("A")="Select SCREEN: "
17 S DIC("S")="I $P(^(0),""^"",4)'=1"
18 D ^DIC K DIC W ! G:Y=-1 NOTHERE S QASCRN=+Y
19 D ^QAOSENT1 I QAOSQUIT S QAOSQUIT=0 G ENTER
20 S QADEAD=0,QADDEAD="" D ISHEDEAD
21 I QADDEAD]"" W *7,!!?5,"You cannot enter an occurrence for this patient, who died on ",QADDEAD,".",! G ENTER
22 I QADEAD,+^QA(741.1,QASCRN,0)=109 W *7,!!?5,"You cannot enter more than one death for the same patient.",! G ENTER
23 K VAIP S DFN=QANAME,VAIP("D")=QADATE\1,VAIP("M")=0 D IN5^VADPT
24 K DD,DIC,DINUM,DO S DIC="^QA(741,",DIC(0)="L",DLAYGO=741,X=QANAME
25 D FILE^DICN K DIC S (DA,QAOSD0)=+Y
26 G:QAOSD0'>0 ENTER
27 S DR="1///^S X=QADATE;3///`"_QASCRN_";28///^S X=DT"
28 I $D(^DGPM(+VAIP(1),0))#2,QADATE\1'<(VAIP(3)\1) S DR=DR_";.02///`"_+VAIP(1)
29 S DIE="^QA(741,",DR=DR_";4",DA=QAOSD0 D ^DIE S SAVEY=$D(Y)
30 S QAUDIT("FILE")="741^27",QAUDIT("DA")=QAOSD0,QAUDIT("ACTION")="o"
31 S QAUDIT("COMMENT")="OPEN A RECORD"
32 D ^QAQAUDIT G:SAVEY ENTER K DR G:($D(DTOUT))!($D(DUOUT)) NOTHERE
33 G ASKEDIT
34NOTHERE ;
35 W !!?5,"This occurrence has not yet been entered into the system"
36 W !?5,"Do you wish to go back to the enter step (Y/N)",*7
37 S %=1,DTOUT=0 D YN^DICN G:%=1 ENTER G:%=-1 EXIT I %=0 X HELPYN G NOTHERE
38 G EXIT
39ISHEDEAD ;
40 S QAOS109=$O(^QA(741.1,"B",109,0)) Q:QAOS109'>0
41 F QAWHEN=0:0 S QAWHEN=$O(^QA(741,"AA",QAOS109,QAWHEN)) Q:QAWHEN'>0 S QAPAT=0 D WHODEAD
42 Q
43WHODEAD ;
44 S QAPAT=$O(^QA(741,"AA",QAOS109,QAWHEN,QANAME,QAPAT)) Q:QAPAT'>0
45 I $P(^QA(741,QAPAT,0),"^",11)'=2 S QADEAD=QADEAD+1 I QAWHEN\1<(QADATE\1) S SAVEY=Y,Y=QAWHEN\1 X ^DD("DD") S QADDEAD=Y,Y=SAVEY
46 G WHODEAD
47ASKEDIT ;
48 W !!?5,"Do you wish to make any corrections to this entry (Y/N)",*7
49 S %=2,DTOUT=0 D YN^DICN G:%=2 ASKREVU G:%=1 EDIT G:X=-1 EXIT
50 I %=0 X HELPYN G ASKEDIT
51EDIT ;
52 W ! S DIE="^QA(741,",DR="1;3;4" D ^DIE
53ASKREVU ;
54 W *7,!!?5,"Do you wish to start review process for this entry (Y/N)"
55 S %=1,DTOUT=0 D YN^DICN G:%=2 ENTER G:X=-1 EXIT I %=0 X HELPYN G ASKREVU
56REVIEW ;
57 D EN1^QAOEDT0 G ENTER
58 Q
59EXIT ;
60 K ACTIVE,DA,DIC,DIE,DR,DTOUT,DUOUT,DZ,HELPYN,I,III,IV,LINE21,LOC,PRINTEE
61 K QAUDIT,QADAT,QADATE,QADEAD,QADDEAD,QAJUL,QANAM,QANAME,QAOS109,QAOSAUDT
62 K QAOSOPEN,QAPAT,QASCREEN,QASCRN,QASTOP,QAOSWHAT,QAWHEN,QAWHO,SAVEY
63 K SAVY,V,X,Y,%,%DT,%T,C,D0,D1,D2,DI,DIG,DIH,DIPGM,DIU,DIV,DK,DL,QA
64 K QAHOLD,QAI,QALINE,QAOSLOC,QACLOSE,QAOSWRD,SAVEX,Y,Z,QAOS,QAOSD0,QAOSD1
65 K QAOSDATA,QAOSFDSP,QAOSFIND,QAOSFOND,QAOSLEVL,QAOSLVNO,QAOSMGMT
66 K QAOSNEWF,QAOSQUIT,QAOSX,QAOSREVR,QAOFIELD,QAOSNODE,QAOSSERV,QAOSUBDD
67 K ^TMP($J,"L")
68 D KVAR^VADPT
69 Q
70ENLOOK ;
71 W ! D WAIT^DICD W ! K ^TMP($J,"L") S LINE21=$Y,QASTOP=0
72 F QAWHO=0:0 S QAWHO=$O(^QA(741,"AD",0,QAWHO)) Q:QAWHO'>0 D
73 . S LOC=$G(^QA(741,QAWHO,0))
74 . Q:LOC'>0 Q:'$D(^DPT(+LOC,0))
75 . S QANAM=$P(^DPT(+LOC,0),"^"),QAJUL=$P(LOC,"^",3)
76 . S QASCREEN=$S($D(^QA(741.1,+$G(^QA(741,QAWHO,"SCRN")),0))#2:$P(^(0),"^"),1:+^QA(741,QAWHO,"SCRN"))
77 . S:$D(Y) SAVY=Y S Y=QAJUL X ^DD("DD") S QADAT=Y S:$D(SAVY) Y=SAVY
78 . S ^TMP($J,"L",QANAM,QAJUL,QASCREEN)=QANAM_"^"_QADAT_"^"_QASCREEN
79 . Q
80 I $O(^TMP($J,"L",""))="" W !?5,"*** NO OPEN OCCURRENCES FOUND ***" Q
81 S QANAM=""
82 F S QANAM=$O(^TMP($J,"L",QANAM)) Q:QANAM=""!(QASTOP="^") F QAJUL=0:0 S QAJUL=$O(^TMP($J,"L",QANAM,QAJUL)) Q:QAJUL=""!(QASTOP="^") F QASCREEN=0:0 S QASCREEN=$O(^TMP($J,"L",QANAM,QAJUL,QASCREEN)) Q:QASCREEN=""!(QASTOP="^") D
83 . S PRINTEE=^TMP($J,"L",QANAM,QAJUL,QASCREEN)
84 . W !?5,$P(PRINTEE,"^",1),?30,$P(PRINTEE,"^",2),?50,$P(PRINTEE,"^",3)
85 . I $Y>(IOSL+LINE21-3) K DIR S DIR(0)="E" D ^DIR K DIR S QASTOP=$S(Y'>0:"^",1:0) S LINE21=$Y
86 . Q
87 Q
Note: See TracBrowser for help on using the repository browser.