Background technology
In medicine and hygiene fields, in solving the computer application software integration of difference in functionality and technology, network technology is one and is full of vitality, and the high solution of cost-effectiveness comparison. But the development of various medical information systems is to comply with market structure, instead of by certain flogic system approach, therefore they have characteristic separately.
Such as, the different information systems of hospital based on the needs of business department build separately, different information systems is that the system of different manufacturers based on various criterion or data format structure produced a serious obstacle to data interaction each other.
HL7 (HealthLevel7) is standardized health information host-host protocol, is the agreement of electric transmission between medical field different application. HL7 has collected different vendor and has been used for the reference format at interface between application software, and each medical institutions of permission between heterogeneous system, carry out data interaction by it, realizes minimizing and the optimization of information exchange of incompatibility between each system.
Because exchanges data amount between each medical information system is very large, and real-time and accuracy requirement to exchanges data are higher, for adopting HL7 to carry out each medical information system of transfer of data, how to solve the problem such as delay, loss of transfer of data, become one of technical barrier of current urgent need solution.
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 ensure the accuracy of HL7 transmission of messages and have effect, 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, each HL7 message that needs transfer is write to message folder; The time order and function order that writes message folder according to each HL7 message, writes index file by filename corresponding each HL7 message 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 to forward process.
In a preferred embodiment, in message folder, create title and be respectively five sub-folders of InBound, OutBound, Error, Resend and Backup; By all HL7 message that need to be sent to external system, before external system, be all written to OutBound sub-folder being sent to, by all HL7 message receiving from external system, before being transferred to corresponding recipient, be all written to InBound sub-folder.
In a preferred embodiment, give corresponding recipient by the HL7 message transfers in InBound sub-folder, if successfully shift, this HL7 message is just transferred to Backup sub-folder from InBound sub-folder, otherwise this HL7 message is just transferred to Error sub-folder from InBound sub-folder.
In a preferred embodiment, by the HL7 message in OutBound sub-folder to outside system forwards, if forward successfully, this HL7 message is just transferred to Backup sub-folder from OutBound sub-folder, wait for transmission again otherwise this HL7 message is just transferred to Resend sub-folder from OutBound sub-folder.
In a preferred embodiment, HL7 message in Resend sub-folder is sent again, if sent successfully, this HL7 message is transferred to Backup sub-folder from Resend sub-folder, otherwise just stay Resend sub-folder and wait for transmission again, if the HL7 message in Resend sub-folder repeatedly sends after failure, just this HL7 message is transferred to Error sub-folder from Resend sub-folder.
In a preferred embodiment, in the time that the number of filename in index file is 0, delete index file.
In addition, the present invention also discloses a kind of HL7 message handling system based on file management, and it comprises: for the message folder of transfer HL7 message; For the HL7 message receiving from external system the message sink service module that writes message folder; Send service module for the message that all HL7 message that need to be sent to external system is forwarded; For write the time order and function order of message folder according to each HL7 message, filename corresponding each HL7 message is write to 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, HL7 message classification to be processed need is written in sub-folder corresponding in message folder, by the judgement to HL7 information receiving and transmitting result, HL7 message file after treatment 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 to time-sequencing successively, the filename of HL7 message after sequence is written in index file, according to the HL7 message of list in time order and function sequential processes index file, can avoid the sequence that repeats to HL7 message, thereby 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 HL7 message handling task.
Detailed description of the invention
According to the regulation of HL7 standard, message (Message) is the base unit of exchanges data. The mode that HL7 transmits by message realizes exchanges data and 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 will exchange, but not all message is all imformosome; Key-course is intermediate layer packaging, comprises trigger event, event, position and responsibility etc.; Transport layer is outermost layer packaging, is used for that administrative messag is replied, decision etc.
The general principle of carrying out exchanges data based on HL7 standard is: first the application data of different-format converts the standard data format that each system can be identified---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, in application layer, that replys and carries out certain validation verification receiving system accordingly, 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, HL7 message handling system comprises: for the message folder of transfer HL7 message; For the file-management services module of administrative messag file; For the HL7 message transmitting from receiving other medical information systems, kept in the message sink service module to message folder; Send service module for the message that the HL7 message of message folder is sent to other medical information systems.
The HL7 message that each medical information system need to exchange, is all sent to message folder, then sends service module by message each HL7 message is sent to goal systems; The HL7 message that message sink service module receives, deposits in after message folder, sends to corresponding medical information system under the control of file-management services module.
By receive service reception to file and need send service send file be all pooled in message folder, by file-management services module, message folder is managed the classification processing of the sending order of processing messages and message. Therefore, the processing of file-management services module to a large amount of mutual HL7 message in message folder, has directly determined the efficiency of transmission of HL7 message and the accuracy of transmission.
For fear of the entanglement of loss and the information receiving and transmitting order of HL7 message, ensure the accuracy of the transmission of HL7 message, the present invention has formulated the file processing method of HL7 message. In message folder, create five sub-folders that title is respectively InBound, OutBound, Error, Resend and Backup. All HL7 message that need to send service module and be sent to by message external system (certain one or more medical information system), before external system, be all written to OutBound sub-folder being sent to, all HL7 message being received from external system by message sink service module, is all written to InBound sub-folder before being transferred to corresponding recipient (certain medical information system).
Shown in Fig. 2 and Fig. 3, management service is in charge of these five sub-folders and the operation to these five sub-folder Chinese parts: if the HL7 message in InBound sub-folder is successfully transferred to corresponding medical information system, this HL7 message is just transferred to Backup sub-folder from InBound sub-folder, otherwise just put into Error sub-folder; If the HL7 message in OutBound sub-folder sends service module to outside system forwards success by message, this HL7 message is just transferred to Backup sub-folder from OutBound sub-folder, otherwise can revise and put into Resend sub-folder after the filename of HL7 message and wait for again and sending, can avoid like this that error message file repeats to send, holding time; If the HL7 message in Resend sub-folder sends successfully, also this HL7 message is transferred to Backup sub-folder from Resend sub-folder, otherwise just stay Resend sub-folder and wait for transmission again, repeatedly send (such as, transmission times > 5) failure after, just this HL7 message is transferred to Error sub-folder from Resend sub-folder.
The time delay existing when effectively improving HL7 transmission of messages, improves efficiency of transmission, and we have designed the sort method of HL7 message file. In the time 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 sort according to time order and function order to a large amount of HL7 message in message folder, then process HL7 message according to the sequencing of time, can effectively prevent like this accumulation and the transmission delay of HL7 message, avoid HL7 information drop-out.
For fear of repeating sequence, we analyze the HL7 message in message folder, in the time judging the HL7 message of accumulating in message folder and reach some n, we are just written to index file the filename of n HL7 message according to the sequencing of their write time. In the time that HL7 message file number pending in index file is 0, delete index file; In the time that index file exists, the HL7 message newly receiving in message folder, according to the time that writes message folder, is written to respectively to the afterbody of index file. Need to process time, by write time sequencing, from the head of index file to afterbody at every turn, obtain successively each filename, carry out successively forward process by flow process shown in Fig. 2 and Fig. 3, repeat the time of sorting by effectively reducing file 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 of n HL7 message file sequence), 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.
(1)
Adopt said method, only need to carry out a minor sort to initial n HL7 message, in message folder, the follow-up HL7 message writing is written to the afterbody (rearmost end) of file list of file names in index file successively, and finish dealing with time of this n+m message of management service is T2.
(2)
From the contrast of above two numerical value, adopt after 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 foregoing is only preferred embodiment of the present invention, not in order to limit the present invention, all any amendments of doing within the spirit and principles in the present invention, be equal to and replace and improvement etc., within all should being included in protection scope of the present invention.