A blockchain-based traditional Chinese medicine decoction substitution whole-process collaborative tracing system and method

By combining the isolated forest algorithm and the dynamic time warping algorithm, the problems of noise interference and data logic continuity in the whole process traceability system of traditional Chinese medicine decoction were solved, realizing a reliable traceability record of the whole process of traditional Chinese medicine decoction, and ensuring the authenticity and immutability of the data.

CN122201669APending Publication Date: 2026-06-12SHENZHEN HEALTH DEV RES & DATA MANAGEMENT CENT

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHENZHEN HEALTH DEV RES & DATA MANAGEMENT CENT
Filing Date
2026-03-04
Publication Date
2026-06-12

AI Technical Summary

Technical Problem

The existing traceability system for the entire process of traditional Chinese medicine decoction lacks a noise filtering mechanism for sensor signals, which leads to abnormal values ​​generated by equipment operation jitter being directly recorded into the system. This makes it difficult to accurately identify the actual evolution of the physical process. The data storage mode ignores the temporal logic verification during the state change process, making it difficult for traceability records to prove their immutability and logical continuity in the event of a dispute.

Method used

The isolated forest algorithm is used to remove weight noise, and the temperature time series is compared with the standard curve by combining the dynamic time warping algorithm. The continuity of state logic is verified by the hash chain structure, and the state change request is confirmed by the consensus mechanism of the whole network nodes, generating an immutable traceability record.

🎯Benefits of technology

It realizes the determination of process completion based on physical state evolution, ensures the authenticity and immutability of data, and builds a reliable traceability chain with strict temporal logic, thus ensuring the reliability and integrity of data throughout the entire process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122201669A_ABST
    Figure CN122201669A_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of information tracing, in particular to a traditional Chinese medicine decocting whole-process collaborative tracing system and method based on a block chain, which comprises an order mapping initialization module, a material boundary determination module, a temperature control state evolution module, a time sequence logic anchoring module and a consensus storage interaction module.In the present application, the isolated forest algorithm is introduced to detect real-time outliers of the sensing data stream, which can effectively eliminate transient noise interference caused by equipment operation, and the similarity of real-time temperature time sequence and standard process curve is compared by using the dynamic time warping algorithm, so that the process completion determination based on physical state evolution is realized, the logical continuity of the current state and the previous record is checked by using the hash chain structure, the state change request is authenticated and the key business permission is synchronously locked through the consensus mechanism of the whole network nodes, and the trusted tracing chain with strict time sequence logic and tamper-proof characteristics is constructed under the premise of ensuring the authenticity and effectiveness of the whole-process data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of information traceability technology, and in particular to a blockchain-based collaborative traceability system and method for the entire process of traditional Chinese medicine decoction. Background Technology

[0002] The field of information traceability technology involves recording, storing, and associating information generated during the production, processing, circulation, and use of products or services. Specifically, it includes coding mechanisms based on identification carriers, deployment of information collection devices and data reading methods, data transmission protocols for communication networks, and data structure design and storage logic for backend information storage devices. This technology system is based on the time-series binding of information at every stage of the process, ensuring that information such as raw material sources, processing procedures, operational nodes, and responsible entities can be uniquely correlated according to time sequence. In implementation, barcodes, QR codes, RFID, and other identification carriers are typically used. Operational data is collected through camera recognition, radio frequency identification, and other collection devices. Data transmission is completed via local area networks (LANs) or wide area networks (WANs), and finally, the data is archived in a centralized or distributed database, achieving traceability and verifiability of information. This technology is widely used in food and pharmaceuticals, manufacturing, logistics and transportation, and supply chain management.

[0003] The traditional blockchain-based collaborative traceability system for the entire process of traditional Chinese medicine (TCM) decoction services involves setting up fixed operation nodes in the TCM decoction business process, such as purchasing, warehousing, weighing, cleaning, soaking, decocting, packaging, and distribution of medicinal materials. Barcodes or QR codes are used to identify batches of medicines. At each node, scanning terminals or RFID readers collect specific data such as operation time, operator, and equipment number. This data is then uploaded to a distributed ledger storage environment composed of multiple server nodes via wired or wireless communication networks. The server nodes concatenate and save each operation record in blocks according to a preset data writing order. Furthermore, temperature sensors, pressure sensors, and timing devices are configured in the decoction stage to generate records of temperature changes, pressure changes, and time during the decoction process. This data, along with the corresponding medicine identifier, is archived, forming a complete process record chain based on the operation sequence and stored in the TCM decoction blockchain platform.

[0004] Existing traceability systems often lack noise filtering mechanisms for raw sensor signals during the data acquisition phase, resulting in abnormal values ​​caused by equipment operation jitter being directly entered into the system. Furthermore, the determination of process completion often relies on static thresholds with preset durations, making it difficult to accurately identify the actual evolution of the physical process. Data storage modes tend to focus on result archiving while neglecting the temporal logic verification during state change processes. This results in a lack of rigorous mathematical anchoring of the causal chain between data at each stage, making it difficult for traceability records to prove their immutability and logical continuity when disputes arise. Summary of the Invention

[0005] The purpose of this invention is to address the shortcomings of existing technologies by proposing a blockchain-based collaborative traceability system and method for the entire process of traditional Chinese medicine decoction.

[0006] To achieve the above objectives, the present invention adopts the following technical solution: a blockchain-based collaborative traceability system for the entire process of traditional Chinese medicine decoction, the system comprising:

[0007] The order mapping initialization module obtains electronic prescription information from the hospital terminal, parses the drugs and dosages, generates a unique order hash identifier, constructs an initial process state vector that maps to the unique order hash identifier, marks the initial process state vector as to be started, and obtains the process timing marker to be activated.

[0008] The material boundary determination module, based on the time sequence marker of the process to be activated, collects the weight of the weighing equipment, calls the isolated forest algorithm to remove noise from the weight, compares the weight with the preset range, and generates a material compliance determination result.

[0009] The temperature control status evolution module, based on the material compliance judgment result, collects temperature time series data in real time, calls the dynamic time warping algorithm to calculate the distance between the temperature time series data and the standard curve, judges the completion status of the physical process, and generates stage evolution instructions.

[0010] The timing logic anchoring module parses the stage evolution instructions, obtains the hash of the previous state on the chain, verifies the logical continuity between the current state and the hash of the previous state, constructs a signed state change request, and generates a block body that has passed the verification.

[0011] The consensus-based evidence storage interaction module broadcasts the verified block, confirms the state change request through the consensus mechanism, writes the data to the latest height of the ledger, locks the refund permission, and generates an immutable traceability record.

[0012] As a further aspect of the present invention, the process timing marker to be activated includes a node index bit, an access control mask, and a creation timing stamp; the material compliance determination result includes a net weight deviation value, a feeding ratio parameter, and a compliance Boolean flag; the stage evolution instruction includes a target state code, a process duration quantity, and a curve fitting score; the verified block body includes a state change payload, a preceding hash reference, and a node signature credential; and the tamper-proof traceability record includes a block height index, a consensus confirmation count, and a stake lock status.

