package com.fs.hisapi;

import com.fs.hisapi.domain.ApiResponse;
import com.fs.hisapi.param.CancelOrderParam;
import com.fs.hisapi.param.CreateOrderParam;
import com.fs.hisapi.param.DrugParam;
import com.fs.hisapi.param.RecipeDetailParam;
import com.fs.hisapi.service.impl.HisApiServiceImpl;
import com.google.gson.Gson;
import org.springframework.jdbc.datasource.DataSourceUtils;

import java.util.ArrayList;
import java.util.List;

public class test {

    public static void main(String[] args){

        ApiResponse apiResponse = cancelOrder();

    }

    public static ApiResponse createOrder(){
    HisApiServiceImpl hisApiService = new HisApiServiceImpl();
    CreateOrderParam o = createHospitalOrderVO();
    o.setRecipe_name("ceshi0002");
    return hisApiService.createOrder(o);
}

    public static ApiResponse cancelOrder(){
        HisApiServiceImpl hisApiService = new HisApiServiceImpl();
        CancelOrderParam cancelOrderVO = new CancelOrderParam();
        cancelOrderVO.setRecipe_name("ceshi0002");
        return hisApiService.cancelOrder(cancelOrderVO);
    }

    public static ApiResponse getDrug(){
        HisApiServiceImpl hisApiService = new HisApiServiceImpl();
        DrugParam drugVO = new DrugParam();
        drugVO.setPage("1");
        drugVO.setPagesize("10");
        return hisApiService.getDrug(drugVO);
    }


    //测试用创建一个订单类
    public static CreateOrderParam createHospitalOrderVO(){
        CreateOrderParam recipeVO = new CreateOrderParam();
        recipeVO.setHospital_code("40032215");
        recipeVO.setRecipe_name("测试");
        recipeVO.setRegistry_id("1");
        recipeVO.setName("1");
        recipeVO.setSex("1");
        recipeVO.setAge(1);
        recipeVO.setBirthday("2020-01-01");
        recipeVO.setPhone("1");
        recipeVO.setEmail("1");
        recipeVO.setDepartment("1");
        recipeVO.setDoctor("1");
        recipeVO.setRecipe_no(1);
        recipeVO.setGranule_total_no(1);
        recipeVO.setTimes_day(1);
        recipeVO.setFactor(0);
        recipeVO.setAttention("1");
        recipeVO.setSymptoms("1");
        recipeVO.setRecipe_sample("1");
        recipeVO.setRecipe_time("2023-07-27 12:01:01");
        recipeVO.setOperator_name("1");
        recipeVO.setOperation_time("2023-07-27 12:01:01");
        recipeVO.setPricing_id("1");
        recipeVO.setPricing_cashier("1");
        recipeVO.setPricing_time("2023-07-27 12:01:01");
        recipeVO.setPrice("1");
        recipeVO.setPrice_total("1");
        recipeVO.setRecipe_sale_price("1");
        recipeVO.setPayment_type("1");
        recipeVO.setPayment_status("PAYED");
        recipeVO.setRecipe_source("HIS");
        recipeVO.setMachine_name("");
        recipeVO.setRecipe_status("NEW");
        recipeVO.setBed("1");
        recipeVO.setDescription("1");
        recipeVO.setPatient_id("1");
        recipeVO.setVisit_id("1");
        recipeVO.setUsage_desc("1");
        recipeVO.setAddress("1");
        recipeVO.setRefund_name("1");
        List<RecipeDetailParam> list = new ArrayList<>();
        RecipeDetailParam recipeDetail1 = new RecipeDetailParam();
        recipeDetail1.setGranule_name("阿胶");
        recipeDetail1.setGranule_no("1");
        recipeDetail1.setHerb_dose("23.0000");
        recipeDetail1.setGranule_price("36.8000");
        recipeDetail1.setGranule_his("C2260");
        list.add(recipeDetail1);
        RecipeDetailParam recipeDetail2 = new RecipeDetailParam();
        recipeDetail2.setGranule_name("当归");
        recipeDetail2.setGranule_no("2");
        recipeDetail2.setHerb_dose("30.0000");
        recipeDetail2.setGranule_price("0.6600");
        recipeDetail2.setGranule_his("C2008");
        list.add(recipeDetail2);
        recipeVO.setRecipe_detail_list(list);
        return recipeVO;
    }

}
