RORUPD07 ;HCIOFO/SG - PROCESSING OF THE 'PROBLEM' FILE ;8/3/05 9:46am
;;1.5;CLINICAL CASE REGISTRIES;**19**;Feb 17, 2006;Build 43
;
; This routine uses the following IAs:
;
; #928 ACTIVE^GMPLUTL
; #2977 GETFLDS^GMPLEDT3
;
Q
;
;***** LOADS DATA ELEMENT VALUES
;
; IENS IENS of the current record
;
; Return values:
; <0 Error code
; 0 Ok
;
LOAD(IENS) ;
N RC S RC=0
;--- API #1
I $D(RORUPD("SR",RORFILE,"F",1)) D Q:RC<0 RC
. S RC=$$LOADFLDS^RORUPDUT(RORFILE,IENS)
;--- API #2
I $D(RORUPD("SR",RORFILE,"F",2)) D Q:RC<0 RC
. N DE,GMPFLD,GMPORIG,GMPROV,GMVAMC,IN,IP,VT
. S (GMPVAMC,GMPROV)=0
. D GETFLDS^GMPLEDT3(+IENS)
. ;--- load date of interest from PTF
. I +$G(GMPFLD(80201)) S RORVALS("DV",RORFILE,"DOI")=$P(GMPFLD(80201),"^")
. S DE=""
. F S DE=$O(RORUPD("SR",RORFILE,"F",2,DE)) Q:DE="" D
. . S VT=""
. . F S VT=$O(RORUPD("SR",RORFILE,"F",2,DE,VT)) Q:VT="" D
. . . S IP=+$P(RORUPD("SR",RORFILE,"F",2,DE,VT),U,1) Q:IP'>0
. . . S IN=+$P(RORUPD("SR",RORFILE,"F",2,DE,VT),U,2)
. . . S RORVALS("DV",RORFILE,DE,VT)=$P($G(GMPFLD(IN)),U,IP)
Q 0
;
;***** PROCESSING OF THE 'PROBLEM' FILE
;
; UPDSTART Date of the earliest update
; PATIEN Patient IEN
;
; Return values:
; <0 Error code
; 0 Continue processing of the current patient
; 1 Stop processing
;
PROBLEM(UPDSTART,PATIEN) ;
N RORFILE ; File number
N RORPLST ; List of patient problems
;
N DATE,IS,LOCATION,PROBIENS,RC,TMP,DOI
S RORFILE=9000011
;--- Check if the problem list has been modified in
; the data scan period of the patient.
Q:$$MOD^GMPLUTL3(PATIEN)<UPDSTART 0
;--- Load a list of active problems
D ACTIVE^GMPLUTL(PATIEN,.RORPLST)
;
;--- Browse through the problems
S (IS,RC)=0
F S IS=$O(RORPLST(IS)) Q:IS="" D Q:RC
. S PROBIENS=+RORPLST(IS,0)_","
. ;--- Load necessary data elements
. I $D(RORUPD("SR",RORFILE,"F"))>1 D I TMP<0 D INCEC^RORUPDUT() Q
. . S TMP=$$LOAD(PROBIENS) Q:TMP<0
. . S TMP=$$GETDE^RORUPDUT(RORFILE,130)
. . S LOCATION=$S(TMP>0:$$IEN4^RORUTL18(TMP),1:"")
. ;--- Ignore problems entered not in the data scan period
. S DATE=$$GETDE^RORUPDUT(RORFILE,118)
. Q:(DATE<UPDSTART)!(DATE'<RORUPD("DSEND"))
. ; --- Apply rule using Date of Interest
. S DOI=$G(RORVALS("DV",RORFILE,"DOI")) I DOI="" S DOI=DATE
. ;--- Apply "before" rules
. S RC=$$APLRULES^RORUPDUT(RORFILE,PROBIENS,"B",DOI,$G(LOCATION))
. I RC D INCEC^RORUPDUT(.RC) Q
. ;--- Apply "after" rules
. S RC=$$APLRULES^RORUPDUT(RORFILE,PROBIENS,"A",DOI,$G(LOCATION))
. I RC D INCEC^RORUPDUT(.RC) Q
;
D CLRDES^RORUPDUT(RORFILE)
Q RC
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRORUPD07 2743 printed Dec 13, 2024@01:43:43 Page 2
RORUPD07 ;HCIOFO/SG - PROCESSING OF THE 'PROBLEM' FILE ;8/3/05 9:46am
+1 ;;1.5;CLINICAL CASE REGISTRIES;**19**;Feb 17, 2006;Build 43
+2 ;
+3 ; This routine uses the following IAs:
+4 ;
+5 ; #928 ACTIVE^GMPLUTL
+6 ; #2977 GETFLDS^GMPLEDT3
+7 ;
+8 QUIT
+9 ;
+10 ;***** LOADS DATA ELEMENT VALUES
+11 ;
+12 ; IENS IENS of the current record
+13 ;
+14 ; Return values:
+15 ; <0 Error code
+16 ; 0 Ok
+17 ;
LOAD(IENS) ;
+1 NEW RC
SET RC=0
+2 ;--- API #1
+3 IF $DATA(RORUPD("SR",RORFILE,"F",1))
Begin DoDot:1
+4 SET RC=$$LOADFLDS^RORUPDUT(RORFILE,IENS)
End DoDot:1
if RC<0
QUIT RC
+5 ;--- API #2
+6 IF $DATA(RORUPD("SR",RORFILE,"F",2))
Begin DoDot:1
+7 NEW DE,GMPFLD,GMPORIG,GMPROV,GMVAMC,IN,IP,VT
+8 SET (GMPVAMC,GMPROV)=0
+9 DO GETFLDS^GMPLEDT3(+IENS)
+10 ;--- load date of interest from PTF
+11 IF +$GET(GMPFLD(80201))
SET RORVALS("DV",RORFILE,"DOI")=$PIECE(GMPFLD(80201),"^")
+12 SET DE=""
+13 FOR
SET DE=$ORDER(RORUPD("SR",RORFILE,"F",2,DE))
if DE=""
QUIT
Begin DoDot:2
+14 SET VT=""
+15 FOR
SET VT=$ORDER(RORUPD("SR",RORFILE,"F",2,DE,VT))
if VT=""
QUIT
Begin DoDot:3
+16 SET IP=+$PIECE(RORUPD("SR",RORFILE,"F",2,DE,VT),U,1)
if IP'>0
QUIT
+17 SET IN=+$PIECE(RORUPD("SR",RORFILE,"F",2,DE,VT),U,2)
+18 SET RORVALS("DV",RORFILE,DE,VT)=$PIECE($GET(GMPFLD(IN)),U,IP)
End DoDot:3
End DoDot:2
End DoDot:1
if RC<0
QUIT RC
+19 QUIT 0
+20 ;
+21 ;***** PROCESSING OF THE 'PROBLEM' FILE
+22 ;
+23 ; UPDSTART Date of the earliest update
+24 ; PATIEN Patient IEN
+25 ;
+26 ; Return values:
+27 ; <0 Error code
+28 ; 0 Continue processing of the current patient
+29 ; 1 Stop processing
+30 ;
PROBLEM(UPDSTART,PATIEN) ;
+1 ; File number
NEW RORFILE
+2 ; List of patient problems
NEW RORPLST
+3 ;
+4 NEW DATE,IS,LOCATION,PROBIENS,RC,TMP,DOI
+5 SET RORFILE=9000011
+6 ;--- Check if the problem list has been modified in
+7 ; the data scan period of the patient.
+8 if $$MOD^GMPLUTL3(PATIEN)<UPDSTART
QUIT 0
+9 ;--- Load a list of active problems
+10 DO ACTIVE^GMPLUTL(PATIEN,.RORPLST)
+11 ;
+12 ;--- Browse through the problems
+13 SET (IS,RC)=0
+14 FOR
SET IS=$ORDER(RORPLST(IS))
if IS=""
QUIT
Begin DoDot:1
+15 SET PROBIENS=+RORPLST(IS,0)_","
+16 ;--- Load necessary data elements
+17 IF $DATA(RORUPD("SR",RORFILE,"F"))>1
Begin DoDot:2
+18 SET TMP=$$LOAD(PROBIENS)
if TMP<0
QUIT
+19 SET TMP=$$GETDE^RORUPDUT(RORFILE,130)
+20 SET LOCATION=$SELECT(TMP>0:$$IEN4^RORUTL18(TMP),1:"")
End DoDot:2
IF TMP<0
DO INCEC^RORUPDUT()
QUIT
+21 ;--- Ignore problems entered not in the data scan period
+22 SET DATE=$$GETDE^RORUPDUT(RORFILE,118)
+23 if (DATE<UPDSTART)!(DATE'<RORUPD("DSEND"))
QUIT
+24 ; --- Apply rule using Date of Interest
+25 SET DOI=$GET(RORVALS("DV",RORFILE,"DOI"))
IF DOI=""
SET DOI=DATE
+26 ;--- Apply "before" rules
+27 SET RC=$$APLRULES^RORUPDUT(RORFILE,PROBIENS,"B",DOI,$GET(LOCATION))
+28 IF RC
DO INCEC^RORUPDUT(.RC)
QUIT
+29 ;--- Apply "after" rules
+30 SET RC=$$APLRULES^RORUPDUT(RORFILE,PROBIENS,"A",DOI,$GET(LOCATION))
+31 IF RC
DO INCEC^RORUPDUT(.RC)
QUIT
End DoDot:1
if RC
QUIT
+32 ;
+33 DO CLRDES^RORUPDUT(RORFILE)
+34 QUIT RC