[0013] As a further aspect of the present invention, the order mapping initialization module includes:

[0014] The prescription parsing and identifier generation submodule receives a pre-set electronic prescription data stream from the hospital terminal interface, unpacks the data stream to extract the drug category code sequence and the corresponding dosage value set for each category, combines the drug category code sequence and dosage value set into a standardized feature byte string according to a preset serialization protocol, performs encrypted hash operation on the feature byte string to obtain a fixed-length hexadecimal digest character, and generates a unique order hash identifier.

[0015] The on-chain space mapping construction submodule, based on the unique order hash identifier, applies for independent storage space in the consortium blockchain distributed ledger network through the smart contract interface, constructs a structured data container with a unique correspondence to the unique order hash identifier, defines the field dimensions of timestamp, operator ID and status code inside the container according to the standard physical process division logic of traditional Chinese medicine decoction, and generates an initial process status mapping vector.

[0016] The state timing anchoring initialization submodule calls the state machine control logic to initialize the node bits inside the vector for the initial process state mapping vector, marks the first node of the initial process state mapping vector as a logically active state, and uses a mutex lock mechanism to lock the write permissions of all subsequent process nodes, generating a process timing mark to be activated.

[0017] As a further aspect of the present invention, the material boundary determination module includes:

[0018] The real-time material parameter acquisition submodule, based on the time sequence mark of the process to be activated, responds to the node activation command in the initial process state mapping vector, establishes a synchronous sampling channel, drives the weighing equipment and water addition device to collect the continuous gravity sensing value of the weighing tray and the cumulative pulse count of the flow meter in parallel, aligns the sensing value and the pulse count with timestamps, and generates the original material metering data stream.

[0019] The outlier noise cleaning submodule constructs a random binary isolation tree group for the gravity sensing part of the original material metering data stream. It recursively divides the data space into subspaces by randomly selecting split points, calculates the average path distance of sample points from the root node to the leaf node, evaluates its isolation degree, filters out transient outliers whose average path distance is less than a preset distance offset threshold, and calculates the arithmetic mean of the remaining steady-state data to generate an effective net weight value.

[0020] The process compliance verification submodule calls the prescription database to obtain the standard feed amount and allowable fluctuation range, calculates the difference ratio between the effective net weight value and the standard feed amount, and determines whether the difference ratio is within the allowable fluctuation range. If the verification passes, the compliance flag is set to true; if the verification fails, the specific deviation overflow amount is recorded, and the material compliance judgment result is constructed.

[0021] As a further aspect of the present invention, the process of setting the distance offset threshold is specifically as follows: based on the historical benchmark sampling data of the device under steady-state environment, a probability density model of the path length distribution is constructed, and the boundary value of the maximum confidence interval of the mechanical vibration noise in the model is selected as the distance offset threshold.

[0022] The process of setting the allowable fluctuation range is as follows: by parsing the pharmacopoeia standard metadata corresponding to the drug category in the electronic prescription, the prescribed weight difference limit coefficient is extracted, and the weight difference limit coefficient is multiplied with the theoretical standard dose specified in the prescription to establish the dynamic positive and negative deviation range centered on the standard dose as the allowable fluctuation range.

[0023] As a further aspect of the present invention, the temperature control state evolution module includes:

[0024] The temperature control monitoring start-up submodule activates the immersion thermal probe of the intelligent decoction equipment based on the compliance Boolean flag in the material compliance judgment result, collects thermodynamic temperature readings below the liquid surface, performs time-series index alignment and discretization processing on continuous readings, and constructs real-time temperature time-series data including timestamps and temperature amplitudes.

[0025] The curve fitting deviation calculation submodule calls the preset standard decoction process reference curve, dynamically normalizes and maps the real-time temperature time series data and the reference curve on the time axis, and calculates the process curve similarity distance.

[0026] The process state evolution determination submodule obtains the process curve similarity distance and compares it with a preset process convergence tolerance threshold. If the process curve similarity distance is less than the process convergence tolerance threshold, the physical decoction process is confirmed to be completed. The process status code and fitting residual value of the current time node are extracted, and a stage evolution instruction is generated.

[0027] As a further aspect of the present invention, the specific method for setting the process convergence tolerance threshold is as follows: retrieve the real-time temperature time series data of historical qualified batches, use the similarity distance set of historical batches relative to the standard decoction process baseline curve, perform statistical distribution fitting on the set, obtain the mean and variance of the distance distribution, and use the sum of the mean and the preset multiple standard deviation as the process convergence tolerance threshold.

[0028] As a further aspect of the present invention, the timing logic anchoring module includes:

[0029] The instruction parsing and hash extraction submodule, based on the stage evolution instruction, parses the instruction message to extract the process status code and the fitted residual value, calls the local ledger interface to obtain the tail hash value of the latest block height, and assembles the status code, residual value and tail hash value in a predetermined format to generate the state change payload to be verified.

[0030] The temporal logic integrity verification submodule extracts the tail hash value as the parent node index for the state change load to be verified, calculates the combined digest of the tail hash value and the state code, queries the preset directed acyclic graph of state transitions to confirm the legality of the transition, verifies the monotonically increasing characteristic of the timestamp, and generates a logical consistency verification certificate.

[0031] The signature encapsulation and block construction submodule, based on the logical consistency verification certificate, calls the node private key module to perform elliptic curve signature operation on the state change data, calculates the Merkle tree root node hash including the signature and payload, fills the root node hash into the block header and data area, and generates a block body that has passed verification.

[0032] As a further aspect of the present invention, the consensus evidence storage interaction module includes:

[0033] The network consensus verification submodule distributes the verified block body to the consortium blockchain verification node set through a P2P network interface, drives each node to perform integrity verification on the Merkle root in the block header and perform parallel signature verification on the transaction signature, collects the digital signature endorsements returned by the nodes, and when the cumulative number of valid endorsements exceeds the preset consensus threshold, it confirms that the network state has reached a consensus and generates a network-wide consensus confirmation certificate.

[0034] The ledger persistence writing submodule triggers the local ledger update process based on the network consensus confirmation certificate, writes the verified block data into the persistent storage area of ​​the distributed file system, establishes a mapping index between block hash and physical storage offset in the state database, increments the latest block height parameter of the current blockchain by one, and generates on-chain ledger index metadata.

[0035] The rights locking and evidence storage submodule calls the smart contract virtual machine to load the on-chain accounting index metadata, locates the corresponding order rights control variable, forcibly flips the execution permission flag of the refund function to a frozen state, extracts the block header hash value, consensus timestamp and permission change log for structured encapsulation, and generates an immutable traceability record.

[0036] A blockchain-based collaborative traceability method for the entire process of traditional Chinese medicine decoction processing, the method being used to implement the aforementioned blockchain-based collaborative traceability system for the entire process of traditional Chinese medicine decoction processing, includes the following steps:

