فهرست منبع

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

huangwenjie 6 سال پیش
والد
کامیت
ee6b284c2c
46فایلهای تغییر یافته به همراه2002 افزوده شده و 214 حذف شده
  1. 39 15
      common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/survey/SurveyQuestionResult.java
  2. 146 8
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/customer/CustomerSynergyManageController.java
  3. 4 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/Patient.java
  4. 42 20
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/survey/SurveyQuestionResult.java
  5. 66 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/synergy/ManageSynergyAccessoryDO.java
  6. 2 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/UserDao.java
  7. 9 5
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/survey/SurveyTemplateDao.java
  8. 0 2
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/synergy/ManageCustomerOnlineRecordDao.java
  9. 17 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/synergy/ManageSynergyAccessoryDao.java
  10. 4 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/synergy/ManageSynergyWorkorderServicerDao.java
  11. 26 6
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/patient/AdminPatientService.java
  12. 17 12
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/QuestionnaireManageService.java
  13. 4 4
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/ScreenResultManageService.java
  14. 372 83
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/SynergyManageService.java
  15. 1 1
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/SynergyWorkorderServicerLogService.java
  16. 174 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/util/ISqlUtils.java
  17. 41 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/util/http/HttpResponse.java
  18. 449 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/util/http/HttpUtils.java
  19. 54 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/util/http/IPInfoUtils.java
  20. 2 0
      patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/common/dao/PatientHealthIndexDao.java
  21. 0 10
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/JMController.java
  22. 9 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/event/ApplicationEvent.java
  23. 28 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/AlertChildImmuneVaccinJob.java
  24. 170 3
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/imm/ChildVaccinImmuneService.java
  25. 2 0
      patient-co/patient-co-wlyy-job/src/main/resources/application-dev.yml
  26. 2 0
      patient-co/patient-co-wlyy-job/src/main/resources/application-devtest.yml
  27. 2 0
      patient-co/patient-co-wlyy-job/src/main/resources/application-test.yml
  28. 3 0
      patient-co/patient-co-wlyy-job/src/main/resources/system.properties
  29. 3 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/health/repository/DevicePatientHealthIndexDao.java
  30. 4 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/imm/ChildImmuneVaccinDao.java
  31. 2 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/message/MessageService.java
  32. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/imm/ChildFamilyImmuneService.java
  33. 4 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/specialist/SpecialistEvaluateSevice.java
  34. 7 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/survey/ManagerQuestionnaireService.java
  35. 13 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/synergy/SynergyManageService.java
  36. 6 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jkEduArticle/ThirdJkEduArticleService.java
  37. 26 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/ZyDictService.java
  38. 14 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/CommonUtil.java
  39. 18 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/fastdfs/FastDFSUtil.java
  40. 21 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/FileUploadController.java
  41. 2 14
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/imm/DoctorImmController.java
  42. 37 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/jimeiJkEdu/DoctorJMJkEduArticleController.java
  43. 152 9
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/synergy/SynergyManagerController.java
  44. 1 1
      patient-co/patient-co-wlyy/src/main/resources/application-devtest.yml
  45. 3 1
      patient-co/patient-co-wlyy/src/main/resources/application-prod.yml
  46. 3 1
      patient-co/patient-co-wlyy/src/main/resources/application-test.yml

+ 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")

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

@ -5,6 +5,7 @@ import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.User;
import com.yihu.wlyy.entity.call.CallRecord;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderServicerLogDO;
import com.yihu.wlyy.entity.synergy.ManageSynergyAccessoryDO;
import com.yihu.wlyy.repository.call.CallRecordDao;
import com.yihu.wlyy.service.manager.user.UserService;
import com.yihu.wlyy.service.synergy.SynergyManageService;
@ -13,11 +14,13 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
@ -82,6 +85,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(
@ -293,13 +309,13 @@ public class CustomerSynergyManageController extends BaseController {
    @ApiOperation(value = "协同任务提交")
    public String taskSubmit(@ApiParam(name="workorderCode",value="协同服务工单code",required = true)
                             @RequestParam(required = true)String workorderCode,
                             @ApiParam(name="dealResultRemark",value="说明",required = true)
                             @RequestParam(required = true)String dealResultRemark,
                             @ApiParam(name="dealResultAccessory",value="附件路径(多个用逗号隔开)",required = true)
                             @RequestParam(required = true)String dealResultAccessory){
                             @ApiParam(name="dealResultRemark",value="说明",required = false)
                             @RequestParam(required = false)String dealResultRemark,
                             @ApiParam(name="accessoryJson",value="附件的json",required = true)
                             @RequestParam(required = true)String accessoryJson){
        try{
            synergyManageService.taskSubmit(workorderCode,dealResultRemark,dealResultAccessory);
            synergyManageService.taskSubmit(workorderCode,dealResultRemark,accessoryJson);
            return write(200,"提交成功");
        }catch (Exception e){
            error(e);
@ -335,6 +351,75 @@ public class CustomerSynergyManageController extends BaseController {
    }
    @ApiOperation("查询体征数据")
    @RequestMapping(value = "/findByPatient", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
    @ResponseBody
    public String findByPatient(@ApiParam(name="patient",value="随访记录ID",defaultValue = "")
                                @RequestParam(value="patient",required = true) String patient)
    {
        try {
            return write(200, "查询成功","data",synergyManageService.findByPatient(patient));
        } catch (Exception e) {
            return invalidUserException(e, -1, "查询失败"+e.getMessage());
        }
    }
    @ApiOperation("获取随访数据")
    @RequestMapping(value = "/getFollowupProjectData", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    @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 {
            return write(200, "获取随访项目数据成功!", "data", synergyManageService.getFollowupProjectData(id,followupProject));
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取随访项目数据失败!" + e.getMessage());
        }
    }
    /**
     * 药品列表
     * @param name
     * @param isinsulin
     * @return
     */
    @RequestMapping(value = "/findDictByName", method = RequestMethod.GET)
    @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,
                                 @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",synergyManageService.findDictByName(name,isinsulin,doctor));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
    @ApiOperation("保存面访用药数据")
    @RequestMapping(value = "/saveFollowupDrugs", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
    @ResponseBody
    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 {
            synergyManageService.saveFollowupDrugs(id,drugsData);
            return write(200, "保存面访用药数据成功!");
        } catch (Exception e) {
            return invalidUserException(e, -1, "保存面访用药数据失败!"+e.getMessage());
        }
    }
    @ApiOperation("新增临时随访记录(返回ID)")
    @RequestMapping(value = "/addFollowup", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
@ -366,10 +451,12 @@ public class CustomerSynergyManageController extends BaseController {
    @ApiOperation("保存随访项目数据")
    @RequestMapping(value = "/saveFollowupProjectData", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
    @ResponseBody
    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 {
            synergyManageService.saveFollowupProjectData(followup);
            synergyManageService.saveFollowupProjectData(id,followup);
            return write(200, "保存随访项目数据成功!");
        } catch (Exception e) {
            error(e);
@ -488,7 +575,7 @@ public class CustomerSynergyManageController extends BaseController {
    }
    @RequestMapping(value = "TodayCustomerActivy",method = RequestMethod.GET)
    @ApiOperation(value = "管理员首页-客服今日活动.")
    @ApiOperation(value = "管理员首页-客服今日活动")
    public String TodayCustomerActivy(){
        try{
            return write(200,"获取成功!","data",synergyManageService.TodayCustomerActivy());
@ -497,5 +584,56 @@ public class CustomerSynergyManageController extends BaseController {
            return write(-1,"获取失败!");
        }
    }
    @RequestMapping(value = "uploadAccessory",method = RequestMethod.POST)
    @ApiOperation(value = "上传附件")
    public String uploadAccessory(HttpServletRequest request){
        try{
            Map<String,Object> map = synergyManageService.uploadAccessory(request);
            return write(200,"获取成功!","data",map);
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"获取失败!");
        }
    }
    @RequestMapping(value = "accessoryList",method = RequestMethod.GET)
    @ApiOperation(value = "获取附件")
    public String accessoryList(@ApiParam(name="workorderCode",value="协同服务code",required = true)
                                 @RequestParam(required = true)String workorderCode){
        try{
            List<ManageSynergyAccessoryDO> resultList = synergyManageService.accessoryList(workorderCode);
            return write(200,"获取成功!","date",resultList);
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"获取失败!");
        }
    }
    @RequestMapping(value = "deleteFile",method = RequestMethod.POST)
    @ApiOperation(value = "删除附件")
    public String deleteFile(@ApiParam(name="storagePath",value="文件的全部路径 如:group1/M00/00/00/wKgRsVjtwpSAXGwkAAAweEAzRjw471.jpg",required = true)
                             @RequestParam(required = true)String storagePath){
        try{
            synergyManageService.deleteFile(storagePath);
            return write(200,"删除成功!");
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"删除失败!");
        }
    }
    @RequestMapping(value = "getArticalById",method = RequestMethod.GET)
    @ApiOperation(value = "获取健康文章详情")
    public String getArticalById(@ApiParam(name="articalId",value="文章id",required = true)
                             @RequestParam(required = true)String articalId){
        try{
            JSONObject jsonObject = synergyManageService.getArticalById(articalId);
            return write(200,"获取成功!","data",jsonObject);
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"获取失败!");
        }
    }
}

+ 4 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/Patient.java

@ -28,23 +28,27 @@ public class Patient extends IdEntity implements Serializable {
    // 业务主键
    private String code;
    // 身份证号
    @Column(name = "idcard")
    private String idcard;
    // 登录密码
    private String password;
    private String salt;
    // 姓名
    @Column(name = "name")
    private String name;
    // 生日
    private Date birthday;
    // 性別,1男,2女
    private Integer sex;
    // 手機號
    @Column(name = "mobile")
    private String mobile;
    // (基卫)手機號
    private String mobileRemarks;
    // 聯繫電話
    private String phone;
    // 社保卡號
    @Column(name = "ssc")
    private String ssc;
    // 頭像HTTP地址
    private String photo;

+ 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;
    }
}

+ 66 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/synergy/ManageSynergyAccessoryDO.java

@ -0,0 +1,66 @@
package com.yihu.wlyy.entity.synergy;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by 刘文彬 on 2018/10/14.
 * 工单上传附件
 */
@Entity
@Table(name = "manage_synergy_accessory")
public class ManageSynergyAccessoryDO extends IdEntity {
    private String code;
    private String name;//文件名
    private String url;//文件存储路径
    private String workorderCode;//工单的code
    private Integer del;//逻辑删除(0、有效,1、删除)
    @Column(name = "code")
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "url")
    public String getUrl() {
        return url;
    }
    public void setUrl(String url) {
        this.url = url;
    }
    @Column(name = "workorder_code")
    public String getWorkorderCode() {
        return workorderCode;
    }
    public void setWorkorderCode(String workorderCode) {
        this.workorderCode = workorderCode;
    }
    @Column(name = "del")
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
}

+ 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();
}

+ 9 - 5
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/survey/SurveyTemplateDao.java

@ -10,9 +10,13 @@ import org.springframework.data.repository.PagingAndSortingRepository;
 * Created by yeshijie on 2017/3/7.
 */
public interface SurveyTemplateDao extends PagingAndSortingRepository<SurveyTemplate,Long>,JpaSpecificationExecutor<SurveyTemplate> {
        @Query("from SurveyTemplate where title=?1 and del = 1")
        SurveyTemplate findByTitle(String title);
        @Query("update SurveyTemplate set del = 0 where id=?1 and del = 1")
        @Modifying
        void deleteById(Long id);
    @Query("from SurveyTemplate where title=?1 and del = 1")
    SurveyTemplate findByTitle(String title);
    @Query("update SurveyTemplate set del = 0 where id=?1 and del = 1")
    @Modifying
    void deleteById(Long id);
    @Query("select t.diseaseType from SurveyTemplate t where t.code = ?1")
    String findByCode(String code);
}

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

@ -11,6 +11,4 @@ import java.util.List;
 */
public interface ManageCustomerOnlineRecordDao extends PagingAndSortingRepository<ManageCustomerOnlineRecordDO, Long> {
    @Query("select r from ManageCustomerOnlineRecordDO r where r.customerCode=?1 and r.createTime>=?2 and r.createTime<=?3 order by r.createTime")
    List<ManageCustomerOnlineRecordDO> findByCustomerCodeToday(String userCode,String startTime,String endTime);
}

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

@ -0,0 +1,17 @@
package com.yihu.wlyy.repository.synergy;
import com.yihu.wlyy.entity.synergy.ManageCustomerOnlineRecordDO;
import com.yihu.wlyy.entity.synergy.ManageSynergyAccessoryDO;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by 刘文彬 on 2018/10/14.
 */
public interface ManageSynergyAccessoryDao extends PagingAndSortingRepository<ManageSynergyAccessoryDO, Long> {
    @Query("select a from ManageSynergyAccessoryDO a where a.workorderCode=?1 and a.del=0")
    List<ManageSynergyAccessoryDO> findByWorkorderCode(String workorderCode);
}

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

@ -21,6 +21,10 @@ public interface ManageSynergyWorkorderServicerDao extends PagingAndSortingRepos
    @Query("select s from ManageSynergyWorkorderServicerDO s where s.workorderCode = ?1 and s.servicePatientCode = ?2 and s.status = 3")
    ManageSynergyWorkorderServicerDO findByWorkOrderCodeAndPatientCode(String workorderCode, String patient);
    //根据工单code和居民code获取未完成的服务对象信息
    @Query("select s from ManageSynergyWorkorderServicerDO s where s.workorderCode = ?1 and s.servicePatientCode = ?2")
    ManageSynergyWorkorderServicerDO findByWorkOrderCodeAndPatientCode1(String workorderCode, String patient);
    @Query("select count(1) from ManageSynergyWorkorderServicerDO s where s.workorderCode=?1 and s.executorCode=?2 and s.status=?3")
    Integer countByWorkorderCodeAndExecutorCodeAndStatus(String workorderCode,String executorCode,Integer status);

+ 26 - 6
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/patient/AdminPatientService.java

@ -6,18 +6,23 @@ import com.yihu.wlyy.entity.SocialSecurityInfo;
import com.yihu.wlyy.repository.PatientDao;
import com.yihu.wlyy.repository.SignFamilyDao;
import com.yihu.wlyy.repository.SocialSecurityInfoDao;
import com.yihu.wlyy.util.ISqlUtils;
import com.yihu.wlyy.util.MD5;
import com.yihu.wlyy.util.query.BaseJpaService;
import org.hibernate.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
/**
 * Created by yww on 2016/10/8.
@ -31,10 +36,25 @@ public class AdminPatientService extends BaseJpaService<Patient,Long> {
    @Autowired
    private SocialSecurityInfoDao socialSecurityInfoDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    public Page<Patient> searchPatientList(String name,String idcard,String ssc,String mobile,Integer openIdStatus,int page,int pageSize) throws Exception{
        if (page <= 0) {
        Patient patient = new Patient();
        patient.setName(name);
        patient.setIdcard(idcard);
        patient.setSsc(ssc);
        patient.setMobile(mobile);
        PageRequest pageRequest = new PageRequest(page - 1, pageSize);
        String sql = ISqlUtils.getSql(patient,page,pageSize,"*",openIdStatus);
        List<Patient> patients = jdbcTemplate.query(sql,new BeanPropertyRowMapper(Patient.class));
        String sqlcount = new ISqlUtils().getSql(patient,0,0,"count",openIdStatus);
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sqlcount);
        Long count = 0L;
        if(rstotal!=null&&rstotal.size()>0){
            count = (Long) rstotal.get(0).get("total");
        }
        /*if (page <= 0) {
            page = 1;
        }
        if (pageSize <= 0) {
@ -83,8 +103,8 @@ public class AdminPatientService extends BaseJpaService<Patient,Long> {
        int count = ((Number) queryCount.iterate().next()).intValue();
        queryList.setFirstResult(pageSize * (page - 1));
        queryList.setMaxResults(pageSize);
        List<Patient> list = queryList.list();
        return new PageImpl<Patient>(list,pageRequest,count);
        List<Patient> list = queryList.list();*/
        return new PageImpl<Patient>(patients,pageRequest,count);
    }
    //列表查询-分页

+ 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("请求失败");
    }
}

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

