Sfoglia il codice sorgente

Merge branch 'dev' of humingfen/patient-co-management into dev

huangwenjie 7 anni fa
parent
commit
d8cfc4af5f
16 ha cambiato i file con 311 aggiunte e 14 eliminazioni
  1. 0 4
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/customer/QuestionnaireController.java
  2. 0 4
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/customer/ScreenResultController.java
  3. 4 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/customer/CustomerQuestionnaireController.java
  4. 4 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/customer/ScreenResultController.java
  5. 53 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/doctor/DoctorQuestionnaireController.java
  6. 7 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/synergy/ManageSynergyWorkOrderDao.java
  7. 7 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/synergy/ManageSynergyWorkorderServicerDao.java
  8. 69 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/QuestionnaireManagerService.java
  9. 3 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/SynergyManageService.java
  10. 1 1
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/device/device_create_js.jsp
  11. 1 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/jimeiJkEdu/JMJkEduArticleService.java
  12. 114 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/survey/ManagerQuestionnaireService.java
  13. 15 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/survey/DoctorSurveyScreenResultController.java
  14. 27 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/survey/ManagerQuestionnaireController.java
  15. 3 0
      patient-co/patient-co-wlyy/src/main/resources/application-devtest.yml
  16. 3 1
      patient-co/patient-co-wlyy/src/main/resources/application-prod.yml

+ 0 - 4
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/customer/QuestionnaireController.java

@ -1,4 +0,0 @@
package com.yihu.wlyy.controller.common.customer;
public class QuestionnaireController {
}

+ 0 - 4
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/customer/ScreenResultController.java

@ -1,4 +0,0 @@
package com.yihu.wlyy.controller.common.customer;
public class ScreenResultController {
}

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

@ -0,0 +1,4 @@
package com.yihu.wlyy.controller.synergy.customer;
public class CustomerQuestionnaireController {
}

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

@ -0,0 +1,4 @@
package com.yihu.wlyy.controller.synergy.customer;
public class ScreenResultController {
}

+ 53 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/doctor/DoctorQuestionnaireController.java

@ -0,0 +1,53 @@
package com.yihu.wlyy.controller.synergy.doctor;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderDO;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderServicerDO;
import com.yihu.wlyy.service.synergy.QuestionnaireManagerService;
import com.yihu.wlyy.service.synergy.SynergyManageService;
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.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
 * 管理端问卷调查
 * Created by humingfen on 2018/9/27.
 */
@Controller
@RequestMapping(value = "/doctor")
@Api(description = "医生端-派发协同服务")
public class DoctorQuestionnaireController extends BaseController {
    @Autowired
    ObjectMapper objectMapper;
    @Autowired
    private QuestionnaireManagerService questionnaireService;
    @Autowired
    private SynergyManageService synergyManageService;
    @RequestMapping(value = "/createWorkOrder", method = {RequestMethod.GET, RequestMethod.POST})
    @ApiOperation(value = "派发协同服务")
    public String addCallRecord(@ApiParam(name="jsonData",value="协同服务json字符串")
                                    @RequestParam(required = true)String jsonData,
                                @ApiParam(name="patientInfo",value="居民信息json字符串")
                                    @RequestParam(required = true)String patientInfo){
        try {
            ManageSynergyWorkorderDO manageSynergyWorkorderDO = objectMapper.readValue(jsonData, ManageSynergyWorkorderDO.class);
            List<ManageSynergyWorkorderServicerDO>  manageSynergyWorkorderServicerDOS = objectMapper.readValue(patientInfo, new TypeReference<List<ManageSynergyWorkorderServicerDO>>(){});
            return write(200,"保存成功","data",questionnaireService.createWorkOrder(manageSynergyWorkorderDO, manageSynergyWorkorderServicerDOS));
        }catch (Exception e){
            error(e);
            return error(-1,"保存失败");
        }
    }
}

+ 7 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/synergy/ManageSynergyWorkOrderDao.java

@ -0,0 +1,7 @@
package com.yihu.wlyy.repository.synergy;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderDO;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface ManageSynergyWorkOrderDao extends PagingAndSortingRepository<ManageSynergyWorkorderDO, Long> {
}

+ 7 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/synergy/ManageSynergyWorkorderServicerDao.java

@ -0,0 +1,7 @@
package com.yihu.wlyy.repository.synergy;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderServicerDO;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface ManageSynergyWorkorderServicerDao extends PagingAndSortingRepository<ManageSynergyWorkorderServicerDO, Long> {
}

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