[0037] S1: Obtain electronic prescription information from the hospital terminal, parse the drug and dosage, generate a unique order hash identifier, construct an initial process state vector that maps to the unique order hash identifier, mark the initial process state vector as to be started, and obtain the process timing marker to be activated.

[0038] S2: Based on the time sequence marker of the process to be activated, collect the weight of the weighing equipment, call the isolated forest algorithm to remove noise from the weight, compare the weight with the preset range, and generate the material compliance judgment result;

[0039] S3: Based on the material compliance judgment result, collect temperature time series data in real time, call the dynamic time warping algorithm to calculate the distance between the temperature time series data and the standard curve, judge the physical process completion status, and generate stage evolution instructions;

[0040] S4: Parse the stage evolution instructions, obtain the hash of the previous state on the chain, verify the logical continuity between the current state and the hash of the previous state, construct a signed state change request, and generate a block body that has passed the verification.

[0041] S5: Broadcast the verified block, confirm the state change request through the consensus mechanism, write the data to the latest height of the ledger, lock the refund permission, and generate an immutable traceability record.

[0042] Compared with the prior art, the advantages and positive effects of the present invention are as follows:

[0043] In this invention, the isolated forest algorithm is introduced to detect outliers in the sensor data stream in real time, which can effectively eliminate transient noise interference caused by equipment operation. Combined with the dynamic time warping algorithm, the similarity between the real-time temperature time series and the standard process curve is compared, realizing the process completion judgment based on the evolution of physical state. The hash chain structure is used to verify the logical continuity between the current state and the previous record. The consensus mechanism of all network nodes confirms the rights of state change requests and locks the key business permissions simultaneously. Under the premise of ensuring the authenticity and validity of the data throughout the process, a reliable traceability chain with strict time sequence logic and anti-tampering characteristics is constructed. Attached Figure Description

[0044] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0045] Figure 1 This is a system flowchart of the present invention;

[0046] Figure 2 This is a schematic diagram of the system framework of the present invention;

[0047] Figure 3 This is a flowchart of the order mapping initialization module of the present invention;

[0048] Figure 4 This is a flowchart of the material boundary determination module of the present invention;

[0049] Figure 5 This is a flowchart of the temperature control state evolution module of the present invention;

[0050] Figure 6 This is a flowchart of the timing logic anchoring module of the present invention;

[0051] Figure 7 This is a flowchart of the consensus evidence storage interaction module of the present invention;

[0052] Figure 8 This is a schematic diagram of the method steps of the present invention. Detailed Implementation

[0053] The technical solution of the present invention will now be described with reference to the accompanying drawings.

[0054] To make the technical problems, technical solutions and advantages of the present invention clearer, a detailed description will be given below in conjunction with the accompanying drawings and specific embodiments.

[0055] Please see Figure 1 This invention provides a technical solution: a blockchain-based collaborative traceability system for the entire process of traditional Chinese medicine decoction. The system includes an order mapping initialization module, a material boundary determination module, a temperature control state evolution module, a time-series logic anchoring module, and a consensus storage and interaction module.

[0056] The order mapping initialization module receives electronic prescription information from the hospital terminal, parses the drug type and dosage data, generates a unique order hash identifier through hash function operation, and constructs an initial process state vector in the consortium blockchain network that corresponds one-to-one with the unique order hash identifier. The initial process state vector is set to the pending start state to obtain the process timing mark to be activated.

[0057] The material boundary determination module, based on the timing mark of the process to be activated, is executed after receiving the activation signal of the initial process state vector. It collects the weight value of the weighing equipment and the liquid flow rate reading of the water adding device, uses the isolated forest algorithm to perform outlier detection on the weight value, filters out operation jitter noise, compares the processed weight value with the preset range of the prescription, and generates the material compliance determination result.

[0058] The temperature control state evolution module triggers decoction monitoring based on the material compliance judgment result, collects the temperature time series data of the intelligent decoction equipment in real time, calls the dynamic time warping algorithm to calculate the similarity distance between the temperature time series data and the standard decoction process curve, and determines that the current physical process is completed when the distance value is less than the set threshold, and generates a stage evolution instruction.

[0059] The timing logic anchoring module parses the stage evolution instructions, extracts the current state features, obtains the hash of the previous state recorded in the latest record on the chain, verifies the logical continuity and irreversibility between the current state and the previous state hash, generates a state change request containing a digital signature after verification, and generates a block body that has passed the verification.

[0060] The consensus and evidence storage interaction module broadcasts the verified block body to the blockchain node network, triggers / runs the consensus mechanism defined in the smart contract to confirm the state change request across the entire network, writes the data that has passed the consensus into the latest block height of the distributed ledger, freezes the refund permission corresponding to this step, and generates an immutable traceability record.

[0061] The process timing marker to be activated includes at least the node index bit, access control mask, and creation timing stamp. The material compliance judgment result includes the net weight deviation value, feeding ratio parameter, and compliance Boolean flag. The stage evolution instruction includes the target state code, process duration quantity, and curve fitting score. The verified block body includes the state change payload, previous hash reference, and node signature certificate. The tamper-proof traceability record includes the block height index, consensus confirmation count, and stake lock status.

[0062] Please see Figure 2 and Figure 3 The order mapping initialization module includes:

[0063] The prescription parsing and identifier generation submodule receives a pre-set electronic prescription data stream from the hospital terminal interface, parses the data stream, extracts the drug category code sequence and the corresponding dosage value set for each category, combines the drug category code sequence and dosage value set into a standardized feature byte string according to a preset serialization protocol, performs encrypted hash operation on the feature byte string to obtain a fixed-length hexadecimal digest string, and generates a unique order hash identifier.

[0064] This submodule connects to the hospital information system via a secure communication link. It unpacks the input data stream and extracts the drug category code sequence and the corresponding dosage value set for each category using a predefined XML parser. In a specific embodiment, when the data stream contains ginseng slices numbered 801 and astragalus slices numbered 802, their corresponding dosage values ​​of 15 grams and 20 grams are extracted, respectively. Subsequently, through a serialization component, according to a preset serialization protocol, the drug category code sequence and dosage value set are concatenated character-level according to the order of "category code - dosage value," and specific separators are inserted between different drug entries to form a standardized feature byte string. Based on this, the encrypted hash operation logic is called or executed. The feature byte string is used as input data to perform SHA-256 hash operation. Through a series of bit operations, logical function operations, and constant addition, the feature byte string of arbitrary length is mapped to a fixed-length 256-bit binary number and then converted into a 64-bit hexadecimal string representation, thereby generating a unique order hash identifier. For example, the combination of ginseng and astragalus mentioned above would generate an identifier of "a1b2c3d4..." after calculation. This process ensures that even the slightest change in the content of each prescription will produce a completely different identifier, thus achieving a unique binding of order information.

