Browse Source

[健康银行]

wangzhinan 6 years ago
parent
commit
6da317b839

+ 139 - 21
common/common-entity/src/main/java/com/yihu/jw/entity/health/bank/ActivityDO.java

@ -36,13 +36,14 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
    @Column(name = "img")
    private String img;//活动图片
    @Column(name = "start_time")
    @Column(name = "registration_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date startTime;//开始时间
    private Date registrationTime;//报名时间
    @Column(name = "end_time")
    @Column(name = "activity_offline_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date endTime; //结束时间
    private Date activityOfflineTime; //活动下线时间
    @Column(name = "status")
    private Integer status;//状态(1代表有效,0代表无效,-1代表过期)
@ -62,6 +63,30 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
    @Column(name = "type")
    private String type;//活动类型
    @Column(name = "dead_line")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date deadLine;//参与截止时间
    @Column(name = "crowd_type")
    private Integer crowdType;//面向人群
    @Column(name = "recommended")
    private Integer recommended;//是否推荐
    @Column(name = "info")
    private String info;//报名信息
    @Column(name="limit_register")
    private Integer limitRegister;//报名限制 0、所有居民可以报名,1、仅当前居民账号可报名
    @Column(name = "count")
    private Long count;//报名人数
/*
    @Column(name = "del")
    private Integer del;//1有效0无效*/
    @Transient
    private String patientId;//居民id
@ -89,6 +114,11 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
    @Transient
    private Long sum;//活动积分总数
    @Transient
    private ActivityRuleDO activityRuleDO;//活动规则
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
@ -97,6 +127,7 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
        this.saasId = saasId;
    }
    @Column(name = "organizer")
    public String getOrganizer() {
        return organizer;
    }
@ -105,6 +136,7 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
        this.organizer = organizer;
    }
    @Column(name = "title")
    public String getTitle() {
        return title;
    }
@ -113,6 +145,7 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
        this.title = title;
    }
    @Column(name = "description")
    public String getDescription() {
        return description;
    }
@ -121,6 +154,7 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
        this.description = description;
    }
    @Column(name = "location")
    public String getLocation() {
        return location;
    }
@ -129,6 +163,7 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
        this.location = location;
    }
    @Column(name = "img")
    public String getImg() {
        return img;
    }
@ -137,15 +172,7 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
        this.img = img;
    }
    public Date getStartTime() {
        return startTime;
    }
    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }
    @Column(name = "status")
    public Integer getStatus() {
        return status;
    }
@ -154,6 +181,7 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
        this.status = status;
    }
    @Column(name = "is_flag")
    public Integer getIsFlag() {
        return isFlag;
    }
@ -162,6 +190,7 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
        this.isFlag = isFlag;
    }
    @Column(name = "remark")
    public String getRemark() {
        return remark;
    }
@ -170,14 +199,7 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
        this.remark = remark;
    }
    public Date getEndTime() {
        return endTime;
    }
    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }
    @Column(name = "area")
    public String getArea() {
        return area;
    }
@ -221,6 +243,7 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
        this.total = total;
    }
    @Column(name = "type")
    public String getType() {
        return type;
    }
