A home-based elderly care service intelligent order placing method and system based on multi-constraint re-verification and failure rollback
The intelligent order scheduling method for home-based elderly care services executed by the server solves the problem of constraint loss when orders are transferred across modules, achieves consistent writing of orders and resource usage, prevents duplicate order dispatch and overcapacity order dispatch, and ensures the accuracy and consistency of order dispatch results.
Patent Information
- Application Number
- CN202611451362.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-18
- Publication Date
- 2026-11-24
AI Technical Summary
In home-based elderly care service platforms, when orders are transferred across modules, execution constraints may be lost or expired, leading to inconsistent order dispatch results, duplicate order dispatch, or order overload, and it is difficult to maintain the consistency of mandatory verification conditions across different distribution channels.
The intelligent scheduling method for home-based elderly care services, executed by the server, obtains service orders to be assigned and their execution constraint sets, performs hard constraint filtering and scoring, generates a scheduling preview, and verifies the version and dynamic data upon confirmation to ensure transaction consistency, prevent rollback channels from bypassing the same constraints, and uses a unified validator to prevent duplicate order assignments.
It effectively prevents the loss of constraints and the use of expired previews, maintains the consistency of order dispatch results and resource usage, reduces duplicate order dispatch and overcapacity order dispatch, ensures that order, usage and confirmation logs are written in the same transaction, and implements mandatory condition retention and version checking of interface mapping.
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This invention relates to the field of service order data processing technology, specifically to an intelligent scheduling method and system for home-based elderly care services based on multi-constraint re-verification and failure rollback. Background Technology
[0002] The home-based elderly care service platform receives structured orders from terminal order placement or service plan generation modules and assigns these orders to service personnel. The service plan generation module determines service content, frequency, and execution requirements based on health records; the scheduling module takes the already determined orders and execution constraints as input and handles personnel screening, resource allocation, and distribution status. The two modules can collaborate within the same platform or communicate via an interface. In the process of manually selecting personnel for each order, the operator needs to query order information, personnel information, and orders in transit separately. When queries occur at different times, the data presented on different pages may be inconsistent; when there are many candidates, verifying dynamic conditions one by one will also increase the number of interactions and queries. In processes that first score personnel and then check if they meet the execution criteria, individuals who do not meet eligibility, scheduling, or capacity limitations may still participate in the scoring. Selecting personnel solely based on distance or category matching does not guarantee that they will meet all execution criteria at the time of confirmation. These processes suffer from the problem of invalid scoring and the continued use of expired recommendations. Furthermore, there may be a time lag between the generation of the recommendation result and the user's confirmation. During this time lag, the order may have already been claimed by other operations, the candidate service personnel may have switched to a busy status, reached capacity limits, or changed locations. If the previous recommendation result is used to write the order directly during the confirmation stage, it will result in duplicate order dispatch, order overcapacity dispatch, or inconsistent status. When orders are transferred across modules, if only the service category and appointment time are retained, upstream-defined health execution restrictions, minimum qualifications, time windows, number of people, or continuity conditions may be lost. If automatic allocation fails and is transferred to other channels without retaining the above conditions, or if different constraint versions are used for preview and confirmation, inconsistencies may arise between the input semantics and the allocation results. Simply recording the final personnel identifier is insufficient to pinpoint failures caused by constraint changes and concurrent writes. Therefore, it is necessary to retain the semantics and version of the upstream execution constraints, separate the candidate preview from the order writing, recheck the constraints and resource status in the confirmation and rollback channels, and complete the interface connection with distinguishable receiving results, coordination status and order dispatch results. Summary of the Invention
[0003] The technical problem to be solved by this invention is to prevent constraint loss and expired previews from being used for order writing when orders are transferred across modules, execution constraints are updatable, and personnel status can change concurrently, to maintain the consistency of mandatory verification conditions in each allocation channel, and to keep the order dispatch results, resource usage, and confirmation logs consistent. To address the aforementioned technical problems, this invention provides a server-executed intelligent scheduling method for home-based elderly care services. The server communicates with a database storing orders, personnel information, and logs, and receives preview and confirmation requests from operating terminals via a network. The method includes the following processing: S100 retrieves the service orders to be assigned, the execution constraint set and constraint version bound to the orders, and the enabled scheduling rules. An order must include at least an order identifier, service category, appointment time, service location, and attribution information. The execution constraint set is determined by the source end and saved as an immutable version record after interface verification. Rules include maximum dispatch distance, scoring weight, automatic minimum score, and rollback method. Even for ordinary orders, the constraint mode must be explicitly declared by the source adapter; missing mandatory fields cannot be treated as empty constraints. The "pending allocation conditions" referred to in this document mean that the order service status is "awaiting order acceptance," the recipient identifier is empty, and the publication status is "awaiting allocation," "published in the task hall," or "transferred to a service organization," and this matches the allowed status of the current allocation entry. The backend confirms that it can process orders awaiting allocation or those transferred to an organization. The task hall only processes orders published in the task hall; both checks the operator's permissions and order ownership, and cross-channel collection is not allowed due to shared verification. After successful personnel allocation, the personnel identifier, service organization identifier, and collection time are written, the service status is updated to "in service," and the publication status is updated to "specified personnel." This business status does not indicate that the personnel have arrived on-site. S200: Query service personnel skill association data based on the service category of the order, and add only personnel with enabled skills for that service category to the initial candidate set. By first narrowing the set according to service category, the number of subsequent dynamic constraint queries and scoring calculations is reduced. S300 performs hard constraint screening on the initial candidate set. Basic resource conditions include being enabled and certified, conforming to organizational affiliation, being able to accept orders, having complete data, valid scheduling, not being at full capacity, having a valid location, and not exceeding the service radius. Simultaneously, it verifies each order's health execution restrictions, minimum qualifications, execution time windows, and other mandatory conditions; the intersection of the two types of conditions is used, and failure in either case results in disqualification. Unknown constraints are not automatically passed, and scores below the minimum qualifications cannot be compensated for with higher scores. Each candidate is verified according to a preset order of qualifications and affiliation, order status and information, shift schedule, capacity, location and radius. The first verification item that fails is recorded, and the number of eliminations is accumulated according to that item. The lack of effective skill association is an empty set reason in the candidate generation stage and is not mixed with the number of personnel eliminated in the hard constraint stage; the same person is not counted repeatedly in multiple elimination categories. The order service location can be the address bound to the order or the location of the associated terminal, while the personnel location is the latitude and longitude coordinates most recently reported and persisted by the personnel's terminal. Location validity includes the existence of latitude and longitude, being within the allowed latitude and longitude range, and being able to determine a common coordinate reference. In the implementation where location validity verification is enabled, the personnel's positioning time is also compared with a preset validity period; if the validity period is exceeded, the personnel are removed; if it is not enabled, this validity verification is not performed. Service distance is calculated using the semi-sine spherical distance. First, the order location and personnel location are converted to the same coordinate system, and latitude and longitude are converted to radians. The square of half the latitude difference between the two points is calculated, multiplied by the cosine of the latitude difference, and then multiplied by the square of half the longitude difference. These two products are added together to obtain an intermediate value 'a'. 'a' is restricted to between zero and one. Using the square root of 'a' as the first parameter and the square root of the difference between 'a' and 'one' as the second parameter, the arctangent function is calculated. This result is then multiplied by twice the Earth's radius to obtain the distance 'd'. The Earth's radius and the dispatch distance use the same unit of length. The effective service radius *r* is the smaller of the maximum dispatch distance of the dispatch rule and the personnel service radius. Both radii must be greater than zero; otherwise, the rule or personnel data will be treated as invalid. Radius validation is only passed when the distance *d* is not greater than *r*, thus preserving both platform and individual personnel range limitations. Spherical distance is not equivalent to road travel distance or estimated arrival time. S400 calculates the distance factor Fd, load factor Fw, skill factor Fs, service organization matching factor Fm, and historical performance factor Fh for candidate service personnel who pass all hard constraints. The distance factor Fd is the result of subtracting the ratio of d to r and truncating it to a closed interval between zero and one. The truncation referred to in this paper means taking zero for values less than zero, taking one for values greater than one, and keeping the rest the original values. The number of orders allocated and not cancelled on the scheduled date is denoted as nday, and the maximum daily order volume is denoted as Nday. The concurrent usage calculated based on order capacity is denoted as nact, and the corresponding upper limit is denoted as Nact. Both load factors are obtained by subtracting the ratio of the usage count to the upper limit from one and truncating to zero or one. The load factor Fw is the smaller of the two. The upper limit is a positive integer. Instant orders can use the number of orders currently in the service; scheduled orders with time windows use the maximum overlapping usage within their target execution interval, and are synchronously written to the scheduled usage record upon confirmation. The skill factor Fs is calculated by dividing the skill level of an individual for the order service category by a preset maximum skill level, truncated to a closed interval between zero and one; the preset maximum skill level is a positive number. In the basic embodiment, for candidates who have passed the hard constraint of order affiliation, the service organization matching factor Fm is uniformly set to one; therefore, this factor does not generate additional ranking differences among candidates for the same order, and its weight of zero does not participate in the scoring. The historical fulfillment factor Fh is calculated by dividing the number of completed orders associated with the individual by the sum of the number of completed and cancelled orders. The same order set and status definition are used in the statistical analysis. When the sum of the two types of orders is zero, a preset initial fulfillment coefficient between zero and one is applied. This factor represents the completion rate in the records and is not used to determine cancellation liability, nor does it constitute an evaluation of medical service capabilities. The weights for distance, load, skills, service organization, and historical performance are denoted as wd, ww, ws, wm, and wh, respectively. Each weight is non-negative, and the sum of the weights is greater than zero. The score for each sub-item is calculated by multiplying one hundred by the product of the corresponding factor and its weight, and then dividing by the sum of the weights. In the basic implementation, the scores for each of the five sub-items are first rounded to two decimal places, and then the rounded sub-item scores are summed and rounded to two decimal places to obtain the overall score P. The sorting, lowest score determination, preview display, and confirmation log all use the same methodology. Candidates must first meet all mandatory conditions. Without a continuity preference, they are ranked in descending order of overall score and ascending order of distance. With a preference for prioritizing historical service providers, candidates within the eligible set are first compared to whether they belong to the target elderly person's historical service provider, then their scores and distance are compared. Mandatory personnel designation is a hard constraint and not a sacrificial preference. In cases of complete overlap, the order is determined by ascending personnel identification. S500 generates a schedule preview. The schedule preview includes at least an order summary, sorted candidates, service distance for each candidate, skill level, capacity usage, historical fulfillment rate, overall score, sub-scores, and textual recommendation reasons, as well as statistics on reasons for elimination. The preview log associates orders, scheduling modes, rule identifiers, constraint versions, candidate snapshots, elimination statistics, operation entities, and times. Snapshots save personnel, organizations, distances, skills, capacity and their statistical definitions, selected execution intervals, historical fulfillment factors, continuous matching results, and various scores; confirmation commands reference this snapshot. When rules are variable, the actual parameters or immutable rule versions are saved. Execution constraints and rule versions are recorded separately; rule identifiers cannot replace order constraint versions. The S600 receives confirmation commands from manually selected personnel or those generated in automatic mode. These commands carry an order identifier, a target personnel identifier, and a snapshot identifier. Within the transaction, it sequentially locks the order record and personnel scheduling data record, checks the conditions to be assigned, and reads the current bound constraint version. If the version differs from the snapshot, confirmation is rejected and a re-preview is requested; confirmation is also rejected if personnel data does not exist. Client-submitted ratings or validation conclusions are not used as the basis for writing. Within a transaction, reread rules, current execution constraints, personnel qualifications, skills, order status, scheduling, location, and committed / occupied items are all checked again using a unified validator to verify basic resource conditions and inherited mandatory conditions. Orders with time windows must be reviewed against the same execution interval in the snapshot; if they are no longer executable, the preview is restarted without silently changing the selected time. Filtering failures are rolled back, scores are recalculated, and then written to the log. After the second screening, updates are performed based on order identifier, waiting order status, empty recipient information, read allowable release status, and constraint version execution conditions. The personnel, organization, release status, business service status, and collection time are written, and the number of affected records must be at least one. For pre-booked orders, the reviewed execution interval occupancy is also written; occupancy, order updates, and confirmation logs are completed within the same transaction, and a rollback occurs if any step fails. Order update and confirmation success logs are written within the same transaction; failure in either step rolls back the entire transaction. Rejection confirmation logs are written separately after the transaction rollback to prevent them from being rolled back along with the original transaction. Only after a transaction is successfully committed is a dispatch notification sent to the associated terminal, target personnel, or service organization. Failure to send a notification does not reverse the committed order, and a successful notification does not replace the database commit result. In S700, the automatic mode reads orders to be allocated within the preset batch limit according to queue priority. Ordinary orders without upstream priority are sorted in ascending order by appointment time and order identifier; orders with timeliness level and time window priority are sorted accordingly, as detailed in the interface implementation. After generating qualified candidates, those below the lowest score are filtered out, and then the first candidate is selected to generate an S600 confirmation instruction. If no continuity preference is specified, this first candidate is the highest-scoring candidate. If there are no qualified candidates or all qualified candidates are below the minimum score, the task will be posted to the task hall, transferred to a valid organization, or left unassigned for manual processing, according to the rules. Each branch retains its execution constraints and version; a unified validator must still be used before actual assignment to personnel. Multi-person tasks with unknown mandatory conditions, incomplete time windows, or those that are not supported will be placed directly under coordination and will not be included in the regular task assignment process. If a valid rollback organization cannot be determined, the order will be retained and the reason recorded; generating empty targets or lowering mandatory conditions is prohibited. Batch processing deduplicates input order identifiers and returns results independently for each order. Automatic scanning only processes orders awaiting assignment or acceptance but not marked as requiring coordination; scanning exits after order assignment, publication, or transfer. For interface anomalies and manual coordination, the coordination flag is set to pending; it can only be removed after the conditions are completed and the interface verification is passed again, preventing abnormal orders from being automatically and repeatedly scanned. The coordination flag and the order business service status are stored separately. The system includes a server, a database, and modules for order and rule acquisition, candidate generation and filtering, scoring and previewing, transaction confirmation, automatic order dispatch, and rollback, executed by a processor. The order acquisition module includes interface verification and version binding functions; the unified constraint validator is shared by automatic, manual, task hall acquisition, and organizational allocation entry points. The system can also include batch processing and auditing modules. All modules are linked through order identifiers, constraint versions, and snapshot identifiers. The technical advantages of this invention are as follows: interface mapping retains mandatory conditions and their versions, reducing cross-module field loss; during confirmation, the version is checked and dynamic data is verified to avoid direct writing of expired snapshots; a unified validator prevents rollback channels from circumventing the same constraints; order, occupancy, and confirmation logs are written with the same transaction to maintain consistency of commit results; and receiving receipts and dispatch results are separated, enabling upstream entities to distinguish between received, pending coordination, and assigned orders. These advantages are achieved through data binding, version checking, and concurrency control mechanisms. Attached Figure Description
[0004] Figure 1 This is the overall flowchart of the intelligent scheduling method for home-based elderly care services of the present invention. Figure 2 This is a schematic diagram illustrating the data input and module relationships of the intelligent scheduling system of this invention. Figure 3 This is a flowchart of the candidate service personnel basic resource hard constraint screening process for this invention; when carrying upstream execution constraints, it is superimposed. Figure 8 The interface constraint inheritance and verification process is shown. Figure 4 This is a flowchart of the candidate service personnel scoring and ranking process when the continuity preference is not carried; when the preference is carried, it is processed according to the interface implementation method. Figure 5 This is a flowchart of the second re-verification process during the preview and confirmation stages of this invention. Figure 6 This is a flowchart illustrating the transaction confirmation and concurrent anti-duplicate process of this invention. Figure 7 This is a flowchart of the automatic order dispatch threshold judgment and failure rollback process when there is no upstream priority or continuity preference in this invention; the queue and candidate sorting are implemented using an interface method when the above conditions are met. Figure 8 This is a flowchart of the upstream order interface constraint inheritance, confirmation, and result feedback of the present invention. Detailed Implementation
[0005] The following is combined with Figures 1 to 8 Implementation details: The server receives preview and confirmation requests via the order interface and performs automatic order scheduling periodically; the database provides transactions, exclusive row locks, and conditional updates. The following values are for illustrative purposes only and are not actual statistical results. Orders are generated by the terminal, shopping cart, management terminal, or upstream service solution generation module. The scheduling module does not re-parse health records or re-derive service solutions; instead, it accepts the already determined service categories and execution requirements and does not change the order charging and settlement rules. Orders are not automatically assigned if required categories, locations, or constraints are missing. For orders with complete time windows and service durations but without a specified start time, the feasible execution interval can be determined using the method described later. like Figure 1 As shown, steps S100 to S500 complete input acquisition, candidate filtering, scoring, and preview; interface validation and constraint binding belong to S100, inheritance of mandatory conditions belongs to S300, and version and range occupancy verification belongs to S600. In manual mode, personnel are selected and confirmed; in automatic mode, the lowest score and preference sorting are applied to qualified candidates before confirmation or rollback. Failure to verify results results in rejection of confirmation and does not immediately use expired results for rollback. like Figure 2 As shown, the basic inputs are divided into three groups: orders and rules, personnel basics and scheduling data, and skill scheduling and history. Orders are also associated with immutable execution constraint versions, and appointment orders are associated with interval occupancy records. Personnel scheduling data is uniquely associated with personnel identifiers, allowing shared locking for confirmed transactions of the same personnel; skills are associated by personnel and category; scheduling saves the date or weekday, start and end times, and activation status. Outputs include candidate sorting and reasons, order status, logs, and notification data. The example rule sets the weights for distance, load, skill, service organization, and historical performance to 35, 25, 20, 10, and 10 respectively; the maximum dispatch distance is set to 10 kilometers; the minimum score for automatic dispatch is set to 60 points; and the failure rollback method is set to Task Hall. Before the rule is enabled, it verifies that the weights are non-negative, the total weights are positive, the maximum distance is positive, and the minimum score is between zero and one hundred. If there is no valid rule, a configuration error is returned, which is not equivalent to a zero score. Before previewing, check that the order exists, can be assigned, has no recipients, and is executable. Regular timed orders must have a scheduled time, and window orders must have a complete window and duration. Cancelled, completed, or pending orders do not generate automatic confirmations. The organizer must also verify attribution. The system then queries the skill records of personnel in an active state based on the order service category. This query result only indicates that the personnel possess the corresponding skills, not directly that the personnel are available to accept orders at that time. The system further retrieves personnel, scheduling information, and valid shift schedules for each skill record, categorized by... Figure 3 Perform hard constraint screening. Basic qualifications require personnel to have an active and verified account; inherited minimum qualifications will be verified item by item according to qualification type, skill level, validity period, and years of service. Organizational affiliation remains a mandatory requirement. Certification does not guarantee compliance with order requirements; missing qualification certificate information cannot be substituted with ordinary skill levels. Order acceptance status constraints require personnel to be in an order-accepting state. Personnel who are resting, offline, or manually set to busy are deleted. Order scheduling data integrity constraints require personnel to have valid latitude and longitude, a positive service radius, a positive maximum daily order volume, and a positive maximum number of orders served simultaneously. The scheduling and time windows use absolute time representation within a unified time zone. Regular orders, whether immediate or with a specified start time and no duration requirement, can be scheduled according to... Figure 3 Check the appointment time; for orders with execution time windows and service durations, the entire execution interval must fall within the upstream allowable window and personnel schedule, and interval capacity checks must be performed. Start time verification should not replace full-process occupancy checks. Capacity statistics are deduplicated based on order identifiers. Daily statistics include all allocated and uncancelled orders for the corresponding appointment date, including completed orders. In standard instant mode, occupancy is calculated based on the number of orders currently in service; in window appointment mode, the execution interval of confirmed, uncancelled, and incomplete appointments in the appointment occupancy table is used. A business status of "In Service" does not equate to actual attendance; future appointments spanning multiple dates without overlap are not counted as simultaneous execution. All entry points can add, delete, or change occupancy when holding the same personnel lock. Location and service radius Figure 3 Verification. Missing order locations are considered order-level input errors; missing personnel locations are considered candidate-level elimination reasons. Spherical distances are calculated using the same coordinate reference; locations exceeding the effective service radius are eliminated. When implementing a location validity period, the location time is also checked. A location cannot be deemed invalid solely because its longitude or latitude is zero; the missing markers and the latitude / longitude range must be considered for determination. Figure 4 In the instant mode rating example shown without continuity preference, the distance between people is 2 km, the effective radius is 8 km, and the distance factor is 0.75; the number of scheduled but not cancelled orders is 1 with a daily limit of 6; the number of orders currently in service is 0 with a concurrency limit of 1; and the load factor is 5 / 6. The window mode uses the maximum overlap of the target interval to replace the instant concurrency count, with the other normalization methods remaining the same. The personnel's skill level is 2, and the highest skill level is 3, so the skill factor is two-thirds; the service organization matching factor is 1, and the historical performance factor is 0.9. Calculated according to the aforementioned weights and rounded to two decimal places, we get 26.25, 20.83, 13.33, 10.00, and 9.00 points, which add up to 79.41 points. If we were to first sum the unrounded items and then round them, we would get 79.42 points; this embodiment explicitly uses the former method to avoid inconsistencies between the preview, log, and lowest score determination results. The system retains a preset number of decimal places for both the overall score and the sub-scores, and generates recommendation reasons such as "distance 2.00 km, skill level 2, daily workload 1 / 6, historical completion rate 90%". The recommendation reasons are generated by structured calculations and do not rely on manual input, thus maintaining a correspondence with the score. The queue preview can output the top N candidates, where N is a positive integer with an upper limit to avoid returning too much personal information at once. Even if there are no qualified candidates, it outputs the elimination reason statistics and records this preview result as a failure, instead of returning an empty list without context. like Figure 5 As shown, the preview is a snapshot at a specific point in time that includes the constraint version and candidate execution range. During the confirmation phase, the current constraints and dynamic data are reread, and the old snapshot is rejected if the version changes; if the version remains unchanged but the personnel status, qualifications, or range occupancy changes, the data is re-verified and accepted or rejected based on the result. The confirmation process first locks the order and checks the versions of the conditions and constraints to be assigned. Concurrent confirmations and upstream constraint updates must acquire the same order lock; changes committed earlier will be read by subsequent transactions. Valid version updates for unassigned orders invalidate the old preview; assigned orders enter reconciliation upon receiving new constraints, without directly rewriting confirmed tasks. Subsequently, the unique scheduling data record of the target personnel is locked, and the submitted occupancy is read and verified. All entry points for increasing occupancy, such as automatic confirmation, ordinary manual allocation, task hall pickup, organizational allocation, and appointment rescheduling, adhere to the same order of personnel locks after the order lock. In multi-personnel lock scenarios, occupancy is retrieved in ascending order of personnel identifier. Capacity reading uses the method of reading submitted or equivalent currently submitted reads, without using earlier statistical snapshots. like Figure 6 As shown, after the target personnel pass the screening again, the order update with the old status conditions is executed, and the number of affected records is checked. Record locks are used to limit the order of concurrent processing, and condition updates are used to re-verify the prerequisites for state transition; both are used together. A successful update should not be simply equated with the database not throwing an exception. Modifications to non-personnel data tables such as qualification or scheduling during the confirmation period, if required to be strictly serialized with the confirmation, must also comply with the same personnel lock convention through the relevant write entry point. After a successful order update, the recalculated candidate snapshot and confirmation result are written within the same transaction. If log writing fails, the order update is rolled back; a failure log is recorded after the rollback. Notifications are only sent upon successful commits; these notifications are not part of the write steps within this database transaction. A persistence error is returned if the database or log channel is unavailable. For example, in normal real-time mode, the concurrency limit for a target person is 1. Two transactions with different orders simultaneously assign orders to that person. Assuming both transactions adhere to the shared person lock and read committed occupancy after acquiring the lock, the transaction that acquires the lock first sees occupancy at 0, updates the order to "in service," and commits. The transaction that acquires the lock later sees occupancy at 1 and is rejected because the capacity is full. If other entry points bypass the person lock or read an earlier snapshot, locking the order record alone is insufficient to prevent over-capacity allocation for different orders. Therefore, this capacity protection relies on all entry points increasing occupancy adhering to the above agreement. Automatic queues, such as Figure 7 The default mode shown reads ordinary orders by appointment time and order identifier; Figure 8 The interface mode preserves upstream timeliness and time window priorities and implements continuity preferences. Batch order only determines the processing sequence, not the globally optimal route. In automatic mode, those scores below the minimum are first filtered from the qualified set of hard constraints, and then the top-ranked allocation is selected based on preference and scoring order. The transaction is then confirmed to recalculate the score and recheck the automatic minimum score; mandatory constraints and version consistency must also be satisfied again. If any condition fails, the current round ends and the reason is returned; an older snapshot cannot be used immediately to switch to another allocation channel. Manual selection still requires all mandatory conditions to be met; version or capacity checks are not exempted based on manual confirmation. Before rolling back, review the order's prior status. When publishing or transferring, only update the channel information; do not delete execution constraints, versions, time windows, or special notes. Subsequent receipt or allocation should use the same validator and execute transaction confirmation; channels unable to handle validation should not automatically accept the restricted order. Manual processing should not directly bypass mandatory conditions and write them to personnel; when upstream solutions need adjustment, the source end should handle it according to the version update process. Organization rollback must be able to identify a valid target organization. If no organization is found or its status has changed, the effective data will be retained and the reason recorded. The interface will return "Received", "Transferred", "Pending Coordination", and "Order Confirmed" respectively; transferring to the task lobby or organization does not mean that personnel matching is complete. Batch orders are initiated through separate transactions. However, for related tasks marked as requiring simultaneous execution by multiple people or being unable to be independently split, independent single-person transactions are not used to impersonate joint completion. Instead, they are checked against interface capabilities and transferred to pending coordination. Subtasks that can be executed independently retain the parent scheme and subtask identifiers, and their results are returned separately. This invention can be implemented using a relational database that supports transactions and row-level locking. Candidate snapshots can be saved as structured data such as JSON; requests are received via an HTTP interface, and notifications after submission can be sent via WebSocket or application messages. The specific communication protocol and storage encoding do not change the data dependencies between candidate filtering, post-lock re-validation, condition updates, and failure rollback. In implementations using region-based or service-category-based rules, rules are selected based on order attributes; if no specific rule matches, the enabled default rule is used. Preview and confirm the rules actually used in each record, and confirm that the corresponding sub-item scores should be recalculated after rereading the rules. If recalculation is required afterward, rule parameter values or immutable rule versions should be saved simultaneously to avoid the inability to restore historical calculation conditions after the rules are modified in place. Modules are associated through order identifiers, constraint versions, and snapshot identifiers. Interfaces first bind constraints, candidate modules check capabilities and conditions, preview modules create snapshots, confirmation modules reread versions and submit status, and rollback modules retain constraints and change channels. No allocation entry point may substitute mandatory condition validation with scoring, manual selection, or receiving receipts. This invention can be implemented by a processor executing program instructions in memory. The instructions cause the processor to receive and bind versioned execution constraints, perform candidate filtering and preview, verify constraint versions and dynamic resources in the confirmation transaction, and preserve constraints and processing semantics in rollback and result return. Figure 8 In the interface implementation shown, the upstream is responsible for health feature parsing, service requirement reasoning, and solution generation, while the downstream is responsible for resource matching and consistent submission of predetermined execution requirements. The source can also be a regular order placement module; the interface does not limit the health inference algorithm, nor does it rely solely on a specific upstream implementation as the sole source. Both parties interact based on structured order agreements, and the downstream does not unilaterally change the service content, frequency, intensity, or health restrictions. The API request includes the API version, source system identifier, source order identifier, constraint version, service category, address or coordinates and coordinate reference, execution time window, time zone, service duration, health execution limits, minimum qualifications, special precautions, timeliness level, continuity preference, and number of users. Associated tasks also include the parent solution, child tasks, and whether they can be executed independently. A versioned field dictionary distinguishes between required, nullable, and inapplicable fields; fields with a clearly defined inapplicable source can be empty; unknown fields are not supported for mandatory returns. Field mapping is completed using a source code vs. local code lookup table. Time values are standardized to absolute times, and addresses are resolved to a common coordinate reference after verification. For each mandatory condition, the source field, standardized code, comparison operation, threshold or allowed set, and mapping version are saved. If semantic equivalence of the mapping cannot be proven, there are only unresolved free text restrictions, or there are contradictions between fields, a reason for pending coordination is returned, and the field is not discarded and the order continues to be dispatched. Special notes are retained with the order and displayed for confirmation before authorized personnel execute the order; displaying confirmation does not replace mandatory verification. The API transaction uses the source system, source order, and constraint version as unique keys to store the standardized request content and content summary. For duplicate keys, the actual standardized content must be compared. If they match, the saved local order identifier and receiving result are returned, preventing duplicate order creation or billing. If they differ, a version conflict is returned. Existing local orders are bound together using association rather than being created again. The scheduling API is not responsible for generating health plans or authorizing billing. If an executable order needs to be created, the original business validation is handled by a separate order entry point. Constraint records are stored immutably by version, and local orders only hold references to the current version. Lower versions are rejected, and modifications to the same version are prohibited; higher versions are only switched and old snapshots invalidated after full verification and locking of the local order before allocation. When allocated, change requests are saved as pending coordination, and confirmed versions and execution records are retained. If necessary, they are handled by existing cancellation or rescheduling processes, and tasks are not secretly canceled in the receiving thread. Health implementation restrictions use executable comparison items, such as prohibited material sets, permitted operation sets, and required care qualifications. Known attributes of candidates or their implementation resources are compared item by item with the restrictions; candidates whose resource attributes are unknown are disqualified. Minimum qualifications are checked by certificate type, validity period, skill level, and years of service. The rules are provided upstream with pre-defined implementation meanings; the scheduling module does not make diagnoses or re-derive health protocols based on original medical records. For orders with upstream conditions of "execution by two people or execution by one person with specified qualifications", they can be processed as a single-person task only if the latter branch is explicitly permitted and the candidate qualification is approved; if multiple people must synchronize, or if the conditional logic cannot be expressed, the task will be returned to be coordinated. Composite services will only be accessed as sub-tasks if the upstream clearly indicates that they can be independently split and provides sub-task requirements; otherwise, a category will not be selected to replace the entire composite task, nor will multiple independent confirmations be claimed as joint confirmations by multiple people. Time windows are defined by the earliest allowed start and the latest allowed finish, and carry a positive duration. If the upstream uses other time window semantics, the interface is converted dictionary-wise; direct equivalence cannot be assumed. When no fixed start time is specified, candidate start times are taken from the window start point, the start point of the schedule within the window, and the end point of an existing occupied interval, and checked one by one in ascending order; when a fixed start time is specified, only the fixed start time is checked. Execution ends by adding the start time to the duration; the complete interval must lie at the intersection of the window and a continuous schedule segment. Midnight intervals are expanded using the actual date, not just comparing the day of the week and clock strings. The reservation occupancy records personnel, orders, start and end dates, status, and constraint versions, using left-closed, right-open intervals, with no overlap between the first and last entries. All occupancy entries intersecting the target interval are clipped to the target interval. The start and end events of the clipped intervals are sorted, with ending events processed first, followed by start events, to obtain the occupancy count and maximum value for each sub-interval. Only when the maximum value plus one does not exceed the capacity limit can the time slot be selected; if no feasible interval exists, it awaits coordination and is not replaced by an out-of-window time slot. Upon confirmation, order and personnel data are locked. Overlap is recalculated for the same interval in the snapshot records, and occupancy, personnel allocation, and confirmation logs are written within the same transaction. When instant and scheduled tasks are mixed, their occupancy is unified to the same personnel timeline. If the end time of an instant task cannot be determined, subsequent new appointment confirmations for that personnel are conservatively prevented until reliable end information is obtained or the task is completed. Cancellation, completion, and rescheduling also maintain occupancy through shared locks. If execution times out and is not completed, it is extended to the confirmed expected end time; if the end time is unknown, new confirmations during conflicting periods are prevented. Idle time is not inferred from missing end times. For example, if the window is from 09:00 to 11:00, the duration is 60 minutes, the shift is from 08:00 to 12:00, and the existing slot is from 09:00 to 10:00 with a capacity limit of 1, then the 09:00 candidate slot will not pass, while the 10:00 to 11:00 slot will pass. If the existing slot is occupied the next day and does not overlap, it will not affect that slot. If the 10:00 to 11:00 slot is occupied by another order after the snapshot, the confirmation review will fail and a re-preview will be required; it cannot be silently changed outside the window. The timeliness field is mapped to a stable sorting key: urgent takes precedence over expedited, expedited takes precedence over normal, and within the same priority level, upstream time window priority, latest start time, appointment time, and order identifier are compared. Priorities that cannot be identified are returned as pending coordination instead of being mapped to normal. Queue sorting and single order candidate sorting are handled separately. The overall fulfillment rate of service personnel cannot replace their historical service relationship with the target elderly person. Continuity criteria include patterns and historical personnel sets or queryable elderly characteristic identifiers. In the priority mode, after all hard criteria are met and the automatic score reaches the threshold, historical service personnel are considered first. If no qualified historical personnel are available, other personnel can be selected based on the score, and the unmet preference is recorded. The mandatory mode only retains the specified set; if no qualified personnel are available, coordination is pending. Personnel queries only require authorized association identifiers and service records; the entire health record is not required to be transmitted. Automatic confirmation, manual allocation, task hall retrieval, and organizational allocation all share version verification, mandatory constraint validation, and capacity write paths. Rollback of published transactions retains the current constraint version; if a higher version is received after publication but not yet claimed, the version is switched according to the order lock, and the channel display is updated, with the retrieval transaction reading the latest reference. Version conflicts, unknown mandatory requirements, and unsupported collaborative tasks do not enter the normal order-grabbing path, and restrictions cannot be lifted under the guise of "manual processing." The interface receives receipts and returns the local order identifier, constraint version, and received or pending coordination status; it does not return false order dispatch success messages. During confirmation or rollback processing, a result event with an event identifier and an incrementing sequence number within the order is generated. The event record and corresponding status update are saved within the same transaction and sent asynchronously after commit. Sending failures can be retried; the upstream system deduplicates by event identifier and rejects older statuses overwriting newer statuses by sequence number, querying the current status as needed to fill in any omissions. The aforementioned interface handles the execution requirements already determined by the source, distinct from health requirement reasoning and service scheme configuration. Its function is to maintain the consistency of constraints in each stage of receiving, previewing, confirming, rolling back, and transmitting, without replacing the original service scheme generation module with interface compatibility. The above embodiments are used to illustrate the technical solution of the present invention. Specific status codes, database products, and notification protocols can be replaced with equivalent ones; the scope of protection of the present invention is determined by the claims.
Claims
1. A smart scheduling method for home-based elderly care services based on multi-constraint re-verification and failure rollback, executed by a server, characterized in that: Obtain the service orders to be assigned, the set of execution constraints and the constraint version bound to the orders, and the enabled scheduling rules. The set of execution constraints is determined by the order source and saved after being verified by the interface. A candidate set is generated based on the service category. The mandatory conditions in the execution constraint set, along with personnel qualifications, order attribution, order acceptance status, appointment scheduling, service capacity, location validity, and service radius conditions, are used together for hard constraint screening. Only personnel that pass the screening are scored, the candidate ranking results are output, and a candidate snapshot of the associated constraint version is saved. In response to the confirmation command, the order record and the scheduling data record of the target personnel are locked sequentially in the database transaction. The currently bound constraint version and dynamic constraint input are read. When the constraint version is consistent with the candidate snapshot, hard constraint filtering and scoring are performed again. The dispatch result is written through atomic update with old order status and constraint version conditions, and the confirmation log is written in the same transaction. If the version is inconsistent, the filtering fails, or the atomic update fails, the rollback is performed and the confirmation is rejected. In automatic mode, when there are qualified candidates whose scores reach the minimum, a confirmation instruction is generated according to the candidate sorting. Otherwise, the task is released to the task hall, transferred to the service organization, or kept in the pending allocation status in the failure rollback manner. Rollback only changes the processing channel while retaining the execution constraint set and its version. Before each channel writes the personnel allocation results, the version check and hard constraint verification are performed. Orders that cannot complete the verification remain unallocated and the reason is recorded.
2. The method of claim 1, wherein, The service order includes an order identifier, service category, appointment time, service location, service organization identifier, service status, recipient identifier, and posting status. The conditions for allocation include a service status of "waiting for order acceptance," a recipient identifier that is empty, and a posting status of "waiting for allocation," "posted to the task hall," or "transferred to a service organization," and must match the current allocation entry's allowed status. The scheduling data includes a personnel identifier, latitude and longitude, service radius, order acceptance status, maximum daily order volume, and maximum number of simultaneous service orders. The effective skill association includes a personnel identifier, service category identifier, skill level, and activation status. The service order is also associated with a source system identifier, a source order identifier, and a versioned execution constraint record. The execution constraint record distinguishes between mandatory and preferred conditions; if mandatory conditions are missing, unidentifiable, or conflicting, automatic allocation will not proceed.
3. The method of claim 2, wherein, The hard constraint screening includes: The verification personnel account is activated and authenticated, and the service organization to which the verification personnel belongs is consistent with the service organization specified in the order; The verification personnel are in an order-accepting state, the order information is complete, and the appointment time is within at least one available shift of the corresponding week. The verification shows that the personnel capacity occupancy obtained according to the order capacity standard has not reached the upper limit, and the number of orders that have been allocated and not cancelled on the appointment day is less than the maximum daily order volume; Each order must be verified for health execution restrictions and minimum qualification requirements. If the minimum qualification is not met, compensation with skill scores is not allowed. Verify that the order location and personnel location are valid, and that the service distance between them is not greater than the effective service radius; The above checks are performed in a preset order. For personnel who fail any check, the subsequent scoring is stopped, the first check item they fail is recorded, and the number of eliminations is accumulated according to the check item.
4. The method of claim 3, wherein, The service distance is calculated using the semi-sine spherical distance method based on the latitude and longitude of the order service location and the personnel location. Before calculation, the two locations are converted to the same coordinate reference and the latitude and longitude are converted to radians. The effective service radius is the smaller value between the maximum order dispatch distance and the personnel service radius in the order dispatch rules. Both the maximum order dispatch distance and the personnel service radius are positive numbers. For personnel who cannot obtain an effective location or effective service radius, their distance score is not calculated.
5. The method of claim 3, wherein, The normalized weighted score uses a distance factor and a load factor. The distance factor is obtained by subtracting the ratio of the service distance to the effective service radius from one. The appointment day load factor is obtained by subtracting the ratio of the number of allocated and non-cancelled orders on the appointment day to the maximum daily order volume from one. The concurrent load factor is obtained by subtracting the ratio of the concurrent occupancy obtained according to the order capacity to the corresponding capacity limit from one. The load factor is the smaller value between the appointment day load factor and the concurrent load factor. The results of the above factors are all truncated to a closed interval between zero and one, and the maximum daily order volume and the maximum number of orders served simultaneously are positive integers.
6. The method of claim 5, wherein, The normalized weighted scoring also employs a skill factor, a service organization matching factor, and a historical performance factor. The skill factor is the ratio of the skill level of the corresponding service category to the preset highest skill level, truncated to a closed interval of zero to one. The service organization matching factor selects one for each candidate service personnel who have passed the order attribution verification. The historical performance factor is the number of orders completed by the personnel divided by the sum of the number of completed orders and the number of cancelled orders. When the sum is zero, a preset initial performance coefficient is used. The weights of each factor are non-negative and the sum of the weights is greater than zero. One hundred is multiplied by the product of each factor and its corresponding weight, and then divided by the sum of the weights to obtain the score for each sub-item. The scores of each sub-item are rounded to a preset number of decimal places, summed, and rounded again to obtain the comprehensive score. Without a continuity preference, the candidate ranking results are formed by descending the comprehensive score and ascending the service distance. With a continuity preference, within the candidate set that meets the mandatory conditions, the ranking is first based on the preference and then by the score and distance.
7. The method of claim 1, wherein, The candidate snapshots include personnel identifier, service organization identifier, service distance, skill level, number of orders allocated and not cancelled on the appointment date, number of orders currently in service, corresponding capacity limit, historical fulfillment factor, comprehensive score, and sub-item score; the preview log associates the candidate snapshots during the preview, and confirms the candidate snapshots recalculated within the associated transaction, recording the scheduling mode, processing result, failure reason, operation subject, and generation time respectively; after the database transaction is rolled back, the reason for rejection of confirmation is recorded outside the transaction; The candidate snapshot and confirmation log also record the execution constraint version, rule version or actual parameters used, selected execution period and constraint verification results, and return the reason for re-previewing when the preview version expires.
8. The method according to claim 1, characterized in that, The order records and scheduling data records use exclusive row locks. For different order confirmation transactions targeting the same service personnel, each personnel allocation entry point reads the submitted service capacity occupancy data and execution constraint records after acquiring the lock on the personnel's scheduling data record, and completes capacity verification and order status updates during the lock holding period. The atomic update simultaneously limits the order identifier, the service status before the update, the recipient identifier, the release status, and the execution constraint version, and uses the number of affected records returned by the database as a condition for successful update. The dispatch notification is sent only after the transaction is successfully committed, and no dispatch success notification is sent when the transaction is rolled back.
9. The method according to claim 1, characterized in that, The interface verification includes parsing the service category code, execution time window with time zone, service duration, service address, health execution restrictions, minimum qualification requirements, special precautions, timeliness level, continuity preference, and number of users according to the interface version and mapping table, and retaining the source fields and their mandatory attributes; using the source system identifier, source order identifier, and constraint version to form a deduplication key, duplicate requests with the same key and content will return the existing received results, while requests with the same key but different content will be rejected; higher version constraints will only be replaced after the order is verified and locked before the order is assigned, and changes to assigned orders will be transferred to coordination processing and will not directly overwrite the confirmed results.
10. The method according to claim 3, characterized in that, For orders with execution time windows and positive service durations, the complete execution interval is determined at the intersection of the time window and the personnel schedule; confirmed but not cancelled and incomplete reservations are counted as half-open intervals, and the original number of reservations at any time within the target interval plus one is checked to ensure that it does not exceed the capacity limit; the interval occupancy is recalculated during the period when the personnel holding the transaction are locked for the order data record, and the reservation occupancy, order dispatch results and confirmation logs are written in the same transaction, and reservations on different dates and that do not overlap are not equated to simultaneous execution.
11. The method according to claim 1, characterized in that, The continuity preference in the execution constraint set is achieved through the association record between the target elderly person's identifier and the historical service personnel. When it is a mandatory designation, the designated personnel are selected; when it is a priority preference, the historical service personnel are prioritized within the qualified set. For composite orders that require multiple people to execute simultaneously or cannot be mapped to a single executable category, the interface returns a pending coordination status and prevents entry into single-person automatic confirmation, while retaining the number of people, task association, and all mandatory conditions. The receipt of an order by the task hall or service organization does not constitute a successful personnel dispatch. Successful personnel dispatch is only reported back after constraint review and database transaction submission.
12. A smart scheduling system for home-based elderly care services based on multi-constraint re-verification and failure rollback, characterized in that, This includes a server and a database communicating with the server, the server comprising a processor, a memory, and the following modules formed by the processor executing programs in the memory: The order and rule acquisition module is used to acquire service orders to be assigned, execution constraint sets and their versions that have been verified and bound by the interface, and enabled scheduling rules; The candidate generation and filtering module is used to form a candidate set with effective skill associations according to service category, and to filter candidates based on hard constraints such as personnel qualifications, order attribution, order acceptance status, appointment scheduling, service capacity, location validity and service radius, and mandatory conditions of the execution constraint set. The scoring and preview module is used to perform normalized weighted scoring on the screened personnel, output the candidate ranking results and sub-item scores, and associate the order saving rule identifier, constraint version and candidate snapshot; The transaction confirmation module is used to respond to confirmation commands. In the database transaction, it locks the order record and the target personnel scheduling data record in sequence, checks that the current constraint version of the order is consistent with the snapshot version, and performs hard constraint filtering and scoring again based on the reread data. When the filtering is successful and the order still meets the conditions for assignment, the target personnel identifier and assignment status are written through atomic update with the old status of the order and constraint version conditions, and the confirmation log is written in the same transaction. When the filtering fails again or the atomic update fails, the transaction is rolled back and the confirmation is rejected. The automatic order dispatch and rollback module is used to generate confirmation instructions according to the candidate sorting when there are qualified candidates whose scores reach the minimum of the rules. Otherwise, according to the rules, orders that still meet the conditions for rollback will be issued to the task hall, transferred to the service organization, or kept in the pending allocation status for manual processing. The execution constraint set and version are retained and the rollback result is recorded. The constraint verification module is shared by the above allocation channels. If any channel cannot complete the mandatory condition verification, it will remain unassigned.
13. The system according to claim 12, characterized in that, It also includes a batch processing module and an auditing module; the batch processing module deduplicates the input order identifiers, performs previews or transaction confirmations independently on each order, and returns the results; the automatic order dispatch and rollback module, when carrying timeliness level and time window priority, determines the order according to timeliness level, time window priority, latest start time, appointment time, and order identifier; when not carrying timeliness level and time window priority, it scans orders in ascending order according to appointment time and order identifier within the preset batch limit, and scans orders with a release status of "waiting for allocation" and a service status of "waiting for order acceptance". After successful dispatch, release, or transfer, the order is removed from the scanning range; the auditing module associates candidate snapshots, sub-scores, elimination reasons, processing results, and operating entities with each order.
