Pārlūkot izejas kodu

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

huangwenjie 7 gadi atpakaļ
vecāks
revīzija
a8a253dba5

+ 4 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/bank/CreditLogService.java

@ -303,11 +303,12 @@ public class CreditLogService {
     * @param size
     * @return
     */
    public JSONObject selectByActivityRanking1(String activityId,Integer page,Integer size){
    public JSONObject selectByActivityRanking1(String activityId,String patientId,Integer page,Integer size){
        String response = null;
        String url =getBaseUrl() + "selectByActivityRanking1";
        Map<String,String> params = new HashMap<>();
        params.put("activityId",activityId);
        params.put("patientId",patientId);
        params.put("page",page.toString());
        params.put("size",size.toString());
        JSONObject object1 = null;
@ -317,8 +318,8 @@ public class CreditLogService {
            JSONArray array = object1.getJSONArray("detailModelList");
            for (int i = 0;array != null && i<array.size();i++){
                JSONObject object2 = array.getJSONObject(i);
                String patientId = object2.getString("patientId");
                Patient patient = patientDao.findByCode(patientId);
                String patientId1 = object2.getString("patientId");
                Patient patient = patientDao.findByCode(patientId1);
                object2.put("patient",patient);
            }
        }catch (Exception e){

+ 26 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/bank/TaskService.java

@ -125,7 +125,7 @@ public class TaskService {
    public JSONObject attendTask(JSONObject object) throws Exception {
        String response = null;
        Patient patient = patientDao.findByCode(object.getString("patientId"));
        String unionId = "1";
        String unionId = object.getString("unionId");
        Patient patient1 = patientDao.findByUnionid(unionId);
        if (patient1 != null){
            throw new Exception("该居民已报过名!");
@ -134,6 +134,7 @@ public class TaskService {
        patientDao.save(patient);
        object.put("unionId",unionId);
        object.put("patientIdcard",patient.getIdcard());
        object.put("patientOpenid",patient.getOpenid());
        String url =getBaseUrl() + "attendTask";
        Map<String,String> params = new HashMap<>();
        params.put("taskPatientDetail",object.toJSONString());
@ -177,4 +178,28 @@ public class TaskService {
        }
        return object;
    }
    /**
     * 创建记录
     *
     * @param object{"patientId":"","taskCode":"","originalStatus","currentStatus":""}
     * @return
     * @throws Exception
     */
    public JSONObject createActiveRecord(JSONObject object) throws Exception {
        String response = null;
        Patient patient = patientDao.findByCode(object.getString("patientId"));
        object.put("unionId",patient.getUnionid());
        object.put("patientIdcard",patient.getIdcard());
        object.put("patientOpenid",patient.getOpenid());
        String url =getBaseUrl() + "createActiveRecord";
        try {
            response = httpClientUtil.iotPostBody(url,object.toString());
        }catch (Exception e){
            e.printStackTrace();
            logger.error(e.getMessage());
        }
        return JSONObject.parseObject(response);
    }
}

+ 3 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/health/bank/CreditsLogController.java

@ -235,13 +235,15 @@ public class CreditsLogController extends BaseController {
    @ApiOperation("获取活动所有排名")
    public String selectByActivityRanking1(@ApiParam(name = "activityId",value = "活动id")
                                  @RequestParam(name = "activityId") String activityId,
                                   @ApiParam(name = "patientId",value = "居民id")
                                   @RequestParam(value = "patientId",required = true)String patientId,
                                  @ApiParam(name = "page", value = "第几页,从1开始")
                                  @RequestParam(value = "page", defaultValue = "1",required = false)Integer page,
                                  @ApiParam(name = "size",defaultValue = "10",value = ",每页分页大小")
                                  @RequestParam(value = "size", required = false)Integer size){
        try {
            return write(200,"查询成功","data",service.selectByActivityRanking1(activityId,page,size));
            return write(200,"查询成功","data",service.selectByActivityRanking1(activityId,patientId,page,size));
        }catch (Exception e){
            error(e);
            return error(-1,e.getMessage());

+ 0 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/health/bank/TaskController.java

@ -95,7 +95,6 @@ public class TaskController extends BaseController{
                             @RequestParam(name = "taskPatientDetail")String taskPatientDetail){
        try {
            JSONObject object = JSONObject.parseObject(taskPatientDetail);
            object.put("patientOpenid",getOpenid());
            return write(200,"报名成功","data",service.attendTask(object));
        }catch (Exception e){
            error(e);

+ 25 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/health/bank/AccountController.java

@ -5,6 +5,7 @@ package com.yihu.wlyy.web.third.health.bank;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.service.app.health.bank.CreditLogService;
import com.yihu.wlyy.service.app.health.bank.TaskService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -31,6 +32,8 @@ public class AccountController extends BaseController {
    @Autowired
    private CreditLogService service;
    @Autowired
    private TaskService taskService;
@ -66,13 +69,15 @@ public class AccountController extends BaseController {
    @ApiOperation("获取活动所有排名")
    public String selectByActivityRanking1(@ApiParam(name = "activityId",value = "活动id")
                                  @RequestParam(name = "activityId") String activityId,
                                   @ApiParam(name = "patientId",value = "居民id")
                                   @RequestParam(value = "patientId",required = true)String patientId,
                                  @ApiParam(name = "page", value = "第几页,从1开始")
                                  @RequestParam(value = "page", defaultValue = "1",required = false)Integer page,
                                  @ApiParam(name = "size",defaultValue = "10",value = ",每页分页大小")
                                  @RequestParam(value = "size", required = false)Integer size){
        try {
            return write(200,"查询成功","data",service.selectByActivityRanking1(activityId,page,size));
            return write(200,"查询成功","data",service.selectByActivityRanking1(activityId,patientId,page,size));
        }catch (Exception e){
            error(e);
            return error(-1,e.getMessage());
@ -100,4 +105,23 @@ public class AccountController extends BaseController {
    }
    /**
     *  添加历史记录
     *
     * @param activeRecord {"patientId":"","taskCode":"","originalStatus","currentStatus":""}
     * @return
     */
    @RequestMapping(value = "/createActiveRecord",method = RequestMethod.POST)
    @ApiOperation("添加记录")
    public String createActiveRecord(@ApiParam(name = "activeRecord",value = "对象JSON")
                                   @RequestParam(name = "activeRecord") String activeRecord){
        try {
            JSONObject object = JSONObject.parseObject(activeRecord);
            JSONObject result = taskService.createActiveRecord(object);
            return write(200,"获取成功","data",result);
        }catch (Exception e){
            error(e);
            return error(-1,e.getMessage());
        }
    }
}