source: WorldVistAEHR/trunk/r/INPATIENT_MEDICATIONS-PSJ-PSIV-PSG--PSGW/PSGOTR.m@ 1800

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

initial load of WorldVistAEHR

File size: 2.6 KB
RevLine 
[613]1PSGOTR ;BIR/CML3-TRANSFERS RENEW DATA FROM 53.1 TO 55 ;23 SEP 03 / 7:54 AM
2 ;;5.0; INPATIENT MEDICATIONS ;**110,127,133,129**;16 DEC 97
3 ;
4 ; Reference to ^PS(55 supported by DBIA 2191.
5 ;
6START(ODA,DA) ; lock record, and write
7 N OFD,PVND4 S OFD=""
8 S OFD=$P($G(^PS(55,PSGP,5,DA,2)),"^",4) K:OFD ^PS(55,"AUD",+OFD,PSGP,+DA)
9 S ND2=^PS(53.1,+ODA,2) S ^PS(55,"AUD",+$P(ND2,"^",4),PSGP,DA)=""
10 F X=6,7 I $D(^PS(53.1,+ODA,X)) S ^PS(55,PSGP,5,DA,X)=^(X)
11 I $O(^PS(53.1,+ODA,1,0)) D
12 .K ^PS(55,PSGP,5,DA,1)
13 .S (C,X)=0 F S X=$O(^PS(53.1,+ODA,1,X)) Q:'X S:$D(^(X,0)) C=C+1,^PS(55,PSGP,5,DA,1,C,0)=^(0),^PS(55,PSGP,5,DA,1,"B",+$P($G(^(0)),U),C)=""
14 .S ^PS(55,PSGP,5,DA,1,0)="^55.07P^"_C_"^"_C
15 F X=3,12 D S ^PS(55,PSGP,5,DA,X,0)="^55.0"_$S(X=3:8,1:612)_U_CNT_U_CNT
16 .S CNT=0 F C=0:0 S C=$O(^PS(53.1,+ODA,X,C)) Q:'C I $D(^(C,0)) S ^PS(55,PSGP,5,DA,X,C,0)=^(0),CNT=CNT+1
17 S $P(^PS(53.1,+ODA,0),"^",19)=DA
18 S $P(^PS(55,PSGP,5,DA,0),"^",7)=$P(^PS(53.1,+ODA,0),"^",7)
19 N PSGPND0,PSGPND2,RDUZ,OND14 S PSGPND0=^PS(53.1,+ODA,0),PSGPND2=^(2) S RNWDT=$P(PSGPND0,"^",16),PSGOEPR=$P(PSGPND0,"^",2)
20 S PSGFD=$P(PSGPND2,"^",4),PSJNOO=$P(^PS(53.1,+ODA,.2),"^",3) S OND14=$$LASTREN^PSJLMPRI(PSGP,+ODA_"P") S RDUZ=$P(OND14,"^",2) S:$P(OND14,"^",3) PSGOEPR=$P(OND14,"^",3)
21 I '$G(DUOUT) D
22 .I $G(PSJORD)["P" N PSGFDO S PSGFDO=$$LASTREN^PSJLMPRI(PSGP,PSJORD),PSGFDO=$P(PSGFDO,"^",4)
23 .D UPDREN^PSGOER(DA_"U",RNWDT,PSGOEPR,$S($G(PSGFDO):PSGFDO,1:PSGFD),PSJNOO,RDUZ)
24 S PVND4=$G(^PS(53.1,+ODA,4)) I $P(PVND4,"^"),$P(PVND4,"^",2) D
25 .N RNDT S RNDT=$$LASTREN^PSJLMPRI(DFN,+ODA_"P") Q:RNDT>$P(PVND4,"^",2)
26 .S $P(^PS(55,DFN,5,DA,4),"^")=$P(PVND4,"^"),$P(^PS(55,DFN,5,DA,4),"^",2)=$P(PVND4,"^",2)
27CR ; set x-refs
28 I $D(^PS(55,PSGP,5.1)),$P(^(5.1),"^",6) S X=$P(^(5.1),"^",6) I $P(ND2,"^",3),$P(ND2,"^",6)'>X S $P(^(5.1),"^",6)=$P(ND2,"^",3)
29 S ^PS(55,PSGP,5,"B",+ODA,DA)="",^PS(55,"AUE",PSGP,DA)=""
30 F S="C","O","P","R","OC" K ^PS(55,PSGP,5,"AU",S,+$P(PSGPND2,"^",4),DA)
31 S ^PS(55,PSGP,5,"AU",$P(PSGPND0,"^",7),+$P(PSGPND2,"^",4),DA)=""
32 S ^PS(55,PSGP,5,"AUS",+$P(ND2,"^",4),DA)="" I OFD,OFD'=$P(ND2,"^",4) K ^PS(55,PSGP,5,"AUS",+OFD,DA)
33 I $$PATCH^XPDUTL("PXRM*1.5*12") S X(1)=+$P(ND2,"^",2),X(2)=+$P(ND2,"^",4),DA(1)=PSGP D SPSPA^PSJXRFS(.X,.DA,"UD")
34 K DIK S DA(1)=PSGP S DIK="^PS(55,"_DA(1)_",5,",DIK(1)=125 D EN1^DIK K DIK
35 S PSGTOL=2,PSGTOO=1 F PSGUOW=0:0 S PSGUOW=$O(^PS(53.41,2,1,PSGUOW)) Q:'PSGUOW I $D(^(PSGUOW,1,PSGP,1,2,1,+ODA)) K ^(+ODA) D ENL^PSGVDS
36DONE I $D(PSGOE2),PSGOE2]"",$D(^TMP("PSJON",$J,PSGOE2)) S ^(PSGOE2)=DA_"U"
37 S PSGODA=ODA,PSGORD=DA_"U"
38 F Q=0:0 S Q=$O(^PS(53.44,Q)) Q:'Q I $D(^(Q,1,PSGP,+ODA,0)) S $P(^(0),"^",2)=DA
39 L -^PS(53.1,ODA) L -^PS(55,DFN,5,+PSGORD) K CNT,ND,ODA,XX,ZND Q
Note: See TracBrowser for help on using the repository browser.