source: FOIAVistA/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGREG.m@ 1607

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

initial load of FOIAVistA 6/30/08 version

File size: 6.9 KB
Line 
1DGREG ;ALB/JDS,MRL/PJR/PHH-REGISTER PATIENT ; 8/24/05 1:40pm
2 ;;5.3;Registration;**1,32,108,147,149,182,245,250,513,425,533,574,563,624,658**;Aug 13, 1993
3START ;
4EN D LO^DGUTL S DGCLPR=""
5 N DGDIV
6 S DGDIV=$$PRIM^VASITE
7 S:DGDIV %ZIS("B")=$P($G(^DG(40.8,+DGDIV,"DEV")),U,1)
8 I $P(^DG(43,1,0),U,39) S %ZIS="NQ",%ZIS("A")="Select 1010 printer: " D ^%ZIS Q:POP S (DGIO(10),DGIO("PRF"),DGIO("RT"),DGIO("HS"))=ION,DGASKDEV="" I $E(IOST,1,2)'["P-" W !,$C(7),"Not a printer" G DGREG
9 K %ZIS("B")
10 I '$D(DGIO),$P(^DG(43,1,0),U,30) S %ZIS="N",IOP="HOME" D ^%ZIS I $D(IOS),IOS,$D(^%ZIS(1,+IOS,99)),$D(^%ZIS(1,+^(99),0)) S Y=$P(^(0),U,1) W !,"Using closest printer ",Y,! F I=10,"PRF","RT","HS" S DGIO(I)=Y
11A D ENDREG($G(DFN))
12 W !! S DIC=2,DIC(0)="ALEQM",DLAYGO=2 K DIC("S"),DIC("B") D ^DIC K DLAYGO G Q1:Y<0 S (DFN,DA)=+Y,DGNEW=$P(Y,"^",3) N Y D PAUSE^DG10 D BEGINREG(DFN) I DGNEW D NEW^DGRP
13 ;
14 ;; ask to continue if patient died - DG*5.3*563 - pjr 10/12/04
15 S DOD="" I $G(DFN) S DOD=$P($G(^DPT(DFN,.35)),"^",1)
16 I DOD S Y=DOD,DGPME=0 D DIED^DGPMV I DGPME K DFN,DGRPOUT G A
17 ;
18 D CIRN
19 ;
20 I +$G(DGNEW) D
21 . ; query CMOR for Patient Record Flag Assignments if NEW patient and
22 . ; display results.
23 . I $$PRFQRY^DGPFAPI(DFN) D DISPPRF^DGPFAPI(DFN)
24 ;
25 D ROMQRY
26 ;
27 S (DGFC,CURR)=0
28 D:'$G(DGNEW) WARN S DA=DFN,DGFC="^1",VET=$S($D(^DPT(DFN,"VET")):^("VET")'="Y",1:0)
29 S %ZIS="N",IOP="HOME" D ^%ZIS S DGELVER=0 D EN^DGRPD I $D(DGRPOUT) D ENDREG($G(DFN)) D HL7A08^VAFCDD01 K DFN,DGRPOUT G A
30 D HINQ^DG10
31 I $D(^DIC(195.4,1,"UP")) I ^("UP") D ADM^RTQ3
32 D REG^IVMCQ($G(DFN)) ; send financial query
33 G A1
34 ;
35RT I $D(^DIC(195.4,1,"UP")) I ^("UP") S $P(DGFC,U,1)=DIV D ADM^RTQ3
36 Q
37 ;
38A1 W !,"Do you want to ",$S(DGNEW:"enter",1:"edit")," Patient Data" S %=1 D YN^DICN D G H:'%,CK:%'=1 S DGRPV=0 D EN1^DGRP G Q:'$D(DA)
39 .I +$G(DGNEW) Q
40 .I $$ADD^DGADDUTL($G(DFN)) ;
41 G CH
42PR W !!,"Is the patient currently being followed in a clinic for the same condition" S %=0 D YN^DICN G Q:%=-1
43 I '% W !?4,$C(7),"Enter 'Y' if the patient is being followed in clinic for condition for which",!?6,"registered, 'N' if not." G PR
44 S CURR=% G SEEN
45 ;
46CK S DGEDCN=1 D ^DGRPC
47CH S X=$S('$D(^DPT(DFN,.36)):1,$P(^(.36),"^",1)']"":1,1:0),X1=$S('$D(^DPT(DFN,.32)):1,$P(^(.32),"^",3)']"":1,1:0) I 'X,'X1 G CH1
48CH1 S DA=DFN G PR:'$D(^DPT("ADA",1,DA)) W !!,"There is still an open disposition--register aborted.",$C(7),$C(7) G Q
49SEEN W !!,"Is the patient to be examined in the medical center today" S %=1 D YN^DICN S SEEN=% G:%<0 Q I %'>0 W !!,"Enter 'Y' if the patient is to be examined today, 'N' if not.",$C(7) G SEEN
50ABIL D ^DGREGG
51ENR ; next line appears to be dead code. left commented just to test. mli 4/28/94
52 ;S DE=0 F I=0:0 S I=$O(^DPT(DA,"DE",I)) Q:'I I $P(^(I,0),"^",3)'?7N Q D PR:'DE S L=+$P($S($D(^SC(L,0)):^(0),1:""),"^",1)
53REG S (DIE,DIC)="^DPT("_DFN_",""DIS"",",%DT="PTEX",%DT("A")="Registration login date/time: NOW// "
54 W !,%DT("A") R ANS:DTIME S:'$T ANS="^" S:ANS="" ANS="N" S X=ANS G Q:ANS="^" S DA(1)=DFN D CHK^DIE(2.101,.01,"E",X,.RESULT) G REG:RESULT="^"!('$D(RESULT)),PR3:'(RESULT#1) S Y=RESULT
55 I (RESULT'="^") W " ("_RESULT(0)_")"
56 S DINUM=9999999-RESULT
57 S (DFN1,Y1)=DINUM,APD=Y I $D(^DPT(DFN,"DIS",Y1)) W !!,"You must enter a date that does not exist.",$C(7),$C(7) G REG
58 G:$D(^DPT("ADA",1,DA)) CH1 L @(DIE_DINUM_")"):2 G:'$T MSG S:'($D(^DPT(DA(1),"DIS",0))#2) ^(0)="^2.101D^^" S DIC(0)="L",X=+Y D ^DIC
59 ;
60 ;SAVE OFF DATE/TIME OF REGISTRATION FOR HL7 V2.3 MESSAGING, IN VAFCDDT
61 S VAFCDDT=X
62 ;
63 S DA=DFN1,DIE("NO^")="",DA(1)=DFN,DP=2.101,DR="1///"_$S(SEEN=2:2,CURR=1:1,1:0)_";Q;2"_$S(CURR=1:"///3",1:"")_";2.1;3//"_$S($P(^DG(43,1,"GL"),"^",2):"",1:"/")_$S($D(^DG(40.8,+$P(^DG(43,1,"GL"),"^",3),0)):$P(^(0),"^",1),1:"")_";4////"_DUZ
64 D EL K DIC("A") N DGNDLOCK S DGNDLOCK=DIE_DFN1_")" L +@DGNDLOCK:2 G:'$T MSG D ^DIE L -@DGNDLOCK
65 I $D(DTOUT) D G Q
66 .K DTOUT
67 .N DA,DIK
68 .S DA(1)=DFN,DA=DFN1,DIK="^DPT("_DFN_",""DIS"","
69 .D ^DIK
70 .W !!?5,"User Time-out. Required registration data could be missing."
71 .W !,?5,"This registration has been deleted."
72 ; check whether facility applying to (division) is inactive
73 I '$$DIVCHK^DGREGFAC(DFN,DFN1) G CONT
74ASKDIV W !!?5,"The facility chosen either has no pointer to an Institution"
75 W !?5,"file record or the Institution file record is inactive."
76 W !?5,"Please choose another division."
77 S DA=DFN1,DIE("NO^")="",DA(1)=DFN,DP=2.101,DR="3" D ^DIE
78 I $$DIVCHK^DGREGFAC(DFN,DFN1) G ASKDIV
79CONT ; continue
80 S DGXXXD=1 D EL^DGREGE I $P(^DPT(DFN,"DIS",DFN1,0),"^",3)=4 S DA=DFN,DIE="^DPT(",DR=".368;.369" D ^DIE S DIE="^DPT("_DFN_",""DIS"",",DA(1)=DFN,DA=DFN1
81 S DA=DFN,DR="[DGREG]",DIE="^DPT(" D ^DIE K DIE("NO^")
82 I $D(^DPT(DFN,"DIS",DFN1,2)),$P(^(2),"^",1)="Y" S DIE="^DPT(",DR="[DG EMPLOYER]",DA=DFN D ^DIE
83 G ^DGREG0
84PR2 W !!,"You can only enter new registrations through this option.",$C(7),$C(7) G REG
85PR3 W !!,"Time is required to register the patient.",!!,$C(7),$C(7) G REG
86H W !?5,"Enter 'YES' to enter/edit registration data or 'NO' to continue." G A1
87Q K DG,DQ G Q1^DGREG0
88Q1 K DGIO,DGASKDEV,DGFC,DGCLRP,CURR,DGELVER,DGNEW Q
89EL S DR=DR_";13//" I $D(^DPT(DFN,.36)),$D(^DIC(8,+^(.36),0)) S DR=DR_$P(^(0),"^",1) Q
90 S DR=DR_"HUMANITARIAN EMERGENCY" Q
91FEE S DGRPFEE=1 D DGREG K DGRPFEE G Q1
92 ;
93WARN I $S('$D(^DPT(DFN,.1)):0,$P(^(.1),"^",1)']"":0,1:1) W !,$C(7),"***PATIENT IS CURRENTLY AN INPATIENT***",! H 2
94 I $S('$D(^DPT(DFN,.107)):0,$P(^(.107),"^",1)']"":0,1:1) W !,$C(7),"***PATIENT IS CURRENTLY A LODGER***",! H 2
95 Q
96MSG W !,"Another user is editing, try later ..." G Q
97 ;
98BEGINREG(DFN) ;
99 ;Description: This is called at the beginning of the registration process.
100 ;Concurrent processes can check the lock to determine if the patient is
101 ;currently being registered.
102 ;
103 Q:'$G(DFN) 0
104 I $$QRY^DGENQRY(DFN) W !!,"Enrollment/Eligibility Query sent ...",!!
105 L +^TMP(DFN,"REGISTRATION IN PROGRESS"):1
106 I $$LOCK^DGENPTA1(DFN) ;try to lock the patient record
107 Q
108 ;
109ENDREG(DFN) ;
110 ;Description: releases the lock obtained by calling BEGINREG.
111 ;
112 Q:'$G(DFN)
113 L -^TMP(DFN,"REGISTRATION IN PROGRESS")
114 D UNLOCK^DGENPTA1(DFN)
115 Q
116 ;
117IFREG(DFN) ;
118 ;Description: tests whether the lock set by BEGINREG is set
119 ;
120 ;Input: DFN
121 ;Output:
122 ; Function Value = 1 if lock is set, 0 otherwise
123 ;
124 N RETURN
125 Q:'$G(DFN) 0
126 L +^TMP(DFN,"REGISTRATION IN PROGRESS"):1
127 S RETURN='$T
128 L -^TMP(DFN,"REGISTRATION IN PROGRESS")
129 Q RETURN
130 Q
131CIRN ;MPI QUERY
132 ;check to see if CIRN PD/MPI is installed
133 N X S X="MPIFAPI" X ^%ZOSF("TEST") Q:'$T
134 K MPIFRTN
135 D MPIQ^MPIFAPI(DFN)
136 K MPIFRTN
137 Q
138ROMQRY ;
139 I +$G(DGNEW) D
140 . ; query LST for Patient Demographic Information if NEW patient and
141 . ; file into patient's record.
142 . N A
143 . I $$ROMQRY^DGROAPI(DFN) D
144 . . ;display busy message to interactive users
145 . .S DGMSG(1)="Data retrieval from LST site has been completed successfully"
146 . .S DGMSG(2)="Thank you for your patience."
147 . .D EN^DDIOL(.DGMSG) R A:5
148 . E D
149 . . ;display busy message to interactive users
150 . .S DGMSG(1)="Data retrieval from LST site has not been successful."
151 . .S DGMSG(2)="Please continue the Registration Process."
152 . .D EN^DDIOL(.DGMSG) R A:5
153 . ;
154 Q
Note: See TracBrowser for help on using the repository browser.