瀏覽代碼

Merge branch 'dev' of http://192.168.1.220:10080/jiwei/jw2.0 into dev

liuwenbin 7 年之前
父節點
當前提交
8b66f2d9ed

+ 0 - 8
common/common-entity/src/main/java/com/yihu/jw/entity/archives/PatientArchives.java

@ -14,7 +14,6 @@ import java.util.Date;
@Table(name = "wlyy_patient_archives")
public class PatientArchives extends IdEntityWithOperation implements Serializable {
    private String code;//档案编号
    private String saasId; //saasid
    private String patientCode;//关联居民登录code
    private String patientName;//姓名
@ -44,13 +43,6 @@ public class PatientArchives extends IdEntityWithOperation implements Serializab
    private String paymentCode;//支付方式(字典)
    private String payment;// 支付方式
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getPatientCode() {
        return patientCode;

+ 1 - 8
common/common-entity/src/main/java/com/yihu/jw/entity/archives/PatientArchivesInfo.java

@ -13,7 +13,7 @@ import java.util.Date;
@Entity
@Table(name = "wlyy_patient_archives_info")
public class PatientArchivesInfo extends IdEntityWithOperation implements Serializable {
    private String code; //业务主键
    private String saasId; //saasid
    private String archivesCode; //档案code
    private String level1;//1.历史情况,2.既往史,3.家族史,4.生活环境
@ -23,13 +23,6 @@ public class PatientArchivesInfo extends IdEntityWithOperation implements Serial
    private Date date;//关联时间
    private String remark; //备注/其他/描述/详情
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getSaasId() {
        return saasId;

+ 5 - 1
common/common-request-mapping/src/main/java/com/yihu/jw/rm/archives/PatientArchivesMapping.java

@ -7,8 +7,12 @@ public class PatientArchivesMapping {
    public static final String api_archives_common = "svr-archives";
    public static final Integer api_archives_fail = -1;
    public static final String api_success ="succes";
    public static class Archives{
        public static final String findPatientArchives = "/findPatientArchives";
        public static final String findPatientArchivesInfos = "/findPatientArchivesInfos";
        public static final String createPatientArchives = "/createPatientArchives";
        public static final String updatePatientArchives = "/updatePatientArchives";
    }
}

+ 97 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/archives/PatientArchivesInfoVO.java

@ -0,0 +1,97 @@
package com.yihu.jw.restmodel.archives;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * Created by Trick on 2018/2/8.
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(value = "居民档案详细信息", description = "居民档案详细信息")
public class PatientArchivesInfoVO {
    @ApiModelProperty("saasid")
    private String saasId; //saasid
    @ApiModelProperty("档案code")
    private String archivesCode; //档案code
    @ApiModelProperty("1.历史情况,2.既往史,3.家族史,4.生活环境")
    private String level1;//1.历史情况,2.既往史,3.家族史,4.生活环境
    @ApiModelProperty("子类别")
    private String level2; //子类别
    @ApiModelProperty("字典值,或判断值(有,无)")
    private String key; //字典值,或判断值(有,无)
    @ApiModelProperty("字典名称")
    private String value; //字典名称
    @ApiModelProperty("关联时间")
    private Date date;//关联时间
    @ApiModelProperty("备注/其他/描述/详情")
    private String remark; //备注/其他/描述/详情
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getArchivesCode() {
        return archivesCode;
    }
    public void setArchivesCode(String archivesCode) {
        this.archivesCode = archivesCode;
    }
    public String getLevel1() {
        return level1;
    }
    public void setLevel1(String level1) {
        this.level1 = level1;
    }
    public String getLevel2() {
        return level2;
    }
    public void setLevel2(String level2) {
        this.level2 = level2;
    }
    public String getKey() {
        return key;
    }
    public void setKey(String key) {
        this.key = key;
    }
    public String getValue() {
        return value;
    }
    public void setValue(String value) {
        this.value = value;
    }
    public Date getDate() {
        return date;
    }
    public void setDate(Date date) {
        this.date = date;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
}

+ 297 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/archives/PatientArchivesVo.java

@ -0,0 +1,297 @@
package com.yihu.jw.restmodel.archives;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * Created by Trick on 2018/2/8.
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(value = "居民档案基本信息", description = "居民档案基本信息")
public class PatientArchivesVO {
    @ApiModelProperty("saasid")
    private String saasId; //saasid
    @ApiModelProperty("关联居民登录code")
    private String patientCode;//关联居民登录code
    @ApiModelProperty("姓名")
    private String patientName;//姓名
    @ApiModelProperty("身份证号")
    private String idcard;//身份证号
    @ApiModelProperty("生日")
    private Date birthday;//生日
    @ApiModelProperty("性别,1男,2女")
    private Integer sex;//性别,1男,2女
    @ApiModelProperty("手机号")
    private String mobile;//手机号
    @ApiModelProperty("社保卡号")
    private String ssc;//社保卡号
    @ApiModelProperty("档案状态:1正常,0注销")
    private Integer status;//档案状态:1正常,0注销
    @ApiModelProperty("注销原因:1死亡,2.重复")
    private String cancelReseanType;//注销原因:1死亡,2.重复
    @ApiModelProperty("居委会代码(字典)")
    private String sickVillage;//居委会代码(字典)
    @ApiModelProperty("居委会")
    private String sickVillageName;//居委会
    @ApiModelProperty("常住类型 :1户籍,2非户籍")
    private String residentType;//常住类型 :1户籍,2非户籍
    @ApiModelProperty("血型:A,AB,O,B,N(不详)")
    private String blood;//血型:A,AB,O,B,N(不详)
    @ApiModelProperty(",阴性;2阳性;0 不详")
    private String RH;//1,阴性;2阳性;0 不详
    @ApiModelProperty("民族名称(字典)")
    private String nationCode;//民族名称(字典)
    @ApiModelProperty("民族名称")
    private String nation;//民族名称
    @ApiModelProperty("工作地点")
    private String workPlace;//工作地点
    @ApiModelProperty("联系人")
    private String contactPeople;//联系人
    @ApiModelProperty("联系人电话")
    private String contactMobile;//
    @ApiModelProperty("文化程度(字典)")
    private String educationCode;//文化程度(字典)
    @ApiModelProperty("文化程度")
    private String education;//文化程度
    @ApiModelProperty("职业(字典)")
    private String professionCode;//职业(字典)
    @ApiModelProperty("职业")
    private String profession;//职业·
    @ApiModelProperty("婚姻状况(字典)")
    private String marriageCode;//婚姻状况(字典)
    @ApiModelProperty("婚姻状况")
    private String marriage;//婚姻状况
    @ApiModelProperty("支付方式(字典)")
    private String paymentCode;//支付方式(字典)
    @ApiModelProperty("支付方式")
    private String payment;// 支付方式
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getPatientCode() {
        return patientCode;
    }
    public void setPatientCode(String patientCode) {
        this.patientCode = patientCode;
    }
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
    public Date getBirthday() {
        return birthday;
    }
    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }
    public Integer getSex() {
        return sex;
    }
    public void setSex(Integer sex) {
        this.sex = sex;
    }
    public String getMobile() {
        return mobile;
    }
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
    public String getSsc() {
        return ssc;
    }
    public void setSsc(String ssc) {
        this.ssc = ssc;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public String getCancelReseanType() {
        return cancelReseanType;
    }
    public void setCancelReseanType(String cancelReseanType) {
        this.cancelReseanType = cancelReseanType;
    }
    public String getSickVillage() {
        return sickVillage;
    }
    public void setSickVillage(String sickVillage) {
        this.sickVillage = sickVillage;
    }
    public String getSickVillageName() {
        return sickVillageName;
    }
    public void setSickVillageName(String sickVillageName) {
        this.sickVillageName = sickVillageName;
    }
    public String getResidentType() {
        return residentType;
    }
    public void setResidentType(String residentType) {
        this.residentType = residentType;
    }
    public String getBlood() {
        return blood;
    }
    public void setBlood(String blood) {
        this.blood = blood;
    }
    public String getRH() {
        return RH;
    }
    public void setRH(String RH) {
        this.RH = RH;
    }
    public String getNationCode() {
        return nationCode;
    }
    public void setNationCode(String nationCode) {
        this.nationCode = nationCode;
    }
    public String getNation() {
        return nation;
    }
    public void setNation(String nation) {
        this.nation = nation;
    }
    public String getWorkPlace() {
        return workPlace;
    }
    public void setWorkPlace(String workPlace) {
        this.workPlace = workPlace;
    }
    public String getContactPeople() {
        return contactPeople;
    }
    public void setContactPeople(String contactPeople) {
        this.contactPeople = contactPeople;
    }
    public String getContactMobile() {
        return contactMobile;
    }
    public void setContactMobile(String contactMobile) {
        this.contactMobile = contactMobile;
    }
    public String getEducationCode() {
        return educationCode;
    }
    public void setEducationCode(String educationCode) {
        this.educationCode = educationCode;
    }
    public String getEducation() {
        return education;
    }
    public void setEducation(String education) {
        this.education = education;
    }
    public String getProfessionCode() {
        return professionCode;
    }
    public void setProfessionCode(String professionCode) {
        this.professionCode = professionCode;
    }
    public String getProfession() {
        return profession;
    }
    public void setProfession(String profession) {
        this.profession = profession;
    }
    public String getMarriageCode() {
        return marriageCode;
    }
    public void setMarriageCode(String marriageCode) {
        this.marriageCode = marriageCode;
    }
    public String getMarriage() {
        return marriage;
    }
    public void setMarriage(String marriage) {
        this.marriage = marriage;
    }
    public String getPaymentCode() {
        return paymentCode;
    }
    public void setPaymentCode(String paymentCode) {
        this.paymentCode = paymentCode;
    }
    public String getPayment() {
        return payment;
    }
    public void setPayment(String payment) {
        this.payment = payment;
    }
}

+ 80 - 1
svr/svr-wlyy-archives/src/main/java/com/yihu/jw/controller/PatientArchivesController.java

@ -1,22 +1,38 @@
package com.yihu.jw.controller;
import com.alibaba.fastjson.JSON;
import com.yihu.jw.entity.archives.PatientArchives;
import com.yihu.jw.entity.archives.PatientArchivesInfo;
import com.yihu.jw.iot.device.IotDeviceQualityInspectionPlanDO;
import com.yihu.jw.restmodel.archives.PatientArchivesInfoVO;
import com.yihu.jw.restmodel.archives.PatientArchivesVO;
import com.yihu.jw.restmodel.archives.Test;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.rm.archives.PatientArchivesMapping;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.jw.service.PatientArchivesSevice;
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.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
/**
 * Created by Trick on 2018/2/7.
 */
@RestController
@RequestMapping(PatientArchivesMapping.api_archives_common)
@Api(tags = "居民建档相关操作", description = "居民建档相关操作")
public class PatientArchivesController {
public class PatientArchivesController extends EnvelopRestController {
    @Autowired
    private PatientArchivesSevice patientArchivesSevice;
    @GetMapping(value = "test")
    @ApiOperation(value = "测试")
@ -26,4 +42,67 @@ public class PatientArchivesController {
        t.setFileType("1");
        return t;
    }
    @GetMapping(value = PatientArchivesMapping.Archives.findPatientArchives)
    @ApiOperation(value = "查询健康信息列表")
    public Envelop<PatientArchivesVO> findPatientArchives(@ApiParam(name = "name", value = "姓名(模糊匹配)")
                                                          @RequestParam(value = "name", required = false)String name,
                                                          @ApiParam(name = "status", value = "档案状态")
                                                          @RequestParam(value = "status", required = false)String status,
                                                          @ApiParam(name = "cancelReseanType", value = "注销状态")
                                                          @RequestParam(value = "cancelReseanType", required = false)String cancelReseanType,
                                                          @ApiParam(name = "page", value = "分页") @RequestParam(value = "page", required = false)Integer page,
                                                          @ApiParam(name = "size", value = "每一页大小")@RequestParam(value = "size", required = false )Integer size){
        try {
            return patientArchivesSevice.queryPatientArchivesPage(page,size,status, cancelReseanType ,name);
        }catch (Exception e){
            e.printStackTrace();
            return Envelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = PatientArchivesMapping.Archives.findPatientArchivesInfos)
    @ApiOperation(value = "查询健康信息详情列表")
    public Envelop<PatientArchivesInfoVO> queryPatientArchivesInfoPage(@ApiParam(name = "code", value = "档案编号")
                                                                           @RequestParam(value = "code", required = false)String code){
        try {
            return patientArchivesSevice.queryPatientArchivesInfoPage(code);
        }catch (Exception e){
            e.printStackTrace();
            return Envelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = PatientArchivesMapping.Archives.createPatientArchives)
    @ApiOperation(value = "创建健康信息详情列表")
    public Envelop<Boolean> createPatientArchives(@ApiParam(name = "patientArchives", value = "建档基本信息Json")
                                                  @RequestParam(value = "patientArchives", required = true)String patientArchives,
                                                  @ApiParam(name = "list", value = "建档详情")
                                                  @RequestParam(value = "list", required = true)List<PatientArchivesInfoVO> list){
        try {
            PatientArchives ps = toEntity(patientArchives, PatientArchives.class);
            List<PatientArchivesInfo> infos = new ArrayList<>();
            convertToModels(list,infos,PatientArchivesInfo.class);
            return patientArchivesSevice.createPatientArchives(ps,infos);
        }catch (Exception e){
            e.printStackTrace();
            return Envelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = PatientArchivesMapping.Archives.updatePatientArchives)
    @ApiOperation(value = "更新健康信息详情列表")
    public Envelop<Boolean> updatePatientArchives(@ApiParam(name = "patientArchives", value = "建档基本信息Json")
                                                  @RequestParam(value = "patientArchives", required = true)String patientArchives,
                                                  @ApiParam(name = "list", value = "建档详情")
                                                  @RequestParam(value = "list", required = true)List<PatientArchivesInfoVO> list){
        try {
            PatientArchives ps = toEntity(patientArchives, PatientArchives.class);
            List<PatientArchivesInfo> infos = new ArrayList<>();
            convertToModels(list,infos,PatientArchivesInfo.class);
            return patientArchivesSevice.updatePatientArchives(ps,infos);
        }catch (Exception e){
            e.printStackTrace();
            return Envelop.getError(e.getMessage());
        }
    }
}

+ 4 - 0
svr/svr-wlyy-archives/src/main/java/com/yihu/jw/dao/PatientArchivesInfoDao.java

@ -4,9 +4,13 @@ import com.yihu.jw.entity.archives.PatientArchivesInfo;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Trick on 2018/2/7.
 */
public interface PatientArchivesInfoDao extends PagingAndSortingRepository<PatientArchivesInfo, String>,
        JpaSpecificationExecutor<PatientArchivesInfo> {
    List<PatientArchivesInfo> findByArchivesCodeOrderByLevel1(String archivesCode);
    int deleteByArchivesCode(String archivesCode);
}

+ 128 - 1
svr/svr-wlyy-archives/src/main/java/com/yihu/jw/service/PatientArchivesSevice.java

@ -1,13 +1,140 @@
package com.yihu.jw.service;
import com.yihu.base.mysql.query.BaseJpaService;
import com.yihu.jw.dao.PatientArchivesDao;
import com.yihu.jw.dao.PatientArchivesInfoDao;
import com.yihu.jw.entity.archives.PatientArchives;
import com.yihu.jw.entity.archives.PatientArchivesInfo;
import com.yihu.jw.iot.company.IotCompanyDO;
import com.yihu.jw.restmodel.archives.PatientArchivesInfoVO;
import com.yihu.jw.restmodel.archives.PatientArchivesVO;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.iot.company.IotCompanyTypeVO;
import com.yihu.jw.restmodel.iot.company.IotCompanyVO;
import com.yihu.jw.rm.archives.PatientArchivesMapping;
import com.yihu.jw.rm.iot.IotRequestMapping;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.awt.*;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
 * Created by Trick on 2018/2/7.
 */
@Service
@Transactional
public class PatientArchivesSevice {
public class PatientArchivesSevice extends BaseJpaService<PatientArchives,PatientArchivesDao> {
    @Autowired
    private PatientArchivesInfoDao patientArchivesInfoDao;
    @Autowired
    private PatientArchivesDao patientArchivesDao;
    /**
     * 分页查找健康档案
     * @param page
     * @param size
     * @param status
     * @param name
     * @return
     * @throws ParseException
     */
    public Envelop<PatientArchivesVO> queryPatientArchivesPage(Integer page, Integer size, String status,String cancelReseanType ,String name) throws ParseException {
        String filters = "";
        String semicolon = "";
        if(StringUtils.isNotBlank(name)){
            filters = "patientName?"+name+"";
            semicolon = ";";
        }
        if(StringUtils.isNotBlank(status)){
            filters += semicolon +"status="+status;
            semicolon = ";";
        }
        if(StringUtils.isBlank(cancelReseanType)){
            filters+= semicolon + "cancelReseanType="+cancelReseanType+"";
            semicolon = ";";
        }
        String sorts = "-createTime";
        //得到list数据
        List<PatientArchivesVO> list = search(null, filters, sorts, page, size);
        //获取总数
        long count = getCount(filters);
        //DO转VO
        List<PatientArchivesVO> patientArchivesVOs = convertToModelVOs(list,new ArrayList<>(list.size()));
        return Envelop.getSuccessListWithPage(PatientArchivesMapping.api_success,patientArchivesVOs, page, size,count);
    }
    /**
     * 获取档案详情
     * @return
     * @throws ParseException
     */
    public Envelop<PatientArchivesInfoVO> queryPatientArchivesInfoPage(String code) throws ParseException {
        List<PatientArchivesInfo> list = patientArchivesInfoDao.findByArchivesCodeOrderByLevel1(code);
        List<PatientArchivesInfoVO> patientArchivesinfoVOs = convertToModelVOs2(list,new ArrayList<>(list.size()));
        return Envelop.getSuccessList(PatientArchivesMapping.api_success,patientArchivesinfoVOs);
    }
    public Envelop<Boolean> createPatientArchives(PatientArchives patientArchives,List<PatientArchivesInfo> list){
        patientArchivesDao.save(patientArchives);
        patientArchivesInfoDao.save(list);
        Envelop envelop = new Envelop();
        envelop.setObj(true);
        return envelop;
    }
    public  Envelop<Boolean> updatePatientArchives(PatientArchives patientArchives,List<PatientArchivesInfo> list){
        patientArchivesDao.save(patientArchives);
        patientArchivesInfoDao.deleteByArchivesCode(patientArchives.getId());
        patientArchivesInfoDao.save(list);
        Envelop envelop = new Envelop();
        envelop.setObj(true);
        return envelop;
    }
    /**
     * 转换
     * @param sources
     * @param targets
     * @return
     */
    public List<PatientArchivesVO> convertToModelVOs(Collection sources, List<PatientArchivesVO> targets){
        sources.forEach(one -> {
            PatientArchivesVO target = new PatientArchivesVO();
            BeanUtils.copyProperties(one, target);
            targets.add(target);
        });
        return targets;
    }
    /**
     * 转换
     * @param sources
     * @param targets
     * @return
     */
    public List<PatientArchivesInfoVO> convertToModelVOs2(Collection sources, List<PatientArchivesInfoVO> targets){
        sources.forEach(one -> {
            PatientArchivesInfoVO target = new PatientArchivesInfoVO();
            BeanUtils.copyProperties(one, target);
            targets.add(target);
        });
        return targets;
    }
}