package cn.sh.stc.sict.theme.hphy.util;

import cn.hutool.core.collection.CollUtil;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;

@Data
@Slf4j
@NoArgsConstructor
public class PythonCompareParam {
    private String patientId;
    private String doctorId;
    private String patientAge;
    private List<String> disease;

    public PythonCompareParam(String patientId, String doctorId, String patientAge, List<String> disease) {
        this.patientId = patientId;
        this.doctorId = doctorId;
        this.patientAge = patientAge;
        if(CollUtil.isNotEmpty(disease)){
            this.disease = new ArrayList<>();
            disease.forEach(d->{
                try {
                    this.disease.add(URLEncoder.encode(d, "UTF-8"));
                } catch (UnsupportedEncodingException e) {
                    e.printStackTrace();
                }
            });
        }
    }
}
