package com.kcim.web;

import com.kcim.common.util.Result;
import com.kcim.dao.model.*;
import com.kcim.service.*;
import com.kcim.web.request.AccountingItemMapRequest;
import com.kcim.web.request.ItemMapRequest;
import com.kcim.web.request.OrderItemRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @program: CostAccount
 * @description: 基础设置控制类
 * @author: Wang.YS
 * @create: 2023-10-17 16:14
 **/
@Api(tags = "基础设置")
@AllArgsConstructor
@RequestMapping("setting")
@RestController
public class SettingController {

    ReportColumnService reportColumnService;
    @GetMapping("getReport")
    @ApiOperation("基础设置-其他设置-报表项目设置-获取报表代码")
    public Result getReport(){
        return Result.ok(reportColumnService.getReport());
    }

    @GetMapping("getReportColumn")
    @ApiOperation("基础设置-其他设置-报表项目设置-获取报表列")
    public Result getReportColumn(@RequestParam String reportCode){
        return Result.ok(reportColumnService.getReportColumn(reportCode));
    }

    @PostMapping("addReportColumn")
    @ApiOperation("基础设置-其他设置-报表项目设置-添加报表列")
    public Result addReportColumn(@RequestBody ReportColumn column){
        reportColumnService.addReportColumn(column);
        return Result.ok();
    }

    @PostMapping("editReportColumn")
    @ApiOperation("基础设置-其他设置-报表项目设置-编辑报表列")
    public Result editReportColumn(@RequestBody ReportColumn column){
        reportColumnService.editReportColumn(column);
        return Result.ok();
    }
    @PostMapping("deleteReportColumn")
    @ApiOperation("基础设置-其他设置-报表项目设置-删除报表列")
    public Result deleteReportColumn(@RequestParam Integer id){
        reportColumnService.deleteReportColumn(id);
        return Result.ok();
    }

    /**
     * 人事分类管理
     */
    EmpCostTypeService empCostTypeService;
    @GetMapping("getEmpCostType")
    @ApiOperation("获取人事分类")
    public Result getEmpCostType(@RequestParam(required = false) String costTypeName){
        return Result.ok(empCostTypeService.getEmpCostType(costTypeName));
    }

    @PostMapping("addEmpCostType")
    @ApiOperation("添加人事分类")
    public Result addEmpCostType(@RequestBody EmpCostType request){
        empCostTypeService.addEmpCostType(request);
        return Result.ok();
    }

    @PostMapping("editEmpCostType")
    @ApiOperation("编辑人事分类")
    public Result editEmpCostType(@RequestBody EmpCostType request){
        empCostTypeService.editEmpCostType(request);
        return Result.ok();
    }
    @PostMapping("deleteEmpCostType")
    @ApiOperation("删除人事分类")
    public Result deleteEmpCostType(@RequestParam Integer id){
        empCostTypeService.deleteEmpCostType(id);
        return Result.ok();
    }
    @GetMapping("getEmpCostTypeDict")
    @ApiOperation("获取人事分类计算类型")
    public Result getEmpCostTypeDict(){
        return Result.ok(empCostTypeService.getEmpCostTypeDict());
    }

    EmpCostMapService empCostMapService;

    @ApiOperation("导出人事分类模版")
    @GetMapping("exportEmpType")
    public Result exportEmpType(HttpServletResponse response){
        return Result.ok(empCostMapService.exportEmpType(response));
    }
    @ApiOperation("导入人事分类模版")
    @PostMapping("importEmpType")
    public Result importEmpType(@RequestPart("file") MultipartFile file){
        empCostMapService.importEmpType(file);
        return Result.ok();
    }
    @ApiOperation("按人员类别生成")
    @PostMapping("generateEmpType")
    public Result generateEmpType(){
        empCostMapService.generateEmpType();
        return Result.ok();
    }



    @GetMapping("getEmpCostMap")
    @ApiOperation("获取人事分类人员对照")
    public Result getEmpCostMap(@RequestParam(required = false,value = "current",defaultValue = "1") Integer current,
                                @RequestParam(required = false,value = "pageSize",defaultValue = "10") Integer pageSize,
                                @RequestParam String costTypeCode,
                                @RequestParam(required = false) String filter){
        return Result.ok(empCostMapService.getEmpCostMap(current,pageSize,costTypeCode,filter));
    }

    @PostMapping("addEmpCostMap")
    @ApiOperation("添加人事分类人员对照")
    public Result addEmpCostMap(@RequestBody List<EmpCostMap> request){
        empCostMapService.addEmpCostMap(request);
        return Result.ok();
    }

    @PostMapping("updateEmpMap")
    @ApiOperation("更新人员信息")
    public Result updateEmpMap(){
        empCostMapService.updateEmpMap();
        return Result.ok();
    }
    @PostMapping("deleteEmpCostMap")
    @ApiOperation("删除人事分类人员对照")
    public Result deleteEmpCostMap(@RequestParam Integer id){
        empCostMapService.deleteEmpCostMap(id);
        return Result.ok();
    }
    @PostMapping("batchDeleteEmpCostMap")
    @ApiOperation("批量删除人事分类人员对照")
    public Result batchDeleteEmpCostMap(@RequestBody List<Integer>  id){
        empCostMapService.batchDeleteEmpCostMap(id);
        return Result.ok();
    }
    @GetMapping("getEmpInfo")
    @ApiOperation("获取人员信息")
    public Result getEmpInfo(@RequestParam String costType){
        return Result.ok(empCostMapService.getEmpInfo(costType));
    }

