source: WorldVistAEHR/trunk/r/BAR_CODE_MED_ADMIN-ALPB-PSB/PSBAPIPM.m@ 1427

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

initial load of WorldVistAEHR

File size: 3.4 KB
Line 
1PSBAPIPM ;BIRMINGHAM/EFC-BCMA API TO IPM FOR ORDER RENEWAL ;Mar 2004
2 ;;3.0;BAR CODE MED ADMIN;**6,15**;Mar 2004
3 ;
4 ;
5EN(PSBDFN,PSBORDX) ;
6 ;
7 ; PSBLADT=date/time of the last action
8 ; PSBADMDT=scheduled time of the last action
9 ; PSBSTUS=last action (given, held, refused, etc.)
10 ;
11 ;
12 S (PSBCNT,PSBFLAG)=0,Y=""
13 S PSBSTR=""
14 I '$D(^PSB(53.79,"AORDX",PSBDFN,PSBORDX)) Q ""
15 F S Y=$O(^PSB(53.79,"AORDX",PSBDFN,PSBORDX,Y),-1) Q:Y="" Q:PSBFLAG=1 D
16 .S PSBLADT=$S(Y:Y,1:"")
17 .S X="" F S X=$O(^PSB(53.79,"AORDX",PSBDFN,PSBORDX,Y,X),-1) Q:X="" D
18 ..S PSBSTUS=$P(^PSB(53.79,X,0),U,9) I PSBSTUS'="N" S PSBFLAG=1
19 ..S PSBADMDT=$P(^PSB(53.79,X,.1),U,3)
20 ..D:PSBSTUS="N"
21 ...S (PSBLADT,PSBSTUS,PSBADMDT)=""
22 ...S Z="" F S Z=$O(^PSB(53.79,X,.9,Z),-1) Q:'Z Q:PSBFLAG=1 S PSBDATA=$G(^(Z,0)) D
23 ....I (PSBDATA["Set to 'NOT GIVEN'")!(PSBDATA["Set to 'GIVEN'")!(PSBDATA["Set to 'REFUSED'")!(PSBDATA["Set to 'HELD'")!(PSBDATA["Set to 'MISSING DOSE'")!(PSBDATA["Set to 'REMOVED'") S PSBCNT=PSBCNT+1
24 ....I (PSBDATA["STATUS 'HELD'")!(PSBDATA["STATUS 'GIVEN'")!(PSBDATA["STATUS 'REFUSED'")!(PSBDATA["STATUS 'MISSING DOSE'")!(PSBDATA["STATUS 'REMOVED'") S PSBCNT=PSBCNT+1
25 ....I PSBCNT#2=0,PSBDATA["'REFUSED'" S PSBSTUS="R",PSBADMDT=$P(^PSB(53.79,X,.1),U,3) D LAST
26 ....I PSBCNT#2=0,PSBDATA["'HELD'" S PSBSTUS="H",PSBADMDT=$P(^PSB(53.79,X,.1),U,3) D LAST
27 ....I PSBCNT#2=0,PSBDATA["'MISSING DOSE'" S PSBSTUS="M",PSBADMDT=$P(^PSB(53.79,X,.1),U,3) D LAST
28 ....I PSBCNT#2=0,PSBDATA["'REMOVED'" S PSBSTUS="RM",PSBADMDT=$P(^PSB(53.79,X,.1),U,3) D LAST
29 I PSBSTUS'="" S PSBSTR=PSBADMDT_U_PSBLADT_U_PSBSTUS
30 Q PSBSTR
31 ;
32LAST ;
33 S PSBCC=0
34 S ZZ="" F S ZZ=$O(^PSB(53.79,X,.3,ZZ),-1) Q:'ZZ Q:PSBFLAG=1 S PSBDATA2=$G(^(ZZ,0)) D
35 .S PSBCC=PSBCC+1
36 .I PSBCC=2 S PSBLADT=$P(PSBDATA2,U,3),PSBFLAG=1
37 Q
38MOB(PSBDFN,PSBCORN) ;
39 I '$D(^TMP("PSBMO",$J,PSBDFN,PSBCORN)) S ^TMP("PSB",$J,0)=-1 Q
40 M ^TMP("PSB",$J)=^TMP("PSBMO",$J,PSBDFN,PSBCORN)
41 K ^TMP("PSB",$J,"PSB")
42 Q
43 ;
44MOBR(PSBDFN,PSBCORN,PSBORDN) ;
45 I $G(PSBORDN)="" K ^TMP("PSB",$J) Q
46 S PSBDUZ=DUZ,PSBDUZ(2)=DUZ(2),DFN=PSBDFN
47 S DUZ=$P(^TMP("PSBMO",$J,PSBDFN,PSBCORN,"PSB"),U,1),DUZ(2)=$P(^TMP("PSBMO",$J,PSBDFN,PSBCORN,"PSB"),U,2),PSBISITE=$P(^TMP("PSBMO",$J,PSBDFN,PSBCORN,"PSB"),U,3)
48 D PSJ1^PSBVT(PSBDFN,PSBORDN)
49 S PSBREC(0)=PSBDFN
50 S PSBREC(1)=PSBONX
51 S PSBREC(2)=PSBSCHT
52 S PSBREC(4)=PSBOIT
53 S PSBREC(5)=$P(^TMP("PSBMO",$J,PSBDFN,PSBCORN,0),U,5)
54 S PSBREC(6)=""
55 S PSBREC(7)="BCMA/CPRS Interface Entry."
56 S PSBREC(8)=PSBISITE
57 I PSBONX["U" S PSBREC(9)="UDTAB^",PSBREC(3)="G"
58 I PSBONX["V" D
59 .I "PCS"'[PSBIVT S PSBREC(9)="IVTAB"_U_$$GETWSID^PSBVDLU2(PSBDFN,PSBORDN),PSBREC(3)="I" Q
60 .I PSBIVT["S",PSBISYR=0 S PSBREC(9)="IVTAB"_U_$$GETWSID^PSBVDLU2(PSBDFN,PSBORDN),PSBREC(3)="I" Q
61 .I PSBIVT["C",PSBISYR=0 S PSBREC(9)="IVTAB"_U_$$GETWSID^PSBVDLU2(PSBDFN,PSBORDN),PSBREC(3)="I" Q
62 .S PSBREC(9)="PBTAB"_U_$$GETWSID^PSBVDLU2(PSBDFN,PSBORDN),PSBREC(3)="G" Q
63 S PSBIMV="^"_$P($G(^TMP("PSBMO",$J,PSBDFN,PSBCORN,"PSB")),U,4)
64 S PSBINDX=10
65 S X="" F S X=$O(PSBDDA(X)) Q:X="" S PSBREC(PSBINDX)=$P(PSBDDA(X),U,1,2)_U_$P(PSBDDA(X),U,4)_U_$P(PSBDDA(X),U,4)_U_PSBDOSEF,PSBINDX=PSBINDX+1
66 S X="" F S X=$O(PSBADA(X)) Q:X="" S PSBREC(PSBINDX)=PSBADA(X),PSBINDX=PSBINDX+1
67 S X="" F S X=$O(PSBSOLA(X)) Q:X="" S PSBREC(PSBINDX)=PSBSOLA(X),PSBINDX=PSBINDX+1
68 D RPC^PSBML(.PSB,"+1^MEDPASS"_$G(PSBIMV),.PSBREC)
69 S DUZ=PSBDUZ,DUZ(2)=PSBDUZ(2) K PSBDUZ,PSBDUZ(2),^TMP("PSBMO",$J,PSBREC(0),PSBCORN),^TMP("PSB",$J) D CLEAN^PSBVT
70 Q
Note: See TracBrowser for help on using the repository browser.