|
@ -0,0 +1,269 @@
|
|
|
package com.yihu.jw.care.endpoint.sign;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yihu.jw.care.dao.sign.ArchiveDao;
|
|
|
import com.yihu.jw.care.dao.sign.CapacityAssessmentRecordDao;
|
|
|
import com.yihu.jw.care.service.sign.ArchiveService;
|
|
|
import com.yihu.jw.care.service.sign.CapacityAssessmentRecordService;
|
|
|
import com.yihu.jw.care.service.sign.ServicePackageService;
|
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
|
import com.yihu.jw.entity.care.archive.ArchiveDO;
|
|
|
import com.yihu.jw.entity.care.sign.CapacityAssessmentRecordDO;
|
|
|
import com.yihu.jw.patient.dao.BasePatientDao;
|
|
|
import com.yihu.jw.restmodel.web.Envelop;
|
|
|
import com.yihu.jw.restmodel.web.ObjEnvelop;
|
|
|
import com.yihu.jw.restmodel.web.PageEnvelop;
|
|
|
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
|
|
|
import com.yihu.jw.util.common.IdCardUtil;
|
|
|
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.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* Created by yeshijie on 2021/2/24.
|
|
|
*/
|
|
|
@RestController
|
|
|
@RequestMapping(value = "sign")
|
|
|
@Api(value = "签约相关", description = "签约相关", tags = {"签约相关"})
|
|
|
public class SignEndpoint extends EnvelopRestEndpoint {
|
|
|
|
|
|
@Autowired
|
|
|
private ArchiveService archiveService;
|
|
|
@Autowired
|
|
|
private BasePatientDao patientDao;
|
|
|
@Autowired
|
|
|
private ArchiveDao archiveDao;
|
|
|
@Autowired
|
|
|
private CapacityAssessmentRecordService capacityAssessmentRecordService;
|
|
|
@Autowired
|
|
|
private CapacityAssessmentRecordDao capacityAssessmentRecordDao;
|
|
|
@Autowired
|
|
|
private ServicePackageService servicePackageService;
|
|
|
|
|
|
|
|
|
@GetMapping(value = "signRecordPage")
|
|
|
@ApiOperation(value = "获取签约记录分页")
|
|
|
public PageEnvelop<List<Map<String,Object>>> signRecordPage (
|
|
|
@ApiParam(name = "name", value = "居民姓名", required = false)
|
|
|
@RequestParam(value = "name",required = false) String name,
|
|
|
@ApiParam(name = "doctorId", value = "医生code", required = true)
|
|
|
@RequestParam(value = "doctorId",required = true) String doctorId,
|
|
|
@ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
|
|
|
@RequestParam(value = "page") int page,
|
|
|
@ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
|
|
|
@RequestParam(value = "size") int size) throws Exception {
|
|
|
try{
|
|
|
return servicePackageService.signRecordPage(name, doctorId, page, size);
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
return PageEnvelop.getError("查询失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = "servicePackageSign" )
|
|
|
@ApiOperation(value = "签约管理-获取签约/未签约总数")
|
|
|
public ObjEnvelop servicePackageSign(
|
|
|
@ApiParam(name = "doctorId", value = "医生id", required = true)
|
|
|
@RequestParam String doctoId) {
|
|
|
try{
|
|
|
int signTotal = servicePackageService.getSignTotal(doctoId);
|
|
|
int unSignTotal = archiveService.getUnSignTotal(doctoId);
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("signTotal",signTotal);
|
|
|
json.put("unSignTotal",unSignTotal);
|
|
|
return ObjEnvelop.getSuccess("查询成功",json);
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
return ObjEnvelop.getError("查询失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@PostMapping(value = "servicePackageSign" )
|
|
|
@ApiOperation(value = "分配服务包-签约")
|
|
|
public Envelop servicePackageSign(
|
|
|
@ApiParam(name = "jsonData", value = "Json数据", required = true)
|
|
|
@RequestParam String jsonData,
|
|
|
@ApiParam(name = "doctorId", value = "医生id", required = true)
|
|
|
@RequestParam String doctoId) {
|
|
|
try{
|
|
|
servicePackageService.servicePackageSign(jsonData,doctoId);
|
|
|
return success("分配成功");
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
return failed("分配失败",-1);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = "servicePackagePage")
|
|
|
@ApiOperation(value = "获取服务包分页")
|
|
|
public PageEnvelop<List<Map<String,Object>>> servicePackagePage (
|
|
|
@ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
|
|
|
@RequestParam(value = "page") int page,
|
|
|
@ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
|
|
|
@RequestParam(value = "size") int size) throws Exception {
|
|
|
try{
|
|
|
return servicePackageService.servicePackagePage(page, size);
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
return PageEnvelop.getError("查询失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = "isCapacityAssessment" )
|
|
|
@ApiOperation(value = "查询今年是否进行过能力评估")
|
|
|
public ObjEnvelop isCapacityAssessment(
|
|
|
@ApiParam(name = "patientId", value = "居民id", required = true)
|
|
|
@RequestParam String patientId) {
|
|
|
try{
|
|
|
return ObjEnvelop.getSuccess("查询成功",capacityAssessmentRecordService.isCapacityAssessment(patientId));
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
return ObjEnvelop.getError("查询失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = "findAssessmentById" )
|
|
|
@ApiOperation(value = "按id查找评估明细")
|
|
|
public ObjEnvelop findAssessmentById(
|
|
|
@ApiParam(name = "id", value = "评估id", required = true)
|
|
|
@RequestParam String id) {
|
|
|
try{
|
|
|
CapacityAssessmentRecordDO recordDO = capacityAssessmentRecordDao.findOne(id);
|
|
|
BasePatientDO basePatientDO = patientDao.findById(recordDO.getPatient());
|
|
|
recordDO.setAge(IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard()));
|
|
|
recordDO.setPhoto(basePatientDO.getPhoto());
|
|
|
return ObjEnvelop.getSuccess("查询成功",recordDO);
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
return ObjEnvelop.getError("查询失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = "assessmentPage")
|
|
|
@ApiOperation(value = "获取能力评估分页")
|
|
|
public PageEnvelop<List<Map<String,Object>>> assessmentPage (
|
|
|
@ApiParam(name = "doctorId", value = "医生id", required = true)
|
|
|
@RequestParam(value = "doctorId") String doctorId,
|
|
|
@ApiParam(name = "name", value = "居民姓名或身份证", required = false)
|
|
|
@RequestParam(value = "name",required = false) String name,
|
|
|
@ApiParam(name = "status", value = "认可结果(0未认可,1已认可,2不认可)", required = false)
|
|
|
@RequestParam(value = "status",required = false) Integer status,
|
|
|
@ApiParam(name = "levelConclusion", value = "评估结果/等级结论", required = false)
|
|
|
@RequestParam(value = "levelConclusion",required = false) Integer levelConclusion,
|
|
|
@ApiParam(name = "servicePackageStatus", value = "服务包分配(0未分配,1已分配)", required = false)
|
|
|
@RequestParam(value = "servicePackageStatus",required = false) Integer servicePackageStatus,
|
|
|
@ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
|
|
|
@RequestParam(value = "page") int page,
|
|
|
@ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
|
|
|
@RequestParam(value = "size") int size) throws Exception {
|
|
|
try{
|
|
|
return capacityAssessmentRecordService.assessmentPage(doctorId, name, page, size, status, levelConclusion, servicePackageStatus);
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
return PageEnvelop.getError("查询失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@PostMapping(value = "capacityAssessment" )
|
|
|
@ApiOperation(value = "生成能力评估报告")
|
|
|
public Envelop capacityAssessment(
|
|
|
@ApiParam(name = "jsonData", value = "Json数据", required = true)
|
|
|
@RequestParam String jsonData,
|
|
|
@ApiParam(name = "doctorId", value = "医生id", required = true)
|
|
|
@RequestParam String doctoId) {
|
|
|
try{
|
|
|
capacityAssessmentRecordService.capacityAssessment(jsonData,doctoId);
|
|
|
return success("生成成功");
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
return failed("生成失败",-1);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@PostMapping(value = "confirmAssessment" )
|
|
|
@ApiOperation(value = "确认评估结果")
|
|
|
public Envelop confirmAssessment(
|
|
|
@ApiParam(name = "signUrl", value = "签字结果图片url", required = true)
|
|
|
@RequestParam String signUrl,
|
|
|
@ApiParam(name = "status", value = "认可结果(0未认可,1已认可,2不认可)", required = true)
|
|
|
@RequestParam Integer status,
|
|
|
@ApiParam(name = "id", value = "评估id", required = true)
|
|
|
@RequestParam String id) {
|
|
|
try{
|
|
|
capacityAssessmentRecordService.confirmAssessment(signUrl, status, id);
|
|
|
return success("确认成功");
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
return failed("确认失败",-1);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@PostMapping(value = "createArchive" )
|
|
|
@ApiOperation(value = "建档")
|
|
|
public Envelop createArchive(
|
|
|
@ApiParam(name = "jsonData", value = "Json数据", required = true)
|
|
|
@RequestParam String jsonData,
|
|
|
@ApiParam(name = "doctorId", value = "医生id", required = true)
|
|
|
@RequestParam String doctorId) {
|
|
|
try{
|
|
|
JSONObject jsonObject = JSONObject.parseObject(jsonData);
|
|
|
BasePatientDO patientDO = toEntity(jsonObject.getJSONObject("patient").toJSONString(), BasePatientDO.class);
|
|
|
|
|
|
String idcard = patientDO.getIdcard();
|
|
|
if(patientDao.existsByIdcardAndDel(idcard,"1")){
|
|
|
ArchiveDO archiveDO = archiveDao.findByIdcardAndDoctorCode(idcard,doctorId);
|
|
|
if(archiveDO!=null){
|
|
|
return success(archiveDO);
|
|
|
}else {
|
|
|
return failed("您所提交的居民信息已存在,请勿重复建档");
|
|
|
}
|
|
|
}
|
|
|
archiveService.createArchive(patientDO,doctorId);
|
|
|
return success("建档成功");
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
return failed("建档失败",-1);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@PostMapping(value = "sysArchive" )
|
|
|
@ApiOperation(value = "同步档案")
|
|
|
public Envelop sysArchive(
|
|
|
@ApiParam(name = "idcard", value = "居民身份证", required = true)
|
|
|
@RequestParam String idcard,
|
|
|
@ApiParam(name = "doctorId", value = "医生id", required = true)
|
|
|
@RequestParam String doctorId) {
|
|
|
try{
|
|
|
archiveService.sysArchive(doctorId,idcard);
|
|
|
return success("同步成功");
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
return failed("同步失败",-1);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = "archiveList")
|
|
|
@ApiOperation(value = "获取档案分页")
|
|
|
public PageEnvelop<List<Map<String,Object>>> archiveList (
|
|
|
@ApiParam(name = "doctorId", value = "医生id", required = true)
|
|
|
@RequestParam(value = "doctorId") String doctorId,
|
|
|
@ApiParam(name = "signStatus", value = "签约状态", required = false)
|
|
|
@RequestParam(value = "signStatus",required = false) Integer signStatus,
|
|
|
@ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
|
|
|
@RequestParam(value = "page") int page,
|
|
|
@ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
|
|
|
@RequestParam(value = "size") int size) throws Exception {
|
|
|
try{
|
|
|
return archiveService.archiveList(doctorId,page,size,signStatus);
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
return PageEnvelop.getError("查询失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|