    /**
     * 药品字典接口
     */
    DrugService drugService;

    @GetMapping("getDrugList")
    @ApiOperation("获取药品字典")
    public Result getDrugList(@RequestParam(required = false,value = "current",defaultValue = "1") Integer current,
                              @RequestParam(required = false,value = "pageSize",defaultValue = "10")Integer pageSize,
                              @RequestParam(required = false) String name,
                              @RequestParam(required = false,value = "stop",defaultValue = "0") Integer stop){
        return Result.ok(drugService.getDrugList(current,pageSize,name,stop));
    }

    @PostMapping("addDrug")
    @ApiOperation("添加药品字典")
    public Result addDrug(@RequestBody Drug request){
        drugService.addDrug(request);
        return Result.ok();
    }

    @PostMapping("editDrug")
    @ApiOperation("编辑药品字典")
    public Result editDrug(@RequestBody Drug request){
        drugService.editDrug(request);
        return Result.ok();
    }
    @PostMapping("deleteDrug")
    @ApiOperation("删除药品字典")
    public Result deleteDrug(@RequestParam Integer id){
        drugService.deleteDrug(id);
        return Result.ok();
    }
    @ApiOperation("导出药品模版")
    @GetMapping("exportDrug")
    public Result exportDrug(HttpServletResponse response){
        return Result.ok(drugService.exportDrug(response));
    }
    @ApiOperation("导入药品字典")
    @PostMapping("importDrug")
    public Result importDrug(@RequestPart("file") MultipartFile file){
        drugService.importDrug(file);
        return Result.ok();
    }
    @ApiOperation("获取药品类型")
    @GetMapping("getDrugType")
    public Result getDrugType(){

        return Result.ok(drugService.getDrugType());
    }
    /**
     * 材料成本管理接口
     */
    MaterialService materialService;
    @GetMapping("getMaterialList")
    @ApiOperation("获取材料字典")
    public Result getMaterialList(@RequestParam(required = false,value = "current",defaultValue = "1") Integer current,
                              @RequestParam(required = false,value = "pageSize",defaultValue = "10")Integer pageSize,
                              @RequestParam(required = false) String name,
                              @RequestParam(required = false) Integer itemType,
                              @RequestParam(required = false,value = "stop",defaultValue = "0") Integer stop){
        return Result.ok(materialService.getMaterialList(current,pageSize,name,itemType,stop));
    }

    @PostMapping("addMaterial")
    @ApiOperation("添加材料字典")
    public Result addMaterial(@RequestBody Material request){
        materialService.addMaterial(request);
        return Result.ok();
    }

    @PostMapping("editMaterial")
    @ApiOperation("编辑材料字典")
    public Result editMaterial(@RequestBody Material request){
        materialService.editMaterial(request);
        return Result.ok();
    }
    @PostMapping("deleteMaterial")
    @ApiOperation("删除材料字典")
    public Result deleteMaterial(@RequestParam Integer id){
        materialService.deleteMaterial(id);
        return Result.ok();
    }
    @ApiOperation("导出材料模版")
    @GetMapping("exportMaterial")
    public Result exportMaterial(HttpServletResponse response){
        return Result.ok(materialService.exportMaterial(response));
    }
    @ApiOperation("导入材料字典")
    @PostMapping("importMaterial")
    public Result importMaterial(@RequestPart("file") MultipartFile file){
        materialService.importMaterial(file);
        return Result.ok();
    }

    /**
     * 设备成本管理
     */
    EquipmentService equipmentService;
    @GetMapping("getEquipmentList")
    @ApiOperation("获取设备成本字典")
    public Result getEquipmentList(@RequestParam(required = false,value = "current",defaultValue = "1") Integer current,
                                  @RequestParam(required = false,value = "pageSize",defaultValue = "10")Integer pageSize,
                                  @RequestParam(required = false) String name,
                                  @RequestParam(required = false,value = "stop",defaultValue = "0") Integer stop){
        return Result.ok(equipmentService.getEquipmentList(current,pageSize,name,stop));
    }

    @PostMapping("addEquipment")
    @ApiOperation("添加设备成本字典")
    public Result addEquipment(@RequestBody Equipment request){
        equipmentService.addEquipment(request);
        return Result.ok();
    }

    @PostMapping("editEquipment")
    @ApiOperation("编辑设备成本字典")
    public Result editEquipment(@RequestBody Equipment request){
        equipmentService.editEquipment(request);
        return Result.ok();
    }
    @PostMapping("deleteEquipment")
    @ApiOperation("删除设备成本字典")
    public Result deleteEquipment(@RequestParam Integer id){
        equipmentService.deleteEquipment(id);
        return Result.ok();
    }
    @ApiOperation("导出设备成本模版")
    @GetMapping("exportEquipment")
    public Result exportEquipment(HttpServletResponse response){
        return Result.ok(equipmentService.exportEquipment(response));
    }
    @ApiOperation("导入设备成本字典")
    @PostMapping("importEquipment")
    public Result importEquipment(@RequestPart("file") MultipartFile file){
        equipmentService.importEquipment(file);
        return Result.ok();
    }

