package com.diagbot.web;

import com.diagbot.annotation.SysLogger;
import com.diagbot.dto.EMRIntroduceDetailDTO;
import com.diagbot.dto.PushEMRDTO;
import com.diagbot.dto.RespDTO;
import com.diagbot.facade.IntroduceInfoFacade;
import com.diagbot.facade.PushFacade;
import com.diagbot.vo.EMRIntroduceVO;
import com.diagbot.vo.EMRPushVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

/**
 * @Description: 电子病历评级
 * @Author:zhaops
 * @time: 2019/3/12 15:07
 */
@RestController
@RequestMapping("/emr")
@Api(value = "电子病历评级相关API", tags = { "电子病历评级相关API" })
@SuppressWarnings("unchecked")
public class EMRController {
    @Autowired
    IntroduceInfoFacade introduceInfoFacade;
    @Autowired
    PushFacade pushFacade;

    @ApiOperation(value = "电子病历解读[by:zhaops]",
            notes = "hosCode: 医院编码，必填，String<br>" +
                    "type: 检验检查类型，5-检验，6-检查，7-诊断，单选必填，Integer<br>" +
                    "name: 名称（检验检查诊断），必填，String<br>" +
                    "detailName: 项目名称（检验选填，检查不填），String<br>" +
                    "titles: 提示信息标题列表，String数组<br>"+
                    "icdCode: 诊断icd10编码，String<br>")
    @PostMapping("/getIntroduceByEMR")
    public RespDTO<List<EMRIntroduceDetailDTO>> getIntroduceByEMR(@RequestBody EMRIntroduceVO emrIntroduceVO) {
        List<EMRIntroduceDetailDTO> data = introduceInfoFacade.getIntroduceByEMR(emrIntroduceVO);
        return RespDTO.onSuc(data);
    }

    @ApiOperation(value = "推理[by:zhaops]",
            notes = "hosCode： 医院编码(必填)<br>" +
                    "age： 年龄(必填)<br>" +
                    "sex：性别(必填)，1：男，2：女<br>" +
                    "symptom：症状,String<br>" +
                    "other：其它史,String<br>" +
                    "vital：查体,String<br>" +
                    "lis：化验,Array<br>" +
                    "lis：name：套餐名称(必填),String<br>" +
                    "lis：detailName：化验项名称(必填),String<br>" +
                    "lis：uniqueName：公表名称,String<br>" +
                    "lis：value：值,Double<br>" +
                    "lis：maxValue：最大值,Double<br>" +
                    "lis：minValue：最小值,Double<br>" +
                    "lis：units：单位,String<br>" +
                    "lis：otherValue：其他结果，包括阴性阳性，文字描述等,String<br>" +
                    "lis：source：数据来源（必填）0-内部来源，1-外部来源,Integer<br>" +
                    "pacs：辅检,String<br>" +
                    "diag：诊断,String<br>" +
                    "featureType：类型(多选必填)，5：检验，6：检查，7：诊断,String<br>")
    @PostMapping("/pushEMR")
    @SysLogger("pushEMR")
    public RespDTO<PushEMRDTO> pushEMR(@RequestBody @Valid EMRPushVO emrPushVO) {
        return RespDTO.onSuc(pushFacade.pushEMR(emrPushVO));
    }
}