@ -282,4 +305,99 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
    public void setTaskDOS(List<TaskDO> taskDOS) {
        this.taskDOS = taskDOS;
    }
    @Column(name = "registration_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getRegistrationTime() {
        return registrationTime;
    }
    public void setRegistrationTime(Date registrationTime) {
        this.registrationTime = registrationTime;
    }
    @Column(name = "activity_offline_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getActivityOfflineTime() {
        return activityOfflineTime;
    }
    public void setActivityOfflineTime(Date activityOfflineTime) {
        this.activityOfflineTime = activityOfflineTime;
    }
    @Column(name = "dead_line")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getDeadLine() {
        return deadLine;
    }
    public void setDeadLine(Date deadLine) {
        this.deadLine = deadLine;
    }
    @Column(name = "crowd_type")
    public Integer getCrowdType() {
        return crowdType;
    }
    public void setCrowdType(Integer crowdType) {
        this.crowdType = crowdType;
    }
    @Column(name = "recommended")
    public Integer getRecommended() {
        return recommended;
    }
    public void setRecommended(Integer recommended) {
        this.recommended = recommended;
    }
    @Column(name = "info")
    public String getInfo() {
        return info;
    }
    public void setInfo(String info) {
        this.info = info;
    }
    @Column(name = "count")
    public Long getCount() {
        return count;
    }
    public void setCount(Long count) {
        this.count = count;
    }
    @Transient
    public ActivityRuleDO getActivityRuleDO() {
        return activityRuleDO;
    }
    public void setActivityRuleDO(ActivityRuleDO activityRuleDO) {
        this.activityRuleDO = activityRuleDO;
    }
    @Column(name="limit_register")
    public Integer getLimitRegister() {
        return limitRegister;
    }
    public void setLimitRegister(Integer limitRegister) {
        this.limitRegister = limitRegister;
    }
/*
    @Column(name = "del")
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }*/
}

+ 22 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/health/bank/CreditsDetailDO.java

@ -83,6 +83,7 @@ public class CreditsDetailDO extends UuidIdentityEntityWithOperator implements S
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
@ -90,7 +91,7 @@ public class CreditsDetailDO extends UuidIdentityEntityWithOperator implements S
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    @Column(name = "integrate")
    public Integer getIntegrate() {
        return integrate;
    }
@ -99,6 +100,7 @@ public class CreditsDetailDO extends UuidIdentityEntityWithOperator implements S
        this.integrate = integrate;
    }
    @Column(name = "status")
    public Integer getStatus() {
        return status;
    }
@ -107,6 +109,7 @@ public class CreditsDetailDO extends UuidIdentityEntityWithOperator implements S
        this.status = status;
    }
    @Column(name = "account_id")
    public String getAccountId() {
        return accountId;
    }
@ -115,6 +118,7 @@ public class CreditsDetailDO extends UuidIdentityEntityWithOperator implements S
        this.accountId = accountId;
    }
    @Column(name = "patient_id")
    public String getPatientId() {
        return patientId;
    }
@ -123,6 +127,7 @@ public class CreditsDetailDO extends UuidIdentityEntityWithOperator implements S
        this.patientId = patientId;
    }
    @Column(name = "hospital")
    public String getHospital() {
        return hospital;
    }
@ -131,6 +136,7 @@ public class CreditsDetailDO extends UuidIdentityEntityWithOperator implements S
        this.hospital = hospital;
    }
    @Column(name = "trade_direction")
    public Integer getTradeDirection() {
        return tradeDirection;
    }
@ -139,6 +145,7 @@ public class CreditsDetailDO extends UuidIdentityEntityWithOperator implements S
        this.tradeDirection = tradeDirection;
    }
    @Column(name = "transaction_id")
    public String getTransactionId() {
        return transactionId;
    }
@ -147,6 +154,7 @@ public class CreditsDetailDO extends UuidIdentityEntityWithOperator implements S
        this.transactionId = transactionId;
    }
    @Column(name = "trade_type")
    public String getTradeType() {
        return tradeType;
    }
@ -155,6 +163,7 @@ public class CreditsDetailDO extends UuidIdentityEntityWithOperator implements S
        this.tradeType = tradeType;
    }
    @Transient
    public TaskDO getTaskDO() {
        return taskDO;
    }
@ -163,6 +172,7 @@ public class CreditsDetailDO extends UuidIdentityEntityWithOperator implements S
        this.taskDO = taskDO;
    }
    @Transient
    public ActivityDO getActivityDO() {
        return activityDO;
    }
@ -171,6 +181,7 @@ public class CreditsDetailDO extends UuidIdentityEntityWithOperator implements S
        this.activityDO = activityDO;
    }
    @Transient
    public String getFlag() {
        return flag;
    }
@ -179,6 +190,7 @@ public class CreditsDetailDO extends UuidIdentityEntityWithOperator implements S
        this.flag = flag;
    }
    @Transient
    public Integer getTotal() {
        return total;
    }