    /**
     * 病种管理
     */
    DiseaseTypeService diseaseTypeService;
    @GetMapping("getDiseaseTypeList")
    @ApiOperation("获取病种管理字典")
    public Result getDiseaseTypeList(@RequestParam(required = false,value = "current",defaultValue = "1") Integer current,
                                   @RequestParam(required = false,value = "pageSize",defaultValue = "10")Integer pageSize,
                                   @RequestParam(required = false) String name){
        return Result.ok(diseaseTypeService.getDiseaseTypeList(current,pageSize,name));
    }

    @PostMapping("addDiseaseType")
    @ApiOperation("添加病种管理字典")
    public Result addDiseaseType(@RequestBody DiseaseType request){
        diseaseTypeService.addDiseaseType(request);
        return Result.ok();
    }

    @PostMapping("editDiseaseType")
    @ApiOperation("编辑病种管理字典")
    public Result editDiseaseType(@RequestBody DiseaseType request){
        diseaseTypeService.editDiseaseType(request);
        return Result.ok();
    }
    @PostMapping("deleteDiseaseType")
    @ApiOperation("删除病种管理字典")
    public Result deleteDiseaseType(@RequestParam Integer id){
        diseaseTypeService.deleteDiseaseType(id);
        return Result.ok();
    }
    @ApiOperation("导出病种管理模版")
    @GetMapping("exportDiseaseType")
    public Result exportDiseaseType(HttpServletResponse response){
        return Result.ok(diseaseTypeService.exportDiseaseType(response));
    }
    @ApiOperation("导入病种管理字典")
    @PostMapping("importDiseaseType")
    public Result importDiseaseType(@RequestPart("file") MultipartFile file){
        diseaseTypeService.importDiseaseType(file);
        return Result.ok();
    }

    /**
     * 诊断与病种对照
     */
    DiseaseTypeDiagMapService diseaseTypeDiagMapService;

    @GetMapping("getDiseaseTypeMapList")
    @ApiOperation("获取诊断与病种对照列表")
    public Result getDiseaseTypeMapList(@RequestParam(required = false,value = "current",defaultValue = "1") Integer current,
                                     @RequestParam(required = false,value = "pageSize",defaultValue = "10")Integer pageSize,
                                     @RequestParam(required = false) String name,
                                        @RequestParam(required = false,defaultValue = "0") Integer type){
        return Result.ok(diseaseTypeDiagMapService.getDiseaseTypeMapList(current,pageSize,name,type));
    }

    @PostMapping("addDiseaseTypeMap")
    @ApiOperation("添加诊断")
    public Result addDiseaseTypeMap(@RequestBody DiseaseTypeDiagMap request){
        diseaseTypeDiagMapService.addDiseaseTypeMap(request);
        return Result.ok();
    }

    @PostMapping("editDiseaseTypeMap")
    @ApiOperation("编辑诊断")
    public Result editDiseaseTypeMap(@RequestBody DiseaseTypeDiagMap request){
        diseaseTypeDiagMapService.editDiseaseTypeMap(request);
        return Result.ok();
    }
    @PostMapping("deleteDiseaseTypeMap")
    @ApiOperation("删除诊断")
    public Result deleteDiseaseTypeMap(@RequestParam Integer id){
        diseaseTypeDiagMapService.deleteDiseaseTypeMap(id);
        return Result.ok();
    }
    @ApiOperation("导出诊断模版")
    @GetMapping("exportDiseaseTypeMap")
    public Result exportDiseaseTypeMap(HttpServletResponse response){
        return Result.ok(diseaseTypeDiagMapService.exportDiseaseTypeMap(response));
    }
    @ApiOperation("导入诊断")
    @PostMapping("importDiseaseTypeMap")
    public Result importDiseaseTypeMap(@RequestPart("file") MultipartFile file){
        diseaseTypeDiagMapService.importDiseaseTypeMap(file);
        return Result.ok();
    }

    @ApiOperation("对照诊断与病种")
    @PostMapping("matchDiseaseTypeMap")
    public Result matchDiseaseTypeMap(){
        diseaseTypeDiagMapService.matchDiseaseTypeMap();
        return Result.ok();
    }

    /**
     * 空间成本
     */
    SpaceService spaceService;
    @GetMapping("getSpaceCostList")
    @ApiOperation("获取空间成本列表")
    public Result getSpaceCostList(@RequestParam(required = false) String name,
                                   @RequestParam(required = false,value = "stop",defaultValue = "0") Integer stop){
        return Result.ok(spaceService.getSpaceCostList(name,stop));
    }

    @PostMapping("addSpaceCost")
    @ApiOperation("添加空间成本")
    public Result addSpaceCost(@RequestBody Space request){
        spaceService.addSpaceCost(request);
        return Result.ok();
    }

    @PostMapping("editSpaceCost")
    @ApiOperation("编辑空间成本")
    public Result editSpaceCost(@RequestBody Space request){
        spaceService.editSpaceCost(request);
        return Result.ok();
    }
    @PostMapping("deleteSpaceCost")
    @ApiOperation("删除空间成本")
    public Result deleteSpaceCost(@RequestParam Integer id){
        spaceService.deleteSpaceCost(id);
        return Result.ok();
    }
    @ApiOperation("导出空间成本模版")
    @GetMapping("exportSpaceCost")
    public Result exportSpaceCost(HttpServletResponse response){
        return Result.ok(spaceService.exportSpaceCost(response));
    }
    @ApiOperation("导入空间成本")
    @PostMapping("importSpaceCost")
    public Result importSpaceCost(@RequestPart("file") MultipartFile file){
        spaceService.importSpaceCost(file);
        return Result.ok();
    }