[0065] The on-chain space mapping construction submodule, based on the unique order hash identifier, applies for and allocates independent on-chain storage space in the consortium blockchain distributed ledger network through the smart contract interface, creates a structured data container with a unique correspondence to the unique order hash identifier, defines the field dimensions of timestamp, operator ID and status code inside the container according to the standard physical process division logic of traditional Chinese medicine decoction, and generates an initial process status mapping vector.

[0066] By invoking the smart contract interface of the consortium blockchain node, a storage space request is initiated to the distributed ledger network. An independent memory address is allocated in the on-chain state database to construct a structured data container with a unique key-value correspondence to a unique order hash identifier. Based on the standard physical process division logic of traditional Chinese medicine decoction, the internal data structure of this container is defined, specifically including a nanosecond-level timestamp field for recording operation time, an operator ID field for identifying the responsible person, and a status code field for representing the current process progress. This data structure defines multiple status slots, corresponding to multiple standard process dimensions such as 'order acceptance', 'dispensing', 'soaking', 'decoction', and 'bottling', and reserves byte space for storing digital signatures in each slot. Finally, an initial process state mapping vector is generated on the blockchain.

[0067] The state-sequence anchoring initialization submodule calls or executes state machine control logic to initialize the node bits inside the vector for the initial process state mapping vector, marks the first node of the initial process state mapping vector as the logically active state, and uses a mutex lock mechanism to lock the write permissions of subsequent process nodes to prevent out-of-order write operations, and generates a process sequence marker to be activated.

[0068] The loading state machine control logic initializes the nodes within the vector. First, it locates the first process node (the order-receiving node) in the vector, writes its ready flag to a binary value of 1, and marks it as logically active, indicating that the process is ready. Simultaneously, using a mutex lock mechanism, it iterates through all subsequent process nodes in the vector except the first node, locking their write permissions and setting their status flags to a read-only state to prevent out-of-order writes before the preceding process is completed. Through this logic, it generates activation process timing markers containing explicit timing constraints, ensuring that the execution of processes in the physical world strictly follows the logical order defined on the blockchain.

[0069] Please see Figure 2 and Figure 4 The material boundary determination module includes:

[0070] The real-time material parameter acquisition submodule, based on the time sequence mark of the process to be activated, responds to the node activation command in the initial process state mapping vector, establishes a synchronous sampling channel, controls the weighing equipment and water addition device to acquire the continuous gravity sensing value of the weighing tray and the cumulative pulse count of the flow meter in parallel, and aligns the sensing value and pulse count with timestamps to obtain the original material metering data stream.

[0071] The initial process state mapping vector is monitored or polled in real time. When a node activation command is received, a synchronous sampling channel with the field equipment is immediately established. A high-precision industrial electronic scale and a flow meter of an intelligent water supply device are driven in parallel. Continuous gravity sensing values ​​of the weighing tray and cumulative pulse counts of the flow meter are collected at a preset sampling frequency (e.g., 100 Hz). An internal clock synchronization unit maps the collected sensing values ​​and pulse counts to a nanosecond-level timestamp coordinate axis, performs timestamp alignment, and generates a raw material metering data stream containing the time dimension. As shown in Table 1, gravity sensing values ​​at continuous time points were collected.

[0072] Table 1 Sample table of raw data during the material collection phase ;

[0073] As shown in Table 1, the data stream faithfully records the numerical changes from standby to feeding and then to water addition, including transient fluctuations caused by mechanical shock.

[0074] The outlier noise removal submodule targets the gravity sensing portion of the raw material metering data stream. It constructs multiple random binary isolation trees, recursively divides the data space into subspaces by randomly selecting split points, calculates the average path length from the root node to the corresponding leaf node for each sample point, assesses its isolation degree, removes transient outliers with an average path length less than a preset threshold, calculates the arithmetic mean of the remaining steady-state data, and generates an effective net weight value.

[0075] The method for setting the distance offset threshold includes: based on historical benchmark data collected by the device under steady-state conditions, by constructing a probability density model of the path length distribution, the boundary value of the maximum confidence interval of the mechanical vibration noise in the model is selected as the distance offset threshold.

[0076] For the gravity sensing portion of the raw material metering data stream, an isolated forest algorithm is loaded to remove non-realistic data caused by operational jitter. First, a forest structure consisting of 100 random binary isolation trees is constructed in memory. The data space is recursively divided into subspaces by randomly selecting feature splitting points. The average path distance from the root node to the leaf node for each sample point is calculated, and this distance is used to assess the isolation level of the sample point. Logically, the shorter the path distance, the easier it is for the sample point to be isolated, i.e., it is outlier noise. The calculated average path distance is compared with a preset distance offset threshold, filtering out transient outliers with path distances less than the threshold (such as the 1850.45g surge data at time index 40 in Table 1). Based on 1000 sets of historical benchmark sampling data of the equipment under steady-state conditions, a probability density model of the path length distribution is constructed, and the boundary value of the maximum confidence interval (e.g., 99% confidence level) corresponding to the mechanical vibration noise in the model is selected as the distance offset threshold. For example, if the threshold is calculated to be 0.65, outliers with a path score of 0.4 are removed, and the arithmetic mean is performed on the remaining steady-state data to generate a high-confidence effective net weight value.

[0077] The process compliance verification submodule calls the prescription database to obtain the standard feed amount and allowable fluctuation range, calculates the difference ratio between the effective net weight value and the standard feed amount, and determines whether the difference ratio is within the allowable fluctuation range. If the verification passes, the compliance flag is set to true; if the verification fails, the specific deviation overflow amount is recorded, and a material compliance judgment result including verification status and deviation data is constructed.

[0078] The method for determining the allowable fluctuation range includes: by parsing the pharmacopoeia standard metadata corresponding to the drug category in the electronic prescription, extracting the prescribed weight difference limit coefficient, multiplying the weight difference limit coefficient with the theoretical standard dose specified in the prescription, and establishing the dynamic positive and negative deviation range centered on the standard dose as the allowable fluctuation range;

[0079] Based on the drug ID, the corresponding standard feed quantity and allowable fluctuation range are obtained. The difference ratio calculation logic is executed, subtracting the standard feed quantity from the effective net weight, taking the absolute value, and then dividing by the standard feed quantity to obtain the actual deviation rate. Subsequently, it is determined whether this deviation rate is within the allowable fluctuation range. The process of setting the allowable fluctuation range involves parsing the pharmacopoeia standard metadata corresponding to the drug category in the electronic prescription, extracting the specified weight difference limit coefficient (e.g., 5%), multiplying the weight difference limit coefficient by the theoretical standard dose specified in the prescription (e.g., 500 grams), and establishing a dynamic positive and negative deviation range centered on the standard dose (i.e., ±25 grams) as the allowable fluctuation range. If the verification passes, the compliance flag is set to true; if the verification fails, the specific deviation overflow is recorded, constructing a material compliance judgment result including the verification status and deviation data.

[0080] Please see Figure 2 and Figure 5 The temperature control state evolution module includes:

[0081] The temperature control monitoring start-up submodule activates the immersion thermal probe of the intelligent decoction equipment based on the compliance Boolean flag in the material compliance judgment result, collects thermodynamic temperature readings below the liquid surface, performs time-series index alignment and discretization processing on continuous readings, and constructs real-time temperature time-series data including timestamps and temperature amplitudes.

[0082] When a true flag is detected, a command is sent to activate the immersion thermal probe of the intelligent decoction device. Thermodynamic temperature readings below the liquid surface are acquired at a frequency of once per second. The continuous readings are then subjected to time-series indexing and discretization processing to convert the analog signal into a digital signal, constructing real-time temperature time-series data including timestamps and temperature amplitudes. For example, the generated data sequence is {(second 1, 25.0℃), (second 2, 28.5℃)...}.

[0083] The curve fitting deviation calculation submodule reads the pre-stored standard decoction process baseline curve, dynamically normalizes and maps the real-time temperature time series data to the baseline curve on the time axis, using the formula:

[0084] ;

[0085] Calculate the similarity distance between process curves;

[0086] in, Represents the distance between similarity curves of the process. The time window length of the sampling sequence is obtained by counting the total number of valid sampling points. The normalized value representing the actual temperature at the k-th sampling point is obtained by dividing the real-time temperature reading by the system's maximum range. The normalized reference temperature value representing the k-th sampling point is obtained by analyzing the corresponding node values ​​of the standard process curve and normalizing them. The normalized coefficient representing the variance of ambient background noise is obtained by calculating the sensor's noise floor variance under no-load conditions and comparing it with a benchmark value. The normalized value of the factor affecting the specific heat capacity of the medicinal liquid was obtained by consulting the physical property database of medicinal materials and performing dimensionless mapping. The normalized deviation of the temperature change rate at the k-th sampling point is obtained by calculating the absolute value of the difference between the normalized temperature values ​​at adjacent time points.

[0087] The real-time temperature time-series data and the reference curve are dynamically normalized and mapped on the time axis. First, the total number of valid sampling points is counted to determine the time window length of the sampling sequence. For each sampling point within the time window, its actual temperature normalized value and reference temperature normalized value are obtained. The actual temperature normalized value is calculated by dividing the real-time acquired temperature reading by the system's maximum range (e.g., 150℃); the reference temperature normalized value is obtained by analyzing the node values ​​of the standard process curve at the corresponding time and performing the same normalization process. The difference between the actual temperature normalized value and the reference temperature normalized value is calculated, squared, and then an environmental background noise variance normalization coefficient is added. The environmental background noise variance normalization coefficient is calculated by comparing the sensor noise floor variance under no-load conditions with the reference value (e.g., a value of 0.002). Next, the square root of the above sum is taken, and the result is divided by the reference temperature normalized value to obtain the basic deviation term. Simultaneously, a normalized value for the specific heat capacity influence factor of the medicinal liquid is introduced. The square root of this value is taken as its reciprocal and used as a thermodynamic correction weight. This normalized value is obtained by consulting a database of medicinal material physical properties and performing dimensionless mapping (e.g., a value of 1.1). The basic deviation term is multiplied by this thermodynamic correction weight. Furthermore, the absolute value of the difference between the normalized temperature values ​​at adjacent time points is calculated to obtain the normalized deviation of the temperature change rate. Finally, the weighted deviation term is added to the normalized deviation of the temperature change rate, and the calculation results for all sampling points are accumulated to calculate the process curve similarity distance.

[0088] The process state evolution determination submodule obtains the process curve similarity distance and compares it with the preset process convergence tolerance threshold. If the process curve similarity distance is less than the process convergence tolerance threshold, the physical decoction process is confirmed to be completed. The process status code and fitting residual value of the current time node are extracted to generate stage evolution instructions.

[0089] The specific method for setting the process convergence tolerance threshold is as follows: retrieve the real-time temperature time series data of historical qualified batches, use the similarity distance set of historical batches relative to the standard decoction process baseline curve, perform statistical distribution fitting on the set, obtain the mean and variance of the distance distribution, and use the sum of the mean and the preset multiple standard deviation as the process convergence tolerance threshold.

[0090] The similarity distance of the process curves calculated in the previous steps is read from the memory bus. This value is a double-precision floating-point number. The dynamic threshold calculation logic is initiated, and a query request is sent to the historical database to retrieve the cooking process data of 1000 batches marked as "quality inspection qualified" within the past 3 months. The similarity distance values ​​of these historical batches relative to the standard cooking process baseline curve are extracted to construct a historical sample set containing 1000 floating-point numbers. Statistical distribution fitting operations are performed on this historical sample set to determine the current judgment benchmark. The specific operation process is as follows: First, the accumulation register is initialized. Each value in the set is traversed, and each value is accumulated and divided by the total number of samples, 1000, to calculate the mean of the distance distribution. For example, when the total sum of the sample set is 15000.0, the calculated mean is 15.0. Next, the standard deviation is calculated. The set is traversed again, and the difference between each sample value and the mean is calculated. The difference is squared, and the sum of the squares of all differences is accumulated. The result is divided by the total number of samples, 1000, and the square root is taken to obtain the standard deviation of the distance distribution. The calculated standard deviation is set to 2.0. Then, the configuration parameters are called to obtain a preset multiplier (e.g., 3). The standard deviation is multiplied by this multiplier to obtain the deviation tolerance value. Finally, the mean and the deviation tolerance value are added to generate the final process convergence tolerance threshold. For example, adding the mean of 15.0 to the deviation tolerance value of 6.0 (i.e., 2.0 multiplied by 3) yields a threshold of 21.0. After obtaining the threshold, the process curve similarity distance of the current batch and the process convergence tolerance threshold are sent to a numerical comparator. The comparator performs a floating-point subtraction operation to calculate the difference between the distance value and the threshold. If the difference is negative, meaning the distance value is strictly less than the threshold, the logic gate outputs a high-level signal, confirming that the physical cooking process has statistically converged to the standard state, and the process is considered complete. An information extraction instruction is then triggered to read the status code register corresponding to the current system clock, obtain the code representing the completion status (e.g., hexadecimal 0x0F), and retain the distance value generated during the comparison process as the fitting residual. The state code, fitting residual, and current timestamp are packaged into binary to generate a stage evolution instruction containing the target state code, process duration, and curve fitting score.

[0091] Please see Figure 2 and Figure 6 The timing logic anchoring module includes:

[0092] The instruction parsing and hash extraction submodule, based on the stage evolution instruction, parses the instruction message to extract the process status code and the fitted residual value, calls the local ledger interface to obtain the tail hash value of the latest block height, and assembles the status code, residual value and tail hash value according to a predetermined format to generate the state change payload to be verified.