@ -0,0 +1,69 @@
package com.yihu.wlyy.service.synergy;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderDO;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderServicerDO;
import com.yihu.wlyy.repository.synergy.ManageSynergyWorkOrderDao;
import com.yihu.wlyy.repository.synergy.ManageSynergyWorkorderServicerDao;
import com.yihu.wlyy.util.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
 * Created by humingfen on 2018/09/27.
 */
@Service
public class QuestionnaireManagerService extends BaseJpaService {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private ManageSynergyWorkOrderDao workOrderDao;
    @Autowired
    private ManageSynergyWorkorderServicerDao workorderServicerDao;
    /**
     * 创建协同服务
     * @param workorderDO
     * @param workorderServicerDOS
     * @return
     */
    public boolean createWorkOrder(ManageSynergyWorkorderDO workorderDO, List<ManageSynergyWorkorderServicerDO> workorderServicerDOS) {
        String servicer = null;
        int size = workorderServicerDOS.size();
        int len = 0;
        if(size > 5){
            len = 5;
        }else {
            len = size;
        }
        //获取服务对象最多五个人
        for(int i = 0; i < len; i++){
            servicer += workorderServicerDOS.get(i).getServicePatientName() + ",";
        }
        servicer = servicer.substring(0, servicer.length()-1);
        //保存协同服务工单
        workorderDO.setCode(getCode());
        workorderDO.setStatus(1);
        workorderDO.setCreateTime(new Date());
        workorderDO.setDel(1);
        workorderDO.setServicerCount(size);
        workorderDO.setServicerKey(servicer);
        workOrderDao.save(workorderDO);
        //保存协同服务工单的服务对象
        for(ManageSynergyWorkorderServicerDO servicerDO : workorderServicerDOS){
            servicerDO.setCode(getCode());
            servicerDO.setWorkorderType(workorderDO.getType());
            servicerDO.setWorkorderCode(workorderDO.getCode());
            servicerDO.setStatus(1);
            servicerDO.setCreateTime(new Date());
            workorderServicerDao.save(servicerDO);
        }
        return true;
    }
}

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

@ -1,7 +1,10 @@
package com.yihu.wlyy.service.synergy;
import org.springframework.stereotype.Service;
/**
 * Created by 刘文彬 on 2018/9/27.
 */
@Service
public class SynergyManageService {
}

+ 1 - 1
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/device/device_create_js.jsp

@ -117,7 +117,7 @@
						//厂家代码
						values.manufacturerId = $("#sel_manufacturer").ligerComboBox("getValue");
						values.deviceModel = $("#inp_deviceModel").ligerComboBox("getValue");
						if (!validator.validate()) {
							return;
						}

+ 1 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/jimeiJkEdu/JMJkEduArticleService.java

@ -41,7 +41,6 @@ import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.annotation.Transient;
import org.springframework.data.domain.PageRequest;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
@ -516,7 +515,7 @@ public class JMJkEduArticleService extends BaseService {
        //全选的时候前端传0,后台要去数据库再查询一次
        String tableSql = " select p.code from wlyy_sign_family w ,wlyy_admin_team t, dm_hospital h  ";
        String whereSql = " where w.status>0  and w.admin_team_code=t.id and t.org_code=h.code ";
        String whereSql = " where w.status>0 and w.expenses_status=1 and w.admin_team_code=t.id and t.org_code=h.code ";
        //通过登录的角色区域权限 限制所属患者条件
@ -594,7 +593,6 @@ public class JMJkEduArticleService extends BaseService {
            }
            groupPatient = jdbcTemplate.queryForList(sql, String.class);
        }else{
            groupPatient = jdbcTemplate.queryForList(tableSql + whereSql, String.class);
        }
        patientSet.addAll(groupPatient);

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