    /**
     * 收费项目接口
     */
    ItemService itemService;
    @GetMapping("getItemList")
    @ApiOperation("获取收费项目列表")
    public Result getItemList(@RequestParam(required = false,value = "current",defaultValue = "1") Integer current,
                                        @RequestParam(required = false,value = "pageSize",defaultValue = "10")Integer pageSize,
                                        @RequestParam(required = false) String name,
                              @RequestParam(required = false,defaultValue = "0") Integer type){
        return Result.ok(itemService.getItemList(current,pageSize,name,type));
    }

    @PostMapping("addItem")
    @ApiOperation("添加收费项目")
    public Result addItem(@RequestBody Item request){
        itemService.addItem(request);
        return Result.ok();
    }

    @PostMapping("editItem")
    @ApiOperation("编辑收费项目")
    public Result editItem(@RequestBody Item request){
        itemService.editItem(request);
        return Result.ok();
    }
    @PostMapping("deleteItem")
    @ApiOperation("删除收费项目")
    public Result deleteItem(@RequestParam Integer id){
        itemService.deleteItem(id);
        return Result.ok();
    }
    @ApiOperation("导出收费项目模版")
    @GetMapping("exportItem")
    public Result exportItem(HttpServletResponse response){
        return Result.ok(itemService.exportItem(response));
    }
    @ApiOperation("导入收费项目")
    @PostMapping("importItem")
    public Result importItem(@RequestPart("file") MultipartFile file){
        itemService.importItem(file);
        return Result.ok();
    }

    @ApiOperation("对照收费项目与标准项目")
    @PostMapping("matchItemAndStandItem")
    public Result matchItemAndStandItem(@RequestParam String progressKey){
        itemService.matchItemAndStandItem(progressKey);
        return Result.ok();
    }
    @ApiOperation("获取标准项目字典")
    @GetMapping("getStandItemDict")
    public Result getStandItemDict(@RequestParam(required = false) String name){
        return Result.ok(itemService.getStandItemDict(name));
    }
    /**
     * 标准项目接口
     */
    StandItemService standItemService;
    @GetMapping("getStandItemList")
    @ApiOperation("获取标准项目列表")
    public Result getStandItemList(@RequestParam(required = false,value = "current",defaultValue = "1") Integer current,
                              @RequestParam(required = false,value = "pageSize",defaultValue = "10")Integer pageSize,
                              @RequestParam(required = false) String name,
                              @RequestParam(required = false) String kcClassCode){
        return Result.ok(standItemService.getStandItemList(current,pageSize,name,kcClassCode));
    }

    @PostMapping("addStandItem")
    @ApiOperation("添加标准项目")
    public Result addStandItem(@RequestBody StandItem request){
        standItemService.addStandItem(request);
        return Result.ok();
    }

    @PostMapping("editStandItem")
    @ApiOperation("编辑标准项目")
    public Result editStandItem(@RequestBody StandItem request){
        standItemService.editStandItem(request);
        return Result.ok();
    }
    @PostMapping("deleteStandItem")
    @ApiOperation("删除标准项目")
    public Result deleteStandItem(@RequestParam Integer id){
        standItemService.deleteStandItem(id);
        return Result.ok();
    }
    @ApiOperation("导出标准项目模版")
    @GetMapping("exportStandItem")
    public Result exportStandItem(HttpServletResponse response){
        return Result.ok(standItemService.exportStandItem(response));
    }
    @ApiOperation("导入标准项目")
    @PostMapping("importStandItem")
    public Result importStandItem(@RequestPart("file") MultipartFile file){
        standItemService.importStandItem(file);
        return Result.ok();
    }

    @ApiOperation("对照标准项目与会计科目")
    @PostMapping("matchStandItemAndCostAccounting")
    public Result matchStandItemAndCostAccounting(){
        standItemService.matchStandItemAndCostAccounting();
        return Result.ok();
    }
    @ApiOperation("获取会计科目字典")
    @GetMapping("getCostAccountingDict")
    public Result getCostAccountingDict(@RequestParam(required = false) String name){
        return Result.ok(standItemService.getCostAccountingDict(name));
    }
    @ApiOperation("获取康程分类字典")
    @GetMapping("getKcClassDict")
    public Result getKcClassDict(){
        return Result.ok(standItemService.getKcClassDict());
    }


    /**
     * 标准项目参与人员对照
     */
    @GetMapping("getStandItemEmpMap")
    @ApiOperation("获取标准项目与人员对照")
    public Result getStandItemEmpMap(@RequestParam String standCode){
        return Result.ok(standItemService.getStandItemEmpMap(standCode));
    }

    @PostMapping("addStandItemEmpMap")
    @ApiOperation("添加标准项目与人员对照")
    public Result addStandItemEmpMap(@RequestBody StandItemEmpMap request){
        standItemService.addStandItemEmpMap(request);
        return Result.ok();
    }