@ -187,6 +199,7 @@ public class CreditsDetailDO extends UuidIdentityEntityWithOperator implements S
        this.total = total;
    }
    @Transient
    public String getName() {
        return name;
    }
@ -195,6 +208,7 @@ public class CreditsDetailDO extends UuidIdentityEntityWithOperator implements S
        this.name = name;
    }
    @Transient
    public String getIdCard() {
        return idCard;
    }
@ -203,6 +217,7 @@ public class CreditsDetailDO extends UuidIdentityEntityWithOperator implements S
        this.idCard = idCard;
    }
    @Transient
    public String getOpenId() {
        return openId;
    }
@ -211,6 +226,7 @@ public class CreditsDetailDO extends UuidIdentityEntityWithOperator implements S
        this.openId = openId;
    }
    @Column(name = "description")
    public String getDescription() {
        return description;
    }
@ -219,6 +235,7 @@ public class CreditsDetailDO extends UuidIdentityEntityWithOperator implements S
        this.description = description;
    }
    @Transient
    public Long getStepNumber() {
        return stepNumber;
    }
@ -227,6 +244,7 @@ public class CreditsDetailDO extends UuidIdentityEntityWithOperator implements S
        this.stepNumber = stepNumber;
    }
    @Transient
    public String getActivityId() {
        return activityId;
    }
@ -235,6 +253,7 @@ public class CreditsDetailDO extends UuidIdentityEntityWithOperator implements S
        this.activityId = activityId;
    }
    @Transient
    public String getUnionId() {
        return unionId;
    }
@ -243,6 +262,7 @@ public class CreditsDetailDO extends UuidIdentityEntityWithOperator implements S
        this.unionId = unionId;
    }
    @Transient
    public String getHospitalName() {
        return hospitalName;
    }
@ -251,6 +271,7 @@ public class CreditsDetailDO extends UuidIdentityEntityWithOperator implements S
        this.hospitalName = hospitalName;
    }
    @Transient
    public String getWeekTimes() {
        return weekTimes;
    }

+ 6 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/health/bank/TaskPatientDetailDO.java

@ -135,6 +135,7 @@ public class TaskPatientDetailDO extends UuidIdentityEntityWithOperator implemen
        this.total = total;
    }
    @Transient
    public AccountDO getAccountDO() {
        return accountDO;
    }
@ -151,6 +152,7 @@ public class TaskPatientDetailDO extends UuidIdentityEntityWithOperator implemen
        this.unionId = unionId;
    }
    @Transient
    public Integer getIsFlag() {
        return isFlag;
    }
@ -159,6 +161,7 @@ public class TaskPatientDetailDO extends UuidIdentityEntityWithOperator implemen
        this.isFlag = isFlag;
    }
    @Transient
    public String getTaskCode() {
        return taskCode;
    }
@ -167,6 +170,7 @@ public class TaskPatientDetailDO extends UuidIdentityEntityWithOperator implemen
        this.taskCode = taskCode;
    }
    @Transient
    public String getName() {
        return name;
    }
@ -175,6 +179,7 @@ public class TaskPatientDetailDO extends UuidIdentityEntityWithOperator implemen
        this.name = name;
    }
    @Transient
    public String getHospital() {
        return hospital;
    }
@ -183,6 +188,7 @@ public class TaskPatientDetailDO extends UuidIdentityEntityWithOperator implemen
        this.hospital = hospital;
    }
    @Transient
    public String getHospitalName() {
        return hospitalName;
    }

+ 3 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/health/bank/HealthBankMapping.java

@ -60,5 +60,8 @@ public class HealthBankMapping {
        public static final String addStepIntegrate = "/addStepIntegrate";
        public static final String weekReward = "/weekReward";
        public static final String selectByDate = "/selectByDate";
        public static final String doctorDescreaseIntegrate = "/doctorDescreaseIntegrate";
        public static final String selectAccountByPatient="/selectAccountByPatient";
        public static final String selectByActivityRule = "/selectByActivityRule";
    }
}

+ 19 - 0
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/AccountController.java

