Ver código fonte

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

Conflicts:
	common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionPay.java
trick9191 7 anos atrás
pai
commit
b82f2ffa3e
34 arquivos alterados com 767 adições e 660 exclusões
  1. 96 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/health/DoctorHealthStandard.java
  2. 1 1
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/PatientSchemeList.java
  3. 0 37
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionPay.java
  4. 29 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/vo/PatientCodeDeviceType.java
  5. 3 1
      patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/common/dao/PatientHealthIndexDao.java
  6. 8 0
      patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/model/Patient.java
  7. 71 1
      patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/service/DeviceService.java
  8. 66 8
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/ArchivesController.java
  9. 18 1
      patient-co-service/wlyy_service/src/main/resources/application.yml
  10. 13 8
      patient-co/patient-co-figure/src/main/java/com/yihu/figure/controller/patient/PortraitController.java
  11. 0 8
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/event/ApplicationEvent.java
  12. 1 1
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/DoctorFeldsherTemplateJob.java
  13. 0 57
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/PrescriptionPayQueryJob.java
  14. 1 1
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/patient/PatientSchemeListDao.java
  15. 0 8
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionPayDao.java
  16. 0 249
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/prescription/PatientPrescriptionPayService.java
  17. 0 17
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/web/quota/JobController.java
  18. 27 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/health/DoctorHealthStandardDao.java
  19. 1 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/PatientDeviceDao.java
  20. 4 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/PatientHealthStandardDao.java
  21. 4 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java
  22. 25 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/PatientHealthIndexService.java
  23. 111 48
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelInfoService.java
  24. 38 55
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/scheme/DoctorSchemeService.java
  25. 21 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/PatientService.java
  26. 63 33
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/fzzb/HealthEducationArticleService.java
  27. 0 21
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/ImUtill.java
  28. 0 44
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/im/imController.java
  29. 120 24
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthController.java
  30. 8 8
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthEduArticleController.java
  31. 7 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/SignPatientLabelInfoController.java
  32. 27 9
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/scheme/DoctroSchemeController.java
  33. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorSignController.java
  34. 3 8
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/ConsultController.java

+ 96 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/health/DoctorHealthStandard.java

@ -0,0 +1,96 @@
package com.yihu.wlyy.entity.doctor.health;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * 医生预警值方案
 * @author huangwenjie
 * @date 2017/9/14 21:08
 */
