yeshijie пре 7 година
родитељ
комит
79bade8df7

+ 19 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/prenatal/PrenatalInspectorPreCardDao.java

@ -0,0 +1,19 @@
package com.yihu.wlyy.service.dao.prenatal;
import com.yihu.wlyy.service.entity.prenatal.PrenatalInspectorPreCard;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by yeshijie on 2017/6/6.
 */
public interface PrenatalInspectorPreCardDao extends PagingAndSortingRepository<PrenatalInspectorPreCard, Long>{
    @Query("select a from PrenatalInspectorPreCard a where a.patient = ?1 and a.del='1' order by a.lastMenstrualDate desc")
    List<PrenatalInspectorPreCard> findByPatient(String patient);
    @Query("select a from PrenatalInspectorPreCard a where a.code = ?1 ")
    PrenatalInspectorPreCard findByCode(String code);
}

+ 550 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/prenatal/PrenatalInspectorPreCard.java

@ -0,0 +1,550 @@
package com.yihu.wlyy.service.entity.prenatal;
import com.yihu.wlyy.service.common.model.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
/**
 * 产检预建卡
 * Created by yeshijie on 2017/6/6.
 */
@Entity
@Table(name = "wlyy_prenatal_inspector_pre_card")
public class PrenatalInspectorPreCard extends IdEntity implements Serializable{
    private String code;//产检code
    private String patient;//居民code
    private String name;//居民姓名
    private String ssc;//医保卡号
    private String idcard;//身份证号
    private Date birthday;//出生日期
    private String mobile;//手机号码
    private String doctor;//团队长
    private String doctorName;//医生名称
    private String jwDoctor;//基位医生code
    private Date lastMenstrualDate;//末次月经时间
    private String allergyHistory;//过敏史
    private String maritalStatus;//婚姻情况(1未婚,2已婚,3再婚,4丧偶,5离婚,6分居)
    private String residentialAddress;//现居住址
    private String residentialProvince;//住址省份
    private String residentialCity;//住址城市
    private String residentialTown;//住址区(县)
    private String permanentAddress;//户籍地址
    private String permanentProvince;//户籍省份
    private String permanentCity;//户籍城市
    private String permanentTown;//户籍区(县)
    private Date marryDate;//结婚日期
    private String spouseName;//配偶姓名
    private Date spouseBirthday;//配偶生日
    private String spouseMobile;//配偶手机
    private String eatFolate;//服用叶酸(1是,0否)
    private String eatAcyeterion;//服避孕药(1是,0否)
    private String smoke;//吸烟(1是,0否)
    private String drink;//饮酒(1是,0否)
    private String eatOtherDrugs;//服用其他药物
    private String workUnit;//工作单位
    private String height;//身高(cm)
    private String weight;//体重(kg)
    private Integer vaginalDeliveryTimes;//阴道分娩次数(次)
    private Integer caesareanSectionTimes;//剖宫产次数(次)
    private Integer menarcheAge;//初潮(岁)
    private Integer menstrualPeriod;//经期(天)
    private Integer menstrualCycle;//周期(天)
    private String diseaseHistory;//疾病史
    private String operationHistory;//手术史
    private String hypertensionHistory;//'高血压',
    private String diabetesHistory;//'糖尿病',
    private String mentalDiseaseHistory;//'精神病',
    private String hyperthroidismHistory;//'甲亢',
    private String bloodDiseaseHistory;//'血液病',
    private String epilepsiaHistory;//'癫痫',
    private String otherInformation;//其他
    private String effective;//是否有效(1有效,0无效)
    private String status;//状态
    private Date dueDate;//预产期
    private String hospital;//医院
    private String hospitalName;//医院名称
    private String bedNo;//床位
    private String orderBedTime;//预约床位时间
    private String inspectionPhase;//检查阶段(1社区检查,2医院检查)
    private String del;//是否删除(1正常,0废弃)
    private Date czrq;//创建日期
    private String uploadStatus;// '上传状态(0未上传,1上传成功,2上传失败)',
    private String uploadMsg; //上传记录\'',
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getSsc() {
        return ssc;
    }
    public void setSsc(String ssc) {
        this.ssc = ssc;
    }
    public Date getBirthday() {
        return birthday;
    }
    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }
    public String getMobile() {
        return mobile;
    }
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
    public Date getLastMenstrualDate() {
        return lastMenstrualDate;
    }
    public void setLastMenstrualDate(Date lastMenstrualDate) {
        this.lastMenstrualDate = lastMenstrualDate;
    }
    public String getAllergyHistory() {
        return allergyHistory;
    }
    public void setAllergyHistory(String allergyHistory) {
        this.allergyHistory = allergyHistory;
    }
    public String getMaritalStatus() {
        return maritalStatus;
    }
    public void setMaritalStatus(String maritalStatus) {
        this.maritalStatus = maritalStatus;
    }
    public String getResidentialAddress() {
        return residentialAddress;
    }
    public void setResidentialAddress(String residentialAddress) {
        this.residentialAddress = residentialAddress;
    }
    public String getResidentialProvince() {
        return residentialProvince;
    }
    public void setResidentialProvince(String residentialProvince) {
        this.residentialProvince = residentialProvince;
    }
    public String getResidentialCity() {
        return residentialCity;
    }
    public void setResidentialCity(String residentialCity) {
        this.residentialCity = residentialCity;
    }
    public String getResidentialTown() {
        return residentialTown;
    }
    public void setResidentialTown(String residentialTown) {
        this.residentialTown = residentialTown;
    }
    public String getPermanentAddress() {
        return permanentAddress;
    }
    public void setPermanentAddress(String permanentAddress) {
        this.permanentAddress = permanentAddress;
    }
    public String getPermanentProvince() {
        return permanentProvince;
    }
    public void setPermanentProvince(String permanentProvince) {
        this.permanentProvince = permanentProvince;
    }
    public String getPermanentCity() {
        return permanentCity;
    }
    public void setPermanentCity(String permanentCity) {
        this.permanentCity = permanentCity;
    }
    public String getPermanentTown() {
        return permanentTown;
    }
    public void setPermanentTown(String permanentTown) {
        this.permanentTown = permanentTown;
    }
    public Date getMarryDate() {
        return marryDate;
    }
    public void setMarryDate(Date marryDate) {
        this.marryDate = marryDate;
    }
    public String getSpouseName() {
        return spouseName;
    }
    public void setSpouseName(String spouseName) {
        this.spouseName = spouseName;
    }
    public Date getSpouseBirthday() {
        return spouseBirthday;
    }
    public void setSpouseBirthday(Date spouseBirthday) {
        this.spouseBirthday = spouseBirthday;
    }
    public String getSpouseMobile() {
        return spouseMobile;
    }
    public void setSpouseMobile(String spouseMobile) {
        this.spouseMobile = spouseMobile;
    }
    public String getEatFolate() {
        return eatFolate;
    }
    public void setEatFolate(String eatFolate) {
        this.eatFolate = eatFolate;
    }
    public String getEatAcyeterion() {
        return eatAcyeterion;
    }
    public void setEatAcyeterion(String eatAcyeterion) {
        this.eatAcyeterion = eatAcyeterion;
    }
    public String getSmoke() {
        return smoke;
    }
    public void setSmoke(String smoke) {
        this.smoke = smoke;
    }
    public String getDrink() {
        return drink;
    }
    public void setDrink(String drink) {
        this.drink = drink;
    }
    public String getEatOtherDrugs() {
        return eatOtherDrugs;
    }
    public void setEatOtherDrugs(String eatOtherDrugs) {
        this.eatOtherDrugs = eatOtherDrugs;
    }
    public String getWorkUnit() {
        return workUnit;
    }
    public void setWorkUnit(String workUnit) {
        this.workUnit = workUnit;
    }
    public String getHeight() {
        return height;
    }
    public void setHeight(String height) {
        this.height = height;
    }
    public String getWeight() {
        return weight;
    }
    public void setWeight(String weight) {
        this.weight = weight;
    }
    public Integer getVaginalDeliveryTimes() {
        return vaginalDeliveryTimes;
    }
    public void setVaginalDeliveryTimes(Integer vaginalDeliveryTimes) {
        this.vaginalDeliveryTimes = vaginalDeliveryTimes;
    }
    public Integer getCaesareanSectionTimes() {
        return caesareanSectionTimes;
    }
    public void setCaesareanSectionTimes(Integer caesareanSectionTimes) {
        this.caesareanSectionTimes = caesareanSectionTimes;
    }
    public Integer getMenarcheAge() {
        return menarcheAge;
    }
    public void setMenarcheAge(Integer menarcheAge) {
        this.menarcheAge = menarcheAge;
    }
    public Integer getMenstrualPeriod() {
        return menstrualPeriod;
    }
    public void setMenstrualPeriod(Integer menstrualPeriod) {
        this.menstrualPeriod = menstrualPeriod;
    }
    public Integer getMenstrualCycle() {
        return menstrualCycle;
    }
    public void setMenstrualCycle(Integer menstrualCycle) {
        this.menstrualCycle = menstrualCycle;
    }
    public String getDiseaseHistory() {
        return diseaseHistory;
    }
    public void setDiseaseHistory(String diseaseHistory) {
        this.diseaseHistory = diseaseHistory;
    }
    public String getOperationHistory() {
        return operationHistory;
    }
    public void setOperationHistory(String operationHistory) {
        this.operationHistory = operationHistory;
    }
    public String getOtherInformation() {
        return otherInformation;
    }
    public void setOtherInformation(String otherInformation) {
        this.otherInformation = otherInformation;
    }
    public String getEffective() {
        return effective;
    }
    public void setEffective(String effective) {
        this.effective = effective;
    }
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    public Date getDueDate() {
        return dueDate;
    }
    public void setDueDate(Date dueDate) {
        this.dueDate = dueDate;
    }
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
    public String getBedNo() {
        return bedNo;
    }
    public void setBedNo(String bedNo) {
        this.bedNo = bedNo;
    }
    public String getOrderBedTime() {
        return orderBedTime;
    }
    public void setOrderBedTime(String orderBedTime) {
        this.orderBedTime = orderBedTime;
    }
    public String getInspectionPhase() {
        return inspectionPhase;
    }
    public void setInspectionPhase(String inspectionPhase) {
        this.inspectionPhase = inspectionPhase;
    }
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
    public Date getCzrq() {
        return czrq;
    }
    public void setCzrq(Date czrq) {
        this.czrq = czrq;
    }
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
    public String getUploadStatus() {
        return uploadStatus;
    }
    public void setUploadStatus(String uploadStatus) {
        this.uploadStatus = uploadStatus;
    }
    public String getUploadMsg() {
        return uploadMsg;
    }
    public void setUploadMsg(String uploadMsg) {
        this.uploadMsg = uploadMsg;
    }
    public String getHypertensionHistory() {
        return hypertensionHistory;
    }
    public void setHypertensionHistory(String hypertensionHistory) {
        this.hypertensionHistory = hypertensionHistory;
    }
    public String getDiabetesHistory() {
        return diabetesHistory;
    }
    public void setDiabetesHistory(String diabetesHistory) {
        this.diabetesHistory = diabetesHistory;
    }
    public String getMentalDiseaseHistory() {
        return mentalDiseaseHistory;
    }
    public void setMentalDiseaseHistory(String mentalDiseaseHistory) {
        this.mentalDiseaseHistory = mentalDiseaseHistory;
    }
    public String getHyperthroidismHistory() {
        return hyperthroidismHistory;
    }
    public void setHyperthroidismHistory(String hyperthroidismHistory) {
        this.hyperthroidismHistory = hyperthroidismHistory;
    }
    public String getBloodDiseaseHistory() {
        return bloodDiseaseHistory;
    }
    public void setBloodDiseaseHistory(String bloodDiseaseHistory) {
        this.bloodDiseaseHistory = bloodDiseaseHistory;
    }
    public String getEpilepsiaHistory() {
        return epilepsiaHistory;
    }
    public void setEpilepsiaHistory(String epilepsiaHistory) {
        this.epilepsiaHistory = epilepsiaHistory;
    }
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    public String getJwDoctor() {
        return jwDoctor;
    }
    public void setJwDoctor(String jwDoctor) {
        this.jwDoctor = jwDoctor;
    }
}