@ -159,4 +159,23 @@ public class AccountController extends EnvelopRestEndpoint {
        }
    }
    /**
     * 根据居民id获取银行账户信息
     *
     * @param patientId
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.selectAccountByPatient)
    @ApiOperation(value = "根据id获取居民账户")
    public MixEnvelop<AccountDO, AccountDO> selectByPatient(@ApiParam(name = "patientId",value = "居民id")
                                                                   @RequestParam(value = "patientId",required = true)String patientId){
        try {
            return service.selectByPatient(patientId);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return MixEnvelop.getError(e.getMessage());
        }
    }
}

+ 8 - 2
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/ActivityController.java

@ -46,10 +46,16 @@ public class ActivityController extends EnvelopRestEndpoint {
    @PostMapping(value = HealthBankMapping.healthBank.createActivity)
    @ApiOperation(value = "发布活动")
    public MixEnvelop<Boolean, Boolean> publishActivity(@ApiParam(name = "activity",value = "健康活动JSON")
                                          @RequestParam(value = "activity",required = true)String activity){
                                          @RequestParam(value = "activity",required = true)String activity,
                                                        @ApiParam(name = "value1",value = "积分JSON")
                                                        @RequestParam(value = "value1",required = false)String value1,
                                                        @ApiParam(name = "value2",value = "时间规则")
                                                            @RequestParam(value = "value2",required = false)String value2,
                                                        @ApiParam(name = "value3",value = "兑奖规则")
                                                            @RequestParam(value = "value3",required = false)String value3){
        try {
            ActivityDO activityDO = toEntity(activity,ActivityDO.class);
            return service.insert(activityDO);
            return service.insert(activityDO,value1,value2,value3);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());

+ 39 - 0
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/CreditsDetailController.java

@ -246,4 +246,43 @@ public class CreditsDetailController extends EnvelopRestEndpoint {
    }
    /**
     * 医生手动减积分
     * @param ruleId
     * @param patientId
     * @param hospital
     * @param hospitalName
     * @param integrate
     * @param reason
     * @param doctorId
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.doctorDescreaseIntegrate)
    @ApiOperation(value = "医生手动减积分")
    public MixEnvelop<Boolean, Boolean> doctorDescreaseIntegrate(@ApiParam(name = "ruleId",value = "规则id")
                                                                     @RequestParam(value = "ruleId",required = false)String ruleId,
                                                                 @ApiParam(name = "patientId",value = "居民id")
                                                                 @RequestParam(value = "patientId",required = false)String patientId,
                                                                 @ApiParam(name = "hospital",value = "机构code")
                                                                     @RequestParam(value = "hospital",required = false)String hospital,
                                                                 @ApiParam(name = "hospitalName",value = "机构名称")
                                                                     @RequestParam(value = "hospitalName",required = false)String hospitalName,
                                                                 @ApiParam(name = "integrate",value = "扣减的积分")
                                                                     @RequestParam(value = "integrate",required = false)Integer integrate,
                                                                 @ApiParam(name = "reason",value = "扣减的原因")
                                                                     @RequestParam(value = "reason",required = false)String reason,
                                                                 @ApiParam(name = "doctorId",value = "医生code")
                                                                     @RequestParam(value = "doctorId",required = false)String doctorId){
        try {
            return service.doctorDescreaseIntegrate(ruleId,patientId,doctorId,hospital,hospitalName,integrate,reason);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return MixEnvelop.getError(e.getMessage());
        }
    }
}

+ 4 - 0
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/dao/ActivityDao.java

@ -1,11 +1,15 @@
package com.yihu.jw.dao;
import com.yihu.jw.entity.health.bank.ActivityDO;
import com.yihu.jw.entity.health.bank.ActivityRuleDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by wang zhinan on 2018/4/27.
 */
public interface ActivityDao extends PagingAndSortingRepository<ActivityDO,String>,JpaSpecificationExecutor<ActivityDO> {
    @Query("select t from ActivityDO t where t.id=?1")
    ActivityDO selectById(String id);
}

