Procházet zdrojové kódy

Merge branch 'dev' of trick9191/wlyy2.0 into dev

trick9191 před 6 roky
rodič
revize
220d6a997d

+ 0 - 1
gateway/ag-basic/src/main/java/com/yihu/AgBasicServer.java

@ -23,5 +23,4 @@ public class AgBasicServer extends SpringBootServletInitializer {
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(AgBasicServer.class);
    }
}

+ 24 - 0
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/config/TomcatConfig.java

@ -0,0 +1,24 @@
package com.yihu.jw.gateway.config;
import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.servlet.MultipartConfigElement;
/**
 * Created by Trick on 2018/12/18.
 */
@Configuration
public class TomcatConfig {
    @Bean
    public MultipartConfigElement multipartConfigElement() {
        MultipartConfigFactory factory = new MultipartConfigFactory();
        //单个文件最大
        factory.setMaxFileSize("10240KB"); //KB,MB
        /// 设置总上传数据总大小
        factory.setMaxRequestSize("102400KB");
        return factory.createMultipartConfig();
    }
}

+ 49 - 49
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/patient/PatientFamilyMemberEndpoint.java

@ -1,49 +1,49 @@
package com.yihu.jw.base.endpoint.patient;
import com.yihu.jw.base.service.patient.PatientFamilyMemberService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.base.BaseRequestMapping;
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.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
 * Created by Trick on 2018/9/3.
 */
@RestController
@RequestMapping(value = BaseRequestMapping.PatientMember.PREFIX)
@Api(value = "家庭成员", description = "家庭成员管理", tags = {"wlyy基础服务 - 家庭成员管理"})
public class PatientFamilyMemberEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private PatientFamilyMemberService patientMemberService;
    @PostMapping(value = BaseRequestMapping.PatientMember.CREATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "创建")
    public Envelop createFamilyMember(@ApiParam(name = "patient", value = "用户id", required = true)
                                      @RequestParam(value = "patient")String patient,
                                      @ApiParam(name = "member", value = "家庭成员id", required = true)
                                      @RequestParam(value = "member")String member,
                                      @ApiParam(name = "relation", value = "关系 1父亲 2母亲 3老公 4老婆 5儿子 6女儿 7其他", required = true)
                                      @RequestParam(value = "relation")Integer relation)throws Exception{
        patientMemberService.createFamilyMember(patient,member,relation);
        return success("success");
    }
    @PostMapping(value = BaseRequestMapping.PatientMember.DELETE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "删除")
    public Envelop delFamilyMember(@ApiParam(name = "patient", value = "用户id", required = true)
                                      @RequestParam(value = "patient")String patient,
                                      @ApiParam(name = "member", value = "家庭成员id", required = true)
                                      @RequestParam(value = "member")String member)throws Exception{
        patientMemberService.delFamilyMember(patient,member);
        return success("success");
    }
}
//package com.yihu.jw.base.endpoint.patient;
//
//import com.yihu.jw.base.service.patient.PatientFamilyMemberService;
//import com.yihu.jw.restmodel.web.Envelop;
//import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
//import com.yihu.jw.rm.base.BaseRequestMapping;
//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.http.MediaType;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.RestController;
//
///**
// * Created by Trick on 2018/9/3.
// */
//@RestController
//@RequestMapping(value = BaseRequestMapping.PatientMember.PREFIX)
//@Api(value = "家庭成员", description = "家庭成员管理", tags = {"wlyy基础服务 - 家庭成员管理"})
//public class PatientFamilyMemberEndpoint extends EnvelopRestEndpoint {
//
//    @Autowired
//    private PatientFamilyMemberService patientMemberService;
//
//    @PostMapping(value = BaseRequestMapping.PatientMember.CREATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ApiOperation(value = "创建")
//    public Envelop createFamilyMember(@ApiParam(name = "patient", value = "用户id", required = true)
//                                      @RequestParam(value = "patient")String patient,
//                                      @ApiParam(name = "member", value = "家庭成员id", required = true)
//                                      @RequestParam(value = "member")String member,
//                                      @ApiParam(name = "relation", value = "关系 1父亲 2母亲 3老公 4老婆 5儿子 6女儿 7其他", required = true)
//                                      @RequestParam(value = "relation")Integer relation)throws Exception{
//        patientMemberService.createFamilyMember(patient,member,relation);
//        return success("success");
//    }
//
//    @PostMapping(value = BaseRequestMapping.PatientMember.DELETE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ApiOperation(value = "删除")
//    public Envelop delFamilyMember(@ApiParam(name = "patient", value = "用户id", required = true)
//                                      @RequestParam(value = "patient")String patient,
//                                      @ApiParam(name = "member", value = "家庭成员id", required = true)
//                                      @RequestParam(value = "member")String member)throws Exception{
//        patientMemberService.delFamilyMember(patient,member);
//        return success("success");
//    }
//}