@Entity
@Table(name = "wlyy_doctor_health_standard")
public class DoctorHealthStandard extends IdEntity {
    private static final long serialVersionUID = -8343925049051333359L;
    // 患者标识
    private String doctor;
    // 健康指标类型:1血糖,2血压,3体重,4腰围
    private Integer type;
    // 最低安全值(血糖餐前\收缩压\体重\腰围)
    private Double minValue1;
    // 最高安全值(血糖餐前\收缩压\体重\腰围)
    private Double maxValue1;
    // 最低安全值(血糖餐后\舒张压)
    private Double minValue2;
    // 最高安全值(血糖餐后\舒张压)
    private Double maxValue2;
    // 设置时间
    private Date czrq;
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    @Column(name = "min_value_1")
    public Double getMinValue1() {
        return minValue1;
    }
    public void setMinValue1(Double minValue) {
        this.minValue1 = minValue;
    }
    @Column(name = "max_value_1")
    public Double getMaxValue1() {
        return maxValue1;
    }
    public void setMaxValue1(Double maxValue) {
        this.maxValue1 = maxValue;
    }
    @Column(name = "min_value_2")
    public Double getMinValue2() {
        return minValue2;
    }
    public void setMinValue2(Double minValue) {
        this.minValue2 = minValue;
    }
    @Column(name = "max_value_2")
    public Double getMaxValue2() {
        return maxValue2;
    }
    public void setMaxValue2(Double maxValue) {
        this.maxValue2 = maxValue;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCzrq() {
        return czrq;
    }
    public void setCzrq(Date czrq) {
        this.czrq = czrq;
    }
}

+ 1 - 1
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/PatientSchemeList.java

@ -16,7 +16,7 @@ public class PatientSchemeList extends IdEntity {
    private String code;
    private String patientcode;
    private String schemecode;
    private Short type;//方案类型:0为血压,1为血糖
    private Short type;//方案类型:1为血糖,2为血压
    private String doctorcode;
    private Timestamp createTime;

+ 0 - 37
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionPay.java

@ -58,43 +58,6 @@ public class PrescriptionPay extends IdEntity {
    private String mxlist;//处方明细
    private Date createTime;//续方确认支付时间
    private Date czrq;//续方记录最后操作时间
    //    易联众新增查询返回字段v1.3.7
//    private String medOrgNo;//医疗机构编号
//    private String medOrgName;//医疗机构名称
//    private Date traceTime;//交易成功时间
//    private String traceNo;//支付平台跟踪号
//    public Date getTraceTime() {
//        return traceTime;
//    }
//
//    public void setTraceTime(Date traceTime) {
//        this.traceTime = traceTime;
//    }
//
//    public String getTraceNo() {
//        return traceNo;
//    }
//
//    public void setTraceNo(String traceNo) {
//        this.traceNo = traceNo;
//    }
//
//    public String getMedOrgNo() {
//        return medOrgNo;
//    }
//
//    public void setMedOrgNo(String medOrgNo) {
//        this.medOrgNo = medOrgNo;
//    }
//
//    public String getMedOrgName() {
//        return medOrgName;
//    }
//
//    public void setMedOrgName(String medOrgName) {
//        this.medOrgName = medOrgName;
//    }
    public Integer getAccountBalance() {
        return accountBalance;

+ 29 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/vo/PatientCodeDeviceType.java

@ -0,0 +1,29 @@
package com.yihu.wlyy.entity.patient.vo;
/**
 * 患者CODE,设备类型VO类
 * @author huangwenjie
 * @date 2017/9/14 22:44
 */
public class PatientCodeDeviceType {
    private String user;            //患者CODE
    private Integer deviceType;     //患者设备类型
    public String getUser() {
        return user;
    }
    public void setUser(String user) {
        this.user = user;
    }
    public Integer getDeviceType() {
        return deviceType;
    }
    public void setDeviceType(Integer deviceType) {
        this.deviceType = deviceType;
    }
}

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

@ -51,5 +51,7 @@ public interface PatientHealthIndexDao
	@Query("select a from PatientHealthIndex a where a.user = ?1 and a.deviceSn = ?2 and a.value1 = ?3 and a.type = ?4 and a.recordDate = ?5 and a.del = '1' ")
	List<PatientHealthIndex> findByType(String patient, String deviceSn, String value1, Integer type, Date recordDate);
	
	@Query("select a from PatientHealthIndex a where a.user = ?1 and a.type =?2  order by recordDate desc ")
    List<PatientHealthIndex> findByPatientAndType(String patientCode, String diseaseType, Pageable pageable);
}

+ 8 - 0
patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/model/Patient.java

@ -325,4 +325,12 @@ public class Patient extends IdEntity implements Serializable {
	public static long getSerialVersionUID() {
		return serialVersionUID;
	}
	public Integer getStandardStatus() {
		return standardStatus;
	}
	public void setStandardStatus(Integer standardStatus) {
		this.standardStatus = standardStatus;
	}
}

+ 71 - 1
patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/service/DeviceService.java

@ -19,6 +19,10 @@ import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
@ -390,6 +394,59 @@ public class DeviceService {
                uploadHealthIndex(result);
                System.out.println(result);
                //连续5次体征值正常,则修改为非预警状态;连续5次异常,修改为预警状态-----START
                String patientCode = result.getUser();
                //患者信息
                Patient patient = patientDao.findByCode(patientCode);
                int bloodPressureBbnormalCount = 0;//血压异常次数
                int bloodSuggurBbnormalCount = 0;//血糖异常次数
                // 排序
                Sort sort = new Sort(Sort.Direction.DESC, "recordDate");
                // 分页信息
                Pageable pageRequest = new PageRequest(0, 5, sort);
                Pageable pageable = new PageRequest(1, 5);
                List<PatientHealthIndex> bloodPressurepatientHealthIndices = new ArrayList<>();
                List<PatientHealthIndex> bloodSuggurpatientHealthIndices = new ArrayList<>();
                if( 1 == patient.getDisease()){
                    bloodPressurepatientHealthIndices = patientHealthIndexDao.findByPatientAndType(patientCode,"2",pageable);
                } else if( 2 == patient.getDisease()){
                    bloodSuggurpatientHealthIndices = patientHealthIndexDao.findByPatientAndType(patientCode,"1",pageable);
                } else {
                    bloodPressurepatientHealthIndices = patientHealthIndexDao.findByPatientAndType(patientCode,"2",pageable);
                    bloodSuggurpatientHealthIndices = patientHealthIndexDao.findByPatientAndType(patientCode,"1",pageable);
                }
                for (PatientHealthIndex patientHealthIndex : bloodPressurepatientHealthIndices) {
                    if(1 == patientHealthIndex.getStatus()){
                        bloodPressureBbnormalCount++;
                    }
                }
                for (PatientHealthIndex patientHealthIndex : bloodSuggurpatientHealthIndices) {
                    if(1 == patientHealthIndex.getStatus()){
                        bloodSuggurBbnormalCount++;
                    }
                }
                //连续5次异常,修改用户为预警状态
                if( (5 == bloodPressureBbnormalCount || 5 == bloodSuggurBbnormalCount) && 0 == patient.getStandardStatus()){
                    patient.setStandardStatus(1);
                }
                //连续5次正常,修改用户为非预警状态
                if((0 == bloodPressureBbnormalCount && 0 == bloodSuggurBbnormalCount) && 1 == patient.getStandardStatus()){
                    patient.setStandardStatus(0);
                }
                //连续5次体征值正常,则修改为非预警状态;连续5次异常,修改为预警状态-----END
            }
        } catch (Exception e) {
            e.printStackTrace();
@ -451,6 +508,7 @@ public class DeviceService {
            obj.setUser(user);
            obj.setIdcard(device.getUserIdcard());
            obj.setStatus(0);
            //  1血糖 2血压 3体重 4腰围
            switch (type) {
                case "1":
@ -485,7 +543,7 @@ public class DeviceService {
                default:
                    throw new Exception("Can not support the metric!");
            }
            patientHealthIndexDao.save(obj);
            obj = patientHealthIndexDao.save(obj);
            return obj;
        } else {
            DeviceInfo deviceInfo = new DeviceInfo();
@ -592,10 +650,18 @@ public class DeviceService {
            if (index % 2 == 0) {
                if (!checkHealthIndex(NumberUtils.toDouble(value1), maxValueBefore, minValueBefore)) {
                    msgContent += patient.getName() + "血糖异常(" + value1 + "mmol/L),请处理";
                    //体征异常,更新体征数据状态
                    data.setStatus(1);
                    patientHealthIndexDao.save(data);
                }
            } else { //餐前
                if (!checkHealthIndex(NumberUtils.toDouble(value1), maxValueAfter, minValueAfter)) {
                    msgContent += patient.getName() + "血糖异常(" + value1 + "mmol/L),请处理";
                    //体征异常,更新体征数据状态
                    data.setStatus(1);
                    patientHealthIndexDao.save(data);
                }
            }
        }
@ -626,6 +692,10 @@ public class DeviceService {
            // 收缩压/舒张压校验
            if (!checkHealthIndex(NumberUtils.toDouble(value1), maxValueSSY, minValueSSY) || !checkHealthIndex(NumberUtils.toDouble(value2), maxValueSZY, minValueSZY)) {
                msgContent = patient.getName() + "血压异常(舒张压 " + value2 + "mmHg、收缩压 " + value1 + "mmHg),请处理";
                //体征异常,更新体征数据状态
                data.setStatus(1);
                patientHealthIndexDao.save(data);
            }
        }

+ 66 - 8
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/ArchivesController.java

@ -8,16 +8,14 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
/**
 * 智业服务接口
 * */
@Controller
@RestController
@RequestMapping(value = "/third/archives/")
@Api(description = "智业档案服务接口")
public class ArchivesController {
@ -28,7 +26,6 @@ public class ArchivesController {
	/********************************* 居民档案相关接口 ****************************************************************/
	@RequestMapping(value = "getEhrSickMedicalList",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("查询居民健康体检列表信息接口")
	public Result getEhrSickMedicalList(
			@ApiParam(name="idcard",value="患者身份证",defaultValue = "350821201112240026")
@ -49,7 +46,6 @@ public class ArchivesController {
	}
	@RequestMapping(value = "getEhrSickMedicalRecord",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("查询居民健康体检详情接口")
	public Result getEhrSickMedicalRecord(
			@ApiParam(name="medicalNo",value="体检ID",defaultValue = "")
@ -70,7 +66,6 @@ public class ArchivesController {
	}
	@RequestMapping(value = "uploadFollowup",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("上传随访记录接口")
	public Result uploadFollowup(@ApiParam(name="id",value="随访记录id",defaultValue = "4")
								  @RequestParam(value="id",required = true) Long id){
@ -90,7 +85,6 @@ public class ArchivesController {
	}
	@RequestMapping(value = "uploadHealthIndex",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("上传体征指标接口")
	public Result uploadHealthIndex(@ApiParam(name="id",value="体征记录id",defaultValue = "5226")
									 @RequestParam(value="id",required = true) Long id){
@ -108,4 +102,68 @@ public class ArchivesController {
			}
		}
	}
	/*****************************************自助建档***************************************************/
	@RequestMapping(value = "getSickArchiveFlag",method = RequestMethod.POST)
	@ApiOperation("查询居民是否有建立健康档案接口")
	public Result getSickArchiveFlag(
			@ApiParam(name="idcard",value="身份证号",defaultValue = "")
			@RequestParam(value="idcard",required = true) String idcard){
		try {
			String response = archivesService.getSickArchiveFlag(idcard);
			return Result.success("查询居民是否有建立健康档案接口成功!",response);
		} catch (Exception ex) {
			if(ex instanceof ApiException)
			{
				ApiException apiEx = (ApiException) ex;
				return Result.error(apiEx.errorCode(),ex.getMessage());
			}
			else{
				return Result.error(ex.getMessage());
			}
		}
	}
	@RequestMapping(value = "getSickArchiveRecord",method = RequestMethod.POST)
	@ApiOperation("查询居民健康档案信息接口")
	public Result getSickArchiveRecord(
			@ApiParam(name="idcard",value="身份证号",defaultValue = "")
			@RequestParam(value="idcard",required = true) String idcard){
		try {
			String response = archivesService.getSickArchiveRecord(idcard);
			return Result.success("查询居民健康档案信息接口!",response);
		} catch (Exception ex) {
			if(ex instanceof ApiException)
			{
				ApiException apiEx = (ApiException) ex;
				return Result.error(apiEx.errorCode(),ex.getMessage());
			}
			else{
				return Result.error(ex.getMessage());
			}
		}
	}
	@RequestMapping(value = "saveSickArchiveRecord",method = RequestMethod.POST)
	@ApiOperation("上传居民档案建档信息接口")
	public Result saveSickArchiveRecord(@ApiParam(name="json",value="居民建档信息",defaultValue = "")
										@RequestParam(value="json",required = true) String json,
										@ApiParam(name="doctor",value="医生code",defaultValue = "")
										@RequestParam(value="doctor",required = true) String doctor){
		try {
			String response = archivesService.saveSickArchiveRecord(json,doctor);
			return Result.success("上传居民档案建档信息接口!",response);
		} catch (Exception ex) {
			if(ex instanceof ApiException)
			{
				ApiException apiEx = (ApiException) ex;
				return Result.error(apiEx.errorCode(),ex.getMessage());
			}
			else{
				return Result.error(ex.getMessage());
			}
		}
	}
}

+ 18 - 1
patient-co-service/wlyy_service/src/main/resources/application.yml

@ -75,10 +75,27 @@ im:
  data_base_name: im_new
---
spring:
  profiles: test
  profiles: devtest
  datasource:
#    url: jdbc:mysql://172.17.110.160:3306/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
    url: jdbc:mysql://172.19.103.85:3306/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
    username: linzhou
    password: linzhou
    driverClassName: com.mysql.jdbc.Driver
    maxTotal: 500
    maxIdle: 30
  redis:
    host: 172.19.103.88 # Redis server host.
    port: 6379 # Redis server port.
#    password: jkzl_ehr
im:
  data_base_name: im_new
---
spring:
  profiles: test
  datasource:
    url: jdbc:mysql://172.17.110.160:3306/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
    username: ssgg
    password: ssgg
    driverClassName: com.mysql.jdbc.Driver

+ 13 - 8
patient-co/patient-co-figure/src/main/java/com/yihu/figure/controller/patient/PortraitController.java

@ -188,7 +188,9 @@ public class PortraitController extends BaseController {
            returnjo.put("data",return1);
            String name=getNameAgeByKey(value,return1);
            System.out.println("name==="+name);
            returnjo.put("message",name);
            System.out.println("returnjo==="+returnjo.toString());
//            List<SystemDict> systemDicts = systemDictService.getDictByDictName(name);
//            if(systemDicts!=null&&systemDicts.size()==1){
//                returnjo.put("message",systemDicts.get(0).getValue());//文字
@ -204,7 +206,7 @@ public class PortraitController extends BaseController {
    private String getNameAgeByKey(String value,JSONObject return1) {
//        DecimalFormat df   = new DecimalFormat("######0.00");
//
//        String message="针对全市区域高血压患者年龄段分布情况来看,高血压患者主要集中在{big}," +
        String message="针对全市区域{disease}患者年龄段分布情况来看,{disease}患者主要集中在{big}岁。" ;
//                "{Big65}%{disease}患者在65岁以上," +
//                "{between40_65}%{disease}患者在40-65岁," +
//                "{between20_40}%{disease}患者在20-40岁," +
@ -231,12 +233,14 @@ public class PortraitController extends BaseController {
//        }
        switch (value){
            case "高血压":{
//                message=message.replace("{disease}","高血压");
                return "针对全市区域高血压患者年龄段分布情况来看,高血压患者主要集中在40-65岁。根据区域性别分布比例来看,女性高血压患病几率较高。";
                message=message.replace("{disease}","高血压");
                message=message.replace("{big}","65岁以上");
                return message;
            }
            case "糖尿病":{
//                message=message.replace("{disease}","糖尿病");
                return "针对全市区域糖尿病患者年龄段分布情况来看,糖尿病患者主要集中在40-65岁。根据区域性别分布比例来看,女性糖尿病患病几率较高。";
                message=message.replace("{disease}","糖尿病");
                message=message.replace("{big}","40-65岁");
                return message;
            }
        }
        return "";
@ -276,11 +280,12 @@ public class PortraitController extends BaseController {
    private String getNameSexByKey(String value,JSONObject return1) {
        DecimalFormat df   = new DecimalFormat("######0.00");
        String message="根据区域性别分布比例来看,{sex}性{disease}患病几率较高,分别是男性患糖尿病比例为{arg1}%,女性患糖尿病比例为{arg2}%。";
//        String message="根据区域性别分布比例来看,{sex}性{disease}患病几率较高,分别是男性患糖尿病比例为{arg1}%,女性患糖尿病比例为{arg2}%。";
        String message="根据区域性别分布比例来看,{sex}性{disease}患病几率较高。";
        Double boy=return1.getDouble("男");
        Double girl=return1.getDouble("女");
        message=message.replace("{arg1}",df.format(boy*100));
        message=message.replace("{arg2}",df.format(girl*100));
//        message=message.replace("{arg1}",df.format(boy*100));
//        message=message.replace("{arg2}",df.format(girl*100));
        if(boy>girl){
            message=message.replace("{sex}","男");
        }else{

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

@ -98,14 +98,6 @@ public class ApplicationEvent implements ApplicationListener<ContextRefreshedEve
                logger.info("zy_execute_sick_settle_job reorder job job exist");
            }
            //处理当天支付,页面回调及异步回调失败的支付,每3分钟一次去主动查询并保存
            if (!quartzHelper.isExistJob("prescription_pay_query_job")) {
                String trigger = SystemConf.getInstance().getSystemProperties().getProperty("prescription_pay_query_job");
                quartzHelper.addJob(PrescriptionPayQueryJob.class, trigger, "prescription_pay_query_job", new HashMap<String, Object>());
                logger.info("prescription_pay_query_job reorder job job success");
            } else {
                logger.info("prescription_pay_query_job reorder job job exist");
            }
            //居民24小时未回复的咨询自动关闭 每小时59分开始执行一次
            if (!quartzHelper.isExistJob("finish_consult_job")) {
                String trigger = SystemConf.getInstance().getSystemProperties().getProperty("finish_consult_job");

+ 1 - 1
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/DoctorFeldsherTemplateJob.java

@ -235,7 +235,7 @@ public class DoctorFeldsherTemplateJob implements Job {
        Date today = new Date();
        if (minutes <= 30 && minutes > 0) {
            PatientSchemeList patient = schemeListDao.findPatientBySchemecode(schemecode, (short) 1);
            PatientSchemeList patient = schemeListDao.findPatientBySchemecode(schemecode, (short) type);
            String patientCode = patient.getPatientcode();
            String day = formatDay.format(today);

+ 0 - 57
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/PrescriptionPayQueryJob.java

@ -1,57 +0,0 @@
package com.yihu.wlyy.job;
import com.yihu.wlyy.repository.prescription.PrescriptionPayDao;
import com.yihu.wlyy.service.app.prescription.PatientPrescriptionPayService;
import com.yihu.wlyy.service.app.prescription.PrescriptionService;
import com.yihu.wlyy.service.third.jw.JwPrescriptionService;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
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;
import java.util.List;
/**
 * 处理当天支付,页面回调及异步回调失败的支付,每3分钟一次去主动查询并保存
 * Created by Reece on 2017/8/29/029.
 */
public class PrescriptionPayQueryJob implements Job {
    private static final Logger logger = LoggerFactory.getLogger(PrescriptionPayQueryJob.class);
    @Autowired
    private PrescriptionPayDao prescriptionPayDao;
    @Autowired
    private PatientPrescriptionPayService payService;
    @Autowired
    WeiXinAccessTokenUtils weiXinAccessTokenUtils;
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        logger.info("PrescriptionPayQueryJob start ..........");
        try {
            String accesstoken =  weiXinAccessTokenUtils.getAccessToken();
            //获取支付完成,院内结算失败的 处方CODE 集合
            List<String> prescriptionCodeList = prescriptionPayDao.findTodayUnpay();
            if (!prescriptionCodeList.isEmpty()) {
                for (String code : prescriptionCodeList) {
                    try {
                        payService.chargeQuery(code,accesstoken);
                    } catch (Exception e) {
                        logger.info("PrescriptionPayQueryJob error ..........continue this JOB,CODE:" + code + ",message:" + e.getMessage());
                        continue;
                    }
                }
            }
            logger.info("PrescriptionPayQueryJob end ..........");
        } catch (Exception e) {
            e.printStackTrace();
            logger.info("PrescriptionPayQueryJob error ..........,message:" + e.getMessage());
        }
    }
}

+ 1 - 1
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/patient/PatientSchemeListDao.java

@ -18,7 +18,7 @@ public interface PatientSchemeListDao extends PagingAndSortingRepository<Patient
    List<DoctorSchemeBloodSugger> findSuggerPatient();
    //联合wlyy_patient_scheme_list和wlyy_doctor_scheme_blood_pressure查询有血压监测方案且在监测时间前十分钟未上传监测数据
    @Query(" select s from PatientSchemeList p,DoctorSchemeBloodPressure s where p.schemecode=s.code and p.type=0 and s.alertTag = 1 ")
    @Query(" select s from PatientSchemeList p,DoctorSchemeBloodPressure s where p.schemecode=s.code and p.type=2 and s.alertTag = 1 ")
    List<DoctorSchemeBloodPressure> findPressurePatient();
    //根据schemecode查询患者监测方案

+ 0 - 8
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionPayDao.java

@ -13,12 +13,4 @@ import java.util.List;
public interface PrescriptionPayDao extends PagingAndSortingRepository<PrescriptionPay, Long>, JpaSpecificationExecutor<PrescriptionPay> {
    @Query("from PrescriptionPay p where p.prescriptionCode=?1 ")
    PrescriptionPay findByPrescriptionPay(String prescriptionCode);
    //查询支付记录
    @Query("from PrescriptionPay p where p.code=?1 ")
    PrescriptionPay findByCode(String code);
    //   查询当天支付,页面回调及异步回调均失败的支付 tradeStatus为空
    @Query(value = "SELECT t.`code` FROM wlyy_prescription_pay t WHERE t.trade_status is null AND t.create_time >= date(now()) AND t.create_time < DATE_ADD(date(now()), INTERVAL 1 DAY)", nativeQuery = true)
    List<String> findTodayUnpay();
}

+ 0 - 249
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/prescription/PatientPrescriptionPayService.java

@ -1,249 +0,0 @@
package com.yihu.wlyy.service.app.prescription;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.entity.organization.Hospital;
import com.yihu.wlyy.entity.organization.HospitalMapping;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.prescription.*;
import com.yihu.wlyy.entity.ylz.PayConfigura;
import com.yihu.wlyy.entity.zydict.ZyPushLog;
import com.yihu.wlyy.repository.charge.ChargeDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.repository.organization.HospitalDao;
import com.yihu.wlyy.repository.organization.HospitalMappingDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
import com.yihu.wlyy.repository.prescription.PrescriptionExpressageDao;
import com.yihu.wlyy.repository.prescription.PrescriptionInfoDao;
import com.yihu.wlyy.repository.prescription.PrescriptionPayDao;
import com.yihu.wlyy.repository.ylz.PayConfiguraDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.SystemConf;
import com.ylzinfo.onepay.sdk.OnepayDefaultClient;
import com.ylzinfo.onepay.sdk.domain.RequestParams;
import com.ylzinfo.onepay.sdk.domain.ResponseParams;
import com.ylzinfo.onepay.sdk.utils.DateUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.StreamUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.transaction.Transactional;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.nio.charset.Charset;
import java.text.SimpleDateFormat;
import java.util.*;
/**
 * Created by Reece on 2017/7/28/028.
 * 患者支付
 */
@Service
public class PatientPrescriptionPayService extends BaseService {
    private Logger logger=LoggerFactory.getLogger(PatientPrescriptionPayService.class);
    //公共配置文件
    Properties systemConf = SystemConf.getInstance().getSystemProperties();
    //    各环境对应配置
    @Value("${server.server_url}")
    private String serverUrl;
    @Value("${wechat.accId}")
    private String accId;
    //    Java配置文件 后续删除
    private String signType = "MD5";
    private String encryptType = "AES";
    //    引入实例
    @Autowired
    private PayConfiguraDao configuraDao;
    @Autowired
    private PrescriptionPayDao payDao;
    @Autowired
    private HospitalMappingDao mappingDao;
    @Autowired
    private PrescriptionDao prescriptionDao;
    /**
     * 家庭医生签约支付查询
     */
    public String chargeQuery(String code, String accessToken) throws Exception {
        PayConfigura config = configuraDao.findWorkConfigura();
        int flag = 0;
        Boolean isSuccess = true;
        String msgBody = "";
        String response = "";
        String error = "";
        String result = null;
        PrescriptionPay charge = payDao.findByCode(code);
        String prescriptionCode = charge.getPrescriptionCode();
        Prescription prescription = prescriptionDao.findByCode(prescriptionCode);
        HospitalMapping hospitalMapping = mappingDao.findByCode(prescription.getHospital());
//          ***************************  测通流程 ***************************************
        OnepayDefaultClient onepayClient = new OnepayDefaultClient(config.getOnepayApi(), hospitalMapping.getAppId(), hospitalMapping.getAppSecret(), signType, encryptType);
        try {
            RequestParams requestParams = new RequestParams();
//            requestParams.setVersion();
//            requestParams.setSign();
//            requestParams.setEncryptData();
//            requestParams.setAppId(appId);
            requestParams.setAppId(hospitalMapping.getAppId());
            requestParams.setTimestamp(DateUtil.getCurrentDateTime());
            requestParams.setSignType(signType);
            requestParams.setEncryptType(encryptType);
            requestParams.setTransType(config.getChargeQueryType());
            //业务参数
            JSONObject params = new JSONObject();
            params.put("outChargeNo", code);  //接入应用结算业务流水号
            params.put("wxToken", accessToken);
            requestParams.setParam(params);
            msgBody = JSON.toJSONString(requestParams);
//              ***************************  测通流程 ***************************************
            //执行支付 返回原生返回值
            ResponseParams<JSONObject> res = onepayClient.execute(requestParams);
            response = JSON.toJSONString(res);
            if (OnepayDefaultClient.isSuccessful(res)) {
                result = JSON.toJSONString(res.getParam());
//                新增保存数据
                JSONObject request = JSON.parseObject(result);
//                String tradeStatus = request.getString("tradeStatus");//交易状态
                String chargeStatus = request.getString("chargeStatus");//交易状态
                String chargeNo = request.getString("chargeNo");//支付平台流水号
                String chargeTime = request.getString("chargeTime");//支付平台交易成功时间
                String outChargeNo = request.getString("outChargeNo");//接入应用业务流水号
                String outChargeTime = request.getString("outChargeTime");//接入应用时间
                String medOrgNo = request.getString("medOrgNo");//医疗机构编号
                String medOrgName = request.getString("medOrgName");//医疗机构名称
                String billNo = request.getString("billNo");//待结算费用单据号
                String cardNo = request.getString("cardNo");//医保卡号
                String totalAmount = request.getString("totalAmount");//交易总金额
                String insuranceAmount = request.getString("insuranceAmount");//医保支付金额
                String selfPayAmount = request.getString("selfPayAmount");//自付金额
                String userId = request.getString("userId");//用户openID
                String userName = request.getString("userName");//用户名字
                String idNo = request.getString("idNo");//证件号码
                String idType = request.getString("idType");//证件类型
//                String appId = request.getString("appId");
//                String channel = request.getString("channel");//支付方式
//                String sign = request.getString("sign");
//                String signType = request.getString("signType");
//                String timestamp = request.getString("timestamp");
                JSONObject responseContents = request.getJSONObject("responseContent");//医保结构体
                PrescriptionPay prescriptionPay = payDao.findByCode(outChargeNo);
                if (responseContents != null) {
                    String miSettleNo = responseContents.getString("miSettleNo");//医保收费单据号 (医保签约号)
                    String miRegisterNo = responseContents.getString("miRegisterNo");//医保挂号
                    String miCollectDate = responseContents.getString("miCollectDate");//收费日期
                    String miCollectTime = responseContents.getString("miCollectTime");//收费时间
                    String miCollectorName = responseContents.getString("miCollectorName");//收费人姓名
                    String miTotalFee = responseContents.getString("miTotalFee");//本次报销总额
                    String selfPay = responseContents.getString("selfPay");//个人现金支付
                    String accountPay = responseContents.getString("accountPay");//个人账户支付
                    String heathPay = responseContents.getString("heathPay");//健康账户支付
                    String cadresPay = responseContents.getString("cadresPay");//公务员补助
                    String fundPay = responseContents.getString("fundPay");//基金支付
                    String healthCarePay = responseContents.getString("healthCarePay");//保健基金支付
                    String commercePay = responseContents.getString("commercePay");//商业保险支付
                    String familyPay = responseContents.getString("familyPay");//共济账户支付
                    String civilPay = responseContents.getString("civilPay");//民政补助金额
                    String civilZone = responseContents.getString("civilZone");//民政行政区号
                    String bdrugPay = responseContents.getString("bdrugPay");//乙类支付金额
                    String unlessAmount = responseContents.getString("unlessAmount");//非医保费用
                    String exceedAmount = responseContents.getString("exceedAmount");//超封顶线金额
                    String accountBalance = responseContents.getString("accountBalance");//个人账户余额
                    String healthBalance = responseContents.getString("healthBalance");//健康账户余额
                    prescriptionPay.setMiSettleNo(miSettleNo);//医保收费单据号
                    prescriptionPay.setMiRegisterNo(miRegisterNo);//医保挂号
                    SimpleDateFormat formatDate = new SimpleDateFormat("yyyyMMdd");
                    prescriptionPay.setMiCollectDate(formatDate.parse(miCollectDate));//收费日期
                    SimpleDateFormat formatTime = new SimpleDateFormat("HHmm");
                    prescriptionPay.setMiCollectTime(formatTime.parse(miCollectTime));//收费时间
                    prescriptionPay.setMiCollectorName(miCollectorName);//收费人姓名
                    prescriptionPay.setMiTotalFee(Integer.parseInt(miTotalFee));//本次报销总额
                    prescriptionPay.setSelfPay(Integer.parseInt(selfPay));//个人现金支付
                    prescriptionPay.setAccountPay(Integer.parseInt(accountPay));//个人账户支付
                    prescriptionPay.setHeathPay(Integer.parseInt(heathPay));//健康账户支付
                    prescriptionPay.setCadresPay(Integer.parseInt(cadresPay));//公务员补助
                    prescriptionPay.setFundPay(Integer.parseInt(fundPay));//基金支付
                    prescriptionPay.setHealthCarePay(Integer.parseInt(healthCarePay));//保健基金支付
                    prescriptionPay.setCommercePay(Integer.parseInt(commercePay));//商业保险支付
                    prescriptionPay.setFamilyPay(Integer.parseInt(familyPay));//共济账户支付
                    prescriptionPay.setCivilPay(Integer.parseInt(civilPay));//民政补助金额
                    prescriptionPay.setCivilZone(civilZone);//民政行政区号
                    prescriptionPay.setBdrugPay(Integer.parseInt(bdrugPay));//乙类支付金额
                    prescriptionPay.setUnlessAmount(Integer.parseInt(unlessAmount));//非医保费用
                    prescriptionPay.setExceedAmount(Integer.parseInt(exceedAmount));//超封顶线金额
                    prescriptionPay.setAccountBalance(Integer.parseInt(accountBalance));//个人账户余额
                    prescriptionPay.setHealthBalance(Integer.parseInt(healthBalance));//健康账户余额
                }
                if ("0".equals(chargeStatus) || "SUCCESS".equals(chargeStatus)) {
                    prescriptionPay.setTradeStatus("1");//交易状态 成功1 失败0
                }else {
                    prescriptionPay.setTradeStatus("0");//交易状态 成功1 失败0
                }
                prescriptionPay.setChargeNo(chargeNo);//支付流水号
                SimpleDateFormat formatDate = new SimpleDateFormat("yyyyMMddHHmmss");
                prescriptionPay.setChargeTime(formatDate.parse(chargeTime));//支付平台交易成功时间
                prescriptionPay.setOutChargeTime(formatDate.parse(outChargeTime));//接入应用内业务时间
                prescriptionPay.setMedOrgNo(medOrgNo);//医疗机构编号
                prescriptionPay.setMedOrgName(medOrgName);//医疗机构名称
                prescriptionPay.setBillNo(billNo);//待结算费用单据号
                prescriptionPay.setCardNo(cardNo);//医保卡号
                prescriptionPay.setTotalAmount(Integer.parseInt(totalAmount));//交易总金额
                prescriptionPay.setInsuranceAmount(Integer.parseInt(insuranceAmount));//医保支付金额
                prescriptionPay.setSelfPayAmount(Integer.parseInt(selfPayAmount));//自付金额
                prescriptionPay.setOpenid(userId);
                prescriptionPay.setUserName(userName);
                prescriptionPay.setIdType(idType);//证件类型
                prescriptionPay.setIdNo(idNo);//证件号码
                //        保存数据库更改记录
                payDao.save(prescriptionPay);
                logger.info("请求成功,返回参数: " + result);
            } else {
                isSuccess = false;
                error = "请求失败,返回结果:" + res.getRespCode() + "," + res.getRespMsg();
            }
        } catch (Exception ex) {
            isSuccess = false;
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            ex.printStackTrace(pw);
            error = sw.toString();
        }
        if (!isSuccess) {
            throw new Exception(error);
        }
        return result;
    }
}

+ 0 - 17
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/web/quota/JobController.java

@ -445,23 +445,6 @@ public class JobController extends BaseController {
        }
    }
    /**
     * 遍历长处方支付但回调都失败的记录,主动查询易联众支付记录并保存
     *
     * @author wujunjie
     * @date 2017/8/30 14:16
     */
    @RequestMapping(value = "/prescriptionPayQueryJob", method = RequestMethod.POST)
    @ApiOperation("遍历长处方支付但回调都失败的记录,主动查询易联众支付记录并保存")
    public String PrescriptionPayQueryJob() {
        try {
            quartzHelper.startNow(PrescriptionPayQueryJob.class, "PRESCRIPTION-PAY_QUERY", null);
            return write(200, "启动成功");
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
    //******************************长处方 end********************************
    /**
     * 居民监测方案提醒通知

+ 27 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/health/DoctorHealthStandardDao.java

@ -0,0 +1,27 @@
package com.yihu.wlyy.repository.doctor.health;
import com.yihu.wlyy.entity.doctor.health.DoctorHealthStandard;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * @author huangwenjie
 * @date 2017/9/14 21:43
 */
public interface DoctorHealthStandardDao extends
		PagingAndSortingRepository<DoctorHealthStandard, Long>,
        JpaSpecificationExecutor<DoctorHealthStandard>{
    // 查询医生健康指标预警值方案
    Iterable<DoctorHealthStandard> findByDoctor(String code);
    @Modifying
    @Query("delete DoctorHealthStandard a where a.doctor = ?1")
    int deleteByDoctor(String doctorcode);
    @Query("select a from DoctorHealthStandard a where a.doctor = ?1 and a.type = ?2")
    DoctorHealthStandard findByDoctorType(String patient, int type);
}

+ 1 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/PatientDeviceDao.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.repository.patient;
import com.yihu.wlyy.entity.patient.vo.PatientCodeDeviceType;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

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

@ -12,7 +12,10 @@ import org.springframework.data.repository.PagingAndSortingRepository;
import com.yihu.wlyy.entity.patient.PatientHealthStandard;
public interface PatientHealthStandardDao extends PagingAndSortingRepository<PatientHealthStandard, Long>, JpaSpecificationExecutor<PatientHealthStandard> {
public interface PatientHealthStandardDao extends
		PagingAndSortingRepository<PatientHealthStandard, Long>,
		JpaSpecificationExecutor<PatientHealthStandard> {
	// 查询患者健康指标预警值
	Iterable<PatientHealthStandard> findByPatient(String patient);

+ 4 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java

@ -788,6 +788,10 @@ public class ConsultTeamService extends ConsultService {
    public int addTeamConsult(ConsultTeam ct, String patient,String agent) throws Exception {
        synchronized (patient.intern()){//新增同步块,防止居民网络不好时多次点击,或者im服务器响应慢导致同时发起多个咨询
            if (exist(patient, ct.getType())) {//判断是否有未结束的咨询移到同步方法中
                return -3;
            }
            JSONObject users = new JSONObject();
            if(patient.equals(agent)){

+ 25 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/PatientHealthIndexService.java

@ -4,12 +4,14 @@ import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.device.entity.DevicePatientHealthIndex;
import com.yihu.wlyy.entity.device.PatientDevice;
import com.yihu.wlyy.entity.doctor.health.DoctorHealthStandard;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.PatientAimSports;
import com.yihu.wlyy.entity.patient.PatientHealthStandard;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.health.repository.DevicePatientHealthIndexDao;
import com.yihu.wlyy.repository.doctor.health.DoctorHealthStandardDao;
import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.repository.patient.*;
import com.yihu.wlyy.service.BaseService;
@ -72,6 +74,8 @@ public class PatientHealthIndexService extends BaseService {
    private PushMsgTask pushMsgTask;
    @Autowired
    private PatientAimSportsDao patientAimSportsDao;
    @Autowired
    private DoctorHealthStandardDao doctorHealthStandardDao;
@ -1322,4 +1326,25 @@ public class PatientHealthIndexService extends BaseService {
        return re;
    }
    /**
     * 保存医生预警值方案
     * @param doclist
     * @param uid
     * @return
     */
    public Iterable<DoctorHealthStandard> saveDocStandard(List<DoctorHealthStandard> doclist, String uid)  throws Exception  {
        // 先删除
        doctorHealthStandardDao.deleteByDoctor(uid);
        return doctorHealthStandardDao.save(doclist);
    }
    /**
     * 查询患者健康指标预警值
     *
     * @param code
     * @return
     */
    public Iterable<DoctorHealthStandard> findDoctorStandardByDoctor(String code) {
        return doctorHealthStandardDao.findByDoctor(code);
    }
}

+ 111 - 48
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelInfoService.java

@ -8,6 +8,7 @@ import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabelInfo;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.PatientDisease;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.patient.vo.PatientCodeDeviceType;
import com.yihu.wlyy.logs.BusinessLogs;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.doctor.DoctorPatientGroupInfoDao;
@ -307,20 +308,15 @@ public class SignPatientLabelInfoService extends BaseService {
                    "   OR t1.doctor_health = ? " +
                    "  ) " +
                    "  AND t1. STATUS > 0 " +
                    "  AND t1.admin_team_code = ?" +
                    " ) f " +
                    "WHERE " +
                    " f. CODE = s.sign_code " +
                    " AND s.server_type ='"+labelCode+"' ";
                    "  AND t1.admin_team_code = ?" ;
            if(StringUtils.isNotBlank(diseaseCondition)){
                sql = sql + " AND p.diseaseCondition = ?";
                args = new Object[]{doctor, doctor, teamCode,diseaseCondition};
            }else{
                args = new Object[]{doctor, doctor, teamCode};
                sql = sql + " AND p.disease_condition ="+diseaseCondition;
            }
            sql = sql + " ORDER BY " +
                    " f.ptOpenid DESC";
            sql = sql +" ) f " +
                    "WHERE " +
                    " f. CODE = s.sign_code " +
                    " AND s.server_type ='"+labelCode+"'  ORDER BY f.ptOpenid DESC";
            args = new Object[]{doctor, doctor, teamCode};
        } else {
            if (labelCode.equals("0")) {
                sql = "SELECT " +
@ -360,9 +356,16 @@ public class SignPatientLabelInfoService extends BaseService {
        signList = jdbcTemplate.queryForList(sql, args);
        //查询患者设备绑定情况
        if(isSlowDisease){
            String _pdsql = "SELECT p.code,(SELECT sum(d.category_code)  from wlyy_patient_device d WHERE p.code = d.`user`) device from wlyy_patient p";
            patientDeviceTypeMap = jdbcTemplate.queryForMap(_pdsql);
        String _pdsql = "select user,floor(sum(category_code)) deviceType FROM wlyy_patient_device GROUP BY user";
        List<Map<String,Object>> patientCodeDeviceTypes =  jdbcTemplate.queryForList(_pdsql);
        if(!patientCodeDeviceTypes.isEmpty()){
            for (Map<String,Object> patientCodeDeviceType : patientCodeDeviceTypes) {
                String user = String.valueOf(patientCodeDeviceType.get("user"));
                String sum = String.valueOf(patientCodeDeviceType.get("deviceType"));
                System.out.println(user+sum);
                patientDeviceTypeMap.put(user,sum);
            }
        }
        if (signList != null && signList.size() > 0) {
@ -508,26 +511,43 @@ public class SignPatientLabelInfoService extends BaseService {
            Collections.sort(list, new Comparator<JSONObject>() {
                @Override
                public int compare(JSONObject o1, JSONObject o2) {
                    //微信綁定情況
                    String openid1 = o1.has("openid") ? o1.getString("openid") : "";
                    String openid2 = o2.has("openid") ? o2.getString("openid") : "";
                    int re = 0;
                    //是否根据预警字段优先排序
                    if(isSlowDisease){
                        int standardStatus1 = o1.has("standardStatus")?o1.getInt("standardStatus"):0;
                        int standardStatus2 = o2.has("standardStatus")?o2.getInt("standardStatus"):0;
                    //患者預警狀態
                    int standardStatus1 = o1.has("standardStatus")?o1.getInt("standardStatus"):0;
                    int standardStatus2 = o2.has("standardStatus")?o2.getInt("standardStatus"):0;
                    //疾病种类
                    int disease1 = o1.has("disease")?o1.getInt("disease"):0;
                    int disease2 = o2.has("disease")?o2.getInt("disease"):0;
                    //颜色标签
                    int diseaseCondition1 = o1.has("diseaseCondition")?o1.getInt("diseaseCondition"):0;
                    int diseaseCondition2 = o2.has("diseaseCondition")?o2.getInt("diseaseCondition"):0;
                    //判断预警状态
                    if(standardStatus1 == standardStatus2){
                        //判断病种种类
                        if(disease1 == disease2){
                            //判断颜色标签
                            if(diseaseCondition1 == diseaseCondition2){
                                //判断微信绑定情况
                                re = openid1.compareTo(openid2);
                            }else{
                                re = diseaseCondition1 - diseaseCondition2;
                            }
                        if(standardStatus1 == standardStatus2){
                            re = openid1.compareTo(openid2);
                        }else{
                            re = standardStatus1 - standardStatus1;
                            re = disease1 - disease2;
                        }
                    }else{
                        re = openid1.compareTo(openid2);
                        re = standardStatus1 - standardStatus2;
                    }
                    if (re > 0) {
                        return -1;
                    } else if (re < 0) {
@ -3558,7 +3578,7 @@ public class SignPatientLabelInfoService extends BaseService {
     * @param teamCode
     * @param page
     * @param pagesize
     * @param sortByStandardStatus 是否根据预警状态排序,如果true, 需要附带查询患者设备绑定情况
     * @param isSlowDisease 是否是慢病管理,如果true
     * @param diseaseCondition
     * @return
     * @throws Exception
@ -3618,7 +3638,7 @@ public class SignPatientLabelInfoService extends BaseService {
                    "  AND t1. STATUS > 0 " +
                    "  AND t1.admin_team_code = ?";
            if(StringUtils.isNotBlank(diseaseCondition)){
                sql = sql + " AND p.diseaseCondition = ?";
                sql = sql + " AND p.disease_condition = ?";
                args = new Object[]{teamCode,diseaseCondition};
            }else{
                args = new Object[]{teamCode};
@ -3679,12 +3699,18 @@ public class SignPatientLabelInfoService extends BaseService {
        signList = jdbcTemplate.queryForList(sql, args);
        //查询患者设备绑定情况
        if(sortByStandardStatus){
            String _pdsql = "SELECT p.code,(SELECT sum(d.category_code)  from wlyy_patient_device d WHERE p.code = d.`user`) device from wlyy_patient p";
            patientDeviceTypeMap = jdbcTemplate.queryForMap(_pdsql);
        String _pdsql = "select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user";
        List<Map<String,Object>> patientCodeDeviceTypes =  jdbcTemplate.queryForList(_pdsql);
        if(!patientCodeDeviceTypes.isEmpty()){
            for (Map<String,Object> patientCodeDeviceType : patientCodeDeviceTypes) {
                String user = String.valueOf(patientCodeDeviceType.get("user"));
                String sum = String.valueOf(patientCodeDeviceType.get("deviceType"));
                System.out.println(user+sum);
                patientDeviceTypeMap.put(user,sum);
            }
        }
        if (signList != null && signList.size() > 0) {
            for (Map<String, Object> sign : signList) {
                Patient p = patientDao.findByCode(sign.get("patient") == null ? "" : sign.get("patient").toString());
@ -3830,27 +3856,43 @@ public class SignPatientLabelInfoService extends BaseService {
            Collections.sort(list, new Comparator<JSONObject>() {
                @Override
                public int compare(JSONObject o1, JSONObject o2) {
                    //微信綁定情況
                    String openid1 = o1.has("openid") ? o1.getString("openid") : "";
                    String openid2 = o2.has("openid") ? o2.getString("openid") : "";
                    int re = 0;
                    //是否根据预警字段优先排序
                    if(sortByStandardStatus){
                        int standardStatus1 = o1.has("standardStatus")?o1.getInt("standardStatus"):0;
                        int standardStatus2 = o2.has("standardStatus")?o2.getInt("standardStatus"):0;
                    //患者預警狀態
                    int standardStatus1 = o1.has("standardStatus")?o1.getInt("standardStatus"):0;
                    int standardStatus2 = o2.has("standardStatus")?o2.getInt("standardStatus"):0;
                    //疾病种类
                    int disease1 = o1.has("disease")?o1.getInt("disease"):0;
                    int disease2 = o2.has("disease")?o2.getInt("disease"):0;
                    //颜色标签
                    int diseaseCondition1 = o1.has("diseaseCondition")?o1.getInt("diseaseCondition"):0;
                    int diseaseCondition2 = o2.has("diseaseCondition")?o2.getInt("diseaseCondition"):0;
                    //判断预警状态
                    if(standardStatus1 == standardStatus2){
                        //判断病种种类
                        if(disease1 == disease2){
                            //判断颜色标签
                            if(diseaseCondition1 == diseaseCondition2){
                                //判断微信绑定情况
                                re = openid1.compareTo(openid2);
                            }else{
                                re = diseaseCondition1 - diseaseCondition2;
                            }
                        if(standardStatus1 == standardStatus2){
                            re = openid1.compareTo(openid2);
                        }else{
                            re = standardStatus1 - standardStatus1;
                            re = disease1 - disease2;
                        }
                    }else{
                        re = openid1.compareTo(openid2);
                        re = standardStatus1 - standardStatus2;
                    }
                    if (re > 0) {
                        return -1;
                    } else if (re < 0) {
@ -4088,17 +4130,26 @@ public class SignPatientLabelInfoService extends BaseService {
                }
            }
            sql = sql + " order by t3.diseaseCondition,t3.openid desc limit " + page + "," + pagesize;
            sql = sql + " order by t3.diseaseCondition,t3.disease,t3.diseaseCondition,t3.openid desc limit " + page + "," + pagesize;
            signList = jdbcTemplate.queryForList(sql, argsnew);
        }else{
            sql = sql + " order by t3.diseaseCondition,t3.openid desc limit " + page + "," + pagesize;
            sql = sql + " order by t3.diseaseCondition,t3.disease,t3.diseaseCondition,t3.openid desc limit " + page + "," + pagesize;
            signList = jdbcTemplate.queryForList(sql, args);
        }
        String _pdsql = "SELECT p.code,(SELECT sum(d.category_code)  from wlyy_patient_device d WHERE p.code = d.`user`) device from wlyy_patient p";
        patientDeviceTypeMap = jdbcTemplate.queryForMap(_pdsql);
        //查询患者设备绑定情况
        String _pdsql = "select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user";
        List<Map<String,Object>> patientCodeDeviceTypes =  jdbcTemplate.queryForList(_pdsql);
        if(!patientCodeDeviceTypes.isEmpty()){
            for (Map<String,Object> patientCodeDeviceType : patientCodeDeviceTypes) {
                String user = String.valueOf(patientCodeDeviceType.get("user"));
                String sum = String.valueOf(patientCodeDeviceType.get("deviceType"));
                System.out.println(user+sum);
                patientDeviceTypeMap.put(user,sum);
            }
        }
        if (signList != null && signList.size() > 0) {
            for (Map<String, Object> sign : signList) {
@ -4296,11 +4347,23 @@ public class SignPatientLabelInfoService extends BaseService {
                "  AND" +
                (isIdcard ? " p.idcard like ? " : " t1.name like ? ");
        String sql = sqlTemp + " order by t2.diseaseCondition,t2.openid desc  limit " + page + "," + pagesize;
        sqlTemp = sqlTemp + " AND p.disease_condition = "+diseaseCondition;
        String sql = sqlTemp + " order by t2.diseaseCondition,t2.disease,t2,diseaseCondition,t2.openid desc  limit " + page + "," + pagesize;
        signList = jdbcTemplate.queryForList(sql, args);
        String _pdsql = "SELECT p.code,(SELECT sum(d.category_code)  from wlyy_patient_device d WHERE p.code = d.`user`) device from wlyy_patient p";
        patientDeviceTypeMap = jdbcTemplate.queryForMap(_pdsql);
        //查询患者设备绑定情况
        String _pdsql = "select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user";
        List<Map<String,Object>> patientCodeDeviceTypes =  jdbcTemplate.queryForList(_pdsql);
        if(!patientCodeDeviceTypes.isEmpty()){
            for (Map<String,Object> patientCodeDeviceType : patientCodeDeviceTypes) {
                String user = String.valueOf(patientCodeDeviceType.get("user"));
                String sum = String.valueOf(patientCodeDeviceType.get("deviceType"));
                System.out.println(user+sum);
                patientDeviceTypeMap.put(user,sum);
            }
        }
        if (signList != null && signList.size() > 0) {
            for (Map<String, Object> sign : signList) {

+ 38 - 55
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/scheme/DoctorSchemeService.java

@ -65,7 +65,7 @@ public class DoctorSchemeService {
     * @date 2017/9/13 16:23
     * @return
     */
    public List<String> getPatientsByDiseaseConditionDiseaseDeviceType(String teamCode, Integer disease, Integer diseaseCondition, Integer deviceType) throws Exception{
    public List<String> getPatientsByDiseaseConditionDiseaseDeviceType(String teamCode, Integer disease, String diseaseCondition, Integer deviceType) throws Exception{
        String sql = "select p.code from wlyy_patient p ";
@ -76,11 +76,11 @@ public class DoctorSchemeService {
        sql = sql+ " JOIN wlyy_sign_family sf on sf.patient = p.code where sf.admin_team_code = "+teamCode;
        if(-1 != disease){
            sql = sql + " p.disease ="+disease;
            sql = sql + " and p.disease ="+disease;
        }
        if(-1 != diseaseCondition){
            sql = sql + " and p.diseaseCondition ="+diseaseCondition;
        if(StringUtils.isNotBlank(diseaseCondition)){
            sql = sql + " and p.diseaseCondition IN ("+diseaseCondition +")";
        }
        if(-1 != deviceType){
@ -184,7 +184,7 @@ public class DoctorSchemeService {
    /**
     * 医生保存居民的血糖监测方案
     * 医生保存血糖监测方案
     * @param data
     * @throws Exception
     */
@ -193,7 +193,6 @@ public class DoctorSchemeService {
        JSONObject dataObj =  JSON.parseObject(data);
        List<DoctorSchemeBloodSugger> results = new ArrayList<>();
        List<String> patientcodeList = new ArrayList<>();
        String code = dataObj.getString("code");
@ -205,11 +204,6 @@ public class DoctorSchemeService {
        String content = dataObj.getString("content");
        String doctorcode = dataObj.getString("doctorcode");
        JSONArray datalist = dataObj.getJSONArray("list");
        JSONArray patientcodes = dataObj.getJSONArray("patientcodes");
        for (int i = 0; i < patientcodes.size(); i++) {
            patientcodeList.add(datalist.getJSONObject(i).toString());
        }
        for (int i = 0; i < datalist.size(); i++) {
@ -247,40 +241,11 @@ public class DoctorSchemeService {
        }
        if(!results.isEmpty()) {
            //使用事务控制批量更新
            DefaultTransactionDefinition def = new DefaultTransactionDefinition();
            def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); // 事物隔离级别,开启新事务
            TransactionStatus status = transactionManager.getTransaction(def); // 获得事务状态
            try {
                for (DoctorSchemeBloodSugger doctorSchemeBloodSugger  : results) {
                    doctoreSchemeBloodSuggerDao.save(doctorSchemeBloodSugger);
                }
                PatientSchemeList patientSchemeListObj = new PatientSchemeList();
                for (String patientcode : patientcodeList) {
                    patientSchemeListDao.delByPatientCodeAndSchemeCode(patientcode,1,code);
                    patientSchemeListObj.setCode(UUID.randomUUID().toString());
                    patientSchemeListObj.setPatientcode(patientcode);
                    patientSchemeListObj.setSchemecode(code);
                    patientSchemeListObj.setDoctorcode(doctorcode);
                    Short _type = new Short("0");
                    patientSchemeListObj.setType(_type);
                    patientSchemeListObj.setCreateTime(DateUtil.getNowTimestamp());
                    patientSchemeListDao.save(patientSchemeListObj);
                }
                //事务提交
                transactionManager.commit(status);
            } catch (Exception ex) {
                //报错事务回滚
                transactionManager.rollback(status);
            }
            doctoreSchemeBloodSuggerDao.save(results);
        }
    }
    /**
     * 医生保存居民的血压监测方案
     * 医生保存血压监测方案
     * @param data
     * @throws Exception
     */
@ -289,7 +254,6 @@ public class DoctorSchemeService {
        JSONObject dataObj =  JSON.parseObject(data);
        List<DoctorSchemeBloodPressure> results = new ArrayList<>();
        List<String> patientcodeList = new ArrayList<>();
        String code = dataObj.getString("code");
@ -303,10 +267,6 @@ public class DoctorSchemeService {
        JSONArray datalist = dataObj.getJSONArray("list");
        JSONArray patientcodes = dataObj.getJSONArray("patientcodes");
        for (int i = 0; i < patientcodes.size(); i++) {
            patientcodeList.add(datalist.getJSONObject(i).toString());
        }
        for (int i = 0; i < datalist.size(); i++) {
            DoctorSchemeBloodPressure doctorSchemeBloodPressure = new DoctorSchemeBloodPressure();
@ -337,6 +297,34 @@ public class DoctorSchemeService {
        }
        if(!results.isEmpty()) {
            doctoreSchemeBloodPressureDao.save(results);
        }
    }
    /**
     * 医生保存居民监测方案
     *
     * @param doctorcode
     * @param schemecode
     * @param patientcodes
     * @param type
     * @throws Exception
     */
    public void savePatientScheme(String doctorcode, String schemecode, String type,String patientcodes) throws Exception {
        List<String> patientcodeList = new ArrayList<>();
        JSONObject dataObj = JSON.parseObject(patientcodes);
        JSONArray codes = dataObj.getJSONArray("patientcodes");
        if (codes == null || codes.size() == 0) {
            throw new Exception("居民列表不能为空");
        }
        for (int i = 0; i < codes.size(); i++) {
            patientcodeList.add(codes.getJSONObject(i).toString());
        }
        if (!patientcodeList.isEmpty()) {
            //使用事务控制批量更新
            DefaultTransactionDefinition def = new DefaultTransactionDefinition();
@ -344,23 +332,18 @@ public class DoctorSchemeService {
            TransactionStatus status = transactionManager.getTransaction(def); // 获得事务状态
            try {
                for (DoctorSchemeBloodPressure doctorSchemeBloodPressure : results) {
                    doctoreSchemeBloodPressureDao.save(doctorSchemeBloodPressure);
                }
                PatientSchemeList patientSchemeListObj = new PatientSchemeList();
                for (String patientcode : patientcodeList) {
                    patientSchemeListDao.delByPatientCodeAndSchemeCode(patientcode,0,code);
                    patientSchemeListDao.delByPatientCodeAndSchemeCode(patientcode, Integer.parseInt(type), schemecode);
                    patientSchemeListObj.setCode(UUID.randomUUID().toString());
                    patientSchemeListObj.setPatientcode(patientcode);
                    patientSchemeListObj.setSchemecode(code);
                    patientSchemeListObj.setSchemecode(schemecode);
                    patientSchemeListObj.setDoctorcode(doctorcode);
                    Short _type = new Short("0");
                    Short _type = new Short(type);
                    patientSchemeListObj.setType(_type);
                    patientSchemeListObj.setCreateTime(DateUtil.getNowTimestamp());
                    patientSchemeListDao.save(patientSchemeListObj);
                }
                //事务提交
                transactionManager.commit(status);
            } catch (Exception ex) {

+ 21 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/PatientService.java

@ -786,7 +786,7 @@ public class PatientService extends TokenService {
     *
     * @return
     */
    public JSONArray getSignByDoctorCodeGpbyServer(String doctor, String teamCode, boolean isSlowDisease) {
    public JSONArray getSignByDoctorCodeGpbyServer(String doctor, String teamCode, boolean isSlowDisease, String diseaseCondition) {
        String teamCodeSql = "";
        if (!org.springframework.util.StringUtils.isEmpty(teamCode)) {
            teamCodeSql = " and f.admin_team_code=" + teamCode + " ";
@ -822,7 +822,13 @@ public class PatientService extends TokenService {
                "  s.server_type " +
                ") c ON d. CODE = c.serverType " +
                "WHERE " +
                " d.`year` = '" + DateUtil.getSignYear() + "' " +
                " d.`year` = '" + DateUtil.getSignYear() + "' " ;
        if(isSlowDisease){
            //获取预警分组数量
            totalGSql = totalGSql +"  AND d. CODE in (4,5)  ";
        }
        totalGSql = totalGSql +
                "ORDER BY " +
                " d.sort ASC";
@ -848,11 +854,15 @@ public class PatientService extends TokenService {
                "   f.patient = p.code ";
        if(isSlowDisease){
            //获取预警分组数量
            fousGSql = fousGSql +"   AND p.standard_status = 1 ";
            fousGSql = fousGSql +"   AND p.standard_status = 1  ";
        }else{
            //获取微信关注量分组数量
            fousGSql = fousGSql +"   AND p.openid IS NOT NULL AND p.openid <>'' " ;
        }
        if(StringUtils.isNotBlank(diseaseCondition)){
            fousGSql = fousGSql +"   AND p.disease_condition = "+diseaseCondition;
        }
        fousGSql = fousGSql +
                "   AND ( " +
                "     f.doctor = '" + doctor + "' " +
@ -867,7 +877,14 @@ public class PatientService extends TokenService {
                "  s.server_type " +
                ") c ON d. CODE = c.serverType " +
                "WHERE " +
                " d.`year` = '" + DateUtil.getSignYear() + "' " +
                " d.`year` = '" + DateUtil.getSignYear() + "' " ;
        if(isSlowDisease){
            //获取预警分组数量
            fousGSql = fousGSql +"  AND d. CODE in (4,5)  ";
        }
        fousGSql = fousGSql +
                "ORDER BY " +
                " d.sort ASC";
        List<Map<String, Object>> fousG = jdbcTemplate.queryForList(fousGSql);

+ 63 - 33
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/fzzb/HealthEducationArticleService.java

@ -1,6 +1,7 @@
package com.yihu.wlyy.service.third.fzzb;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.repository.doctor.DoctorDao;
@ -81,9 +82,9 @@ public class HealthEducationArticleService extends BaseService{
     * @param userId 是    当前用户ID
     * @return
     */
    public String getDoctorArticalList(String articleTitle, Integer articleState, String firstLevelCategoryId, Integer pageIndex, Integer pageSize,String userId){
        String response = "";
    public JSONArray getDoctorArticalList(String articleTitle, Integer articleState, String firstLevelCategoryId, Integer pageIndex, Integer pageSize,String userId) throws Exception{
        JSONArray re = new JSONArray();
        JSONObject json = null;
        try{
            JSONObject param = new JSONObject();
            param.put("articleTitle",articleTitle);
@ -92,13 +93,18 @@ public class HealthEducationArticleService extends BaseService{
            param.put("pageIndex",pageIndex);
            param.put("pageSize",pageSize);
            param.put("userId",userId);
            response = httpClientUtil.httpPost(baseUrl,getParamsMap(getDoctorArticalList,param.toString(),"1"));
            String response = httpClientUtil.httpPost(baseUrl,getParamsMap(getDoctorArticalList,param.toString(),"1"));
            json = JSON.parseObject(response);
        }catch (Exception e){
            logger.error(e.getMessage());
            return re;
        }
        if("10000".equals(json.getString("Code"))){
            return json.getJSONArray("Result");
        }else {
            throw new Exception(json.getString("Message"));
        }
        return response;
    }
    /**
@ -106,18 +112,24 @@ public class HealthEducationArticleService extends BaseService{
     * @param articleId 文章id
     * @return
     */
    public String getArticalById(String articleId){
        String response = "";
    public JSONObject getArticalById(String articleId) throws Exception{
        JSONObject re = new JSONObject();
        JSONObject json = null;
        try{
            JSONObject param = new JSONObject();
            param.put("articleId",articleId);
            response = httpClientUtil.httpPost(baseUrl,getParamsMap(getArticalById,param.toString(),"1"));
            String response = httpClientUtil.httpPost(baseUrl,getParamsMap(getArticalById,param.toString(),"1"));
            json = JSON.parseObject(response);
        }catch (Exception e){
            logger.error(e.getMessage());
            return re;
        }
        if("10000".equals(json.getString("Code"))){
            return json.getJSONObject("Result");
        }else {
            throw new Exception(json.getString("Message"));
        }
        return response;
    }
    /**
@ -131,8 +143,10 @@ public class HealthEducationArticleService extends BaseService{
     * @param userType 是    1 医生 2 居民
     * @return
     */
    public String getCollectionArticalList(String articleTitle, Integer articleState, String firstLevelCategoryId, Integer pageIndex, Integer pageSize,String userId,Integer userType){
        String response = "";
    public JSONArray getCollectionArticalList(String articleTitle, Integer articleState, String firstLevelCategoryId,
                                              Integer pageIndex, Integer pageSize,String userId,Integer userType) throws Exception{
        JSONArray re = new JSONArray();
        JSONObject json = null;
        try{
            JSONObject param = new JSONObject();
            param.put("articleTitle",articleTitle);
@ -143,12 +157,18 @@ public class HealthEducationArticleService extends BaseService{
            param.put("userId",userId);
            param.put("userType",userType);
            response = httpClientUtil.httpPost(baseUrl,getParamsMap(getCollectionArticalList,param.toString(),"1"));
            String response = httpClientUtil.httpPost(baseUrl,getParamsMap(getCollectionArticalList,param.toString(),"1"));
            json = JSON.parseObject(response);
        }catch (Exception e){
            logger.error(e.getMessage());
            return re;
        }
        if("10000".equals(json.getString("Code"))){
            return json.getJSONObject("Result").getJSONArray("result");
        }else {
            throw new Exception(json.getString("Message"));
        }
        return response;
    }
@ -157,22 +177,25 @@ public class HealthEducationArticleService extends BaseService{
     * @param categoryLevel 是    获取类别:1、一级类别 2、二级类别
     * @return
     */
    public String getCategoryList(String categoryLevel) throws Exception{
        String response = "";
    public JSONArray getCategoryList(String categoryLevel) throws Exception{
        JSONArray re = new JSONArray();
        JSONObject json = null;
        try{
            JSONObject param = new JSONObject();
            param.put("categoryLevel",categoryLevel);
            response = httpClientUtil.httpPost(baseUrl,getParamsMap(getCategoryList,param.toString(),"1"));
            JSONObject json = JSON.parseObject(response);
            if("10000".equals(json.getString(""))){
            }
            String response = httpClientUtil.httpPost(baseUrl,getParamsMap(getCategoryList,param.toString(),"1"));
            json = JSON.parseObject(response);
        }catch (Exception e){
            logger.error(e.getMessage());
            return re;
        }
        if("10000".equals(json.getString("Code"))){
            return json.getJSONObject("Result").getJSONArray("result");
        }else {
            throw new Exception(json.getString("Message"));
        }
        return response;
    }
    /**
@ -242,9 +265,10 @@ public class HealthEducationArticleService extends BaseService{
     * @param userId 是    当前用户ID
     * @return
     */
    public String getDoctorArticalByUserId(String articleTitle, Integer articleState, String firstLevelCategoryId, Integer pageIndex, Integer pageSize,String userId){
        String response = "";
    public JSONArray getDoctorArticalByUserId(String articleTitle, Integer articleState, String firstLevelCategoryId,
                                              Integer pageIndex, Integer pageSize,String userId) throws Exception{
        JSONArray re = new JSONArray();
        JSONObject json = null;
        try{
            JSONObject param = new JSONObject();
            param.put("articleTitle",articleTitle);
@ -254,12 +278,18 @@ public class HealthEducationArticleService extends BaseService{
            param.put("pageSize",pageSize);
            param.put("userId",userId);
            response = httpClientUtil.httpPost(baseUrl,getParamsMap(getDoctorArticalByUserId,param.toString(),"1"));
            String response = httpClientUtil.httpPost(baseUrl,getParamsMap(getDoctorArticalByUserId,param.toString(),"1"));
            json = JSON.parseObject(response);
        }catch (Exception e){
            logger.error(e.getMessage());
            return re;
        }
        if("10000".equals(json.getString("Code"))){
            return json.getJSONObject("Result").getJSONArray("result");
        }else {
            throw new Exception(json.getString("Message"));
        }
        return response;
    }
}

+ 0 - 21
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/ImUtill.java

@ -193,27 +193,6 @@ public class ImUtill {
        return response;
    }
    /**
     * 发送消息给IM(发送给医生的,医生会多发送医生助手微信模板消息)
     *
     * @param from        来自
     * @param contentType 1文字 2图片消息
     * @param content     内容
     */
    public String sendDoctorImMsg(String from, String fromName, String sessionId, String contentType, String content, String businessType,String sendJson) {
        String imAddr = im_host + "api/v2/sessions/" + sessionId + "/messages";
        JSONObject params = new JSONObject();
        params.put("sender_id", from);
        params.put("sender_name", fromName);
        params.put("content_type", contentType);
        params.put("content", content);
        params.put("session_id", sessionId);
        params.put("business_type", businessType);
        params.put("sendJson", sendJson);
        String response = HttpClientUtil.postBody(imAddr, params);
        return response;
    }
    /**
     * 更新会话状态
     *

+ 0 - 44
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/im/imController.java

@ -337,50 +337,6 @@ public class imController extends BaseController {
        }
    }
    @RequestMapping(value = "/testwx", method = RequestMethod.POST)
    @ResponseBody
    public String testwx(@ApiParam(name="doctor",value="医生code",defaultValue = "xy201703150222")
                         @RequestParam(value="doctor",required = true) String doctor){
        try {
            Doctor d = doctorDao.findByCode(doctor);
            String sessionId = "ec7572875d27446cb4f067b13a85d72a_0ee64daec62746279517ca70d307a52f_8";
            JSONObject json = new JSONObject();
            json.put("openid", "o7NFZwyjo7Wvhv2Wh0eOUoUtlUT4");
            json.put("template_id", "-dr4QNyFoRvVsf8uWxXMC1dRyjwnbUuJwJ21vBLhf18");
            json.put("url", "wap.baidu.com");
            JSONObject data = new JSONObject();
            JSONObject first = new JSONObject();
            first.put("value","first");
            first.put("color","#000000");
            JSONObject remark = new JSONObject();
            remark.put("value","");
            remark.put("color","#000000");
            JSONObject keyword1 = new JSONObject();
            keyword1.put("value","description");
            keyword1.put("color","#000000");
            JSONObject keyword2 = new JSONObject();
            keyword2.put("value","replyContent");
            keyword2.put("color","#000000");
            JSONObject keyword3 = new JSONObject();
            keyword3.put("value","senderName");
            keyword3.put("color","#000000");
            data.put("first",first);
            data.put("remark",remark);
            data.put("keyword1",keyword1);
            data.put("keyword2",keyword2);
            data.put("keyword3",keyword3);
            json.put("data",data);
            ImUtill.sendDoctorImMsg(doctor, d.getName(), sessionId, "1", "test", "REMAIN",json.toString());
            return success("发送成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "发送失败!");
        }
    }
    public List getMemberByDoctor(String doctor) {
        String sql = "SELECT d.photo,d.`name`,d.sex,d.`code`,d.level " +
                " from wlyy_admin_team t,wlyy_admin_team_member m,wlyy_doctor d " +

+ 120 - 24
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthController.java

@ -2,6 +2,7 @@ package com.yihu.wlyy.web.doctor.health;
import com.yihu.device.entity.DevicePatientHealthIndex;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.doctor.health.DoctorHealthStandard;
import com.yihu.wlyy.entity.patient.PatientHealthStandard;
import com.yihu.wlyy.service.app.health.PatientHealthIndexService;
import com.yihu.wlyy.util.SystemConf;
@ -201,36 +202,68 @@ public class DoctorHealthController extends BaseController {
	public String standardSave(@ApiParam("患者代码") @RequestParam String patient,
							    @ApiParam("预警值Json") @RequestParam String json) {
		try {
			JSONArray array = new JSONArray(json);
			if (StringUtils.isEmpty(patient) || array == null || array.length() == 0) {
				return error(-1, "保存失败!");
			}
			// 生成数据对象
			List<PatientHealthStandard> list = new ArrayList<PatientHealthStandard>();
			for (int i = 0; i < array.length(); i++) {
				JSONObject obj = array.getJSONObject(i);
				if (obj == null) {
					continue;
			if(patient.contains(",")){
				String[] pcodeArray = patient.split(",");
				if(pcodeArray != null && pcodeArray.length > 0){
					// 生成数据对象
					List<PatientHealthStandard> list = new ArrayList<>();
					//保存患者的数据时,同时医生的预警值方案
					List<DoctorHealthStandard> doclist = new ArrayList<>();
					for (int i = 0; i < array.length(); i++) {
						JSONObject obj = array.getJSONObject(i);
						if (obj == null) {
							continue;
						}
						for (String patientCode: pcodeArray) {
							PatientHealthStandard standard = new PatientHealthStandard();
							standard.setDoctor(getUID());
							standard.setMaxValue1(obj.has("max_value1") ? NumberUtils.toDouble(obj.getString("max_value1"), 0) : 0);
							standard.setMaxValue2(obj.has("max_value2") ? NumberUtils.toDouble(obj.getString("max_value2"), 0) : 0);
							standard.setMinValue1(obj.has("min_value1") ? NumberUtils.toDouble(obj.getString("min_value1"), 0) : 0);
							standard.setMinValue2(obj.has("min_value2") ? NumberUtils.toDouble(obj.getString("min_value2"), 0) : 0);
							standard.setType(obj.getInt("type"));
							standard.setPatient(patientCode);
							standard.setCzrq(new Date());
							list.add(standard);
						}
						DoctorHealthStandard doctorHealthStandard = new DoctorHealthStandard();
						doctorHealthStandard.setDoctor(getUID());
						doctorHealthStandard.setMaxValue1(obj.has("max_value1") ? NumberUtils.toDouble(obj.getString("max_value1"), 0) : 0);
						doctorHealthStandard.setMaxValue2(obj.has("max_value2") ? NumberUtils.toDouble(obj.getString("max_value2"), 0) : 0);
						doctorHealthStandard.setMinValue1(obj.has("min_value1") ? NumberUtils.toDouble(obj.getString("min_value1"), 0) : 0);
						doctorHealthStandard.setMinValue2(obj.has("min_value2") ? NumberUtils.toDouble(obj.getString("min_value2"), 0) : 0);
						doctorHealthStandard.setType(obj.getInt("type"));
						doctorHealthStandard.setCzrq(new Date());
						doclist.add(doctorHealthStandard);
					}
					if (list.size() == 0) {
						return error(-1, "保存失败!");
					}
					// 保存数据库
					Iterable<PatientHealthStandard> iterable = healthIndexService.saveStandard(list, patient);
					if (iterable == null || iterable.iterator() == null || !iterable.iterator().hasNext()) {
						return error(-1, "保存失败!");
					}
					Iterable<DoctorHealthStandard> dociterable = healthIndexService.saveDocStandard(doclist, getUID());
					if (dociterable == null || dociterable.iterator() == null || !dociterable.iterator().hasNext()) {
						return error(-1, "保存失败!");
					}
				}
				PatientHealthStandard standard = new PatientHealthStandard();
				standard.setDoctor(getUID());
				standard.setMaxValue1(obj.has("max_value1") ? NumberUtils.toDouble(obj.getString("max_value1"), 0) : 0);
				standard.setMaxValue2(obj.has("max_value2") ? NumberUtils.toDouble(obj.getString("max_value2"), 0) : 0);
				standard.setMinValue1(obj.has("min_value1") ? NumberUtils.toDouble(obj.getString("min_value1"), 0) : 0);
				standard.setMinValue2(obj.has("min_value2") ? NumberUtils.toDouble(obj.getString("min_value2"), 0) : 0);
				standard.setType(obj.getInt("type"));
				standard.setPatient(patient);
				standard.setCzrq(new Date());
				list.add(standard);
			}
			if (list.size() == 0) {
				return error(-1, "保存失败!");
			}
			// 保存数据库
			Iterable<PatientHealthStandard> iterable = healthIndexService.saveStandard(list, patient);
			if (iterable == null || iterable.iterator() == null || !iterable.iterator().hasNext()) {
				return error(-1, "保存失败!");
			}
			return write(200, "保存成功");
		} catch (Exception e) {
			error(e);
@ -292,4 +325,67 @@ public class DoctorHealthController extends BaseController {
	@RequestMapping(value = "doctorstandard",method = RequestMethod.GET)
	@ResponseBody
	@ApiOperation("医生健康指标预警值方案查询")
	public String doctorstandard(@ApiParam("医生") @RequestParam String doctor) {
		try {
			JSONArray standardArray = new JSONArray();
			JSONArray userArray = new JSONArray();
			if(StringUtils.isBlank(doctor)){
				doctor = getUID();
			}
			Iterable<DoctorHealthStandard> iterable = healthIndexService.findDoctorStandardByDoctor(doctor);
			if(iterable == null){
				//如果获取不到,则获取系统默认方案
				iterable = healthIndexService.findDoctorStandardByDoctor("default");
			}
			Iterator<DoctorHealthStandard> iterator = null;
			if (iterable != null) {
				iterator = iterable.iterator();
			}
			// 预警值未设置,返回默认值
			StringBuffer sb = new StringBuffer();
			sb.append("[");
			// 默认血糖(餐前,餐后二小时)
			sb.append("{min_value_1:"+ SystemConf.HEALTH_STANDARD_ST_MIN_BEFORE +", max_value_1: "+ SystemConf.HEALTH_STANDARD_ST_MAX_BEFORE +", " +
					"min_value_2:"+ SystemConf.HEALTH_STANDARD_ST_MIN_AFTER +", max_value_2:"+ SystemConf.HEALTH_STANDARD_ST_MAX_AFTER +", type:1},");
			// 默认血压(收缩压,舒张压)
			sb.append("{min_value_1:"+ SystemConf.HEALTH_STANDARD_SSY_MIN +", max_value_1:"+ SystemConf.HEALTH_STANDARD_SSY_MAX +", " +
					"min_value_2:"+ SystemConf.HEALTH_STANDARD_SZY_MIN +", max_value_2:"+ SystemConf.HEALTH_STANDARD_SZY_MAX +", type:2}");
			sb.append("]");
			standardArray = new JSONArray(sb.toString());
			if (iterator != null) {
				while (iterator.hasNext()) {
					DoctorHealthStandard phs = iterator.next();
					if (phs == null) {
						continue;
					}
					JSONObject json = new JSONObject();
					// 最低安全值(血糖餐前\收缩压\体重\腰围)
					json.put("min_value_1", phs.getMinValue1());
					// 最高安全值(血糖餐前\收缩压\体重\腰围)
					json.put("max_value_1", phs.getMaxValue1());
					// 最低安全值(血糖餐后\舒张压)
					json.put("min_value_2", phs.getMinValue2());
					// 最高安全值(血糖餐后\舒张压)
					json.put("max_value_2", phs.getMaxValue2());
					// 健康指标类型:1血糖,2血压,3体重,4腰围
					json.put("type", phs.getType());
					userArray.put(json);
				}
			}
			JSONObject json = new JSONObject();
			json.put("standard", standardArray);
			json.put("custom", userArray);
			return write(200, "查询成功", "data", json);
		} catch (Exception e) {
			error(e);
			return invalidUserException(e, -1, "查询失败!");
		}
	}
}

+ 8 - 8
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthEduArticleController.java

@ -616,8 +616,8 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
                                       @ApiParam(name = "pageSize", value = "每页显示数 ,默认5")
                                       @RequestParam(value = "pageSize", required = false) Integer pageSize){
        try {
            String response = healthEducationArticleService.getDoctorArticalList(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,getUID());
//            String response = healthEducationArticleService.getDoctorArticalList(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,"0de7295862dd11e69faffa163e8aee56");
//            com.alibaba.fastjson.JSONArray response = healthEducationArticleService.getDoctorArticalList(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,getUID());
            com.alibaba.fastjson.JSONArray response = healthEducationArticleService.getDoctorArticalList(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,"0de7295862dd11e69faffa163e8aee56");
            return write(200,"查询成功!","data",response);
        }catch (Exception e){
            e.printStackTrace();
@ -630,7 +630,7 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
    public String getCategoryList(@ApiParam(name = "categoryLevel", value = "获取类别:1、一级类别 2、二级类别",defaultValue = "1")
                                       @RequestParam(value = "categoryLevel", required = true) String categoryLevel){
        try {
            String response = healthEducationArticleService.getCategoryList(categoryLevel);
            com.alibaba.fastjson.JSONArray response = healthEducationArticleService.getCategoryList(categoryLevel);
            return write(200,"查询成功!","data",response);
        }catch (Exception e){
            e.printStackTrace();
@ -651,8 +651,8 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
                                       @ApiParam(name = "pageSize", value = "每页显示数 ,默认5")
                                       @RequestParam(value = "pageSize", required = false) Integer pageSize){
        try {
            String response = healthEducationArticleService.getCollectionArticalList(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,getUID(),1);
//            String response = healthEducationArticleService.getCollectionArticalList(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,"0de7295862dd11e69faffa163e8aee56",1);
            com.alibaba.fastjson.JSONArray response = healthEducationArticleService.getCollectionArticalList(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,getUID(),1);
//            com.alibaba.fastjson.JSONArray response = healthEducationArticleService.getCollectionArticalList(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,"0de7295862dd11e69faffa163e8aee56",1);
            return write(200,"查询成功!","data",response);
        }catch (Exception e){
            e.printStackTrace();
@ -665,7 +665,7 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
    public String getArticalById(@ApiParam(name = "articleId", value = "文章id",defaultValue = "1")
                                  @RequestParam(value = "articleId", required = true) String articleId){
        try {
            String response = healthEducationArticleService.getArticalById(articleId);
            com.alibaba.fastjson.JSONObject response = healthEducationArticleService.getArticalById(articleId);
            return write(200,"查询成功!","data",response);
        }catch (Exception e){
            e.printStackTrace();
@ -721,8 +721,8 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
                                       @ApiParam(name = "pageSize", value = "每页显示数 ,默认5")
                                       @RequestParam(value = "pageSize", required = false) Integer pageSize){
        try {
//            String response = healthEducationArticleService.getDoctorArticalByUserId(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,getUID());
            String response = healthEducationArticleService.getDoctorArticalByUserId(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,"0de7295862dd11e69faffa163e8aee56");
//            com.alibaba.fastjson.JSONArray response = healthEducationArticleService.getDoctorArticalByUserId(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,getUID());
            com.alibaba.fastjson.JSONArray response = healthEducationArticleService.getDoctorArticalByUserId(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,"0de7295862dd11e69faffa163e8aee56");
            return write(200,"查询成功!","data",response);
        }catch (Exception e){
            e.printStackTrace();

+ 7 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/SignPatientLabelInfoController.java

@ -171,8 +171,8 @@ public class SignPatientLabelInfoController extends BaseController {
                return write(200, "查询成功", "data", jsonObject);
            }
            JSONArray result = labelInfoService.getPatientByLabel(getUID(), labelCode, labelType, teamCode, page, pagesize,isSlowDisease,diseaseCondition);
            //JSONArray result = labelInfoService.getPatientByLabel("xh1D201703150222", labelCode, labelType, teamCode, page, pagesize);
//            JSONArray result = labelInfoService.getPatientByLabel(getUID(), labelCode, labelType, teamCode, page, pagesize,isSlowDisease,diseaseCondition);
            JSONArray result = labelInfoService.getPatientByLabel("xh1D201703150222", labelCode, labelType, teamCode, page, pagesize,isSlowDisease,diseaseCondition);
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {
@ -287,7 +287,8 @@ public class SignPatientLabelInfoController extends BaseController {
    public String getPatientAmountByLabelType(
            @RequestParam(required = false) String labelType,
            @RequestParam(required = false) Long teamCode,
            @RequestParam(required = false) boolean isSlowDisease) {
            @RequestParam(required = false) boolean isSlowDisease,
            @RequestParam(required = false) String diseaseCondition) {
        try {
            if (StringUtils.isEmpty(labelType)) {
                return error(-1, "标签类型不能为空");
@ -304,7 +305,7 @@ public class SignPatientLabelInfoController extends BaseController {
            }
            if (labelType.equals("1") && teamCode != 0L) {
                JSONArray r = patientService.getSignByDoctorCodeGpbyServer(getUID(), teamCode + "",isSlowDisease);
                JSONArray r = patientService.getSignByDoctorCodeGpbyServer(getUID(), teamCode + "",isSlowDisease,diseaseCondition);
                //JSONArray r= patientService.getSignByDoctorCodeGpbyServer("xh1D201703150222",teamCode+"");
                return write(200, "查询成功", "data", r);
            }
@ -780,7 +781,7 @@ public class SignPatientLabelInfoController extends BaseController {
                                             @RequestParam(required = false) String exLabelType,
                                             @RequestParam(required = true) int page,
                                             @RequestParam(required = true) int pagesize,
                                             @RequestParam(required = false) String diseaseCondition) {
                                             @RequestParam(required = true) String diseaseCondition) {
        try {
            if (StringUtils.isEmpty(filter)) {
                return error(-1, "搜索字段不能为空");
@ -815,7 +816,7 @@ public class SignPatientLabelInfoController extends BaseController {
                                        @RequestParam(required = true, defaultValue = "0") long teamCode,
                                        @RequestParam(required = false, defaultValue = "0") int page,
                                        @RequestParam(required = false, defaultValue = "15") int pagesize,
                                        @RequestParam(required = false) String diseaseCondition) {
                                        @RequestParam(required = true) String diseaseCondition) {
        try {
            if (StringUtils.isEmpty(filter)) {
                return error(-1, "查询参数不能为空");

+ 27 - 9
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/scheme/DoctroSchemeController.java

@ -20,7 +20,7 @@ import java.util.List;
 * @date 2017/9/13 15:39
 */
@RestController
@RequestMapping(value = "/doctor/scheme/")
@RequestMapping(value = "/doctor/scheme")
@Api(description = "医生端-监测方案相关接口")
public class DoctroSchemeController extends BaseController {
@ -32,10 +32,10 @@ public class DoctroSchemeController extends BaseController {
    @RequestMapping(value="/get/disease/patientcodes",method = RequestMethod.GET)
    @ApiOperation("医生端-根据居民标签/病情/设备绑定状态查询团队居民CODE列表")
    public String getDiseasePatientCodes (
            @ApiParam(name="teamCode", value="团队CODE") @RequestParam(value = "teamCode",required = true) String teamCode,
            @ApiParam(name="disease", value="疾病类型,-1全部,0健康,1高血压,2糖尿病,3高血压+糖尿病") @RequestParam(value = "disease",required = true) Integer disease,
            @ApiParam(name="diseaseCondition", value="居民标签:-1全部,0绿标,1黄标,2红标") @RequestParam(value = "diseaseCondition",required = true) Integer diseaseCondition,
            @ApiParam(name="deviceType", value="设备类型:-1全部,0未绑定,1已绑定") @RequestParam(value = "deviceType",required = true) Integer deviceType
            @ApiParam(name="teamCode", value="团队CODE") @RequestParam(value = "teamCode",required = true,defaultValue = "642") String teamCode,
            @ApiParam(name="disease", value="疾病类型,-1全部,0健康,1高血压,2糖尿病,3高血压+糖尿病",defaultValue = "-1") @RequestParam(value = "disease",required = true) Integer disease,
            @ApiParam(name="diseaseCondition", value="居民标签:0绿标,1黄标,2红标",defaultValue = "0,1,2") @RequestParam(value = "diseaseCondition",required = true) String diseaseCondition,
            @ApiParam(name="deviceType", value="设备类型:-1全部,0未绑定,1已绑定",defaultValue = "-1") @RequestParam(value = "deviceType",required = true) Integer deviceType
            ){
        try {
@ -84,8 +84,8 @@ public class DoctroSchemeController extends BaseController {
        }
    }
    @RequestMapping(value="/post/save/patient/bloodpressure",method = RequestMethod.POST)
    @ApiOperation("医生保存居民的血压监测方案")
    @RequestMapping(value="/post/save/bloodpressure",method = RequestMethod.POST)
    @ApiOperation("医生保存血压监测方案")
    public String saveDoctorSchemeBloodPressure(
            @ApiParam(name="data", value="JSON数据") @RequestParam(value = "data",required = true) String data){
        try {
@ -99,8 +99,8 @@ public class DoctroSchemeController extends BaseController {
        }
    }
    @RequestMapping(value="/post/save/patient/bloodsugger",method = RequestMethod.POST)
    @ApiOperation("医生保存居民的血糖监测方案")
    @RequestMapping(value="/post/save/bloodsugger",method = RequestMethod.POST)
    @ApiOperation("医生保存血糖监测方案")
    public String saveDoctorSchemeBloodSugger(
            @ApiParam(name="data", value="JSON数据") @RequestParam(value = "data",required = true) String data){
        try {
@ -113,4 +113,22 @@ public class DoctroSchemeController extends BaseController {
            return error(-1, "操作失败,"+e.getMessage());
        }
    }
    @RequestMapping(value="/post/save/patient/scheme",method = RequestMethod.POST)
    @ApiOperation("医生保存居民的血糖监测方案")
    public String savePatientScheme(
            @ApiParam(name="doctorcode", value="医生CODE") @RequestParam(value = "doctorcode",required = true) String doctorcode,
            @ApiParam(name="schemecode", value="方案CODE") @RequestParam(value = "schemecode",required = true) String schemecode,
            @ApiParam(name="type", value="血糖1、血压2") @RequestParam(value = "type",required = true) String type,
            @ApiParam(name="patientcodes", value="JASON数据") @RequestParam(value = "patientcodes",required = true) String patientcodes){
        try {
            doctorSchemeService.savePatientScheme(doctorcode,schemecode,type,patientcodes);
            return write(200, "操作成功");
        }catch (Exception e){
            //日志文件中记录异常信息
            error(e);
            //返回接口异常信息处理结果
            return error(-1, "操作失败,"+e.getMessage());
        }
    }
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorSignController.java

@ -669,7 +669,7 @@ public class DoctorSignController extends WeixinBaseController {
    @ResponseBody
    public String getSignByDoctorCodeGpbyServer(){
        try {
            JSONArray result = patientService.getSignByDoctorCodeGpbyServer(getUID(),null, false);
            JSONArray result = patientService.getSignByDoctorCodeGpbyServer(getUID(),null, false, "");
            //JSONArray result = patientService.getSignByDoctorCodeGpbyServer("xh1D201703150222");
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {

+ 3 - 8
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/ConsultController.java

@ -320,14 +320,7 @@ public class ConsultController extends WeixinBaseController {
            if (type != 1 && type != 2) {
                return error(-1, "无效请求!");
            }
            try {
                if (consultTeamService.exist(getRepUID(), type)) {
                    return error(-1, "还有咨询未结束,不允许再次提交咨询!");
                }
            } catch (Exception e) {
                error(e);
                return error(-1, e.getMessage());
            }
            if (StringUtils.isEmpty(images)) {
                images = fetchWxImages();
            }
@ -364,6 +357,8 @@ public class ConsultController extends WeixinBaseController {
                return error(-1, "家庭签约信息不存在或已过期,无法进行家庭医生咨询!");
            } else if (res == -2) {
                return error(-1, "家庭签约信息不存在或已过期,无法进行三师医生咨询!");
            }else if (res == -3) {
                return error(-1, "还有咨询未结束,不允许再次提交咨询!");
            }
            Doctor doctor = doctorService.findDoctorByCode(consult.getDoctor());