/*
 * Copyright ©2023 CJB-CNIT Team. All rights reserved
 */
package com.openhis.web.regdoctorstation.controller;

import org.springframework.web.bind.annotation.*;

import com.core.common.core.domain.R;
import com.openhis.web.regdoctorstation.appservice.ISpecialAdviceAppService;
import com.openhis.web.regdoctorstation.dto.LeaveHospitalParam;
import com.openhis.web.regdoctorstation.dto.NursingOrdersSaveDto;
import com.openhis.web.regdoctorstation.dto.TransferOrganizationParam;

import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * 特殊医嘱 controller
 */
@RestController
@RequestMapping("/reg-doctorstation/special-advice")
@Slf4j
@AllArgsConstructor
public class SpecialAdviceController {

    private final ISpecialAdviceAppService iSpecialAdviceAppService;

    /**
     * 查询护理医嘱信息
     * 
     * @return 护理医嘱信息
     */
    @GetMapping(value = "/nursing-orders")
    public R<?> getNursingOrdersInfos() {
        return R.ok(iSpecialAdviceAppService.getNursingOrdersInfos());
    }

    /**
     * 保存护理医嘱
     * 
     * @param nursingOrdersSaveDto 护理医嘱保存dto
     * @return 结果
     */
    @PostMapping(value = "/nursing-orders")
    public R<?> saveNursingOrders(@RequestBody NursingOrdersSaveDto nursingOrdersSaveDto) {
        return iSpecialAdviceAppService.saveNursingOrders(nursingOrdersSaveDto);
    }

    /**
     * 查询就诊护理医嘱
     * 
     * @param encounterId 就诊id
     * @return 就诊护理医嘱
     */
    @GetMapping(value = "/encounter-nursing-orders")
    public R<?> getEncounterNursingOrdersInfos(@RequestParam Long encounterId) {
        return R.ok(iSpecialAdviceAppService.getEncounterNursingOrdersInfos(encounterId));
    }

    /**
     * 保存转科医嘱
     * 
     * @param transferOrganizationParam 转科医嘱参数
     * @return 结果
     */
    @PostMapping(value = "/transfer-organization-orders")
    public R<?> saveTransferOrganizationOrders(@RequestBody TransferOrganizationParam transferOrganizationParam) {
        return iSpecialAdviceAppService.saveTransferOrganizationOrders(transferOrganizationParam);
    }

    /**
     * 保存出院医嘱
     *
     * @param leaveHospitalParam 转科医嘱参数
     * @return 结果
     */
    @PostMapping(value = "/leave-hospital-orders")
    public R<?> saveLeaveHospitalOrders(@RequestBody LeaveHospitalParam leaveHospitalParam) {
        return iSpecialAdviceAppService.saveLeaveHospitalOrders(leaveHospitalParam);
    }

}
