# guide-flow Specification ## Purpose Provide the patient-facing visit guidance experience for Pu Rui Smart Hospital Mini Program V2.0: guidance tab/list, detail process, visit code, document carriers, evaluation and AI guide entry. The module restores old guidance APIs and new `page-aiguide`/`page-guide`/`page-guide-detail` layouts while keeping real AI recommendation, refund/reschedule, payment, insurance and IM/TRTC write operations outside this module. ## Requirements ### Requirement: Guide List Page The system SHALL provide a visit guidance tab page that restores the new `page-guide` layout and the old guidance list behavior. #### Scenario: Load guidance list for current patient - **GIVEN** the current hospital has `guideHospConfig` enabled and a current patient exists - **WHEN** the user opens the guide tab - **THEN** the page SHALL request guidance list data through `17050049` - **AND** the page SHALL show visit code, process cards, hospital actions, real reminder information when returned, and list records. - **AND** the page SHALL NOT show static weather or reminder mock data when no real source is returned. #### Scenario: Guidance feature unavailable - **GIVEN** the current hospital has not enabled guidance - **WHEN** the user opens the guide tab - **THEN** the page SHALL show an unavailable state and SHALL NOT call guidance list APIs. #### Scenario: Guidance unread badge - **GIVEN** a current patient exists - **WHEN** the guide tab loads or refreshes - **THEN** the system SHALL request unread count through `01010035` - **AND** sync `triageUnreadMessageCount` to the custom tab bar settings. ### Requirement: Guide Detail Page The system SHALL provide a visit guidance detail page that restores the new `page-guide-detail` layout and old detail process behavior. #### Scenario: Load detail and process categories - **GIVEN** a guide record `admID` - **WHEN** the user opens detail - **THEN** the page SHALL request base detail through `17050050` - **AND** request process categories through `01010032` - **AND** request category details through `01010033`. #### Scenario: Safe document and operation boundaries - **GIVEN** the detail contains prescription, exam, refund, reschedule or payment-related entries - **WHEN** the user taps those entries - **THEN** the page SHALL show safe entry, disabled, or construction feedback - **AND** SHALL NOT perform real refund, reschedule, payment, insurance, IM/TRTC or document payment write operations. ### Requirement: Guide Evaluation The system SHALL support guidance evaluation status query and submission according to the legacy source behavior, and SHALL treat only an explicit completed status as already evaluated. Boolean/string `false`, `N`, `null`, an absent status, and unrecognized statuses MUST NOT disable the evaluation form by default. #### Scenario: Normalize an explicit evaluated status - **GIVEN** `01010040` returns the legacy completed marker `status: 'Y'` - **WHEN** the guide detail loads the evaluation record - **THEN** the system SHALL display the record as evaluated - **AND** SHALL disable rating, content editing, and duplicate submission. #### Scenario: Normalize an eligible evaluation status - **GIVEN** `01010040` returns `N`, boolean/string `false`, boolean/string `true`, `null`, no status, or an unrecognized status - **WHEN** the guide detail loads the evaluation record - **THEN** the system SHALL display the record as pending evaluation - **AND** SHALL keep rating and content inputs available without issuing a submission request. #### Scenario: Preserve submission failure input - **GIVEN** a record is pending evaluation and the user has entered a rating and content - **WHEN** the real `01010039` submission fails in an authorized manual test - **THEN** the system SHALL preserve the entered rating and content - **AND** SHALL not mark the record evaluated solely because the request failed. ### Requirement: AI Guide Entry The system SHALL provide an AI guide entry that restores the new `page-aiguide` interaction without producing medical diagnosis. #### Scenario: AI guide interface not connected - **GIVEN** the user selects a crowd and enters symptoms - **WHEN** the user submits guide information before a real AI guide interface is connected - **THEN** the page SHALL show unavailable feedback - **AND** SHALL NOT show static, rule-based, mock department hints, science cards, diagnosis, treatment or medication conclusions. #### Scenario: Connect AI guide to registration - **GIVEN** a real recommendation interface is not connected - **WHEN** the user opens the AI guide entry - **THEN** the page SHALL keep the entry available for future integration - **AND** SHALL NOT navigate with mock department context.