@ -1,18 +1,28 @@
package com.yihu.wlyy.service.synergy;
import com.alibaba.fastjson.JSON;
import com.yihu.wlyy.entity.*;
import com.yihu.wlyy.entity.call.CallRecord;
import com.yihu.wlyy.entity.synergy.*;
import com.yihu.wlyy.repository.*;
import com.yihu.wlyy.repository.survey.SurveyTemplateDao;
import com.yihu.wlyy.repository.synergy.*;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.IdCardUtil;
import com.yihu.wlyy.util.fastdfs.FastDFSUtil;
import com.yihu.wlyy.util.query.BaseJpaService;
import jxl.Workbook;
import jxl.write.*;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@ -20,9 +30,14 @@ import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.charset.Charset;
import java.text.SimpleDateFormat;
import java.util.*;
@ -62,11 +77,9 @@ public class SynergyManageService extends BaseJpaService {
    @Autowired
    private ManageSynergyWorkorderServicerLogDao manageSynergyWorkorderServicerLogDao;
    @Autowired
    private TownDao townDao;
    private SurveyTemplateDao surveyTemplateDao;
    @Autowired
    private FastDFSUtil fastDFSUtil;
    @Autowired
    private ManageCustomerOnlineRecordDao manageCustomerOnlineRecordDao;
    private ManageSynergyAccessoryDao manageSynergyAccessoryDao;
    /**
     * 根据服务编码获取工单
@ -226,6 +239,10 @@ public class SynergyManageService extends BaseJpaService {
                case 4: workorderTypeName="问卷调查";break;
                case 5: workorderTypeName="疾病筛查";break;
            }
            if(workorderTypeR==0||workorderTypeR==2||workorderTypeR==3){
                List<ManageSynergyWorkorderServicerDO> ls = workorderServicerDao.findByWorkorderCode(workorderCode);
                map.put("patientCode",ls.size()>0?ls.get(0):null);//1对1服务工单,服务对象code
            }
            map.put("typeName",workorderTypeName);//服务类型名称
            map.put("serviceTime", DateUtil.dateToStr((Date)one.get("service_time"),"yyyy-MM-dd HH:mm"));//服务时间
            map.put("priority",one.get("priority"));//工单优先级
@ -338,6 +355,7 @@ public class SynergyManageService extends BaseJpaService {
        map.put("serviceTime", s.format(workorderDO.getServiceTime()));
        map.put("status", status);
        map.put("title", workorderDO.getRelationCodeName());
        map.put("relationCode", workorderDO.getRelationCode());
        map.put("remark", workorderDO.getRemark());
        map.put("createTime", sdf.format(workorderDO.getCreateTime()));
        map.put("createUserName", workorderDO.getCreateUserName());
@ -360,6 +378,16 @@ 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());
        }else if(workorderDO.getType() == 5) {
            String diseaseType = surveyTemplateDao.findByCode(workorderDO.getRelationCode());
            map.put("diseaseType", diseaseType);
        }
        //超时标签
        map.put("delayStatus", this.isServiceOverTime(workorderDO.getServiceTime()));
@ -402,6 +430,8 @@ public class SynergyManageService extends BaseJpaService {
            //获取退回原因
            map.put("returnedRemark", workorderDO.getReturnedRemark());
        }
        List<ManageSynergyAccessoryDO> accessoryList = accessoryList(workorderCode);
        map.put("accessoryList",accessoryList);//附件列表
        return map;
    }
@ -509,6 +539,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);
@ -594,7 +625,7 @@ public class SynergyManageService extends BaseJpaService {
     * @param type
     */
    public void sendMessage(ManageSynergyWorkorderDO workorderDO, User user, Integer type){
        String url = wlyyUrl + "doctor/message/sendMessage";
        String url = wlyyUrl + "third/synergy/sendMessage";
        //组装message内容
        JSONObject message = new JSONObject();
        if(type == 24){
@ -610,7 +641,17 @@ public class SynergyManageService extends BaseJpaService {
        }
        //组装jsonObject内容
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("type", workorderDO.getType());
        Integer servicerType = workorderDO.getType();
        //协同服务类型
        if(servicerType == 1){
            jsonObject.put("type", "健康教育");
        }else if(servicerType == 3){
            jsonObject.put("type", "随访");
        }else if(servicerType == 4){
            jsonObject.put("type", "调查问卷");
        }else if(servicerType == 5){
            jsonObject.put("type", "疾病筛查");
        }
        if(type == 26){
            jsonObject.put("returnedRemark", workorderDO.getReturnedRemark());
        }else if(type == 25){
@ -834,7 +875,7 @@ public class SynergyManageService extends BaseJpaService {
        if(receiveType==1){
            sql =" select DISTINCT r.* from manage_synergy_workorder_reminder r " +
                 " LEFT JOIN manage_synergy_workorder_executor e on r.workorder_code=e.workorder_code " +
                 " where e.executor_code='' and e.del=1 and r.deal_with=0 " +sort;
                 " where e.executor_code='"+userCode+"' and e.del=1 and r.deal_with=0 " +sort;
        }else if(receiveType==2){
            sql =" select r.* from manage_synergy_workorder_reminder r where r.principal_code='"+userCode+"' and r.deal_with=0 "+sort;
        }
@ -843,7 +884,7 @@ public class SynergyManageService extends BaseJpaService {
        for(Map<String,Object> one:List){
            Map<String,Object> resultMap = new HashMap<>();
            resultMap.put("workorderCode",one.get("workorder_code"));
            resultMap.put("title","来自"+one.get("create_user_name")+"医生("+one.get("hospital_name")+")催单,请尽快处理(服务编号:)"+one.get("workorder_code"));//标题
            resultMap.put("title","来自"+one.get("create_user_name")+"医生("+one.get("hospital_name")+")催单,请尽快处理(服务编号:"+one.get("workorder_code")+")");//标题
            String workorderTypeName ="";
            Integer workorderType = (Integer) one.get("workorder_type");
            switch (workorderType){
@ -886,11 +927,104 @@ public class SynergyManageService extends BaseJpaService {
            servicerDO.setWorkorderCode(manageSynergyWorkorderDO1.getCode());
            servicerDO.setRelationCode(manageSynergyWorkorderDO1.getRelationCode());
            servicerDO.setCreateTime(new Date());
            servicerDO.setStatus(1);
            servicerDO.setCode(getCode());
            servicerDO.setRelationCodeName(manageSynergyWorkorderDO1.getRelationCodeName());
            workorderServicerDao.save(servicerDO);
        }
    }
    public String findByPatient(String patient){
        String response = null;
        String url = wlyyUrl + "third/synergy/findByPatient";
        Map<String,String> params = new HashMap<>();
        params.put("patient",patient);
        try {
            response = httpClientUtil.httpPost(url, params);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return response;
    }
    /**
     * 获取随访数据
     *
     * @param id
     * @param followupProject
     * @return
     */
    public String getFollowupProjectData(String id,String followupProject){
        String response = null;
        String url = wlyyUrl + "third/synergy/getFollowupProjectData";
        Map<String,String> params = new HashMap<>();
        params.put("id",id);
        params.put("followupProject",followupProject);
        String data = null;
        try {
            response = httpClientUtil.httpPost(url, params);
            com.alibaba.fastjson.JSONObject object = JSON.parseObject(response);
            if(object.getInteger("status")==200){
                data = object.getJSONObject("data").toJSONString();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return data;
    }
    /**
     * 药品列表
     *
     * @param name
     * @param isinsulin
     * @return
     */
    public String findDictByName(String name,String isinsulin,String doctor){
        String response = null;
        String url = wlyyUrl + "third/synergy/findDictByName";
        Map<String,String> params = new HashMap<>();
        params.put("name",name);
        params.put("isinsulin",isinsulin);
        params.put("doctor",doctor);
        String data = null;
        try {
            response = httpClientUtil.httpPost(url, params);
            com.alibaba.fastjson.JSONObject object = JSON.parseObject(response);
            if(object.getInteger("status")==200){
                data = object.getJSONArray("data").toJSONString();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return data;
    }
    /**
     * 保存药品
     *
     * @param id
     * @param drugsData
     * @return
     */
    public String saveFollowupDrugs(String id,String drugsData){
        String response = null;
        String url = wlyyUrl + "third/synergy/saveFollowupDrugs";
        Map<String,String> params = new HashMap<>();
        params.put("id",id);
        params.put("drugsData",drugsData);
        String data = null;
        try {
            response = httpClientUtil.httpPost(url, params);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return data;
    }
    /**
     * 添加随访计划
@ -905,14 +1039,13 @@ public class SynergyManageService extends BaseJpaService {
     */
    public String addFollowup(String doctor,String patient, String date, String followupType,String followupClass,String followupManagerStatus,String plandate){
        String response = null;
        String url = wlyyUrl + "followup/addFollowup";
        String url = wlyyUrl + "third/synergy/addFollowup";
        Map<String, Object> params = new HashMap<>();
        params.put("doctor",doctor);
        params.put("patient",patient);
        params.put("date",date);
        params.put("followupType",followupType);
        params.put("followupClass",followupClass);
        params.put("followupManagerStatus",followupManagerStatus);
        params.put("plandate",plandate);
        try {
            response = httpClientUtil.post(url, params);
@ -925,14 +1058,15 @@ public class SynergyManageService extends BaseJpaService {
    /**
     * 保存随访数据
     *
     * @param id
     * @param followup
     * @return
     */
    public String saveFollowupProjectData(String followup){
    public String saveFollowupProjectData(String id,String followup){
        String response = null;
        String url = wlyyUrl + "followup/saveFollowupProjectData";
        String url = wlyyUrl + "third/synergy/saveFollowupProjectData";
        Map<String, Object> params = new HashMap<>();
        params.put("id",id);
        params.put("followup",followup);
        try {
            response = httpClientUtil.post(url, params);
@ -944,11 +1078,25 @@ public class SynergyManageService extends BaseJpaService {
    @Transactional
    public void taskSubmit(String workorderCode,String dealResultRemark,String dealResultAccessory) throws Exception{
    public void taskSubmit(String workorderCode,String dealResultRemark,String accessoryJson) throws Exception{
        JSONArray jsonArray = new JSONArray(accessoryJson);
        String fileName;
        String url;
        List<ManageSynergyAccessoryDO> accessoryList = new ArrayList<>();
        for(int i=0;i<jsonArray.length();i++){
            fileName = jsonArray.getJSONObject(i).get("name")+"";
            url = jsonArray.getJSONObject(i).get("url")+"";
            ManageSynergyAccessoryDO manageSynergyAccessoryDO = new ManageSynergyAccessoryDO();
            manageSynergyAccessoryDO.setCode(getCode());
            manageSynergyAccessoryDO.setDel(0);
            manageSynergyAccessoryDO.setName(fileName);
            manageSynergyAccessoryDO.setUrl(url);
            manageSynergyAccessoryDO.setWorkorderCode(workorderCode);
            accessoryList.add(manageSynergyAccessoryDO);
        }
        manageSynergyAccessoryDao.save(accessoryList);
        ManageSynergyWorkorderDO manageSynergyWorkorderDO = workOrderDao.findByCode(workorderCode);
        manageSynergyWorkorderDO.setDealResultRemark(dealResultRemark);
        manageSynergyWorkorderDO.setDealResultAccessory(dealResultAccessory);
        manageSynergyWorkorderDO.setStatus(3);
        workOrderDao.save(manageSynergyWorkorderDO);
    }
@ -1184,6 +1332,8 @@ public class SynergyManageService extends BaseJpaService {
        String sql ="SELECT" +
                " s.create_time," +
                " s.service_patient_name," +
                " s.workorder_code,"+
                " s.workorder_type,"+
                " w.priority," +
                " w.relation_code," +
                " w.relation_code_name," +
@ -1235,15 +1385,30 @@ public class SynergyManageService extends BaseJpaService {
            }
        }
        //求总时长
        int seconds = totalTaklTime(waihudList);
        //求平均时长
        map.put("waihuAvgTalkTime",getAvgTime(seconds,waihudList.size()));
        if (waihudList.size()>0){
            int seconds = totalTaklTime(waihudList);
            //求平均时长
            map.put("waihuAvgTalkTime",getAvgTime(seconds,waihudList.size()));
        }else {
            map.put("waihuAvgTalkTime",0);
        }
        map.put("waihuCount",waihudList.size());
        map.put("waihuCustomerNoCount",customerNoCount);
        //--------------今日在线时长-----------------//
        List<ManageCustomerOnlineRecordDO> manageCustomerOnlineRecordDOList = manageCustomerOnlineRecordDao.findByCustomerCodeToday(userCode,startTime,endTime);
        String lineSql="SELECT" +
                " *" +
                " FROM" +
                " `manage_customer_online_record`" +
                " WHERE" +
                " customer_code ='"+userCode+"'" +
                " AND create_time >='"+startTime+"'" +
                " AND create_time <='"+endTime+"'" +
                " ORDER BY" +
                " create_time";
        List<ManageCustomerOnlineRecordDO> manageCustomerOnlineRecordDOList = jdbcTemplate.query(lineSql,new BeanPropertyRowMapper<>(ManageCustomerOnlineRecordDO.class));
        //如果最新一条是离线则直接获取总在线时长就是在线时间,
        // 如果最新一条是在线,则用当前时间减去上一条登录时间加上之前的在线时长为总的在线时长
        Map<String,Object> lineMap = getOnlineAndNotOnlineAndNowOnline(manageCustomerOnlineRecordDOList);
@ -1254,7 +1419,10 @@ public class SynergyManageService extends BaseJpaService {
        //求总时长
        int jieruTotalSecond = totalTaklTime(jieruList);
        //求平均时长
        map.put("jieruAvgTalkTime",getAvgTime(jieruTotalSecond,jieruList.size()));
        if (jieruList.size()>0){
            map.put("jieruAvgTalkTime",getAvgTime(jieruTotalSecond,jieruList.size()));
        }
        map.put("jieruAvgTalkTime",0);
        map.put("jieruCount",jieruList.size());
        //--------------今日协同任务完成数-----------------//
@ -1277,7 +1445,7 @@ public class SynergyManageService extends BaseJpaService {
                " executor_code = '"+userCode+"'" +
                " AND executor_type = 2" +
                " AND `status`<3";
        Map<String,Object> weiwanchenMap = jdbcTemplate.queryForMap(wanchenSql);
        Map<String,Object> weiwanchenMap = jdbcTemplate.queryForMap(weiwanchenSql);
        String fasongSql="SELECT" +
                " COUNT(*) AS fasongCount" +
                " FROM" +
@ -1298,46 +1466,54 @@ public class SynergyManageService extends BaseJpaService {
    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();
        if (list!=null && list.size()>0){
            //如果最新一条是离线则直接获取总在线时长就是在线时间,
            // 如果最新一条是在线,则用当前时间减去上一条登录时间加上之前的在线时长为总的在线时长
            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;
            }
            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);
        }else {
            map.put("notOnline",0);
            map.put("online",0);
            map.put("nowOnline",0);
            map.put("firstOnlineTime","");
        }
        map.put("notOnline",totalNotOnlineMinute);
        map.put("online",totalOnlineMinute);
        map.put("nowOnline",toMinute);
        map.put("firstOnlineTime",firstOnlineTime);
        return map;
    }
@ -1353,16 +1529,18 @@ public class SynergyManageService extends BaseJpaService {
        for(CallRecord callRecord : list){
            if (callRecord.getAnswerStatus()==1){
                String talkTime = callRecord.getTalkTime();
                String[] talkTimeStr = talkTime.split(":");
                for (int i=0;i<talkTimeStr.length;i++){
                    if (i==0){
                        hours += Integer.valueOf(talkTimeStr[i]);
                    }
                    if (i==1){
                        minutes += Integer.valueOf(talkTimeStr[i]);
                    }
                    if (i==2){
                        seconds += Integer.valueOf(talkTimeStr[i]);
                if (StringUtils.isNotBlank(talkTime)){
                    String[] talkTimeStr = talkTime.split(":");
                    for (int i=0;i<talkTimeStr.length;i++){
                        if (i==0){
                            hours += Integer.valueOf(talkTimeStr[i]);
                        }
                        if (i==1){
                            minutes += Integer.valueOf(talkTimeStr[i]);
                        }
                        if (i==2){
                            seconds += Integer.valueOf(talkTimeStr[i]);
                        }
                    }
                }
            }
@ -1416,11 +1594,85 @@ public class SynergyManageService extends BaseJpaService {
//        System.out.println(aa);
//        System.out.println(a.substring(0,aa));
//    }
    public void wordToPDF(String path) throws Exception{
        String groupName = path.substring(0,path.lastIndexOf("/"));
        String remoteFileName =path.substring(path.lastIndexOf("/"),path.length()-1);
        byte[] bb =FastDFSUtil.download(groupName,remoteFileName);
//    public void wordToPDF(String path) throws Exception{
//        String groupName = path.substring(0,path.lastIndexOf("/"));
//        String remoteFileName =path.substring(path.lastIndexOf("/"),path.length()-1);
//        byte[] bb =FastDFSUtil.download(groupName,remoteFileName);
//
//    }
    @Transactional
    public Map<String,Object> uploadAccessory(HttpServletRequest request) throws Exception{
        Map<String,Object> map = new HashMap<>();
        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
        MultipartFile multipartFile = multipartRequest.getFile("file");
        long size = multipartFile.getSize();
        if(size<=0){
            map.put("uploadStatus",1);//size小于0
            map.put("accessoryUrl",null);//
            return map;
        }
        String fileName = multipartFile.getOriginalFilename();
        String[] fs = fileName.split("\\.");
        String type = fs[1];
        //图片常见格式:bmp,jpg,png,tif,gif,pcx,tga,exif,fpx,svg,psd,cdr,pcd,dxf,ufo,eps,ai,raw,WMF,webp
        List img = new ArrayList(Arrays.asList("bmp","jpg","png","tif","gif","pcx","tga","exif","fpx","svg","psd","cdr","pcd","dxf","ufo","eps","ai","raw","WMF","webp"));
        if(!("doc".equals(type)||"docx".equals(type)||"xls".equals(type)||"xlsx".equals(type)||img.contains(type))){
            map.put("uploadStatus",2);//文件类型不对
            map.put("accessoryUrl",null);//
            return map;
        }
        String response = request(wlyyUrl + "/upload/chat", multipartFile, null);
        JSONObject rs = new JSONObject(response);
        Integer status =(Integer)rs.get("status");
        if(status==200){
            String url = rs.get("urls")+"";
            map.put("uploadStatus",0);//文件类型正确
            map.put("accessory",url);//
            return map;
        }
        throw new Exception();
    }
    public List<ManageSynergyAccessoryDO> accessoryList(String workorderCode){
        List<ManageSynergyAccessoryDO> list = manageSynergyAccessoryDao.findByWorkorderCode(workorderCode);
        return list;
    }
    public String request(String remote_url, MultipartFile file, String type) {
        CloseableHttpClient httpClient = HttpClientBuilder.create().build();
        String result = "";
        try {
            String fileName = file.getOriginalFilename();
            HttpPost httpPost = new HttpPost(remote_url);
            MultipartEntityBuilder builder = MultipartEntityBuilder.create();
            builder.addBinaryBody("file", file.getInputStream(), ContentType.MULTIPART_FORM_DATA, fileName);// 文件流
            builder.addTextBody("filename", fileName);// 类似浏览器表单提交,对应input的name和value
            if (!org.springframework.util.StringUtils.isEmpty(type)) {
                builder.addTextBody("type", type); //发送类型
            }
            HttpEntity entity = builder.build();
            httpPost.setEntity(entity);
            HttpResponse response = httpClient.execute(httpPost);// 执行提交
            HttpEntity responseEntity = response.getEntity();
            if (responseEntity != null) {
                // 将响应内容转换为字符串
                result = EntityUtils.toString(responseEntity, Charset.forName("UTF-8"));
            }
        } catch (IOException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                httpClient.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return result;
    }
    public Map<String,Object> adminIndex(){
@ -1442,6 +1694,8 @@ public class SynergyManageService extends BaseJpaService {
                " AND r.create_time <= '"+endTime+"'";
        //正在咨询人数
        String consultSql="SELECT COUNT(*) consultNum FROM manage_call_record WHERE answer_status=1 AND (end_time IS NULL or end_time ='')";
        map.put("consultNum",jdbcTemplate.queryForMap(consultSql).get("consultNum"));
        //当前客服人数
        map.put("onlineNowCount",userList.size());
@ -1484,11 +1738,11 @@ public class SynergyManageService extends BaseJpaService {
                " COUNT(*) AS weiwanchengCount" +
                " FROM" +
                " `manage_synergy_workorder_servicer` s" +
                "LEFT JOIN wlyy_user u ON s.executor_code = u.`code`" +
                " 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);
        Map<String,Object> weiwanchenMap = jdbcTemplate.queryForMap(weiwanchenSql);
        String fasongSql="SELECT" +
                " COUNT(*) AS fasongCount" +
                " FROM" +
@ -1497,7 +1751,7 @@ public class SynergyManageService extends BaseJpaService {
                "   s.*, w.create_user," +
                "   w.create_user_name" +
                "  FROM" +
                "   manage_synergy_workorder_servicer s" +
                "  manage_synergy_workorder_servicer s" +
                "  LEFT JOIN manage_synergy_workorder w ON s.workorder_code = w.`code`" +
                "  WHERE" +
                "   w.create_user_type = 2" +
@ -1560,12 +1814,12 @@ public class SynergyManageService extends BaseJpaService {
        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";
        /*startTime="2017-11-15 00:00:00";
        endTime="2017-11-22 23:59:59";*/
        String sql="SELECT" +
                " u.`code`,"+
                " u.`name`," +
                " u.`online`," +
                " u.`online` as onlineType," +
                " r.type," +
                " COUNT(*) as num"+
                " FROM" +
@ -1590,7 +1844,7 @@ public class SynergyManageService extends BaseJpaService {
                Map<String,Object> resultMap = new HashMap<>();
                resultMap.put("userCode",userCode);
                resultMap.put("userName",map.get("name"));
                resultMap.put("online",map.get("online"));
                resultMap.put("onlineType",map.get("online"));
                if ("1".equals(type)){
                    resultMap.put("jieruCount",map.get("num"));
                    resultMap.put("waihuCount",0);
@ -1616,7 +1870,7 @@ public class SynergyManageService extends BaseJpaService {
                        Map<String,Object> resultMap = new HashMap<>();
                        resultMap.put("userCode",userCode);
                        resultMap.put("userName",map.get("name"));
                        resultMap.put("online",map.get("online"));
                        resultMap.put("onlineType",map.get("onlineType"));
                        if ("1".equals(type)){
                            resultMap.put("jieruCount",map.get("num"));
                            resultMap.put("waihuCount",0);
@ -1632,8 +1886,18 @@ public class SynergyManageService extends BaseJpaService {
        }
        for (Map<String,Object> reMap : resultList){
            String userCode = String.valueOf(reMap.get("userCode"));
            List<ManageCustomerOnlineRecordDO> manageCustomerOnlineRecordDOList = manageCustomerOnlineRecordDao.findByCustomerCodeToday(userCode,startTime,endTime);
            //如果最新一条是离线则直接获取总在线时长就是在线时间,
            String lineSql="SELECT" +
                    " *" +
                    " FROM" +
                    " `manage_customer_online_record`" +
                    " WHERE" +
                    " customer_code ='"+userCode+"'" +
                    " AND create_time >='"+startTime+"'" +
                    " AND create_time <='"+endTime+"'" +
                    " ORDER BY" +
                    " create_time";
            List<ManageCustomerOnlineRecordDO> manageCustomerOnlineRecordDOList = jdbcTemplate.query(lineSql,new BeanPropertyRowMapper<>(ManageCustomerOnlineRecordDO.class));
            //如果最新一条是离线则直接获取总在线时长就是在线时间
            // 如果最新一条是在线,则用当前时间减去上一条登录时间加上之前的在线时长为总的在线时长
            Map<String,Object> lineMap = getOnlineAndNotOnlineAndNowOnline(manageCustomerOnlineRecordDOList);
            reMap.putAll(lineMap);
@ -1641,4 +1905,29 @@ public class SynergyManageService extends BaseJpaService {
        return resultList;
    }
    public List<User> getCustomers() {
        return userDao.findAllCustomer();
    }
    public void deleteFile(String storagePath) throws Exception{
        Map<String,Object> params = new HashMap<>();
        params.put("storagePath",storagePath);
        String response = httpClientUtil.post(wlyyUrl + "/upload/deleteFile", params);
        JSONObject jsonObject = new JSONObject(response);
        Integer status = (Integer) jsonObject.get("status");
        if(status!=200){
            throw new Exception();
        }
    }
    public JSONObject getArticalById(String articalId) throws Exception{
        String response = httpClientUtil.get(wlyyUrl + "/third/synergy/getArticalById?articleId="+articalId,"UTF-8");
        JSONObject jsonObject = new JSONObject(response);
        Integer status = (Integer) jsonObject.get("status");
        if(status==200){
            return jsonObject.getJSONObject("data");
        }
        throw new Exception();
    }
}

+ 1 - 1
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/SynergyWorkorderServicerLogService.java

@ -52,7 +52,7 @@ public class SynergyWorkorderServicerLogService extends BaseJpaService {
    public void create(ManageSynergyWorkorderServicerLogDO synergyWorkorderServicerLogDO){
        synergyWorkorderServicerLogDO.setCreateTime(new Date());
        ManageSynergyWorkorderServicerLogDO workorderServicerLogDO = manageSynergyWorkorderServicerLogDao.save(synergyWorkorderServicerLogDO);
        ManageSynergyWorkorderServicerDO workorderServicerDO = workorderServicerDao.findByWorkOrderCodeAndPatientCode(workorderServicerLogDO.getWorkorderCode(),workorderServicerLogDO.getWorkorderServiceCode());
        ManageSynergyWorkorderServicerDO workorderServicerDO = workorderServicerDao.findByWorkOrderCodeAndPatientCode1(workorderServicerLogDO.getWorkorderCode(),workorderServicerLogDO.getWorkorderServiceCode());
        workorderServicerDO.setStatus(3);
        workorderServicerDao.save(workorderServicerDO);
        String sql = "select * from manage_synergy_workorder_servicer where workorder_code = '"+workorderServicerLogDO.getWorkorderCode()+"' and status IN(1,2)";

+ 174 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/util/ISqlUtils.java

@ -0,0 +1,174 @@
package com.yihu.wlyy.util;/**
 * Created by nature of king on 2018/4/27.
 */
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import javax.persistence.Column;
import javax.persistence.Table;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
 * @author wangzhinan
 * @create 2018-04-27 12:47
 * @desc sql自定义编辑
 **/
public class ISqlUtils {
    public static String getSql(Object object,Integer page,Integer size,String isFlag,Integer openIdStatus){
        StringBuffer sb = new StringBuffer();
        Class c =object.getClass();
        Table table = (Table)c.getAnnotation(Table.class);
        String tableName = table.name();
        if (isFlag.equalsIgnoreCase("count")){
            sb.append("select count(1) AS total from ").append(tableName).append(" where 1=1");
        }else if(isFlag.equalsIgnoreCase("*")){
            sb.append("select * from ").append(tableName).append(" where 1=1 ");
        }
        JSONObject object1  = (JSONObject) JSONObject.toJSON(object);
        if (object1.getString("id") !=null){
            sb.append(" and id = '" + object1.getString("id")+"' ");
        }
        Field[] fArray= c.getDeclaredFields();
        for(Field f:fArray){
                //拿到字段后与实体类中的属性匹配,并得到其get方法,用来获取他的属性值
                String getMethodName ="";
                boolean isCExist =f.isAnnotationPresent(Column.class);
                if(isCExist){
                    Column mc =f.getAnnotation(Column.class);
                    String columeName =mc.name();  //字段对应数据库名字
                    String name =f.getName();       //字段名字
                    Class a= f.getType();          //字段类型
                    Object value=null;              //字段值
                    getMethodName="get"+name.substring(0,1).toUpperCase()+name.substring(1);//拼接属性的get方法
                    try {
                        Method m =c.getMethod(getMethodName);
                        value =(Object)m.invoke(object);     //拿到属性的值
                        if(value == null || "".equals(value)){  //如果属性没值,不拼接sql
                            continue;
                        }
                        else if(value instanceof String){
                            value ="'%"+value+"%'";
                            sb.append(" and ").append(columeName +" like " ).append(value+"");
                        }else if (value instanceof Integer){
                            value = value;
                            sb.append(" and ").append(columeName +" = " ).append(value+"");
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
        }
        JSONObject jsonObject = (JSONObject) JSONObject.toJSON(object);
        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date date1 = jsonObject.getDate("startTime");
        Date date2 = jsonObject.getDate("endTime");
        String startTime = null;
        String endTime = null;
        if (date1 != null){
             startTime = sdf.format(date1);
        }
        if (date2 != null) {
            endTime = sdf.format(date2);
        }
        if (StringUtils.isNoneBlank(startTime)&& StringUtils.isNoneBlank(endTime)){
            sb.append(" and start_time >= '"+startTime+"' and end_time <='"+endTime+"'");
        } else if (StringUtils.isNoneBlank(startTime)&&!StringUtils.isNoneBlank(endTime)) {
            sb.append(" and start_time >= '"+startTime+"'");
        }else if (StringUtils.isNoneBlank(endTime)&&!StringUtils.isNoneBlank(startTime)){
            sb.append(" and end_time <= '"+endTime+"'");
        }
        if(openIdStatus != null && openIdStatus== 2){
            sb.append(" and ( openid = '' or  openid is null)");
        }
        if(openIdStatus != null && openIdStatus == 3){
            sb.append(" and (openid != '' and openid is not null) ");
        }
        if(isFlag.equalsIgnoreCase("*")){
            sb.append(" ORDER BY czrq DESC ").append("LIMIT ").append((page-1)*size+",").append(size);
        }
        return sb.toString();
    }
    public static String getAllSql(Object object){
        StringBuffer sb = new StringBuffer();
        Class c =object.getClass();
        Table table = (Table)c.getAnnotation(Table.class);
        String tableName = table.name();
        sb.append("select * from ").append(tableName).append(" where 1=1 ");
        Field[] fArray= c.getDeclaredFields();
        for(Field f:fArray){
            //拿到字段后与实体类中的属性匹配,并得到其get方法,用来获取他的属性值
            String getMethodName ="";
            boolean isCExist =f.isAnnotationPresent(Column.class);
            if(isCExist){
                Column mc =f.getAnnotation(Column.class);
                String columeName =mc.name();  //字段对应数据库名字
                String name =f.getName();       //字段名字
                Object value=null;              //字段值
                getMethodName="get"+name.substring(0,1).toUpperCase()+name.substring(1);//拼接属性的get方法
                try {
                    Method m =c.getMethod(getMethodName);
                    value =(Object)m.invoke(object);     //拿到属性的值
                    if(value == null || "".equals(value) || value.equals(Integer.parseInt("0"))){  //如果属性没值,不拼接sql
                        continue;
                    }
                    else if(value instanceof String){
                        value ="'"+value+"'";
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
                sb.append(" and ").append(columeName +"=" ).append(value+"");
            }
        }
        return sb.toString();
    }
    public static  String getUpdateSql(Object object){
        StringBuffer sb = new StringBuffer();
        Class c = object.getClass();
        Table table = (Table)c.getAnnotation(Table.class);
        String tableName = table.name();
        sb.append("update ").append(tableName).append(" set ");
        Field[] fArray = c.getDeclaredFields();
        for (Field f:fArray){
            String getMethoName = "";
            boolean isCExist = f.isAnnotationPresent(Column.class);
            if (isCExist){
                Column mc = f.getAnnotation(Column.class);
                String columeName = mc.name();
                String name = f.getName();
                Class a= f.getType();
                Object value= null;
                getMethoName = "get" + name.substring(0,1).toUpperCase()+name.substring(1);
                try {
                    Method m = c.getMethod(getMethoName);
                    if (Date.class.isAssignableFrom(a)){
                        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                        value = sdf.format((Object)m.invoke(object));
                    }else {
                        value = (Object)m.invoke(object);
                    }
                    if (value == null || "".equals(value)){
                        continue;
                    }
                    else if (value instanceof  String){
                        value = "'"+value+"'";
                    }
                }catch (Exception e){
                    e.printStackTrace();
                }
                sb.append(columeName + "=").append(value+"").append(",");
            }
        }
        sb.deleteCharAt(sb.length()-1);
        JSONObject jsonObject = (JSONObject) JSONObject.toJSON(object);
        sb.append(" where ").append("id = ").append("'"+jsonObject.get("id")+"'");
        return sb.toString();
    }
}

+ 41 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/util/http/HttpResponse.java

@ -0,0 +1,41 @@
package com.yihu.wlyy.util.http;
/**
 * Utils - Http请求辅助类,简化页面页面判断逻辑
 * Created by progr1mmer on 2018/1/16.
 */
public class HttpResponse {
    private int status;
    private String content;
    public HttpResponse(int status, String content) {
        this.status = status;
        this.content = content;
    }
    public int getStatus() {
        return status;
    }
    public void setStatus(int status) {
        this.status = status;
    }
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public boolean isSuccessFlg() {
        return status == 200;
    }
    public String getErrorMsg() {
        return content;
    }
}

+ 449 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/util/http/HttpUtils.java

@ -0,0 +1,449 @@
package com.yihu.wlyy.util.http;
import org.apache.http.HttpEntity;
import org.apache.http.HttpStatus;
import org.apache.http.NameValuePair;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.*;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.springframework.util.StringUtils;
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * Utils - HTTP请求辅助工具类
 * Created by progr1mmer on 2017/9/27.
 */
public class HttpUtils {
    public static HttpResponse doGet(String url, Map<String, Object> params) throws Exception {
        return doGet(url, params, null);
    }
    public static HttpResponse doGet(String url, Map<String, Object> params, Map<String, String> headers) throws Exception {
        return doGet(url, params, headers, null, null);
    }
    public static HttpResponse doGet(String url, Map<String, Object> params, Map<String, String> headers, String username, String password) throws Exception {
        String response;
        int status;
        CloseableHttpClient httpClient = null;
        CloseableHttpResponse closeableHttpResponse = null;
        List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>();
        if (params != null) {
            for (String key : params.keySet()) {
                Object value = params.get(key);
                if (value != null) {
                    nameValuePairList.add(new BasicNameValuePair(key, String.valueOf(params.get(key))));
                }
            }
        }
        String paramStr = EntityUtils.toString(new UrlEncodedFormEntity(nameValuePairList, "UTF-8"));
        HttpGet httpGet = new HttpGet(url + "?" + paramStr);
        if (headers != null) {
            for (String key : headers.keySet()) {
                httpGet.addHeader(key, headers.get(key));
            }
        }
        try {
            if (!StringUtils.isEmpty(username) && !StringUtils.isEmpty(password)) {
                UsernamePasswordCredentials usernamePasswordCredentials = new UsernamePasswordCredentials(username, password);
                CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
                credentialsProvider.setCredentials(AuthScope.ANY, usernamePasswordCredentials);
                httpClient = HttpClients.custom().setDefaultCredentialsProvider(credentialsProvider).build();
            } else {
                httpClient = HttpClients.createDefault();
            }
            closeableHttpResponse = httpClient.execute(httpGet);
            HttpEntity resEntity = closeableHttpResponse.getEntity();
            status = closeableHttpResponse.getStatusLine().getStatusCode();
            response = getRespString(resEntity);
        } finally {
            try {
                if (closeableHttpResponse != null) {
                    closeableHttpResponse.close();
                }
                if (httpClient != null) {
                    httpClient.close();
                }
            }catch (Exception e) {
                e.printStackTrace();
            }
        }
        if (status != HttpStatus.SC_OK) {
//            LogService.getLogger().error(" GET: " + url + " " + status);
        }
        HttpResponse httpResponse = new HttpResponse(status, response);
        return httpResponse;
    }
    public static HttpResponse doPost(String url, Map<String, Object> params) throws Exception {
        return doPost(url, params, null);
    }
    public static HttpResponse doPost(String url, Map<String, Object> params, Map<String, String> headers) throws Exception{
        return doPost(url, params, headers, null, null);
    }
    public static HttpResponse doPost(String url, Map<String, Object> params, Map<String, String> headers, String username, String password) throws Exception{
        String response;
        int status;
        CloseableHttpClient httpClient = null;
        CloseableHttpResponse closeableHttpResponse = null;
        HttpPost httpPost = new HttpPost(url);
        List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>();
        if (params != null) {
            for (String key : params.keySet()) {
                Object value = params.get(key);
                if (value != null) {
                    nameValuePairList.add(new BasicNameValuePair(key, String.valueOf(params.get(key))));
                }
            }
        }
        httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairList, "UTF-8"));
        if (headers != null) {
            for (String key : headers.keySet()) {
                httpPost.addHeader(key, headers.get(key));
            }
        }
        try {
            if (!StringUtils.isEmpty(username) && !StringUtils.isEmpty(password)) {
                UsernamePasswordCredentials usernamePasswordCredentials = new UsernamePasswordCredentials(username, password);
                CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
                credentialsProvider.setCredentials(AuthScope.ANY, usernamePasswordCredentials);
                httpClient = HttpClients.custom().setDefaultCredentialsProvider(credentialsProvider).build();
            } else {
                httpClient = HttpClients.createDefault();
            }
            closeableHttpResponse = httpClient.execute(httpPost);
            HttpEntity resEntity = closeableHttpResponse.getEntity();
            status = closeableHttpResponse.getStatusLine().getStatusCode();
            response = getRespString(resEntity);
        } finally {
            try {
                if (closeableHttpResponse != null) {
                    closeableHttpResponse.close();
                }
                if (httpClient != null) {
                    httpClient.close();
                }
            }catch (Exception e) {
                e.printStackTrace();
            }
        }
        if(status != HttpStatus.SC_OK) {
//            LogService.getLogger().error(" POST: " + url + " " + status);
        }
        HttpResponse httpResponse = new HttpResponse(status, response);
        return httpResponse;
    }
    public static HttpResponse doJsonPost(String url, String jsonData, Map<String, String> headers, String username, String password) throws Exception{
        String response;
        int status;
        CloseableHttpClient httpClient = null;
        CloseableHttpResponse closeableHttpResponse = null;
        HttpPost httpPost = new HttpPost(url);
        httpPost.setHeader("Content-Type", "application/json;charset=UTF-8");
        httpPost.setEntity(new StringEntity(jsonData, "UTF-8"));
        if (headers != null) {
            for (String key : headers.keySet()) {
                httpPost.addHeader(key, headers.get(key));
            }
        }
        try {
            if (!StringUtils.isEmpty(username) && !StringUtils.isEmpty(password)) {
                UsernamePasswordCredentials usernamePasswordCredentials = new UsernamePasswordCredentials(username, password);
                CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
                credentialsProvider.setCredentials(AuthScope.ANY, usernamePasswordCredentials);
                httpClient = HttpClients.custom().setDefaultCredentialsProvider(credentialsProvider).build();
            } else {
                httpClient = HttpClients.createDefault();
            }
            closeableHttpResponse = httpClient.execute(httpPost);
            HttpEntity resEntity = closeableHttpResponse.getEntity();
            status = closeableHttpResponse.getStatusLine().getStatusCode();
            response = getRespString(resEntity);
        } finally {
            try {
                if (closeableHttpResponse != null) {
                    closeableHttpResponse.close();
                }
                if (httpClient != null) {
                    httpClient.close();
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        if(status != HttpStatus.SC_OK) {
//            LogService.getLogger().error(" POST: " + url + " " + status);
        }
        HttpResponse httpResponse = new HttpResponse(status, response);
        return httpResponse;
    }
    public static HttpResponse doPut(String url, Map<String, Object> params) throws Exception {
        return doPut(url, params, null);
    }
    public static HttpResponse doPut(String url, Map<String, Object> params, Map<String, String> headers) throws Exception {
        return doPut(url, params, headers, null, null);
    }
    public static HttpResponse doPut(String url, Map<String, Object> params, Map<String, String> headers, String username, String password) throws Exception {
        String response;
        int status;
        CloseableHttpClient httpClient = null;
        CloseableHttpResponse closeableHttpResponse = null;
        HttpPut httpPut = new HttpPut(url);
        List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>();
        if (params != null) {
            for (String key : params.keySet()) {
                Object value = params.get(key);
                if (value != null) {
                    nameValuePairList.add(new BasicNameValuePair(key, String.valueOf(params.get(key))));
                }
            }
        }
        httpPut.setEntity(new UrlEncodedFormEntity(nameValuePairList, "UTF-8"));
        if (headers != null) {
            for (String key : headers.keySet()) {
                httpPut.addHeader(key, headers.get(key));
            }
        }
        try {
            if (!StringUtils.isEmpty(username) && !StringUtils.isEmpty(password)) {
                UsernamePasswordCredentials usernamePasswordCredentials = new UsernamePasswordCredentials(username, password);
                CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
                credentialsProvider.setCredentials(AuthScope.ANY, usernamePasswordCredentials);
                httpClient = HttpClients.custom().setDefaultCredentialsProvider(credentialsProvider).build();
            } else {
                httpClient = HttpClients.createDefault();
            }
            closeableHttpResponse = httpClient.execute(httpPut);
            HttpEntity resEntity = closeableHttpResponse.getEntity();
            status = closeableHttpResponse.getStatusLine().getStatusCode();
            response = getRespString(resEntity);
        } finally {
            try {
                if (closeableHttpResponse != null) {
                    closeableHttpResponse.close();
                }
                if (httpClient != null) {
                    httpClient.close();
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        if (status != HttpStatus.SC_OK) {
//            LogService.getLogger().error(" PUT: " + url + " " + status);
        }
        HttpResponse httpResponse = new HttpResponse(status, response);
        return httpResponse;
    }
    public static HttpResponse doJsonPut(String url, String jsonData, Map<String, String> headers, String username, String password) throws Exception {
        String response;
        int status;
        CloseableHttpClient httpClient = null;
        CloseableHttpResponse closeableHttpResponse = null;
        HttpPut httpPut = new HttpPut(url);
        httpPut.setHeader("Content-Type", "application/json;charset=UTF-8");
        httpPut.setEntity(new StringEntity(jsonData, "UTF-8"));
        if (headers != null) {
            for (String key : headers.keySet()) {
                httpPut.addHeader(key, headers.get(key));
            }
        }
        try {
            if (!StringUtils.isEmpty(username) && !StringUtils.isEmpty(password)) {
                UsernamePasswordCredentials usernamePasswordCredentials = new UsernamePasswordCredentials(username, password);
                CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
                credentialsProvider.setCredentials(AuthScope.ANY, usernamePasswordCredentials);
                httpClient = HttpClients.custom().setDefaultCredentialsProvider(credentialsProvider).build();
            } else {
                httpClient = HttpClients.createDefault();
            }
            closeableHttpResponse = httpClient.execute(httpPut);
            HttpEntity resEntity = closeableHttpResponse.getEntity();
            status = closeableHttpResponse.getStatusLine().getStatusCode();
            response = getRespString(resEntity);
        } finally {
            try {
                if (closeableHttpResponse != null) {
                    closeableHttpResponse.close();
                }
                if (httpClient != null) {
                    httpClient.close();
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        if (status != HttpStatus.SC_OK) {
//            LogService.getLogger().error(" PUT: " + url + " " + status);
        }
        HttpResponse httpResponse = new HttpResponse(status, response);
        return httpResponse;
    }
    public static HttpResponse doDelete(String url, Map<String, Object> params) throws Exception {
        return doDelete(url, params, null);
    }
    public static HttpResponse doDelete(String url, Map<String, Object> params, Map<String, String> headers) throws Exception {
        return doDelete(url, params, headers, null, null);
    }
    public static HttpResponse doDelete(String url, Map<String, Object> params, Map<String, String> headers, String username, String password) throws Exception {
        String response;
        int status;
        CloseableHttpClient httpClient = null;
        CloseableHttpResponse closeableHttpResponse = null;
        List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>();
        if (params != null) {
            for (String key : params.keySet()) {
                Object value = params.get(key);
                if (value != null) {
                    nameValuePairList.add(new BasicNameValuePair(key, String.valueOf(params.get(key))));
                }
            }
        }
        String paramStr = EntityUtils.toString(new UrlEncodedFormEntity(nameValuePairList, "UTF-8"));
        HttpDelete httpDelete = new HttpDelete(url + "?" + paramStr);
        if (headers != null) {
            for (String key : headers.keySet()) {
                httpDelete.addHeader(key, headers.get(key));
            }
        }
        try {
            if (!StringUtils.isEmpty(username) && !StringUtils.isEmpty(password)) {
                UsernamePasswordCredentials usernamePasswordCredentials = new UsernamePasswordCredentials(username, password);
                CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
                credentialsProvider.setCredentials(AuthScope.ANY, usernamePasswordCredentials);
                httpClient = HttpClients.custom().setDefaultCredentialsProvider(credentialsProvider).build();
            } else {
                httpClient = HttpClients.createDefault();
            }
            closeableHttpResponse = httpClient.execute(httpDelete);
            HttpEntity resEntity = closeableHttpResponse.getEntity();
            status = closeableHttpResponse.getStatusLine().getStatusCode();
            response = getRespString(resEntity);
        } finally {
            try {
                if (closeableHttpResponse != null) {
                    closeableHttpResponse.close();
                }
                if (httpClient != null) {
                    httpClient.close();
                }
            }catch (Exception e) {
                e.printStackTrace();
            }
        }
        if (status != HttpStatus.SC_OK) {
//            LogService.getLogger().error(" DELETE: " + url + " " + status);
        }
        HttpResponse httpResponse = new HttpResponse(status, response);
        return httpResponse;
    }
    public static HttpResponse doUpload(String url, Map<String, Object> params, File file) throws Exception {
        return doUpload(url, params, null, file, null, null);
    }
    public static HttpResponse doUpload(String url, Map<String, Object> params, Map<String, String> headers, File file) throws Exception {
        return doUpload(url, params, headers, file, null, null);
    }
    public static HttpResponse doUpload(String url, Map<String, Object> params, Map<String, String> headers, File file, String username, String password) throws Exception {
        String response;
        int status;
        CloseableHttpClient httpClient = null;
        CloseableHttpResponse closeableHttpResponse = null;
        HttpPost httpPost = new HttpPost(url);
        MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder.create();
        FileBody fileBody = new FileBody(file);
        multipartEntityBuilder.addPart("file", fileBody);
        if (params != null) {
            for (String key : params.keySet()) {
                Object value = params.get(key);
                if (value != null) {
                    multipartEntityBuilder.addTextBody(key, String.valueOf(params.get(key)), ContentType.TEXT_PLAIN);
                }
            }
        }
        if (headers != null) {
            for (String key : headers.keySet()) {
                httpPost.addHeader(key, headers.get(key));
            }
        }
        HttpEntity reqEntity = multipartEntityBuilder.build();
        httpPost.setEntity(reqEntity);
        try {
            if (!StringUtils.isEmpty(username) && !StringUtils.isEmpty(password)) {
                UsernamePasswordCredentials usernamePasswordCredentials = new UsernamePasswordCredentials(username, password);
                CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
                credentialsProvider.setCredentials(AuthScope.ANY, usernamePasswordCredentials);
                httpClient = HttpClients.custom().setDefaultCredentialsProvider(credentialsProvider).build();
            } else {
                httpClient = HttpClients.createDefault();
            }
            closeableHttpResponse = httpClient.execute(httpPost);
            HttpEntity resEntity = closeableHttpResponse.getEntity();
            status = closeableHttpResponse.getStatusLine().getStatusCode();
            response = getRespString(resEntity);
        } finally {
            try {
                if (closeableHttpResponse != null) {
                    closeableHttpResponse.close();
                }
                if (httpClient != null) {
                    httpClient.close();
                }
            }catch (Exception e) {
                e.printStackTrace();
            }
        }
        if (status != HttpStatus.SC_OK) {
//            LogService.getLogger().error(" POST UPLOAD: " + url + " " + status);
        }
        HttpResponse httpResponse = new HttpResponse(status, response);
        return httpResponse;
    }
    private static String getRespString(HttpEntity entity) throws Exception {
        if (entity == null) {
            return null;
        }
        InputStream is = entity.getContent();
        BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
        StringBuilder stringBuilder = new StringBuilder();
        String line;
        while ((line = reader.readLine()) != null) {
            stringBuilder.append(line);
        }
        return stringBuilder.toString();
    }
}

+ 54 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/util/http/IPInfoUtils.java

@ -0,0 +1,54 @@
package com.yihu.wlyy.util.http;
import javax.servlet.http.HttpServletRequest;
/**
 * Utils - ip信息辅助工具类
 * Created by progr1mmer on 2018/1/18.
 */
public class IPInfoUtils {
    private static final long A1 = getIpNum("10.0.0.0");
    private static final long A2 = getIpNum("10.255.255.255");
    private static final long B1 = getIpNum("172.16.0.0");
    private static final long B2 = getIpNum("172.31.255.255");
    private static final long C1 = getIpNum("192.168.0.0");
    private static final long C2 = getIpNum("192.168.255.255");
    private static final long D1 = getIpNum("10.44.0.0");
    private static final long D2 = getIpNum("10.69.0.255");
    private static long getIpNum(String ipAddress) {
        String [] ip = ipAddress.split("\\.");
        long a = Integer.parseInt(ip[0]);
        long b = Integer.parseInt(ip[1]);
        long c = Integer.parseInt(ip[2]);
        long d = Integer.parseInt(ip[3]);
        return a * 256 * 256 * 256 + b * 256 * 256 + c * 256 + d;
    }
    public static boolean isInnerIP(String ip){
        long n = getIpNum(ip);
        return (n >= A1 && n <= A2) || (n >= B1 && n <= B2) || (n >= C1 && n <= C2) || (n >= D1 && n <= D2);
    }
    public static String getIPAddress(HttpServletRequest request) {
        String ip = request.getHeader("x-forwarded-for");
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("Proxy-Client-IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("WL-Proxy-Client-IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("HTTP_CLIENT_IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("HTTP_X_FORWARDED_FOR");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getRemoteAddr();
        }
        return ip;
    }
}

+ 2 - 0
patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/common/dao/PatientHealthIndexDao.java

@ -60,4 +60,6 @@ public interface PatientHealthIndexDao
	@Query(value="select * from device.wlyy_patient_health_index where user = ?1 and type = ?2 ORDER BY record_date desc limit 0 ,5",nativeQuery = true)
	List<PatientHealthIndex> findByPatientAndTypeByPage(String patientCode, int type);
}

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

@ -1,11 +1,7 @@
package com.yihu.wlyy.service.controller;
import com.google.gson.JsonObject;
import com.yihu.wlyy.service.common.model.Result;
import com.yihu.wlyy.service.entity.PatientReservation;
import com.yihu.wlyy.service.service.JMService;
import com.yihu.wlyy.service.service.guahao.GuahaoDoctor;
import com.yihu.wlyy.service.service.guahao.GuahaoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -17,12 +13,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * 计划免疫接口

+ 9 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/event/ApplicationEvent.java

@ -292,6 +292,15 @@ public class ApplicationEvent implements ApplicationListener<ContextRefreshedEve
                logger.info("child_immune_vaccin_job  job exist");
            }
            //获取儿童可预约疫苗,每天凌晨1点执行一次
            if (!quartzHelper.isExistJob("alert_child_immune_vaccin_job")) {
                String trigger = SystemConf.getInstance().getSystemProperties().getProperty("alert_child_immune_vaccin_job");
                quartzHelper.addJob(AlertChildImmuneVaccinJob.class, trigger, "alert_child_immune_vaccin_job", new HashMap<String, Object>());
                logger.info("alert_child_immune_vaccin_job  job success");
            } else {
                logger.info("alert_child_immune_vaccin_job  job exist");
            }
        } catch (Exception e) {
            logger.info("sign end job start failed");
        }

+ 28 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/AlertChildImmuneVaccinJob.java

@ -0,0 +1,28 @@
package com.yihu.wlyy.job;
import com.yihu.wlyy.service.imm.ChildVaccinImmuneService;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
public class AlertChildImmuneVaccinJob implements Job {
    private static final Logger logger = LoggerFactory.getLogger(AlertChildImmuneVaccinJob.class);
    @Autowired
    private ChildVaccinImmuneService childVaccinImmuneService;
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        logger.info("START========每天九点提醒居民待接种JOB========");
        try {
            childVaccinImmuneService.alertBefore();
            logger.info("END========每天九点提醒居民待接种JOB========");
        }catch (Exception e){
            e.printStackTrace();
            logger.info("END===ERROE===每天九点提醒居民待接种JOB,message:"+e.getMessage());
        }
    }
}

+ 170 - 3
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/imm/ChildVaccinImmuneService.java

@ -1,16 +1,28 @@
package com.yihu.wlyy.service.imm;
import com.yihu.es.entity.PatientRemindRecordESDO;
import com.yihu.wlyy.config.es.ElasticFactory;
import com.yihu.wlyy.config.es.ElastricSearchSave;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.imm.ChildFamilyImmune;
import com.yihu.wlyy.entity.imm.ChildImmuneVaccin;
import com.yihu.wlyy.entity.imm.ChildInfo;
import com.yihu.wlyy.entity.wechat.WechatTemplateConfig;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.imm.ChildImmuneVaccinDao;
import com.yihu.wlyy.repository.wechat.WechatTemplateConfigDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.third.jw.ImmuneService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import io.searchbox.client.JestClient;
import org.apache.commons.lang.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -24,21 +36,38 @@ import java.util.*;
 */
@Service
public class ChildVaccinImmuneService extends BaseService {
	
	private static org.slf4j.Logger logger = LoggerFactory.getLogger(ChildVaccinImmuneService.class);
	@Autowired
	private JdbcTemplate jdbcTemplate;
	@Autowired
	private ChildImmuneVaccinDao childImmuneVaccinDao;
	@Autowired
	private ImmuneService immuneService;
	@Autowired
	private DoctorDao doctorDao;
	@Value("${es.type.patientRemindRecord}")
	private String esType;
	@Value("${es.index.patientRemindRecord}")
	private String esIndex;
	@Autowired
	private WechatTemplateConfigDao templateConfigDao;
	@Autowired
	private PushMsgTask pushMsgTask;
	@Autowired
	private WeiXinAccessTokenUtils weiXinAccessTokenUtils;
	@Autowired
	private ElasticFactory elasticFactory;
	@Autowired
	private ElastricSearchSave elastricSearchSave;
	
	@Transactional(rollbackFor = Exception.class)
	public int getChildImmuneVaccinEveryDay()throws Exception{
		int result = 0;
		try {
			String sql ="SELECT" +
			/*String sql ="SELECT" +
					" DISTINCT ci.`code`," +
					" ci.idcard," +
					" ci.`name`," +
@ -48,7 +77,9 @@ public class ChildVaccinImmuneService extends BaseService {
					" wlyy_child_family_immune fi" +
					" LEFT JOIN wlyy_child_info ci ON fi.child_code = ci.`code`" +
					" WHERE" +
					" fi.del = 0";
					" fi.del = 0";*/
            String sql ="SELECT `code`,`name`,idcard,ssc FROM wlyy_child_info WHERE del=0";
			List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
			for (Map<String,Object> map : list){
				String barcode = String.valueOf(map.get("barcode"));
@ -165,4 +196,140 @@ public class ChildVaccinImmuneService extends BaseService {
		}
		return result;
	}
	public int alertBefore()throws Exception{
		JSONArray jsonArray =  new JSONArray();
		String sql ="SELECT" +
				" v.*, i.birthday" +
				" FROM" +
				" wlyy_child_immune_vaccin v" +
				" LEFT JOIN wlyy_child_info i ON v.child_info_code = i.`code`" +
				" WHERE" +
				" v.del = 0" +
				" AND ymkc = 'true'";
		List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sql);
		String nowDate = DateUtil.dateToStrShort(new Date());
		for (Map<String,Object> map : mapList){
			Calendar calendar=Calendar.getInstance();
			String birthDayStr = String.valueOf(map.get("birthday"));
			if (StringUtils.isNotBlank(birthDayStr)){
				String[] biStr = birthDayStr.split("-");
				int birthdayDate = Integer.valueOf(biStr[biStr.length-1]);
				int nowDayDate = calendar.get(GregorianCalendar.DAY_OF_MONTH);
				int nowMonthDate = calendar.get(GregorianCalendar.MONTH)+1;
				int nowYearDate = calendar.get(GregorianCalendar.YEAR);
				//如果生日在今天的日期之前,则取下个月生日的日期的15天的是否是今天.
				if (birthdayDate<nowDayDate){
					calendar.set(nowYearDate,nowMonthDate+1,birthdayDate);
				}else {
					//如果生日在今天之前后,则看生日的15天之前是否是今天
					calendar.set(nowYearDate,nowMonthDate,birthdayDate);
				}
				String needAlertDate = DateUtil.dateToStrShort(DateUtil.getPreDays(calendar.getTime(),-15));
				if (needAlertDate.equals(nowDate)){
					JSONObject jsonObject = new JSONObject();
					jsonObject.put("vaccinCode",map.get("code"));//待接种疫苗记录code
					jsonObject.put("childName", map.get("name"));//儿童姓名
					jsonObject.put("childCode", map.get("child_info_code"));//儿童code
					jsonObject.put("vaccinName", map.get("ymmc"));//疫苗名称
					jsonArray.put(jsonObject);
				}
			}
		}
		return alertImmVacclinByChildInfoCodes(jsonArray.toString());
	}
	public int alertImmVacclinByChildInfoCodes(String alertDataJsonStr)throws Exception{
		if (StringUtils.isEmpty(alertDataJsonStr)){
			return -1;
		}
		List<PatientRemindRecordESDO> patientRemindRecordESDOList = new ArrayList<>();
		JSONArray jsonArray = new JSONArray(alertDataJsonStr);
		for (int i=0;i<jsonArray.length();i++){
			JSONObject jsonObject = jsonArray.getJSONObject(i);
			String childCode = jsonObject.getString("childCode");
			String childName = jsonObject.getString("childName");
			String vaccinName = jsonObject.getString("vaccinName");
			String vaccinCode = jsonObject.getString("vaccinCode");
			String sql ="SELECT" +
					" cfi.relation," +
					" p.`code`," +
					" p.`name`," +
					" p.openid" +
					" FROM" +
					" wlyy_child_family_immune cfi" +
					" LEFT JOIN wlyy_patient p ON cfi.family_code = p.`code`" +
					" WHERE" +
					" cfi.child_code = '"+childCode+"'" +
					" AND cfi.del = 0 and (p.openid is not null or p.openid !='')";
			List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
			if (list.size()==0){
				return -10000;
			}
			List<String> openIdList = new ArrayList<>();
			for (Map<String,Object> map : list){
				//如果父母亲都在就都发
				if (!openIdList.contains(String.valueOf(map.get("openid")))){
					if (("1".equals(String.valueOf(map.get("relation"))) || "2".equals(String.valueOf(map.get("relation")))) && StringUtils.isNotBlank(String.valueOf(map.get("openid")))){
						boolean flag =true;
						try {
							WechatTemplateConfig temp = templateConfigDao.findByScene("template_deal_with_job", "dsymjztx");
							JSONObject json = new JSONObject();
							json.put("toUser",String.valueOf(map.get("code")));
							json.put("keyword1", temp.getKeyword1().replace("key1",DateUtil.dateToStr(new Date(), "yyyy-MM-dd")));
							json.put("keyword2", temp.getKeyword2().replace("key1", vaccinName));
							json.put("remark", temp.getRemark());
							json.put("first", temp.getFirst().replace("key1", childName));
							logger.info("weiTempJOSN:"+json.toString());
							pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 24,String.valueOf(map.get("openid")) , String.valueOf(map.get("name")), json);
						}catch (Exception e){
							e.printStackTrace();
							flag = false;
						}
						//发送微信消息并且插入一条es提醒数据
						PatientRemindRecordESDO patientRemindRecordESDO =  new PatientRemindRecordESDO();
						patientRemindRecordESDO.setCode(getCode());
						patientRemindRecordESDO.setPatient(String.valueOf(map.get("code")));
						patientRemindRecordESDO.setPatientName(String.valueOf(map.get("name")));
						patientRemindRecordESDO.setDoctor("admin");
						patientRemindRecordESDO.setDoctorName("admin");
						patientRemindRecordESDO.setCreateDate(new Date());
						patientRemindRecordESDO.setRemindType(1);
						if (flag) {
							patientRemindRecordESDO.setStatus(1);
							String update="UPDATE wlyy_child_immune_vaccin SET alert_tag=1,alert_time='"+DateUtil.dateToStr(new Date(),DateUtil.YYYY_MM_DD_HH_MM_SS)+"' where `code`='"+vaccinCode+"'";
							jdbcTemplate.update(update);
						}else {
							patientRemindRecordESDO.setStatus(0);
						}
						patientRemindRecordESDOList.add(patientRemindRecordESDO);
					}
				}
			}
		}
		//保存到es的提醒日志表中
		esSavePatientRemindRecord(patientRemindRecordESDOList);
		return 200;
	}
	public boolean esSavePatientRemindRecord(List<PatientRemindRecordESDO> patientRemindRecordESDOList)throws Exception{
		JestClient jestClient = null;
		boolean flag = true;
		try {
			jestClient = elasticFactory.getJestClient();
			if(patientRemindRecordESDOList != null && patientRemindRecordESDOList.size()>0){
				flag = elastricSearchSave.save(patientRemindRecordESDOList, esIndex, esType);
			}
		}catch (Exception e){
			e.printStackTrace();
			flag = false;
		} finally{
			if (jestClient != null) {
				jestClient.shutdownClient();
			}
		}
		return  flag;
	}
}

+ 2 - 0
patient-co/patient-co-wlyy-job/src/main/resources/application-dev.yml

@ -125,10 +125,12 @@ es:
    HealthEduArticlePatient: health_edu_article_patient_dev
    Statistics: wlyy_quota_test
    FollowUp: wlyy_followup
    patientRemindRecord: wlyy_patient_remind_record
  type:
    HealthEduArticlePatient: health_edu_article_patient_dev
    Statistics: wlyy_quota_test
    FollowUpContent: wlyy_followup_content
    patientRemindRecord: wlyy_patient_remind_record
  host:  http://172.19.103.68:9200
  tHost: 172.19.103.68:9300
  clusterName: jkzl

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

@ -118,10 +118,12 @@ es:
    HealthEduArticlePatient: wlyy_quota_test
    FollowUp: wlyy_followup
    Statistics: wlyy_quota_test
    patientRemindRecord: wlyy_patient_remind_record
  type:
    HealthEduArticlePatient: wlyy_quota_test
    Statistics: wlyy_quota_test
    FollowUpContent: wlyy_followup_content
    patientRemindRecord: wlyy_patient_remind_record
  host:  http://172.19.103.68:9200
  tHost: 172.19.103.68:9300
  clusterName: jkzl

+ 2 - 0
patient-co/patient-co-wlyy-job/src/main/resources/application-test.yml

@ -124,10 +124,12 @@ es:
    HealthEduArticlePatient: health_edu_article_patient_test
    FollowUp: wlyy_followup
    Statistics: wlyy_quota_test
    patientRemindRecord: wlyy_patient_remind_record
  type:
    HealthEduArticlePatient: health_edu_article_patient_test
    FollowUpContent: wlyy_followup_content
    Statistics: wlyy_quota_test
    patientRemindRecord: wlyy_patient_remind_record
  host:  http://172.19.103.68:9200
  tHost: 172.19.103.68:9300
  clusterName: jkzl

+ 3 - 0
patient-co/patient-co-wlyy-job/src/main/resources/system.properties

@ -140,6 +140,9 @@ patient_medicare_number_job=0 0 6 * * ?
# 获取儿童可预约疫苗,每天凌晨1点执行一次
child_immune_vaccin_job=0 0 1 * * ?
# 提醒具名儿童可预约疫苗,每天9点执行一次
alert_child_immune_vaccin_job=0 0 9 * * ?
#统一支付平台支付成功后页面跳转地址
return_url={server}/wx/html/qygl/html/pay_result.html
#统一支付平台支付接口地址

+ 3 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/health/repository/DevicePatientHealthIndexDao.java

@ -112,4 +112,7 @@ public interface DevicePatientHealthIndexDao
	@Query("select count(a) from DevicePatientHealthIndex a where a.recordDate >= ?1 and a.recordDate <= ?2 and a.type in (1,2) and a.status = ?3 and a.del = '1' and user = ?4")
	int getCountByTimeAndStatus(Date start, Date end, int status, String patientCode);
}

+ 4 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/imm/ChildImmuneVaccinDao.java

@ -14,7 +14,7 @@ import java.util.List;
 */
public interface ChildImmuneVaccinDao extends PagingAndSortingRepository<ChildImmuneVaccin, Long>,
		JpaSpecificationExecutor<ChildImmuneVaccin> {
	@Query("select p from ChildImmuneVaccin p where p.barcode=?1")
	@Query("select p from ChildImmuneVaccin p where p.barcode=?1 and p.del=0")
	List<ChildImmuneVaccin> getChildImmuneVaccinByBarcode(String barcode);
	List<ChildImmuneVaccin> findByBarcodeAndYmbmAndJzzc(String barcode,String ymbm,String jzzc);
@ -32,4 +32,7 @@ public interface ChildImmuneVaccinDao extends PagingAndSortingRepository<ChildIm
	@Modifying
	@Query("update ChildImmuneVaccin  c set c.alert_tag=?2 where c.code=?1")
	int updateAlertTagByCode(String code,int tag);
	@Query("select p from ChildImmuneVaccin p where p.barcode=?1 and p.del=0 and p.ymsx=1")
	List<ChildImmuneVaccin> getChildImmuneVaccinByBarcodeAndYmsx(String barcode);
}

+ 2 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/message/MessageService.java

@ -279,6 +279,7 @@ public class MessageService extends BaseService {
            specialistMesJson.put("amount", 0);
        }
        //系统服务
        List<Message> synergyList = new ArrayList<>();
        synergyList = messageDao.getSynergyService(doctor);
        JSONObject synergyMesJson = new JSONObject();
@ -287,7 +288,7 @@ public class MessageService extends BaseService {
            JSONObject  synergyJson = new JSONObject();
            synergyJson.put("title", synergyList.get(0).getTitle());
            synergyJson.put("type", synergyList.get(0).getType());
            synergyJson.put("msg", "您有"+synergyList.size()+"个专科服务消息,请查看!");
            synergyJson.put("msg", "您有"+synergyList.size()+"个协同服务消息,请查看!");
            synergyJson.put("msgTime", DateUtil.dateToStrLong(synergyList.get(0).getCreateTime()));
            synergyMesJson.put("lastMessage", synergyJson);
        }else{

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

@ -190,7 +190,7 @@ public class ChildFamilyImmuneService extends BaseService {
	 * @return
	 */
	public List<ChildImmuneVaccin> getChildImmuneVaccinByBarcode(String barcode){
		return childImmuneVaccinDao.getChildImmuneVaccinByBarcode(barcode);
		return childImmuneVaccinDao.getChildImmuneVaccinByBarcodeAndYmsx(barcode);
	}

+ 4 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/specialist/SpecialistEvaluateSevice.java

@ -193,7 +193,10 @@ public class SpecialistEvaluateSevice extends BaseService {
            if(StringUtils.isNotEmpty(hospitalCode)){
                hospital = hospitalDao.findByCode(hospitalCode);
            }
            Patient patient = patientDao.findByCode(patientCode);
            Patient patient = null;
            if (StringUtils.isNoneBlank(patientCode)){
                patient  = patientDao.findByCode(patientCode);
            }
//            Doctor sendDoctor = doctorDao.findByCode(message.getSender());
            Doctor receiverDoctor = doctorDao.findByCode(message.getReceiver());
            if (message.getType() == 19 ){

+ 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());

+ 13 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/synergy/SynergyManageService.java

@ -3,11 +3,13 @@ package com.yihu.wlyy.service.synergy;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.education.HealthEduArticle;
import com.yihu.wlyy.entity.followup.Followup;
import com.yihu.wlyy.entity.organization.Hospital;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.education.HealthEduArticleDao;
import com.yihu.wlyy.repository.followup.FollowUpDao;
import com.yihu.wlyy.repository.organization.HospitalDao;
import com.yihu.wlyy.repository.patient.PatientDao;
@ -50,6 +52,8 @@ public class SynergyManageService extends BaseService {
    private FollowUpDao followUpDao;
    @Autowired
    private HospitalDao hospitalDao;
    @Autowired
    private HealthEduArticleDao healthEduArticleDao;
    public JSONObject getWorkOrderInfo(String workorderCode, String patient, Integer role) throws Exception {
        Map<String, Object> param = new HashedMap();
@ -127,10 +131,17 @@ public class SynergyManageService extends BaseService {
            followup.setCreateTime(new Date());
            followup = followUpDao.save(followup);
            object.put("relationCode",followup.getId());
            object.put("relationCodeName","随访");
            if (followupClass.equals("1")){
                object.put("relationCodeName","高血压");
            }else if (followupClass.equals("1")){
                object.put("relationCodeName","糖尿病");
            }
        }else if (type == 1){
            object.put("relationCode",objectId);
            object.put("relationCodeName","健康教育");
            HealthEduArticle healthEduArticle = healthEduArticleDao.findByCode(objectId);
            if (healthEduArticle != null){
                object.put("relationCodeName",healthEduArticle.getTitle());
            }
        }else if (type == 5){
            object.put("relationCode",objectId);
            object.put("relationCodeName","疾病筛查");

+ 6 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jkEduArticle/ThirdJkEduArticleService.java

@ -414,8 +414,12 @@ public class ThirdJkEduArticleService extends BaseService {
        try {
            JSONObject param = new JSONObject();
            param.put("articleId", articleId);
            param.put("userId", userId);
            param.put("userType", userType);
            if(!StringUtils.isEmpty(userId)){
                param.put("userId", userId);
            }
            if(!StringUtils.isEmpty(userType)){
                param.put("userType", userType);
            }
            String response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(getArticalById, param.toString(), "1"));
            json = JSON.parseObject(response);
            if("1".equals(userType)&&!org.apache.commons.lang.StringUtils.isEmpty(messageCode)){

+ 26 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/ZyDictService.java

@ -1,8 +1,10 @@
package com.yihu.wlyy.service.third.jw;
import com.yihu.device.entity.DevicePatientHealthIndex;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.organization.Hospital;
import com.yihu.wlyy.entity.zydict.ZyIvPhysicDict;
import com.yihu.wlyy.health.repository.DevicePatientHealthIndexDao;
import com.yihu.wlyy.repository.doctor.DoctorMappingDao;
import com.yihu.wlyy.repository.organization.HospitalDao;
import com.yihu.wlyy.repository.organization.HospitalMappingDao;
@ -11,10 +13,14 @@ import com.yihu.wlyy.repository.zydict.ZyIvPhysicDictDao;
import com.yihu.wlyy.repository.zydict.ZyZoneDictDao;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -39,6 +45,8 @@ public class ZyDictService {
    private ZyCommonDictDao zyCommonDictDao;
    @Autowired
    private ZyZoneDictDao zyZoneDictDao;
    @Autowired
    private DevicePatientHealthIndexDao patientHealthIndexDao;
    @Transactional
    public void synchronousDict(String dictName) {
@ -312,4 +320,22 @@ public class ZyDictService {
    }
    public List<DevicePatientHealthIndex> findByPatient(String patient){
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
        Date date = new Date();
        String sql = "select * from wlyy_patient_health_index a where a.user = '"+patient+"' and a.type = 3";
        String sql1 = "select * from wlyy_patient_health_index a where a.user = '"+patient+"' and a.type = 2 and DATE_FORMAT(a.czrq, '%Y-%m-%d') = '"+formatter.format(date)+"'";
        List<DevicePatientHealthIndex> devicePatientHealthIndices = jdbcTemplate.query(sql,new BeanPropertyRowMapper(DevicePatientHealthIndex.class));
        List<DevicePatientHealthIndex> devicePatientHealthIndices1 = jdbcTemplate.query(sql1,new BeanPropertyRowMapper(DevicePatientHealthIndex.class));
        List<DevicePatientHealthIndex> devicePatientHealthIndices2 = new ArrayList<>();
        for (DevicePatientHealthIndex devicePatientHealthIndex:devicePatientHealthIndices){
            devicePatientHealthIndices2.add(devicePatientHealthIndex);
        }
        for (DevicePatientHealthIndex devicePatientHealthIndex:devicePatientHealthIndices1){
            devicePatientHealthIndices2.add(devicePatientHealthIndex);
        }
        return devicePatientHealthIndices2;
    }
}

+ 14 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/CommonUtil.java

@ -16,6 +16,8 @@ import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -639,4 +641,16 @@ public class CommonUtil {
        
        return fileUrls.substring(0,fileUrls.length()-1);
    }
    public void deleteFile(String storagePath,HttpServletRequest request, HttpServletResponse response) throws Exception{
        String url = neiwangWlyy + request.getRequestURI();//uri请求路径 http://172.19.103.88/wlyy/upload/deleteFile
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("storagePath", storagePath));
        String result = httpClientUtil.post(url, params, "UTF-8");
        JSONObject jsonObject = new JSONObject(result);
        Integer status = (Integer)jsonObject.get("status");
        if(status!=200){
            throw new Exception();
        }
    }
}

+ 18 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/fastdfs/FastDFSUtil.java

@ -272,8 +272,8 @@ public class FastDFSUtil {
    /**
     * 删除文件。
     *
     * @param groupName
     * @param remoteFileName
     * @param groupName 组名 如:group1
     * @param remoteFileName 不带组名的路径名称 如:M00/00/00/wKgRsVjtwpSAXGwkAAAweEAzRjw471.jpg
     */
    public static void delete(String groupName, String remoteFileName) throws IOException, MyException {
@ -284,4 +284,20 @@ public class FastDFSUtil {
            FastDFSClientPool.getInstance().releaseStorageClient(client);
        }
    }
    /**
     *
     * @param storagePath 文件的全部路径 如:group1/M00/00/00/wKgRsVjtwpSAXGwkAAAweEAzRjw471.jpg
     * @throws IOException
     * @throws MyException
     */
    public static void delete(String storagePath) throws Exception {
        if(!storagePath.startsWith("group")){
            throw new Exception();
        }
        String[] temp = storagePath.split("/");
        String groupName = temp[0];
        String remoteFileName = storagePath.substring(storagePath.indexOf("/")+1);
        delete(groupName, remoteFileName);
    }
}

+ 21 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/FileUploadController.java

@ -641,4 +641,25 @@ public class FileUploadController extends BaseController {
//
//
//    }
    @RequestMapping(value = "deleteFile", method = RequestMethod.POST  /*,headers = "Accept=image/png"*/ )
    @ResponseBody
    public String deleteFile(@ApiParam(name="storagePath",value="文件的全部路径 如:group1/M00/00/00/wKgRsVjtwpSAXGwkAAAweEAzRjw471.jpg",required = true)
                             @RequestParam(required = true)String storagePath,HttpServletRequest request, HttpServletResponse response){
        try {
            if (isneiwang) {
                fastDFSUtil.delete(storagePath);
            }else{
                CommonUtil.deleteFile(storagePath,request,response);
            }
            JSONObject json = new JSONObject();
            json.put("status", 200);
            json.put("msg", "删除成功");
            return json.toString();
        }catch (Exception e){
            error(e);
            return error(-1, "删除失败");
        }
    }
}

+ 2 - 14
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/imm/DoctorImmController.java

@ -143,19 +143,7 @@ public class DoctorImmController extends BaseController {
			return error(-1, "查询失败");
		}
	}
	
	@RequestMapping(value = "/alertImmVacclinByPatient", method = RequestMethod.POST)
	@ApiOperation(value = "医生提醒单个居民疫苗接种")
	public String alertImmVacclinByPatient(@ApiParam(name = "barcode", value = "儿童免疫条码", defaultValue = "")
	                                      @RequestParam(value = "barcode", required = true) String barcode){
		try {
			// TODO: 2018/6/21
			return write(200, "请求成功");
		} catch (Exception e) {
			e.printStackTrace();
			return error(-1, "查询失败");
		}
	}
	@RequestMapping(value = "/alertImmVacclinByChildInfoCodes", method = RequestMethod.POST)
	@ApiOperation(value = "医生提醒居民疫苗接种")
@ -171,7 +159,7 @@ public class DoctorImmController extends BaseController {
	}
	@RequestMapping(value = "/alertImmVacclinByChildInfoCode", method = RequestMethod.POST)
	@ApiOperation(value = "医生提醒居民疫苗接种")
	@ApiOperation(value = "医生提醒居民疫苗接种(作废)")
	public String alertImmVacclinByChildInfoCode(@ApiParam(name = "alertDataJsonStr", value = "{\"childCode\":\"123\",\"childName\":\"张三\",\"vaccinCode\":\"asd123\",\"vaccinName\":\"疫苗名称\"}", defaultValue = "")
												  @RequestParam(value = "alertDataJsonStr", required = true) String alertDataJsonStr){
		try {

+ 37 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/jimeiJkEdu/DoctorJMJkEduArticleController.java

@ -350,24 +350,55 @@ public class DoctorJMJkEduArticleController extends BaseController {
            if (patientSet.size() == 0) {
                return new BaseResultModel("请至少选择一个患者!");
            }
            //推送微信模板消息和发送im消息
            if(StringUtils.isEmpty(currentUserRole)){
                currentUserRole = getCurrentRoleCode();
            }
            if(StringUtils.isEmpty(currentUserRoleLevel)){
                currentUserRoleLevel = getCurrentRoleLevel();
            }
            List<HealthEduArticleES> healthEduArticleESList = jmJkEduArticleService.savePCPushArticle(patientSet, getUID(), Integer.parseInt(sendType),"", teamCode, articleId,leaveWords,currentUserRole,currentUserRoleLevel);
            //推送微信模板消息和发送im消息
            new Thread(() -> {
                //发送任务到redis
                sender(healthEduArticleESList);
            }).start();
//            List<HealthEduArticleES> healthEduArticleESList = jmJkEduArticleService.savePCPushArticle(patientSet, getUID(), Integer.parseInt(sendType),"", teamCode, articleId,leaveWords,currentUserRole,currentUserRoleLevel);
//            new Thread(() -> {
//                //发送任务到redis
//                sender(healthEduArticleESList);
//            }).start();
            new Thread(new HealthEduArticleESTask(patientSet,sendType,teamCode,articleId,leaveWords,currentUserRole,currentUserRoleLevel,getUID())).start();
            return new BaseResultModel();
        } catch (Exception e) {
            error(e);
            return new BaseResultModel(BaseResultModel.statusEm.opera_error.getCode(), BaseResultModel.statusEm.opera_error.getMessage() + ":" + e.getMessage());
        }
    }
    class HealthEduArticleESTask implements Runnable {
        Set<String> patientSet;
        String sendType;
        Long teamCode;
        String articleId;
        String leaveWords;
        String currentUserRole;
        String currentUserRoleLevel;
        String sendCode;
        public HealthEduArticleESTask(Set<String> patientSet,String sendType,Long teamCode,String articleId,String leaveWords,String currentUserRole,String currentUserRoleLevel,String sendCode)  {
            this.patientSet=patientSet;
            this.sendType=sendType;
            this.teamCode=teamCode;
            this.articleId=articleId;
            this.leaveWords=leaveWords;
            this.currentUserRole=currentUserRole;
            this.currentUserRoleLevel=currentUserRoleLevel;
            this.sendCode=sendCode;
        }
        @Override
        public void run() {
            try{
                List<HealthEduArticleES> healthEduArticleESList = jmJkEduArticleService.savePCPushArticle(patientSet, sendCode, Integer.parseInt(sendType),"", teamCode, articleId,leaveWords,currentUserRole,currentUserRoleLevel);
                //发送任务到redis
                sender(healthEduArticleESList);
            }catch (Exception e){
                error(e);
            }
        }
    }
    @RequestMapping(value = "doctorSendArticleToSingle", method = RequestMethod.POST)

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

@ -2,11 +2,18 @@ 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.jkEduArticle.ThirdJkEduArticleService;
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 +23,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 +42,14 @@ public class SynergyManagerController extends BaseController{
    private ManagerQuestionnaireService managerQuestionnaireService;
    @Autowired
    private SurveyScreenResultService surveyScreenResultService;
    @Autowired
    private ZyDictService zyDictService;
    @Autowired
    private FollowupDrugsService followupDrugsService;
    @Autowired
    private SpecialistEvaluateSevice specialistEvaluateSevice;
    @Autowired
    private ThirdJkEduArticleService thirdJkEduArticleService;
    @ApiOperation("新增临时随访记录(返回ID)")
    @RequestMapping(value = "/addFollowup", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
@ -68,14 +87,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 +108,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 +209,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 +288,54 @@ 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.POST)
    @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, "获取消息失败!");
        }
    }
    @RequestMapping(value = "getArticalById",method = RequestMethod.GET)
    @ApiOperation("获取文章详情")
    public String getArticalById(@ApiParam(name = "articleId", value = "文章id")
                                 @RequestParam(value = "articleId", required = true) String articleId){
        try {
            com.alibaba.fastjson.JSONObject response = thirdJkEduArticleService.getArticalById(articleId,null,null);
            return write(200,"查询成功!","data",response);
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"查询失败!");
        }
    }
}

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

@ -52,7 +52,7 @@ rehabilitation:
  url: http://localhost:10055/svr-wlyy-rehabilitation/
#集美客服配置
customerService:
  url: http://localhost:8180/
  url: http://localhost:8082/
#小程序
applets:

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

@ -48,8 +48,10 @@ healthBank:
rehabilitation:
  url: http://localhost:10055/svr-rehabilitation/
#集美客服配置
#customerService:
#  url: http://172.19.103.72:8080/customer-service/
customerService:
  url: http://172.19.103.72:8080/customer-service/
  url: http://www.xmtyw.cn/wlyy/
#小程序
applets:
  appId: wx0e663ce069b5170c

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

@ -43,6 +43,8 @@ healthBank:
#康复计划配置
rehabilitation:
  url: http://localhost:10055/svr-rehabilitation/
customerService:
  url: http://172.19.103.88:9092/wlyy/
#小程序
applets:
  appId: wx0e663ce069b5170c
@ -86,7 +88,7 @@ wechat:
   #服务结果通知
   template_doctor_service:  2hEhp2bLfmM-7Goc6rJ3EE4a4wvuhyndKufruYTk6A0
   #体检报告提醒
   template_physical_examination:  tlsPJlgA90-I73j2QudyMG7C-LmrMn1lC4_UnJPyWSM·
   template_physical_examination:  tlsPJlgA90-I73j2QudyMG7C-LmrMn1lC4_UnJPyWSM
   #处理结果通知
   template_deal_with:  q9AiUpG7h2_4MUVE7iIKLV8lVwVaytTrHozqnkPGSes
   #设备绑定结果通知