Browse Source

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

yeshijie 7 years ago
parent
commit
3e3c96b18c

+ 11 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/ChildImmuneDetailInfoDao.java

@ -0,0 +1,11 @@
//package com.yihu.wlyy.repository.patient;
//
//import com.yihu.wlyy.entity.patient.prenatal.ChildImmuneDetailInfo;
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
///**
// * Created by yeshijie on 2017/10/17.
// */
//public interface ChildImmuneDetailInfoDao extends PagingAndSortingRepository<ChildImmuneDetailInfo, Long>, JpaSpecificationExecutor<ChildImmuneDetailInfo> {
//}

+ 11 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/ChildImmuneInfoDao.java

@ -0,0 +1,11 @@
//package com.yihu.wlyy.repository.patient;
//
//import com.yihu.wlyy.entity.patient.prenatal.ChildImmuneInfo;
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
///**
// * Created by yeshijie on 2017/10/17.
// */
//public interface ChildImmuneInfoDao extends PagingAndSortingRepository<ChildImmuneInfo, Long>, JpaSpecificationExecutor<ChildImmuneInfo> {
//}

+ 19 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/ChildInfoDao.java

@ -0,0 +1,19 @@
//package com.yihu.wlyy.repository.patient;
//
//import com.yihu.wlyy.entity.patient.Patient;
//import com.yihu.wlyy.entity.patient.prenatal.ChildInfo;
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.jpa.repository.Query;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
///**
// * Created by yeshijie on 2017/10/17.
// */
//public interface ChildInfoDao extends PagingAndSortingRepository<ChildInfo, Long>, JpaSpecificationExecutor<ChildInfo> {
//
//    @Query("select p from ChildInfo p where p.barcodeNo=?1")
//    ChildInfo findByBarcodeNo(String barcodeNo);
//
//    @Query("select p from ChildInfo p where p.code=?1")
//    ChildInfo findByCode(String code);
//}

+ 19 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/ImmuneDictDao.java

@ -0,0 +1,19 @@
//package com.yihu.wlyy.repository.patient;
//
//import com.yihu.wlyy.entity.patient.Patient;
//import com.yihu.wlyy.entity.patient.prenatal.ImmuneDict;
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.jpa.repository.Query;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
//import java.util.List;
//
///**
// * Created by yeshijie on 2017/10/17.
// */
//public interface ImmuneDictDao extends PagingAndSortingRepository<ImmuneDict, Long>, JpaSpecificationExecutor<ImmuneDict> {
//
//    @Query("select p from ImmuneDict p where p.immuneType=?1 and p.effectiveSign=1 and p.del =1")
//    List<ImmuneDict> findByImmuneType(Integer immuneType);
//
//}

+ 19 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/ImmuneHospitalDictDao.java

@ -0,0 +1,19 @@
//package com.yihu.wlyy.repository.patient;
//
//import com.yihu.wlyy.entity.patient.prenatal.ChildImmuneDetailInfo;
//import com.yihu.wlyy.entity.patient.prenatal.ImmuneDict;
//import com.yihu.wlyy.entity.patient.prenatal.ImmuneHospitalDict;
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.jpa.repository.Query;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
//import java.util.List;
//
///**
// * Created by yeshijie on 2017/10/17.
// */
//public interface ImmuneHospitalDictDao extends PagingAndSortingRepository<ImmuneHospitalDict, Long>, JpaSpecificationExecutor<ChildImmuneDetailInfo> {
//
//    @Query("select p from ImmuneHospitalDict p where p.hospital=?1 and p.immuneType=2 and p.effectiveSign=1 and p.del =1")
//    List<ImmuneHospitalDict> findByHospital(String hospital);
//}

+ 12 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/ImmuneMappingDao.java

@ -0,0 +1,12 @@
//package com.yihu.wlyy.repository.patient;
//
//import com.yihu.wlyy.entity.patient.prenatal.ChildImmuneDetailInfo;
//import com.yihu.wlyy.entity.patient.prenatal.ImmuneMapping;
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
///**
// * Created by yeshijie on 2017/10/17.
// */
//public interface ImmuneMappingDao extends PagingAndSortingRepository<ImmuneMapping, Long>, JpaSpecificationExecutor<ChildImmuneDetailInfo> {
//}

