Prescription processing method, device and equipment and readable storage medium
By systematically scheduling counter resources, the system has achieved automated and intelligent management of multiple prescriptions in the logistics of traditional Chinese medicine, significantly reducing the time-consuming manual search, preventing omissions or scattered outbound shipments that lead to manual searching and resource waste, and improving the accuracy and efficiency of drug delivery.
Patent Information
- Application Number
- CN202511801392.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-02
- Publication Date
- 2026-03-03
AI Technical Summary
In the current process of traditional Chinese medicine logistics, the manual order processing is inefficient, prone to errors, and chaotic on-site management due to the multiple prescriptions being issued separately. It is difficult to achieve automatic association and centralized management of multiple prescriptions for the same patient, which affects the safety and efficiency of drug delivery.
By receiving the prescription identifier of the target prescription, obtaining prescription merging relationship information and medicine cabinet resource information, dynamically allocating the target medicine cabinet, sending a placement request to establish a placement record, and sequentially allocating associated cabinets to other prescriptions belonging to the same merging identifier according to the prescription merging relationship information and establishing placement records, until the merging completion conditions are met, generating status information that the merging operation has been completed, thus realizing automated and intelligent management and control of multiple prescription merging.
It has achieved automated and intelligent management of multiple prescriptions in the logistics of traditional Chinese medicine, significantly reducing the time spent on manual searching and merging, reducing the risk of human errors such as mismatch and omission, and improving the accuracy of drug delivery and service response speed.
Smart Images

