- ABSPOSQ1 ; IHS/FCS/DRS - POS background, Part 1 ; [ 11/04/2002 2:21 PM ]
- ;;1.0;PHARMACY POINT OF SALE;**3,46**;JUN 01, 2001;Build 38
- ;
- ; This is usually started by Taskman call in TASK^ABSPOSIZ
- ;
- ; For all with status 0, LOOP loops and calls CLAIMINF()
- ; to fill in any missing information. Pricing, for example,
- ; may or may not have already been determined.
- ; Sets status = 10 while it's working on a request.
- ; Sets status = 30 when it's done - and then it's ready for ABSPOSQ2
- ; If there were problems with the claim, the status will be set = 99.
- ;
- ; Also deals with status = 19 (special for Oklahoma Medicaid)
- ;
- ; ABSPOSQ - contains many useful $$ calls
- ; Here in ABSPOSQ1:
- ; The big outer loop through ^ABSPT("AD",0,*)
- ; and Task manager calls to start up ^ABSPOSQ2
- ; Extensions of ABSPOSQ1:
- ; ABSPOSQA - ONE59
- ; ABSPOSQB - CLAIMINF
- ; ABSPOSQC - some CLAIMINF subroutines
- ; ABSPOSQD - data for certain a/r interfaces
- ; ABSPOSQS - special queuing for Oklahoma Medicaid 3 highest prices
- ;
- ;--------------------------------------------------------------
- ;IHS/SD/lwj 11/04/02 on behalf of IHS/OKCAO/POC
- ; Set ZTREQ to delete the task after it completes in task man
- ;
- ;-------------------------------------------------------------
- Q
- LOOP ; line item detail: your work list is ^ABSPT("AD",0)
- N ERROR,PREVPAT,THISPAT,COUNT,PACKETER S PACKETER=0
- N IEN59,ABSBRXI,ABSBRXR,ABSBNDC,MODULO
- N ABSBPATI,ABSBPDIV,ABSBSDIV,ABSBVISI,ABSPHARM,INSURER
- N VMEDDFN,APCDVCN
- ;
- ;IHS/OIT/CAS/RCS Patch 46...If 'POSSTAT' flag is set to '1' then halt the POS process
- I $G(^ABSP(9002313.99,1,"POSSTAT"))=1 Q ;Halt the POS Process, only used by programmers
- ;
- ;IHS/SD/lwj 11/04/02 on behalf of IHS/OKCAO/POC 11/04/02
- I $D(ZTQUEUED) S ZTREQ="@" ;delete task if complete
- ;
- ;IHS/SD/lwj 11/04/02 end change
- ;
- S MODULO=4 ; interval at which we start up a packeter program
- S COUNT=0
- F S IEN59=$$NEXT59 Q:'IEN59 D
- . D INIT^ABSPOSL(IEN59,1) ; logging (don't delete old data)
- . D ONE59^ABSPOSQA ; process this claim
- . D RELSLOT^ABSPOSL ; release logging slot
- ; Deal with the status 19s (special for Oklahoma Medicaid bundling)
- I $D(^ABSPT("AD",19)) D
- . I $$STAT19^ABSPOSQS D ; if any 19s pushed to status 30, then
- . . S COUNT=.1 ; force packeter to start
- I COUNT#MODULO'=0 D PACKETER
- Q
- NEXT59() ; Get the next entry with Status = 0
- ; If there is one, change its status to 10
- ; (says "Gathering claim information")
- ; (Being very careful to LOCK access while you're getting the entry
- ; and changing its status.)
- ; Timed lock and resulting complications is a hassle but not a mess.
- L +^ABSPT:300
- I '$T D Q 0 ; lock failed?!
- . D TASK^ABSPOSIZ ; try again - requeue this job
- S IEN59=$O(^ABSPT("AD",0,0))
- I IEN59 D SETSTAT(10)
- L -^ABSPT
- Q IEN59
- SETSTAT(NEWSTAT) ;EP - from ABSPOSQA
- N ABSBRXI S ABSBRXI=IEN59 ; unfortunate variable name convention
- D SETSTAT^ABSPOSU(NEWSTAT)
- Q
- PACKETER ;EP - from ABSPOSAN,ABSPOSQA
- ; tell the packetizer it's time to get working
- ; But only if there are claims in status 30
- I $O(^ABSPT("AD",30,0)) D TASK
- Q
- TASK ;EP - from ABSPOS2D,ABSPOS6D,ABSPOS6L,ABSPOSQ2,ABSPOSQ4
- N X,%DT,Y S X="N",%DT="ST" D ^%DT
- D TASKAT(Y)
- I $D(PACKETER) S PACKETER=PACKETER+1 ; note: "we started the packeter"
- Q
- TASKAT(ZTDTH) ;EP - from ABSPOSQ4 (requeue if insurer is sleeping)
- ; called here from ABSPOSQS -
- ;N (DUZ,PACKETER,ZTDTH) N ZTRTN
- N ZTRTN,ZTIO
- S ZTRTN="PACKETS^ABSPOSQ2",ZTIO=""
- D ^%ZTLOAD
- Q
- ABSPOSQ1 ; IHS/FCS/DRS - POS background, Part 1 ; [ 11/04/2002 2:21 PM ]
- +1 ;;1.0;PHARMACY POINT OF SALE;**3,46**;JUN 01, 2001;Build 38
- +2 ;
- +3 ; This is usually started by Taskman call in TASK^ABSPOSIZ
- +4 ;
- +5 ; For all with status 0, LOOP loops and calls CLAIMINF()
- +6 ; to fill in any missing information. Pricing, for example,
- +7 ; may or may not have already been determined.
- +8 ; Sets status = 10 while it's working on a request.
- +9 ; Sets status = 30 when it's done - and then it's ready for ABSPOSQ2
- +10 ; If there were problems with the claim, the status will be set = 99.
- +11 ;
- +12 ; Also deals with status = 19 (special for Oklahoma Medicaid)
- +13 ;
- +14 ; ABSPOSQ - contains many useful $$ calls
- +15 ; Here in ABSPOSQ1:
- +16 ; The big outer loop through ^ABSPT("AD",0,*)
- +17 ; and Task manager calls to start up ^ABSPOSQ2
- +18 ; Extensions of ABSPOSQ1:
- +19 ; ABSPOSQA - ONE59
- +20 ; ABSPOSQB - CLAIMINF
- +21 ; ABSPOSQC - some CLAIMINF subroutines
- +22 ; ABSPOSQD - data for certain a/r interfaces
- +23 ; ABSPOSQS - special queuing for Oklahoma Medicaid 3 highest prices
- +24 ;
- +25 ;--------------------------------------------------------------
- +26 ;IHS/SD/lwj 11/04/02 on behalf of IHS/OKCAO/POC
- +27 ; Set ZTREQ to delete the task after it completes in task man
- +28 ;
- +29 ;-------------------------------------------------------------
- +30 QUIT
- LOOP ; line item detail: your work list is ^ABSPT("AD",0)
- +1 NEW ERROR,PREVPAT,THISPAT,COUNT,PACKETER
- SET PACKETER=0
- +2 NEW IEN59,ABSBRXI,ABSBRXR,ABSBNDC,MODULO
- +3 NEW ABSBPATI,ABSBPDIV,ABSBSDIV,ABSBVISI,ABSPHARM,INSURER
- +4 NEW VMEDDFN,APCDVCN
- +5 ;
- +6 ;IHS/OIT/CAS/RCS Patch 46...If 'POSSTAT' flag is set to '1' then halt the POS process
- +7 ;Halt the POS Process, only used by programmers
- IF $GET(^ABSP(9002313.99,1,"POSSTAT"))=1
- QUIT
- +8 ;
- +9 ;IHS/SD/lwj 11/04/02 on behalf of IHS/OKCAO/POC 11/04/02
- +10 ;delete task if complete
- IF $DATA(ZTQUEUED)
- SET ZTREQ="@"
- +11 ;
- +12 ;IHS/SD/lwj 11/04/02 end change
- +13 ;
- +14 ; interval at which we start up a packeter program
- SET MODULO=4
- +15 SET COUNT=0
- +16 FOR
- SET IEN59=$$NEXT59
- IF 'IEN59
- QUIT
- Begin DoDot:1
- +17 ; logging (don't delete old data)
- DO INIT^ABSPOSL(IEN59,1)
- +18 ; process this claim
- DO ONE59^ABSPOSQA
- +19 ; release logging slot
- DO RELSLOT^ABSPOSL
- End DoDot:1
- +20 ; Deal with the status 19s (special for Oklahoma Medicaid bundling)
- +21 IF $DATA(^ABSPT("AD",19))
- Begin DoDot:1
- +22 ; if any 19s pushed to status 30, then
- IF $$STAT19^ABSPOSQS
- Begin DoDot:2
- +23 ; force packeter to start
- SET COUNT=.1
- End DoDot:2
- End DoDot:1
- +24 IF COUNT#MODULO'=0
- DO PACKETER
- +25 QUIT
- NEXT59() ; Get the next entry with Status = 0
- +1 ; If there is one, change its status to 10
- +2 ; (says "Gathering claim information")
- +3 ; (Being very careful to LOCK access while you're getting the entry
- +4 ; and changing its status.)
- +5 ; Timed lock and resulting complications is a hassle but not a mess.
- +6 LOCK +^ABSPT:300
- +7 ; lock failed?!
- IF '$TEST
- Begin DoDot:1
- +8 ; try again - requeue this job
- DO TASK^ABSPOSIZ
- End DoDot:1
- QUIT 0
- +9 SET IEN59=$ORDER(^ABSPT("AD",0,0))
- +10 IF IEN59
- DO SETSTAT(10)
- +11 LOCK -^ABSPT
- +12 QUIT IEN59
- SETSTAT(NEWSTAT) ;EP - from ABSPOSQA
- +1 ; unfortunate variable name convention
- NEW ABSBRXI
- SET ABSBRXI=IEN59
- +2 DO SETSTAT^ABSPOSU(NEWSTAT)
- +3 QUIT
- PACKETER ;EP - from ABSPOSAN,ABSPOSQA
- +1 ; tell the packetizer it's time to get working
- +2 ; But only if there are claims in status 30
- +3 IF $ORDER(^ABSPT("AD",30,0))
- DO TASK
- +4 QUIT
- TASK ;EP - from ABSPOS2D,ABSPOS6D,ABSPOS6L,ABSPOSQ2,ABSPOSQ4
- +1 NEW X,%DT,Y
- SET X="N"
- SET %DT="ST"
- DO ^%DT
- +2 DO TASKAT(Y)
- +3 ; note: "we started the packeter"
- IF $DATA(PACKETER)
- SET PACKETER=PACKETER+1
- +4 QUIT
- TASKAT(ZTDTH) ;EP - from ABSPOSQ4 (requeue if insurer is sleeping)
- +1 ; called here from ABSPOSQS -
- +2 ;N (DUZ,PACKETER,ZTDTH) N ZTRTN
- +3 NEW ZTRTN,ZTIO
- +4 SET ZTRTN="PACKETS^ABSPOSQ2"
- SET ZTIO=""
- +5 DO ^%ZTLOAD
- +6 QUIT