+ 13 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/ImmuneNeedleDao.java

@ -0,0 +1,13 @@
//package com.yihu.wlyy.repository.patient;
//
//import com.yihu.wlyy.entity.patient.prenatal.ImmuneNeedle;
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
///**
// * Created by yeshijie on 2017/10/17.
// */
//public interface ImmuneNeedleDao extends PagingAndSortingRepository<ImmuneNeedle, Long>, JpaSpecificationExecutor<ImmuneNeedle> {
//
//
//}

+ 5 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/PatientFamilyMemberDao.java

@ -1,7 +1,9 @@
package com.yihu.wlyy.repository.patient;
import com.yihu.wlyy.entity.patient.PatientFamilyMember;
import com.yihu.wlyy.entity.patient.prenatal.ChildInfo;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
@ -14,6 +16,9 @@ import java.util.List;
public interface PatientFamilyMemberDao extends PagingAndSortingRepository<PatientFamilyMember, Long>,
        JpaSpecificationExecutor<PatientFamilyMember> {
    @Query("select p from PatientFamilyMember p where p.familyMember=?1 and p.familyRelation=?2 ")
    PatientFamilyMember findByFamilyMember(String familyMember,Integer familyRelation);
    /**
     * 查询居民的某个成员
     *

+ 1 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/family/FamilyMemberService.java

@ -80,6 +80,7 @@ public class FamilyMemberService extends BaseService {
        relations.put(5, "儿子");
        relations.put(6, "女儿");
        relations.put(7, "未知");
        relations.put(8, "免疫关联");
    }
    /**

+ 155 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prenatalInspector/ChildImmuneService.java

@ -0,0 +1,155 @@
//package com.yihu.wlyy.service.app.prenatalInspector;
//
//import com.alibaba.fastjson.JSONArray;
//import com.alibaba.fastjson.JSONObject;
//import com.yihu.wlyy.entity.patient.PatientFamilyMember;
//import com.yihu.wlyy.entity.patient.SignFamily;
//import com.yihu.wlyy.entity.patient.prenatal.ChildInfo;
//import com.yihu.wlyy.entity.patient.prenatal.ImmuneDict;
//import com.yihu.wlyy.entity.patient.prenatal.ImmuneHospitalDict;
//import com.yihu.wlyy.repository.patient.*;
//import com.yihu.wlyy.service.BaseService;
//import com.yihu.wlyy.util.DateUtil;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//import org.springframework.transaction.annotation.Transactional;
//
//import java.util.Date;
//import java.util.List;
//
///**
// * Created by yeshijie on 2017/10/18.
// */
//@Component
//@Transactional(rollbackFor = Exception.class)
//public class ChildImmuneService extends BaseService{
//
//    @Autowired
//    private ChildInfoDao childInfoDao;
//    @Autowired
//    private PatientFamilyMemberDao memberDao;
//    @Autowired
//    private SignFamilyDao signFamilyDao;
//    @Autowired
//    private ImmuneDictDao immuneDictDao;
//    @Autowired
//    private ImmuneHospitalDictDao immuneHospitalDictDao;
//    @Autowired
//    private ImmuneMappingDao immuneMappingDao;
//    @Autowired
//    private ImmuneNeedleDao immuneNeedleDao;
//    @Autowired
//    private ChildImmuneDetailInfoDao childImmuneDetailInfoDao;
//    @Autowired
//    private ChildImmuneInfoDao childImmuneInfoDao;
//
//    /**
//     * 获取儿童信息
//     * @param barcodeNo
//     * @return
//     */
//    public JSONObject findChildInfo(String barcodeNo,String patient){
//        Integer status = 0;
//        ChildInfo childInfo = childInfoDao.findByBarcodeNo(barcodeNo);
//        if(childInfo==null){
//            //请求智业接口
//
//
//            childInfoDao.save(childInfo);
//        }
//
//        PatientFamilyMember familyMember = memberDao.findByFamilyMember(childInfo.getCode(),8);
//        if(familyMember!=null){
//            if(patient.equals(familyMember.getPatient())){
//                status = -2;
//            }else {
//                status = -1;
//            }
//        }
//
//        JSONObject re = new JSONObject();
//        re.put("name","张三");
//        re.put("age", DateUtil.getChildAge(DateUtil.strToDate("2017-01-01")));
//        re.put("birthday","2017-01-01");
//        re.put("sex","1");//0 未知的性别,1男,2女,9未说明的性别
//        re.put("barcodeNo","350400201609090099");
//        re.put("status",status);
//
//        return re;
//    }
//
//    /**
//     * 绑定儿童信息
//     * @param barcodeNo
//     * @param patient
//     * @return
//     */
//    public Integer bindChildInfo(String barcodeNo,String patient){
//        Integer re = 0;
//        ChildInfo childInfo = childInfoDao.findByBarcodeNo(barcodeNo);
//
//        PatientFamilyMember familyMember = memberDao.findByFamilyMember(childInfo.getCode(),8);
//        if(familyMember!=null){
//            if(patient.equals(familyMember.getPatient())){
//                return -2;
//            }else {
//                return -1;
//            }
//        }
//        familyMember = new PatientFamilyMember();
//        familyMember.setIsAuthorize(1);
//        familyMember.setPatient(patient);
//        familyMember.setCzrq(new Date());
//        familyMember.setFamilyMember(childInfo.getCode());
//        familyMember.setFamilyRelation(8);//免疫关联
//        memberDao.save(familyMember);
//        return re;
//    }
//
//    /**
//     * 获取免疫家人
//     * @param patient
//     * @return
//     */
//    public JSONArray getImmuneFamily(String patient){
//        JSONArray re = new JSONArray();
//        List<PatientFamilyMember> familyMemberList =  memberDao.findByPatientAndFamilyRelation(patient,8);
//        familyMemberList.forEach(one->{
//            JSONObject json = new JSONObject();
//            ChildInfo childInfo = childInfoDao.findByCode(one.getFamilyMember());
//            json.put("name",childInfo.getName());
//            json.put("age", DateUtil.getChildAge(childInfo.getBirthday()));
//            json.put("birthday",childInfo.getBirthday());
//            json.put("sex",childInfo.getSickSex());//0 未知的性别,1男,2女,9未说明的性别
//            json.put("barcodeNo",childInfo.getBarcodeNo());
//            json.put("photo",childInfo.getPhoto());
//            re.add(json);
//        });
//        return re;
//    }
//
//    /**
//     * 免疫计划表-居民端
//     * @param patient
//     */
//    public void getImmunePlan(String patient){
//
//        SignFamily signFamily = signFamilyDao.findByPatient(patient);
//        if(signFamily==null){
//            //未签约
//
//        }
//
//        //获取必打疫苗
//        List<ImmuneDict> oneImmuneList = immuneDictDao.findByImmuneType(1);
//
//
//        //获取非必打疫苗
//        List<ImmuneHospitalDict> twoImmuneList = immuneHospitalDictDao.findByHospital(signFamily.getHospital());
//
//
//
//    }
//
//
//}

+ 33 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/DateUtil.java

@ -883,4 +883,37 @@ public class DateUtil {
		cal.set(Calendar.DATE, cal.get(Calendar.DATE) +(days));
		return  cal.getTime();
	}
	/**
	 * 获取儿童的年龄
	 * @param birthday
	 * @return
     */
	public static String getChildAge(Date date){
		Calendar now = Calendar.getInstance();
		Calendar cal = Calendar.getInstance();
		cal.setTime(date);
		int year = now.get(Calendar.YEAR)-cal.get(Calendar.YEAR);
		int month = now.get(Calendar.MONTH)-cal.get(Calendar.MONTH);
		if(month<0){
			year--;
			month+=12;
		}
		int day = now.get(Calendar.DAY_OF_MONTH)-cal.get(Calendar.DAY_OF_MONTH);
		if(day<0){
			month--;
			Calendar temp = Calendar.getInstance();
			temp.setTime(date);
			temp.add(Calendar.MONTH,1);
			temp.set(Calendar.DAY_OF_MONTH,1);
			temp.add(Calendar.DAY_OF_MONTH,-1);
			day = temp.get(Calendar.DAY_OF_MONTH)+now.get(Calendar.DAY_OF_MONTH)-cal.get(Calendar.DAY_OF_MONTH);
		}
		String y = year>0? year+"岁":"";
		String m = month>0? month+"月":"";
		String d = day>0? day+"天":"";
		return y+m+d;
	}
}

