Electrocardiogram drawing method and system, electronic device and storage medium
By transforming and plotting the processing rules of ECG data packets, the problem of incomplete waveforms caused by packet loss in ECGs was solved, thus achieving the continuity and accuracy of ECGs and avoiding misdiagnosis.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHANGHAI YUANXIN MEDICAL TECH CO LTD
- Filing Date
- 2022-02-25
- Publication Date
- 2026-04-21
AI Technical Summary
During the transmission of electrocardiogram (ECG) data, packet loss or partial data loss can lead to incorrect waveforms when drawing the ECG, which can easily result in misdiagnosis.
If the ECG data packet to be processed is a sequential data packet, it is converted into ECG coordinate data according to the first preset processing rule; otherwise, the lost data is processed according to the second preset processing rule first, and then converted into ECG coordinate data according to the first preset rule, and drawn on the canvas in sequence.
This solves the problem of incomplete ECG waveforms caused by packet loss, avoids misdiagnosis, and ensures the continuity and accuracy of ECGs.
Smart Images

Figure CN116687419B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to an electrocardiogram (ECG) plotting method, system, electronic device, and storage medium. Background Technology
[0002] Bluetooth is a short-range wireless communication technology that enables data exchange between fixed and mobile devices. Bluetooth Low Energy (BLE) is developed based on traditional Bluetooth, but differs from traditional modules in that its biggest advantages are reduced cost and power consumption, making it suitable for scenarios with high real-time requirements. The BLE connection process is roughly as follows: the slave device continuously sends broadcasts containing its own characteristics; the master device scans for a compatible device, sends a connection request, and upon receiving a response data packet from the slave device, the connection is confirmed, and data transmission then begins.
[0003] Portable ECG devices, including multiple acquisition electrodes, collect users' electrocardiogram (ECG) data. Sensors on the device convert analog signals into digital signals, which are then transmitted via Bluetooth. Clients connect to the device via Bluetooth to receive the ECG data and generate real-time ECGs. However, Bluetooth, being a short-range wireless communication technology, is susceptible to disconnection due to distance and obstacles, and data loss during transmission is common, known as packet loss. Without proper processing, the displayed ECG waveform will be incomplete, potentially leading to misdiagnosis by doctors.
[0004] It should be noted that the information disclosed in the background section of this invention is intended only to enhance the understanding of the general background of this invention, and should not be construed as an admission or in any way implying that the information constitutes prior art known to those skilled in the art. Summary of the Invention
[0005] The purpose of this invention is to provide an electrocardiogram (ECG) plotting method, system, electronic device, and storage medium, which can solve the problem that in the process of transmitting ECG data, packet loss or partial data loss can cause some waveforms to be incorrect during ECG plotting, which can easily lead to misdiagnosis.
[0006] To solve the above-mentioned technical problems, the present invention provides a method for drawing an electrocardiogram, comprising:
[0007] Acquire the ECG data packet to be processed;
[0008] Determine whether the ECG data packet to be processed is a sequential data packet;
[0009] If so, the ECG data in the ECG data packet to be processed is converted into ECG coordinate data according to the first preset processing rule;
[0010] If not, first convert the lost ECG data in each lost ECG data packet located between the ECG data packet processed in the previous moment and the ECG data packet to be processed into ECG coordinate data according to the second preset processing rule; then convert the ECG data in the ECG data packet to be processed into ECG coordinate data according to the first preset processing rule.
[0011] The ECG coordinate data are plotted sequentially onto a pre-generated canvas.
[0012] Optionally, acquiring the ECG data packet to be processed includes:
[0013] Multiple data frames are received sequentially, and the multiple data frames are obtained by splitting the ECG data packet to be processed;
[0014] The multiple data frames are spliced together to obtain the ECG data packet to be processed.
[0015] Optionally, determining whether the ECG data packet to be processed is a sequential data packet includes:
[0016] If the difference between the sequence number of the ECG data packet to be processed and the sequence number of the ECG data packet processed at the previous moment is 1, then the ECG data packet to be processed is determined to be the sequential data packet.
[0017] If the difference between the sequence number of the ECG data packet to be processed and the sequence number of the ECG data packet processed at the previous moment is not 1, then the ECG data packet to be processed is determined to be a non-sequential data packet.
[0018] Optionally, converting the ECG data in the ECG data packet to be processed into ECG coordinate data according to the first preset processing rule includes:
[0019] The ECG data in the data packet to be processed is stored in a pre-created data cache pool;
[0020] Retrieve all data from the data cache pool and convert all retrieved data into ECG coordinate data;
[0021] The data cache pool includes multiple storage units, each of which stores 1 byte of data, and the total length of the data that the data cache pool can store is equal to the total length of the complete electrocardiogram data.
[0022] Optionally, storing the ECG data in the ECG data packet to be processed into a pre-created data cache pool includes:
[0023] The data cache pool is initialized so that each storage unit in the data cache pool stores the initialization data;
[0024] The initialization data stored in the corresponding storage unit of the data cache pool is replaced sequentially with each 1-byte ECG data in the ECG data.
[0025] Optionally, converting the lost ECG data in each lost ECG data packet located between the ECG data packet processed in the previous moment and the ECG data packet to be processed into ECG coordinate data according to the second preset processing rule includes:
[0026] For each of the aforementioned lost ECG data packets:
[0027] The data cache pool is initialized so that each storage unit in the data cache pool stores the initialization data;
[0028] All data is retrieved from the data cache pool and converted into ECG coordinate data.
[0029] Optionally, converting all retrieved data into ECG coordinate data includes:
[0030] All the retrieved data is divided into multiple data groups in sequence, and each data group includes data stored in two adjacent storage units;
[0031] Determine whether the initialization data exists in the data group;
[0032] If not, the data set is determined to be a normal data set, and the normal data set is converted into corresponding ECG coordinate data according to a pre-set formula;
[0033] If so, the data set is determined to be an abnormal data set, and the abnormal data set is converted into corresponding ECG coordinate data according to the pre-set abnormal data processing criteria.
[0034] Optionally, converting the abnormal data set into corresponding ECG coordinate data according to a pre-set abnormal data processing standard includes:
[0035] Based on the parity of the sequence number corresponding to the abnormal data group, the abnormal data group is converted into ECG coordinate data with ECG voltage values corresponding to preset values.
[0036] Optionally, the step of converting the abnormal data group into ECG coordinate data with corresponding preset values based on the parity of the sequence number corresponding to the abnormal data group includes:
[0037] If the sequence number corresponding to the abnormal data group is even, then the abnormal data group is converted into ECG coordinate data with the ECG voltage value being the maximum preset value.
[0038] If the sequence number corresponding to the abnormal data group is odd, then the abnormal data group is converted into ECG coordinate data with an ECG voltage value of the minimum preset value; or,
[0039] If the sequence number corresponding to the abnormal data group is even, then the abnormal data group is converted into ECG coordinate data with an ECG voltage value of the minimum preset value.
[0040] If the sequence number corresponding to the abnormal data group is odd, then the abnormal data group is converted into ECG coordinate data with the ECG voltage value being the maximum preset value.
[0041] Optionally, before sequentially plotting the electrocardiogram coordinate data onto a pre-generated canvas, the electrocardiogram plotting method further includes:
[0042] Determine whether the data group corresponding to the ECG coordinate data is a normal data group;
[0043] The step of plotting the electrocardiogram coordinate data on a pre-generated canvas includes:
[0044] If the data group corresponding to the ECG coordinate data is a normal data group, then the ECG coordinate data is drawn on a pre-generated canvas using the first preset color.
[0045] If the data group corresponding to the ECG coordinate data is an abnormal data group, the ECG coordinate data will be drawn on a pre-generated canvas using a second preset color.
[0046] To address the aforementioned technical problems, the present invention also provides an electrocardiogram (ECG) plotting system, comprising a data receiving module, a data processing module, and a waveform plotting module;
[0047] The data receiving module is used to acquire the ECG data packets to be processed;
[0048] The data processing module includes a data judgment submodule, a sequential data processing submodule, and a non-sequential data processing submodule.
[0049] The data judgment submodule is used to determine whether the ECG data packet to be processed is a sequential data packet;
[0050] The sequential data processing submodule is used to convert the ECG data in the ECG data to be processed into ECG coordinate data according to the first preset processing rule when the ECG data to be processed is a sequential data packet.
[0051] The non-sequential data processing submodule includes a first data processing unit and a second data processing unit:
[0052] The first data processing unit is used to convert the lost ECG data in each lost ECG data packet located between the ECG data packet processed at the previous moment and the ECG data packet to be processed into ECG coordinate data according to the second preset processing rule when the ECG data packet to be processed is a non-sequential data packet.
[0053] The second data processing unit is used to convert the lost ECG data in each lost ECG data packet into ECG coordinate data according to the first preset processing rule after the first data processing unit converts the lost ECG data in each lost ECG data packet into ECG coordinate data.
[0054] The waveform drawing module is used to draw the electrocardiogram coordinate data sequentially on a pre-generated canvas.
[0055] Optionally, the sequential data processing submodule and / or the second data processing unit are specifically used for:
[0056] The ECG data in the data packet to be processed is stored in a pre-created data cache pool; all data is retrieved from the data cache pool and converted into ECG coordinate data;
[0057] The data cache pool includes multiple storage units, each of which stores 1 byte of data, and the total length of the data that the data cache pool can store is equal to the total length of the complete electrocardiogram data.
[0058] Optionally, the first data processing unit is specifically configured to: for each of the lost ECG data packets:
[0059] The data cache pool is initialized so that each storage unit in the data cache pool stores the initialization data; all data is retrieved from the data cache pool and converted into electrocardiogram coordinate data.
[0060] Optionally, the waveform drawing module includes a filtering unit and a drawing unit;
[0061] The filtering unit is used to determine whether the data group corresponding to the ECG coordinate data is a normal data group;
[0062] The drawing unit is used for:
[0063] When the data group corresponding to the ECG coordinate data is a normal data group, the ECG coordinate data is drawn on a pre-generated canvas using a first preset color;
[0064] When the data group corresponding to the ECG coordinate data is an abnormal data group, the ECG coordinate data is drawn on a pre-generated canvas using a second preset color.
[0065] To address the aforementioned technical problems, the present invention also provides an electronic device, including a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, it implements the electrocardiogram drawing method described above.
[0066] To address the aforementioned technical problems, the present invention also provides a readable storage medium storing a computer program, which, when executed by a processor, implements the electrocardiogram drawing method described above.
[0067] Compared with the prior art, the electrocardiogram (ECG) drawing method, system, electronic device, and storage medium provided by the present invention have the following advantages: The present invention first acquires the ECG data packet to be processed; then determines whether the ECG data packet to be processed is a sequential data packet; if so, the ECG data in the ECG data packet to be processed is converted into ECG coordinate data according to a first preset processing rule; if not, the lost ECG data in each lost ECG data packet between the ECG data packet processed at the previous moment and the ECG data packet to be processed is converted into ECG coordinate data according to a second preset processing rule; then the ECG data in the ECG data packet to be processed is converted into ECG coordinate data according to the first preset processing rule; and the ECG coordinate data is sequentially drawn onto a pre-generated canvas. Therefore, this invention, for sequential ECG data packets to be processed, directly converts the ECG data in the ECG data packets to ECG coordinate data according to a first preset processing rule; for non-sequential ECG data packets to be processed (i.e., packets lost in the middle), firstly, according to a second preset processing rule, the lost ECG data in each lost ECG data packet between the previously processed ECG data packet and the ECG data packet to be processed is converted into ECG coordinate data, and then according to the first preset processing rule, the ECG data in the ECG data packet to be processed is converted into ECG coordinate data; finally, the ECG coordinate data is drawn sequentially on a pre-generated canvas, thus preventing the situation where subsequent waveforms are directly spliced onto the tail of the previous waveform when the previous waveform is incomplete due to packet loss. This solves the problem that during the transmission of ECG data, due to packet loss or partial data loss, some waveforms are incorrect when drawing the ECG, which can easily lead to misdiagnosis. Attached Figure Description
[0068] Figure 1 This is a flowchart illustrating an electrocardiogram (ECG) drawing method according to an embodiment of the present invention.
[0069] Figure 2This is a schematic diagram of the structure of an electrocardiogram (ECG) data packet provided in one embodiment of the present invention;
[0070] Figure 3 This is a schematic diagram of an electrocardiogram (ECG) drawn using the ECG drawing method provided by the present invention.
[0071] Figure 4 A structural block diagram of an electrocardiogram (ECG) plotting system provided in one embodiment of the present invention;
[0072] Figure 5 This is a block diagram of an electronic device provided according to an embodiment of the present invention.
[0073] The reference numerals in the attached figures are as follows:
[0074] Data receiving module-100;
[0075] Data processing module - 200; Data judgment submodule - 210; Sequential data processing submodule - 220; Non-sequential data processing submodule - 230; First data processing unit - 231; Second data processing unit - 232;
[0076] Waveform plotting module-300; Filtering unit-310; Plotting unit-320;
[0077] Processor-410; Communication interface-420; Memory-430; Communication bus-440. Detailed Implementation
[0078] The following detailed description, in conjunction with the accompanying drawings and specific embodiments, further illustrates the electrocardiogram (ECG) drawing method, system, electronic device, and storage medium proposed in this invention. The advantages and features of this invention will become clearer from the following description. It should be noted that the drawings are in a very simplified form and use non-precise proportions, used only to facilitate and clearly illustrate the embodiments of this invention. Please refer to the drawings to make the objectives, features, and advantages of this invention more apparent and understandable. It should be understood that the structures, proportions, sizes, etc., depicted in the accompanying drawings are only for illustrative purposes and to enable those skilled in the art to understand and read them, and are not intended to limit the implementation conditions of this invention. Any modifications to the structure, changes in proportions, or adjustments to the size, provided they produce the same or similar effects and achieve the same objectives as this invention, should still fall within the scope of the technical content disclosed in this invention.
[0079] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element, and the term "a plurality of" includes two instances.
[0080] Furthermore, in the description of this specification, the reference to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., means that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in a suitable manner in any one or more embodiments or examples. Furthermore, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0081] The core idea of this invention is to provide an electrocardiogram (ECG) drawing method, system, electronic device, and storage medium to solve the problem in the prior art where packet loss or partial data loss during ECG data transmission leads to incorrect waveforms in the ECG drawing, which can easily result in misdiagnosis.
[0082] It should be noted that the electrocardiogram (ECG) drawing method of this invention can be applied to the ECG drawing system of this invention. This ECG drawing system can be configured on an electronic device, such as a personal computer, a mobile terminal, or a mobile phone or tablet computer with various operating systems. Furthermore, although this invention uses the transmission of the ECG data packet to be processed via Bluetooth as an example, as those skilled in the art will understand, the ECG data packet can also be transmitted via other communication means, and this invention does not limit it in this regard. Additionally, it should be noted that the term "1 byte of data" as used herein refers to data with a length of 1 byte.
[0083] To achieve the above-mentioned goals, this invention provides a method for drawing an electrocardiogram (ECG). Please refer to [the relevant documentation]. Figure 1 The diagram illustrates a flowchart of an electrocardiogram (ECG) drawing method according to an embodiment of the present invention. Figure 1 As shown, the electrocardiogram (ECG) drawing method includes the following steps:
[0084] Step S100: Obtain the ECG data packet to be processed.
[0085] Step S200: Determine whether the ECG data packet to be processed is a sequential data packet.
[0086] If yes, proceed to step S300; otherwise, proceed to step S400.
[0087] Step S300: Convert the ECG data in the ECG data packet to be processed into ECG coordinate data according to the first preset processing rule.
[0088] Step S400: First, according to the second preset processing rule, convert the lost ECG data in each lost ECG data packet located between the ECG data packet processed in the previous moment and the ECG data packet to be processed into ECG coordinate data; then, according to the first preset processing rule, convert the ECG data in the ECG data packet to be processed into ECG coordinate data.
[0089] Step S500: Plot the ECG coordinate data sequentially on a pre-generated canvas.
[0090] Therefore, this invention, for sequential ECG data packets to be processed, directly converts the ECG data in the ECG data packets to ECG coordinate data according to a first preset processing rule; for non-sequential ECG data packets to be processed (i.e., packets lost in the middle), firstly, according to a second preset processing rule, the lost ECG data in each lost ECG data packet between the previously processed ECG data packet and the ECG data packet to be processed is converted into ECG coordinate data, and then according to the first preset processing rule, the ECG data in the ECG data packet to be processed is converted into ECG coordinate data; finally, the ECG coordinate data is drawn sequentially on a pre-generated canvas, thus preventing the situation where subsequent waveforms are directly spliced onto the tail of the previous waveform when the previous waveform is incomplete due to packet loss. This solves the problem that during the transmission of ECG data, due to packet loss or partial data loss, some waveforms are incorrect when drawing the ECG, which can easily lead to misdiagnosis.
[0091] Specifically, during the transmission of ECG data, in order to identify the desired data, a header and footer are added to each packet of ECG data sent by the ECG device according to a pre-set protocol. Please continue to refer to... Figure 2The diagram illustrates the structure of an electrocardiogram (ECG) data packet provided in one embodiment of the present invention. Figure 2 As shown, the ECG data packet includes a header, a data portion, and a trailer. In this embodiment, the header includes a 1-byte start-of-data marker (indicating the start of data), a 1-byte data length marker (indicating the actual length of the data portion, i.e., the actual length of the ECG data), and a 1-byte data type marker (indicating the data type of the data portion, where 0x00 represents ECG data). The trailer consists of a 4-byte data sequence number (incrementing by 1 for each packet starting from 1) and a 1-byte end-of-data marker (indicating the end of data). Figure 2 As shown, the header and trailer together comprise 8 bytes, so a complete ECG data packet is 40 bytes, of which 32 bytes are ECG data and 8 bytes are supplementary information. In other embodiments, the number of bytes in the header, data, and trailer can be adjusted as needed, and this application does not impose any restrictions on this.
[0092] In one exemplary embodiment, acquiring the ECG data packet to be processed includes:
[0093] Multiple data frames are received sequentially, and the multiple data frames are obtained by splitting the ECG data packet to be processed;
[0094] The multiple data frames are spliced together to obtain the ECG data packet to be processed.
[0095] Specifically, when the ECG data packet to be processed is transmitted via the BLE Bluetooth communication protocol, due to the constraints of the BLE Bluetooth communication protocol, the total data size of each Bluetooth transmission does not exceed 20 bytes. Therefore, before transmitting the ECG data packet to be processed to the receiver, it is necessary to split the ECG data packet to be processed. For example, when the ECG data packet to be processed is 40 bytes, it is split into two 20-byte data frames. When the receiver receives the first 20-byte data frame, it first stores the first 20-byte data frame. After receiving the second 20-byte data frame, the two 20-byte data frames are spliced together to form a complete ECG data packet to be processed, including the packet header and packet footer.
[0096] In one exemplary implementation, determining whether the ECG data packet to be processed is a sequential data packet includes:
[0097] If the difference between the sequence number of the ECG data packet to be processed and the sequence number of the ECG data packet processed at the previous moment is 1, then the ECG data packet to be processed is determined to be a sequential data packet.
[0098] If the difference between the sequence number of the ECG data packet to be processed and the sequence number of the ECG data packet processed at the previous moment is not 1, then the ECG data packet to be processed is determined to be a non-sequential data packet.
[0099] Specifically, assuming the sequence number of the ECG data packet to be processed is CQ1, and the sequence number of the ECG data packet processed at the previous moment is CQ2, if CQ1-CQ2=1, then the ECG data packet to be processed is a sequential data packet; if CQ1-CQ2≠1, then the ECG data packet to be processed is a non-sequential data packet. Assuming CQ1-CQ2=M (M≥2), then a total of (M-1) ECG data packets have been lost from the previous moment to the current moment, meaning the number of lost ECG data packets between the ECG data packets processed at the previous moment and the ECG data packet to be processed is (M-1). Therefore, by judging the difference between the sequence numbers of the ECG data packet to be processed and the ECG data packets processed at the previous moment, it is easier to determine whether the ECG data packet to be processed is a sequential or non-sequential data packet, i.e., to determine whether packet loss has occurred.
[0100] In one exemplary embodiment, converting the ECG data in the ECG data packet to be processed into ECG coordinate data according to a first preset processing rule includes:
[0101] The ECG data in the data packet to be processed is stored in a pre-created data cache pool;
[0102] All data is retrieved from the data cache pool and converted into ECG coordinate data.
[0103] The data cache pool comprises multiple storage units, each storing 1 byte of data. The total length of data that the data cache pool can store is equal to the total length of the complete ECG data. For example, if the length of a complete ECG data is 32 bytes, then the cache pool comprises 32 storage units. Since the total length of data that the data cache pool can store is equal to the total length of the complete ECG data, this invention, for the received ECG data packet to be processed, first stores the ECG data in the received ECG data packet into a pre-created data cache pool, then retrieves all data from the data cache pool, and converts all retrieved data into ECG coordinate data. This ensures that the number of ECG coordinate data corresponding to each ECG data packet to be processed is the same as the number of ECG coordinate data corresponding to a complete ECG data packet, thereby ensuring the continuity of ECG data in the drawn ECG chart.
[0104] In one exemplary embodiment, storing the ECG data in the ECG data packet to be processed into a pre-created data cache pool includes:
[0105] The data cache pool is initialized so that each storage unit in the data cache pool stores the initialization data;
[0106] The initialization data stored in the corresponding storage unit of the data cache pool is replaced sequentially with each 1-byte ECG data in the ECG data.
[0107] Specifically, if the ECG data in the ECG data packet to be processed is not lost, that is, if the ECG data in the ECG data packet to be processed is complete ECG data (in this embodiment, the length of the ECG data is 32 bytes), then the ECG data is divided into 32 1-byte ECG data in sequence, and these 32 1-byte ECG data are used to replace the initialization data stored in the corresponding storage unit in the data cache pool in sequence. That is, the data stored in the corresponding storage unit in the data cache pool is replaced by the initialization data with the corresponding 1-byte ECG data in the ECG data. If all the ECG data in the ECG data packet to be processed is lost, that is, if the length of the ECG data in the ECG data packet to be processed is 0 bytes, then the data stored in each storage unit in the data cache pool is still the initialization data, that is, the entire data cache pool is in an initialization state. If the ECG data in the ECG data packet to be processed is partially lost, i.e., the length of the ECG data in the ECG data packet to be processed is less than 32 bytes, then the ECG data is divided into a corresponding number of 1-byte ECG data in sequence, and these 1-byte ECG data are used to replace the initialization data stored in the corresponding storage unit in the data cache pool in sequence. Since the length of the ECG data in the ECG data packet to be processed is less than 32 bytes, there will be some storage units in the data cache pool that do not have corresponding 1-byte ECG data for replacement. For ease of description, these storage units are referred to as remaining storage units. Since the remaining storage units have not undergone data replacement, the data stored in these remaining storage units is still the initialization data, that is, some storage units in the data cache pool still remain in the initialization state. Therefore, this invention first initializes the data cache pool so that each storage unit in the data cache pool stores the initialization data; then, it sequentially replaces the initialization data stored in the corresponding storage unit of the data cache pool with each 1-byte ECG data from the ECG data. This effectively determines the number of bytes of missing data in the ECG data packet to be processed, and thus, according to the abnormal data processing criteria described below, these missing data can be converted into corresponding ECG coordinate data. It should be noted that, as those skilled in the art will understand, the initialization data can be set according to specific circumstances, for example, the initialization data can be set to 0 to distinguish it from the ECG data.
[0108] In one exemplary implementation, for the ECG data packet to be processed, converting all retrieved data into ECG coordinate data includes:
[0109] All the retrieved data is divided into multiple data groups in sequence, and each data group includes data stored in two adjacent storage units;
[0110] Determine whether initialization data exists in the data group;
[0111] If not, the data set is determined to be a normal data set, and the normal data set is converted into corresponding ECG coordinate data according to a pre-set formula;
[0112] If so, the data set is determined to be an abnormal data set, and the abnormal data set is converted into corresponding ECG coordinate data according to the pre-set abnormal data processing criteria.
[0113] Since two bytes represent one sampling point in ECG data, all data retrieved from the data buffer can be divided into multiple data groups, with each data group representing one sampling point. Specifically, when the total length of all retrieved data is 32 bytes, this data can be divided into 16 data groups. When all storage units in the data cache pool store 1-byte ECG data (i.e., when the ECG data in the ECG data packet to be processed is not lost), then each of the 16 data groups includes two adjacent 1-byte ECG data, meaning all 16 data groups are normal data groups. When some storage units in the data cache pool store 1-byte ECG data and some storage units store 1-byte initialization data (i.e., when some data in the ECG data packet to be processed is lost), then some of the 16 data groups include two adjacent 1-byte ECG data (i.e., normal data groups), some data groups include two adjacent 1-byte initialization data (i.e., abnormal data groups), and some data groups even include adjacent 1-byte ECG data and 1-byte initialization data (i.e., abnormal data groups). When all storage units in the data cache pool store 1-byte initialization data (i.e., when all the ECG data in the ECG data packet to be processed is lost), then each of the 16 data groups includes two adjacent 1-byte initialization data, meaning all 16 data groups are abnormal data groups.
[0114] For normal data sets, a pre-defined formula is used to convert them into corresponding ECG coordinate data. For abnormal data sets, a pre-defined abnormal data processing rule is used to convert them into corresponding ECG coordinate data. It should be noted that, as those skilled in the art will understand, since the horizontal axis of ECG coordinate data can be obtained by summing the number of data sets, the primary purpose of converting a data set into corresponding ECG coordinate data is to obtain the vertical axis of the corresponding ECG coordinate data, i.e., the ECG voltage value.
[0115] In one exemplary embodiment, the step of converting lost ECG data in each lost ECG data packet located between the previously processed ECG data packet and the ECG data packet to be processed into ECG coordinate data according to a second preset processing rule includes:
[0116] For each of the aforementioned lost ECG data packets:
[0117] The data cache pool is initialized so that each storage unit in the data cache pool stores the initialization data;
[0118] All initialization data is retrieved from the data cache pool and used as the lost ECG data in each lost ECG data packet. All the retrieved initialization data is then converted into ECG coordinate data.
[0119] Specifically, assuming that the number of lost ECG data packets between the ECG data packets processed in the previous moment and the ECG data packets to be processed is m (m≥1), for each of these m lost ECG data packets, the data cache pool is first initialized so that each storage unit in the data cache pool stores the initialization data. Then, all the initialization data is retrieved from the data cache pool and converted into ECG coordinate data. In this way, the lost ECG data in each lost ECG data packet between the ECG data packets processed in the previous moment and the ECG data packets to be processed can be converted into the corresponding ECG coordinate data.
[0120] In one exemplary implementation, converting all retrieved initialization data into ECG coordinate data includes:
[0121] All the retrieved initialization data are divided into multiple abnormal data groups in sequence, and each abnormal data group includes two adjacent initialization data groups.
[0122] According to the pre-set abnormal data processing criteria, the abnormal data group is converted into corresponding electrocardiogram coordinate data.
[0123] Therefore, for each lost ECG data packet located between the ECG data packet processed in the previous moment and the ECG data packet to be processed, an abnormal data processing criterion is adopted to convert the corresponding ECG data into ECG coordinate data. This ensures that medical staff can more intuitively observe which stage of packet loss occurred in the drawn ECG.
[0124] In one exemplary implementation, both the ECG data packets to be processed and the lost ECG data packets are converted into corresponding ECG coordinate data according to the following abnormal data processing criteria:
[0125] Based on the parity of the sequence number corresponding to the abnormal data group, the abnormal data group is converted into ECG coordinate data with ECG voltage values corresponding to preset values.
[0126] Specifically, in some implementations, the sequence number of the abnormal data group to be converted can be determined based on its ranking among the 16 data groups. The sequence number of the first data group is 0, the second is 1, and so on, with the Nth data group having the number N-1. In other implementations, all abnormal data groups can be identified, and the sequence number of the abnormal data group to be converted can be determined based on its ranking among all abnormal data groups. The sequence number of the first abnormal data group is 0, the second is 1, and the nth is n-1. Therefore, by processing the abnormal data group according to whether its sequence number is odd or even, it can be converted into ECG coordinate data with a corresponding preset ECG voltage value.
[0127] In one exemplary embodiment, the step of converting the abnormal data group into ECG coordinate data with corresponding preset values based on the parity of the sequence number corresponding to the abnormal data group includes:
[0128] If the sequence number corresponding to the abnormal data group is even, then the abnormal data group is converted into ECG coordinate data with ECG voltage values of the maximum preset value / minimum preset value.
[0129] If the sequence number corresponding to the abnormal data group is odd, then the abnormal data group is converted into ECG coordinate data with ECG voltage values of minimum preset value / maximum preset value.
[0130] Specifically, in some implementations, if the sequence number corresponding to the abnormal data group is even, the abnormal data group is converted into ECG coordinate data with an ECG voltage value of the maximum preset value; if the sequence number corresponding to the abnormal data group is odd, the abnormal data group is converted into ECG coordinate data with an ECG voltage value of the minimum preset value. In other implementations, if the sequence number corresponding to the abnormal data group is even, the abnormal data group is converted into ECG coordinate data with an ECG voltage value of the minimum preset value; if the sequence number corresponding to the abnormal data group is odd, the abnormal data group is converted into ECG coordinate data with an ECG voltage value of the maximum preset value. Thus, during waveform plotting (i.e., during ECG plotting), during the packet loss phase or partial data loss phase, a special area is formed by connecting lines sequentially from the highest point to the lowest point and back to the highest point (or from the lowest point to the highest point and back to the lowest point). This special area can be used to indicate that data loss has occurred in that area, i.e., an invalid waveform is formed. This allows doctors to clearly see that data loss has occurred in this area, thus avoiding misdiagnosis.
[0131] It should be noted that, as those skilled in the art will understand, the maximum preset value and the minimum preset value can be set according to specific circumstances, as long as they can be distinguished from normal ECG voltage values. For example, normal ECG voltage values after conversion by a preset formula are all between 7 and 11 millivolts, and the waveform fluctuates between 7 and 11 on the vertical axis.
[0132] In one exemplary embodiment, the electrocardiogram plotting method further includes, before sequentially plotting the electrocardiogram coordinate data onto a pre-generated canvas:
[0133] Determine whether the data group corresponding to the ECG coordinate data is a normal data group.
[0134] Correspondingly, plotting the electrocardiogram coordinate data on a pre-generated canvas includes:
[0135] If the data group corresponding to the ECG coordinate data is a normal data group, then the ECG coordinate data is drawn on a pre-generated canvas using the first preset color.
[0136] If the data group corresponding to the ECG coordinate data is an abnormal data group, the ECG coordinate data will be drawn on a pre-generated canvas using a second preset color.
[0137] Specifically, the ECG voltage value in the ECG coordinate data can be determined by whether it is less than the maximum preset value and greater than the minimum preset value. If the determination result is yes, it indicates that the data group corresponding to the ECG coordinate data is a normal data group; if the determination result is no, it indicates that the data group corresponding to the ECG coordinate data is an abnormal data group. Therefore, when the data group corresponding to the ECG coordinate data is a normal data group, the ECG coordinate data is drawn on a pre-generated canvas using a first preset color (e.g., blue); if the data group corresponding to the ECG coordinate data is an abnormal data group, the ECG coordinate data is drawn on a pre-generated canvas using a second preset color (e.g., gray). Since the drawing colors of normal waveforms (waveforms drawn from ECG coordinate data corresponding to normal data groups) and abnormal waveforms (waveforms drawn from ECG coordinate data corresponding to abnormal data groups) are different, it is easier for doctors to clearly see the packet loss in the ECG, effectively avoiding misdiagnosis. It should be noted that, as those skilled in the art will understand, in some other embodiments, the identification can be performed directly during the data conversion process to identify whether the ECG coordinate data corresponds to a normal data group or an abnormal data group.
[0138] Please refer to Figure 3 The diagram illustrates an electrocardiogram (ECG) drawn using the ECG drawing method provided by this invention. Figure 3 As shown, since the electrocardiogram (ECG) is plotted by connecting adjacent coordinate points corresponding to two adjacent ECG coordinate data, the waveform formed during the packet loss phase is as follows: connecting the point with the largest ordinate to the point with the smallest ordinate, and then connecting the point with the smallest ordinate back to the point with the largest ordinate (or connecting the point with the smallest ordinate to the point with the largest ordinate, and then connecting the point with the largest ordinate back to the point with the smallest ordinate), and repeating this process. When there are enough sampling points, i.e., when the plot is dense enough, an area will be formed and displayed with a second preset color (e.g., gray) to indicate that packet loss has occurred in that area. It should be noted that, as those skilled in the art will understand, Figure 3 The paper feed speed of 25mm / s and the gain of 10mm / mv are merely illustrative examples. In actual practice, the paper feed speed and gain can be set according to specific circumstances, and this invention does not limit them.
[0139] The following is a detailed explanation of how to draw an electrocardiogram based on the obtained electrocardiogram coordinate data.
[0140] Specifically, the ECG can be drawn by using the canvas object in the Android Software Development Kit (SDK) and continuously inputting ECG coordinate data through loop calls, then connecting the corresponding coordinate points sequentially. It should be noted that, as those skilled in the art will understand, a canvas can be generated by calling a canvas object. The vertical and horizontal lengths of the canvas can be set according to specific circumstances. The interval between two adjacent points on the horizontal axis can be obtained by dividing the horizontal width of the canvas by the total number of points, thereby determining the X coordinate of the ECG coordinate data. Since the Y coordinate corresponding to the ECG coordinate data can be directly determined when the data group is converted into the corresponding ECG coordinate data, after determining the X and Y coordinates corresponding to the ECG coordinate data, the canvas object can be called. By passing in the X and Y coordinates corresponding to the previous ECG coordinate data and the X and Y coordinates corresponding to the current ECG coordinate data (if the current ECG coordinate data is the first ECG coordinate data, the default X and Y coordinates corresponding to the previous ECG coordinate data are both 0), the two points can be connected on the pre-generated canvas to form a straight line. Since a complete ECG data packet contains 16 sampling points, assuming 16 ECG data packets are received per second, 256 straight lines can be drawn per second, forming the ECG waveform. Because the canvas object is called cyclically, as long as ECG data is continuously received, ECG waveforms can be continuously drawn on the canvas to create an ECG chart. It should be noted that, as those skilled in the art will understand, in other embodiments, other drawing plugins can also be called to draw the ECG chart.
[0141] Corresponding to the electrocardiogram (ECG) plotting method described above, this invention also provides an ECG plotting system, please refer to... Figure 4 The diagram illustrates the structure of an electrocardiogram (ECG) plotting system according to an embodiment of the present invention. Figure 4 As shown, the electrocardiogram (ECG) plotting system includes: a data receiving module 100, a data processing module 200, and a waveform plotting module 300.
[0142] The data receiving module 100 is used to acquire the ECG data packets to be processed.
[0143] The data processing module 200 includes a data judgment submodule 210, a sequential data processing submodule 220, and a non-sequential data processing submodule 230. The data judgment submodule 210 is used to determine whether the ECG data packet to be processed is a sequential data packet. The sequential data processing submodule 220 is used to convert the ECG data in the ECG data packet to be processed into ECG coordinate data according to a first preset processing rule when the ECG data packet to be processed is a sequential data packet. The non-sequential data processing submodule 230 includes a first data processing unit 231 and a second data processing unit 232. The first data processing unit 231 is used to convert the lost ECG data in each lost ECG data packet located between the ECG data packet processed at the previous moment and the ECG data packet to be processed into ECG coordinate data according to a second preset processing rule when the ECG data packet to be processed is a non-sequential data packet. The second data processing unit 232 is used to convert the lost ECG data in each lost ECG data packet into ECG coordinate data according to the first preset processing rule after the first data processing unit 231 converts the lost ECG data in each lost ECG data packet into ECG coordinate data.
[0144] The waveform drawing module 300 is used to draw the electrocardiogram coordinate data sequentially on a pre-generated canvas.
[0145] Therefore, the electrocardiogram (ECG) plotting system provided by this invention, for sequential ECG data packets to be processed, directly converts the ECG data in the ECG data packets to be processed into ECG coordinate data according to the first preset processing rule; for non-sequential ECG data packets to be processed (i.e., packets are lost in the middle), firstly, according to the second preset processing rule, the lost ECG data in each lost ECG data packet between the ECG data packet processed at the previous moment and the ECG data packet to be processed is converted into ECG coordinate data, and then the ECG data in the ECG data packet to be processed is converted into ECG coordinate data according to the first preset processing rule; finally, the ECG coordinate data is plotted sequentially on a pre-generated canvas, so that when the previous waveform is incomplete due to packet loss, the subsequent waveform is directly spliced to the end of the previous waveform, thus solving the problem that in the process of transmitting ECG data, due to packet loss or partial data loss, some waveforms are incorrect when plotting the ECG, which can easily lead to misdiagnosis. It should be noted that, as those skilled in the art will understand, in practical applications, the processor used to convert sequential ECG data packets into ECG coordinate data according to the first preset processing rule and the processor used to convert non-sequential ECG data packets into ECG coordinate data according to the first preset processing rule can be the same processor or they can be different processors. This invention does not limit this.
[0146] In one exemplary embodiment, the sequential data processing submodule 220 and / or the second data processing unit 232 are specifically used for:
[0147] The ECG data in the data packet to be processed is stored in a pre-created data cache pool; all data is retrieved from the data cache pool and converted into ECG coordinate data;
[0148] The data cache pool includes multiple storage units, each of which stores 1 byte of data, and the total length of the data that the data cache pool can store is equal to the total length of the complete electrocardiogram data.
[0149] In one exemplary implementation, storing the ECG data from the ECG data packet to be processed into a pre-created data cache pool includes:
[0150] The data cache pool is initialized so that each storage unit in the data cache pool stores the initialization data;
[0151] The initialization data stored in the corresponding storage unit of the data cache pool is replaced sequentially with each 1-byte ECG data in the ECG data.
[0152] In one exemplary implementation, converting all retrieved data into ECG coordinate data includes:
[0153] All the retrieved data is divided into multiple data groups in sequence, and each data group includes data stored in two adjacent storage units;
[0154] Determine whether initialization data exists in the data group;
[0155] If not, the data set is determined to be a normal data set, and the normal data set is converted into corresponding ECG coordinate data according to a pre-set formula;
[0156] If so, the data set is determined to be an abnormal data set, and the abnormal data set is converted into corresponding ECG coordinate data according to the pre-set abnormal data processing criteria.
[0157] In one exemplary embodiment, the first data processing unit 231 is specifically configured to: for each of the lost ECG data packets:
[0158] The data cache pool is initialized so that each storage unit in the data cache pool stores the initialization data; all initialization data is retrieved from the data cache pool and used as the lost ECG data in each lost ECG data packet; and all retrieved initialization data is converted into ECG coordinate data.
[0159] In one exemplary embodiment, the first data processing unit 231 is configured to convert all retrieved initialization data into ECG coordinate data through the following process:
[0160] All the retrieved initialization data are divided into multiple abnormal data groups in sequence, and each abnormal data group includes two adjacent initialization data groups.
[0161] According to the pre-set abnormal data processing criteria, the abnormal data group is converted into corresponding electrocardiogram coordinate data.
[0162] In one exemplary embodiment, both the sequential data processing submodule 220 and the first data processing unit 231 are configured to convert the abnormal data group into corresponding ECG coordinate data according to the following abnormal data processing criteria: based on the parity of the sequence number corresponding to the abnormal data group, the abnormal data group is converted into ECG coordinate data with an ECG voltage value corresponding to a preset value.
[0163] In one exemplary embodiment, the step of converting the abnormal data group into ECG coordinate data with corresponding preset values based on the parity of the sequence number corresponding to the abnormal data group includes:
[0164] When the sequence number corresponding to the abnormal data group is even, the data group is converted into ECG coordinate data with the ECG voltage value being the maximum preset value;
[0165] When the sequence number corresponding to the data group is odd, the data group is converted into ECG coordinate data with an ECG voltage value of the minimum preset value; or,
[0166] When the sequence number corresponding to the abnormal data group is even, the data group is converted into ECG coordinate data with an ECG voltage value of the minimum preset value;
[0167] When the sequence number corresponding to the data group is odd, the data group is converted into ECG coordinate data with the ECG voltage value being the maximum preset value.
[0168] like Figure 4As shown, in an exemplary embodiment, the waveform drawing module 300 includes a filtering unit 310 and a drawing unit 320; the filtering unit 310 is used to determine whether the data group corresponding to the ECG coordinate data is a normal data group; the drawing unit 320 is used to: draw the ECG coordinate data on a pre-generated canvas using a first preset color when the data group corresponding to the ECG coordinate data is a normal data group; and draw the ECG coordinate data on a pre-generated canvas using a second preset color when the data group corresponding to the ECG coordinate data is an abnormal data group.
[0169] Based on the same inventive concept, the present invention also provides an electronic device, please refer to... Figure 5 A block diagram illustrating an embodiment of the electronic device provided by the present invention is shown. Figure 5 As shown, the electronic device includes a processor 410 and a memory 430. The memory 430 stores a computer program, which, when executed by the processor 410, implements the electrocardiogram (ECG) drawing method described above. Since the electronic device provided by this invention and the ECG drawing method described above belong to the same inventive concept, the electronic device provided by this invention possesses all the advantages of the ECG drawing method described above; therefore, its beneficial effects will not be elaborated further.
[0170] like Figure 5 As shown, the electronic device also includes a communication interface 420 and a communication bus 440, wherein the processor 410, the communication interface 420, and the memory 430 communicate with each other via the communication bus 440. The communication bus 440 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus 440 can be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is used to represent it in the figure, but this does not indicate that there is only one bus or one type of bus. The communication interface 420 is used for communication between the aforementioned electronic device and other devices.
[0171] The processor 410 described in this invention can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor. The processor 410 is the control center of the electronic device, connecting various parts of the electronic device via various interfaces and lines.
[0172] The memory 430 can be used to store the computer program. The processor 410 implements various functions of the electronic device by running or executing the computer program stored in the memory 430 and calling the data stored in the memory 430.
[0173] The memory 430 may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.
[0174] This invention also provides a readable storage medium storing a computer program that, when executed by a processor, can implement the electrocardiogram (ECG) drawing method described above. Since the readable storage medium provided by this invention and the ECG drawing method described above belong to the same inventive concept, the readable storage medium provided by this invention possesses all the advantages of the ECG drawing method described above; therefore, its beneficial effects will not be elaborated further.
[0175] The readable storage medium of embodiments of the present invention can be any combination of one or more computer-readable media. The readable medium can be a computer-readable signal medium or a computer-readable storage medium. Computer-readable storage media can be, for example, but not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: electrical connections having one or more wires, portable computer hard disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, apparatus, or device.
[0176] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.
[0177] Program code contained on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0178] Computer program code for performing the operations of this invention can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as "C" or similar languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0179] In summary, compared with the prior art, the electrocardiogram (ECG) drawing method, system, electronic device, and storage medium provided by the present invention have the following advantages: The present invention first acquires the ECG data packet to be processed; then determines whether the ECG data packet to be processed is a sequential data packet; if so, the ECG data in the ECG data packet to be processed is converted into ECG coordinate data according to a first preset processing rule; if not, the lost ECG data in each lost ECG data packet between the ECG data packet processed at the previous moment and the ECG data packet to be processed is converted into ECG coordinate data according to a second preset processing rule; then the ECG data in the ECG data packet to be processed is converted into ECG coordinate data according to the first preset processing rule; and the ECG coordinate data is sequentially drawn onto a pre-generated canvas. Therefore, this invention, for sequential ECG data packets to be processed, directly converts the ECG data in the ECG data packets to ECG coordinate data according to a first preset processing rule; for non-sequential ECG data packets to be processed (i.e., packets lost in the middle), firstly, according to a second preset processing rule, the lost ECG data in each lost ECG data packet between the previously processed ECG data packet and the ECG data packet to be processed is converted into ECG coordinate data, and then according to the first preset processing rule, the ECG data in the ECG data packet to be processed is converted into ECG coordinate data; finally, the ECG coordinate data is drawn sequentially on a pre-generated canvas, thus preventing the situation where subsequent waveforms are directly spliced onto the tail of the previous waveform when the previous waveform is incomplete due to packet loss. This solves the problem that during the transmission of ECG data, due to packet loss or partial data loss, some waveforms are incorrect when drawing the ECG, which can easily lead to misdiagnosis.
[0180] It should be noted that the apparatus and methods disclosed in the embodiments herein can also be implemented in other ways. The apparatus embodiments described above are merely illustrative; for example, the flowcharts and block diagrams in the accompanying drawings show the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments herein. In this regard, each block in a flowchart or block diagram may represent a module, program, or part of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system to perform the specified function or action, or can be implemented using a combination of dedicated hardware and computer instructions.
[0181] In addition, the functional modules in the various embodiments of this article can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0182] The above description is merely a description of preferred embodiments of the present invention and is not intended to limit the scope of the invention in any way. Any changes or modifications made by those skilled in the art based on the above disclosure are within the protection scope of the present invention. Obviously, those skilled in the art can make various modifications and variations to the present invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the present invention and its equivalents, the present invention also intends to include these modifications and variations.
Claims
1. A method for drawing an electrocardiogram, characterized in that, include: Acquire the ECG data packet to be processed; Determine whether the ECG data packet to be processed is a sequential data packet; If so, the ECG data in the ECG data packet to be processed is converted into ECG coordinate data according to the first preset processing rule; If not, first convert the lost ECG data in each lost ECG data packet located between the ECG data packet processed in the previous moment and the ECG data packet to be processed into ECG coordinate data according to the second preset processing rule; then convert the ECG data in the ECG data packet to be processed into ECG coordinate data according to the first preset processing rule. The electrocardiogram coordinate data are plotted sequentially on a pre-generated canvas; The step of converting the ECG data in the ECG data packet to be processed into ECG coordinate data according to the first preset processing rule includes: The pre-created data cache pool is initialized so that each storage unit in the data cache pool stores initialization data; The initialization data stored in the corresponding storage unit in the data cache pool is replaced sequentially with each 1-byte of ECG data in the ECG data packet to be processed. Retrieve all data from the data cache pool and convert all retrieved data into ECG coordinate data; The data cache pool includes multiple storage units, each of which is used to store 1 byte of data, and the total length of the data that the data cache pool can store is equal to the total length of the complete electrocardiogram data. The step of converting lost ECG data in each lost ECG data packet located between the ECG data packet processed in the previous moment and the ECG data packet to be processed into ECG coordinate data according to the second preset processing rule includes: For each of the aforementioned lost ECG data packets: The data cache pool is initialized so that each storage unit in the data cache pool stores the initialization data; Retrieve all data from the data cache pool and convert all retrieved data into ECG coordinate data; The process of converting all retrieved data into ECG coordinate data includes: All the retrieved data is divided into multiple data groups in sequence, and each data group includes data stored in two adjacent storage units; Determine whether the initialization data exists in the data group; If not, the data set is determined to be a normal data set, and the normal data set is converted into corresponding ECG coordinate data according to a pre-set formula; If so, the data set is determined to be an abnormal data set, and the abnormal data set is converted into corresponding ECG coordinate data according to the pre-set abnormal data processing criteria. The step of converting the abnormal data set into corresponding electrocardiogram coordinate data according to a pre-set abnormal data processing standard includes: Based on the parity of the sequence number corresponding to the abnormal data group, the abnormal data group is converted into ECG coordinate data with ECG voltage values corresponding to preset values; The step of converting the abnormal data group into ECG coordinate data with corresponding preset values based on the parity of the sequence number corresponding to the abnormal data group includes: If the sequence number corresponding to the abnormal data group is even, then the abnormal data group is converted into ECG coordinate data with the ECG voltage value being the maximum preset value, and; If the sequence number corresponding to the abnormal data group is odd, then the abnormal data group is converted into ECG coordinate data with an ECG voltage value of the minimum preset value; or, If the sequence number corresponding to the abnormal data group is even, then the abnormal data group is converted into ECG coordinate data with an ECG voltage value of the minimum preset value, and; If the sequence number corresponding to the abnormal data group is odd, then the abnormal data group is converted into ECG coordinate data with the ECG voltage value being the maximum preset value.
2. The electrocardiogram drawing method according to claim 1, characterized in that, The acquisition of the ECG data packet to be processed includes: Multiple data frames are received sequentially, wherein the multiple data frames are obtained by splitting the ECG data packet to be processed; The multiple data frames are spliced together to obtain the ECG data packet to be processed.
3. The electrocardiogram drawing method according to claim 1, characterized in that, The step of determining whether the ECG data packet to be processed is a sequential data packet includes: If the difference between the sequence number of the ECG data packet to be processed and the sequence number of the ECG data packet processed at the previous moment is 1, then the ECG data packet to be processed is determined to be the sequential data packet. If the difference between the sequence number of the ECG data packet to be processed and the sequence number of the ECG data packet processed at the previous moment is not 1, then the ECG data packet to be processed is determined to be a non-sequential data packet.
4. The electrocardiogram drawing method according to claim 1, characterized in that, Before sequentially plotting the electrocardiogram coordinate data onto a pre-generated canvas, the electrocardiogram plotting method further includes: determining whether the data group corresponding to the electrocardiogram coordinate data is a normal data group; The step of sequentially plotting the electrocardiogram coordinate data onto a pre-generated canvas includes: If the data group corresponding to the ECG coordinate data is a normal data group, then the ECG coordinate data is drawn on a pre-generated canvas using the first preset color. If the data group corresponding to the ECG coordinate data is an abnormal data group, the ECG coordinate data will be drawn on a pre-generated canvas using a second preset color.
5. An electrocardiogram (ECG) plotting system, characterized in that, It includes a data receiving module, a data processing module, and a waveform drawing module; The data receiving module is used to acquire the ECG data packets to be processed; The data processing module includes a data judgment submodule, a sequential data processing submodule, and a non-sequential data processing submodule. The data judgment submodule is used to determine whether the ECG data packet to be processed is a sequential data packet; The sequential data processing submodule is used to convert the ECG data in the ECG data to be processed into ECG coordinate data according to the first preset processing rule when the ECG data to be processed is a sequential data packet. The non-sequential data processing submodule includes a first data processing unit and a second data processing unit: The first data processing unit is used to convert the lost ECG data in each lost ECG data packet located between the ECG data packet processed at the previous moment and the ECG data packet to be processed into ECG coordinate data according to the second preset processing rule when the ECG data packet to be processed is a non-sequential data packet. The second data processing unit is used to convert the lost ECG data in each lost ECG data packet into ECG coordinate data according to the first preset processing rule after the first data processing unit converts the lost ECG data in each lost ECG data packet into ECG coordinate data. The waveform drawing module is used to draw the electrocardiogram coordinate data sequentially on a pre-generated canvas; The sequential data processing submodule and the second data processing unit are specifically used for: The pre-created data cache pool is initialized so that each storage unit in the data cache pool stores initialization data; The initialization data stored in the corresponding storage unit in the data cache pool is replaced sequentially with each 1-byte of ECG data in the ECG data packet to be processed. Retrieve all data from the data cache pool and convert all retrieved data into ECG coordinate data; The data cache pool includes multiple storage units, each of which is used to store 1 byte of data, and the total length of the data that the data cache pool can store is equal to the total length of the complete electrocardiogram data. The first data processing unit is specifically used for: for each of the lost ECG data packets: The data cache pool is initialized so that each storage unit in the data cache pool stores the initialization data; all data is retrieved from the data cache pool and converted into electrocardiogram coordinate data; The process of converting all retrieved data into ECG coordinate data includes: All the retrieved data is divided into multiple data groups in sequence, and each data group includes data stored in two adjacent storage units; Determine whether the initialization data exists in the data group; If not, the data set is determined to be a normal data set, and the normal data set is converted into corresponding ECG coordinate data according to a pre-set formula; If so, the data set is determined to be an abnormal data set, and the abnormal data set is converted into corresponding ECG coordinate data according to the pre-set abnormal data processing criteria. The step of converting the abnormal data set into corresponding electrocardiogram coordinate data according to a pre-set abnormal data processing standard includes: Based on the parity of the sequence number corresponding to the abnormal data group, the abnormal data group is converted into ECG coordinate data with ECG voltage values corresponding to preset values; The step of converting the abnormal data group into ECG coordinate data with corresponding preset values based on the parity of the sequence number corresponding to the abnormal data group includes: If the sequence number corresponding to the abnormal data group is even, then the abnormal data group is converted into ECG coordinate data with the ECG voltage value being the maximum preset value, and; If the sequence number corresponding to the abnormal data group is odd, then the abnormal data group is converted into ECG coordinate data with an ECG voltage value of the minimum preset value; or, If the sequence number corresponding to the abnormal data group is even, then the abnormal data group is converted into ECG coordinate data with an ECG voltage value of the minimum preset value, and; If the sequence number corresponding to the abnormal data group is odd, then the abnormal data group is converted into ECG coordinate data with the ECG voltage value being the maximum preset value.
6. The electrocardiogram (ECG) plotting system according to claim 5, characterized in that, The waveform drawing module includes a filtering unit and a drawing unit; The filtering unit is used to determine whether the data group corresponding to the ECG coordinate data is a normal data group; The drawing unit is used for: When the data group corresponding to the ECG coordinate data is a normal data group, the ECG coordinate data is drawn on a pre-generated canvas using a first preset color; When the data group corresponding to the ECG coordinate data is an abnormal data group, the ECG coordinate data is drawn on a pre-generated canvas using a second preset color.
7. An electronic device, characterized in that, It includes a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, it implements the electrocardiogram drawing method according to any one of claims 1 to 4.
8. A readable storage medium, characterized in that, The readable storage medium stores a computer program, which, when executed by a processor, implements the electrocardiogram drawing method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Terminal and method for acquiring electrocardiogram data information
CN101803916A
Dynamic electrocardiogram processing method and system
CN109480820A
Electrocardiogram drawing system, drawing method and storage medium
CN115337020A