Method and device for constructing patient master index based on dynamic multithreading
By introducing dynamic multithreaded computing and cache pool segmentation technology in the EMPI system, the problems of traditional single-threaded processing are solved, and efficient, stable and scalable patient main index construction is achieved, which improves medical data processing Speed and system resource utilization.
Patent Information
- Application Number
- CN202411170007.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2025-01-03
- Estimated Expiration
- 2044-08-26
AI Technical Summary
The EMPI system in traditional single-threaded processing mode is inefficient, has high failure rate and limited scalability, which cannot meet the needs of medical information big data processing. The caching technology has a significant problem of falling hit rate and consistency management under the scale of big data.
Using a patient-main index construction method based on dynamic multithreading, combined with the cache mechanism, through dynamic multithreading calculation and cache pool segmentation, the patient factor weight and threshold range are optimized, and parallel calculations are used for cache missed data. Process to ensure data consistency and resource utilization.
It significantly improves the processing speed and system response capabilities of massive patient records, reduces the risk of failure, ensures the stability and consistency of data processing, enhances the scalability and adaptability of the system, and avoids resource waste and performance bottlenecks.
Smart Images

Figure CN118673026B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of medical information big data, and specifically relates to a method and device for constructing a patient master index based on dynamic multi-threading. Background Art
[0002] In the field of medical information big data, building an efficient and stable Enterprise Master Patient Index (EMPI) system is a major issue. As a core component of the medical information system, the core mission of the EMPI system is to ensure that the identity information of each patient is managed uniquely, accurately and consistently in a complex medical network, which is of great value in optimizing the patient diagnosis and treatment process, reducing medical errors and improving the utilization of medical resources.
[0003] As the process of medical informatization accelerates, the traditional EMPI system that relies on single-threaded processing logic mainly focuses on performing data retrieval, update, and addition operations one by one. Its limitations are becoming increasingly apparent:
[0004] (1) Low efficiency: In the single-thread processing mode, the system can only process data one by one in sequence, and cannot fully utilize the parallel computing capabilities of modern multi-core processors. In the face of massive amounts of data, this serial processing method leads to a serious lag in processing speed, which cannot meet the needs of medical institutions for real-time and efficient data processing, thus affecting the quality and efficiency of medical services.
[0005] (2) Increased failure rate: In a complex data processing link, any single point of failure or delay may trigger a chain reaction, ultimately leading to the interruption of the entire processing flow, seriously affecting the continuity and reliability of data processing, and may have an adverse impact on the patient's diagnosis and treatment process;
[0006] (3) Limited scalability: As the amount of medical data continues to grow, it is difficult for a single-threaded system to achieve a significant increase in processing power through simple capacity expansion. This not only increases the maintenance cost of the system, but also limits the system's potential to cope with larger-scale data processing in the future.
[0007] In order to alleviate the pressure brought by single-threaded processing, cache technology is widely used in medical information systems. By caching frequently accessed data in memory, cache technology can significantly reduce the number of accesses to the database, reduce the database load, and thus improve the data processing speed. For EMPI systems, the application of cache technology helps to speed up the retrieval of patient information and improve the responsiveness of the system. However, as the scale of data increases, the cache hit rate gradually decreases, resulting in a weakened cache effect. In addition, cache management also brings new challenges. Memory resources are limited, and improper cache strategies may lead to out of memory (OOM) problems, which in turn affects the stability and reliability of the system. At the same time, the consistency and update strategy of cached data are also important issues that need to be considered. In a distributed system, multiple nodes may access and modify cached data at the same time. If there is a lack of an effective synchronization mechanism, data inconsistency may occur.
[0008] Therefore, faced with the limitations of single-threaded processing and caching technology, the field of medical information big data needs to explore more efficient, stable and scalable patient master index construction solutions. Summary of the invention
[0009] In view of the above, the purpose of the present invention is to provide a method and device for constructing a patient master index based on dynamic multi-threading, which can realize efficient, stable and scalable patient master index construction by combining dynamic multi-threading and caching mechanism, thereby further optimizing resource allocation and improving the quality of medical services.
[0010] In order to achieve the above-mentioned invention object, the technical solution provided by the present invention is as follows:
[0011] An embodiment of the present invention provides a method for constructing a patient master index based on dynamic multithreading, comprising the following steps:
[0012] The configuration of the enterprise master patient index system includes patient factors, weights of each patient factor, and patient weight threshold ranges, wherein the patient factors include ID card number factor, name factor, date of birth factor, and gender factor;
[0013] Creating a first cache pool for storing identity card number factor information, and creating a second cache pool for storing composite factor information, wherein the composite factor includes a name factor, a date of birth factor, and a gender factor;
[0014] Read patient data from the patient information database, and store the patient data in the first cache pool if the ID card number factor information in the patient data is not in the first cache pool; and store the patient data in the second cache pool if the composite factor information in the patient data is not in the second cache pool; mark the non-duplicate data stored in both the first cache pool and the second cache pool as data that can be processed concurrently;
[0015] For data marked as capable of concurrent processing, dynamic multi-threading is used to construct the primary index calculation. For data not marked as capable of concurrent processing, a single thread is used to construct the primary index calculation. When calculating the primary index, the weight of each patient factor and the patient weight threshold range are used to calculate and generate primary index information for the patient.
[0016] Preferably, each patient factor weight includes:
[0017] Different weight values from large to small are configured for the ID number factor, name factor, date of birth factor and gender factor.
[0018] Preferably, the patient weight threshold range includes:
[0019] Different weight threshold ranges are configured for patient weight threshold ranges representing different patients, similar patients and identical patients, respectively, wherein different patients means that the patient factors of the two patients do not match at all or the sum of the matching patient factor weights is less than the set distinction threshold, similar patients means that the patient factors of the two patients partially match and the sum of the partially matching patient factor weights is greater than or equal to the set distinction threshold but less than the set matching threshold, and identical patients means that the patient factors of the two patients completely match or the sum of the matching patient factor weights is greater than or equal to the set matching threshold.
[0020] Preferably, when reading patient data from the patient information database, the data is read in batches by setting the data size for each data query.
[0021] Preferably, if the ID card number factor information in the patient data is not in the first cache pool, storing it in the first cache pool includes:
[0022] For each piece of patient data, the factor field is read to obtain the ID card number factor information. When it is determined that the ID card number factor information is not empty, the hash code of the ID card number factor information is obtained, and a comparison is made from the cache objects in the first cache pool to see whether there is an identical hash code. If not, the hash code of the ID card number factor information of this piece of patient data is stored in the first cache pool.
[0023] Preferably, if the composite factor information in the patient data is not in the second cache pool, storing it in the second cache pool comprises:
[0024] For each piece of patient data, the factor field is read to obtain the composite factor information including the name factor, the date of birth factor and the gender factor. When it is determined that the composite factor information is not empty, the hash code of the composite factor information is obtained, and a comparison is made from the cache objects in the second cache pool to see whether there is an identical hash code. If not, the hash code of the composite factor information of this piece of patient data is stored in the second cache pool.
[0025] Preferably, the method of using dynamic multithreading to construct a primary index calculation for data marked as being capable of concurrent processing includes:
[0026] For each piece of data marked as capable of concurrent processing, an asynchronous task is submitted to the thread pool. The multi-threaded synchronization counter is used to keep the main thread blocked before all asynchronous tasks are completed. Each asynchronous task is responsible for calling the main index calculation method and generating return results. Whenever an asynchronous task completes the main index calculation, the multi-threaded synchronization counter is used to count down until all asynchronous tasks have completed the main index calculation and the multi-threaded synchronization counter count returns to zero. At this time, the main thread resumes execution, collects all return results, and finally performs data persistence operations.
[0027] Preferably, the method of using a single thread to construct a primary index calculation for data that is not marked as being capable of concurrent processing includes:
[0028] After concurrent computing, for data that is not marked as capable of concurrent processing, a single thread is used to build the main index calculation, collect all returned results, and finally perform data persistence operations.
[0029] Preferably, the calculation of the primary index is performed according to the weight of each patient factor and the patient weight threshold range and the primary index information is generated for the patient, including:
[0030] The patient factor with the highest weight after sorting is used as the query condition to query in the main index database maintained by the enterprise's main patient index system. If a match is found, a detailed factor match is performed. If no match is found using the patient factor with the highest weight, the next patient factor is used as the query condition according to the sorting. If a match is found, a detailed factor match is performed. If no match is found for all patient factors, it is considered that different patients have been found, and new main index information is generated for the current patient. Before each query, it is evaluated whether the sum of the weight of the current patient factor and the weight of all subsequent patient factors has reached the lowest value of the preset weight threshold range for similar patients, i.e., the distinction threshold. If the sum of the weights is greater than or equal to the distinction threshold, it is considered that similar or identical patients exist, and the query is continued. If the sum of the weights is less than the distinction threshold, it is considered that different patients have been found, and the query is terminated and new main index information is generated for the current patient.
[0031] A detailed factor match is performed on the matching results obtained in the preliminary match. The sum of the weights of the patient factors that match the same ID number factor, name factor, date of birth factor and gender factor is calculated cumulatively in turn as the final weight threshold. A judgment is made based on the final weight threshold. If the final weight threshold is greater than or equal to the highest value of the weight threshold range of similar patients, that is, the matching threshold, it is considered that the same patient has been found, and the same primary index information is generated for the current patient; if the final weight threshold is greater than or equal to the distinction threshold but less than the matching threshold, it is considered that a similar patient has been found, and suspected patient information is generated and suspected labels are added to the suspected patient and the suspected patient; if the final weight threshold is less than the distinction threshold, it is considered that different patients have been found, and new primary index information is generated for the current patient.
[0032] To achieve the above-mentioned purpose of the invention, the embodiment of the present invention further provides a patient master index construction device based on dynamic multithreading, comprising: a factor information acquisition module, a cache pool construction module, a duplicate checking module and a master index calculation module;
[0033] The factor information acquisition module is used to configure the enterprise master patient index system including patient factors, weights of each patient factor, and patient weight threshold ranges, wherein the patient factors include ID card number factors, name factors, date of birth factors, and gender factors;
[0034] The buffer pool construction module is used to create a first buffer pool for storing identity card number factor information, and to create a second buffer pool for storing composite factor information, wherein the composite factor includes a name factor, a date of birth factor, and a gender factor;
[0035] The duplicate checking module is used to read patient data from the patient information database, and if the ID card number factor information in the patient data is not in the first cache pool, it is stored in the first cache pool; if the composite factor information in the patient data is not in the second cache pool, it is stored in the second cache pool, and the non-duplicate data stored in both the first cache pool and the second cache pool are marked as being able to start concurrent processing;
[0036] The main index calculation module is used to use dynamic multi-threading to build the main index calculation for data marked as capable of concurrent processing, and to use a single thread to build the main index calculation for data not marked as capable of concurrent processing. When calculating the main index, the calculation is performed based on the weight of each patient factor and the patient weight threshold range, and the main index information is generated for the patient.
[0037] Compared with the prior art, the present invention has the following beneficial effects:
[0038] (1) The present invention overcomes the efficiency bottleneck of single-threaded processing by introducing dynamic multi-threaded computing technology, can effectively utilize the multi-core capabilities of modern computing resources, realize the concurrent execution of massive patient record data processing tasks, greatly improve the system response speed and processing capacity when processing hundreds of millions of patient records, and greatly shorten the medical data construction cycle.
[0039] (2) The present invention reduces dependence on external databases by designing a caching and duplication checking mechanism, and adopts a single-threaded meticulous processing strategy for sensitive data sets containing potential duplicate records, thereby avoiding data inconsistencies and logical conflicts that may be caused by concurrent operations, reducing the risk of single point failures in the processing link, ensuring the continuity of the data processing process and the consistency of the results, ensuring the integrity of each patient's information data to the highest extent, and enhancing the stability and continuity of data processing.
[0040] (3) The present invention can dynamically adjust the thread pool size according to actual hardware resources by dynamically adjusting the number of threads and the cache strategy, which is easy to adapt to data processing requirements of different scales, maximize the use of system resources, avoid resource waste and performance bottlenecks, ensure that the system can run efficiently under various circumstances, and improve the scalability and adaptability of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0042] Figure 1 It is a flowchart of a method for constructing a patient primary index based on dynamic multithreading provided by an embodiment of the present invention;
[0043] Figure 2 is a schematic diagram of patient factor weight configuration provided by an embodiment of the present invention;
[0044] Figure 3 is a schematic diagram of a patient weight threshold range configuration provided by an embodiment of the present invention;
[0045] Figure 4 It is a structural schematic diagram of a patient master index construction device based on dynamic multithreading provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0046] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific implementation methods described herein are only used to explain the present invention and do not limit the scope of protection of the present invention.
[0047] The inventive concept of the present invention is: in view of the key problems such as low efficiency, high fault sensitivity and limited scalability faced by the prior art in building an enterprise master patient index (EMPI) system, the embodiment of the present invention provides a method and device for building a patient master index based on dynamic multi-threading, by first segmenting each piece of data according to the patient factor weight information pre-configured by the EMPI system, in this process, the important factors are stored in the cache, when the subsequent data is processed for factor splitting, the system preferentially retrieves the relevant factor data from the cache quickly, and uses the fast response characteristics of the cache to realize duplicate checking and preliminary filtering, which greatly reduces the direct access to the database, thereby significantly improving the efficiency of data processing. After completing the preliminary data processing, the system will divide this batch of data into two parts, namely, a completely non-repetitive patient information set and a patient information set that may have duplicates. For the completely non-repetitive patient information set, the Java ExecutorService framework is used to perform concurrent processing of the master index construction task, accelerate the calculation process of the master index, and adopt a single-threaded processing method for patients who may have duplicates, so as to ensure that the highest data accuracy, integrity and consistency can be maintained for such sensitive data.
[0048] Figure 1 FIG. 1 is a flow chart of a method for constructing a patient master index based on dynamic multithreading provided by an embodiment of the present invention. Figure 1 As shown, the embodiment provides a method for constructing a patient master index based on dynamic multithreading, comprising the following steps:
[0049] S1. The enterprise master patient index system configuration includes patient factors, weights of each patient factor, and patient weight threshold ranges, wherein patient factors include ID number factor, name factor, date of birth factor, and gender factor.
[0050] In the embodiment, a Java application is started, an AppMain main entry is created to implement the ApplicationRunner (application startup initialization interface provided by Spring) class, a run method is implemented to perform application configuration initialization steps, and patient factor weight information pre-configured in the EMPI system database is read.
[0051] S1.1. Use the JDBC (Java Database Connectivity) program to execute select * from empi_factor_weight (patient factor weight reading instruction) to read the EMPI database to obtain the patient factor weight configuration information, including the ID card number factor, name factor, date of birth factor and gender factor, as well as the weight of each patient factor, such as Figure 2 As shown, different weight values from large to small are configured for ID_CRD_NO (ID number factor), PTT_NM (name factor), BTH_DT (date of birth factor) and GDR_CD (gender factor), which are 80, 50, 25 and 5 respectively.
[0052] S1.2, use the JDBC program to execute select * from empi_weight_range (patient weight range threshold reading instruction) to read the EMPI database and load the patient weight threshold range configuration, such as Figure 3 As shown, different weight threshold ranges are configured for the patient weight threshold ranges representing different patients, similar patients and identical patients, which are 0-60, 60-80 and 80-100, respectively. Different patients means that the patient factors of the two patients are completely unmatched or the sum of the matching patient factor weights is less than the set distinction threshold (i.e., 60); similar patients means that the patient factors of the two patients are partially matched and the sum of the partially matched patient factor weights is greater than or equal to the set distinction threshold but less than the set matching threshold (i.e., 80); identical patients means that the patient factors of the two patients are completely matched or the sum of the matching patient factor weights is greater than or equal to the set matching threshold.
[0053] S2, creating a first cache pool for storing identity card number factor information, and creating a second cache pool for storing composite factor information, wherein the composite factor includes a name factor, a date of birth factor, and a gender factor.
[0054] In the embodiment, the Java high-performance cache library Caffeine is used to create a cache pool.
[0055] S2.1, based on the patient factor information, it is known that factors with the same weight of ID_CRD_NO can be directly matched to the same patient, so the first cache pool is created, and the key (key value) is the hashCode (hash code) of ID_CRD_NO.
[0056] Initialize the first cache pool and execute the following code for ID_CRD_NO:
[0057] idCrdNoCache=Caffeine.newBuilder().maximumSize(100_000).build();
[0058] Among them, idCrdNoCache represents the first cache pool, Caffeine.newBuilder() represents the new cache configuration builder created by the Caffeine cache library, maximumSize(100_000) represents setting the maximum number of elements that can be stored in the cache to 1000000, and build() represents building and returning a cache instance according to all previously configured parameters.
[0059] S2.2, according to the weight combination of the composite factors including PTT_NM, BTH_DT and GDR_CD, the same patient can be matched, and a second cache pool is created, with the key being the hashCode of (PTT_NM+BTH_DT+GDR_CD).
[0060] Initialize the second buffer pool and execute the following code for the combination of (PTT_NM + BTH_DT + GDR_CD):
[0061] combinedFactorsCache=Caffeine.newBuilder().maximumSize(100_000).build();
[0062] Among them, combinedFactorsCache represents the second cache pool.
[0063] S3, read patient data from the patient information database. If the ID number factor information in the patient data is not in the first cache pool, it is stored in the first cache pool. If the composite factor information in the patient data is not in the second cache pool, it is stored in the second cache pool. The non-duplicate data stored in both the first cache pool and the second cache pool are marked as data that can be processed concurrently.
[0064] In the embodiment, the JDBC program Api (Application programming interface) is used to access the patient information database and start the patient data reading calculation. In order to ensure the system efficiency and stability when processing large data sets, a batch reading strategy is adopted. By setting the fetchSize (the JDBC program controls the data size of each data query) to 1000, an efficient cycle of extracting and processing 1000 records from the database each time is achieved. This strategy effectively reduces the memory burden and avoids the memory pressure caused by continuous large-scale data loading, thereby ensuring the entire data processing flow.
[0065] S3.1, read the factor field for each row of patient data in the patient data record, obtain the ID_CRD_NO factor, and when it is determined that the factor data is not null, obtain the hash value, and check whether it exists from the idCrdNoCache cache object. If it does not exist, return true (does not exist), and store the hashCode in the idCrdNoCache object. Continue to determine whether the next set of composite factors (PTT_NM + BTH_DT + GDR_CD) exists, obtain the hashCode from the combinedFactorsCache, and if it does not exist, return true (does not exist), and store the hash value in the combinedFactorsCache.
[0066] S3.2, if the comparison results of a row of data in both cache arrays are true, it means that there are no duplicates for this data in the cache, and it is identified as "concurrency-enabled" data and marked as concurrently-enabled. If any comparison stage returns false (exists), it is considered that the data may be duplicated and cannot be processed concurrently to avoid data conflicts or dirty reads.
[0067] S4: For data marked as capable of concurrent processing, dynamic multi-threading is used to construct the primary index calculation. For data not marked as capable of concurrent processing, single-threading is used to construct the primary index calculation. During the primary index calculation, the weight of each patient factor and the patient weight threshold range are calculated and the primary index information is generated for the patient.
[0068] In the embodiment, Java language is used to build a fixed-length thread pool using its built-in ExexutorService (a framework for controlling and managing the operation of multiple threads). The number of threads in the thread pool is set to the number of CPU cores in the current system plus 1. By enabling concurrent processing marks, it is possible to obtain row data with concurrent processing enabled, and use the thread pool to enable concurrent construction of primary index calculations. In order to ensure that all concurrent tasks are fully executed before continuing the subsequent process, CountDownLatch (Java multi-thread synchronization counter) is introduced as a synchronization assistant.
[0069] S4.1, build the main index calculation using dynamic multithreading.
[0070] S4.1.1, Initialize the synchronization assistant: Create a CountDownLatch instance based on the number of rows to be processed, and set its count value to this number to track the remaining unfinished tasks.
[0071] S4.1.2, assign tasks to the thread pool: construct the data marked as concurrently processed into a data set (diffMap) that needs to be processed concurrently, traverse the diffMap, and submit an asynchronous task to the thread pool for each data item. Use the multi-thread synchronization counter to keep the main thread in a blocked state before all asynchronous tasks are completed. Each task is responsible for calling the main index calculation method, processing a single data entry, and generating the corresponding EmpiThreadEntity (the result object returned by the EMPI calculation index).
[0072] S4.1.3, Task completion count: Whenever a task completes its primary index calculation, the count value of CountDownLatch is decremented by the countDown() method, indicating that a task has been completed.
[0073] S4.1.4, main thread synchronous waiting: After all tasks are submitted, the main thread calls cd.await() to enter a blocked state until all tasks are completed, that is, the CountDownLatch count returns to zero, at which time the main thread resumes execution.
[0074] S4.1.5, Result Collection and Processing: Using BlockingQueue <Future<?> > (BlockingQueue<> represents a blocking queue, Future<> represents a storage element object, and the question mark ? represents a wildcard for specific parameters) as a collector, as each concurrent task is submitted, the Future object it generates is immediately added to the queue, and the return value EmpiThreadEntity object of each task is obtained by calling the blockingQueue.poll() method, and the returned result is obtained, and finally the data persistence operation is performed.
[0075] S4.2, use single thread to build main index calculation.
[0076] After concurrent calculation, for the data that is not marked as capable of concurrent processing (the remaining uncalculated data in the 1000 rows of data), a data set (maybeMap) that does not require concurrent processing is constructed. Since there may be duplicate values in this batch of data, it is not suitable for concurrent calculation. The maybeMap is traversed, and for each data item, the primary index calculation is constructed using a single thread, all the returned results are collected, and finally the data is persisted. After waiting for all the data to be calculated, the cache array is cleared and the calculation of the next batch of data continues.
[0077] S4.3, for the primary index calculation involved in steps S4.1 and S4.2, the specific steps are as follows.
[0078] S4.3.1, Preparation phase: Sort the patient factor weights from high to low, and read the main index database (main index database maintained by EMPI, containing patient main index information and factor information) in turn to match the same patients and suspected patients.
[0079] S4.3.2, preliminary matching: The patient factor with the highest weight after sorting obtained from step S4.3.1 is the ID card number factor. The ID card number factor is used as the query condition to query in the main index database maintained by the EMPI system. If a match is found, jump to the detailed factor matching step; if the ID card number factor with the highest weight is not matched, the next patient factor is used as the name factor as the query condition according to the sorting to query. If a match is found, a detailed factor matching is performed, and so on; if all patient factors are not matched, it is considered that different patients have been found, and new main index information is generated for the current patient. Before each query, evaluate whether the weight of the current patient factor and the sum of the weights of all subsequent patient factors have reached the minimum value of the preset weight threshold range for similar patients (i.e., the distinction threshold of 60). If the sum of the weights is greater than or equal to the distinction threshold, it is considered that there are similar or identical patients, and the query continues. If the sum of the weights is less than the distinction threshold, it is considered that different patients have been found, the query is terminated, and a new main index information is generated for the current patient. A main index number is directly generated for the current patient, and maintained in the main index database, and the next patient is generated.
[0080] S4.3.3, detailed factor matching: Perform detailed factor matching on the matching results obtained in the preliminary matching of step S4.3.2, and calculate the sum of weights of the patient factors that match the same ID card number factor, name factor, date of birth factor, and gender factor in turn as the final weight threshold. For example, to match whether the ID cards are the same, the weight of the same plus the ID card is 80, and the weight of the different is 0; continue to match whether the next factor is the same, the same plus the factor weight, and the different is 0, and so on.
[0081] S4.3.4, judgment and operation: judge according to the final weight threshold. If the final weight threshold is greater than or equal to the highest value of the weight threshold range of similar patients (that is, the final weight threshold ≥ matching threshold 80), it is considered that the same patient has been found, and the same primary index information is generated for the current patient; if the final weight threshold is greater than or equal to the distinction threshold but less than the matching threshold (that is, the distinction threshold 60 ≤ final weight threshold < matching threshold 80), it is considered that similar patients have been found, and suspected patient information is generated and suspected labels are added to suspected patients and suspected patients; if the final weight threshold is less than the distinction threshold (that is, the final weight threshold < distinction threshold 60), it is considered that different patients have been found, and new primary index information is generated for the current patient.
[0082] S4.3.5, result processing: After the final calculation of the results, the generated primary index information is packaged into a primary index result object including patient information and primary index code, and returned to the caller in the primary index calculation of steps S4.1 and S4.2 for subsequent data persistence operations.
[0083] In summary, the patient master index construction method based on dynamic multi-threading provided by the embodiment of the present invention overcomes the efficiency bottleneck of single-thread processing by introducing dynamic multi-thread computing technology, can effectively utilize the multi-core capabilities of modern computing resources, realize concurrent execution of massive patient record data processing tasks, greatly improve the system response speed and processing capacity when processing hundreds of millions of patient records, and greatly shorten the medical data construction cycle; by designing a cache and duplicate checking mechanism, the dependence on external databases is reduced, and a single-threaded meticulous processing strategy is adopted for sensitive data sets containing potential duplicate records, thereby avoiding data inconsistency and logical conflicts that may be caused by concurrent operations, reducing the risk of single point failures in the processing link, ensuring the uninterrupted data processing process and the consistency of results, and ensuring the integrity of each patient's information data to the highest extent, and enhancing the stability and continuity of data processing; by dynamically adjusting the number of threads and the cache strategy, the thread pool size can be dynamically adjusted according to the actual hardware resources, which is easy to adapt to data processing needs of different scales, maximize the use of system resources, avoid resource waste and performance bottlenecks, ensure that the system can run efficiently under various circumstances, and improve the scalability and adaptability of the system.
[0084] Based on the same inventive concept, Figure 4 As shown, an embodiment of the present invention further provides a patient master index construction device 400 based on dynamic multi-threading, including: a factor information acquisition module 410, a cache pool construction module 420, a duplicate detection module 430 and a master index calculation module 440.
[0085] The factor information acquisition module 410 is used to configure the enterprise master patient index system including patient factors, weights of each patient factor, and patient weight threshold ranges, wherein the patient factors include ID number factors, name factors, date of birth factors, and gender factors.
[0086] The cache pool construction module 420 is used to create a first cache pool for storing identity card number factor information, and to create a second cache pool for storing composite factor information, wherein the composite factor includes a name factor, a date of birth factor, and a gender factor.
[0087] The duplicate checking module 430 is used to read patient data from the patient information database, and if the ID card number factor information in the patient data is not in the first cache pool, it is stored in the first cache pool; if the composite factor information in the patient data is not in the second cache pool, it is stored in the second cache pool, and the non-duplicate data stored in both the first cache pool and the second cache pool are marked as being able to start concurrent processing;
[0088] The main index calculation module 440 is used to use dynamic multi-threading to build the main index calculation for data marked as capable of concurrent processing, and to use a single thread to build the main index calculation for data not marked as capable of concurrent processing. When calculating the main index, the weight of each patient factor and the patient weight threshold range are calculated and the main index information is generated for the patient.
[0089] It should be noted that the patient primary index construction device based on dynamic multi-threading provided in the above embodiment belongs to the same inventive concept as the patient primary index construction method based on dynamic multi-threading. The specific implementation process is detailed in the embodiment of the patient primary index construction method based on the dynamic multi-threading strategy, which will not be repeated here.
[0090] The specific implementation methods described above provide a detailed description of the technical solutions and beneficial effects of the present invention. It should be understood that the above is only the most preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, supplements and equivalent substitutions made within the scope of the principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for constructing a patient master index based on dynamic multithreading, characterized in that: The following steps are involved: The configuration of the enterprise master patient index system includes patient factors, weights of each patient factor, and patient weight threshold ranges, wherein patient factors include ID number factors, name factors, date of birth factors, and gender factors, and the patient weight threshold ranges include: configuring different weight threshold ranges for patient weight threshold ranges representing different patients, similar patients, and identical patients, wherein different patients means that the patient factors of two patients do not match at all or the sum of the weights of the matching patient factors is less than the set distinction threshold, similar patients means that the patient factors of two patients partially match and the sum of the weights of the partially matching patient factors is greater than or equal to the set distinction threshold but less than the set matching threshold, and identical patients means that the patient factors of two patients completely match or the sum of the weights of the matching patient factors is greater than or equal to the set matching threshold; Creating a first cache pool for storing identity card number factor information, and creating a second cache pool for storing composite factor information, wherein the composite factor includes a name factor, a date of birth factor, and a gender factor; Read patient data from the patient information database, and store the patient data in the first cache pool if the ID card number factor information in the patient data is not in the first cache pool; and store the patient data in the second cache pool if the composite factor information in the patient data is not in the second cache pool; mark the non-duplicate data stored in both the first cache pool and the second cache pool as data that can be processed concurrently; For data marked as concurrently processable, dynamic multithreading is used to construct the main index calculation, including: submitting an asynchronous task to the thread pool for each piece of data marked as concurrently processable, using a multithreaded synchronization counter to keep the main thread in a blocked state before all asynchronous tasks are completed, each asynchronous task is responsible for calling the main index calculation method and generating a return result, and each time an asynchronous task completes the main index calculation, the multithreaded synchronization counter is used to count down until all asynchronous tasks have completed the main index calculation and the multithreaded synchronization counter count returns to zero, at which point the main thread resumes execution, collects all return results, and finally performs data persistence operations; For data that is not marked as capable of concurrent processing, a single thread is used to build the main index calculation; When calculating the primary index, the weight of each patient factor and the patient weight threshold range are used for calculation and primary index information is generated for the patient, including: using the patient factor with the highest weight after sorting as the query condition to query in the primary index database maintained by the enterprise's primary patient index system, and if a match is found, detailed factor matching is performed; if no match is found using the patient factor with the highest weight, the next patient factor is used as the query condition according to the sorting, and if a match is found, detailed factor matching is performed; if no match is found for all patient factors, it is considered that different patients have been found, and new primary index information is generated for the current patient; before each query, it is evaluated whether the sum of the weight of the current patient factor and the weight of all subsequent patient factors has reached the lowest value of the preset weight threshold range for similar patients, i.e., the distinction threshold; if the sum of the weights is greater than or equal to the distinction threshold, it is considered that there are similar or identical patients, and further searches are performed. Continue to query. If the sum of the weights is less than the distinction threshold, it is considered that different patients have been found, the query is terminated and new primary index information is generated for the current patient. For the matching results obtained in the preliminary matching, detailed factor matching is performed. The sum of the weights of the patient factors that match the same factors of the ID card number factor, name factor, date of birth factor and gender factor is accumulated and calculated as the final weight threshold. The judgment is made based on the final weight threshold. If the final weight threshold is greater than or equal to the highest value of the weight threshold range of similar patients, that is, the matching threshold, it is considered that the same patient has been found, and the same primary index information is generated for the current patient. If the final weight threshold is greater than or equal to the distinction threshold but less than the matching threshold, it is considered that similar patients have been found, suspected patient information is generated, and suspected labels are added to the suspected patients and the suspected patients. If the final weight threshold is less than the distinction threshold, it is considered that different patients have been found, and new primary index information is generated for the current patient.
2. The method for constructing a patient master index based on dynamic multithreading according to claim 1, characterized in that: The weights of each patient factor include: Different weight values from large to small are configured for the ID number factor, name factor, date of birth factor and gender factor.
3. The method for constructing a patient master index based on dynamic multithreading according to claim 1, characterized in that: When reading patient data from the patient information database, the data size for each data query is set to perform batch reading.
4. The method for constructing a patient master index based on dynamic multithreading according to claim 1, characterized in that: If the ID card number factor information in the patient data is not in the first cache pool, storing it in the first cache pool includes: For each piece of patient data, the factor field is read to obtain the ID card number factor information. When it is determined that the ID card number factor information is not empty, the hash code of the ID card number factor information is obtained, and a comparison is made from the cache objects in the first cache pool to see whether there is an identical hash code. If not, the hash code of the ID card number factor information of this piece of patient data is stored in the first cache pool.
5. The method for constructing a patient master index based on dynamic multithreading according to claim 1, characterized in that: If the composite factor information in the patient data is not in the second buffer pool, storing it in the second buffer pool includes: For each piece of patient data, the factor field is read to obtain the composite factor information including the name factor, the date of birth factor and the gender factor. When it is determined that the composite factor information is not empty, the hash code of the composite factor information is obtained, and a comparison is made from the cache objects in the second cache pool to see whether there is an identical hash code. If not, the hash code of the composite factor information of this piece of patient data is stored in the second cache pool.
6. The method for constructing a patient master index based on dynamic multithreading according to claim 1, characterized in that: The main index calculation is constructed using a single thread for data that is not marked as being capable of concurrent processing, including: After concurrent computing, for data that is not marked as capable of concurrent processing, a single thread is used to build the main index calculation, collect all returned results, and finally perform data persistence operations.
7. A patient master index construction device based on dynamic multithreading, characterized in that: include: Factor information acquisition module, cache pool construction module, duplicate checking module and main index calculation module; The factor information acquisition module is used to configure the enterprise master patient index system including patient factors, weights of each patient factor, and patient weight threshold ranges, wherein the patient factors include ID number factors, name factors, date of birth factors, and gender factors, and the patient weight threshold ranges include: configuring different weight threshold ranges for patient weight threshold ranges representing different patients, similar patients, and identical patients, respectively, wherein different patients represent that the patient factors of two patients are completely unmatched or the sum of the weights of the matching patient factors is less than a set distinction threshold, similar patients represent that the patient factors of two patients are partially matched and the sum of the weights of the partially matched patient factors is greater than or equal to the set distinction threshold but less than a set matching threshold, and identical patients represent that the patient factors of two patients are completely matched or the sum of the weights of the matching patient factors is greater than or equal to the set matching threshold; The buffer pool construction module is used to create a first buffer pool for storing identity card number factor information, and to create a second buffer pool for storing composite factor information, wherein the composite factor includes a name factor, a date of birth factor, and a gender factor; The duplicate checking module is used to read patient data from the patient information database, and if the ID card number factor information in the patient data is not in the first cache pool, it is stored in the first cache pool; if the composite factor information in the patient data is not in the second cache pool, it is stored in the second cache pool, and the non-duplicate data stored in both the first cache pool and the second cache pool are marked as being able to start concurrent processing; The main index calculation module is used to use dynamic multi-threading to construct the main index calculation for the data marked as concurrently processed, including: submitting an asynchronous task to the thread pool for each piece of data marked as concurrently processed, using a multi-threaded synchronization counter to keep the main thread in a blocked state before all asynchronous tasks are completed, each asynchronous task is responsible for calling the main index calculation method and generating a return result, and each time an asynchronous task completes the main index calculation, the multi-threaded synchronization counter is used to count down until all asynchronous tasks have completed the main index calculation and the multi-threaded synchronization counter count returns to zero, at which time the main thread resumes execution, collects all return results, and finally performs data persistence operations; For data that is not marked as capable of concurrent processing, a single thread is used to build the main index calculation; When calculating the primary index, the weight of each patient factor and the patient weight threshold range are used for calculation and primary index information is generated for the patient, including: using the patient factor with the highest weight after sorting as the query condition to query in the primary index database maintained by the enterprise's primary patient index system, and if a match is found, detailed factor matching is performed; if no match is found using the patient factor with the highest weight, the next patient factor is used as the query condition according to the sorting, and if a match is found, detailed factor matching is performed; if no match is found for all patient factors, it is considered that different patients have been found, and new primary index information is generated for the current patient; before each query, it is evaluated whether the sum of the weight of the current patient factor and the weight of all subsequent patient factors has reached the lowest value of the preset weight threshold range for similar patients, i.e., the distinction threshold; if the sum of the weights is greater than or equal to the distinction threshold, it is considered that there are similar or identical patients, and further searches are performed. Continue to query. If the sum of the weights is less than the distinction threshold, it is considered that different patients have been found, the query is terminated and new primary index information is generated for the current patient. For the matching results obtained in the preliminary matching, detailed factor matching is performed. The sum of the weights of the patient factors that match the same factors of the ID card number factor, name factor, date of birth factor and gender factor is accumulated and calculated as the final weight threshold. The judgment is made based on the final weight threshold. If the final weight threshold is greater than or equal to the highest value of the weight threshold range of similar patients, that is, the matching threshold, it is considered that the same patient has been found, and the same primary index information is generated for the current patient. If the final weight threshold is greater than or equal to the distinction threshold but less than the matching threshold, it is considered that similar patients have been found, suspected patient information is generated, and suspected labels are added to the suspected patients and the suspected patients. If the final weight threshold is less than the distinction threshold, it is considered that different patients have been found, and new primary index information is generated for the current patient.