    @PostMapping("editStandItemEmpMap")
    @ApiOperation("编辑标准项目与人员对照")
    public Result editStandItemEmpMap(@RequestBody StandItemEmpMap request){
        standItemService.editStandItemEmpMap(request);
        return Result.ok();
    }
    @PostMapping("deleteStandItemEmpMap")
    @ApiOperation("删除标准项目与人员对照")
    public Result deleteStandItemEmpMap(@RequestParam Integer id){
        standItemService.deleteStandItemEmpMap(id);
        return Result.ok();
    }
    /**
     * 标准项目使用设备对照
     */
    @GetMapping("getStandItemEquipmentMap")
    @ApiOperation("获取标准项目与设备对照")
    public Result getStandItemEquipmentMap(@RequestParam String standCode){
        return Result.ok(standItemService.getStandItemEquipmentMap(standCode));
    }

    @PostMapping("addStandItemEquipmentMap")
    @ApiOperation("添加标准项目与设备对照")
    public Result addStandItemEquipmentMap(@RequestBody StandItemEquipmentMap request){
        standItemService.addStandItemEquipmentMap(request);
        return Result.ok();
    }

    @PostMapping("editStandItemEquipmentMap")
    @ApiOperation("编辑标准项目与设备对照")
    public Result editStandItemEquipmentMap(@RequestBody StandItemEquipmentMap request){
        standItemService.editStandItemEquipmentMap(request);
        return Result.ok();
    }
    @PostMapping("deleteStandItemEquipmentMap")
    @ApiOperation("删除标准项目与设备对照")
    public Result deleteStandItemEquipmentMap(@RequestParam Integer id){
        standItemService.deleteStandItemEquipmentMap(id);
        return Result.ok();
    }
    /**
     * 标准项目空间成本对照
     */

    @GetMapping("getStandItemSpaceMap")
    @ApiOperation("获取标准项目与空间对照")
    public Result getStandItemSpaceMap(@RequestParam String standCode){
        return Result.ok(standItemService.getStandItemSpaceMap(standCode));
    }

    @PostMapping("addStandItemSpaceMap")
    @ApiOperation("添加标准项目与空间对照")
    public Result addStandItemSpaceMap(@RequestBody StandItemSpaceMap request){
        standItemService.addStandItemSpaceMap(request);
        return Result.ok();
    }

    @PostMapping("editStandItemSpaceMap")
    @ApiOperation("编辑标准项目与空间对照")
    public Result editStandItemSpaceMap(@RequestBody StandItemSpaceMap request){
        standItemService.editStandItemSpaceMap(request);
        return Result.ok();
    }
    @PostMapping("deleteStandItemSpaceMap")
    @ApiOperation("删除标准项目与空间对照")
    public Result deleteStandItemSpaceMap(@RequestParam Integer id){
        standItemService.deleteStandItemSpaceMap(id);
        return Result.ok();
    }

    /**
     * 医嘱项目
     */
    OrderService orderService;

    @GetMapping("getOrderList")
    @ApiOperation("获取医嘱项目")
    public Result getOrderList(@RequestParam(required = false) String orderType,
                               @RequestParam(required = false) String orderName){
        return Result.ok(orderService.getOrderList(orderType,orderName));
    }

    @PostMapping("addOrder")
    @ApiOperation("添加医嘱项目")
    public Result addOrder(@RequestBody Order request){
        orderService.addOrder(request);
        return Result.ok();
    }

    @PostMapping("editOrder")
    @ApiOperation("编辑医嘱项目")
    public Result editOrder(@RequestBody Order request){
        orderService.editOrder(request);
        return Result.ok();
    }
    @PostMapping("deleteOrder")
    @ApiOperation("删除医嘱项目")
    public Result deleteOrder(@RequestParam Integer id){
        orderService.deleteOrder(id);
        return Result.ok();
    }

    @GetMapping("getOrderType")
    @ApiOperation("获取医嘱类型")
    public Result getOrderType(){
        return Result.ok(orderService.getOrderType());
    }

    @ApiOperation("导出医嘱项目模版")
    @GetMapping("exportOrder")
    public Result exportOrder(HttpServletResponse response){
        return Result.ok(orderService.exportOrder(response));
    }
    @ApiOperation("导入医嘱项目")
    @PostMapping("importOrder")
    public Result importOrder(@RequestPart("file") MultipartFile file){
        orderService.importOrder(file);
        return Result.ok();
    }

    @ApiOperation("获取医嘱项目与收费项目对照列表")
    @GetMapping("getOrderItemList")
    public Result getOrderItemList(@RequestParam(required = false,defaultValue = "1",value = "current") Integer current,
                                   @RequestParam(required = false,defaultValue = "10",value = "pageSize") Integer pageSize,
                                   @RequestParam(value = "orderCode") String orderCode,
                                   @RequestParam(required = false,value = "itemName")String itemName){
        return Result.ok(orderService.getOrderItemList(current,pageSize,orderCode,itemName));
    }

    @ApiOperation("添加医嘱项目与收费项目对照")
    @PostMapping("addOrderItem")
    public Result addOrderItem(@RequestBody OrderItemRequest request){
        orderService.addOrderItem(request);
        return Result.ok();
    }

    @ApiOperation("编辑医嘱项目与收费项目对照")
    @PostMapping("editOrderItem")
    public Result editOrderItem(@RequestBody OrderItemMap request){
        orderService.editOrderItem(request);
        return Result.ok();
    }