Figure CN121601183A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of pharmaceutical information processing technology, and in particular to a prescription processing method, apparatus, device, and readable storage medium. Background Technology
[0002] Traditional Chinese medicine (TCM) services, a significant Lingnan specialty in Guangdong Province, have seen increasingly diverse prescription formats in recent years due to the diversification of health management needs. These formats encompass various dosage forms, including small-packaged decoction pieces, prepared herbal medicines, proprietary Chinese medicines, and external applications. In actual production and distribution processes, different dosage forms are typically prepared and shipped separately by independent processing departments. This results in multiple prescriptions for the same patient often being completed at different times and entering the logistics chain sequentially. To ensure the integrity of patients' medication use, all relevant prescriptions must be combined and packaged together before shipment. Currently, this process primarily relies on manual identification and retrieval of corresponding medications for order consolidation.
[0003] Due to the lack of a systematic order merging management mechanism, the manual order merging process is easily affected by peak-hour operational pressure, resulting in problems such as long search times, disorganized on-site placement, and frequent mis- and missing prescriptions. Especially during peak order periods, the risk of mixed medications increases significantly, seriously affecting the safety and efficiency of drug delivery. The existing model struggles to achieve automatic association and centralized management of multiple prescriptions for the same patient, and cannot accurately locate the status and physical location of each prescription, leading to weak logistics coordination capabilities and low overall outbound efficiency. This has become a key bottleneck restricting the efficient operation of smart pharmacies. Summary of the Invention
[0004] In view of this, embodiments of this application provide a prescription processing method, apparatus, device, and readable storage medium, which can effectively solve the technical problems of low efficiency, error-proneness, and chaotic on-site management caused by multiple prescriptions being issued separately in the existing Chinese medicine logistics process.
[0005] In a first aspect, embodiments of this application provide a prescription processing method, including: Based on the prescription identifier of the target prescription, obtain the prescription merging relationship information and medicine cabinet resource information corresponding to the prescription identifier; Based on the medicine cabinet resource information, the target medicine cabinet is determined, and a placement request is sent to establish a placement record corresponding to the target prescription. Based on the prescription merging relationship information, the target medicine cabinets for the remaining prescriptions that are under the same merging identifier as the target prescription are determined in sequence and a placement record is established until the merging completion conditions are met; When the conditions for merging are met, status information indicating that the merging operation has been completed is generated.
[0006] In some embodiments, obtaining prescription merging relationship information and pharmacy resource information corresponding to the prescription identifier of the target prescription includes: Send a query request based on the prescription identifier to the combined prescription unit, and receive the combined prescription unit's returned information on the merge identifier associated with the prescription identifier, the size of the prescription set, and available pharmacy cabinet resources.
[0007] In some embodiments, determining the target medicine cabinet based on the medicine cabinet resource information and sending a placement request to establish a placement record corresponding to the target prescription includes: Obtain available medicine cabinet resource information from the medicine cabinet resource information, and receive the user's cabinet selection instruction based on the available medicine cabinet resource information; Send a placement request containing the prescription identifier and the cabinet selection instruction to the cabinet placement update unit, and after receiving the placement confirmation result returned by the cabinet placement update unit, establish a placement record corresponding to the prescription identifier.
[0008] In some embodiments, the step of determining the target pharmacy cabinet and establishing a placement record for the remaining prescriptions with the same merger identifier as the target prescription based on the prescription merger relationship information, until the merger completion conditions are met, includes: Based on the prescription merging relationship, identify the set of unplaced prescription identifiers under the merging identifier; For each set of prescriptions that have not been placed, obtain the corresponding medicine cabinet resource information; The system receives the user's counter selection instruction and sends a placement request, including the prescription identifier and the corresponding counter selection instruction, to the counter update unit until all prescriptions in the set of unplaced prescription identifiers have been processed.
[0009] In some embodiments, generating status information indicating that the merge operation has been completed when the merge completion condition is met includes: A merge completion event is generated after all prescriptions associated with the merge identifier have completed their placement records. In response to the merge completion event, a completion confirmation request containing the merge identifier is sent to the merge prescription unit; The system receives the processing result returned by the prescription unit and indicates the status information that the merging operation has been completed based on the processing result.
[0010] In some embodiments, after the status information indicating that the merging operation has been completed, the method further includes: Resource release processing is performed on the counters corresponding to each prescription under the merged identifier to release the locked and occupied state of the counters.
[0011] In some embodiments, it also includes: If sending a placement request to the cabinet update unit fails, a retry will be performed after a preset time interval until a successful response is received. Before each retry, retrieve the latest medicine cabinet resource information to ensure that the target medicine cabinet is available.
[0012] Secondly, embodiments of this application provide a drug processing apparatus, comprising: The information acquisition module is used to acquire prescription merging relationship information and medicine cabinet resource information corresponding to the prescription identifier of the target prescription. The placement request module is used to determine the target medicine cabinet based on the medicine cabinet resource information and send a placement request to establish a placement record corresponding to the target prescription. The placement processing module is used to determine the target medicine cabinet and establish a placement record for the remaining prescriptions that are under the same merger identifier as the target prescription, based on the prescription merger relationship information, until the merger completion conditions are met. The status acquisition module is used to generate status information indicating that the merging operation has been completed when the merging completion conditions are met.
[0013] Thirdly, embodiments of this application provide a terminal device, the terminal device including a processor and a memory, the memory storing a computer program, and the processor executing the computer program to implement the prescription processing method of the first aspect described above.
[0014] Fourthly, embodiments of this application provide a computer-readable storage medium, wherein when the computer program is executed on a processor, it implements the prescription processing method of the first aspect described above.
[0015] The embodiments of this application have the following beneficial effects: by receiving the prescription identifier of the target prescription, obtaining the corresponding prescription merging relationship information and medicine cabinet resource information, and determining the merging identifier to which the prescription belongs; dynamically allocating the target medicine cabinet based on the medicine cabinet resource information, and sending a placement request to establish a placement record; according to the prescription merging relationship information, sequentially allocating the same or related cabinet positions to other prescriptions belonging to the same merging identifier and establishing placement records, until the merging completion condition that all related prescriptions have been placed is met; when this condition is met, generating status information indicating that the merging operation has been completed, realizing closed-loop management and status synchronization of the entire merging process. This application realizes the automated and intelligent control of multi-prescription merging in the logistics of Chinese and Western medicines, significantly reducing manual search and merging time, and reducing the risk of human errors such as mismatch and omission; by systematically scheduling cabinet resources, improving the utilization rate of medicine cabinets and the efficiency of outbound packaging, and improving the chaotic situation of peak-hour operations; at the same time, it supports full traceability and query of the merging process, enhancing logistics transparency and quality control capabilities, and effectively improving the accuracy of drug delivery and service response speed. Attached Figure Description
[0016] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 A flowchart of a prescription processing method according to an embodiment of this application is shown; Figure 2 Another flowchart of the prescription processing method according to an embodiment of this application is shown; Figure 3 This paper shows another flowchart of a prescription processing method according to an embodiment of the present application; Figure 4 A schematic diagram of a prescription processing method according to an embodiment of this application is shown. Detailed Implementation
[0018] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.
[0019] The components of the embodiments of this application described and illustrated in the accompanying drawings can be arranged and designed in a variety of different configurations. Therefore, the following detailed description of the embodiments of this application provided in the drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0020] In the following text, the terms "comprising," "having," and their cognates, which may be used in various embodiments of this application, are intended only to indicate a particular feature, number, step, operation, element, component, or combination thereof, and should not be construed as primarily excluding the presence of one or more other features, numbers, steps, operations, elements, components, or combinations thereof, or adding the possibility of one or more combinations thereof. Furthermore, the terms "first," "second," "third," etc., are used only for distinguishing descriptions and should not be construed as indicating or implying relative importance.
[0021] Unless otherwise specified, all terms used herein (including technical and scientific terms) shall have the same meaning as commonly understood by one of ordinary skill in the art to which the various embodiments of this application pertain. Terms (such as those defined in commonly used dictionaries) shall be interpreted as having the same meaning as in their contextual meaning in the relevant technical field and shall not be construed as having an idealized or overly formal meaning, unless clearly defined in the various embodiments of this application.
[0022] The following detailed description of some embodiments of this application is provided in conjunction with the accompanying drawings. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0023] Considering the technical problems of low efficiency, error-proneness, and chaotic on-site management caused by the dispersed issuance of multiple prescriptions in the existing Chinese medicine logistics process, a prescription processing method is proposed. This method receives the prescription identifier of the target prescription, obtains the corresponding prescription merging relationship information and medicine cabinet resource information; dynamically allocates the target medicine cabinet based on the medicine cabinet resource information, and sends a placement request to establish a placement record; according to the prescription merging relationship information, it sequentially assigns associated cabinet positions to other prescriptions belonging to the same merging identifier and establishes placement records until all related prescriptions are placed; and generates corresponding merging status information when the merging completion conditions are met, thus realizing a systematic, centralized, and traceable closed-loop management of the multi-prescription merging process.
[0024] The following examples illustrate the method for processing prescriptions.
[0025] Figure 1 A flowchart of a prescription processing method according to an embodiment of this application is shown. Exemplarily, the prescription processing method includes the following steps: Step S100: Receive the prescription identifier of the target prescription and obtain the prescription merging relationship information and medicine cabinet resource information corresponding to the prescription identifier.
[0026] The prescription identifier refers to a unique prescription number generated by the pharmacy system (e.g., KM25070212872-1), used to accurately identify each Chinese medicine or Western medicine prescription in the system. Prescription merging relationship information includes whether the prescription belongs to a task requiring merging and delivery, the total number of prescriptions in the merging task, and how many prescriptions have already been collected. Cabinet resource information refers to the current status set of logistics cabinets available for storing prescriptions, including the code of each cabinet location, its X / Y coordinates, and its usage status (unused, in use, deactivated). Upon receiving the prescription identifier, this step initiates a query request to the merging prescription unit and determines whether the prescription needs to participate in the merging operation based on the returned results. By identifying merging requirements, it avoids the inefficiency and errors caused by manual searching and memorization.
[0027] In an optional embodiment, step S100 includes the following sub-steps: Send a query request based on the prescription identifier to the combined prescription unit, and receive the combined prescription unit's return information on the merge identifier associated with the prescription identifier, the size of the prescription set, and the available pharmacy cabinet resources.
[0028] The order merging unit is responsible for managing whether orders are merged, including maintaining the "prescription merging table" (dyf_logistics_prescriptions_merge), determining whether a prescription belongs to a merging task, generating a merging identifier, and providing an external query interface. The merging identifier is a globally unique task ID (e.g., HB20250702110909SSS) assigned by the system to multiple prescriptions that need to be merged for delivery, used to logically associate multiple prescriptions for the same patient. The prescription set size information specifically refers to the total number of prescriptions to be collected under this merging task (merge_number) and the number of prescriptions that have been bound to the cabinet (has_merge_number). The available medicine cabinet resource information refers to the list of logistics cabinets that are currently "unused" and not temporarily locked, including the code, X / Y coordinates, and status information of each cabinet.
[0029] For example, when the QR code on a prescription is scanned for the first time on the logistics waybill printing interface, the prescription identifier is extracted, and a request message {"prescriid":"KM25070212872-1"} is constructed to call the logistics medicine cabinet prescription query interface; after receiving the request, the prescription unit queries the dyf_logistics_prescriptions_merge table to see if there is a record matching the prescriid. If it does, the corresponding merge_orderid (order number) is extracted. Then, using the merge_orderid as a condition, all related prescription entries are counted, resulting in merge_number=3 and has_merge_number=1; At the same time, query the dyf_logistics_cabinet_info table (cabinet information table) for logistics cabinets with a status of "0: unused", retrieve the set of locked cabinets from the Redis cache, remove them from the unused list, then randomly select a remaining cabinet as the recommended value (such as CAB-GZ-08), and set the cabinet in Redis to be locked for 10 seconds to prevent concurrent conflicts; Finally, the combined prescription unit encapsulates data such as the combined identifier, prescription set size information, recommended counter location, and list of available counter locations into a JSON response body and returns it to the system.
[0030] For example, if a patient has three prescriptions that need to be combined, when the second prescription arrives at the logistics area and is scanned, it will detect that it already has a combination task. It will then return to the location of the cabinet that the first prescription is already bound to and recommend the same cabinet, ensuring that all related prescriptions are placed in the same logistics cabinet area for easy packaging and shipping later.
[0031] Step S200: Determine the target medicine cabinet based on the medicine cabinet resource information and send a placement request to establish a placement record corresponding to the target prescription.
[0032] The information includes: Drug cabinet resource information (list of logistics cabinets in "unused" status and not temporarily locked, including the cabinet code, X / Y coordinates, and physical location distribution); target drug cabinet (selected location for storing the prescription); placement request (system command to bind prescription to specific cabinet); and placement record (data entry generated in the system to identify a prescription placed in a specific cabinet, including prescription identifier, cabinet code, and operation time). After obtaining the drug cabinet resource information, this step determines the target drug cabinet through user selection or system recommendation and sends a binding request to the cabinet update unit. Upon receiving a confirmation response, the placement status is established. This ensures accurate association between prescription and physical storage location, guaranteeing traceability and queryability for subsequent order consolidation operations.
[0033] In one alternative embodiment, such as Figure 2 As shown, step S200 includes the following sub-steps: S201: Obtain available medicine cabinet resource information from the medicine cabinet resource information, and receive the user's cabinet selection instruction based on the available medicine cabinet resource information.
[0034] Among them, available medicine cabinet resource information refers to all logistics cabinets with a status of "unused" and not locked by Redis that are filtered out from the medicine cabinet resource information, serving as a candidate list for optional placement locations; cabinet selection instruction refers to the operation signal triggered by logistics operators manually selecting a cabinet location or confirming a system-recommended cabinet location on the system interface.
[0035] For example, after receiving the cabinet resource information, the system parses the cabinetInfoList field (cabinet information list), extracts the remaining available cabinets after excluding locked cabinets from all cabinets with a status of "1: In Use", and displays them in the form of a list or grid in the "Logistics Cabinet Consolidation Management" pop-up interface, while highlighting recommended cabinets (such as CAB-GZ-08). Logistics personnel can complete the selection by clicking the corresponding cabinet option or directly confirming the recommended value; the system receives the selection action and generates a selection instruction containing the selected cabinet code.
[0036] For example, when the interface displays "A total of 3 prescriptions need to be collected, and 1 prescription has already been collected to CAB-GZ-08", the system automatically recommends the same cabinet. When the operator clicks the "OK" button, it means that the cabinet is selected as the storage location for the current prescription, and the system will then prepare to send the placement request.
[0037] S202, send a placement request containing prescription identifier and counter selection instruction to the counter update unit, and after receiving the placement confirmation result returned by the counter update unit, establish a placement record corresponding to the prescription identifier.
[0038] The cabinet update unit is the core service module in the system responsible for handling cabinet binding and status updates. Its functions include verifying the validity of the cabinet, updating the cabinet_code field in the "Logistics Prescription Merging Table", and maintaining information such as the placement time of the prescription. The placement confirmation result refers to the status feedback returned by the cabinet update unit after successfully or unsuccessfully performing the placement operation, which includes code (status code) and message (prompt information).
[0039] As an example, construct a request message, for example: {"prescriid":"KM25070212872-1","cabinet_code":"CAB-GZ-08","oper_type":"1"}, calls the logistics medicine cabinet prescription area update interface; if a success code is received, the placement status of the prescription is recorded locally as "placed in CAB-GZ-08" and displayed on the interface; if an error message is returned (such as "the logistics cabinet has been locked" or "the logistics cabinet has been deactivated"), the operator is prompted to change the cabinet location and select again. After receiving the request, the cabinet update unit queries the relevant operations center based on the prescription identifier and checks whether the cabinet is locked in Redis by combining the operations center and the cabinet code. If it is locked, it returns the error message "This logistics cabinet is locked, please change to another logistics cabinet"; if it is not locked, it further queries the dyf_logistics_cabinet_info table to confirm whether the cabinet status is "9: Deactivated". If so, it returns "This logistics cabinet is deactivated, please change to another logistics cabinet". After successful verification, the system updates the cabinet_code field of the prescription to the selected value, updates the standing_time to the current operation time, and returns a success response; after receiving the success code, the system creates a placement record for the prescription locally and refreshes the interface to display "Prescription placed in cabinet CAB-GZ-08".
[0040] For example, if a counter has been locked in a previous operation but not released in time, this request will be rejected due to lock verification failure, preventing multiple prescriptions from being mistakenly sent to the same counter and ensuring data consistency and on-site operational order.
[0041] In one optional implementation, step S202 includes: If sending a placement request to the cabinet update unit fails, a retry will be performed after a preset time interval until a successful response is received. Before each retry, the latest cabinet resource information will be retrieved to ensure that the target cabinet remains available.
[0042] Among them, "failed placement request" refers to the situation where the cabinet update unit returns a non-success status code (such as an error message indicating that the cabinet is locked or has been deactivated) or a network communication abnormality occurs after the system calls the "logistics medicine cabinet merge prescription area update interface". The preset time interval refers to the waiting time configured by the system, which is the time period during which execution is paused before each retry.
[0043] As an example, when the system receives the message "This logistics cabinet is locked, please try another logistics cabinet" after sending the placement request for the first time, it does not immediately terminate the operation. Instead, it initiates a retry mechanism, temporarily saving the current task at set time intervals (e.g., 3 seconds) and waiting for the system status to change during this period. Before the next retry, the system calls the logistics medicine cabinet prescription query interface again to obtain the latest medicine cabinet resource information and determines whether the original target medicine cabinet has been released and restored to a usable state. If it is still unavailable, the retry process continues. If it is available, the placement request is reconstructed and submitted again until a successful confirmation response is received.
[0044] For example, when a storage unit is locked in Redis due to a previous operation not releasing it in time, although the original request failed, the lock will automatically expire after a few seconds. The system will then retrieve the latest storage unit status and find that it has been restored to availability, and complete the binding operation, thus avoiding interruptions and delays caused by manual intervention.
[0045] In other implementations, the maximum number of retries for the retry mechanism can be set in the system configuration table to prevent infinite retry loops. In addition, during the retry process, the operator can be informed of the current status as "Retrying, please wait" through the interface prompts, thereby improving the transparency of the operation.
[0046] Step S300: Based on the prescription merging relationship information, determine the target pharmacy cabinet and establish a placement record for the remaining prescriptions that are under the same merging identifier as the target prescription, until the merging completion conditions are met.
[0047] The prescription merging relationship information refers to the merging task data associated with the current prescription, including all prescription entries under this task and their respective statuses of whether they have been bound to a storage location. The merging identifier is a task number used to uniquely identify a group of prescriptions to be merged and delivered (e.g., HB20250702110909SSS). All prescriptions under the same merging identifier should be grouped to the same or a designated storage location area. The placement record refers to the data entry in the system that records a prescription being placed in a specific logistics cabinet, including the prescription identifier, storage location code, and operation time. The merging completion condition means that all prescriptions corresponding to the merging identifier have successfully established placement records, i.e., all have been successfully collected. After the current prescription has been bound to a storage location, this step involves the system continuously monitoring and processing other uncollected prescriptions in the same batch to ensure that all related prescriptions are guided to the correct location. Its purpose is to ensure the integrity and consistency of the merged order and prevent omissions or scattered storage.
[0048] In one alternative embodiment, such as Figure 3 As shown, step S300 includes the following sub-steps: S301, Identify the set of unplaced prescription identifiers under the merged identifier based on the prescription merge relationship.
[0049] The set of prescriptions with unfilled labels refers to the set of prescription labels for all prescriptions under the same merge label that have not yet had the cabin_code field (logistics cabinet number) filled in in the "Logistics Prescription Merging Table".
[0050] For example, after the current prescription is placed, the system calls the logistics medicine cabinet prescription query interface based on the known merge identifier, and initiates a query request by passing in any prescription identifier belonging to the task; after receiving the request, the prescription unit finds the corresponding merge_orderid based on prescriid, and retrieves all relevant records in the dyf_logistics_prescriptions_merge table with the merge_orderid as the condition, filters out prescription entries with empty cabinet_code, extracts their prescriid field to form a set of prescription identifiers that have not been placed, and returns the updated values of has_merge_number and merge_number with the response.
[0051] For example, if a merging task contains 3 prescriptions, after the second prescription is placed, the system queries again and finds that the cabinet_code of one prescription is still empty, so it adds its prescriid to the unplaced set.
[0052] S302, for each set of prescriptions that have not been placed, obtain the corresponding medicine cabinet resource information.
[0053] Among them, the medicine cabinet resource information refers to the list of logistics cabinets in the current operation center that are in "unused" and not temporarily locked by Redis, including the code, X / Y coordinates and status of each cabinet.
[0054] As an example, it iterates through each prescription identifier in the set of unplaced prescription identifiers, constructs a query request {"prescriid":"KMXXXXXX"} for each one, and calls the logistics medicine cabinet combined prescription query interface; each time the combined prescription unit receives a request, it executes the same logic: queries whether the prescription belongs to a certain combined task, and if so, returns its combined identifier, prescription set size information, and available medicine cabinet resource information. Available medicine cabinet resource information is generated by querying the records in the dyf_logistics_cabinet_info table with a status of "0: unused" and filtering them in conjunction with the set of currently locked cabinets in Redis.
[0055] For example, when the third prescription arrives at the logistics area and is scanned, the recommended storage location for its merged task obtained through this step is still CAB-GZ-08, and this storage location is currently unoccupied, thus supporting the continued use of the same storage location to complete the collection.
[0056] S303 receives the user's counter selection instruction and sends a placement request, including the prescription identifier and the corresponding counter selection instruction, to the counter update unit until all prescriptions in the unplaced prescription identifier set are processed.
[0057] Among them, the counter selection instruction refers to the operation signal of logistics personnel to confirm the recommended or optional counter on the system interface; the counter update unit refers to the service module in the pharmacy system responsible for receiving placement requests and updating the database status.
[0058] As an example, for each prescription that has not been placed in a designated cabinet, a "Logistics Cabinet Consolidation Management" window pops up on the waybill printing interface, displaying the consolidation progress of the prescription, recommended cabinet locations, and a list of available cabinet locations. After the operator selects the target cabinet (or confirms the recommended value) and clicks the "OK" button, the system generates a placement request. The system submits the following information to the "Logistics Pharmacy Cabinet Prescription Area Update Interface": {"prescriid":"KMXXXXXX","cabinet_code":"CAB-GZ-08","oper_type":"1"}. The cabinet update unit verifies whether the cabinet is locked in Redis and whether it is "9: disabled" in the dyf_logistics_cabinet_info table. If both are valid, the system updates the cabinet_code and standing_time fields of the prescription and returns a success response. After receiving the success response, the system considers the prescription placement complete and continues to process the next prescription that has not yet been placed until all prescriptions in the set have been bound.
[0059] For example, once the last prescription is bound to the counter, the "merging complete" judgment is triggered, and then the packaging and outbound stage begins.
[0060] In other implementations, after a user completes the selection of a prescription's counter location, the system can initiate a process of querying and prompting for the remaining prescriptions that have not been placed, thereby achieving continuous operation guidance.
[0061] Step S400: When the conditions for merging completion are met, generate status information indicating that the merging operation has been completed.
[0062] The conditions for successful consolidation are that all prescriptions belonging to the same consolidation identifier have established placement records, meaning each prescription has a non-empty `cabinet_code` field in the "Logistics Prescription Consolidation Table" and its operation status is not marked as abnormal. Status information refers to data identifiers reflecting the current lifecycle stage of the consolidation task, specifically including whether the task has ended, whether all prescriptions have been collected, and the subsequent actions the system can perform. This step triggers a consolidation completion event after detecting that all associated prescriptions have completed counter binding, and updates the overall task status by sending a confirmation request to the backend service to avoid omissions or duplicate processing.
[0063] In an optional embodiment, step S400 includes the following sub-steps: S401, after all prescriptions associated with the merge identifier have completed the placement record creation, a merge completion event is generated.
[0064] The completion of the placement record means that for each prescription under the merged identifier, the "Logistics Pharmacy Cabinet Merged Prescription Area Update Interface" has been successfully called and a successful response has been obtained, and its cabinet_code has been updated to a valid value in the dyf_logistics_prescriptions_merge table.
[0065] For example, when the last prescription that has not yet been placed completes its placement request and receives a successful response, the system determines that has_merge_number equals merge_number based on the locally maintained prescription set size information, confirming that all prescriptions have been collected. Then, an internal event signal is generated and marked as "merge completion event" as the trigger condition for starting the subsequent status update process.
[0066] For example, if a merging task contains 3 prescriptions, the system will immediately determine that the merging completion condition is met after the third prescription is successfully bound to counter CAB-GZ-08 and a success code is returned.
[0067] S402, in response to the merge completion event, sends a completion confirmation request containing a merge identifier to the merge prescription unit.
[0068] As an example, the system constructs a request message: The request uses the following parameters: {"prescriid":"KM25070212872-1","cabinet_code":"CAB-GZ-08","oper_type":"2"}, where oper_type "2" indicates "merge completed" and calls the logistics medicine cabinet prescription area update interface. The prescriid in this request can be any prescription identifier in the merge task. The system will query the corresponding merge_orderid based on the prescriid to locate the entire merge task.
[0069] For example, when logistics personnel click the "Merge Complete" button on the interface, the system sends a request in this way, indicating that all prescriptions in the batch have been collected and requesting the backend to update the overall status.
[0070] S403, receive the processing result returned by the prescription unit, and generate status information indicating that the merging operation has been completed based on the processing result.
[0071] The processing result refers to the response data returned by the prescription unit after performing the status update operation, which includes a code (status code) and a message (prompt message) to indicate whether the operation was successful.
[0072] For example, after the system receives a successful response to the processing result, it generates completion status information corresponding to the merge identifier, marks it as "Merger completed", and displays the status synchronously on the interface.
[0073] In other implementations, the prescription merging unit updates the status to "1: Completed" and releases the locked state of all counter codes involved in the merging task from Redis, ensuring that resources are available for subsequent merging tasks.
[0074] In one optional implementation, step S403 includes the following sub-steps: Perform resource release processing on the counters corresponding to each prescription under the merged identifier to release the locked and occupied status of the counters.
[0075] Among them, resource release processing refers to the operation of releasing the logistics cabinet code that has been locked by Redis from the temporary occupancy state; the lock occupancy state of the cabinet refers to the temporary control mechanism by which the system sets key-value pairs in Redis and sets an expiration time when the cabinet is recommended for consolidation, so as to prevent other tasks from reusing it.
[0076] For example, when the prescription merging unit receives the completion confirmation request and verifies that all relevant prescriptions have been placed, it updates the status of the corresponding record in the dyf_logistics_prescriptions_merge table to "1: Completed". At the same time, it extracts the cabinet_code bound to all prescriptions under the merge identifier, and, in conjunction with the Redis key name, calls the delete operation to remove these keys from Redis, thereby unlocking the corresponding cabinet and making it available again for subsequent prescription merging tasks.
[0077] For example, if a merging task involves three prescriptions placed in CAB-GZ-08, CAB-GZ-09, and CAB-GZ-10 respectively, the system will clear the lock tags of these three slots in Redis after the merging is completed, ensuring that other newly arrived merging prescriptions can normally select and use the above slots.
[0078] In other implementations, resource release is performed immediately after a successful state update to ensure state consistency.
[0079] Figure 4 A schematic diagram of a pharmaceutical processing apparatus according to an embodiment of this application is shown. Exemplarily, the apparatus 100 includes: The information acquisition module 110 is used to acquire prescription merging relationship information and medicine cabinet resource information corresponding to the prescription identifier of the target prescription based on the prescription identifier of the target prescription. The placement request module 120 is used to determine the target medicine cabinet based on the medicine cabinet resource information and send a placement request to establish a placement record corresponding to the target prescription. The placement processing module 130 is used to determine the target medicine cabinet and establish a placement record for the remaining prescriptions that are in the same merger identifier as the target prescriptions, based on the prescription merger relationship information, until the merger completion conditions are met. The status acquisition module 140 is used to generate status information indicating that the merging operation has been completed when the merging completion conditions are met.
[0080] It is understood that the apparatus of this embodiment corresponds to the method of the above embodiments, and the options in the above embodiments are also applicable to this embodiment, so they will not be described again here.
[0081] This application also provides a terminal device, exemplary of which includes a processor and a memory, wherein the memory stores a computer program, and the processor executes the computer program to enable the terminal device to perform the functions of the various modules in the above-described method or apparatus.
[0082] The processor can be an integrated circuit chip with signal processing capabilities. The processor can be a general-purpose processor, including at least one of a Central Processing Unit (CPU), Graphics Processing Unit (GPU), Network Processor (NP), Digital Signal Processor (DSP), Application-Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The general-purpose processor can be a microprocessor or any conventional processor, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application.
[0083] The memory can be, but is not limited to, Random Access Memory (RAM), Read Only Memory (ROM), Programmable Read-Only Memory (PROM), Erasable Programmable Read-Only Memory (EPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), etc. The memory is used to store computer programs, and the processor can execute the computer programs accordingly after receiving execution instructions.
[0084] This application also provides a computer-readable storage medium for storing the computer program used in the aforementioned terminal device. For example, the computer-readable storage medium may include, but is not limited to, various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0085] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods 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 of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that, in 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 the block diagram and / or flowchart, and combinations of blocks in the block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0086] In addition, the functional modules or units in the various embodiments of this application 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.
[0087] If the aforementioned functions are implemented as software functional modules 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 this application, in essence, 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 smartphone, personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application.
[0088] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.
Claims
1. A method for processing prescriptions, characterized in that, The method includes: Based on the prescription identifier of the target prescription, obtain the prescription merging relationship information and medicine cabinet resource information corresponding to the prescription identifier; Based on the medicine cabinet resource information, the target medicine cabinet is determined, and a placement request is sent to establish a placement record corresponding to the target prescription. Based on the prescription merging relationship information, the target medicine cabinets for the remaining prescriptions that are under the same merging identifier as the target prescription are determined in sequence and a placement record is established until the merging completion conditions are met; When the conditions for merging are met, status information indicating that the merging operation has been completed is generated.
2. The prescription processing method according to claim 1, characterized in that, The step of obtaining prescription merging relationship information and pharmacy resource information corresponding to the prescription identifier of the target prescription includes: Send a query request based on the prescription identifier to the combined prescription unit, and receive the combined prescription unit's returned information on the merge identifier associated with the prescription identifier, the size of the prescription set, and available pharmacy cabinet resources.
3. The prescription processing method according to claim 1, characterized in that, The step of determining the target medicine cabinet based on the medicine cabinet resource information and sending a placement request to establish a placement record corresponding to the target prescription includes: Obtain available medicine cabinet resource information from the medicine cabinet resource information, and receive the user's cabinet selection instruction based on the available medicine cabinet resource information; Send a placement request containing the prescription identifier and the cabinet selection instruction to the cabinet update unit, and after receiving the placement confirmation result returned by the cabinet update unit, establish a placement record corresponding to the prescription identifier.
4. The prescription processing method according to claim 1, characterized in that, Based on the prescription merging relationship information, the remaining prescriptions with the same merging identifier as the target prescription are sequentially identified for their target pharmacy cabinets and their placement records are established until the merging completion conditions are met, including: Based on the prescription merging relationship, identify the set of unplaced prescription identifiers under the merging identifier; For each set of prescriptions that have not been placed, obtain the corresponding medicine cabinet resource information; The system receives the user's counter selection instruction and sends a placement request, including the prescription identifier and the corresponding counter selection instruction, to the counter update unit until all prescriptions in the set of unplaced prescription identifiers have been processed.
5. The prescription processing method according to claim 1, characterized in that, When the merge completion condition is met, generating status information indicating that the merge operation has been completed includes: A merge completion event is generated after all prescriptions associated with the merge identifier have completed their placement records. In response to the merge completion event, a completion confirmation request containing the merge identifier is sent to the merge prescription unit; The system receives the processing result returned by the prescription unit and indicates the status information that the merging operation has been completed based on the processing result.
6. The prescription processing method according to claim 5, characterized in that, After the status information indicating that the merging operation has been completed, it also includes: Resource release processing is performed on the counters corresponding to each prescription under the merged identifier to release the locked and occupied state of the counters.
7. The prescription processing method according to claim 3, characterized in that, Also includes: If sending a placement request to the cabinet update unit fails, a retry will be performed after a preset time interval until a successful response is received. Before each retry, retrieve the latest medicine cabinet resource information to ensure that the target medicine cabinet is available.
8. A pharmaceutical processing device, characterized in that, include: The information acquisition module is used to acquire prescription merging relationship information and medicine cabinet resource information corresponding to the prescription identifier of the target prescription. The placement request module is used to determine the target medicine cabinet based on the medicine cabinet resource information and send a placement request to establish a placement record corresponding to the target prescription. The placement processing module is used to determine the target medicine cabinet and establish a placement record for the remaining prescriptions that are under the same merger identifier as the target prescription, based on the prescription merger relationship information, until the merger completion conditions are met. The status acquisition module is used to generate status information indicating that the merging operation has been completed when the merging completion conditions are met.
9. A terminal device, characterized in that, The terminal device includes a processor and a memory, the memory storing a computer program, and the processor executing the computer program to implement the prescription processing method according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed on a processor, implements the prescription processing method according to any one of claims 1-7.