+ 71 - 7
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/ZysoftMaternalService.java

@ -1,5 +1,13 @@
package com.yihu.wlyy.service.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.service.common.util.DateUtil;
import com.yihu.wlyy.service.dao.SignFamilyDao;
import com.yihu.wlyy.service.dao.prenatal.PrenatalInspectorPreCardDao;
import com.yihu.wlyy.service.entity.SignFamily;
import com.yihu.wlyy.service.entity.prenatal.PrenatalInspectorPreCard;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
@ -13,6 +21,11 @@ import java.util.Map;
@Service
public class ZysoftMaternalService extends ZysoftBaseService{
    @Autowired
    private PrenatalInspectorPreCardDao preCardDao;
    @Autowired
    private SignFamilyDao signFamilyDao;
    /**
     * 7.32获取孕妇建卡信息(妇幼保健)
@ -270,19 +283,70 @@ public class ZysoftMaternalService extends ZysoftBaseService{
     * @throws Exception
     */
    public String SaveEhrMaternalPreFirstExamRecord(String code) throws Exception{
        String[] hospitalMapping = getHospitalMapping(null); //获取机构映射
        PrenatalInspectorPreCard preCard = preCardDao.findByCode(code);
        JSONObject json = new JSONObject();
        json.put("SICK_NAME",preCard.getName());//姓名
        json.put("IDENTITY_CARD_NO",preCard.getIdcard());//身份证号码
        json.put("HEALTH_CARD_NO",preCard.getSsc());//孕妇医保卡
        json.put("BIRTHDAY",DateUtil.dateToStrLong(preCard.getBirthday()));//出生日期
        json.put("SICK_PHONE",preCard.getMobile());//手机号码
        json.put("MENSES_LAST",DateUtil.dateToStrLong(preCard.getLastMenstrualDate()));//末次月经
        json.put("ALLERGIC_HISTORY",preCard.getAllergyHistory());//过敏史
        json.put("MARITAL_STATE",preCard.getMaritalStatus());//婚姻情况
        json.put("SICK_ADDRESS",preCard.getResidentialAddress());//现居地址
        json.put("PERMANENT_ADDRESS_",preCard.getPermanentAddress());//户籍地址
        json.put("WEDDING_DATE_",DateUtil.dateToStrLong(preCard.getMarryDate()));//结婚日期
        json.put("LOVER_NAME",preCard.getSpouseName());//配偶姓名
        json.put("LOVER_BIRTHDAY",DateUtil.dateToStrLong(preCard.getSpouseBirthday()));//配偶生日
        json.put("LOVER_PHONE",preCard.getSpouseMobile());//配偶手机
        json.put("TAKE_FOLACIN",preCard.getEatFolate());//是否服用叶酸
        json.put("TAKE_ACYETERION",preCard.getEatAcyeterion());//是否服避孕药
        json.put("SMOKE",preCard.getSmoke());//是否吸烟
        json.put("DRUNK",preCard.getDrink());//是否饮酒
        json.put("PREGNANCY_NOW_HISTROY_OTHER",preCard.getEatOtherDrugs());//服用其他药物
        json.put("SICK_WORK_COMPANY",preCard.getWorkUnit());//工作单位
        json.put("HEIGHT",preCard.getHeight());//身高
        json.put("WEIGHT",preCard.getWeight());//体重
        json.put("VAGINAL_DELIVERY_TIMES",preCard.getVaginalDeliveryTimes());//阴道分娩次数
        json.put("CESAREAN_SECTION_TIMES",preCard.getCaesareanSectionTimes());//剖宫产次数
        json.put("MENARCHE_AGE",preCard.getMenarcheAge());//初潮
        json.put("PERIOD_DURATION",preCard.getMenstrualPeriod());//经期
        json.put("MENSTRUAL_CYCLE",preCard.getMenstrualCycle());//周期
        json.put("HYPERTENSION_HISTORY",preCard.getHypertensionHistory());//高血压
        json.put("DIABETES_HISTORY",preCard.getDiabetesHistory());//糖尿病
        json.put("MENTAL_DISEASE_HISTORY",preCard.getMentalDiseaseHistory());//精神病
        json.put("HYPERTHYROIDISM_HISTORY",preCard.getHyperthroidismHistory());//甲亢
        json.put("BLOOD_DISEASE_HISTORY",preCard.getBloodDiseaseHistory());//血液病
        json.put("EPILEPSIA_HISTORY",preCard.getEpilepsiaHistory());//癫痫
        json.put("OPERATION_HISTORY",preCard.getOperationHistory());//手术史
        json.put("OTHER_HISTORY",preCard.getOtherInformation());//其他
        json.put("QUERY_TIME",DateUtil.dateToStrLong(preCard.getCzrq()));//询问时间
        json.put("EXPECTED_TIME",DateUtil.dateToStrLong(preCard.getDueDate()));//预产期
        json.put("EXAM_TIME",DateUtil.dateToStrLong(preCard.getCzrq()));//检查时间
        SignFamily signFamily = signFamilyDao.findByPatient(preCard.getPatient());
        String[] hospitalMapping = getHospitalMapping(signFamily.getHospital()); //获取机构映射
        String hospital = hospitalMapping[0];
        String licence = hospitalMapping[1];
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("LICENCE",licence);
        Map<String,String> params = new HashMap<>();
        params.put("ORG_CODE",hospital);
        String response = postSecond("SaveEhrMaternalPreFirstExamRecord","上传孕妇预建卡信息",params,null,header,false,1,"3");
        header.put("OPERATOR",preCard.getJwDoctor());
        String response = postSecond("SaveEhrMaternalPreFirstExamRecord","上传孕妇预建卡信息",null,json,header,false,1,"3");
        JSONObject re = JSONObject.parseObject(response);
        JSONArray data = re.getJSONArray("DATA");
        if(data.size()>0&&"OK".equals(data.getJSONObject(0).getString("MESSAGE"))){
            preCard.setUploadStatus("1");
        }else {
            preCard.setUploadStatus("2");
        }
        preCard.setUploadMsg(response);
        preCardDao.save(preCard);
        return response;
    }