[0093] The system receives stage evolution instructions via an internal message queue and initiates a message parser to deconstruct the binary stream of the instructions. Following a predefined TLV (Type-Length-Value) protocol, the parser reads the type field in the instruction header to confirm the data category. Then, based on the length field, it locates and extracts the process status code (e.g., 0x0F) and the fitted residual value (e.g., 3.5). Next, it establishes a read-only connection to the local ledger database, calls the blockchain node's API interface to request the current main chain's metadata information, reads the latest block height parameter, and locates the block header region of the latest block using this height index. It then directly reads the tail hash value stored in the block header. This hash value is a 256-bit hexadecimal string used to uniquely identify the previous block. After obtaining the above data, the payload assembly process is initiated. The program allocates a contiguous buffer in memory. First, it converts the extracted process state code into a corresponding byte sequence and writes it to the beginning of the buffer. Next, it converts the fitted residual value into an IEEE 754 standard floating-point number throttle and writes it immediately afterward. Finally, it appends the obtained tail hash value to the end of the buffer as a byte array. Serialization is performed on the data in the buffer using a recursive length prefix encoding rule, merging these three parts into a compact byte stream. This byte stream is the data entity to be uploaded to the blockchain. It is marked to generate a state change payload containing a state change payload, a preceding hash reference, and reserved bits for node signature credentials.

[0094] The temporal logic integrity verification submodule extracts the tail hash value as the parent node index for the state change load to be verified, calculates the combined digest of the tail hash value and the state code, queries the pre-set directed acyclic graph of state transitions to confirm the legality of the transition, verifies the monotonically increasing characteristic of the timestamp, and generates a logical consistency verification certificate.

[0095] The payload of the state change to be verified is read and deserialized to separate the tail hash value, state code, and fitting residual. The extracted tail hash value is used as the parent node index key and retrieved from the locally maintained directed acyclic graph (DAG) cache of state transitions. The DAG records all allowed state transition paths. The process state node corresponding to the preceding block represented by the tail hash value is located, and it is checked whether the list of successor nodes pointed to by this node contains the currently extracted state code. For example, if the preceding state is "cooking in progress" and the current state is "cooking completed", and there is a directed edge in the DAG from "cooking in progress" to "cooking completed", then the transition path is considered valid. Subsequently, a time-dimensional logical verification is performed. The generation timestamp embedded in the payload is read, and the confirmation timestamp of the parent block is queried through the parent node index. An integer comparison operation is performed to verify whether the payload timestamp is strictly greater than the parent block timestamp. If the greater-than relationship is satisfied, and the difference between the two is within a preset reasonable time window (e.g., 1 hour), then the time-series logic is considered normal. To ensure the data has not been tampered with, the status code is further concatenated with the tail hash value. A SHA-3 digest operation is then performed on the concatenated data to generate a temporary logical check digest. This digest is compared with the metadata in the payload; if they match, it indicates internal logical consistency. After all verification steps pass, a structure containing a verification pass flag, a verification time point, and a digest value is generated in memory, thus generating a logical consistency verification credential containing check bits, a timestamp, and digest information.

[0096] The signature encapsulation and block construction submodule, based on the logical consistency verification certificate, calls the node private key module to perform elliptic curve signature operation on the state change data, calculates the Merkle tree root node hash including the signature and payload, fills the root node hash into the block header and data area, and generates a block body that has passed verification.

[0097] The node's private key from the hardware security module is loaded, and the state change data to be added to the chain (including state encoding, residuals, timestamps, etc.) is input into the Elliptic Curve Digital Signature Algorithm (ECDSA) engine. The engine uses the secp256k1 elliptic curve parameter and performs scalar multiplication on the hash digest of the data using the private key to generate a digital signature containing r and s values. For example, the generated signature is a combination of two 256-bit integers. Subsequently, the Merkle tree construction logic is initiated. Since the current block may contain this node's transaction as well as other transactions to be packaged from the mempool, the hash values ​​of these transaction data are used as leaf nodes. Leaf hashes are paired in pairs, and each pair of hash values ​​is concatenated and subjected to a double SHA-256 operation to generate the parent node hash. This process is executed recursively until a unique Merkle tree root node hash is calculated. Then, a new block object is instantiated in memory, and the block header information is filled in. The protocol version number is written to the version field, the verified tail hash value is written to the parent hash field, the calculated Merkle root is written to the root hash field, and the current timestamp is written to the time field. Simultaneously, the generated digital signature and the original state change payload are filled into the data area of ​​the block body. After assembly, the entire block structure is serialized to generate a binary data packet containing a complete block header and block body, i.e., the verified block body;

[0098] Please see Figure 2 and Figure 7 The consensus and evidence storage interaction module includes:

[0099] The network consensus verification submodule distributes the verified block body to the consortium blockchain verification node set through the P2P network interface, drives each node to perform integrity verification on the Merkle root in the block header and perform parallel signature verification on the transaction signature, collects the digital signature endorsements returned by the nodes, and when the cumulative number of valid endorsements exceeds the preset consensus threshold, it confirms that the network state has reached a consensus and generates a network-wide consensus confirmation certificate.

[0100] Using a P2P network protocol stack, verified blocks are encapsulated into network message packets and broadcast to the set of verification nodes in the consortium blockchain via the Gossip protocol. Simultaneously, a listening port is opened to await verification feedback from other nodes. Upon receiving the block, other verification nodes independently execute verification logic: first, they parse the block header to verify the existence of the parent hash; second, they recalculate the Merkle root to verify transaction integrity; and finally, they extract the digital signature from the block and perform ECDSA signature verification using the publishing node's public key. Verified nodes generate an endorsement message containing their digital signature. These returned endorsement messages are collected and verified in real time and stored in a temporary consensus pool. An internal counter is maintained; each valid endorsement from a different node is received, and the counter is continuously compared to a preset consensus threshold. The consensus threshold is calculated using the PBFT consensus algorithm, specifically two-thirds of the total number of nodes in the network, rounded up. For example, if there are 4 nodes in the network, the threshold is 3. When the counter value reaches or exceeds the threshold, the network confirms that it has reached a consensus on the block, packages all the collected valid endorsement signatures, and generates a network consensus confirmation certificate containing a list of node signatures, consensus rounds, and a marked token.

[0101] The ledger persistence writing submodule triggers the local ledger update process based on the network consensus confirmation certificate, writes the verified block data into the persistent storage area of ​​the distributed file system, establishes a mapping index between block hash and physical storage offset in the state database, performs an increment operation on the latest block height parameter of the current blockchain, and generates on-chain ledger index metadata.

[0102] Upon receiving the network-wide consensus confirmation credential, an atomic write process is triggered in the local ledger. First, the verified block body and the network-wide consensus confirmation credential are merged to form the final block data structure. The file system interface is then called to write this data structure to the block data file on disk (e.g., blk0001.dat) in append mode, recording the starting byte offset and length of the write operation. After writing, the LevelDB key-value database is updated with index information. Using the block's hash value as the key and its filename, offset, and length in the file system as the value, a Put operation is performed to establish a mapping from hash to physical location. Simultaneously, the latest block hash value is updated to the value of the "LastBlockHash" key, and the chain height parameter is incremented. For example, the height is updated from 100 to 101. To ensure data consistency, the above database operations are executed in an atomic batch. When the database write returns successfully, the blockchain state cache in memory is updated, a successful block write event is broadcast, and on-chain ledger index metadata containing the latest block height, block hash, and storage address index is generated.

