|
@ -2,11 +2,17 @@ package com.yihu.wlyy.web.third.synergy;/**
|
|
|
* Created by nature of king on 2018/10/8.
|
|
|
*/
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.yihu.es.entity.FollowupContentESDO;
|
|
|
import com.yihu.wlyy.aop.ObserverRequired;
|
|
|
import com.yihu.wlyy.entity.message.Message;
|
|
|
import com.yihu.wlyy.service.app.followup.FollowUpService;
|
|
|
import com.yihu.wlyy.service.app.followup.FollowupDrugsService;
|
|
|
import com.yihu.wlyy.service.app.survey.SurveyScreenResultService;
|
|
|
import com.yihu.wlyy.service.specialist.SpecialistEvaluateSevice;
|
|
|
import com.yihu.wlyy.service.survey.ManagerQuestionnaireService;
|
|
|
import com.yihu.wlyy.service.third.jw.ZyDictService;
|
|
|
import com.yihu.wlyy.web.BaseController;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
@ -16,6 +22,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.MediaType;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* @author wangzhinan
|
|
|
* @create 2018-10-08 13:56
|
|
@ -31,6 +41,12 @@ public class SynergyManagerController extends BaseController{
|
|
|
private ManagerQuestionnaireService managerQuestionnaireService;
|
|
|
@Autowired
|
|
|
private SurveyScreenResultService surveyScreenResultService;
|
|
|
@Autowired
|
|
|
private ZyDictService zyDictService;
|
|
|
@Autowired
|
|
|
private FollowupDrugsService followupDrugsService;
|
|
|
@Autowired
|
|
|
private SpecialistEvaluateSevice specialistEvaluateSevice;
|
|
|
|
|
|
@ApiOperation("新增临时随访记录(返回ID)")
|
|
|
@RequestMapping(value = "/addFollowup", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
|
|
@ -68,14 +84,15 @@ public class SynergyManagerController extends BaseController{
|
|
|
@RequestMapping(value = "/saveFollowupProjectData", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
@ObserverRequired
|
|
|
public String saveFollowupProjectData(@ApiParam(name = "followup", value = "随访项目对象")
|
|
|
public String saveFollowupProjectData(@ApiParam(name = "id", value = "随访记录id")
|
|
|
@RequestParam(value = "id", required = true)String id,
|
|
|
@ApiParam(name = "followup", value = "随访项目对象")
|
|
|
@RequestParam(value = "followup", required = true)String followup ) {
|
|
|
try {
|
|
|
JSONArray array = JSONArray.parseArray(followup);
|
|
|
// followUpService.saveFollowupProjectData(id, followupProject, followupProjectData);
|
|
|
//修改为通过ES查询---2017.11.01--huangwenjie
|
|
|
for (int i =0;i<array.size();i++){
|
|
|
String id = array.getJSONObject(i).getString("id");
|
|
|
String followupProject = array.getJSONObject(i).getString("followupProject");
|
|
|
String followupProjectData = array.getJSONObject(i).getString("followupProjectData");
|
|
|
followUpService.esSaveFollowupProjectData(id, followupProject, followupProjectData);
|
|
@ -88,26 +105,99 @@ public class SynergyManagerController extends BaseController{
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* @RequestMapping(value = "/findDictByName", method = RequestMethod.GET)
|
|
|
/**
|
|
|
* 获取药品
|
|
|
*
|
|
|
* @param name
|
|
|
* @param isinsulin
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/findDictByName", method = RequestMethod.POST)
|
|
|
@ApiOperation(value = "药品列表")
|
|
|
public String findDictByName(@ApiParam(name = "name", value = "药品名称(中文或拼音首字母查询)", defaultValue = "胰岛素")
|
|
|
@RequestParam(value = "name", required = false) String name,
|
|
|
@ApiParam(name = "isinsulin", value = "是否过滤胰岛素:1非胰岛素,2胰岛素", defaultValue = "")
|
|
|
@RequestParam(value = "isinsulin", required = false) String isinsulin) {
|
|
|
@RequestParam(value = "isinsulin", required = false) String isinsulin,
|
|
|
@ApiParam(name = "doctor", value = "医生code", defaultValue = "")
|
|
|
@RequestParam(value = "doctor", required = false) String doctor) {
|
|
|
try {
|
|
|
// return write(200, "操作成功!", "data",zyDictService.findDictByDoctorAndName("e3b3bfb3644011e69616fa163e424525",name,isinsulin));
|
|
|
return write(200, "操作成功!", "data",zyDictService.findDictByDoctorAndName(getUID(), name,isinsulin));
|
|
|
return write(200, "操作成功!", "data",zyDictService.findDictByDoctorAndName(doctor, name,isinsulin));
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, "查询失败!");
|
|
|
}
|
|
|
}*/
|
|
|
}
|
|
|
|
|
|
|
|
|
@ApiOperation("保存面访用药数据")
|
|
|
@RequestMapping(value = "/saveFollowupDrugs", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
@ObserverRequired
|
|
|
public String saveFollowupDrugs(@ApiParam(name="id",value="随访记录ID",defaultValue = "")
|
|
|
@RequestParam(value="id",required = true) String id,
|
|
|
@ApiParam(name="drugsData",value="面访用药数据",defaultValue = "[]")
|
|
|
@RequestParam(value="drugsData",required = true) String drugsData)
|
|
|
{
|
|
|
try {
|
|
|
followupDrugsService.saveFollowupDrugs(id,drugsData);
|
|
|
|
|
|
return write(200, "保存面访用药数据成功!");
|
|
|
} catch (Exception e) {
|
|
|
return invalidUserException(e, -1, "保存面访用药数据失败!"+e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
@ApiOperation("查询体征数据")
|
|
|
@RequestMapping(value = "/findByPatient", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
@ObserverRequired
|
|
|
public String findByPatient(@ApiParam(name="patient",value="居民code",defaultValue = "")
|
|
|
@RequestParam(value="patient",required = true) String patient)
|
|
|
{
|
|
|
try {
|
|
|
return write(200, "查询成功","data",zyDictService.findByPatient(patient));
|
|
|
} catch (Exception e) {
|
|
|
return invalidUserException(e, -1, "查询失败"+e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
@ApiOperation("获取随访数据")
|
|
|
@RequestMapping(value = "/getFollowupProjectData", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public String getFollowupProjectData(@ApiParam(name = "id", value = "随访记录ID", defaultValue = "4")
|
|
|
@RequestParam(value = "id", required = true) String id,
|
|
|
@ApiParam(name = "followupProject", value = "随访项目", defaultValue = "2")
|
|
|
@RequestParam(value = "followupProject", required = true) String followupProject) {
|
|
|
try {
|
|
|
// Map<String, String> response = followUpService.getFollowupProjectData(id, followupProject);
|
|
|
//修改为通过ES查询---2017.11.01--huangwenjie
|
|
|
Map<String, String> response = followUpService.getFollowup(id);
|
|
|
Map<String,Object> followupDrugs = followupDrugsService.getFollowupDrugs(id);
|
|
|
JSONArray array = JSON.parseArray(followupProject);
|
|
|
List<FollowupContentESDO> followupContentESDOS = new ArrayList<>();
|
|
|
for (int i =0;i<array.size();i++){
|
|
|
FollowupContentESDO followupContentESDO = followUpService.esGetFollowupProjectData(id, array.getString(i));
|
|
|
followupContentESDOS.add(followupContentESDO);
|
|
|
}
|
|
|
JSONObject object = new JSONObject();
|
|
|
object.put("followup",response);
|
|
|
object.put("followupDrugs",followupDrugs);
|
|
|
object.put("followupContent",followupContentESDOS);
|
|
|
return write(200, "获取随访项目数据成功!", "data", object);
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return invalidUserException(e, -1, "获取随访项目数据失败!" + e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/questionnaire/saveResultAndAnswer", method = RequestMethod.POST)
|
|
|
@ApiOperation(value = "保存用户问卷答案")
|
|
|
public String saveResultAndAnswer( @ApiParam(name = "jsonData", value = "问题和答案字符串")@RequestParam(value = "jsonData") String jsonData,
|
|
|
@ApiParam(name = "patientCode", value = "居民code")@RequestParam(value = "patientCode")String patientCode,
|
|
|
@ApiParam(name = "doctor", value = "医生code")@RequestParam(value = "doctor")String doctor,
|
|
|
@ApiParam(name = "customerCode", value = "客服code")@RequestParam(value = "customerCode")String customerCode,
|
|
|
@ApiParam(name = "labelType", value = "问卷标签")@RequestParam(value = "labelType")Integer labelType,
|
|
|
@ApiParam(name = "isAgain", value = "筛查入口(labelType=5时要填),0是第一次筛查 1是再次评估")@RequestParam(value = "isAgain", required = false)int isAgain,
|
|
@ -116,9 +206,9 @@ public class SynergyManagerController extends BaseController{
|
|
|
|
|
|
JSONObject json = new JSONObject(jsonData);
|
|
|
if (labelType == 5){
|
|
|
return write(200, "保存成功!","data",surveyScreenResultService.saveScreenResultAndAnswer(patientCode, customerCode, isAgain, source, json));
|
|
|
return write(200, "保存成功!","data",surveyScreenResultService.saveScreenResultAndAnswer(patientCode, doctor, isAgain, source, json));
|
|
|
}else {
|
|
|
return write(200, "保存成功!", "data", managerQuestionnaireService.saveQuestionResultAndAnswer(json, patientCode, customerCode));
|
|
|
return write(200, "保存成功!", "data", managerQuestionnaireService.saveQuestionResultAndAnswer(json, patientCode, customerCode, doctor));
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@ -195,4 +285,41 @@ public class SynergyManagerController extends BaseController{
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 发送消息 type:19 受理提醒,20 待办工作提醒 21 服务进展提醒-已完成 22 服务进展提醒-未完成
|
|
|
* message{sender:"",receiver:"",relationCode:""}
|
|
|
* @param message
|
|
|
* @param hospital
|
|
|
* @param patient
|
|
|
* @param time
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/sendMessage", method = RequestMethod.GET)
|
|
|
@ResponseBody
|
|
|
@ApiOperation("发送消息")
|
|
|
public String sendMessage(@ApiParam(name = "message",value = "消息对象(如:{'sender':'','receiver':'','relationCode':'','type':19})",required = true)
|
|
|
@RequestParam(value = "message",required = true)String message,
|
|
|
@ApiParam(name = "hospital",value = "医院code",required = false)
|
|
|
@RequestParam(value = "hospital",required = false)String hospital,
|
|
|
@ApiParam(name = "patient",value = "居民code",required = false)
|
|
|
@RequestParam(value = "patient",required = false)String patient,
|
|
|
@ApiParam(name = "time",value = "时间",required = false)
|
|
|
@RequestParam(value = "time",required = false)Integer time,
|
|
|
@ApiParam(name = "jsonObject",value = "参数",required = false)
|
|
|
@RequestParam(value = "jsonObject",required = false) String jsonObject){
|
|
|
try {
|
|
|
com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(message);
|
|
|
Message message1 = new Message();
|
|
|
message1.setSender(object.getString("sender"));
|
|
|
message1.setType(object.getInteger("type"));
|
|
|
message1.setReceiver(object.getString("receiver"));
|
|
|
message1.setRelationCode(object.getString("relationCode"));
|
|
|
com.alibaba.fastjson.JSONObject jsonObject1 = com.alibaba.fastjson.JSONObject.parseObject(jsonObject);
|
|
|
return write(200, "获取消息成功!","data",specialistEvaluateSevice.sendMessage(message1,hospital,patient,time,jsonObject1));
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, "获取消息失败!");
|
|
|
}
|
|
|
}
|
|
|
}
|