Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: BGOPROB3

BGOPROB3.m

Go to the documentation of this file.
BGOPROB3 ; IHS/BAO/TMD - Delete PROBLEMS ;11-Aug-2017 11:10;DU
 ;;1.1;BGO COMPONENTS;*20,23**;Mar 20, 2007;Build 3
 ; Delete a problem entry
 ;  PRIEN = Problem IEN ^ TYPE ^ DELETE REASON ^ OTHER^PROB ID
DEL(RET,PRIEN) ;EP
 N FPIEN,FPNUM,ZN,REASON,CMMT,IENS,IEN2,FDA
 D CHK^BGOPROB2(.RET,PRIEN)
 Q:+RET<0
 I $P(PRIEN,U,2)="P"&(+$P(PRIEN,U,5)>8999) D
 .S PRIEN=$P(PRIEN,U,1)
 .S FPNUM=9000013
 .S RET=$$DELETE^BGOUTL(FPNUM,PRIEN)
 E  D
 .S IENS=$P(PRIEN,U,1)
 .S REASON=$P(PRIEN,U,3),CMMT=$P(PRIEN,U,4)
 .S ZN=$G(^AUPNPROB(IENS,0)),RET=""
 .Q:ZN=""
 .S FPIEN=$$FNDFP(IENS,.FPNUM)
 .S FNUM=$$FNUM
 .S IEN2=IENS_","
 .S FDA=$NA(FDA(FNUM,IEN2))
 .S @FDA@(.12)="D"
 .S @FDA@(2.01)=DUZ
 .S @FDA@(2.02)=$$NOW^XLFDT()
 .S @FDA@(2.03)=REASON
 .S @FDA@(2.04)=CMMT
 .S RET=$$UPDATE^BGOUTL(.FDA,,.IEN)
 .;S RET=$$DELETE^BGOUTL("^AUPNPROB(",PRIEN)
 .I 'RET D EVT^BGOPROB(IENS,2,ZN)
 .I 'RET,FPIEN S RET=$$DELETE^BGOUTL(FPNUM,FPIEN)
 Q
FNDFP(PRIEN,FNUM) ;EP-
 N DFN,CLASS,DIEN,NIEN,DMOD,GBL,IEN,RET,X
 S X=$G(^AUPNPROB(PRIEN,0)),DIEN=+X,DFN=$P(X,U,2),DMOD=$P(X,U,3),CLASS=$P(X,U,4),NIEN=$P(X,U,5)
 S FNUM=$S(CLASS="P":9000013,1:0)
 Q:'FNUM ""
 S GBL=$$ROOT^DILFD(FNUM,,1)
 Q:'$L(GBL) ""  ;P8
 S IEN=0,RET=""
 F  S IEN=$O(@GBL@("AC",DFN,IEN)) Q:'IEN  D  Q:RET
 .S X=$G(@GBL@(IEN,0))
 .I +X=DIEN,$P(X,U,2)=DFN,$P(X,U,3)\1=DMOD,$P(X,U,4)=NIEN S RET=IEN
 Q RET
ASTHMA(RET,VIEN,INP,DIEN,DESCT) ;ASTHMA DATA
 N ACL,ASTHMA,RET2,AIEN,CONTROL,RET3,INP2,IENS,CODE
 K FDA
 S FNUM=$$FNUM,RET2=""
 S IENS=PRIEN_","
 S FDA=$NA(FDA(FNUM,IENS))
 Q:'DFN
 Q:'PRIEN
 S ACL=$P(INP,U,2)
 Q:ACL=""
 I DUZ("AG")="I" D
 . S CODE=$$CODEC^ICDEX(80,DIEN)
 . S ASTHMA=$$CHECK^BGOASLK(CODE,DESCT)
 . I ASTHMA=0 S @FDA@(.15)="@"
 . I ASTHMA=1 D
 ..S ACL=$S(ACL="INTERMITTENT":1,ACL="MILD PERSISTENT":2,ACL="MODERATE PERSISTENT":3,ACL="SEVERE PERSISTENT":4,1:"")
 ..S @FDA@(.15)=ACL
 ..S RET2=$$UPDATE^BGOUTL(.FDA,,.IENS)
 ..I RET2 S ERR=1,RET=RET_U_"Error on Asthma Update"
 ..;Patch 6 check to see if its an asthma diagnosis
 ..I ASTHMA=1&(ACL="") S RET=RET_U_ASTHMA
 ..S CONTROL=$P(INP,U,3)
 ..S AIEN=$P(INP,U,4)
 ..I VIEN="" S ERR=1,RET=RET_U_"Visit not defined. Cannot store asthma data"
 ..I CONTROL="NONE RECORDED" S CONTROL=""
 ..I CONTROL'="" D
 ...S INP2=AIEN_U_VIEN_U_CONTROL
 ...D SET^BGOVAST(.RET3,INP2)
 ...I RET3 S RET=RET_U_RET3
 ...E  S RET=RET_U_"Unable to store V asthma data"
 Q
 ; Return file number
FNUM() Q 9000011