+ 121 - 121
svr/svr-base/src/main/java/com/yihu/jw/base/service/patient/PatientFamilyMemberService.java

@ -1,121 +1,121 @@
package com.yihu.jw.base.service.patient;
import com.yihu.jw.base.dao.patient.BasePatientFamilyMemberDao;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientFamilyMemberDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.util.idcard.IdCardUtil;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
 * Created by Trick on 2018/8/31.
 */
@Service
@Transactional
public class PatientFamilyMemberService extends BaseJpaService<BasePatientFamilyMemberDO,BasePatientFamilyMemberDao> {
    @Autowired
    private BasePatientFamilyMemberDao familyMemberDao;
    @Autowired
    private BasePatientDao basePatientDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    public String createFamilyMember(String patient,String member,Integer relation)throws Exception{
        BasePatientDO pDo = basePatientDao.findByIdAndDel(patient,"1");
        BasePatientDO mDo = basePatientDao.findByIdAndDel(patient,"1");
        BasePatientFamilyMemberDO family1 = new BasePatientFamilyMemberDO();
        //添加正向关系
        family1.setPatient(patient);
        family1.setFamilyMember(member);
        family1.setFamilyRelation(relation);
        //默认添加已经授权记录,用户同意授权之后调用此接口
        family1.setIsAuthorize(1);
        //添加反向关系
        BasePatientFamilyMemberDO family2 = new BasePatientFamilyMemberDO();
        family1.setPatient(patient);
        family1.setFamilyMember(member);
        family1.setFamilyRelation(familyRelationTrans(mDo,relation));
        //默认添加已经授权记录,用户同意授权之后调用此接口
        family1.setIsAuthorize(1);
        return "1";
    }
    public String delFamilyMember(String patient,String member)throws Exception{
        BasePatientFamilyMemberDO family1 = familyMemberDao.findByPatientAndFamilyMember(patient,member);
        BasePatientFamilyMemberDO family2 = familyMemberDao.findByPatientAndFamilyMember(member,patient);
        familyMemberDao.delete(family1);
        familyMemberDao.delete(family2);
        return "1";
    }
    /**
     * 家庭关系转换
     *
     * @param patient  居民
     * @param relation 关系 1父亲 2母亲 3老公 4老婆 5儿子 6女儿 7其他
     * @return
     */
    public int familyRelationTrans(BasePatientDO patient, Integer relation) throws Exception {
        int relationTrans = 0;
        switch (relation) {
            case 1:
            case 2:
                if (patient.getSex() == 1) {
                    relationTrans = 5;
                } else if (patient.getSex() == 2) {
                    relationTrans = 6;
                } else {
                    relationTrans = 0;
                }
                if (relationTrans == 0) {
                    if (IdCardUtil.getSexForIdcard(StringUtils.isEmpty(patient.getIdcard()) ? "" : patient.getIdcard()).equals("1")) {
                        relationTrans = 6;
                    } else if (IdCardUtil.getSexForIdcard(StringUtils.isEmpty(patient.getIdcard()) ? "" : patient.getIdcard()).equals("2")) {
                        relationTrans = 5;
                    }
                }
                break;
            case 3:
                relationTrans = 4;
                break;
            case 4:
                relationTrans = 3;
                break;
            case 5:
            case 6:
                if (patient.getSex() == 1) {
                    relationTrans = 1;
                } else if (patient.getSex() == 2) {
                    relationTrans = 2;
                } else {
                    relationTrans = 0;
                }
                if (relationTrans == 0) {
                    if (IdCardUtil.getSexForIdcard(StringUtils.isEmpty(patient.getIdcard()) ? "" : patient.getIdcard()).equals("1")) {
                        relationTrans = 2;
                    } else if (IdCardUtil.getSexForIdcard(StringUtils.isEmpty(patient.getIdcard()) ? "" : patient.getIdcard()).equals("2")) {
                        relationTrans = 1;
                    }
                }
                break;
        }
        return relationTrans;
    }
}
//package com.yihu.jw.base.service.patient;
//
//import com.yihu.jw.base.dao.patient.BasePatientFamilyMemberDao;
//import com.yihu.jw.entity.base.patient.BasePatientDO;
//import com.yihu.jw.entity.base.patient.BasePatientFamilyMemberDO;
//import com.yihu.jw.patient.dao.BasePatientDao;
//import com.yihu.jw.restmodel.web.Envelop;
//import com.yihu.jw.util.idcard.IdCardUtil;
//import com.yihu.mysql.query.BaseJpaService;
//import org.apache.commons.lang3.StringUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.jdbc.core.JdbcTemplate;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//
///**
// * Created by Trick on 2018/8/31.
// */
//@Service
//@Transactional
//public class PatientFamilyMemberService extends BaseJpaService<BasePatientFamilyMemberDO,BasePatientFamilyMemberDao> {
//
//    @Autowired
//    private BasePatientFamilyMemberDao familyMemberDao;
//
//    @Autowired
//    private BasePatientDao basePatientDao;
//
//    @Autowired
//    private JdbcTemplate jdbcTemplate;
//
//    public String createFamilyMember(String patient,String member,Integer relation)throws Exception{
//
//        BasePatientDO pDo = basePatientDao.findByIdAndDel(patient,"1");
//        BasePatientDO mDo = basePatientDao.findByIdAndDel(patient,"1");
//
//        BasePatientFamilyMemberDO family1 = new BasePatientFamilyMemberDO();
//
//        //添加正向关系
//        family1.setPatient(patient);
//        family1.setFamilyMember(member);
//        family1.setFamilyRelation(relation);
//        //默认添加已经授权记录,用户同意授权之后调用此接口
//        family1.setIsAuthorize(1);
//
//        //添加反向关系
//        BasePatientFamilyMemberDO family2 = new BasePatientFamilyMemberDO();
//
//        family1.setPatient(patient);
//        family1.setFamilyMember(member);
//        family1.setFamilyRelation(familyRelationTrans(mDo,relation));
//        //默认添加已经授权记录,用户同意授权之后调用此接口
//        family1.setIsAuthorize(1);
//
//        return "1";
//    }
//
//    public String delFamilyMember(String patient,String member)throws Exception{
//        BasePatientFamilyMemberDO family1 = familyMemberDao.findByPatientAndFamilyMember(patient,member);
//        BasePatientFamilyMemberDO family2 = familyMemberDao.findByPatientAndFamilyMember(member,patient);
//        familyMemberDao.delete(family1);
//        familyMemberDao.delete(family2);
//        return "1";
//    }
//
//    /**
//     * 家庭关系转换
//     *
//     * @param patient  居民
//     * @param relation 关系 1父亲 2母亲 3老公 4老婆 5儿子 6女儿 7其他
//     * @return
//     */
//    public int familyRelationTrans(BasePatientDO patient, Integer relation) throws Exception {
//        int relationTrans = 0;
//
//        switch (relation) {
//            case 1:
//            case 2:
//                if (patient.getSex() == 1) {
//                    relationTrans = 5;
//                } else if (patient.getSex() == 2) {
//                    relationTrans = 6;
//                } else {
//                    relationTrans = 0;
//                }
//                if (relationTrans == 0) {
//                    if (IdCardUtil.getSexForIdcard(StringUtils.isEmpty(patient.getIdcard()) ? "" : patient.getIdcard()).equals("1")) {
//                        relationTrans = 6;
//                    } else if (IdCardUtil.getSexForIdcard(StringUtils.isEmpty(patient.getIdcard()) ? "" : patient.getIdcard()).equals("2")) {
//                        relationTrans = 5;
//                    }
//                }
//                break;
//            case 3:
//                relationTrans = 4;
//                break;
//            case 4:
//                relationTrans = 3;
//                break;
//            case 5:
//            case 6:
//                if (patient.getSex() == 1) {
//                    relationTrans = 1;
//                } else if (patient.getSex() == 2) {
//                    relationTrans = 2;
//                } else {
//                    relationTrans = 0;
//                }
//                if (relationTrans == 0) {
//                    if (IdCardUtil.getSexForIdcard(StringUtils.isEmpty(patient.getIdcard()) ? "" : patient.getIdcard()).equals("1")) {
//                        relationTrans = 2;
//                    } else if (IdCardUtil.getSexForIdcard(StringUtils.isEmpty(patient.getIdcard()) ? "" : patient.getIdcard()).equals("2")) {
//                        relationTrans = 1;
//                    }
//                }
//                break;
//        }
//
//        return relationTrans;
//    }
//}