humingfen 6 år sedan
förälder
incheckning
1f99be306e

+ 39 - 15
common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/survey/SurveyQuestionResult.java

@ -18,9 +18,13 @@ public class SurveyQuestionResult extends IdEntity implements Serializable {
    //唯一标识
    private String code;
    //模板编码
    private String templateCode;
    private String surveyCode;
    //模板标题
    private  String templateTitle;
    private  String surveyTitle;
    //派发问卷的医生code
    private String doctor;
    //派发问卷的医生名称
    private String doctorName;
    //居民code
    private String patientCode;
    //居民名字
@ -37,10 +41,12 @@ public class SurveyQuestionResult extends IdEntity implements Serializable {
    public SurveyQuestionResult() {
    }
    public SurveyQuestionResult(String code, String templateCode, String templateTitle, String patientCode, String patientName, Integer type, String createUser, String createUserName, Date createTime) {
    public SurveyQuestionResult(String code, String surveyCode, String surveyTitle, String doctor, String doctorName, String patientCode, String patientName, Integer type, String createUser, String createUserName, Date createTime) {
        this.code = code;
        this.templateCode = templateCode;
        this.templateTitle = templateTitle;
        this.surveyCode = surveyCode;
        this.surveyTitle = surveyTitle;
        this.doctor = doctor;
        this.doctorName = doctorName;
        this.patientCode = patientCode;
        this.patientName = patientName;
        this.type = type;
@ -58,22 +64,40 @@ public class SurveyQuestionResult extends IdEntity implements Serializable {
        this.code = code;
    }
    @Column(name = "template_code")
    public String getTemplateCode() {
        return templateCode;
    @Column(name = "survey_code")
    public String getSurveyCode() {
        return surveyCode;
    }
    public void setTemplateCode(String templateCode) {
        this.templateCode = templateCode;
    public void setSurveyCode(String surveyCode) {
        this.surveyCode = surveyCode;
    }
    @Column(name = "template_title")
    public String getTemplateTitle() {
        return templateTitle;
    @Column(name = "survey_title")
    public String getSurveyTitle() {
        return surveyTitle;
    }
    public void setTemplateTitle(String templateTitle) {
        this.templateTitle = templateTitle;
    public void setSurveyTitle(String surveyTitle) {
        this.surveyTitle = surveyTitle;
    }
    @Column(name = "doctor")
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    @Column(name = "doctor_name")
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    @Column(name = "patient_code")

+ 13 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/customer/CustomerSynergyManageController.java

@ -82,6 +82,19 @@ public class CustomerSynergyManageController extends BaseController {
    }
    @RequestMapping(value = "/getCustomers", method = RequestMethod.GET)
    @ApiOperation(value = "获取客服列表")
    public String getCustomers(){
        try {
            List<User> list = synergyManageService.getCustomers();
            return write(200,"保存成功", "data", list);
        }catch (Exception e){
            error(e);
            return error(-1,"保存失败");
        }
    }
    @RequestMapping(value = "/labels", method = RequestMethod.GET)
    @ApiOperation("根据分组类型查找标签")
    public String labels(

+ 42 - 20
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/survey/SurveyQuestionResult.java

@ -18,9 +18,13 @@ public class SurveyQuestionResult extends IdEntity implements Serializable {
    //唯一标识
    private String code;
    //模板编码
    private String templateCode;
    private String surveyCode;
    //模板标题
    private  String templateTitle;
    private  String surveyTitle;
    //派发问卷的医生code
    private String doctor;
    //派发问卷的医生名称
    private String doctorName;
    //居民code
    private String patientCode;
    //居民名字
@ -43,24 +47,6 @@ public class SurveyQuestionResult extends IdEntity implements Serializable {
        this.code = code;
    }
    @Column(name = "template_code")
    public String getTemplateCode() {
        return templateCode;
    }
    public void setTemplateCode(String templateCode) {
        this.templateCode = templateCode;
    }
    @Column(name = "template_title")
    public String getTemplateTitle() {
        return templateTitle;
    }
    public void setTemplateTitle(String templateTitle) {
        this.templateTitle = templateTitle;
    }
    @Column(name = "patient_code")
    public String getPatientCode() {
        return patientCode;
@ -114,4 +100,40 @@ public class SurveyQuestionResult extends IdEntity implements Serializable {
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @Column(name = "survey_code")
    public String getSurveyCode() {
        return surveyCode;
    }
    public void setSurveyCode(String surveyCode) {
        this.surveyCode = surveyCode;
    }
    @Column(name = "survey_title")
    public String getSurveyTitle() {
        return surveyTitle;
    }
    public void setSurveyTitle(String surveyTitle) {
        this.surveyTitle = surveyTitle;
    }
    @Column(name = "doctor")
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    @Column(name = "doctor_name")
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
}

+ 2 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/UserDao.java

@ -40,4 +40,6 @@ public interface UserDao extends PagingAndSortingRepository<User, Long>, JpaSpec
	List<User> findByType(int type);
	@Query("from User u where u.type = 4")
    List<User> findAllCustomer();
}

+ 17 - 12
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/QuestionnaireManageService.java

@ -11,7 +11,6 @@ import com.yihu.wlyy.repository.synergy.ManageSynergyWorkOrderDao;
import com.yihu.wlyy.repository.synergy.ManageSynergyWorkorderServicerDao;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
@ -97,8 +96,12 @@ public class QuestionnaireManageService extends BaseJpaService {
     * @param jsonData
     * @param serviceCode
     */
    public String saveResultAndAnswer(String patientCode, Integer labelType, String customerCode, Integer source, String jsonData, String serviceCode) {
    public String saveResultAndAnswer(String patientCode, Integer labelType, String customerCode, Integer source, String jsonData, String serviceCode) throws Exception {
        String url = wlyyUrl + "third/synergy/questionnaire/saveResultAndAnswer";
        //查找发放问卷的医生
        String sql = "SELECT w.create_user from manage_synergy_workorder_servicer s, manage_synergy_workorder w " +
                "where s.workorder_code = w.`code` and s.`code`= '" + serviceCode + "'";
        String doctor = jdbcTemplate.queryForObject(sql, String.class);
        String response = "";
        Map<String, Object> params = new HashMap<>();
        params.put("labelType", labelType);
@ -107,17 +110,19 @@ public class QuestionnaireManageService extends BaseJpaService {
        params.put("customerCode", customerCode);
        params.put("source", source);
        params.put("isAgain", 0);
        params.put("doctor", doctor);
        try {
            response = httpClientUtil.post(url, params);
        } catch (Exception e) {
            e.printStackTrace();
        }
        JSONObject object = JSONObject.parseObject(response);
        String questionResultCode = object.getString("data");
        if(StringUtils.isNotBlank(questionResultCode)) {
        if(object.getInteger("status") == 200) {
            String questionResultCode = object.getString("data");
            workorderServicerDao.updateRelationCodeByCode(serviceCode, questionResultCode);
            return questionResultCode;
        }
        return questionResultCode;
        throw new Exception("保存失败");
    }
    /**
@ -125,14 +130,14 @@ public class QuestionnaireManageService extends BaseJpaService {
     * @param surveyCode
     * @return
     */
    public JSONObject getAnswers(String surveyCode) {
    public JSONObject getAnswers(String surveyCode) throws Exception {
        String url = wlyyUrl + "third/synergy/questionnaire/getAnswers?id=" + surveyCode;
        String  response = httpClientUtil.get(url, "UTF-8");
        JSONObject jsonObject = JSONObject.parseObject(response);
        if(jsonObject.getInteger("status") == 200){
            return JSONObject.parseObject(jsonObject.getString("data"));
        }
        return JSONObject.parseObject(response);
        throw new Exception("请求失败");
    }
    /**
@ -145,13 +150,13 @@ public class QuestionnaireManageService extends BaseJpaService {
        //查找问卷结果信息
        SurveyQuestionResult questionResult = questionResultDao.findByCode(code);
        String patient = questionResult.getPatientCode();
        String templateCode = questionResult.getTemplateCode();
        String surverCode = questionResult.getSurveyCode();
        //获取模板问题
        List<SurveyQuestionnaire> questionList = surveyQuestionnaireDao.findBySurveyCode(templateCode);
        List<SurveyQuestionnaire> questionList = surveyQuestionnaireDao.findBySurveyCode(surverCode);
        //查找选项和答案
        Map<String, Object> answerMap = new HashMap<>();
        String sql = "SELECT soa.*, sqo.content FROM wlyy_survey_option_answers soa LEFT JOIN wlyy_survey_questions_options sqo ON soa.options_code= sqo.code WHERE soa.screen_result_code = ? AND soa.patient=? AND soa.survey_code=?";
        List<Map<String, Object>> optionAnswersList = jdbcTemplate.queryForList(sql, new Object[]{code, patient, templateCode});
        List<Map<String, Object>> optionAnswersList = jdbcTemplate.queryForList(sql, new Object[]{code, patient, surverCode});
        for (SurveyQuestionnaire question : questionList) {
            List<Map<String, Object>> optionList = new ArrayList<>();
            Map<String, Object> map = new HashMap<>();
@ -169,13 +174,13 @@ public class QuestionnaireManageService extends BaseJpaService {
        return json;
    }
    public JSONObject getQuestionnaireDetail(String surveyCode) {
    public JSONObject getQuestionnaireDetail(String surveyCode) throws Exception {
        String url = wlyyUrl + "third/synergy/questionnaire/getQuestionnaireDetail?id=" + surveyCode;
        String response = httpClientUtil.get(url, "UTF-8");
        JSONObject jsonObject = JSONObject.parseObject(response);
        if(jsonObject.getInteger("status") == 200){
            return JSONObject.parseObject(jsonObject.getString("data"));
        }
        return JSONObject.parseObject(response);
        throw new Exception("请求失败");
    }
}

+ 4 - 4
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/ScreenResultManageService.java

@ -24,14 +24,14 @@ public class ScreenResultManageService {
     * @param code
     * @return
     */
    public JSONObject getScreenResultDetail(String code) {
    public JSONObject getScreenResultDetail(String code) throws Exception {
        String url = wlyyUrl + "third/synergy/screen/getScreenResultDetail?code=" + code;
        String response = httpClientUtil.get(url, "UTF-8");
        JSONObject jsonObject = JSONObject.parseObject(response);
        if(jsonObject.getInteger("status") == 200){
            return JSONObject.parseObject(jsonObject.getString("data"));
        }
        return JSONObject.parseObject(response);
        throw new Exception("请求失败");
    }
    /**
@ -39,13 +39,13 @@ public class ScreenResultManageService {
     * @param templateCode
     * @return
     */
    public JSONObject getScreenDetail(String templateCode) {
    public JSONObject getScreenDetail(String templateCode) throws Exception {
        String url = wlyyUrl + "third/synergy/questionnaire/getAllQuestions?surveyTemplateCode=" + templateCode;
        String response = httpClientUtil.get(url, "UTF-8");
        JSONObject jsonObject = JSONObject.parseObject(response);
        if(jsonObject.getInteger("status") == 200){
            return JSONObject.parseObject(jsonObject.getString("data"));
        }
        return JSONObject.parseObject(response);
        throw new Exception("请求失败");
    }
}

+ 11 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/SynergyManageService.java

@ -360,6 +360,13 @@ public class SynergyManageService extends BaseJpaService {
            map.put("servicerKey", workorderDO.getServicerKey());
            map.put("servicerCount", workorderDO.getServicerCount());
        }
        //如果是随访,查出对象的信息
        if(workorderDO.getType() == 3){
            List<ManageSynergyWorkorderServicerDO> workorderServicerDO = workorderServicerDao.findByWorkorderCode(workorderCode);
            map.put("patientName", workorderServicerDO.get(0).getServicePatientName());
            map.put("idcard", workorderServicerDO.get(0).getIdcard());
            map.put("ssc", workorderServicerDO.get(0).getSsc());
        }
        //超时标签
        map.put("delayStatus", this.isServiceOverTime(workorderDO.getServiceTime()));
@ -509,6 +516,7 @@ public class SynergyManageService extends BaseJpaService {
            resultMap.put("doctorCode",workorderMap.get("create_user"));//创建人(医生)code
            //获取提交记录
            String servicerCode = workorderMap.get("servicerCode")+"";
            resultMap.put("servicerCode", servicerCode);
            List<ManageSynergyWorkorderServicerLogDO> list = manageSynergyWorkorderServicerLogDao.findByWorkorderServiceCode(servicerCode);
            if(list.size()>0){
                ManageSynergyWorkorderServicerLogDO log = list.get(0);
@ -1641,4 +1649,7 @@ public class SynergyManageService extends BaseJpaService {
        return resultList;
    }
    public List<User> getCustomers() {
        return userDao.findAllCustomer();
    }
}

+ 7 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/survey/ManagerQuestionnaireService.java

@ -1915,21 +1915,25 @@ public class ManagerQuestionnaireService extends BaseService {
     * @param jsonData
     * @param patientCode
     * @param customerCode
     * @param doctor
     * @return
     * @throws Exception
     */
    public String saveQuestionResultAndAnswer(JSONObject jsonData, String patientCode, String customerCode) throws Exception {
    public String saveQuestionResultAndAnswer(JSONObject jsonData, String patientCode, String customerCode, String doctor) throws Exception {
        String surveyCode = jsonData.get("surveyCode").toString();
        Survey survey = surveyDao.findById(surveyCode);
        Patient patient = patientDao.findByCode(patientCode);
        User user = userDao.findByCode(customerCode);
        Doctor d = doctorDao.findByCode(doctor);
        SurveyQuestionResult questionResult =  new SurveyQuestionResult();
        String code = getCode();
        questionResult.setCode(code);
        questionResult.setTemplateCode(survey.getCode());
        questionResult.setTemplateTitle(survey.getTitle());
        questionResult.setSurveyCode(survey.getCode());
        questionResult.setSurveyTitle(survey.getTitle());
        questionResult.setPatientCode(patient.getCode());
        questionResult.setPatientName(patient.getName());
        questionResult.setDoctor(doctor);
        questionResult.setDoctorName(d.getName());
        questionResult.setType(1);
        questionResult.setCreateUser(customerCode);
        questionResult.setCreateUserName(user.getName());

+ 3 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/synergy/SynergyManagerController.java

@ -108,6 +108,7 @@ public class SynergyManagerController extends BaseController{
    @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 +117,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();