humingfen 7 роки тому
батько
коміт
1d928dae43

+ 24 - 6
common/common-request-mapping/src/main/java/com/yihu/jw/rm/rehabilitation/RehabilitationRequestMapping.java

@ -11,10 +11,17 @@ public class RehabilitationRequestMapping {
     * 公共模块
     * 公共模块
     */
     */
    public static class Common {
    public static class Common {
        public static final String information = api_rehabilitation_common + "/information";
        public static final String message_success_update = "update success";
        public static final String message_success_delete = "delete success";
        public static final String message_success_find = "find success";
        public static final String message_success_create = "create success";
        public static final String message_success_find_functions = "message_success_find_functions";
    }
    }
    public static class Information {
    public static class Information {
        public static final String information = api_rehabilitation_common + "/information";
        public static final String api_create = "createInformation";
        public static final String api_create = "createInformation";
        public static final String api_delete = "delInformation";
        public static final String api_delete = "delInformation";
        public static final String api_getById = "getInformationById";
        public static final String api_getById = "getInformationById";
@ -24,11 +31,22 @@ public class RehabilitationRequestMapping {
        public static final String findInformationByPatientId = "findInformationByPatientId";
        public static final String findInformationByPatientId = "findInformationByPatientId";
        public static final String findInformationPage = "findInformationPage";
        public static final String findInformationPage = "findInformationPage";
        public static final String message_success_update = "information update success";
        public static final String message_success_delete = "information delete success";
        public static final String message_success_find = "information find success";
        public static final String message_success_create = "information create success";
    }
    public static class Performance {
        public static final String performance = api_rehabilitation_common + "/performance";
    }
        public static final String message_success_find_functions = "message_success_find_functions";
    public static class TreatmentProgram {
        public static final String treatmentProgram = api_rehabilitation_common + "/treatmentProgram";
        public static final String findTreatmentProgramPage = "findTreatmentProgramPage";
        public static final String api_create = "createTreatmentProgram";
        public static final String api_delete = "delTreatmentProgram";
        public static final String api_getById = "getTreatmentProgramById";
        public static final String api_update = "updateTreatmentProgram";
        public static final String findTreatmentProgramById = "findTreatmentProgramById";
    }
    }
}
}

+ 57 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/rehabilitation/RehabilitationTreatmentProgramVO.java

@ -0,0 +1,57 @@
package com.yihu.jw.restmodel.rehabilitation;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.yihu.jw.restmodel.iot.common.BaseVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
/**
 * 就诊信息表
 * @author humingfen on 2018/4/27.
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(value = "治疗方案表", description = "治疗方案表")
public class RehabilitationTreatmentProgramVO extends BaseVO implements Serializable {
    @ApiModelProperty("方案名称")
    private String name;
    @ApiModelProperty("训练次数/时间")
    private String frequency;
    @ApiModelProperty("方案名称")
    private Integer timesDaily;
    @ApiModelProperty("附加说明")
    private String description;
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getFrequency() {
        return frequency;
    }
    public void setFrequency(String frequency) {
        this.frequency = frequency;
    }
    public Integer getTimesDaily() {
        return timesDaily;
    }
    public void setTimesDaily(Integer timesDaily) {
        this.timesDaily = timesDaily;
    }
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
}

+ 6 - 6
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/controller/RehabilitationInformationController.java

@ -17,7 +17,7 @@ import com.yihu.jw.rm.rehabilitation.RehabilitationRequestMapping;
 * @author humingfen on 2018/4/25.
 * @author humingfen on 2018/4/25.
 */
 */
