package thyyxxk.webserver.service.externalhttp.emr;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.dtflys.forest.annotation.*;
import thyyxxk.webserver.service.zhuyuanyisheng.emr.EmrServer;

@BaseRequest(baseURL = "${emrUrl}", interceptor = EmrServer.EmrInterceptor.class)
public interface EmrEditor {

    /**
     * 获取全院模板
     *
     * @return json
     */
    @Get("/category/list/dept")
    JSONArray getEmrTree();

    /**
     * 获取片段模板
     *
     * @return js
     */
    @Get("/snippet/list/tree")
    JSONArray getSnippetTree();

    @Get("/snippet/list/dept?code=${dept}&content=true")
    JSONArray getSnippetByDept(@Var("dept") String dept);

    /**
     * 获取指定模板中的数据元
     *
     * @param id 文档id
     * @return js
     */
    @Get("/document/docs/data/${id}?keyType=business")
    JSONObject getEditorJsonDataByDocumentId(@Var("id") String id);

    /**
     * 恢复电子病历
     *
     * @param id         文档id
     * @param jsonObject 值
     * @return js
     */
    @Put("/document/recover/{id}")
    JSONObject resumeMedicalRecords(@Var("id") String id,
                                    @JSONBody JSONObject jsonObject);

    @Get("/document/invalid/{id}")
    JSONObject getInvalidByDocumentIdApi(@Var("id") String id);

    @Post("/document?history=1")
    JSONObject saveDocument(@JSONBody JSONObject jsonObject);

    @Delete("/document/{id}")
    JSONObject deleteEmr(@Var("id") String id);

    @Get("/document/history/{id}")
    Object getHistory(@Var("id") String id);

    @Get("/category/list/dept?code={deptCode}")
    JSONArray getDeptList(@Var("deptCode") String deptCode);
}
