|
@ -0,0 +1,216 @@
|
|
|
package com.yihu.ehr.svrinspection.controller;
|
|
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.yihu.ehr.controller.EnvelopRestEndPoint;
|
|
|
import com.yihu.ehr.svrinspection.commons.exception.ManageException;
|
|
|
import com.yihu.ehr.svrinspection.model.AssistanceApplyModel;
|
|
|
import com.yihu.ehr.svrinspection.service.AssistanceApplyService;
|
|
|
import com.yihu.ehr.svrinspection.service.ExamStatisticsService;
|
|
|
import com.yihu.ehr.util.rest.Envelop;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.MediaType;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.IOException;
|
|
|
import java.text.ParseException;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* 机构检验申请控制类
|
|
|
*
|
|
|
* @author HZY
|
|
|
* @created 2018/11/9 16:23
|
|
|
*/
|
|
|
@RequestMapping( "/api/v1.1/exam")
|
|
|
@RestController
|
|
|
@Api(value = "assistanceApply", description = "区域检验相关接口", tags = {"区域检验"})
|
|
|
public class AssistanceApplyController extends EnvelopRestEndPoint {
|
|
|
|
|
|
@Autowired
|
|
|
private ObjectMapper objectMapper;
|
|
|
@Autowired
|
|
|
private AssistanceApplyService assistanceApplyService;
|
|
|
@Autowired
|
|
|
private ExamStatisticsService examStatisticsService;
|
|
|
|
|
|
@GetMapping(value = "/area")
|
|
|
@ApiOperation(value = "区域检验-【区域排行】")
|
|
|
public Envelop examAreaRanking(
|
|
|
@ApiParam(name = "pid", value = "上级区域编码", defaultValue = "361100")
|
|
|
@RequestParam(value = "pid", required = false,defaultValue = "361100") Integer pid,
|
|
|
@ApiParam(name = "eventDate", value = "就诊时间(年月)",required = true, defaultValue = "")
|
|
|
@RequestParam(value = "eventDate", required = false) String eventDate) throws Exception {
|
|
|
|
|
|
List<Map<String,Object>> list = examStatisticsService.areaGroupCount(pid,"org_area",eventDate);
|
|
|
return success(list);
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = "/hospital")
|
|
|
@ApiOperation(value = "区域检验-【医院排行】")
|
|
|
public Envelop examHospitalRanking(
|
|
|
@ApiParam(name = "areaCode", value = "区域编码(为空显示全市数据)", defaultValue = "")
|
|
|
@RequestParam(value = "areaCode", required = false) String areaCode,
|
|
|
@ApiParam(name = "eventDate", value = "就诊时间(年月)", defaultValue = "")
|
|
|
@RequestParam(value = "eventDate", required = false) String eventDate) {
|
|
|
|
|
|
List<Map<String,Object>> list = null;
|
|
|
try {
|
|
|
list = examStatisticsService.hospitalGroupCount(areaCode,"org_code",eventDate);
|
|
|
} catch (Exception e) {
|
|
|
return failed(e.getMessage());
|
|
|
}
|
|
|
return success(list);
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = "/statistics")
|
|
|
@ApiOperation(value = "区域检验数-【统计信息】",notes = "包含今日新增量,检验次数业务分布")
|
|
|
public Envelop statistics(
|
|
|
@ApiParam(name = "areaCode", value = "区域编码(不传默认全市)", defaultValue = "")
|
|
|
@RequestParam(value = "areaCode", required = false) String areaCode,
|
|
|
@ApiParam(name = "date", value = "日期", defaultValue = "")
|
|
|
@RequestParam(value = "date", required = false) String date) throws IOException {
|
|
|
|
|
|
Map<String,Object> map = null;
|
|
|
try {
|
|
|
map = examStatisticsService.areaExamStatistics(areaCode,date);
|
|
|
} catch (ManageException e) {
|
|
|
return failed(e.getMessage());
|
|
|
} catch (Exception e) {
|
|
|
return failed(e.getMessage());
|
|
|
}
|
|
|
return success(map);
|
|
|
}
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/organizations/statistics")
|
|
|
@ApiOperation(value = "机构今日检验统计查询-【医生端-头部统计信息】",notes = "医生端的头部统计信息,数据为当日的数据统计")
|
|
|
public Envelop orgStatistics(
|
|
|
@ApiParam(name = "orgCode", value = "机构编码(不传默认全市)", defaultValue = "")
|
|
|
@RequestParam(value = "orgCode", required = false) String orgCode) throws IOException {
|
|
|
|
|
|
Map<String,Object> map = null;
|
|
|
try {
|
|
|
map = examStatisticsService.organizationExamStatistics(orgCode);
|
|
|
} catch (ManageException e) {
|
|
|
return failed(e.getMessage());
|
|
|
} catch (Exception e) {
|
|
|
return failed(e.getMessage());
|
|
|
}
|
|
|
return success(map);
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = "/organizations/basic/statistics")
|
|
|
@ApiOperation(value = "机构今日检验统计查询-【基层机构端-头部统计信息】",notes = "基层机构端的头部统计信息,主要包含总检验数,及今日已处理数,今日未处理数")
|
|
|
public Envelop basicOrgStatistics(
|
|
|
@ApiParam(name = "orgCode", value = "机构编码(不传默认全市)", defaultValue = "")
|
|
|
@RequestParam(value = "orgCode", required = false) String orgCode) throws IOException {
|
|
|
|
|
|
Map<String,Object> map = null;
|
|
|
try {
|
|
|
map = examStatisticsService.basicOrgExamStatistics(orgCode);
|
|
|
} catch (ManageException e) {
|
|
|
return failed(e.getMessage());
|
|
|
} catch (Exception e) {
|
|
|
return failed(e.getMessage());
|
|
|
}
|
|
|
return success(map);
|
|
|
}
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/apply/list")
|
|
|
@ApiOperation(value = "机构申请/处理列表查询",notes = "filters 的like查询用“?”,")
|
|
|
public Envelop applyList(
|
|
|
@ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "")
|
|
|
@RequestParam(value = "fields", required = false) String fields,
|
|
|
@ApiParam(name = "filters", value = "过滤器,like用?,为空检索所有信息eg:applyOrg=jkzl;createTime>=2018-11-14T18:43:57Z;createTime<2018-11-14T22:59:59Z;", defaultValue = "")
|
|
|
@RequestParam(value = "filters", required = false) String filters,
|
|
|
@ApiParam(name = "sorts", value = "排序,升序+,降序-(eg:+id)", defaultValue = "+id")
|
|
|
@RequestParam(value = "sorts", required = false) String sorts,
|
|
|
@ApiParam(name = "size", value = "分页大小", defaultValue = "15")
|
|
|
@RequestParam(value = "size", required = false) int size,
|
|
|
@ApiParam(name = "page", value = "页码", defaultValue = "1")
|
|
|
@RequestParam(value = "page", required = false) int page,
|
|
|
HttpServletRequest request,
|
|
|
HttpServletResponse response) throws IOException, ParseException {
|
|
|
|
|
|
List<AssistanceApplyModel> assistanceApplyModelList = (List<AssistanceApplyModel>)assistanceApplyService.search(fields, filters, sorts, page, size);
|
|
|
Envelop envelop = new Envelop();
|
|
|
envelop.setTotalCount((int)assistanceApplyService.getCount(filters));
|
|
|
envelop.setCurrPage(page);
|
|
|
envelop.setPageSize(size);
|
|
|
envelop.setDetailModelList(assistanceApplyModelList);
|
|
|
envelop.setSuccessFlg(true);
|
|
|
envelop.setTotalPage(envelop.getTotalPage());
|
|
|
return envelop;
|
|
|
// pagedResponse(request, response, assistanceApplyService.getCount(filters), page, size);
|
|
|
// return convertToModels(assistanceApplyModelList, new ArrayList<AssistanceApplyModel>(assistanceApplyModelList.size()), AssistanceApplyModel.class, fields);
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = "/apply/detail")
|
|
|
@ApiOperation(value = "下级机构申请详情-查看")
|
|
|
public Envelop applyDetail(
|
|
|
@ApiParam(name = "applyId", value = "申请记录ID")
|
|
|
@RequestParam(value = "applyId", required = false) int applyId) {
|
|
|
|
|
|
AssistanceApplyModel applyModel = assistanceApplyService.findById(applyId);
|
|
|
return success(applyModel);
|
|
|
}
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "检验协助申请", response = AssistanceApplyModel.class,produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
@PostMapping(value = "apply",consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
public Envelop createAssistanceApply(
|
|
|
@ApiParam(name = "apply", value = "档案申请JSON结构",required = true)
|
|
|
@RequestBody(required = true) AssistanceApplyModel apply) {
|
|
|
|
|
|
AssistanceApplyModel save = null;
|
|
|
try {
|
|
|
save = assistanceApplyService.saveOrUpdateApply(apply);
|
|
|
} catch (ManageException e) {
|
|
|
return failed(e.getMessage());
|
|
|
}
|
|
|
return success(save);
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "检验申请处理", response = AssistanceApplyModel.class,produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
@PostMapping(value = "apply/solution",consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
public Envelop applySolution (
|
|
|
@ApiParam(name = "applyId", value = "申请记录ID", defaultValue = "")
|
|
|
@RequestParam(value = "applyId", required = false) int applyId,
|
|
|
@ApiParam(name = "replyUserId", value = "处理人ID", defaultValue = "")
|
|
|
@RequestParam(value = "replyUserId", required = false) String replyUserId,
|
|
|
@ApiParam(name = "replyContent", value = "回复内容", defaultValue = "")
|
|
|
@RequestParam(value = "replyContent", required = false) String replyContent) {
|
|
|
|
|
|
AssistanceApplyModel save = null;
|
|
|
try {
|
|
|
save = assistanceApplyService.solutionApply(applyId,replyUserId,replyContent);
|
|
|
} catch (ManageException e) {
|
|
|
return failed(e.getMessage());
|
|
|
}
|
|
|
return success(save);
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "检验申请撤回", response = AssistanceApplyModel.class)
|
|
|
@PostMapping(value = "apply/retract",consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
public Envelop applyRetract (
|
|
|
@ApiParam(name = "applyId", value = "申请记录ID", defaultValue = "")
|
|
|
@RequestParam(value = "applyId", required = false) int applyId) {
|
|
|
|
|
|
AssistanceApplyModel save = null;
|
|
|
try {
|
|
|
save = assistanceApplyService.retractApply(applyId,-1);
|
|
|
} catch (ManageException e) {
|
|
|
return failed(e.getMessage());
|
|
|
}
|
|
|
return success(save);
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|