package com.ruoyi.os.controller;


import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.os.domain.HealthcareOsConventionalPrescriptions;
import com.ruoyi.os.domain.HealthcareOsPatientDiagnosis;
import com.ruoyi.os.service.IConventionalPrescriptionsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;

/**
 *
 *  @author 何顺
 *  @date 2024-09-17
 */
@RestController
@RequestMapping("/outpatientService/conventionalPrescriptions")
public class ConventionalPrescriptionsController extends BaseController
{

    //
    @Autowired
    private IConventionalPrescriptionsService iConventionalPrescriptionsService;


    /**
     *   获取  常规 处方  列表
     */
    @PreAuthorize("@ss.hasPermi('os:conventionalPrescriptions:list')")
    @GetMapping("/list")
    public TableDataInfo list(HealthcareOsConventionalPrescriptions conventionalPrescriptions)
    {
        startPage();
        return getDataTable(iConventionalPrescriptionsService.gainConventionalPrescriptionsList(conventionalPrescriptions));
    }

    /**
     *   获取  常规 处方  详细
     */
    @PreAuthorize("@ss.hasPermi('os:conventionalPrescriptions:getInfo')")
    @GetMapping("/getInfo/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(iConventionalPrescriptionsService.gainConventionalPrescriptions(id));
    }

    /**
     *   添加  常规 处方  列表
     */
    @PreAuthorize("@ss.hasPermi('os:conventionalPrescriptions:add')")
    @PostMapping("/add")
    public AjaxResult add(@RequestBody HealthcareOsConventionalPrescriptions conventionalPrescriptions)
    {
        return toAjax(iConventionalPrescriptionsService.addConventionalPrescriptions(conventionalPrescriptions));
    }


    /**
     *   修改  常规 处方  列表 remove
     */
    @PreAuthorize("@ss.hasPermi('os:conventionalPrescriptions:update')")
    @PostMapping("/update")
    public AjaxResult update(@RequestBody HealthcareOsConventionalPrescriptions conventionalPrescriptions)
    {
        return toAjax(iConventionalPrescriptionsService.updateConventionalPrescriptions(conventionalPrescriptions));
    }

    /**
     *   删除  常规 处方  列表 remove
     */
    @PreAuthorize("@ss.hasPermi('os:conventionalPrescriptions:remove')")
    @GetMapping("/remove/{id}")
    public AjaxResult remove(@PathVariable("id") Long id)
    {
        return toAjax(iConventionalPrescriptionsService.deleteConventionalPrescriptions(id));
    }

}
