Proc for send out multiple messages.

Homepage Clovertech Forums Read Only Archives Cloverleaf Tcl Library Proc for send out multiple messages.

  • Creator
    Topic
  • #54462
    Robert Denny
    Participant

    Does any one have an example of scripts for sending out a repeating group into one message?

    I have an Material Management file with mulitple cd1, cd2 and cd3 segments.

    I need to build each set of 123 segment into an hl7 message and send one message for each group.

    If I can see proc that does a similar task I should be able to apply the logic to my script.

Viewing 0 reply threads
  • Author
    Replies
    • #81591
      Rehman Masood
      Participant

      Here is one I wrote to convert to the CD1/CD2/CD3 stuff (I think its lawson ic527 file) to hl7.

      Code:


                     set fileptr [open $localfilepathandname]
                     set mFS |
                     set mCS ^
                     set mRS ~
                     set mEC \
                     set mSS &
                     set msgNumber 0
                     while { [gets $fileptr line] >= 0 } {
                         set fieldList [split $line $mFS]
                         set segName [lindex $fieldList 0]
                         switch -exact — $segName {
                             MSH {
                                 set sequenceNumber [lindex $fieldList 12]
                             }
                             MFI {
                                 set masterFileIdentifier [lindex $fieldList 1]
                                 set enteredDateTime [lindex $fieldList 3]
                             }
                             CD1 {
                                 set productCategory [lindex $fieldList 7]
                                 if { $productCategory ne “IMPL” } {
                                     set itemCategory SUPPLY
                                 }
                             }
                             CD2 {
                                 set itemInfo [lindex $fieldList 2]
                                 set itemId [string trimleft [lindex [split $itemInfo $mCS] 0] 0]
                                 puts “itemId $itemId”
                                 set itemName [string trim [lindex [split $itemInfo $mCS] 1]]
                                 set itemIdType SUPID
                                 set packageUnitOfMeasure [lindex $fieldList 4]
                                 set packageQuantity [lindex $fieldList 5]
                                 set manufacturerInfo [lindex $fieldList 12]
                                 set manufacturerId [string trim [lindex [split $manufacturerInfo $mCS] 0]]
                                 set manufacturerName [string trim [lindex [split $manufacturerInfo $mCS] 2]]
                                 set manufacturerCatalog [string trim [lindex $fieldList 13]]
                                 set supplierId [string trim [lindex $fieldList 14]]
                                 set supplierCatalog [string trim [lindex $fieldList 15]]
                             }
                             CD3 {
                                 set itemStatus [lindex $fieldList 30]
                                 set patientChargeable [lindex $fieldList 19]
                                 set patientPrice [string trimleft [lindex $fieldList 25] 0]
                                 set chargeCDM [lindex $fieldList 26]
                                 set out {}
                                 incr msgNumber
                                 set fields [list MSH$mFS$mCS$mRS$mEC$mSS IC527 LAWSON “” “” $dateTime “” [join [list “MFN” “M16″] $mCS] $dateTime $processingId 2.5 “${sequenceNumber}:${msgNumber}”]
                                 lappend out [join $fields $mFS]
                                 set fields [list MFI $masterFileIdentifier “” $enteredDateTime]
                                 lappend out [join $fields $mFS]
                                 set fields [list MFE “” “” $enteredDateTime]
                                 lappend out [join $fields $mFS]
                                 set fields [list ITM [join [list $itemId $itemName $itemIdType] $mCS] $itemStatus SUPPLY $itemCategory “” [join [list $manufacturerId $manufacturerName] $mCS] $manufacturerCatalog “” $patientChargeable $chargeCDM $patientPrice ]
                                 lappend out [join $fields $mFS]
                                 set fields [list VND “” $supplierId $supplierCatalog]
                                 lappend out [join $fields $mFS]
                                 set fields [list PKG “” $packageUnitOfMeasure “” $packageQuantity]
                                 lappend out [join $fields $mFS]
                                 set fields [list IVT 1 BHMC]
                                 lappend out [join $fields $mFS]
                                 set fields [list ZBL $patientPrice]
                                 lappend out [join $fields $mFS]
                                 set msg [join $out r]
                                 set mh [msgcreate]
                                 msgset $mh “$msgr”
                                 lappend dispList “CONTINUE $mh”
                             }
                         }
                     }
                     close $fileptr

Viewing 0 reply threads
  • The forum ‘Tcl Library’ is closed to new topics and replies.

Forum Statistics

Registered Users
5,129
Forums
28
Topics
9,301
Replies
34,448
Topic Tags
288
Empty Topic Tags
10