source: FOIAVistA/trunk/r/PHARMACY_DATA_MANAGEMENT-PSS/PSSCPRS1.m@ 1800

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

initial load of FOIAVistA 6/30/08 version

File size: 3.7 KB
Line 
1PSSCPRS1 ;BIR/ASJ-API for CPRS ;09/07/00
2 ;;1.0;PHARMACY DATA MANAGEMENT;**38**;9/30/97
3 ;Reference to $$CPRS^PSNAPIS supported by DBIA 2531
4 ;
5 ;PSDD -Dispense Drug, PSOI-Orderable Item, PSPK-Package
6 ;PSDOS-Dosage, PSDUD-Dispense Units per Dosage
7 ;RESULT(1)=Dispense Drug^Dosage^Orderable Item^Dispense Units per Dosage
8 ;RESULT(2)=ERROR DESCRIPTION
9 ;
10 G:+PSDUD>0 ND
11 I 'PSSND1!('PSSND3) S RESULT(0)=-1,RESULT(2)="Problem in ND node!" Q
12 S X=$$DFSU^PSNAPIS(PSSND1,PSSND3) I $P(X,U,4)="" D NNSI Q
13 I $P(X,U)'="" D NNMI
14 Q
15ND ; I/P to O/P Transfer Rules - Numeric Dosages
16 ;
17FR541 I '$P($G(^PSDRUG(+PSDD,"I")),"^")!($P($G(^("I")),"^")'<DT),(PSUSE["O") S RESULT(0)=1,RESULT(1)=PSDD_"^"_PSDOS,RESULT(2)="FR541" Q
18 ;
19 ;
20FR542 S PSCORR=$P(PSNODE8,U,5) I PSCORR I '$P($G(^PSDRUG(PSCORR,"I")),"^")!($P($G(^("I")),"^")'<DT) S PSNODE2=$G(^PSDRUG(PSCORR,2)) D CP D
21 .F PDS=0:0 S PDS=$O(^PSDRUG(PSCORR,"DOS1",PDS)) Q:'PDS D
22 ..S PSDOS1=^PSDRUG(PSCORR,"DOS1",PDS,0),PDOS=$G(^PSDRUG(PSCORR,"DOS")),PSSTR=$P(PDOS,U),PSUNT=$P(PDOS,U,2)
23 ..I PSDOS'="",($P(PSDOS1,U,2)=PSDOS),($P(PSNODE2,U,3)["O")&($P(PSDOS1,U,3)["O") D
24 ...I $P(X,U,4)=$P(PSDOSN,U,2),$P(X,"^")=$P(X1,"^") S RESULT(0)=1,RESULT(1)=PSCORR_"^"_PSDOS,RESULT(2)="FR542" Q
25 Q:RESULT(0)=1
26 ;
27 ;
28FR543 S AA=0 F S AA=$O(^PSDRUG("ASP",+PSOI,AA)) Q:'AA D
29 .I $D(^PSDRUG(AA,"DOS1",0)) F PDS=0:0 S PDS=$O(^PSDRUG(AA,"DOS1",PDS)) Q:'PDS D
30 ..S BB=^PSDRUG(AA,"DOS1",PDS,0),PSNODE2=$G(^PSDRUG(AA,2))
31 ..I PSDOS'="",($P(BB,U,2)=PSDOS)&($P(PSNODE2,U,3)["O")&($P(BB,U,3)["O") S FLAG=1,PSLI(AA)=""
32 ;
33 I FLAG S AA=0 F S AA=$O(PSLI(AA)) Q:'AA F PDS=0:0 S PDS=$O(^PSDRUG(AA,"DOS1",PDS)) Q:'PDS D
34 .S POSDOS=^PSDRUG(AA,"DOS1",PDS,0) S PSDPD=+$P(POSDOS,U)
35 .I '$D(PSDUPD)!(PSDPD<PSDUPD) S PSDUPD=PSDPD
36 I FLAG S RESULT(0)=1,RESULT(1)=AA_"^"_$P(POSDOS,U,2),RESULT(2)="FR543",FLAG=0 Q
37 ;
38 ;
39FR544 S PSCORR=$P(PSNODE8,U,5) I PSCORR I '$P($G(^PSDRUG(PSCORR,"I")),"^")!($P($G(^("I")),"^")'<DT) D CP D
40 .I $P(X,U,4)=$P(PSDOSN,U,2),$P(X,"^")=$P(X1,"^") S RESULT(0)=1,RESULT(1)=PSDD
41 Q:RESULT(0)=1
42 ;
43 ;
44FR545 S RESULT(0)=-1,RESULT(2)="All Numeric Dosage Rules failed!"
45 Q
46 ;
47 ;
48NNSI ; I/P to O/P Transfer Rules- NON-NUMERIC Single Ingredient
49 ;
50FR551 I '$P($G(^PSDRUG(+PSDD,"I")),"^")!($P($G(^("I")),"^")'<DT),(PSUSE["U")&(PSUSE["O") S RESULT(0)=1,RESULT(1)=PSDD_"^"_PSDOS_"^"_PSOI_"^"_PSDUD Q
51 ;
52 ;
53FR552 I PSUSE'["U",(PSUSE'["O") S PSCORR=$P(PSNODE8,U,5) I PSCORR I '$P($G(^PSDRUG(PSCORR,"I")),"^")!($P($G(^("I")),"^")'<DT) D CP D Q:RESULT(0)=1
54 .S PDOS=$G(^PSDRUG(PSCORR,"DOS")),PSSTR=$P(PDOS,U),PSUNT=$P(PDOS,U,2)
55 .I (PSSTR'="")&(PSUNT'=""),(PSSTR=PSNDSTR)&(PSUNT=PSNDUN) D
56 ..I $P(X,U,4)=$P(PSDOSN,U,2),$P(X,"^")=$P(X1,"^") S RESULT(0)=1,RESULT(1)=PSCORR_"^"_PSDOS_"^"_PSOI_"^"_PSDUD
57 ;
58 ;
59FR553 S AA=0 F S AA=$O(^PSDRUG("ASP",+PSOI,AA)) Q:'AA D
60 .S PSSTR=$P($G(^PSDRUG(AA,"DOS")),U),PSUNT=$P($G(^("DOS")),U,2)
61 .S X=$$CPRS^PSNAPIS(PSSND1,PSSND3)
62 .S PSNDSTR=$P(X,U,3),PSNDUN=$P(X,U,4)
63 .I (PSSTR'="")&(PSUNT'=""),(PSSTR=PSNDSTR)&(PSUNT=PSNDUN) S RESULT(0)=1,RESULT(1)=AA_"^"_PSDOS_"^"_PSOI_"^"_PSDUD
64 Q:RESULT(0)=1
65 ;
66FR554 S RESULT(0)=-1
67 Q
68 ;
69NNMI ; I/P to O/P Transfer Rules- Multi-Ingredient
70 ;
71FR561 I '$P($G(^PSDRUG(+PSDD,"I")),"^")!($P($G(^("I")),"^")'<DT),(PSUSE["U")&(PSUSE["O") S RESULT(0)=1,RESULT(1)=PSDD_"^"_PSDOS_"^"_PSOI_"^"_PSDUD Q
72 ;
73 ;
74FR562 I PSUSE'["U",(PSUSE'["O") S PSCORR=$P(PSNODE8,U,5) I PSCORR I '$P($G(^PSDRUG(PSCORR,"I")),"^")!($P($G(^("I")),"^")'<DT) D CP D
75 .I $P(X,U,4)=$P(PSDOSN,U,2),$P(X,"^")=$P(X1,"^") S RESULT(0)=1,RESULT(1)=PSCORR_"^"_PSOD_"^"_PSSOP_"^"_PSDUD
76 Q
77CP ;
78 S PSND=$G(^PSDRUG(PSCORR,"ND")) S X=$$CPRS^PSNAPIS($P(PSND,"^"),$P(PSND,"^",3)),PSNDSTR=$P(X,U,3),PSNDUN=$P(X,U,4)
79 S PSDOSN=$G(^PSDRUG(PSDD,"DOS")),X1=$$CPRS^PSNAPIS(PSSND1,PSSND3)
80 Q
Note: See TracBrowser for help on using the repository browser.