HL7 message treatment method and system based on file management
Technical field
The present invention relates to a kind of data transmission technology, especially relate to a kind of in medical information system the HL7 message treatment method based on file management, and corresponding HL7 message handling system.
Background technology
In medicine and hygiene fields, in the computer application software integration that solves difference in functionality and technology, network technology is one and is full of vitality, and the high solution of cost-effectiveness comparison.Yet the development of various medical information systems is to comply with market structure, rather than by certain logic system approach, so they have characteristic separately.
Such as the different information systems that, hospital builds based on the needs of business department separately, the different information systems system that to be different manufacturers build based on various criterion or data format has produced a serious obstacle to data interaction each other.
HL7 (Health Level 7) is standardized health information host-host protocol, is the agreement of electric transmission between the medical field different application.HL7 has collected different vendor and has been used for the reference format at interface between application software, and it will allow each medical institutions to carry out data interaction between heterogeneous system, realizes the optimization with information exchange of minimizing of incompatibility between each system.
Because exchanges data amount between each medical information system is very large, and real-time and accuracy requirement to the data exchange are higher, for adopting HL7 to carry out each medical information system of transfer of data, how to solve the problems such as delay, loss of transfer of data, become one of technical barrier that current urgent need solves.
Summary of the invention
The present invention propose a kind of in medical information system the HL7 message treatment method based on file management, and corresponding HL7 message handling system, adopt file data interaction and index file time-sequencing guarantee the accuracy of HL7 transmission of messages and effect is arranged, avoid loss and the transmission delay of message.
The present invention adopts following technical scheme to realize: a kind of HL7 message treatment method based on file management, and it comprises step: set up a message folder, will need each HL7 message of transfer to write message folder; Write the time order and function order of message folder according to each HL7 message, the filename that each HL7 message is corresponding writes index file successively from head to the afterbody of index file; From the filename of index file head, successively each HL7 message in message folder is carried out forward process.
In a preferred embodiment, create five sub-folders that title is respectively InBound, OutBound, Error, Resend and Backup in message folder; All need to be sent to the HL7 message of external system, all be written to the OutBound sub-folder before being sent to external system, with all HL7 message that receives from external system, all be written to the InBound sub-folder before being transferred to corresponding recipient.
In a preferred embodiment, give corresponding recipient with the HL7 message transfers in the InBound sub-folder, if successfully shift, this HL7 message is just transferred to the Backup sub-folder from the InBound sub-folder, otherwise this HL7 message is just transferred to the Error sub-folder from the InBound sub-folder.
In a preferred embodiment, with the HL7 message in the OutBound sub-folder to outside system forwards, if forward successfully, this HL7 message is just transferred to the Backup sub-folder from the OutBound sub-folder, wait for transmission again otherwise this HL7 message is just transferred to the Resend sub-folder from the OutBound sub-folder.
In a preferred embodiment, HL7 message in the Resend sub-folder is sent again, if send successfully, this HL7 message is transferred to the Backup sub-folder from the Resend sub-folder, otherwise just stay the Resend sub-folder and wait for transmission again, after if the HL7 message in the Resend sub-folder repeatedly sends failure, just this HL7 message is transferred to the Error sub-folder from the Resend sub-folder.
In a preferred embodiment, when the number of index file File name is 0, the deletion index file.
In addition, the present invention also discloses a kind of HL7 message handling system based on file management, and it comprises: the message folder that is used for transfer HL7 message; Be used for the HL7 message that receives from external system and the message sink service module that writes message folder; The message that forwards for the HL7 message that all need to be sent to external system sends service module; Be used for writing according to each HL7 message the time order and function order of message folder, the filename that each HL7 message is corresponding writes index file successively from head to the afterbody of index file, and from the filename of index file head, successively each HL7 message in message folder is carried out the file-management services module of forward process.
Compared with prior art, the present invention has following beneficial effect:
The present invention adopts to process HL7 message based on file exchange method and index file ranking method, need HL7 message classification to be processed is written in sub-folder corresponding in message folder, by the judgement to HL7 information receiving and transmitting result, HL7 message file after processing is shifted in these sub-folders, reduce the loss of HL7 message, improve the accuracy of transmission; And employing index file ranking method, the HL7 message of accumulation is in enormous quantities carried out time-sequencing successively, the filename of HL7 message after sequence is written in index file, HL7 message according to list in time order and function sequential processes index file, can avoid the sequence that repeats to HL7 message, thereby the saving computer processing time improves the validity of transmission, avoids network congestion.By theory analysis with facts have proved: the present invention effectively improves accuracy and the validity of HL7 transmission of messages, avoids loss and the transmission delay of HL7 message, can complete efficiently, accurately the HL7 message handling task.
Description of drawings
Fig. 1 is the modular structure schematic diagram of HL7 message handling system;
Fig. 2 is the reception ﹠ disposal schematic flow sheet of HL7 message;
Fig. 3 is the transmission processing schematic flow sheet of HL7 message.
Embodiment
According to the regulation of HL7 standard, message (Message) is the base unit of exchanges data.HL7 realizes that by the mode of message transmission exchanges data is similar to the transmission of network information bag.HL7 message is divided into 3 layers: message body (Content), key-course (Control) and transport layer (Transmission).Wherein, message body is real information load, the data that namely will exchange, but not all message is all imformosome; Key-course is the intermediate layer packing, comprises trigger event, event, position and responsibility etc.; Transport layer is outermost layer packing, is used for that administrative messag is replied, decision etc.
the basic principle of carrying out exchanges data based on the HL7 standard is: at first the application data of different-format converts the standard data format that each system can identify---message to according to the syntax rule of HL7 standard, then according to certain network transmission protocol (as TCP/IP, FTP etc.) or the mode such as E-mail transmit the message to receiving system, that replys and carries out certain validation verification receiving system accordingly in application layer, message sends to application program after by validation verification, resolve according to the syntax rule of HL7 standard again, message conversion is application data the most at last.
As shown in Figure 1, the HL7 message handling system comprises: the message folder that is used for transfer HL7 message; The file-management services module that is used for the administrative messag file; Be used for from receiving the HL7 message of other medical information systems transmission, with its temporary message sink service module to message folder; Be used for sending to the message of other medical information systems to send service module the HL7 message of message folder.
The HL7 message that each medical information system need to exchange all is sent to message folder, then sends service module by message each HL7 message is sent to goal systems; The HL7 message that the message sink service module receives after depositing message folder in, sends to corresponding medical information system under the control of file-management services module.
By receive service reception to file and the file that needs the service that sends to send all be pooled in message folder, by the file-management services module, message folder is managed, the sending order of processing messages and the classification of message are processed.Therefore, the file-management services module has directly determined the efficiency of transmission of HL7 message and the accuracy of transmission to the processing of mutual HL7 message in a large number in message folder.
For fear of the entanglement of loss and the information receiving and transmitting order of HL7 message, guarantee the accuracy of the transmission of HL7 message, the present invention has formulated the file processing method of HL7 message.Create five sub-folders that title is respectively InBound, OutBound, Error, Resend and Backup in message folder.All need to send the HL7 message that service module is sent to external system (certain one or more medical information system) by message, all be written to the OutBound sub-folder before being sent to external system, the HL7 message that all are received from external system by the message sink service module all is written to the InBound sub-folder before the recipient's (certain medical information system) who is transferred to correspondence.
In conjunction with Fig. 2 and shown in Figure 3, management service is in charge of these five sub-folders and to the operation of these five sub-folder Files: if the HL7 message in the InBound sub-folder successfully is transferred to corresponding medical information system, this HL7 message is just transferred to the Backup sub-folder from the InBound sub-folder, otherwise just put into the Error sub-folder; If the HL7 message in the OutBound sub-folder sends service module to outside system forwards success by message, this HL7 message is just transferred to the Backup sub-folder from the OutBound sub-folder, otherwise can revise and put into the Resend sub-folder after the filename of HL7 message and wait for again and sending, can avoid like this that the error message file repeats to send, holding time; If the HL7 message in the Resend sub-folder sends successfully, also this HL7 message is transferred to the Backup sub-folder from the Resend sub-folder, otherwise just stay the Resend sub-folder and wait for transmission again, repeatedly send (such as, transmission times〉5) failure after, just this HL7 message is transferred to the Error sub-folder from the Resend sub-folder.
The time-delay that exists when effectively improving the HL7 transmission of messages improves efficiency of transmission, and we have designed the sort method of HL7 message file.When processing large batch of mutual HL7 message, to process HL7 message according to the write sequence of HL7 message in message folder, so just must a large amount of HL7 message in message folder be sorted according to the time order and function order, then process HL7 message according to the sequencing of time, can effectively prevent accumulation and the transmission delay of HL7 message like this, avoid the HL7 information drop-out.
For fear of repeating sequence, we analyze the HL7 message in message folder, when the HL7 message of accumulating in judging message folder reached some n, we just were written to index file to the filename of n HL7 message according to the sequencing of their write time.When HL7 message file number pending in index file is 0, delete index file; When index file exists, the HL7 message that newly receives in message folder according to the time that writes message folder, is written to respectively the afterbody of index file.When at every turn needing to process, by the write time sequencing, from the head of index file to afterbody, obtain successively each filename, carry out successively forward process by Fig. 2 and flow process shown in Figure 3, will effectively reduce the time that file repeats to sort like this, improve greatly efficiency of transmission.
Suppose original n HL7 message in message folder, within the unit interval, receive again m HL7 message, the time that computer is carried out single operation is t, and operating system is O(nlogn according to the time to the time complexity that n HL7 message file sorts), the each file number of processing of management service is k, processing k needed time of HL7 message is t1, within the unit interval, adopt according to time sequence algorithm, finish dealing with time of this (n+m) individual HL7 message of management service is T1.
Adopt said method, only need to carry out a minor sort to initial n HL7 message, in message folder, the follow-up HL7 message that writes is written to the afterbody (rearmost end) of index file File list of file names successively, and finish dealing with time of this n+m message of management service is T2.
From the contrast of above two numerical value as seen, after adopting said method, the time of processing HL7 message significantly reduces, and like this with regard to the accumulation of avoidable HL7 message, thereby effectively improves the transmission delay of HL7 message, improves the validity of transmission of messages.
To sum up, the present invention effectively improves accuracy and the validity of HL7 transmission of messages, avoids loss and the transmission delay of HL7 message.
The above is only preferred embodiment of the present invention, not in order to limiting the present invention, all any modifications of doing within the spirit and principles in the present invention, is equal to and replaces and improvement etc., within all should being included in protection scope of the present invention.