    @ApiOperation("删除医嘱项目与收费项目对照")
    @PostMapping("deleteOrderItem")
    public Result deleteOrderItem(@RequestParam Integer id){
        orderService.deleteOrderItem(id);
        return Result.ok();
    }

    @ApiOperation("批量删除医嘱项目与收费项目对照")
    @PostMapping("batchDeleteOrderItem")
    public Result batchDeleteOrderItem(@RequestBody List<Integer> ids){
        orderService.batchDeleteOrderItem(ids);
        return Result.ok();
    }

    @ApiOperation("获取项目列表")
    @GetMapping("getItemDict")
    public Result getItemDict(@RequestParam(defaultValue = "3") Integer type,
                              @RequestParam(required = false)String name,
                              @RequestParam String orderCode){


        return Result.ok(orderService.getItemDict(type,orderCode,name));
    }
    AccountingItemMapService accountingItemMapService;
    @ApiOperation("获取会计科目收入列表")
    @GetMapping("getAccountingList")
    public Result getAccountingList(@RequestParam(required = false) String accountingName,
                                    @RequestParam(required = false,name = "type",defaultValue = "0") Integer type){
        return Result.ok(accountingItemMapService.getAccountingList(accountingName,type));
    }

    @ApiOperation("获取会计科目收费项目对照列表")
    @GetMapping("getAccountingItemMap")
    public Result getAccountingItemMap(@RequestParam(required = false,name = "current") Integer current,
                                    @RequestParam(required = false,name = "pageSize") Integer pageSize,
                                    @RequestParam String accountingCode,
                                    @RequestParam(required = false,name = "itemName")String itemName){
        return Result.ok(accountingItemMapService.getAccountingItemMap(current,pageSize,accountingCode,itemName));
    }

    @ApiOperation("获取收费项目列表")
    @GetMapping("getAccountingItemDictList")
    public Result getAccountingItemDictList(@RequestParam(defaultValue = "3") Integer type,
                                            @RequestParam(required = false)String name){
        return Result.ok(accountingItemMapService.getAccountingItemDictList(type,name));
    }

    @ApiOperation(" 添加会计科目收费项目对照")
    @PostMapping("addAccountingItemMap")
    public Result addAccountingItemMap(@RequestBody AccountingItemMapRequest map){
        accountingItemMapService.addAccountingItemMap(map);
        return Result.ok();
    }

    @ApiOperation(" 删除会计科目收费项目对照")
    @PostMapping("deleteAccountingItemMap")
    public Result deleteAccountingItemMap(@RequestParam Integer id){
        accountingItemMapService.deleteAccountingItemMap(id);
        return Result.ok();
    }

    @ApiOperation("批量删除会计科目收费项目对照")
    @PostMapping("batchDeleteAccountingItemMap")
    public Result batchDeleteAccountingItemMap(@RequestBody List<Integer> ids){
        accountingItemMapService.batchDeleteAccountingItemMap(ids);
        return Result.ok();
    }

    /**
     * 项目分摊参数
     */
    ShareParamTypeMapService shareParamTypeMapService;

    @ApiOperation("项目成本管理-项目分摊参数设置-获取列表")
    @GetMapping("shareParamTypeMapList")
    public Result shareParamTypeMapList(@RequestParam(required = false,name = "filter")String filter){
        return Result.ok(shareParamTypeMapService.getList(filter));
    }

    @ApiOperation("项目成本管理-项目分摊参数设置-新增")
    @PostMapping("addShareParamTypeMap")
    public Result addShareParamTypeMap(@RequestBody ShareParamTypeMap request){
        shareParamTypeMapService.add(request);
        return Result.ok();
    }

    @ApiOperation("项目成本管理-项目分摊参数设置-编辑")
    @PostMapping("updateShareParamTypeMap")
    public Result updateShareParamTypeMap(@RequestBody ShareParamTypeMap request){
        shareParamTypeMapService.update(request);
        return Result.ok();
    }

    @ApiOperation("项目成本管理-项目分摊参数设置-删除")
    @PostMapping("deleteShareParamTypeMap")
    public Result deleteShareParamTypeMap(@RequestParam Integer id){
        shareParamTypeMapService.delete(id);
        return Result.ok();
    }

    @ApiOperation("项目成本管理-项目分摊参数设置-获取来源项目")
    @GetMapping("getShareParamSourceItem")
    public Result getShareParamSourceItem(@RequestParam(required = false,name = "type")Integer type){
        return Result.ok(shareParamTypeMapService.getSourceItem(type));
    }

    /**
     * 项目成本分摊设置
     */
    ItemCostShareService itemCostShareService;
    @ApiOperation("项目成本管理-项目成本分摊设置-获取列表")
    @GetMapping("itemCostShareList")
    public Result itemCostShareList(@RequestParam(required = false,name = "filter")String filter){
        return Result.ok(itemCostShareService.getList(filter));
    }
    @ApiOperation("项目成本管理-项目成本分摊设置-新增")
    @PostMapping("addItemCostShare")
    public Result addItemCostShare(@RequestBody ShareParamCost request){
        itemCostShareService.add(request);
        return Result.ok();
    }
    @ApiOperation("项目成本管理-项目成本分摊设置-编辑")
    @PostMapping("updateItemCostShare")
    public Result updateItemCostShare(@RequestBody ShareParamCost request){
        itemCostShareService.update(request);
        return Result.ok();
    }
    @ApiOperation("项目成本管理-项目成本分摊设置-删除")
    @PostMapping("deleteItemCostShare")
    public Result deleteItemCostShare(@RequestParam Integer id){
        itemCostShareService.delete(id);
        return Result.ok();
    }