@ -11,9 +11,13 @@ import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.wechat.WechatTemplateConfigDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.survey.SurveyScreenResultService;
import com.yihu.wlyy.service.common.account.DoctorService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.http.HttpResponse;
import com.yihu.wlyy.util.http.HttpUtils;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONException;
@ -21,6 +25,7 @@ import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
@ -39,6 +44,9 @@ import java.util.*;
@Transactional
public class ManagerQuestionnaireService extends BaseService {
    @Value("${customerService.url}")
    private String customerUrl;
    @Autowired
    private SurveyDao surveyDao;
    @Autowired
@ -89,6 +97,8 @@ public class ManagerQuestionnaireService extends BaseService {
    private WechatTemplateConfigDao templateConfigDao;
    @Autowired
    private SurveyScreenResultService surveyScreenResultService;
    @Autowired
    private DoctorService doctorService;
    private Logger logger = LoggerFactory.getLogger(this.getClass());
@ -1809,4 +1819,108 @@ public class ManagerQuestionnaireService extends BaseService {
        //更改调查对象表答题状态为已答
        //surveyUserDao.modifyStatus(surveyCode, patient);
    }
    //查询出推送居民
    public List<Map<String, Object>> initPatient(String labelUnitType, String labelSexType, String labelServerType, String labelDiseaseType, String labelHealthType, String currentUserRole, String currentUserRoleLevel) {
        String tableSql = " select p.code as service_patient_code ,w.`name` as service_patient_name,w.ssc,w.idcard,w.mobile,w.hospital,w.hospital_name,h.town,h.town_name from wlyy_sign_family w ,wlyy_admin_team t, dm_hospital h  ";
        String whereSql = " where w.status>0 and w.expenses_status=1 and w.admin_team_code=t.id and t.org_code=h.code ";
        //通过登录的角色区域权限 限制所属患者条件
        if (StringUtils.isNotBlank(labelUnitType)) {
            switch (currentUserRoleLevel) {
                case "1": {
                    whereSql += " and h.city in (" + labelUnitType + ")";
                    break;
                }
                case "2": {
                    whereSql += " and h.town in (" + labelUnitType + ")";
                    break;
                }
                case "3": {
                    whereSql += " and h.code in (" + labelUnitType + ")";
                    break;
                }
            }
        } else {
            switch (currentUserRoleLevel) {
                case "1": {
                    whereSql += " and h.province = '" + currentUserRole + "'";
                    break;
                }
                case "2": {
                    whereSql += " and h.city = '" + currentUserRole + "'";
                    break;
                }
                case "3": {
                    whereSql += " and h.town = '" + currentUserRole + "'";
                    break;
                }
                case "4": {
                    whereSql += " and h.code = '" + currentUserRole + "'";
                    break;
                }
            }
        }
        if (StringUtils.isNotBlank(labelServerType)) {
            tableSql += " , wlyy_sign_family_server s   ";
            whereSql += " and s.server_type in (" + labelServerType + " ) and w.code= s.sign_code";
        }
        tableSql += " , wlyy_patient p  ";
        whereSql += " and p.code=w.patient AND p.openid IS NOT NULL and p.openid <>'' ";
        if (StringUtils.isNotBlank(labelSexType)) {
            whereSql += " and p.sex in (" + labelSexType + ") ";
        }
        List<Map<String, Object>> groupPatient = null;
        if (StringUtils.isNotBlank(labelHealthType) || StringUtils.isNotBlank(labelDiseaseType)) {
            String sql = "SELECT DISTINCT s.patient as service_patient_code, f.`name` as service_patient_name, f.ssc,f.idcard,f.mobile,f.hospital,f.hospital_name,h.town,h.town_name  FROM ( SELECT t.patient," +
                    " GROUP_CONCAT(',',t.label_type,t.label,',') label FROM " +
                    " wlyy_sign_patient_label_info t WHERE t.patient IN (" +
                    tableSql + whereSql + ") AND t. STATUS = 1 GROUP BY t.patient ) s LEFT JOIN wlyy_sign_family f on s.patient=f.patient LEFT JOIN dm_hospital h on f.hospital=h.`code` where 1=1 ";
            if (StringUtils.isNotBlank(labelHealthType)) {
                String[] aa = labelHealthType.split(",");
                String bb = "";
                for (String a : aa) {
                    bb += " OR s.label LIKE '%,2" + a + ",%'";
                }
                sql += " AND ( " + bb.substring(3) + " )";
            }
            if (StringUtils.isNotBlank(labelDiseaseType)) {
                String[] aa = labelDiseaseType.split(",");
                String bb = "";
                for (String a : aa) {
                    bb += " OR s.label LIKE '%,3" + a + ",%'";
                }
                sql += " AND ( " + bb.substring(3) + " )";
            }
            sql += "and f.status>0 and f.expenses_status=1";
            groupPatient = jdbcTemplate.queryForList(sql);
        } else {
            groupPatient = jdbcTemplate.queryForList(tableSql + whereSql);
        }
        return groupPatient;
    }
    /**
     * 调用集美客服派发问卷协同服务接口
     * @param jsonData
     * @param patientInfo
     * @param doctor
     * @return
     * @throws Exception
     */
    public String createWorkOrder(String jsonData, List<Map<String, Object>> patientInfo, String doctor) throws Exception{
        JSONObject object = new JSONObject(jsonData);
        Doctor d = doctorService.findDoctorByCode(doctor);
        object.put("createUser", d.getCode());
        object.put("createUserName", d.getName());
        object.put("createUserType", 1);
        Map<String, Object> param = new HashedMap();
        param.put("patientInfo", patientInfo.toString());
        param.put("jsonData", object.toString());
        HttpResponse response = null;
        response = HttpUtils.doPost(customerUrl + "wlyy-manage/createWorkOrder", param);
        JSONObject rs = new JSONObject(response.getContent());
        return rs.getString("message");
    }
}

+ 15 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/survey/DoctorSurveyScreenResultController.java

@ -6,7 +6,6 @@ import com.yihu.wlyy.repository.specialist.SpecialDiseaseDao;
import com.yihu.wlyy.repository.wechat.WechatTemplateConfigDao;
import com.yihu.wlyy.service.app.survey.SurveyScreenResultService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.web.WeixinBaseController;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
@ -227,4 +226,19 @@ public class DoctorSurveyScreenResultController extends WeixinBaseController {
        }
    }
    /*@RequestMapping(value = "/createWorkOrder",method = RequestMethod.POST)
    @ApiOperation(value = "创建协同服务")
    public String getAllQuestions(@ApiParam(name = "jsonData",value = "协同服务json字符串")
                                  @RequestParam(value = "jsonData",required = true)String jsonData,
                                  @ApiParam(value = "筛选条件",defaultValue = "{\"sex\":1,\"disease\":[2,5,6],\"healthCondition\":[0],\"service\":[1,3]}")
                                  @RequestParam(value = "conditionJson",required = true) String conditionJson){
        try {
            surveyScreenResultService.findPatientInfo(conditionJson);
            JSONObject jsonObject = managerQuestionnaireService.getAllQuestions(surveyTemplateCode);
            return write(200, "查询成功!", "data", jsonObject);
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "查询失败!");
        }
    }*/
}

