--- name: eGFR fix and video gen overview: Fix the eGFR field not appearing in calculator results due to a Lombok/Jackson serialization mismatch, and ensure the check-in page correctly calls the KieAI API to generate sora videos when the toggle is enabled. todos: - id: fix-egfr-serialization content: Add @JsonProperty("eGFR") to HealthData.eGFR field in NutritionCalculateResponse.java to fix JSON serialization mismatch status: completed - id: fix-nframes-hardcode content: Fix n_frames hardcoded value in ToolSora2ServiceImpl.java to use the request input value instead of always "15" status: completed - id: verify-checkin-video-flow content: Verify and fix the end-to-end video generation flow from checkin-publish.vue through KieAI API, ensuring taskId is properly stored in UserSign status: completed - id: improve-video-error-handling content: Improve error handling and user feedback in checkin-publish.vue for video generation failures status: completed isProject: false --- # Fix eGFR Display and Check-in Video Generation ## Issue 1: eGFR Not Showing in Calculator Results ### Root Cause The field `private String eGFR` in `HealthData` uses Lombok `@Data`, which generates the getter `getEGFR()`. Jackson follows Java Beans naming convention: when the first two characters after stripping "get" are both uppercase ("EG"), the property name stays as-is: `"EGFR"`. The frontend expects `data.healthData.eGFR` but receives `data.healthData.EGFR`, resulting in `undefined` and displaying `--`. ```mermaid sequenceDiagram participant FE as Frontend participant BE as Backend FE->>BE: GET /tool/calculator/result/{id} BE->>BE: buildResponse() sets healthData.setEGFR(...) BE-->>FE: JSON: {"healthData":{"EGFR":"7.9",...}} FE->>FE: healthData.eGFR is undefined FE->>FE: Displays "--" ``` ### Fix Add `@JsonProperty("eGFR")` annotation to the `eGFR` field in [NutritionCalculateResponse.java](msh_crmeb_22/crmeb-common/src/main/java/com/zbkj/common/response/NutritionCalculateResponse.java) (line 55): ```java @JsonProperty("eGFR") @ApiModelProperty(value = "eGFR数值(ml/min/1.73m²)", example = "7.9") private String eGFR; ``` This forces Jackson to use the exact field name `"eGFR"` in JSON output, matching the frontend's expectation. --- ## Issue 2: Check-in Page Video Generation ### Current State The implementation already exists in [checkin-publish.vue](msh_single_uniapp/pages/tool/checkin-publish.vue) (lines 590-627). It calls `api.createImageToVideoTask()` / `api.createTextToVideoTask()` from [models-api.js](msh_single_uniapp/api/models-api.js) which hit the backend [KieAIController.java](msh_crmeb_22/crmeb-front/src/main/java/com/zbkj/front/controller/KieAIController.java) endpoints at `/api/front/kieai/image-to-video` and `/api/front/kieai/text-to-video`. Auth is not required (kieai endpoints are excluded from the interceptor in [WebConfig.java](msh_crmeb_22/crmeb-front/src/main/java/com/zbkj/front/config/WebConfig.java) line 98). ```mermaid sequenceDiagram participant User participant CheckinPage as checkin-publish.vue participant ModelsAPI as models-api.js participant Backend as KieAIController participant Sora2 as ToolSora2ServiceImpl participant KieAI as KieAI API User->>CheckinPage: Toggle "生成打卡视频" ON, click 发布 CheckinPage->>ModelsAPI: createImageToVideoTask({imageUrl, prompt, uid}) ModelsAPI->>Backend: POST /api/front/kieai/image-to-video Backend->>Sora2: createImageToVideoTask(...) Sora2->>KieAI: Upload image to KieAI Sora2->>KieAI: POST /api/v1/jobs/createTask (sora-2-image-to-video) KieAI-->>Sora2: {taskId: "..."} Sora2->>Sora2: Save Article record with taskId Sora2-->>Backend: taskId Backend-->>ModelsAPI: CommonResult{code:200, data: taskId} ModelsAPI-->>CheckinPage: response CheckinPage->>CheckinPage: submitCheckin({...taskId...}) ``` ### Issues to Fix **a) Request parameter format bug in `models-api.js**` The `createImageToVideoTask` function sends `image_urls` as `[params.imageUrl]` (single URL in array). However, the `Sora2Request.Input.image_urls` field is `String[]` -- this should work for deserialization, but the request body also sets `uid` as a potential number (from vuex). The `Sora2Request.uid` is `String` type. Jackson auto-coerces `number -> String`, so this is fine. No code change needed here. **b) `n_frames` hardcoded in backend** The backend [ToolSora2ServiceImpl.java](msh_crmeb_22/crmeb-service/src/main/java/com/zbkj/service/service/impl/tool/ToolSora2ServiceImpl.java) hardcodes `input.put("n_frames", "15")` at lines 44 and 109, ignoring the value sent by the frontend (`5`). For check-in videos, a shorter duration (5 frames ~ 5 seconds) is more appropriate. Change to use the value from the request input. **c) Video task result not linked to check-in in backend** Currently the video task creates an `Article` record but has no direct link to the `UserSign` (check-in) record. The frontend passes `taskId` in the `submitCheckin` request, but this linkage should be verified in the backend `ToolCheckinServiceImpl` to properly store and retrieve the video for the check-in. **d) Error handling improvement in frontend** The current error handling silently fails. Improve feedback to the user when video generation fails. ### Changes - **[ToolSora2ServiceImpl.java](msh_crmeb_22/crmeb-service/src/main/java/com/zbkj/service/service/impl/tool/ToolSora2ServiceImpl.java)**: Use the `n_frames` value from the request input instead of hardcoding `"15"`. Both `createTextToVideoTask` (line 44) and `createImageToVideoTask` (line 109) need this fix. - **[checkin-publish.vue](msh_single_uniapp/pages/tool/checkin-publish.vue)**: Improve video generation error handling and ensure proper prompt construction for nutritional video content. - **Verify backend checkin service** stores the `taskId` from the video task in the `UserSign` record correctly.