@RestController
@RestController
@RequestMapping(value = RehabilitationRequestMapping.Common.information)
@RequestMapping(value = RehabilitationRequestMapping.Information.information)
@Api(tags = "就诊信息相关操作", description = "就诊信息相关操作")
@Api(tags = "就诊信息相关操作", description = "就诊信息相关操作")
public class RehabilitationInformationController extends EnvelopRestController {
public class RehabilitationInformationController extends EnvelopRestController {
@ -56,7 +56,7 @@ public class RehabilitationInformationController extends EnvelopRestController {
        try {
        try {
            RehabilitationInformationVO informationVO = toEntity(jsonData, RehabilitationInformationVO.class);
            RehabilitationInformationVO informationVO = toEntity(jsonData, RehabilitationInformationVO.class);
            RehabilitationInformationDO informationDO = rehabilitationInformationService.convertToModel(informationVO, RehabilitationInformationDO.class);
            RehabilitationInformationDO informationDO = rehabilitationInformationService.convertToModel(informationVO, RehabilitationInformationDO.class);
            return Envelop.getSuccess(RehabilitationRequestMapping.Information.message_success_create, rehabilitationInformationService.create(informationDO));
            return Envelop.getSuccess(RehabilitationRequestMapping.Common.message_success_create, rehabilitationInformationService.create(informationDO));
        } catch (Exception e) {
        } catch (Exception e) {
            e.printStackTrace();
            e.printStackTrace();
            return Envelop.getError(e.getMessage());
            return Envelop.getError(e.getMessage());
@ -70,7 +70,7 @@ public class RehabilitationInformationController extends EnvelopRestController {
        try {
        try {
            RehabilitationInformationDO informationDO = rehabilitationInformationService.findById(id);
            RehabilitationInformationDO informationDO = rehabilitationInformationService.findById(id);
            RehabilitationInformationVO informationVO = rehabilitationInformationService.convertToModel(informationDO, RehabilitationInformationVO.class);
            RehabilitationInformationVO informationVO = rehabilitationInformationService.convertToModel(informationDO, RehabilitationInformationVO.class);
            return Envelop.getSuccess(RehabilitationRequestMapping.Information.message_success_find, informationVO);
            return Envelop.getSuccess(RehabilitationRequestMapping.Common.message_success_find, informationVO);
        } catch (Exception e) {
        } catch (Exception e) {
            e.printStackTrace();
            e.printStackTrace();
            return Envelop.getError(e.getMessage());
            return Envelop.getError(e.getMessage());
@ -84,7 +84,7 @@ public class RehabilitationInformationController extends EnvelopRestController {
        try {
        try {
            RehabilitationInformationDO informationDO = rehabilitationInformationService.findByPatientId(patientId);
            RehabilitationInformationDO informationDO = rehabilitationInformationService.findByPatientId(patientId);
            RehabilitationInformationVO informationVO = rehabilitationInformationService.convertToModel(informationDO, RehabilitationInformationVO.class);
            RehabilitationInformationVO informationVO = rehabilitationInformationService.convertToModel(informationDO, RehabilitationInformationVO.class);
            return Envelop.getSuccess(RehabilitationRequestMapping.Information.message_success_find, informationVO);
            return Envelop.getSuccess(RehabilitationRequestMapping.Common.message_success_find, informationVO);
        } catch (Exception e) {
        } catch (Exception e) {
            e.printStackTrace();
            e.printStackTrace();
            return Envelop.getError(e.getMessage());
            return Envelop.getError(e.getMessage());
@ -99,7 +99,7 @@ public class RehabilitationInformationController extends EnvelopRestController {
            RehabilitationInformationVO informationVO = toEntity(jsonData, RehabilitationInformationVO.class);
            RehabilitationInformationVO informationVO = toEntity(jsonData, RehabilitationInformationVO.class);
            RehabilitationInformationDO informationDO = rehabilitationInformationService.convertToModel(informationVO, RehabilitationInformationDO.class);
            RehabilitationInformationDO informationDO = rehabilitationInformationService.convertToModel(informationVO, RehabilitationInformationDO.class);
            rehabilitationInformationService.update(informationDO);
            rehabilitationInformationService.update(informationDO);
            return Envelop.getSuccess(RehabilitationRequestMapping.Information.message_success_update);
            return Envelop.getSuccess(RehabilitationRequestMapping.Common.message_success_update);
        } catch (Exception e) {
        } catch (Exception e) {
            e.printStackTrace();
            e.printStackTrace();
            return Envelop.getError(e.getMessage());
            return Envelop.getError(e.getMessage());
@ -112,7 +112,7 @@ public class RehabilitationInformationController extends EnvelopRestController {
                                            @RequestParam(value = "id", required = true) String id) {
                                            @RequestParam(value = "id", required = true) String id) {
        try {
        try {
            rehabilitationInformationService.delete(id);
            rehabilitationInformationService.delete(id);
            return Envelop.getSuccess(RehabilitationRequestMapping.Information.message_success_delete);
            return Envelop.getSuccess(RehabilitationRequestMapping.Common.message_success_delete);
        } catch (Exception e) {
        } catch (Exception e) {
            e.printStackTrace();
            e.printStackTrace();
            return Envelop.getError(e.getMessage());
            return Envelop.getError(e.getMessage());

+ 105 - 0
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/controller/RehabilitationTreatmentProgramController.java

@ -0,0 +1,105 @@
package com.yihu.rehabilitation.controller;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.rehabilitation.RehabilitationTreatmentProgramDO;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.restmodel.rehabilitation.RehabilitationTreatmentProgramVO;
import com.yihu.jw.rm.rehabilitation.RehabilitationRequestMapping;
import com.yihu.rehabilitation.service.RehabilitationTreatmentProgramService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
 * @author humingfen on 2018/4/27.
 */
@RestController
@RequestMapping(value = RehabilitationRequestMapping.TreatmentProgram.treatmentProgram)
@Api(tags = "治疗方案相关操作", description = "治疗方案相关操作")
public class RehabilitationTreatmentProgramController extends EnvelopRestController {
    @Autowired
    private RehabilitationTreatmentProgramService treatmentProgramService;
    @GetMapping(value = RehabilitationRequestMapping.TreatmentProgram.findTreatmentProgramPage)
    @ApiOperation(value = "分页查找治疗方案", notes = "分页查找治疗方案")
    public Envelop<RehabilitationTreatmentProgramVO> findTreatmentProgramPage(@ApiParam(name = "name", value = "方案名称", defaultValue = "")
                                                                    @RequestParam(value = "name", required = false) String name,
                                                                         @ApiParam(name = "page", value = "第几页", defaultValue = "")
                                                                    @RequestParam(value = "page", required = false) Integer page,
                                                                         @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
                                                                    @RequestParam(value = "size", required = false) Integer size){
        try {
            if(page == null|| page < 0){
                page = 1;
            }
            if(size == null){
                size = 10;
            }
            return treatmentProgramService.queryTreatmentPage(page, size, name);
        } catch (Exception e) {
            e.printStackTrace();
            return Envelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = RehabilitationRequestMapping.TreatmentProgram.api_create)
    @ApiOperation(value = "创建治疗方案", notes = "创建治疗方案")
    public Envelop<RehabilitationTreatmentProgramDO> createTreatmentProgram(@ApiParam(name = "jsonData", value = "方案基本信息Json", defaultValue = "")
                                                                         @RequestParam(value = "jsonData", required = false) String jsonData) {
        try {
            RehabilitationTreatmentProgramDO infos = new ObjectMapper().readValue(jsonData, new TypeReference<RehabilitationTreatmentProgramDO>(){});
            return Envelop.getSuccess(RehabilitationRequestMapping.Common.message_success_create, treatmentProgramService.create(infos));
        }catch (Exception e){
            e.printStackTrace();
            return Envelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = RehabilitationRequestMapping.TreatmentProgram.findTreatmentProgramById)
    @ApiOperation(value = "根据id查找治疗方案", notes = "根据id查找治疗方案")
    public Envelop<RehabilitationTreatmentProgramVO> findById(@ApiParam(name = "id", value = "id")
                                                         @RequestParam(value = "id", required = true) String id) {
        try {
            RehabilitationTreatmentProgramDO treatmentProgramDO = treatmentProgramService.findById(id);
            RehabilitationTreatmentProgramVO treatmentProgramVO = treatmentProgramService.convertToModel(treatmentProgramDO, RehabilitationTreatmentProgramVO.class);
            return Envelop.getSuccess(RehabilitationRequestMapping.Common.message_success_find, treatmentProgramVO);
        } catch (Exception e) {
            e.printStackTrace();
            return Envelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = RehabilitationRequestMapping.TreatmentProgram.api_update)
    @ApiOperation(value = "修改治疗方案", notes = "修改治疗方案(记得传入修改id)")
    public Envelop updateTreatmentProgram(@ApiParam(name = "jsonData", value = "json", defaultValue = "")
                                                                  @RequestParam(value = "jsonData", required = true)String jsonData) {
        try {
            RehabilitationTreatmentProgramVO treatmentProgramVO = toEntity(jsonData, RehabilitationTreatmentProgramVO.class);
//            RehabilitationTreatmentProgramDO treatmentProgramDO = treatmentProgramService.convertToModel(treatmentProgramVO, RehabilitationTreatmentProgramDO.class);
            treatmentProgramService.update(treatmentProgramVO);
            return Envelop.getSuccess(RehabilitationRequestMapping.Common.message_success_update);
        } catch (Exception e) {
            e.printStackTrace();
            return Envelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = RehabilitationRequestMapping.TreatmentProgram.api_delete)
    @ApiOperation(value = "删除治疗方案", notes = "删除治疗方案")
    public Envelop delTreatmentProgram(@ApiParam(name = "id", value = "id")
                                                               @RequestParam(value = "id", required = true) String id) {
        try {
            treatmentProgramService.delete(id);
            return Envelop.getSuccess(RehabilitationRequestMapping.Common.message_success_delete);
        } catch (Exception e) {
            e.printStackTrace();
            return Envelop.getError(e.getMessage());
        }
    }
}

+ 12 - 0
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/dao/RehabilitationTreatmentProgramDao.java

@ -0,0 +1,12 @@
package com.yihu.rehabilitation.dao;
import com.yihu.jw.rehabilitation.RehabilitationTreatmentProgramDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface RehabilitationTreatmentProgramDao extends PagingAndSortingRepository<RehabilitationTreatmentProgramDO, String>,
        JpaSpecificationExecutor<RehabilitationTreatmentProgramDO> {
    @Query("from RehabilitationTreatmentProgramDO w where w.id = ?1")
    RehabilitationTreatmentProgramDO findById(String id);
}

+ 1 - 1
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/RehabilitationInformationService.java

@ -60,7 +60,7 @@ public class RehabilitationInformationService extends BaseJpaService<Rehabilitat
        //DO转VO
        //DO转VO
        List<RehabilitationInformationVO> informationVOList = convertToModels(list,new ArrayList<>(list.size()), RehabilitationInformationVO.class);
        List<RehabilitationInformationVO> informationVOList = convertToModels(list,new ArrayList<>(list.size()), RehabilitationInformationVO.class);
        return Envelop.getSuccessListWithPage(RehabilitationRequestMapping.Information.message_success_find_functions,informationVOList, page, size,count);
        return Envelop.getSuccessListWithPage(RehabilitationRequestMapping.Common.message_success_find_functions,informationVOList, page, size,count);
    }
    }
    /**
    /**

+ 78 - 0
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/RehabilitationTreatmentProgramService.java

@ -0,0 +1,78 @@
package com.yihu.rehabilitation.service;
import com.yihu.base.mysql.query.BaseJpaService;
import com.yihu.jw.rehabilitation.RehabilitationTreatmentProgramDO;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.rehabilitation.RehabilitationTreatmentProgramVO;
import com.yihu.jw.rm.rehabilitation.RehabilitationRequestMapping;
import com.yihu.rehabilitation.dao.RehabilitationTreatmentProgramDao;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
/**
 * @author humingfen on 2018/4/27.
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class RehabilitationTreatmentProgramService extends BaseJpaService<RehabilitationTreatmentProgramDO, RehabilitationTreatmentProgramDao> {
    @Autowired
    private RehabilitationTreatmentProgramDao treatmentProgramDao;
    /**
     * 分页查找健康档案
     * @param page
     * @param size
     * @param name
     * @return
     * @throws ParseException
     */
    public Envelop<RehabilitationTreatmentProgramVO> queryTreatmentPage(Integer page, Integer size, String name) throws ParseException {
        String filters = "";
        String semicolon = "";
        if(StringUtils.isNotBlank(name)){
            filters = "name?"+name+"";
            semicolon = ";";
        }
        String sorts = "-createTime";
        //得到list数据
        List<RehabilitationTreatmentProgramDO> list = search(null, filters, sorts, page, size);
        //获取总数
        long count = getCount(filters);
        //DO转VO
        List<RehabilitationTreatmentProgramVO> treatmentProgramVOs = convertToModels(list,new ArrayList<>(list.size()), RehabilitationTreatmentProgramVO.class);
        return Envelop.getSuccessListWithPage(RehabilitationRequestMapping.Common.message_success_find_functions,treatmentProgramVOs, page, size,count);
    }
    public RehabilitationTreatmentProgramDO create(RehabilitationTreatmentProgramDO treatmentProgramDO) {
        treatmentProgramDO.setSaasId(getCode());
        treatmentProgramDO = treatmentProgramDao.save(treatmentProgramDO);
        return treatmentProgramDO;
    }
    public RehabilitationTreatmentProgramDO findById(String id) {
        RehabilitationTreatmentProgramDO treatmentProgramDO = treatmentProgramDao.findById(id);
        return treatmentProgramDO;
    }
    /**
     * 修改
     * @param treatmentProgramVO
     */
    public void update(RehabilitationTreatmentProgramVO treatmentProgramVO){
        RehabilitationTreatmentProgramDO treatmentProgramDO = treatmentProgramDao.findById(treatmentProgramVO.getId());
        treatmentProgramDO.setName(treatmentProgramVO.getName());
        treatmentProgramDO.setFrequency(treatmentProgramVO.getFrequency());
        treatmentProgramDO.setTimesDaily(treatmentProgramVO.getTimesDaily());
        treatmentProgramDO.setDescription(treatmentProgramVO.getDescription());
        treatmentProgramDao.save(treatmentProgramDO);
    }
}

+ 1 - 1
svr/svr-rehabilitation/src/main/resources/application.yml

@ -1,6 +1,6 @@
##如果有配置服务的话,远程服务器和本地服务器配置不一致的情况下,优先远程的为主  git上 svr-base ->  git application ->本地 appliction ->本地 bootstarp
##如果有配置服务的话,远程服务器和本地服务器配置不一致的情况下,优先远程的为主  git上 svr-base ->  git application ->本地 appliction ->本地 bootstarp
server:
server:
  port: 10051
  port: 10055
spring:
spring:
  application:
  application: