source: WorldVistAEHR/trunk/r/IHS_ROUTINES-AUP/AUPNLK2B.m@ 634

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

initial load of WorldVistAEHR

File size: 4.3 KB
Line 
1AUPNLK2B ; IHS/CMI/LAB - Broke up AUPNLK2 because of size ;1/29/07 09:04
2 ;;1.0;PCE PATIENT CARE ENCOUNTER;**167**;Aug 12, 1996;Build 22
3 ;
4TALK ; TALK TO OPERATOR
5 D ASK ; Ask if want to add patient
6 Q:AUPQF2
7 D MIDDLE ; Ask for complete middle
8 D NICKNM ; Check for nicknames
9 D CHKID ; Get identifiers
10 Q:AUPQF2
11 D DUPECHK ; Check for dupes
12 Q:AUPQF2
13 W !!?3,"...adding new patient"
14 Q
15 ; - - - - - - - - - - - - - - - - - - - - - - - - - - - -
16 ;
17ASK ; ASK OPERATOR
18 F AUPL=0:0 D ASKADD Q:%
19 S:%'=1 AUPQF2=3
20 Q
21 ;
22ASKADD ;
23 S Y=+$P(^DPT(0),U,4)+1 W !?3,*7,"ARE YOU ADDING ",$S(AUPX'?.N:"'"_AUPX_"' AS ",1:""),"A NEW PATIENT (THE ",Y,$S(Y#10=1&(Y#100-11):"ST",Y#10=2&(Y#100-12):"ND",Y#10=3&(Y#100-13):"RD",1:"TH"),")"
24 S %=2 D YN^DICN I '% W !?6,"Enter 'YES' to add a new patient, or 'NO' not to."
25 Q
26 ; - - - - - - - - - - - - - - - - - - - - - - - - - - - -
27 ;
28MIDDLE ;
29 S AUPNMM=$P($P(AUPX,",",2)," ",2)
30 Q:$L(AUPNMM)>2
31 I $L(AUPNMM)=2,$E(AUPNMM,2)'="." Q
32 ; IHS/SD/EFG AUPN*99.1*12 12/2/2003 FIX PROBLEM WITH MIDDLE
33 ; OR NAME NOT POPULATING PATIENT FILES CORRECTLY
34 ;W !!?3,"Enter complete middle name if known,",!?5," or press <return> to add as entered: " R X:DTIME
35 ;I '$T!(X="^") Q
36 ;S Y=AUPX,Z=$P(Y,",",2),$P(Z," ",2)=X,$P(Y,",",2)=Z,X=Y K Z
37 ;D NAME^AUPNPED
38 ;Q:'$D(X)
39 ;S AUPX=X
40 K DIR
41 S DIR(0)="FO^2:15"
42 S DIR("A")="Enter complete middle name if known or press <return> to add as entered: "
43 D ^DIR
44 S:Y="/.,"!(Y="^^") DFOUT=""
45 Q:$D(DFOUT)!$D(DUOUT)!$D(DTOUT)
46 I $G(X)'="" S Y=AUPX,Z=$P(Y,",",2),$P(Z," ",2)=X,$P(Y,",",2)=Z,X=Y K Z
47 I $G(X)="" S X=AUPX
48 D NAME^AUPNPED
49 K DIR,DFOUT,DUOUT,X,Y
50 ; END OF CODE CHANGES FOR AUPN*99.1*12
51 Q
52 ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
53 ;
54NICKNM ; CHECK FIRST & MIDDLE NAMES FOR NICK NAMES
55 S AUPNML=$P(AUPX,",",1),AUPNMF=$P($P(AUPX,",",2)," ",1),AUPNMM=$P($P(AUPX,",",2)," ",2),AUPNMX=$P(AUPX,",",3)
56 I AUPNMF'="",$D(^APMM(99,"B",AUPNMF)) S AUPNMCVN=1 F AUPNMCV=0:0 S AUPNMCV=$O(^APMM(99,"B",AUPNMF,AUPNMCV)) Q:AUPNMCV="" D NICKNM2 Q:AUPNMCV=""
57 I AUPNMM'="",$D(^APMM(99,"B",AUPNMM)) S AUPNMCVN=2 F AUPNMCV=0:0 S AUPNMCV=$O(^APMM(99,"B",AUPNMM,AUPNMCV)) Q:AUPNMCV="" D NICKNM2 Q:AUPNMCV=""
58 S AUPX=AUPNML_","_AUPNMF_$S(AUPNMM'="":" "_AUPNMM,1:"")_$S(AUPNMX'="":","_AUPNMX,1:"")
59 K AUPNML,AUPNMF,AUPNMM,AUPNMCV,AUPNMCVN,AUPNMCVX,AUPNMX
60 Q
61 ;
62NICKNM2 ; CHECK NICK NAMES
63 S AUPNMCVX=$S(AUPNMCVN=1:AUPNMF,1:AUPNMM)
64 Q:AUPNMCVX=$P(^APMM(99,AUPNMCV,0),U,1)
65 W !," Do you want ",$S(AUPNMCVN=1:AUPNMF,1:AUPNMM)," entered as ",$P(^APMM(99,AUPNMCV,0),U,1)
66 S %=2 D YN^DICN
67 S:%=1 @($S(AUPNMCVN=1:"AUPNMF",1:"AUPNMM"))=$P(^APMM(99,AUPNMCV,0),U,1),AUPNMCV=""
68 K %,%Y
69 Q
70 ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
71 ;
72CHKID ; CHECK IDENTIFIERS
73 Q:$D(DIC("DR"))
74 S AUPGID="^.02^.03^.09^"
75 F AUPID=.02,.03,.09 D CHKID1 Q:AUPQF2
76 Q:AUPQF2
77 F AUPID=0:0 S AUPID=$O(^DD(2,0,"ID",AUPID)) Q:'AUPID!(AUPQF2) I '$F(AUPGID,U_AUPID_U) S AUPLID="",AUP("DR")=AUP("DR")_";"_AUPID
78 Q
79 ;
80CHKID1 ;
81 S AUP("DR")=$S('$D(AUP("DR")):AUPID,1:AUP("DR")_";"_AUPID) I $D(^DD(2,AUPID,0)) S AUPID0=^(0) D ASKID S:'$D(X) AUPQF2=4
82 Q
83 ;
84ASKID W !?3,"PATIENT ",$P(AUPID0,U),": " R X:DTIME I '$T!(X?1"^") W !?6,*7,"<'",AUPX,"'> DELETED" K X Q
85 I X="",AUPID=.09 S AUPIDS(AUPID)="",AUP("DR")=AUP("DR")_"////"_X Q
86 I X["^" W:$E(X)["^" !?6,*7,"Sorry, '^' not allowed!" W " ??" G ASKID
87 I X["?"!(X="") W:X="" *7," ??" D HLPID G ASKID
88 I $P(AUPID0,U,2)["S" F I=1:1 S Y=$P($P(AUPID0,U,3),";",I) K:Y="" X Q:Y="" I $P(Y,":",1)=X!($E($P(Y,":",2),1,$L(X))=X) S X=$P(Y,":",1),AUPSET=$P(Y,":",2) Q
89 S (DA,D0)=0
90 X $P(^DD(2,AUPID,0),U,5,99) I $D(X) W:$D(AUPSET) " ",AUPSET S AUPIDS(AUPID)=X,AUP("DR")=AUP("DR")_"////"_X K AUPSET Q
91 W:'$D(X)&($P(AUPID0,U,2)'["D") *7," ??" D HLPID
92 G ASKID
93 ;
94HLPID W:$D(^DD(2,AUPID,.1)) !?5,^(.1) W:$D(^DD(2,AUPID,3)) !?5,^(3) I $D(X),X["?" F I=0:0 S I=$O(^DD(2,AUPID,21,I)) Q:'I!(I>3&(X?1"?")) I $D(^(I,0)) W !?5,^(0) I I>2,X?1"?" W !?5,"..."
95 W:$D(^DD(2,AUPID,4)) !?5,^(4) I $P(AUPID0,U,2)["D" S X="?",%DT="E" D ^%DT
96 I $P(AUPID0,U,2)["S" W !?7,"CHOOSE FROM: " F I=1:1 S Y=$P($P(AUPID0,U,3),";",I) Q:Y="" W !?7,$P(Y,":",1),?15," ",$P(Y,":",2)
97 Q
98 ; - - - - - - - - - - - - - - - - - - - - - - - - - - - -
99 ;
100DUPECHK ; CHECK FOR DUPLICATE PATIENTS
101 Q:$D(DIC("DR"))
102 D ^AUPNLK3 S:AUPNLK3<0 AUPQF2=5 K AUPNLK3
103 Q
Note: See TracBrowser for help on using the repository browser.