[0103] The rights locking and evidence storage submodule calls the smart contract virtual machine to load the on-chain accounting index metadata, locates the corresponding order rights control variable, forcibly flips the execution permission flag of the refund function to a frozen state, extracts the block header hash value, consensus timestamp and permission change log for structured encapsulation, and generates an immutable traceability record.

[0104] The Ethereum Virtual Machine (EVM) or a homogeneous contract engine is launched. Based on the block hash in the metadata, the order transaction information contained in the block is located, the order ID in the transaction is extracted, and the corresponding order equity control object is found in the contract's state tree. A state change transaction is constructed, and the equity management function in the contract is called. This function internally performs logical judgments, checking whether the current block height has been confirmed. If confirmed, it modifies the "refund permission" flag in the order object through underlying storage instructions. Specifically, the boolean value of this flag is forcibly flipped from "True" (executable) to "False" (frozen), thus locking the refund function at the code level and preventing malicious refunds after the process is completed. After the contract execution is complete, the state change logs generated during execution are captured. The hash value of the block header, the physical timestamp of the network-wide consensus, and the previously generated permission change logs are structured and encapsulated. Following the JSON format standard, this data is organized into an immutable evidence package containing key information such as the block height index, consensus confirmation count, and equity lock status, ultimately generating an immutable traceability record. As shown in Table 2, this record details the key information after locking.

[0105] Table 2 Details of Rights Lock-up Tracing Records ;

[0106] As shown in Table 2, by combining the above parameters, the system realizes digital ownership confirmation and permanent locking of the physical process results.

[0107] Please see Figure 8 A blockchain-based collaborative traceability method for the entire process of traditional Chinese medicine decoction processing, the method being used to implement the aforementioned blockchain-based collaborative traceability system for the entire process of traditional Chinese medicine decoction processing, includes the following steps:

[0108] S1: Receive electronic prescription information from the hospital terminal, parse the drug category and dosage data, generate a unique order hash identifier, construct an initial process state vector corresponding to the unique order hash identifier, set the initial process state vector to the pending start state, and obtain the process timing mark to be activated.

[0109] S2: Based on the time sequence marker of the process to be activated, collect the weight value of the weighing equipment, call the isolated forest algorithm to detect outliers in the weight value to remove noise, compare the weight with the preset range, and generate the material compliance judgment result.

[0110] S3: Based on the material compliance judgment result, collect temperature time series data in real time, call the dynamic time warping algorithm to calculate the distance between the temperature time series data and the standard curve, and when the distance value is less than the set threshold, determine that the physical process is completed and generate the stage evolution instruction.

[0111] S4: Parse the evolution instructions, obtain the hash of the previous state on the chain, verify the logical continuity between the current state and the hash of the previous state, execute the consensus mechanism to confirm the state change request, and generate a block body that has passed the verification.

[0112] S5: The block body that passes the broadcast verification is confirmed by the consensus mechanism for the state change request. The confirmed data is written into the latest block of the distributed ledger, the refund permission is locked, and an immutable traceability record is generated.

[0113] It should be understood that the term "and / or" in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. A and B can be singular or plural. Additionally, the character " / " in this article generally indicates an "or" relationship between the preceding and following related objects, but it can also represent an "and / or" relationship. Please refer to the context for a more accurate understanding.

[0114] In this invention, "at least one" means one or more, and "more than one" means two or more. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of a single item or a plurality of items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, and c can be a single item or multiple items.

[0115] It should be understood that, in various embodiments of the present invention, the order of the above-mentioned process numbers does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0116] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0117] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the devices, apparatuses, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0118] In the several embodiments provided by this invention, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0119] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0120] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0121] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0122] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of protection of the technical solution.

Claims

1. A blockchain-based collaborative traceability system for the entire process of traditional Chinese medicine decoction, characterized in that, The system includes: The order mapping initialization module obtains electronic prescription information from the hospital terminal, parses the drugs and dosages, generates a unique order hash identifier, constructs an initial process state vector that maps to the unique order hash identifier, marks the initial process state vector as to be started, and obtains the process timing marker to be activated. The material boundary determination module, based on the time sequence marker of the process to be activated, collects the weight of the weighing equipment, calls the isolated forest algorithm to remove noise from the weight, compares the weight with the preset range, and generates a material compliance determination result. The temperature control status evolution module, based on the material compliance judgment result, collects temperature time series data in real time, calls the dynamic time warping algorithm to calculate the distance between the temperature time series data and the standard curve, judges the completion status of the physical process, and generates stage evolution instructions. The timing logic anchoring module parses the stage evolution instructions, obtains the hash of the previous state on the chain, verifies the logical continuity between the current state and the hash of the previous state, constructs a signed state change request, and generates a block body that has passed the verification. The consensus-based evidence storage interaction module broadcasts the verified block, confirms the state change request through the consensus mechanism, writes the data to the latest height of the ledger, locks the refund permission, and generates an immutable traceability record.

2. The blockchain-based collaborative traceability system for the entire process of traditional Chinese medicine decoction as described in claim 1, characterized in that, The process timing marker to be activated includes a node index bit, a permission control mask, and a creation timing stamp. The material compliance judgment result includes a net weight deviation value, a feeding ratio parameter, and a compliance Boolean flag. The stage evolution instruction includes a target state code, a process duration quantity, and a curve fitting score. The verified block body includes a state change payload, a preceding hash reference, and a node signature credential. The tamper-proof traceability record includes a block height index, a consensus confirmation count, and a stake lock status.

3. The blockchain-based collaborative traceability system for the entire process of traditional Chinese medicine decoction as described in claim 1, characterized in that, The order mapping initialization module includes: The prescription parsing and identifier generation submodule receives a pre-set electronic prescription data stream from the hospital terminal interface, unpacks the data stream to extract the drug category code sequence and the corresponding dosage value set for each category, combines the drug category code sequence and dosage value set into a standardized feature byte string according to a preset serialization protocol, performs encrypted hash operation on the feature byte string to obtain a fixed-length hexadecimal digest character, and generates a unique order hash identifier. The on-chain space mapping construction submodule, based on the unique order hash identifier, applies for independent storage space in the consortium blockchain distributed ledger network through the smart contract interface, constructs a structured data container with a unique correspondence to the unique order hash identifier, defines the field dimensions of timestamp, operator ID and status code inside the container according to the standard physical process division logic of traditional Chinese medicine decoction, and generates an initial process status mapping vector. The state timing anchoring initialization submodule calls the state machine control logic to initialize the node bits inside the vector for the initial process state mapping vector, marks the first node of the initial process state mapping vector as a logically active state, and uses a mutex lock mechanism to lock the write permissions of all subsequent process nodes, generating a process timing mark to be activated.