    @ApiOperation("项目成本管理-项目成本分摊设置-分摊参数设置-新增")
    @PostMapping("addItemCostShareDetail")
    public Result addItemCostShareDetail(@RequestBody List<ShareParamCostDetail> request){
        itemCostShareService.addDetail(request);
        return Result.ok();
    }
    @ApiOperation("项目成本管理-项目成本分摊设置-分摊参数设置-编辑")
    @PostMapping("updateItemCostShareDetail")
    public Result updateItemCostShareDetail(@RequestBody List<ShareParamCostDetail> request){
        itemCostShareService.updateDetail(request);
        return Result.ok();
    }
    @ApiOperation("项目成本管理-项目成本分摊设置-分摊参数设置-删除")
    @PostMapping("deleteItemCostShareDetail")
    public Result deleteItemCostShareDetail(@RequestParam Integer id){
        itemCostShareService.deleteDetail(id);
        return Result.ok();
    }

    @ApiOperation("项目成本管理-项目成本分摊设置-获取损益报表字典")
    @GetMapping("getReportType")
    public Result itemReportType(){
        return Result.ok(itemCostShareService.itemReportType());
    }

    @ApiOperation("项目成本管理-项目成本分摊设置-医疗服务项目分类")
    @GetMapping("getMedServiceItemType")
    public Result getMedServiceItemType(){
        return Result.ok(itemCostShareService.getMedServiceItemType());
    }




    /**
     * 医疗服务项目人员对照
     */
    @GetMapping("getItemEmpMap")
    @ApiOperation("获取医疗服务项目与人员对照")
    public Result getItemEmpMap(@RequestParam String itemCode,
                                @RequestParam String departmentCode){
        return Result.ok(itemService.getItemEmpMap(itemCode,departmentCode));
    }

    @PostMapping("addItemEmpMap")
    @ApiOperation("添加医疗服务项目与人员对照")
    public Result addItemEmpMap(@RequestBody ItemEmpMap request){
        itemService.addItemEmpMap(request);
        return Result.ok();
    }

    @PostMapping("editItemEmpMap")
    @ApiOperation("编辑医疗服务项目与人员对照")
    public Result editItemEmpMap(@RequestBody ItemEmpMap request){
        itemService.editItemEmpMap(request);
        return Result.ok();
    }
    @PostMapping("deleteItemEmpMap")
    @ApiOperation("删除医疗服务项目与人员对照")
    public Result deleteItemEmpMap(@RequestParam Integer id){
        itemService.deleteItemEmpMap(id);
        return Result.ok();
    }
    /**
     * 医疗服务项目使用设备对照
     */
    @GetMapping("getItemEquipmentMap")
    @ApiOperation("获取医疗服务项目与设备对照")
    public Result getItemEquipmentMap(@RequestParam String itemCode,
                                      @RequestParam String departmentCode){
        return Result.ok(itemService.getItemEquipmentMap(itemCode,departmentCode));
    }

    @PostMapping("addItemEquipmentMap")
    @ApiOperation("添加医疗服务项目与设备对照")
    public Result addItemEquipmentMap(@RequestBody ItemEquipmentMap request){
        itemService.addItemEquipmentMap(request);
        return Result.ok();
    }

    @PostMapping("editItemEquipmentMap")
    @ApiOperation("编辑医疗服务项目与设备对照")
    public Result editItemEquipmentMap(@RequestBody ItemEquipmentMap request){
        itemService.editItemEquipmentMap(request);
        return Result.ok();
    }
    @PostMapping("deleteItemEquipmentMap")
    @ApiOperation("删除医疗服务项目与设备对照")
    public Result deleteItemEquipmentMap(@RequestParam Integer id){
        itemService.deleteItemEquipmentMap(id);
        return Result.ok();
    }
    /**
     * 医疗服务项目空间成本对照
     */

    @GetMapping("getItemSpaceMap")
    @ApiOperation("获取医疗服务项目与空间对照")
    public Result getItemSpaceMap(@RequestParam String itemCode,
                                  @RequestParam String departmentCode){
        return Result.ok(itemService.getItemSpaceMap(itemCode,departmentCode));
    }

    @PostMapping("addItemSpaceMap")
    @ApiOperation("添加医疗服务项目与空间对照")
    public Result addItemSpaceMap(@RequestBody ItemSpaceMap request){
        itemService.addItemSpaceMap(request);
        return Result.ok();
    }

    @PostMapping("editItemSpaceMap")
    @ApiOperation("编辑医疗服务项目与空间对照")
    public Result editItemSpaceMap(@RequestBody ItemSpaceMap request){
        itemService.editItemSpaceMap(request);
        return Result.ok();
    }
    @PostMapping("deleteItemSpaceMap")
    @ApiOperation("删除医疗服务项目与空间对照")
    public Result deleteItemSpaceMap(@RequestParam Integer id){
        itemService.deleteItemSpaceMap(id);
        return Result.ok();
    }


