package com.docus.server.gdszyzh.controller;

import com.docus.core.util.Func;
import com.docus.infrastructure.web.api.CommonResult;
import com.docus.server.gdszyzh.service.ReportCollectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jline.internal.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 *
 * @author YongBin Wen
 * @date 2026/4/7 16:35
 */
@RestController
@RequestMapping("/gdszyzh")
@Api(tags = "广东省中医珠海文件接口")
public class ReportCollectController {
    @Autowired
    private ReportCollectService reportCollectService;

    @PostMapping("/collect/pacs")
    @ApiOperation("采集PACS报告")
    public CommonResult<String> collectPacs(@RequestBody List<String> patientIds) {
        if (Func.isNotEmpty(patientIds)) {
            Log.info("PACS报告采集接口，参数：{}", patientIds);
            reportCollectService.collectPacs(patientIds);
        }
        return CommonResult.success("采集完成！");
    }

    @PostMapping("/collect/lis")
    @ApiOperation("采集LIS报告")
    public CommonResult<String> collectLis(@RequestBody List<String> patientIds) {
        if (Func.isNotEmpty(patientIds)) {
            Log.info("LIS报告采集接口，参数：{}", patientIds);
            reportCollectService.collectLis(patientIds);
        }
        return CommonResult.success("采集完成！");
    }

    @PostMapping("/collect/icu")
    @ApiOperation("采集ICU报告")
    public CommonResult<String> collectIcu(@RequestBody List<String> patientIds) {
        if (Func.isNotEmpty(patientIds)) {
            Log.info("ICU报告采集接口，参数：{}", patientIds);
            reportCollectService.collectIcu(patientIds);
        }
        return CommonResult.success("采集完成！");
    }

    @PostMapping("/collect/ecg")
    @ApiOperation("采集ECG报告")
    public CommonResult<String> collectEcg(@RequestBody List<String> patientIds) {
        if (Func.isNotEmpty(patientIds)) {
            Log.info("ECG报告采集接口，参数：{}", patientIds);
            reportCollectService.collectEcg(patientIds);
        }
        return CommonResult.success("采集完成！");
    }

    @PostMapping("/collect/shouMa")
    @ApiOperation("采集ECG报告")
    public CommonResult<String> collectShouMa(@RequestBody List<String> patientIds) {
        if (Func.isNotEmpty(patientIds)) {
            Log.info("ShouMa报告采集接口，参数：{}", patientIds);
            reportCollectService.collectShouMa(patientIds);
        }
        return CommonResult.success("采集完成！");
    }
}
