Explorar el Código

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

huangwenjie hace 6 años
padre
commit
e7ece2e4d3
Se han modificado 16 ficheros con 673 adiciones y 78 borrados
  1. 8 8
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/customer/CustomerQuestionnaireController.java
  2. 25 3
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/customer/CustomerSynergyManageController.java
  3. 165 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/survey/SurveyQuestionnaire.java
  4. 120 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/survey/SurveyQuestionnaireOptions.java
  5. 3 3
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/synergy/ManageCustomerOnlineRecordDO.java
  6. 14 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/survey/SurveyQuestionnaireDao.java
  7. 8 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/survey/SurveyQuestionnaireOptionsDao.java
  8. 17 15
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/QuestionnaireManageService.java
  9. 4 4
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/ScreenResultManageService.java
  10. 289 39
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/SynergyManageService.java
  11. 7 3
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/JMController.java
  12. 9 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/JMService.java
  13. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/imm/ChildFamilyImmuneService.java
  14. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/imm/ChildInfoService.java
  15. 2 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/survey/ManagerQuestionnaireService.java
  16. 0 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/guahao/ImmuneService.java

+ 8 - 8
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/customer/CustomerQuestionnaireController.java

@ -29,12 +29,12 @@ public class CustomerQuestionnaireController extends BaseController {
    @RequestMapping(value = "saveAnswer", method = RequestMethod.POST)
    @ApiOperation(value = "保存用户答案")
    public String saveAnswer( @ApiParam(value = "问卷题目及选项", required = true)@RequestParam String jsonData,
                              @ApiParam(value = "客服code", required = true)@RequestParam(value = "customerCode")String customerCode,
                              @ApiParam(value = "居民code", required = true)@RequestParam(value = "patientCode")String patientCode,
                              @ApiParam(value = "问卷标签(疾病筛查问卷要传5,否则可不传)", required = false)@RequestParam(value = "labelType")Integer labelType,
                              @ApiParam(value = "来源(1医生发放 2居民自我评估)", required = false, defaultValue = "1")@RequestParam(value = "source")Integer source,
                              @ApiParam(value = "协同工单服务对象表code", required = true)@RequestParam(value = "serviceCode")String serviceCode) {
    public String saveAnswer( @ApiParam(value = "问卷题目及选项")@RequestParam String jsonData,
                              @ApiParam(value = "客服code")@RequestParam(value = "customerCode", required = true)String customerCode,
                              @ApiParam(value = "居民code")@RequestParam(value = "patientCode", required = true)String patientCode,
                              @ApiParam(value = "问卷标签(疾病筛查问卷要传5,调查问卷传4)")@RequestParam(value = "labelType", required = false)Integer labelType,
                              @ApiParam(value = "来源(1医生发放 2居民自我评估)")@RequestParam(value = "source", required = false, defaultValue = "1")Integer source,
                              @ApiParam(value = "协同工单服务对象表code", required = true)@RequestParam(value = "serviceCode", required = true)String serviceCode) {
        try {
            return  write(200, "保存成功!", "data", questionnaireService.saveResultAndAnswer(patientCode, labelType, customerCode, source,jsonData, serviceCode));
        } catch (Exception e) {
@ -45,9 +45,9 @@ public class CustomerQuestionnaireController extends BaseController {
    @RequestMapping(value = "getAnswers", method = RequestMethod.GET)
    @ApiOperation(value = "查看调查统计结果")
    public String getAnswers(@ApiParam(value = "问卷code", required = true) @RequestParam String templateCode) {
    public String getAnswers(@ApiParam(value = "问卷code", required = true) @RequestParam String surveyCode) {
        try {
            return write(200, "查询成功!", "data", questionnaireService.getAnswers(templateCode));
            return write(200, "查询成功!", "data", questionnaireService.getAnswers(surveyCode));
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "查询失败!");

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

@ -466,10 +466,32 @@ public class CustomerSynergyManageController extends BaseController {
    }
    @RequestMapping(value = "adminIndex",method = RequestMethod.GET)
    @ApiOperation(value = "管理员首页")
    public String adminIndex(@ApiParam(name="userCode",value="客服code")@RequestParam(value ="userCode")String userCode){
    @ApiOperation(value = "管理员首页.")
    public String adminIndex(){
        try{
            return write(200,"获取成功!","data",synergyManageService.customerIndex(userCode));
            return write(200,"获取成功!","data",synergyManageService.adminIndex());
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"获取失败!");
        }
    }
    @RequestMapping(value = "intervalOnLine",method = RequestMethod.GET)
    @ApiOperation(value = "管理员首页-今日在线服务趋势")
    public String intervalOnLine(){
        try{
            return write(200,"获取成功!","data",synergyManageService.intervalOnLine());
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"获取失败!");
        }
    }
    @RequestMapping(value = "TodayCustomerActivy",method = RequestMethod.GET)
    @ApiOperation(value = "管理员首页-客服今日活动.")
    public String TodayCustomerActivy(){
        try{
            return write(200,"获取成功!","data",synergyManageService.TodayCustomerActivy());
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"获取失败!");

+ 165 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/survey/SurveyQuestionnaire.java

@ -0,0 +1,165 @@
package com.yihu.wlyy.entity.survey;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
/**
 * Created by Reece on 2017/3/10.
 */
@Entity
@Table(name = "wlyy_survey_questionnaire")
public class SurveyQuestionnaire extends IdEntity implements Serializable {
    //    问题编码
    private String code;
    //            问题标题
    private String title;
    //    问题说明(可为null)
    private String questionComment;
    //    问题类型(0单选 1多选 2问答)
    private int questionType;
    //    关联编码(按使用类型分类)
    private String surveyCode;
    //    是否必答(0否 1是)
    private int isRequired;
    //    最小答案个数(多选有效)
    private Integer minNum;
    //    最大答案个数(多选有效)
    private Integer maxNum;
    //            排序
    private int sort;
    //    下一题问题编码(问答题逻辑跳转)
    private String questionCodeNext;
    //    删除标志(1正常,0删除)
    private int del;
    //    创建时间
    private Date createTime;
    //    修改时间
    private Date updateTime;
    public SurveyQuestionnaire() {
    }
    public SurveyQuestionnaire(String code, String title, String questionComment, int questionType, String surveyCode, int isRequired, Integer minNum, Integer maxNum, int sort, String questionCodeNext, int del, Date createTime, Date updateTime) {
        this.code = code;
        this.title = title;
        this.questionComment = questionComment;
        this.questionType = questionType;
        this.surveyCode = surveyCode;
        this.isRequired = isRequired;
        this.minNum = minNum;
        this.maxNum = maxNum;
        this.sort = sort;
        this.questionCodeNext = questionCodeNext;
        this.del = del;
        this.createTime = createTime;
        this.updateTime = updateTime;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    public String getQuestionComment() {
        return questionComment;
    }
    public void setQuestionComment(String questionComment) {
        this.questionComment = questionComment;
    }
    public int getQuestionType() {
        return questionType;
    }
    public void setQuestionType(int questionType) {
        this.questionType = questionType;
    }
    public String getSurveyCode() {
        return surveyCode;
    }
    public void setSurveyCode(String surveyCode) {
        this.surveyCode = surveyCode;
    }
    public int getIsRequired() {
        return isRequired;
    }
    public void setIsRequired(int isRequired) {
        this.isRequired = isRequired;
    }
    public Integer getMinNum() {
        return minNum;
    }
    public void setMinNum(Integer minNum) {
        this.minNum = minNum;
    }
    public Integer getMaxNum() {
        return maxNum;
    }
    public void setMaxNum(Integer maxNum) {
        this.maxNum = maxNum;
    }
    public int getSort() {
        return sort;
    }
    public void setSort(int sort) {
        this.sort = sort;
    }
    public String getQuestionCodeNext() {
        return questionCodeNext;
    }
    public void setQuestionCodeNext(String questionCodeNext) {
        this.questionCodeNext = questionCodeNext;
    }
    public int getDel() {
        return del;
    }
    public void setDel(int del) {
        this.del = del;
    }
}

+ 120 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/survey/SurveyQuestionnaireOptions.java

@ -0,0 +1,120 @@
package com.yihu.wlyy.entity.survey;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
/**
 * Created by Reece on 2017/3/10.
 */
@Entity
@Table(name = "wlyy_survey_questionnaire_options")
public class SurveyQuestionnaireOptions extends IdEntity implements Serializable {
    //选项编码
    private String code;
    //    是否有选项说明(0没有 1有)
    private int haveComment;
    //    	所属问题编码
    private String questionnaireCode;
    //    选项内容
    private String content;
    //        问卷编码
    private String surveyCode;
    //    下一题问题编码(逻辑跳转)
    private String questionCodeNext;
    //    选项说明是否必填(0否 1是)
    private int isRequired;
    //    单题内排序
    private int sort;
    //    删除标志(1正常,0删除)
    private int del;
    public SurveyQuestionnaireOptions() {
    }
    public SurveyQuestionnaireOptions(String code, int haveComment, String questionnaireCode, String content, String surveyCode, String questionCodeNext, int isRequired, int sort, int del) {
        this.code = code;
        this.haveComment = haveComment;
        this.questionnaireCode = questionnaireCode;
        this.content = content;
        this.surveyCode = surveyCode;
        this.questionCodeNext = questionCodeNext;
        this.isRequired = isRequired;
        this.sort = sort;
        this.del = del;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public int getHaveComment() {
        return haveComment;
    }
    public void setHaveComment(int haveComment) {
        this.haveComment = haveComment;
    }
    public String getQuestionnaireCode() {
        return questionnaireCode;
    }
    public void setQuestionnaireCode(String questionnaireCode) {
        this.questionnaireCode = questionnaireCode;
    }
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public String getSurveyCode() {
        return surveyCode;
    }
    public void setSurveyCode(String surveyCode) {
        this.surveyCode = surveyCode;
    }
    public String getQuestionCodeNext() {
        return questionCodeNext;
    }
    public void setQuestionCodeNext(String questionCodeNext) {
        this.questionCodeNext = questionCodeNext;
    }
    public int getIsRequired() {
        return isRequired;
    }
    public void setIsRequired(int isRequired) {
        this.isRequired = isRequired;
    }
    public int getSort() {
        return sort;
    }
    public void setSort(int sort) {
        this.sort = sort;
    }
    public int getDel() {
        return del;
    }
    public void setDel(int del) {
        this.del = del;
    }
}

+ 3 - 3
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/synergy/ManageCustomerOnlineRecordDO.java

@ -22,7 +22,7 @@ public class ManageCustomerOnlineRecordDO extends IdEntity {
    private String jobNo;//客服工号
    private String seat;//席位
    private String phone;//客服电话
    private String totalOnlineTime;//在线总时长
    private int totalOnlineTime;//在线总时长(单位:分钟)
    @Column(name = "code")
    public String getCode() {
@ -97,11 +97,11 @@ public class ManageCustomerOnlineRecordDO extends IdEntity {
    }
    @Column(name = "total_online_time")
    public String getTotalOnlineTime() {
    public int getTotalOnlineTime() {
        return totalOnlineTime;
    }
    public void setTotalOnlineTime(String totalOnlineTime) {
    public void setTotalOnlineTime(int totalOnlineTime) {
        this.totalOnlineTime = totalOnlineTime;
    }
}

+ 14 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/survey/SurveyQuestionnaireDao.java

@ -0,0 +1,14 @@
package com.yihu.wlyy.repository.survey;
import com.yihu.wlyy.entity.survey.SurveyQuestionnaire;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
public interface SurveyQuestionnaireDao extends PagingAndSortingRepository<SurveyQuestionnaire,Long>,JpaSpecificationExecutor<SurveyQuestionnaire> {
    @Query("select q from SurveyQuestionnaire q where q.surveyCode = ?1")
    List<SurveyQuestionnaire> findBySurveyCode(String surveyCode);
}

+ 8 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/survey/SurveyQuestionnaireOptionsDao.java

@ -0,0 +1,8 @@
package com.yihu.wlyy.repository.survey;
import com.yihu.wlyy.entity.survey.SurveyQuestionnaireOptions;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface SurveyQuestionnaireOptionsDao extends PagingAndSortingRepository<SurveyQuestionnaireOptions,Long>,JpaSpecificationExecutor<SurveyQuestionnaireOptions> {
}

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

@ -2,11 +2,11 @@ package com.yihu.wlyy.service.synergy;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.survey.SurveyQuestionResult;
import com.yihu.wlyy.entity.survey.SurveyTemplateQuestions;
import com.yihu.wlyy.entity.survey.SurveyQuestionnaire;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderDO;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderServicerDO;
import com.yihu.wlyy.repository.survey.SurveyQuestionResultDao;
import com.yihu.wlyy.repository.survey.SurveyTemplateQuestionsDao;
import com.yihu.wlyy.repository.survey.SurveyQuestionnaireDao;
import com.yihu.wlyy.repository.synergy.ManageSynergyWorkOrderDao;
import com.yihu.wlyy.repository.synergy.ManageSynergyWorkorderServicerDao;
import com.yihu.wlyy.util.HttpClientUtil;
@ -38,7 +38,7 @@ public class QuestionnaireManageService extends BaseJpaService {
    @Autowired
    private ManageSynergyWorkorderServicerDao workorderServicerDao;
    @Autowired
    private SurveyTemplateQuestionsDao templateQuestionDao;
    private SurveyQuestionnaireDao surveyQuestionnaireDao;
    @Autowired
    private SurveyQuestionResultDao questionResultDao;
    @Autowired
@ -122,14 +122,14 @@ public class QuestionnaireManageService extends BaseJpaService {
    /**
     * 查看调查问卷统计结果
     * @param templateCode
     * @param surveyCode
     * @return
     */
    public JSONObject getAnswers(String templateCode) {
        String url = wlyyUrl + "third/synergy/questionnaire/getAnswers?id=" + templateCode;
    public JSONObject getAnswers(String surveyCode) {
        String url = wlyyUrl + "third/synergy/questionnaire/getAnswers?id=" + surveyCode;
        String  response = httpClientUtil.get(url, "UTF-8");
        JSONObject jsonObject = JSONObject.parseObject(response);
        if(jsonObject.getString("msg").equals("查询成功!")){
        if(jsonObject.getInteger("status") == 200){
            return JSONObject.parseObject(jsonObject.getString("data"));
        }
        return JSONObject.parseObject(response);
@ -147,21 +147,23 @@ public class QuestionnaireManageService extends BaseJpaService {
        String patient = questionResult.getPatientCode();
        String templateCode = questionResult.getTemplateCode();
        //获取模板问题
        List<SurveyTemplateQuestions> questionList = templateQuestionDao.findByTemplateCode(templateCode);
        List<SurveyQuestionnaire> questionList = surveyQuestionnaireDao.findBySurveyCode(templateCode);
        //查找选项和答案
        Map<String, Object> answerMap = new HashMap<>();
        String sql = "SELECT soa.*, sto.content FROM wlyy_survey_option_answers soa LEFT JOIN wlyy_survey_template_options sto ON soa.options_code= sto.code WHERE soa.screen_result_code = ? AND soa.patient=? AND soa.survey_code=?";
        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});
        for (SurveyTemplateQuestions templateQuestion : questionList) {
        for (SurveyQuestionnaire question : questionList) {
            List<Map<String, Object>> optionList = new ArrayList<>();
            Map<String, Object> map = new HashMap<>();
            map.put("question", templateQuestion);
            String qusCode = templateQuestion.getCode();
            map.put("question", question);
            String qusCode = question.getCode();
            for (Map<String, Object> option : optionAnswersList) {
                if (option.get("question_code").equals(qusCode)) {
                    map.put("option", option);
                    optionList.add(option);
                }
            }
            answerMap.put(templateQuestion.getSort() + "", map);
            map.put("option", optionList);
            answerMap.put(question.getSort() + "", map);
        }
        json.put("answer", answerMap);
        return json;
@ -171,7 +173,7 @@ public class QuestionnaireManageService extends BaseJpaService {
        String url = wlyyUrl + "third/synergy/questionnaire/getQuestionnaireDetail?id=" + surveyCode;
        String response = httpClientUtil.get(url, "UTF-8");
        JSONObject jsonObject = JSONObject.parseObject(response);
        if(jsonObject.getString("msg").equals("查询成功")){
        if(jsonObject.getInteger("status") == 200){
            return JSONObject.parseObject(jsonObject.getString("data"));
        }
        return JSONObject.parseObject(response);

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

@ -25,10 +25,10 @@ public class ScreenResultManageService {
     * @return
     */
    public JSONObject getScreenResultDetail(String code) {
        String url = wlyyUrl + "synergy/screen/getScreenResultDetail?code=" + code;
        String url = wlyyUrl + "third/synergy/screen/getScreenResultDetail?code=" + code;
        String response = httpClientUtil.get(url, "UTF-8");
        JSONObject jsonObject = JSONObject.parseObject(response);
        if(jsonObject.getString("msg").equals("查询成功")){
        if(jsonObject.getInteger("status") == 200){
            return JSONObject.parseObject(jsonObject.getString("data"));
        }
        return JSONObject.parseObject(response);
@ -40,10 +40,10 @@ public class ScreenResultManageService {
     * @return
     */
    public JSONObject getScreenDetail(String templateCode) {
        String url = wlyyUrl + "synergy/questionnaire/getAllQuestions?surveyTemplateCode=" + templateCode;
        String url = wlyyUrl + "third/synergy/questionnaire/getAllQuestions?surveyTemplateCode=" + templateCode;
        String response = httpClientUtil.get(url, "UTF-8");
        JSONObject jsonObject = JSONObject.parseObject(response);
        if(jsonObject.getString("msg").equals("查询成功")){
        if(jsonObject.getInteger("status") == 200){
            return JSONObject.parseObject(jsonObject.getString("data"));
        }
        return JSONObject.parseObject(response);

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

@ -2,10 +2,6 @@ package com.yihu.wlyy.service.synergy;
import com.yihu.wlyy.entity.*;
import com.yihu.wlyy.entity.call.CallRecord;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkordeReminderDO;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderDO;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderExecutorDO;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderServicerDO;
import com.yihu.wlyy.entity.synergy.*;
import com.yihu.wlyy.repository.*;
import com.yihu.wlyy.repository.synergy.*;
@ -16,7 +12,6 @@ import com.yihu.wlyy.util.fastdfs.FastDFSUtil;
import com.yihu.wlyy.util.query.BaseJpaService;
import jxl.Workbook;
import jxl.write.*;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
@ -401,6 +396,8 @@ public class SynergyManageService extends BaseJpaService {
            //获取处理结果
            map.put("resultRemark", workorderDO.getDealResultRemark());
            map.put("accessory", workorderDO.getDealResultAccessory());
            if(workorderDO.getType() == 4)
            map.put("relationCode", workorderDO.getRelationCode());
        }else if(status == 4){
            //获取退回原因
            map.put("returnedRemark", workorderDO.getReturnedRemark());
@ -1223,9 +1220,11 @@ public class SynergyManageService extends BaseJpaService {
    }
    public Map<String,Object> customerIndex(String userCode){
        Map<String,Object> map = new HashMap<>();
        String today = DateUtil.dateToStrShort(new Date());
        String callSql ="SELECT * FROM manage_call_record WHERE user_code='"+userCode+"' and create_time>='"+today+" 00:00:00' and create_time<='"+today+" 23:59:59'";
        String startTime=today+" 00:00:00";
        String endTime = today+" 23:59:59";
        Map<String,Object> map = new HashMap<>();
        String callSql ="SELECT * FROM manage_call_record WHERE user_code='"+userCode+"' and create_time>='"+startTime+"' and create_time<='"+endTime+"'";
        //--------------今日外呼量-----------------//
        List<CallRecord> waihudList = jdbcTemplate.query(callSql+" and type=2",new BeanPropertyRowMapper<>(CallRecord.class));
        int customerNoCount = 0;
@ -1243,13 +1242,12 @@ public class SynergyManageService extends BaseJpaService {
        map.put("waihuCustomerNoCount",customerNoCount);
        //--------------今日在线时长-----------------//
        String startTime=today+" 00:00:00";
        String endTime = today+" 23:59:59";
        List<ManageCustomerOnlineRecordDO> manageCustomerOnlineRecordDOList = manageCustomerOnlineRecordDao.findByCustomerCodeToday(userCode,startTime,endTime);
        String onLineTime = manageCustomerOnlineRecordDOList.get(0).getTotalOnlineTime();
        for (ManageCustomerOnlineRecordDO customerOnlineRecordDO : manageCustomerOnlineRecordDOList){
        }
        List<ManageCustomerOnlineRecordDO> manageCustomerOnlineRecordDOList = manageCustomerOnlineRecordDao.findByCustomerCodeToday(userCode,startTime,endTime);
        //如果最新一条是离线则直接获取总在线时长就是在线时间,
        // 如果最新一条是在线,则用当前时间减去上一条登录时间加上之前的在线时长为总的在线时长
        Map<String,Object> lineMap = getOnlineAndNotOnlineAndNowOnline(manageCustomerOnlineRecordDOList);
        map.putAll(lineMap);
        //--------------今日接入量-----------------//
        List<CallRecord> jieruList = jdbcTemplate.query(callSql+" and type=1",new BeanPropertyRowMapper<>(CallRecord.class));
@ -1259,12 +1257,90 @@ public class SynergyManageService extends BaseJpaService {
        map.put("jieruAvgTalkTime",getAvgTime(jieruTotalSecond,jieruList.size()));
        map.put("jieruCount",jieruList.size());
        //--------------今日协同任务外呼数-----------------//
        //--------------今日协同任务完成数-----------------//
        String wanchenSql="SELECT" +
                " count(*) as wanchengCount" +
                " FROM" +
                " `manage_synergy_workorder_servicer`" +
                " WHERE" +
                " executor_code = '"+userCode+"'" +
                " AND executor_type = 2" +
                " AND `status`=3" +
                " AND complete_time >='"+startTime+"'" +
                " AND complete_time<='"+endTime+"'";
        Map<String,Object> wanchenMap = jdbcTemplate.queryForMap(wanchenSql);
        String weiwanchenSql ="SELECT" +
                " COUNT(*) AS weiwanchengCount" +
                " FROM" +
                " `manage_synergy_workorder_servicer`" +
                " WHERE" +
                " executor_code = '"+userCode+"'" +
                " AND executor_type = 2" +
                " AND `status`<3";
        Map<String,Object> weiwanchenMap = jdbcTemplate.queryForMap(wanchenSql);
        String fasongSql="SELECT" +
                " COUNT(*) AS fasongCount" +
                " FROM" +
                " manage_synergy_workorder" +
                " WHERE" +
                " create_user = '"+userCode+"'" +
                " AND create_user_type = 2" +
                " AND del = 1" +
                " AND create_time>='"+startTime+"'" +
                " AND create_time<='"+endTime+"'";
        Map<String,Object> fasongMap = jdbcTemplate.queryForMap(fasongSql);
        map.putAll(wanchenMap);
        map.putAll(weiwanchenMap);
        map.putAll(fasongMap);
        return map;
    }
    public Map<String,Object> getOnlineAndNotOnlineAndNowOnline(List<ManageCustomerOnlineRecordDO> list){
        Map<String,Object> map = new HashMap<>();
        //如果最新一条是离线则直接获取总在线时长就是在线时间,
        // 如果最新一条是在线,则用当前时间减去上一条登录时间加上之前的在线时长为总的在线时长
        int status = list.get(list.size()-1).getStatus();
        String firstOnlineTime  = DateUtil.dateToStr(list.get(0).getCreateTime(),DateUtil.YYYY_MM_DD_HH_MM_SS);
        int totalOnlineMinute=0;
        int totalNotOnlineMinute =0;
        int toMinute = 0;
        //离线status==2
        if (status==2){
            totalOnlineMinute =list.get(list.size()-1).getTotalOnlineTime();
            long allTime = list.get(list.size()-1).getCreateTime().getTime()-list.get(0).getCreateTime().getTime();
            totalNotOnlineMinute= Integer.valueOf(String.valueOf(allTime/1000/60))-totalOnlineMinute;
        }
        //在线status==1
        if (status==1){
            //只有一条在线的数据,用当前时间减去数据创建时间
            long onlineDate = 0L;
            long allDateTime = 0L;
            int lastOnlineTime =0;
            Date now = new Date();
            onlineDate = now.getTime()-list.get(list.size()-1).getCreateTime().getTime();
            allDateTime = now.getTime()-list.get(0).getCreateTime().getTime();
            toMinute = Integer.valueOf(String.valueOf(onlineDate/1000/60));
            //多条数据,要加上上一次记录的在线时长
            if(list.size()>1){
                int notOnlineCount=0;
                for (ManageCustomerOnlineRecordDO m : list){
                    if (m.getStatus()==2 && notOnlineCount<1){
                        notOnlineCount++;
                        lastOnlineTime = m.getTotalOnlineTime();
                    }
                }
            }
            totalOnlineMinute=toMinute+lastOnlineTime;
            totalNotOnlineMinute = Integer.valueOf(String.valueOf(allDateTime/1000/60))-totalOnlineMinute;
        }
        map.put("notOnline",totalNotOnlineMinute);
        map.put("online",totalOnlineMinute);
        map.put("nowOnline",toMinute);
        map.put("firstOnlineTime",firstOnlineTime);
        return map;
    }
    /**
     * 返回总的秒数
     * @param list
@ -1347,11 +1423,14 @@ public class SynergyManageService extends BaseJpaService {
    }
    public Map<String,Object> adminIndex(String userCode){
    public Map<String,Object> adminIndex(){
        List<User> userList = userDao.findByType(4);
        Map<String,Object> map = new HashMap<>();
        String today = DateUtil.dateToStrShort(new Date());
        String startTime=today+" 00:00:00";
        String endTime = today+" 23:59:59";
        String callSql ="SELECT" +
                " r.*" +
                " FROM" +
@ -1359,36 +1438,207 @@ public class SynergyManageService extends BaseJpaService {
                " LEFT JOIN wlyy_user u ON r.user_code = u.`code`" +
                " WHERE" +
                " u.type = 4" +
                " AND r.create_time >= '"+today+" 00:00:00'" +
                " AND r.create_time <= '"+today+" 23:59:59'";
        //--------------今日外呼量-----------------//
        List<CallRecord> waihudList = jdbcTemplate.query(callSql+" and r.type=2",new BeanPropertyRowMapper<>(CallRecord.class));
        //求总时长
        int seconds = totalTaklTime(waihudList);
        //求平均时长
        map.put("waihuAvgTalkTime",getAvgTime(seconds,waihudList.size()));
        map.put("waihuCount",waihudList.size());
                " AND r.create_time >= '"+startTime+"'" +
                " AND r.create_time <= '"+endTime+"'";
        //--------------今日在线时长-----------------//
        String startTime=today+" 00:00:00";
        String endTime = today+" 23:59:59";
        List<ManageCustomerOnlineRecordDO> manageCustomerOnlineRecordDOList = manageCustomerOnlineRecordDao.findByCustomerCodeToday(userCode,startTime,endTime);
        String onLineTime = manageCustomerOnlineRecordDOList.get(0).getTotalOnlineTime();
        for (ManageCustomerOnlineRecordDO customerOnlineRecordDO : manageCustomerOnlineRecordDOList){
        //正在咨询人数
        //当前客服人数
        map.put("onlineNowCount",userList.size());
        //今日会话总量  今日平均会话时长
        List<CallRecord> allCallRecordList = jdbcTemplate.query(callSql+" and r.answer_status=1",new BeanPropertyRowMapper<>(CallRecord.class));
        map.put("allCallCount",allCallRecordList.size());
        if (allCallRecordList.size()>0){
            int totalSeconds = totalTaklTime(allCallRecordList);
            map.put("allAvgTaklTime",getAvgTime(totalSeconds,allCallRecordList.size()));
        }else {
            map.put("allAvgTaklTime",0);
        }
        //--------------今日接入量-----------------//
        List<CallRecord> jieruList = jdbcTemplate.query(callSql+" and r.type=1",new BeanPropertyRowMapper<>(CallRecord.class));
        //求总时长
        int jieruTotalSecond = totalTaklTime(jieruList);
        //求平均时长
        map.put("jieruAvgTalkTime",getAvgTime(jieruTotalSecond,jieruList.size()));
        map.put("jieruCount",jieruList.size());
        //--------------今日协同任务外呼数-----------------//
        //今日外呼量 今日平均会话时长
        List<CallRecord> waihuCallRecordList = jdbcTemplate.query(callSql+" and r.answer_status=1 and r.type=2 ",new BeanPropertyRowMapper<>(CallRecord.class));
        map.put("waihuCallCount",waihuCallRecordList.size());
        if (waihuCallRecordList.size()>0){
            int waihuTotalSeconds = totalTaklTime(waihuCallRecordList);
            map.put("waihuAvgTaklTime",getAvgTime(waihuTotalSeconds,waihuCallRecordList.size()));
        }else {
            map.put("waihuAvgTaklTime",0);
        }
        //--------------今日协同任务外呼数-----------------//
        String wanchenSql="SELECT" +
                " count(*) AS wanchengCount" +
                " FROM" +
                " `manage_synergy_workorder_servicer` s" +
                " LEFT JOIN wlyy_user u ON s.executor_code = u.`code`" +
                " WHERE" +
                " s.executor_type = 2" +
                " AND s.`status` = 3" +
                " AND s.complete_time >= '"+startTime+"'" +
                " AND s.complete_time <= '"+endTime+"'";
        Map<String,Object> wanchenMap = jdbcTemplate.queryForMap(wanchenSql);
        String weiwanchenSql ="SELECT" +
                " COUNT(*) AS weiwanchengCount" +
                " FROM" +
                " `manage_synergy_workorder_servicer` s" +
                "LEFT JOIN wlyy_user u ON s.executor_code = u.`code`" +
                " WHERE" +
                " executor_type = 2" +
                " AND `status`<3";
        Map<String,Object> weiwanchenMap = jdbcTemplate.queryForMap(wanchenSql);
        String fasongSql="SELECT" +
                " COUNT(*) AS fasongCount" +
                " FROM" +
                " (" +
                "  SELECT" +
                "   s.*, w.create_user," +
                "   w.create_user_name" +
                "  FROM" +
                "   manage_synergy_workorder_servicer s" +
                "  LEFT JOIN manage_synergy_workorder w ON s.workorder_code = w.`code`" +
                "  WHERE" +
                "   w.create_user_type = 2" +
                "  AND w.del = 1" +
                "  AND w.create_time >= '"+startTime+"'" +
                "  AND w.create_time <= '"+endTime+"'" +
                " ) a" +
                " LEFT JOIN wlyy_user u ON a.create_user = u.`code`";
        Map<String,Object> fasongMap = jdbcTemplate.queryForMap(fasongSql);
        map.putAll(wanchenMap);
        map.putAll(weiwanchenMap);
        map.putAll(fasongMap);
        return map;
    }
    public Map<String,Object> intervalOnLine(){
        Map<String,Object> map = new HashMap<>();
        String today = DateUtil.dateToStrShort(new Date());
        String startTime=today+" 00:00:00";
        String endTime = today+" 23:59:59";
        String allSql="SELECT " +
                " HOUR (r.create_time) AS HOUR, " +
                " count(*) AS Count " +
                " FROM " +
                " manage_call_record r " +
                " LEFT JOIN wlyy_user u ON r.user_code = u.`code` " +
                " WHERE " +
                " r.create_time BETWEEN '"+startTime+"' " +
                " AND '"+endTime+"' " +
                " AND r.answer_status = 1 " +
                " GROUP BY " +
                " HOUR (r.create_time) " +
                " ORDER BY " +
                " HOUR (r.create_time)";
    List<Map<String,Object>> allList = jdbcTemplate.queryForList(allSql);
    String jieruSql ="SELECT " +
            " HOUR (r.create_time) AS HOUR, " +
            " count(*) AS Count " +
            " FROM " +
            " manage_call_record r " +
            " LEFT JOIN wlyy_user u ON r.user_code = u.`code` " +
            " WHERE " +
            " r.create_time BETWEEN '"+startTime+"' " +
            " AND '"+endTime+"' " +
            " AND r.answer_status = 1 " +
            " AND r.type = 1 " +
            " GROUP BY " +
            " HOUR (r.create_time) " +
            " ORDER BY " +
            " HOUR (r.create_time)";
        List<Map<String,Object>> jieruList = jdbcTemplate.queryForList(allSql);
        map.put("all",allList);
        map.put("jieru",jieruList);
        return  map;
    }
    public List<Map<String,Object>> TodayCustomerActivy(){
        List<Map<String,Object>> resultList =  new ArrayList<>();
        String today = DateUtil.dateToStrShort(new Date());
        String startTime=today+" 00:00:00";
        String endTime = today+" 23:59:59";
        startTime="2017-11-15 00:00:00";
        endTime="2017-11-22 23:59:59";
        String sql="SELECT" +
                " u.`code`,"+
                " u.`name`," +
                " u.`online`," +
                " r.type," +
                " COUNT(*) as num"+
                " FROM" +
                " wlyy_user u" +
                " LEFT JOIN manage_call_record r ON u.`code` = r.user_code" +
                " WHERE" +
                " u.type = 4" +
                " AND r.create_time>='"+startTime+"'" +
                " AND r.create_time<='"+endTime+"'" +
                " AND r.answer_status=1"+
                " GROUP BY" +
                " u.`code`," +
                " r.type";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> toList =  new ArrayList<>();
        for (Map<String,Object> map : list){
            resultList.addAll(toList);
            toList.clear();
            String userCode = String.valueOf(map.get("code"));
            String type = String.valueOf(map.get("type"));
            if (resultList.size()==0){
                Map<String,Object> resultMap = new HashMap<>();
                resultMap.put("userCode",userCode);
                resultMap.put("userName",map.get("name"));
                resultMap.put("online",map.get("online"));
                if ("1".equals(type)){
                    resultMap.put("jieruCount",map.get("num"));
                    resultMap.put("waihuCount",0);
                }
                if ("2".equals(type)){
                    resultMap.put("jieruCount",0);
                    resultMap.put("waihuCount",map.get("num"));
                }
                toList.add(resultMap);
            }else {
                int count =0;
                for (Map<String,Object> map1 : resultList){
                    count++;
                    if(userCode.equals(String.valueOf(map1.get("userCode")))){
                        if ("1".equals(type)){
                            map1.put("jieruCount",map.get("num"));
                        }
                        if ("2".equals(type)){
                            map1.put("waihuCount",map.get("num"));
                        }
                    }
                    if (count==resultList.size() && !userCode.equals(String.valueOf(map1.get("userCode")))){
                        Map<String,Object> resultMap = new HashMap<>();
                        resultMap.put("userCode",userCode);
                        resultMap.put("userName",map.get("name"));
                        resultMap.put("online",map.get("online"));
                        if ("1".equals(type)){
                            resultMap.put("jieruCount",map.get("num"));
                            resultMap.put("waihuCount",0);
                        }
                        if ("2".equals(type)){
                            resultMap.put("jieruCount",0);
                            resultMap.put("waihuCount",map.get("num"));
                        }
                        toList.add(resultMap);
                    }
                }
            }
        }
        for (Map<String,Object> reMap : resultList){
            String userCode = String.valueOf(reMap.get("userCode"));
            List<ManageCustomerOnlineRecordDO> manageCustomerOnlineRecordDOList = manageCustomerOnlineRecordDao.findByCustomerCodeToday(userCode,startTime,endTime);
            //如果最新一条是离线则直接获取总在线时长就是在线时间,
            // 如果最新一条是在线,则用当前时间减去上一条登录时间加上之前的在线时长为总的在线时长
            Map<String,Object> lineMap = getOnlineAndNotOnlineAndNowOnline(manageCustomerOnlineRecordDOList);
            reMap.putAll(lineMap);
        }
        return resultList;
    }
}

+ 7 - 3
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/JMController.java

@ -43,9 +43,13 @@ public class JMController {
	{
		try {
			
			String data = jmService.GetChildrenInfo(barCode);
			
			return Result.success("获取儿童信息成功!",data);
			String data = jmService.findChildren(barCode);
			JSONObject jsonObject = new JSONObject(data);
			if (jsonObject.getInt("msgCode")==800){
				return Result.success("获取儿童信息成功!",data);
			}else{
				return Result.error(jsonObject.getString("msg"));
			}
		} catch (Exception ex) {
			ex.printStackTrace();
			return Result.error(ex.getMessage());

+ 9 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/JMService.java

@ -551,4 +551,13 @@ public class JMService {
        token = redisTemplate.opsForValue().get(redis_key).toString();
        return token;
    }
    public String findChildren(String credential)throws Exception  {
        Map<String,String> params = new HashMap<>();
        params.put("act", FIND_CHILDREN);
        params.put("accId", accId);
        params.put("token_ylz", getTokenCheck());
        params.put("etmykh", credential);
        return ylzImmGetSecond(FIND_CHILDREN,"计免预约-获取儿童信息成功",params);
    }
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/imm/ChildFamilyImmuneService.java

@ -136,7 +136,7 @@ public class ChildFamilyImmuneService extends BaseService {
		String sql = "select DISTINCT t.*,m.child_name,m.birthday,m.childCode from wlyy_child_immune_vaccin t " +
				" inner join ( " +
				" select a.*,b.name as family_name ,c.name as child_name,c.barcode as barcode ,c.birthday as birthday,c.`code` AS childCode from  wlyy_child_family_immune a " +
				" inner join (select patient,name from wlyy_sign_family where type in (1,2) and `status` = 1 and expenses_status = 1 and doctor = '"+doctorcode+"') b " +
				" inner join (select patient,name from wlyy_sign_family where type in (1,2) and `status` = 1 and expenses_status = 1 and doctor = '"+doctorcode+"' or doctor_health='"+doctorcode+"') b " +
				" on a.family_code = b.patient " +
				" left join wlyy_child_info c on c.`code` = a.child_code " +
				") m on m.barcode = t.barcode ";

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/imm/ChildInfoService.java

@ -54,7 +54,7 @@ public class ChildInfoService extends BaseService {
				childInfo.setCreate_time(new Date());
				childInfo.setBarcode(barCode);
			}else{
				throw new Exception("获取新生儿信息失败!");
				throw new Exception(rejson.getString("msg"));
			}
		}
		

+ 2 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/survey/ManagerQuestionnaireService.java

@ -769,6 +769,7 @@ public class ManagerQuestionnaireService extends BaseService {
                opt.put("sort", st);
                opt.put("haveComment", haveComment);
                opt.put("isRequired", required);
                opt.put("optionCode", option.getCode());
                optList.add(opt);
            }
@ -776,6 +777,7 @@ public class ManagerQuestionnaireService extends BaseService {
            question.put("type", type);
            question.put("isRequired", isRequired);
            question.put("sort", sort);
            question.put("qstCode", qstcode);
            question.put("options", optList);
            questions.add(question);
        }

+ 0 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/guahao/ImmuneService.java

@ -50,7 +50,6 @@ public class ImmuneService {
		String url = jwUrl + "/third/jm/imm/GetChildrenInfo";
		List<NameValuePair> params = new ArrayList<>();
		params.add(new BasicNameValuePair("barCode", barcode));
		
		String response = httpClientUtil.post(url, params, "UTF-8");
		
		return response;