Changeset 1603 for fmts/trunk


Ignore:
Timestamp:
Jan 28, 2013, 7:15:32 PM (12 years ago)
Author:
Sam Habiel
Message:

Code to add problems from SMART document

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fmts/trunk/p/C0XPT0.m

    r1602 r1603  
    1 C0XPT0 ; VEN/SMH - Get patient data and do something about it ;2013-01-25  5:00 PM
     1C0XPT0 ; VEN/SMH - Get patient data and do something about it ;2013-01-28  4:24 PM
    22 ;;1.1;FILEMAN TRIPLE STORE;;
    33 ;
     
    123123 ;  PARAM("FULLICN")=INTEGRATION CONTROL NUMBER AND CHECKSUM
    124124 ;
    125  ;TODO: CHECK THAT PATCH DG*5.3*800 is installed for routine VAFCPTAD to add pt.
    126  ;I '$$PATCH^XPDUTL("DG*5.3*800") D EN^DDIOL("You need to have patch DG*5.3*800 to add patients")
     125 ;CHECK THAT PATCH DG*5.3*800 is installed for routine VAFCPTAD to add pt.
     126 I '$$PATCH^XPDUTL("DG*5.3*800") D EN^DDIOL("You need to have patch DG*5.3*800 to add patients") S $EC=",U1,"
    127127 ;
    128128 ; Crash if required params aren't present
     
    183183 ;
    184184PROBLEMS(G,DFN) ; Private EP; Process Problems for a patient graph
     185 ; Delete existing problems if they are present
     186 ; PS: This is a risky operation if somebody points to the original data.
     187 ; PS2: Another idea is just to quit here if Patient has problems already.
     188 I $D(^AUPNPROB("AC",DFN)) DO  ; Patient already has problems.
     189 . N DIK S DIK="^AUPNPROB("  ; Global to kill
     190 . N DA F DA=0:0 S DA=$O(^AUPNPROB("AC",DFN,DA)) Q:'DA  D ^DIK  ; Kill each entry
     191 ;
     192 ; Process incoming problems
    185193 N RETURN ; Local return variable. I don't expect a patient to have more than 50 problems.
    186194 D ONETYPE^C0XGET3($NA(RETURN),G,"sp:Problem") ; Get all problems for patient
     
    195203 . N LEXS ; Return from Lex call
    196204 . D EN^LEXCODE(CODE) ; Lex API
    197  . ;S EXPIEN=$P(LEXS("SCT",1),U) ; First match on Snomed CT. Crash if isn't present.
     205 . S EXPIEN=$P(LEXS("SCT",1),U) ; First match on Snomed CT. Crash if isn't present.
    198206 . ;
    199207 . N STARTDT S STARTDT=$$GSPO1^C0XGET3(G,RETURN(S),"sp:startDate") ; Start Date
    200208 . N X,Y,%DT S X=STARTDT D ^%DT S STARTDT=Y ; Convert STARTDT to internal format
    201  . ZWRITE CODE
    202  . ZWRITE TEXT
    203  . ZWRITE STARTDT
     209 . D PROBADD(DFN,CODE,TEXT,EXPIEN,STARTDT) ; Add problem to VISTA.
    204210 QUIT
    205211PROBADD(DFN,CODE,TEXT,EXPIEN,STARTDT) ; Add a problem to a patient's record.
    206         ; Input - DFN from Symbol Table
    207         ;
    208         ; Output - ISIRC [return code]
    209         ;          ISIRESUL(0)=1
    210         ;          ISIRESUL(1)=IEN
     212        ; Input
     213        ; DFN - you know what that is
     214        ; CODE - SNOMED code; not used alas; for the future.
     215        ; TEXT - SNOMED Text
     216        ; EXPIEN - IEN of Snomed CT Expression in the Expressions File (757.01)
     217        ; STARTDT - Internal Date of when the problem was first noted.
     218        ;
     219        ; Output:
     220        ; NONE
     221        ; Crash expectd if code fails to add a problem.
     222        ;
     223        ;
    211224        ;
    212225        N GMPDFN S GMPDFN=DFN ; patient dfn
     
    217230        S C0XFDA(200,"?+1,",1)="USP" ; Initials
    218231        S C0XFDA(200,"?+1,",28)="SMART" ; Mail Code
    219         D UPDATE^DIE("E",$NA(C0XFDA),$NA(C0XIEN),$NA(C0XERR))
     232        ;
     233        N DIC S DIC(0)="" ; An XREF in File 200 requires this.
     234        D UPDATE^DIE("E",$NA(C0XFDA),$NA(C0XIEN),$NA(C0XERR)) ; Typical UPDATE
    220235        N GMPPROV S GMPPROV=C0XIEN(1) ;Provider IEN
    221236        ;
    222         N GMPVAMC S GMPVAMC=$$KSP^XUPARAM("INST")
    223         ;
    224         N GMPFLD
    225         S GMPFLD(".01")=ISIMISC("ICDIEN") ;Code IEN
    226         S GMPFLD(".03")=0 ;hard set
    227         S GMPFLD(".05")="^"_ISIMISC("EXPNM") ;Expression text
     237        N GMPVAMC S GMPVAMC=$$KSP^XUPARAM("INST") ; Problem Institution. Ideally, the external one. But we are taking a shortcut here.
     238        ;
     239        N GMPFLD ; Input array
     240        S GMPFLD(".01")="" ;Code IEN - API will assign 799.9.
     241        ; .02 field (Patient IEN) not used. Pass variable GMPDFN instead.
     242        S GMPFLD(".03")=DT ;Date Last Modified
     243        S GMPFLD(".05")="^"_TEXT ;Expression text
    228244        S GMPFLD(".08")=DT ; today's date (entry?)
    229         S GMPFLD(".12")=ISIMISC("STATUS") ;Active/Inactive
    230         S GMPFLD(".13")=ISIMISC("ONSET") ;Onset date
    231         S GMPFLD("1.01")=ISIMISC("EXPIEN")_"^"_ISIMISC("EXPNM") ;^LEX(757.01 ien,descip
    232         S GMPFLD("1.03")=ISIMISC("PROVIDER") ;Entered by
    233         S GMPFLD("1.04")=ISIMISC("PROVIDER") ;Recording provider
    234         S GMPFLD("1.05")=ISIMISC("PROVIDER") ;Responsible provider
    235         S GMPFLD("1.06")=1018 ;MEDICAL SERVICE (#49)
     245        S GMPFLD(".12")="A" ;Active/Inactive
     246        S GMPFLD(".13")=STARTDT ;Onset date
     247        S GMPFLD("1.01")=EXPIEN_U_TEXT ;^LEX(757.01 ien,descip
     248        S GMPFLD("1.03")=GMPPROV ;Entered by
     249        S GMPFLD("1.04")=GMPPROV ;Recording provider
     250        S GMPFLD("1.05")=GMPPROV ;Responsible provider
     251        S GMPFLD("1.06")="" ; SERVICE FILE - LEAVE BLANK(#49)
    236252        S GMPFLD("1.07")="" ; Date resolved
    237253        S GMPFLD("1.08")="" ; Clinic (#44)
     
    241257        S GMPFLD("1.12")=0 ;Ionizing radiation exposure
    242258        S GMPFLD("1.13")=0 ;Persian Gulf exposure
    243         S GMPFLD("1.14")=ISIMISC("TYPE") ;Accute/Chronic (A,C)
     259        S GMPFLD("1.14")="C" ;Accute/Chronic (A,C)
    244260        S GMPFLD("1.15")="" ;Head/neck cancer
    245261        S GMPFLD("1.16")="" ;Military sexual trauma
    246         S GMPFLD("10",0)=0 ;auto set ""
    247         D NEW^GMPLSAVE
    248         I '$D(DA) Q "-1^Error creating problem"
    249         S ISIRESUL(0)=1
    250         S ISIRESUL(1)=DA
    251         Q 1
    252  ; Example FDA
    253  ; SAM(9000011,"88,",.01)="410.90"
    254  ; SAM(9000011,"88,",.02)="RODGERS,RONALD"
    255  ; SAM(9000011,"88,",.03)="JUN 13,2011"
    256  ; SAM(9000011,"88,",.04)=""
    257  ; SAM(9000011,"88,",.05)="Acute myocardial infarction, unspecified site, episode of care unspecified"
    258  ; SAM(9000011,"88,",.06)="VOE OFFICE INSTITUTION"
    259  ; SAM(9000011,"88,",.07)=2
    260  ; SAM(9000011,"88,",.08)="MAY 29,2011"
    261  ; SAM(9000011,"88,",.12)="INACTIVE"
    262  ; SAM(9000011,"88,",.13)="MAY 29,2011"
    263  ; SAM(9000011,"88,",1.01)="Acute myocardial infarction, unspecified site, episode of care unspecified"
    264  ; SAM(9000011,"88,",1.02)="PERMANENT"
    265  ; SAM(9000011,"88,",1.03)="COORDINATOR,ONE"
    266  ; SAM(9000011,"88,",1.04)="COORDINATOR,ONE"
    267  ; SAM(9000011,"88,",1.05)="COORDINATOR,ONE"
    268  ; SAM(9000011,"88,",1.06)="MEDICINE"
    269  ; SAM(9000011,"88,",1.07)="JUN 13,2011"
    270  ; SAM(9000011,"88,",1.08)=""
    271  ; SAM(9000011,"88,",1.09)="MAY 29,2011"
    272  ; SAM(9000011,"88,",1.1)="NO"
    273  ; SAM(9000011,"88,",1.11)="NO"
    274  ; SAM(9000011,"88,",1.12)="NO"
    275  ; SAM(9000011,"88,",1.13)="NO"
    276  ; SAM(9000011,"88,",1.14)="CHRONIC"
    277  ; SAM(9000011,"88,",1.15)=""
    278  ; SAM(9000011,"88,",1.16)=""
    279  ; SAM(9000011,"88,",1.17)=""
    280  ; SAM(9000011,"88,",1.18)=""
     262        S GMPFLD("10",0)=0 ; Note. No note.
     263        ;
     264        ;
     265        N DA ; Return variable
     266        D NEW^GMPLSAVE ; API call
     267        I '$D(DA) S $EC=",U1," ; Fail here if API fails.
     268        QUIT
Note: See TracChangeset for help on using the changeset viewer.