+ 3 - 0
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/dao/TaskPatientDetailDao.java

@ -16,4 +16,7 @@ public interface TaskPatientDetailDao extends PagingAndSortingRepository<TaskPat
    @Query("select t from TaskPatientDetailDO t where taskId = ?1")
    List<TaskPatientDetailDO> selectByTaskId(String taskId);
    @Query("select t from TaskPatientDetailDO t where taskId = ?1 and patientId =?2")
    TaskPatientDetailDO selectByTaskIdAndPatientId(String taskId,String patientId);
}

+ 3 - 0
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/dao/TaskRuleDao.java

@ -5,6 +5,7 @@ package com.yihu.jw.dao;
import com.yihu.jw.entity.health.bank.TaskRuleDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
@ -13,4 +14,6 @@ import org.springframework.data.repository.PagingAndSortingRepository;
 * @desc health bank task dao
 **/
public interface TaskRuleDao extends PagingAndSortingRepository<TaskRuleDO,String>,JpaSpecificationExecutor<TaskRuleDO> {
    @Query("select t from TaskRuleDO t where t.id = ?1 and t.status=1")
    public TaskRuleDO findByCode(String id);
}

+ 14 - 0
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/AccountService.java

@ -397,4 +397,18 @@ public class AccountService extends BaseJpaService<AccountDO,AccountDao> {
        }
        return MixEnvelop.getSuccessListWithPage(HealthBankMapping.api_success, accountDOS,page,size,count);
    }
    /**
     * 根据居民code获取积分
     *
     * @param patient
     * @return
     */
    public MixEnvelop<AccountDO, AccountDO> selectByPatient(String patient){
        MixEnvelop<AccountDO,AccountDO> envelop = new MixEnvelop<>();
        String sql = "select * from wlyy_health_bank_account where status = 1 and patient_id = '"+patient+"'";
        List<AccountDO> accountDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(AccountDO.class));
        envelop.setObj(accountDOS.get(0));
        return envelop;
    }
}

+ 27 - 2
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/ActivityService.java