+ 27 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/survey/ManagerQuestionnaireController.java

@ -586,4 +586,31 @@ public class ManagerQuestionnaireController extends WeixinBaseController {
        }
    }
    @RequestMapping(value = "/createWorkOrder",method = RequestMethod.POST)
    @ApiOperation(value = "创建协同服务")
    public String getAllQuestions(@ApiParam(name = "jsonData",value = "协同服务json字符串")
                                      @RequestParam(value = "jsonData",required = true)String jsonData,
                                  @ApiParam(name = "labelUnitType", value = "标签类型  1:下属单位,多个用逗号分隔", required = false)
                                      @RequestParam(value = "labelUnitType", required = false, defaultValue = "") String labelUnitType,
                                  @ApiParam(name = "labelSexType", value = "标签类型  2:性别,多个用逗号分隔", required = false)
                                      @RequestParam(value = "labelSexType", required = false, defaultValue = "") String labelSexType,
                                  @ApiParam(name = "labelServerType", value = "标签类型  3:服务类型,多个用逗号分隔", required = false)
                                      @RequestParam(value = "labelServerType", required = false, defaultValue = "") String labelServerType,
                                  @ApiParam(name = "labelDiseaseType", value = "标签类型  4:疾病类型,多个用逗号分隔", required = false)
                                      @RequestParam(value = "labelDiseaseType", required = false, defaultValue = "") String labelDiseaseType,
                                  @ApiParam(name = "labelHealthType", value = "标签类型  5:健康情况,多个用逗号分隔", required = false)
                                      @RequestParam(value = "labelHealthType", required = false, defaultValue = "") String labelHealthType,
                                  @ApiParam(name = "currentUserRole", value = "当前登录的角色code", required = false)
                                      @RequestParam(value = "currentUserRole", required = false) String currentUserRole,
                                  @ApiParam(name = "currentUserRoleLevel", value = "当前登录的角色级别", required = false)
                                      @RequestParam(value = "currentUserRoleLevel", required = false) String currentUserRoleLevel) {
        try {
            List<Map<String, Object>> patientInfo = managerQuestionnaireService.initPatient(labelUnitType, labelSexType, labelServerType, labelDiseaseType, labelHealthType, currentUserRole, currentUserRoleLevel);
            return write(200, "查询成功!", "data", managerQuestionnaireService.createWorkOrder(jsonData, patientInfo, getUID()));
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "查询失败!");
        }
    }
}

+ 3 - 0
patient-co/patient-co-wlyy/src/main/resources/application-devtest.yml

@ -50,6 +50,9 @@ healthBank:
#康复计划配置
rehabilitation:
  url: http://localhost:10055/svr-wlyy-rehabilitation/
#集美客服配置
customerService:
  url: http://172.19.103.72:8080/customer-service/
#小程序
applets:

+ 3 - 1
patient-co/patient-co-wlyy/src/main/resources/application-prod.yml

@ -47,7 +47,9 @@ healthBank:
#康复计划配置
rehabilitation:
  url: http://localhost:10055/svr-rehabilitation/
#集美客服配置
customerService:
  url: http://172.19.103.72:8080/customer-service/
#小程序
applets:
  appId: wx0e663ce069b5170c