    /**
     * 医疗服务项目不计价药材对照
     */

    @GetMapping("getItemNoValuationDrugMaterialMap")
    @ApiOperation("获取医疗服务项目与不计价药材对照")
    public Result getItemNoValuationDrugMaterialMap(@RequestParam String itemCode,
                                                    @RequestParam String departmentCode){
        return Result.ok(itemService.getItemNoValuationDrugMaterialMap(itemCode,departmentCode));
    }

    @PostMapping("addItemNoValuationDrugMaterialMap")
    @ApiOperation("添加医疗服务项目与不计价药材对照")
    public Result addItemNoValuationDrugMaterialMap(@RequestBody ItemMapRequest request){
        itemService.addItemNoValuationDrugMaterialMap(request);
        return Result.ok();
    }

    @PostMapping("editItemNoValuationDrugMaterialMap")
    @ApiOperation("编辑医疗服务项目与不计价药材对照")
    public Result editItemNoValuationDrugMaterialMap(@RequestBody ItemNoValuationDrugMaterialMap request){
        itemService.editItemNoValuationDrugMaterialMap(request);
        return Result.ok();
    }
    @PostMapping("deleteItemNoValuationDrugMaterialMap")
    @ApiOperation("删除医疗服务项目与不计价药材对照")
    public Result deleteItemNoValuationDrugMaterialMap(@RequestParam Integer id){
        itemService.deleteItemNoValuationDrugMaterialMap(id);
        return Result.ok();
    }

    @PostMapping("batchDeleteItemNoValuationDrugMaterialMap")
    @ApiOperation("批量删除医疗服务项目与不计价药材对照")
    public Result batchDeleteItemNoValuationDrugMaterialMap(@RequestBody List<Integer> ids){
        itemService.batchDeleteItemNoValuationDrugMaterialMap(ids);
        return Result.ok();
    }
    /**
     * 医疗服务项目计价药材对照
     */

    @GetMapping("getItemValuationDrugMaterialMap")
    @ApiOperation("获取医疗服务项目与计价药材对照")
    public Result getItemValuationDrugMaterialMap(@RequestParam String itemCode,
                                                  @RequestParam String departmentCode){
        return Result.ok(itemService.getItemValuationDrugMaterialMap(itemCode,departmentCode));
    }

    @PostMapping("addItemValuationDrugMaterialMap")
    @ApiOperation("添加医疗服务项目与计价药材对照")
    public Result addItemValuationDrugMaterialMap(@RequestBody ItemMapRequest request){
        itemService.addItemValuationDrugMaterialMap(request);
        return Result.ok();
    }

    @PostMapping("editItemValuationDrugMaterialMap")
    @ApiOperation("编辑医疗服务项目与计价药材对照")
    public Result editItemValuationDrugMaterialMap(@RequestBody ItemValuationDrugMaterialMap request){
        itemService.editItemValuationDrugMaterialMap(request);
        return Result.ok();
    }
    @PostMapping("deleteItemValuationDrugMaterialMap")
    @ApiOperation("删除医疗服务项目与计价药材对照")
    public Result deleteItemValuationDrugMaterialMap(@RequestParam Integer id){
        itemService.deleteItemValuationDrugMaterialMap(id);
        return Result.ok();
    }
    @PostMapping("batchDeleteItemValuationDrugMaterialMap")
    @ApiOperation("批量删除医疗服务项目与计价药材对照")
    public Result batchDeleteItemValuationDrugMaterialMap(@RequestBody List<Integer> ids){
        itemService.batchDeleteItemValuationDrugMaterialMap(ids);
        return Result.ok();
    }

    @ApiOperation("获取项目列表")
    @GetMapping("getItemData")
    public Result getItemData(@RequestParam(defaultValue = "1") Integer type,
                              @RequestParam(required = false)String name,
                              @RequestParam String itemCode){
        return Result.ok(itemService.getItemDict(type,itemCode,name));
    }


    @ApiOperation("智能对照-获取收费项目信息")
    @GetMapping("getSingleItem")
    public Result getSingleItem(@RequestParam String itemCode,
                                @RequestParam String departmentCode){
        return Result.ok(itemService.getSingleItem(itemCode,departmentCode));
    }
    @ApiOperation("智能对照-获取收费项目信息列表")
    @GetMapping("getSingleItemList")
    public Result getSingleItemList(){
        return Result.ok(itemService.getSingleItemList());
    }
    @ApiOperation("智能对照-推荐匹配")
    @GetMapping("getReferralMatch")
    public Result getReferralMatch(@RequestParam String itemCode,@RequestParam String departmentCode){
        return Result.ok(itemService.getReferralMatch(itemCode,departmentCode));
    }

    @ApiOperation("智能对照-获取对照数据")
    @GetMapping("getMatchCount")
    public Result getMatchCount(){
        return Result.ok(itemService.getMatchCount());
    }

    @ApiOperation("智能对照-匹配")
    @PostMapping("matchItem")
    public Result matchItem(@RequestParam String itemCode,
                            @RequestParam String standItemCode,
                            @RequestParam Integer type,
                            @RequestParam String departmentCode){
        itemService.matchItem(itemCode,standItemCode,type,departmentCode);
        return Result.ok();
    }


}