4. The blockchain-based collaborative traceability system for the entire process of traditional Chinese medicine decoction as described in claim 3, characterized in that, The material boundary determination module includes: The real-time material parameter acquisition submodule, based on the time sequence mark of the process to be activated, responds to the node activation command in the initial process state mapping vector, establishes a synchronous sampling channel, drives the weighing equipment and water addition device to collect the continuous gravity sensing value of the weighing tray and the cumulative pulse count of the flow meter in parallel, aligns the sensing value and the pulse count with timestamps, and generates the original material metering data stream. The outlier noise cleaning submodule constructs a random binary isolation tree group for the gravity sensing part of the original material metering data stream. It recursively divides the data space into subspaces by randomly selecting split points, calculates the average path distance of sample points from the root node to the leaf node, evaluates its isolation degree, filters out transient outliers whose average path distance is less than a preset distance offset threshold, and calculates the arithmetic mean of the remaining steady-state data to generate an effective net weight value. The process compliance verification submodule accesses the prescription database to obtain the standard feed amount and allowable fluctuation range, calculates the difference ratio between the effective net weight value and the standard feed amount, determines whether the deviation rate is within the allowable fluctuation range, and sets the compliance flag to True if the verification passes. If the verification fails, it records the specific deviation overflow amount and constructs the material compliance judgment result.

5. The blockchain-based collaborative traceability system for the entire process of traditional Chinese medicine decoction as described in claim 4, characterized in that, The process of setting the distance offset threshold is as follows: based on the historical benchmark sampling data of the device in a steady-state environment, a probability density model of the path length distribution is constructed, and the boundary value of the maximum confidence interval of the mechanical vibration noise in the model is selected as the distance offset threshold. The process of setting the allowable fluctuation range is as follows: by parsing the pharmacopoeia standard metadata corresponding to the drug category in the electronic prescription, the prescribed weight difference limit coefficient is extracted, and the weight difference limit coefficient is multiplied with the theoretical standard dose specified in the prescription to establish the dynamic positive and negative deviation range centered on the standard dose as the allowable fluctuation range.

6. The blockchain-based collaborative traceability system for the entire process of traditional Chinese medicine decoction as described in claim 4, characterized in that, The temperature control state evolution module includes: The temperature control monitoring start-up submodule activates the immersion thermal probe of the intelligent decoction equipment based on the compliance Boolean flag in the material compliance judgment result, collects thermodynamic temperature readings below the liquid surface, performs time-series index alignment and discretization processing on continuous readings, and constructs real-time temperature time-series data including timestamps and temperature amplitudes. The curve fitting deviation calculation submodule calls the preset standard decoction process reference curve, dynamically normalizes and maps the real-time temperature time series data and the reference curve on the time axis, and calculates the process curve similarity distance. The process state evolution determination submodule obtains the process curve similarity distance and compares it with a preset process convergence tolerance threshold. If the process curve similarity distance is less than the process convergence tolerance threshold, the physical decoction process is confirmed to be completed. The process status code and fitting residual value of the current time node are extracted, and a stage evolution instruction is generated.

7. The blockchain-based collaborative traceability system for the entire process of traditional Chinese medicine decoction as described in claim 6, characterized in that, The specific method for setting the process convergence tolerance threshold is as follows: retrieve the real-time temperature time series data of historical qualified batches, use the similarity distance set of historical batches relative to the standard decoction process baseline curve, perform statistical distribution fitting on the set, obtain the mean and variance of the distance distribution, and use the sum of the mean and the preset multiple standard deviation as the process convergence tolerance threshold.

8. The blockchain-based collaborative traceability system for the entire process of traditional Chinese medicine decoction as described in claim 6, characterized in that, The timing logic anchoring module includes: The instruction parsing and hash extraction submodule, based on the stage evolution instruction, parses the instruction message to extract the process status code and the fitted residual value, calls the local ledger interface to obtain the tail hash value of the latest block height, and assembles the status code, residual value and tail hash value in a predetermined format to generate the state change payload to be verified. The temporal logic integrity verification submodule extracts the tail hash value as the parent node index for the state change load to be verified, calculates the combined digest of the tail hash value and the state code, queries the preset directed acyclic graph of state transitions to confirm the legality of the transition, verifies the monotonically increasing characteristic of the timestamp, and generates a logical consistency verification certificate. The signature encapsulation and block construction submodule, based on the logical consistency verification certificate, calls the node private key module to perform elliptic curve signature operation on the state change data, calculates the Merkle tree root node hash including the signature and payload, fills the root node hash into the block header and data area, and generates a block body that has passed verification.

9. The blockchain-based collaborative traceability system for the entire process of traditional Chinese medicine decoction as described in claim 8, characterized in that, The consensus and evidence storage interaction module includes: The network consensus verification submodule distributes the verified block body to the consortium blockchain verification node set through a P2P network interface, drives each node to perform integrity verification on the Merkle root in the block header and perform parallel signature verification on the transaction signature, collects the digital signature endorsements returned by the nodes, and when the cumulative number of valid endorsements exceeds the preset consensus threshold, it confirms that the network state has reached a consensus and generates a network-wide consensus confirmation certificate. The ledger persistence writing submodule triggers the local ledger update process based on the network consensus confirmation certificate, writes the verified block data into the persistent storage area of ​​the distributed file system, establishes a mapping index between block hash and physical storage offset in the state database, increments the latest block height parameter of the current blockchain by one, and generates on-chain ledger index metadata. The rights locking and evidence storage submodule calls the smart contract virtual machine to load the on-chain accounting index metadata, locates the corresponding order rights control variable, forcibly flips the execution permission flag of the refund function to a frozen state, extracts the block header hash value, consensus timestamp and permission change log for structured encapsulation, and generates an immutable traceability record.

10. A blockchain-based collaborative traceability method for the entire process of traditional Chinese medicine decoction, characterized in that, The method is used to implement the blockchain-based collaborative traceability system for the entire process of traditional Chinese medicine decoction as described in any one of claims 1-9, and includes the following steps: S1: Obtain electronic prescription information from the hospital terminal, parse the drug and dosage, generate a unique order hash identifier, construct an initial process state vector that maps to the unique order hash identifier, mark the initial process state vector as to be started, and obtain the process timing marker to be activated. S2: Based on the time sequence marker of the process to be activated, collect the weight of the weighing equipment, call the isolated forest algorithm to remove noise from the weight, compare the weight with the preset range, and generate the material compliance judgment result; S3: Based on the material compliance judgment result, collect temperature time series data in real time, call the dynamic time warping algorithm to calculate the distance between the temperature time series data and the standard curve, judge the physical process completion status, and generate stage evolution instructions; S4: Parse the stage evolution instructions, obtain the hash of the previous state on the chain, verify the logical continuity between the current state and the hash of the previous state, construct a signed state change request, and generate a block body that has passed the verification. S5: Broadcast the verified block, confirm the state change request through the consensus mechanism, write the data to the latest height of the ledger, lock the refund permission, and generate an immutable traceability record.