@ -2,10 +2,13 @@ package com.yihu.jw.service;/**
 * Created by nature of king on 2018/4/27.
 */
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.dao.ActivityDao;
import com.yihu.jw.dao.ActivityRuleDao;
import com.yihu.jw.dao.TaskDao;
import com.yihu.jw.dao.TaskPatientDetailDao;
import com.yihu.jw.entity.health.bank.ActivityDO;
import com.yihu.jw.entity.health.bank.ActivityRuleDO;
import com.yihu.jw.entity.health.bank.TaskDO;
import com.yihu.jw.entity.health.bank.TaskPatientDetailDO;
import com.yihu.jw.restmodel.web.MixEnvelop;
@ -40,6 +43,8 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> {
    private TaskDao taskDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private ActivityRuleDao activityRuleDao;
    /**
@ -48,10 +53,27 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> {
     * @param activityDO 活动参数对象
     * @return
     */
    public MixEnvelop<Boolean, Boolean> insert(ActivityDO activityDO){
    public MixEnvelop<Boolean, Boolean> insert(ActivityDO activityDO,String value1,String value2,String value3){
        if (value2 != null){
            JSONObject object = JSONObject.parseObject(value2);
            activityDO.setActivityOfflineTime(object.getDate("activityOfflineTime"));
            activityDO.setRegistrationTime(object.getDate("registrationTime"));
            activityDO.setDeadLine(object.getDate("deadLine"));
        }
        activityDO.setCreateTime(new Date());
        activityDO.setUpdateTime(new Date());
        activityDao.save(activityDO);
        activityDO.setDel(1);
        activityDO= activityDao.save(activityDO);
        ActivityRuleDO activityRuleDO = new ActivityRuleDO();
        activityRuleDO.setCreateTime(new Date());
        activityRuleDO.setUpdateTime(new Date());
        activityRuleDO.setActivityId(activityDO.getId());
        activityRuleDO.setSaasId("dev");
        activityRuleDO.setValue1(value1);
        activityRuleDO.setValue2(value2);
        activityRuleDO.setValue3(value3);
        activityRuleDO.setDel(1);
        activityRuleDao.save(activityRuleDO);
        MixEnvelop<Boolean, Boolean> envelop = new MixEnvelop<>();
        envelop.setObj(true);
        return envelop;
@ -247,4 +269,7 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> {
        }
        return envelop;
    }
}

+ 61 - 0
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/CreditsDetailService.java

@ -709,6 +709,8 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
        envelop.setObj(true);
        return envelop;
    }
    /**
     * 固定数据
     *
@ -890,6 +892,65 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
        }
    }
    public MixEnvelop doctorDescreaseIntegrate(String ruleId,String patientId,String doctorId,String hospital,String hospitalName,Integer integrate,String reason) throws Exception {
       MixEnvelop envelop = new MixEnvelop<>();
       envelop.setObj(true);
       TaskDO taskDO =  taskDao.selectByTaskRuleId(ruleId);
       String sql = "select * from wlyy_health_bank_account where status = 1 and patient_id = '"+patientId+"'";
       List<AccountDO> accountDOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(AccountDO.class));
       AccountDO accountDO = accountDOs.get(0);
       if (taskDO == null){
           TaskRuleDO taskRuleDO =  taskRuleDao.findByCode(ruleId);
           TaskDO  taskDO1 = new TaskDO();
           taskDO1.setTitle(taskRuleDO.getName());
           taskDO1.setContent(taskRuleDO.getDescription());
           taskDO1.setSaasId("dev");
           taskDO1.setTaskCode("RULE");
           taskDO1.setType("RULE_TASK");
           taskDO1.setTransactionId(ruleId);
           taskDO1.setCreateTime(new Date());
           taskDO1.setUpdateTime(new Date());
           taskDO1.setRuleCode(taskRuleDO.getId());
           taskDO1.setStatus(1);
           taskDO = taskDao.save(taskDO1);
       }
       TaskPatientDetailDO patientDetailDO = taskPatientDetailDao.selectByTaskIdAndPatientId(taskDO.getId(),patientId);
       if (patientDetailDO == null){
           TaskPatientDetailDO taskPatientDetailDO = new TaskPatientDetailDO();
           taskPatientDetailDO.setSaasId("dev");
           taskPatientDetailDO.setTaskId(taskDO.getId());
           taskPatientDetailDO.setPatientId(patientId);
           taskPatientDetailDO.setDoctorId(doctorId);
           taskPatientDetailDO.setPatientIdcard(accountDO.getIdCard());
           taskPatientDetailDO.setCreateTime(new Date());
           taskPatientDetailDO.setUpdateTime(new Date());
           taskPatientDetailDO.setStatus(1);
           taskPatientDetailDao.save(taskPatientDetailDO);
       }
       if (accountDO.getTotal().compareTo(integrate)>=1){
           CreditsDetailDO creditsDetailDO = new CreditsDetailDO();
           creditsDetailDO.setAccountId(accountDO.getId());
           creditsDetailDO.setIdCard(accountDO.getIdCard());
           creditsDetailDO.setSaasId("dev");
           creditsDetailDO.setTradeType("ACTIVITY_TASK");
           creditsDetailDO.setTradeDirection(-1);
           creditsDetailDO.setIntegrate(integrate);
           creditsDetailDO.setDescription(reason);
           creditsDetailDO.setStatus(1);
           creditsDetailDO.setHospital(hospital);
           creditsDetailDO.setHospitalName(hospitalName);
           creditsDetailDO.setCreateTime(new Date());
           creditsDetailDO.setUpdateTime(new Date());
           credittsLogDetailDao.save(creditsDetailDO);
           accountDO.setTotal(accountDO.getTotal()-integrate);
           accountDao.save(accountDO);
       }else {
           envelop.setMessage("积分不足!");
           throw new Exception("积分不足!");
       }
       return envelop;
    }
    /*public JSONObject getStepNumber(){
        String step = redisTemplate.·().get(STEP);
        logger.info("redis数据:"+step);