+ 35 - 10
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prenatalInspector/ChildImmuneController.java

@ -1,10 +1,13 @@
//package com.yihu.wlyy.web.patient.prenatalInspector;
//
//import com.alibaba.fastjson.JSONArray;
//import com.alibaba.fastjson.JSONObject;
//import com.yihu.wlyy.service.app.prenatalInspector.ChildImmuneService;
//import com.yihu.wlyy.web.BaseController;
//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.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
@ -19,14 +22,19 @@
//@Api(description = "患者端-免疫")
//public class ChildImmuneController extends BaseController{
//
//    @Autowired
//    private ChildImmuneService childImmuneService;
//
//
//    @ApiOperation("获取儿童信息")
//    @RequestMapping(value = "findChildInfo", method = RequestMethod.GET)
//    public String findChildInfo(@ApiParam(name = "pregnancyNo", value = "产检号", defaultValue = "")
//                                                @RequestParam(value = "pregnancyNo", required = true) String pregnancyNo){
//    public String findChildInfo(@ApiParam(name = "barcodeNo", value = "儿童条形码", defaultValue = "")
//                                @RequestParam(value = "barcodeNo", required = true) String barcodeNo){
//        try {
//            JSONObject jsonObject = null;
//            JSONObject jsonObject = childImmuneService.findChildInfo(barcodeNo,getUID());
//            if(jsonObject.size()==0){
//                return error(-1,"条码有误,请重新确认");
//            }
//            return write(200, "查询成功!", "data", jsonObject);
//        }catch (Exception e){
//            error(e);
@ -35,19 +43,36 @@
//    }
//
//    @ApiOperation("绑定儿童关联")
//    @RequestMapping(value = "findChildInfo", method = RequestMethod.GET)
//    public String bindChildInfo(@ApiParam(name = "pregnancyNo", value = "产检号", defaultValue = "")
//                                @RequestParam(value = "pregnancyNo", required = true) String pregnancyNo){
//    @RequestMapping(value = "bindChildInfo", method = RequestMethod.POST)
//    public String bindChildInfo(@ApiParam(name = "barcodeNo", value = "儿童条形码", defaultValue = "")
//                                @RequestParam(value = "barcodeNo", required = true) String barcodeNo){
//        try {
//            JSONObject jsonObject = null;
//
//            Integer status = childImmuneService.bindChildInfo(barcodeNo,getUID());
//            if(status==-1){
//                return error(-1,"绑定失败,儿童信息已被其他居民绑定");
//            }else if(status==-2){
//                return error(-1,"已绑定成功,请不要重复绑定");
//            }else {
//                return success("绑定成功!");
//            }
//
//        }catch (Exception e){
//            error(e);
//            return error(-1,"绑定失败");
//        }
//    }
//
//            return write(200, "查询成功!", "data", jsonObject);
//    @ApiOperation("获取免疫关联的家人")
//    @RequestMapping(value = "bindChildInfo", method = RequestMethod.GET)
//    public String getImmuneFamily(){
//        try {
//            JSONArray response = childImmuneService.getImmuneFamily(getUID());
//            return write(200, "查询成功!", "list", response);
//        }catch (Exception e){
//            error(e);
//            return error(-1,"查询失败");
//            return error(-1,"绑定失败");
//        }
//    }
//
//
//}