BGOHOS ; IHS/BAO/TMD - Hospital associated with problems ;14-Aug-2014 10:56;DU
;;1.1;BGO COMPONENTS;**13**;Mar 20, 2007;Build 16
;---------------------------------------------
HOSP(RET,PROB,VIEN,DEL) ;EP
;Add POV to the problem multiple
N PRIEN,FDA,IEN,ERR,X,VFNEW
S RET="",VFNEW=0
Q:PROB=""
I $P($G(^AUPNVSIT(VIEN,0)),U,7)'="H"&($P($G(^AUPNVSIT(VIEN,0)),U,7)'="O") D Q
.S RET="Visit selected is not an inpt visit"
I $G(DEL)=1 D DELH(.RET,PROB,VIEN) Q
I $D(^AUPNPROB(PROB,15,"B",VIEN))=0 D
.S PRIEN="+1,"_PROB_","
.S FDA(9000011.15,PRIEN,.01)=VIEN
.D UPDATE^DIE(,"FDA","IEN","ERR")
.I $D(ERR) S RET=ERR
.E S RET=IEN(1)
Q
; Delete a Hospital visit entry
DELH(RET,PROB,VIEN) ;EP
N IEN,FDA,OKAY,ERR
I $G(PROB) D
.Q:'+VIEN
.S IEN="" S IEN=$O(^AUPNPROB(PROB,15,"B",VIEN,IEN)) Q:'+IEN D
..S FDA(9000011.15,IEN_","_PROB_",",.01)="@"
..D UPDATE^DIE("","FDA","OKAY","ERR")
Q
BGOHOS ; IHS/BAO/TMD - Hospital associated with problems ;14-Aug-2014 10:56;DU
+1 ;;1.1;BGO COMPONENTS;**13**;Mar 20, 2007;Build 16
+2 ;---------------------------------------------
HOSP(RET,PROB,VIEN,DEL) ;EP
+1 ;Add POV to the problem multiple
+2 NEW PRIEN,FDA,IEN,ERR,X,VFNEW
+3 SET RET=""
SET VFNEW=0
+4 IF PROB=""
QUIT
+5 IF $PIECE($GET(^AUPNVSIT(VIEN,0)),U,7)'="H"&($PIECE($GET(^AUPNVSIT(VIEN,0)),U,7)'="O")
Begin DoDot:1
+6 SET RET="Visit selected is not an inpt visit"
End DoDot:1
QUIT
+7 IF $GET(DEL)=1
DO DELH(.RET,PROB,VIEN)
QUIT
+8 IF $DATA(^AUPNPROB(PROB,15,"B",VIEN))=0
Begin DoDot:1
+9 SET PRIEN="+1,"_PROB_","
+10 SET FDA(9000011.15,PRIEN,.01)=VIEN
+11 DO UPDATE^DIE(,"FDA","IEN","ERR")
+12 IF $DATA(ERR)
SET RET=ERR
+13 IF '$TEST
SET RET=IEN(1)
End DoDot:1
+14 QUIT
+15 ; Delete a Hospital visit entry
DELH(RET,PROB,VIEN) ;EP
+1 NEW IEN,FDA,OKAY,ERR
+2 IF $GET(PROB)
Begin DoDot:1
+3 IF '+VIEN
QUIT
+4 SET IEN=""
SET IEN=$ORDER(^AUPNPROB(PROB,15,"B",VIEN,IEN))
IF '+IEN
QUIT
Begin DoDot:2
+5 SET FDA(9000011.15,IEN_","_PROB_",",.01)="@"
+6 DO UPDATE^DIE("","FDA","OKAY","ERR")
End DoDot:2
End DoDot:1
+7 QUIT