- GMTSPLSZ ;SLC/SBW - Updated Problem List 2.0 extract routine. in HS namespace ;18/Apr/95
- ;;2.7;Health Summary;;Oct 20, 1995
- GMPLHS ;SLC/MKB,DJP,SBW - Extract for Prob List-Health Summary 2.7 ;15/APR/95
- ;;2.0;Problem List;;Aug 25, 1994
- GETLIST(GMPDFN,STATUS) ; Define list
- N GMPLIST,GMPLVIEW,GMPARAM,GMPTOTAL
- K ^TMP("GMPLHS",$J)
- Q:+GMPDFN'>0
- S GMPARAM("QUIET")=1,GMPARAM("REV")=$P($G(^GMPL(125.99,1,0)),U,5)="R"
- S GMPLVIEW("ACT")=STATUS,GMPLVIEW("PROV")=0,GMPLVIEW("VIEW")=""
- D GETPLIST^GMPLMGR1(.GMPLIST,.GMPTOTAL,.GMPLVIEW)
- BUILD ; Build list for selected patient
- ; Returns ^TMP("GMPLHS",$J,STATUS,0) = GMPCNT ^ GMPTOTAL
- N IFN,GMPCNT,NUM
- S (NUM,GMPCNT)=0
- F S NUM=$O(GMPLIST(NUM)) Q:NUM'>0 D
- . S IFN=+GMPLIST(NUM) Q:IFN'>0
- . D GETPROB(IFN)
- I $G(GMPCNT)'>0 K ^TMP("GMPLHS",$J) Q
- S ^TMP("GMPLHS",$J,STATUS,0)=GMPCNT_U_GMPTOTAL ; # entries extracted ^ # entries that exist
- Q
- GETPROB(IFN) ; Get problem data and set it to ^TMP array
- ; Returns ^TMP("GMPLHS",$J,CNT,0)
- ; Returns ^TMP("GMPLHS",$J,CNT,IFN,"N")
- N DIC,DIQ,DR,DA,REC,DIAG,LASTMDT,NARR,SITE,ENTDT,STAT,ONSETDT,RPROV
- N SERV,SERVABB,RESDT,CLIN,RECDT
- S DIC=9000011,DA=IFN,DIQ="REC(",DIQ(0)="IE"
- S DR=".01;.03;.05;.06;.08;.12;.13;1.05;1.06;1.07;1.08;1.09"
- D EN^DIQ1
- S DIAG=REC(9000011,DA,.01,"I")
- S LASTMDT=REC(9000011,DA,.03,"I")
- S NARR=REC(9000011,DA,.05,"E")
- S SITE=REC(9000011,DA,.06,"E")
- S ENTDT=REC(9000011,DA,.08,"I")
- S STAT=REC(9000011,DA,.12,"I")
- S ONSETDT=REC(9000011,DA,.13,"I")
- S RPROV=REC(9000011,DA,1.05,"E")
- S SERV=REC(9000011,DA,1.06,"E")
- S SERVABB=$$SERV(REC(9000011,DA,1.06,"I"),SERV)
- S RESDT=REC(9000011,DA,1.07,"I")
- S CLIN=REC(9000011,DA,1.08,"E")
- S RECDT=REC(9000011,DA,1.09,"I")
- S GMPCNT=GMPCNT+1 ; # of problems included in the extract
- S ^TMP("GMPLHS",$J,GMPCNT,0)=DIAG_U_LASTMDT_U_SITE_U_ENTDT_U_STAT_U_ONSETDT_U_RPROV_U_SERV_U_SERVABB_U_RESDT_U_CLIN_U_RECDT
- S ^TMP("GMPLHS",$J,GMPCNT,"N")=NARR
- D GETCOMM(IFN,GMPCNT)
- Q
- GETCOMM(IFN,CNT) ;Get active comments for a note
- ; Returns ^TMP("GMPLHS",$J,CNT,"C",LOCATION,NOTE NMBR,0))
- N IFN2,IFN3,LOC,NODE
- S LOC=0
- Q:$D(^AUPNPROB(IFN,11))'>0
- S IFN2=0
- F S IFN2=$O(^AUPNPROB(IFN,11,IFN2)) Q:IFN2'>0 D
- . Q:$D(^AUPNPROB(IFN,11,IFN2,11))'>0
- . S LOC=+$G(^AUPNPROB(IFN,11,IFN2,0))
- . S IFN3=0
- . F S IFN3=$O(^AUPNPROB(IFN,11,IFN2,11,IFN3)) Q:IFN3'>0 D
- . . S NODE=$G(^AUPNPROB(IFN,11,IFN2,11,IFN3,0))
- . . Q:$P(NODE,U,4)']""
- . . S ^TMP("GMPLHS",$J,CNT,"C",LOC,$P(NODE,U),0)=$P(NODE,U,3)_U_$P(NODE,U,5)_U_$P($G(^VA(200,+$P(NODE,U,6),0)),U)
- Q
- SERV(X,SERV) ; Return service name abbreviation
- N ABBREV
- S ABBREV=$P($G(^DIC(49,+X,0)),U,2)
- I ABBREV="" S ABBREV=$E($G(SERV),1,5)
- Q ABBREV
- GMTSPLSZ ;SLC/SBW - Updated Problem List 2.0 extract routine. in HS namespace ;18/Apr/95
- +1 ;;2.7;Health Summary;;Oct 20, 1995
- GMPLHS ;SLC/MKB,DJP,SBW - Extract for Prob List-Health Summary 2.7 ;15/APR/95
- +1 ;;2.0;Problem List;;Aug 25, 1994
- GETLIST(GMPDFN,STATUS) ; Define list
- +1 NEW GMPLIST,GMPLVIEW,GMPARAM,GMPTOTAL
- +2 KILL ^TMP("GMPLHS",$JOB)
- +3 IF +GMPDFN'>0
- QUIT
- +4 SET GMPARAM("QUIET")=1
- SET GMPARAM("REV")=$PIECE($GET(^GMPL(125.99,1,0)),U,5)="R"
- +5 SET GMPLVIEW("ACT")=STATUS
- SET GMPLVIEW("PROV")=0
- SET GMPLVIEW("VIEW")=""
- +6 DO GETPLIST^GMPLMGR1(.GMPLIST,.GMPTOTAL,.GMPLVIEW)
- BUILD ; Build list for selected patient
- +1 ; Returns ^TMP("GMPLHS",$J,STATUS,0) = GMPCNT ^ GMPTOTAL
- +2 NEW IFN,GMPCNT,NUM
- +3 SET (NUM,GMPCNT)=0
- +4 FOR
- SET NUM=$ORDER(GMPLIST(NUM))
- IF NUM'>0
- QUIT
- Begin DoDot:1
- +5 SET IFN=+GMPLIST(NUM)
- IF IFN'>0
- QUIT
- +6 DO GETPROB(IFN)
- End DoDot:1
- +7 IF $GET(GMPCNT)'>0
- KILL ^TMP("GMPLHS",$JOB)
- QUIT
- +8 ; # entries extracted ^ # entries that exist
- SET ^TMP("GMPLHS",$JOB,STATUS,0)=GMPCNT_U_GMPTOTAL
- +9 QUIT
- GETPROB(IFN) ; Get problem data and set it to ^TMP array
- +1 ; Returns ^TMP("GMPLHS",$J,CNT,0)
- +2 ; Returns ^TMP("GMPLHS",$J,CNT,IFN,"N")
- +3 NEW DIC,DIQ,DR,DA,REC,DIAG,LASTMDT,NARR,SITE,ENTDT,STAT,ONSETDT,RPROV
- +4 NEW SERV,SERVABB,RESDT,CLIN,RECDT
- +5 SET DIC=9000011
- SET DA=IFN
- SET DIQ="REC("
- SET DIQ(0)="IE"
- +6 SET DR=".01;.03;.05;.06;.08;.12;.13;1.05;1.06;1.07;1.08;1.09"
- +7 DO EN^DIQ1
- +8 SET DIAG=REC(9000011,DA,.01,"I")
- +9 SET LASTMDT=REC(9000011,DA,.03,"I")
- +10 SET NARR=REC(9000011,DA,.05,"E")
- +11 SET SITE=REC(9000011,DA,.06,"E")
- +12 SET ENTDT=REC(9000011,DA,.08,"I")
- +13 SET STAT=REC(9000011,DA,.12,"I")
- +14 SET ONSETDT=REC(9000011,DA,.13,"I")
- +15 SET RPROV=REC(9000011,DA,1.05,"E")
- +16 SET SERV=REC(9000011,DA,1.06,"E")
- +17 SET SERVABB=$$SERV(REC(9000011,DA,1.06,"I"),SERV)
- +18 SET RESDT=REC(9000011,DA,1.07,"I")
- +19 SET CLIN=REC(9000011,DA,1.08,"E")
- +20 SET RECDT=REC(9000011,DA,1.09,"I")
- +21 ; # of problems included in the extract
- SET GMPCNT=GMPCNT+1
- +22 SET ^TMP("GMPLHS",$JOB,GMPCNT,0)=DIAG_U_LASTMDT_U_SITE_U_ENTDT_U_STAT_U_ONSETDT_U_RPROV_U_SERV_U_SERVABB_U_RESDT_U_CLIN_U_RECDT
- +23 SET ^TMP("GMPLHS",$JOB,GMPCNT,"N")=NARR
- +24 DO GETCOMM(IFN,GMPCNT)
- +25 QUIT
- GETCOMM(IFN,CNT) ;Get active comments for a note
- +1 ; Returns ^TMP("GMPLHS",$J,CNT,"C",LOCATION,NOTE NMBR,0))
- +2 NEW IFN2,IFN3,LOC,NODE
- +3 SET LOC=0
- +4 IF $DATA(^AUPNPROB(IFN,11))'>0
- QUIT
- +5 SET IFN2=0
- +6 FOR
- SET IFN2=$ORDER(^AUPNPROB(IFN,11,IFN2))
- IF IFN2'>0
- QUIT
- Begin DoDot:1
- +7 IF $DATA(^AUPNPROB(IFN,11,IFN2,11))'>0
- QUIT
- +8 SET LOC=+$GET(^AUPNPROB(IFN,11,IFN2,0))
- +9 SET IFN3=0
- +10 FOR
- SET IFN3=$ORDER(^AUPNPROB(IFN,11,IFN2,11,IFN3))
- IF IFN3'>0
- QUIT
- Begin DoDot:2
- +11 SET NODE=$GET(^AUPNPROB(IFN,11,IFN2,11,IFN3,0))
- +12 IF $PIECE(NODE,U,4)']""
- QUIT
- +13 SET ^TMP("GMPLHS",$JOB,CNT,"C",LOC,$PIECE(NODE,U),0)=$PIECE(NODE,U,3)_U_$PIECE(NODE,U,5)_U_$PIECE($GET(^VA(200,+$PIECE(NODE,U,6),0)),U)
- End DoDot:2
- End DoDot:1
- +14 QUIT
- SERV(X,SERV) ; Return service name abbreviation
- +1 NEW ABBREV
- +2 SET ABBREV=$PIECE($GET(^DIC(49,+X,0)),U,2)
- +3 IF ABBREV=""
- SET ABBREV=$EXTRACT($GET(SERV),1,5)
- +4 QUIT ABBREV