Kaynağa Gözat

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

yeshijie 7 yıl önce
ebeveyn
işleme
ef09ef27b9

+ 223 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/archive/Archive.java

@ -0,0 +1,223 @@
package com.yihu.wlyy.entity.doctor.archive;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by zhangdan on 2018/1/4.
 */
@Entity
@Table(name = "wlyy_archive")
public class Archive extends IdEntity {
    private String code;//唯一标识code
    private String archiveCode;//基卫档案code
    private String sickName;//姓名
    private String archiveOperatorName;// 建档人姓名
    private String doctorCode;// 医生code
    private int archiveStatus;//档案状态【1.未管理 2.死亡 3.正常 4.高危】【必填】
    private String archiveTime;//建档时间
    private int signStatus;// 签约状态【0未签约,1已签约】
    private String birthday;// 生日
    private int sickSex;//性别【1.男 2.女 9 未知】
    private String jwZoneCode;//所属社区
    private int identityType;//证件类型
    private String identityCardNo;//身份证号
    private String homePhone;// 本人电话
    private String homeAddress;//现住地址
    private String orgId;//新增默认传0
    private int residence;//户籍【1.户籍 2.非户籍】
    private String national;//民族
    private String origo;//户口所在地
    private int blood;//血型【1.A型 2.3.O型4.AB型 5.不详】
    private int bloodRh;//  RH阴性【1.否 2.是 3.不详】
    private int marriage;//  婚姻状况【10.未婚 20.已婚 30.丧偶 40.离婚 90.未说明的婚姻状况】
    private String insurCardNo;//  医保卡号
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getArchiveCode() {
        return archiveCode;
    }
    public void setArchiveCode(String archiveCode) {
        this.archiveCode = archiveCode;
    }
    public String getSickName() {
        return sickName;
    }
    public void setSickName(String sickName) {
        this.sickName = sickName;
    }
    public String getArchiveOperatorName() {
        return archiveOperatorName;
    }
    public void setArchiveOperatorName(String archiveOperatorName) {
        this.archiveOperatorName = archiveOperatorName;
    }
    public String getDoctorCode() {
        return doctorCode;
    }
    public void setDoctorCode(String doctorCode) {
        this.doctorCode = doctorCode;
    }
    public int getArchiveStatus() {
        return archiveStatus;
    }
    public void setArchiveStatus(int archiveStatus) {
        this.archiveStatus = archiveStatus;
    }
    public String getArchiveTime() {
        return archiveTime;
    }
    public void setArchiveTime(String archiveTime) {
        this.archiveTime = archiveTime;
    }
    public int getSignStatus() {
        return signStatus;
    }
    public void setSignStatus(int signStatus) {
        this.signStatus = signStatus;
    }
    public String getBirthday() {
        return birthday;
    }
    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }
    public int getSickSex() {
        return sickSex;
    }
    public void setSickSex(int sickSex) {
        this.sickSex = sickSex;
    }
    public String getJwZoneCode() {
        return jwZoneCode;
    }
    public void setJwZoneCode(String jwZoneCode) {
        this.jwZoneCode = jwZoneCode;
    }
    public int getIdentityType() {
        return identityType;
    }
    public void setIdentityType(int identityType) {
        this.identityType = identityType;
    }
    public String getIdentityCardNo() {
        return identityCardNo;
    }
    public void setIdentityCardNo(String identityCardNo) {
        this.identityCardNo = identityCardNo;
    }
    public String getHomePhone() {
        return homePhone;
    }
    public void setHomePhone(String homePhone) {
        this.homePhone = homePhone;
    }
    public String getHomeAddress() {
        return homeAddress;
    }
    public void setHomeAddress(String homeAddress) {
        this.homeAddress = homeAddress;
    }
    public String getOrgId() {
        return orgId;
    }
    public void setOrgId(String orgId) {
        this.orgId = orgId;
    }
    public int getResidence() {
        return residence;
    }
    public void setResidence(int residence) {
        this.residence = residence;
    }
    public String getNational() {
        return national;
    }
    public void setNational(String national) {
        this.national = national;
    }
    public String getOrigo() {
        return origo;
    }
    public void setOrigo(String origo) {
        this.origo = origo;
    }
    public int getBlood() {
        return blood;
    }
    public void setBlood(int blood) {
        this.blood = blood;
    }
    public int getBloodRh() {
        return bloodRh;
    }
    public void setBloodRh(int bloodRh) {
        this.bloodRh = bloodRh;
    }
    public int getMarriage() {
        return marriage;
    }
    public void setMarriage(int marriage) {
        this.marriage = marriage;
    }
    public String getInsurCardNo() {
        return insurCardNo;
    }
    public void setInsurCardNo(String insurCardNo) {
        this.insurCardNo = insurCardNo;
    }
}

+ 1 - 199
common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/archive/ArchiveInfo.java

@ -12,29 +12,7 @@ import javax.persistence.Table;
@Table(name = "wlyy_archive_info")
public class ArchiveInfo extends IdEntity {
    private String code;//唯一标识code
    private String archiveCode;//基卫档案code
    private String sickName;//姓名
    private String archiveOperatorName;// 建档人姓名
    private String doctorCode;// 医生code
    private int archiveStatus;//档案状态【1.未管理 2.死亡 3.正常 4.高危】【必填】
    private String archiveTime;//建档时间
    private int signStatus;// 签约状态【0未签约,1已签约】
    private String birthday;// 生日
    private int sickSex;//性别【1.男 2.女 9 未知】
    private String jwZoneCode;//所属社区
    private int identityType;//证件类型
    private String identityCardNo;//身份证号
    private String homePhone;// 本人电话
    private String homeAddress;//现住地址
    private String orgId;//新增默认传0
    private int residence;//户籍【1.户籍 2.非户籍】
    private String national;//民族
    private String origo;//户口所在地
    private int blood;//血型【1.A型 2.3.O型4.AB型 5.不详】
    private int bloodRh;//  RH阴性【1.否 2.是 3.不详】
    private int marriage;//  婚姻状况【10.未婚 20.已婚 30.丧偶 40.离婚 90.未说明的婚姻状况】
    private String insurCardNo;//  医保卡号
    private String archiveCode;//wlyy_archive的唯一标识code
    private int education;//  文化程度【1.文盲及半文盲 2.小学 3.初中 4.高中/技校/中专 5.大学大专及以上 6.不详】
    private int occupation;//  职业【1、国家机关、党群组织、企业、事业单位负责人 2、专业技术人员 3、办事人员和有关人员 4、商业、服务业员工 5、农、林、牧、渔、水利生产人员 6、生产、运输设备操作人员及有关人员 7、军人 8、不便分类的其他从业人员】
    private int medicalExpenses;//  支付方式【7.贫困救助 5.商业医疗保险 1.全公费 8.全自费 99.其它】
@ -53,14 +31,6 @@ public class ArchiveInfo extends IdEntity {
    private String  familyBrothers;//  家族史--兄弟姐妹【0无 1高血压 2糖尿病 3冠心病 4慢性阻塞性肺疾病 5恶性肿瘤 6脑卒中 7重性精神疾病 8结核病 9肝炎 10先天畸形 11其他】
    private String  familyChildren;//  家族史--子女【0无 1高血压 2糖尿病 3冠心病 4慢性阻塞性肺疾病 5恶性肿瘤 6脑卒中 7重性精神疾病 8结核病 9肝炎 10先天畸形 11其他】
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getArchiveCode() {
        return archiveCode;
    }
@ -69,174 +39,6 @@ public class ArchiveInfo extends IdEntity {
        this.archiveCode = archiveCode;
    }
    public String getSickName() {
        return sickName;
    }
    public void setSickName(String sickName) {
        this.sickName = sickName;
    }
    public String getArchiveOperatorName() {
        return archiveOperatorName;
    }
    public void setArchiveOperatorName(String archiveOperatorName) {
        this.archiveOperatorName = archiveOperatorName;
    }
    public String getDoctorCode() {
        return doctorCode;
    }
    public void setDoctorCode(String doctorCode) {
        this.doctorCode = doctorCode;
    }
    public int getArchiveStatus() {
        return archiveStatus;
    }
    public void setArchiveStatus(int archiveStatus) {
        this.archiveStatus = archiveStatus;
    }
    public String getArchiveTime() {
        return archiveTime;
    }
    public void setArchiveTime(String archiveTime) {
        this.archiveTime = archiveTime;
    }
    public int getSignStatus() {
        return signStatus;
    }
    public void setSignStatus(int signStatus) {
        this.signStatus = signStatus;
    }
    public String getBirthday() {
        return birthday;
    }
    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }
    public int getSickSex() {
        return sickSex;
    }
    public void setSickSex(int sickSex) {
        this.sickSex = sickSex;
    }
    public String getJwZoneCode() {
        return jwZoneCode;
    }
    public void setJwZoneCode(String jwZoneCode) {
        this.jwZoneCode = jwZoneCode;
    }
    public int getIdentityType() {
        return identityType;
    }
    public void setIdentityType(int identityType) {
        this.identityType = identityType;
    }
    public String getIdentityCardNo() {
        return identityCardNo;
    }
    public void setIdentityCardNo(String identityCardNo) {
        this.identityCardNo = identityCardNo;
    }
    public String getHomePhone() {
        return homePhone;
    }
    public void setHomePhone(String homePhone) {
        this.homePhone = homePhone;
    }
    public String getHomeAddress() {
        return homeAddress;
    }
    public void setHomeAddress(String homeAddress) {
        this.homeAddress = homeAddress;
    }
    public String getOrgId() {
        return orgId;
    }
    public void setOrgId(String orgId) {
        this.orgId = orgId;
    }
    public int getResidence() {
        return residence;
    }
    public void setResidence(int residence) {
        this.residence = residence;
    }
    public String getNational() {
        return national;
    }
    public void setNational(String national) {
        this.national = national;
    }
    public String getOrigo() {
        return origo;
    }
    public void setOrigo(String origo) {
        this.origo = origo;
    }
    public int getBlood() {
        return blood;
    }
    public void setBlood(int blood) {
        this.blood = blood;
    }
    public int getBloodRh() {
        return bloodRh;
    }
    public void setBloodRh(int bloodRh) {
        this.bloodRh = bloodRh;
    }
    public int getMarriage() {
        return marriage;
    }
    public void setMarriage(int marriage) {
        this.marriage = marriage;
    }
    public String getInsurCardNo() {
        return insurCardNo;
    }
    public void setInsurCardNo(String insurCardNo) {
        this.insurCardNo = insurCardNo;
    }
    public int getEducation() {
        return education;
    }

+ 9 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/vo/PatientArchivesDto.java

@ -18,6 +18,7 @@ public class PatientArchivesDto {
    private String blood; // 血型
    private String marry; //结婚
    private String adress;  //地址
    private String orgGo;//户口所在地
    private String education; //教育水平
    private String occupation; //职业
@ -106,6 +107,14 @@ public class PatientArchivesDto {
        this.adress = adress;
    }
    public String getOrgGo() {
        return orgGo;
    }
    public void setOrgGo(String orgGo) {
        this.orgGo = orgGo;
    }
    public String getEducation() {
        return education;
    }

+ 15 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/archive/PatientArchiveDao.java

@ -0,0 +1,15 @@
package com.yihu.wlyy.repository.archive;
import com.yihu.wlyy.entity.doctor.archive.Archive;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Administrator on 2018/1/4.
 */
public interface PatientArchiveDao extends PagingAndSortingRepository<Archive, Long>, JpaSpecificationExecutor<Archive> {
    @Query("select a from Archive a where a.code=?1")
    Archive findArchiveDetailsByCode(String code);
}

+ 1 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/archive/PatientArchiveInfoDao.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.repository.archive;
import com.yihu.wlyy.entity.doctor.archive.Archive;
import com.yihu.wlyy.entity.doctor.archive.ArchiveInfo;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
@ -10,6 +11,4 @@ import org.springframework.data.repository.PagingAndSortingRepository;
 */
public interface PatientArchiveInfoDao extends PagingAndSortingRepository<ArchiveInfo, Long>, JpaSpecificationExecutor<ArchiveInfo> {
    @Query("select a from ArchiveInfo a where a.code=?1")
    ArchiveInfo findArchiveDetailsByCode(String code);
}

+ 119 - 87
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/PatientInfoService.java

@ -1,10 +1,10 @@
package com.yihu.wlyy.service.app.account;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.yihu.wlyy.entity.address.*;
import com.yihu.wlyy.entity.demographic.DemographicInfo;
import com.yihu.wlyy.entity.dict.SystemDict;
import com.yihu.wlyy.entity.doctor.archive.Archive;
import com.yihu.wlyy.entity.doctor.archive.ArchiveInfo;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.login.LoginLog;
@ -17,6 +17,7 @@ import com.yihu.wlyy.entity.patient.vo.PatientArchivesDto;
import com.yihu.wlyy.entity.patient.vo.PatientVO;
import com.yihu.wlyy.entity.security.Token;
import com.yihu.wlyy.repository.address.*;
import com.yihu.wlyy.repository.archive.PatientArchiveDao;
import com.yihu.wlyy.repository.archive.PatientArchiveInfoDao;
import com.yihu.wlyy.repository.demographic.TblBasicDao;
import com.yihu.wlyy.repository.dict.SystemDictDao;
@ -27,21 +28,18 @@ import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.repository.patient.SocialSecurityInfoDao;
import com.yihu.wlyy.service.app.family.FamilyMemberService;
import com.yihu.wlyy.service.app.family.FamilyService;
import com.yihu.wlyy.service.app.sign.FamilyContractService;
import com.yihu.wlyy.service.common.SMSService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.service.common.account.TokenService;
import com.yihu.wlyy.service.common.login.LoginLogService;
import com.yihu.wlyy.service.third.jw.JwArchivesService;
import com.yihu.wlyy.util.*;
import io.swagger.models.auth.In;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.objenesis.ObjenesisBase;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@ -102,6 +100,8 @@ public class PatientInfoService extends BaseService {
    @Autowired
    DoctorDao doctorDao;
    @Autowired
    PatientArchiveDao patientArchiveDao;
    @Autowired
    PatientArchiveInfoDao patientArchiveInfoDao;
    /**
     * 患者更换手机号
@ -423,38 +423,42 @@ public class PatientInfoService extends BaseService {
        //保存建档信息到服务器数据库
        Doctor doctorObj = doctorDao.findByCode(doctorCode);
        ArchiveInfo archiveInfo = new ArchiveInfo();
        archiveInfo.setCode(getCode());
        archiveInfo.setArchiveCode(response);
        archiveInfo.setSickName(p.getName());
        archiveInfo.setDoctorCode(doctorCode);
        Archive archive = new Archive();
        String code = getCode();
        archive.setCode(code);
        archive.setArchiveCode(response);
        archive.setSickName(p.getName());
        archive.setDoctorCode(doctorCode);
        if (doctorObj!=null){
            archiveInfo.setArchiveOperatorName(doctorObj.getName());
            archive.setArchiveOperatorName(doctorObj.getName());
        }
        archiveInfo.setArchiveTime(DateUtil.getStringDateShort());
        archive.setArchiveTime(DateUtil.getStringDateShort());
        int isSign = signFamilyDao.hasSingStatus(p.getIdcard());
        if (isSign>0){
            archiveInfo.setSignStatus(1);
            archive.setSignStatus(1);
        }else{
            archiveInfo.setSignStatus(0);
            archive.setSignStatus(0);
        }
        archiveInfo.setArchiveStatus(3);
        archiveInfo.setSickSex(p.getSex());
        archiveInfo.setBirthday(brithday);
        archiveInfo.setJwZoneCode(jwCountryCode);
        archiveInfo.setIdentityType(1);
        archiveInfo.setIdentityCardNo(p.getIdcard());
        archiveInfo.setHomePhone(p.getMobile());
        archiveInfo.setHomeAddress(adress);
        archiveInfo.setOrgId("0");
        archiveInfo.setResidence(1);
        archiveInfo.setNational(nation);
        archiveInfo.setOrigo("350200");
        archiveInfo.setBlood(Integer.valueOf(blood));
        archiveInfo.setBloodRh(1);
        archiveInfo.setMarriage(Integer.valueOf(marry));
        archiveInfo.setInsurCardNo(p.getSsc());
        archive.setArchiveStatus(3);
        archive.setSickSex(p.getSex());
        archive.setBirthday(brithday);
        archive.setJwZoneCode(jwCountryCode);
        archive.setIdentityType(1);
        archive.setIdentityCardNo(p.getIdcard());
        archive.setHomePhone(p.getMobile());
        archive.setHomeAddress(adress);
        archive.setOrgId("0");
        archive.setResidence(1);
        archive.setNational(nation);
        archive.setOrigo("350200");
        archive.setBlood(Integer.valueOf(blood));
        archive.setBloodRh(1);
        archive.setMarriage(Integer.valueOf(marry));
        archive.setInsurCardNo(p.getSsc());
        patientArchiveDao.save(archive);
        //补充参数
        ArchiveInfo archiveInfo = new ArchiveInfo();
        archiveInfo.setArchiveCode(code);
        archiveInfo.setAllergic("0");
        archiveInfo.setPast("0");
        archiveInfo.setGenetic(0);
@ -465,7 +469,6 @@ public class PatientInfoService extends BaseService {
        archiveInfo.setFamilyChildren("0");
        archiveInfo.setDisability("1");
        patientArchiveInfoDao.save(archiveInfo);
        return 1;
    }
    public int createProfile(String archiveJson) throws Exception{
@ -473,6 +476,7 @@ public class PatientInfoService extends BaseService {
        PatientArchivesDto archive = (PatientArchivesDto) net.sf.json.JSONObject.toBean(j,PatientArchivesDto.class);
        Patient p = patientDao.findByCode(archive.getPatient());
        Archive archiveDateBase = new Archive();
        ArchiveInfo archiveInfo = new ArchiveInfo();
        Doctor doctorObj = doctorDao.findByCode(archive.getDoctorCode());
@ -490,41 +494,50 @@ public class PatientInfoService extends BaseService {
        json.put("ORG_ID","0");//新增默认传0
        json.put("RESIDENCE","1");//户籍【1.户籍 2.非户籍】
        json.put("NATIONAL",archive.getNation());//民族【NATION_DICT】
        json.put("ORIGO","350200");//户口所在地【ZONE_DICT】
        //json.put("ORIGO","350200");//户口所在地【ZONE_DICT】
        if (StringUtils.isEmpty(archive.getOrgGo())){
            json.put("ORIGO","350200");//户口所在地【ZONE_DICT】
        }else{
            json.put("ORIGO",archive.getOrgGo());//户口所在地【ZONE_DICT】
        }
        json.put("BLOOD",archive.getBlood());//血型【1.A型 2.3.O型4.AB型 5.不详】
        json.put("BLOOD_RH","1");//RH阴性【1.否 2.是 3.不详】
        json.put("MARRIAGE",archive.getMarry());//婚姻状况【10.未婚 20.已婚 30.丧偶 40.离婚 90.未说明的婚姻状况】
        json.put("INSUR_CARD_NO",p.getSsc());//医保卡号
        //保存建档记录信息
        archiveInfo.setSickName(p.getName());
        archiveInfo.setDoctorCode(archive.getDoctorCode());
        archiveDateBase.setSickName(p.getName());
        archiveDateBase.setDoctorCode(archive.getDoctorCode());
        if (doctorObj!=null){
            archiveInfo.setArchiveOperatorName(doctorObj.getName());
            archiveDateBase.setArchiveOperatorName(doctorObj.getName());
        }
        archiveInfo.setArchiveTime(DateUtil.getStringDateShort());
        archiveDateBase.setArchiveTime(DateUtil.getStringDateShort());
        int isSign = signFamilyDao.hasSingStatus(p.getIdcard());
        if (isSign>0){
            archiveInfo.setSignStatus(1);
            archiveDateBase.setSignStatus(1);
        }else{
            archiveInfo.setSignStatus(0);
            archiveDateBase.setSignStatus(0);
        }
        archiveInfo.setArchiveStatus(3);
        archiveInfo.setSickSex(p.getSex());
        archiveInfo.setBirthday(archive.getBrithday());
        archiveInfo.setJwZoneCode(archive.getJwCountryCode());
        archiveInfo.setIdentityType(1);
        archiveInfo.setIdentityCardNo(p.getIdcard());
        archiveInfo.setHomePhone(p.getMobile());
        archiveInfo.setHomeAddress(archive.getAdress());
        archiveInfo.setOrgId("0");
        archiveInfo.setResidence(1);
        archiveInfo.setNational(archive.getNation());
        archiveInfo.setOrigo("350200");
        archiveInfo.setBlood(Integer.valueOf(archive.getBlood()));
        archiveInfo.setBloodRh(1);
        archiveInfo.setMarriage(Integer.valueOf(archive.getMarry()));
        archiveInfo.setInsurCardNo(p.getSsc());
        archiveDateBase.setArchiveStatus(3);
        archiveDateBase.setSickSex(p.getSex());
        archiveDateBase.setBirthday(archive.getBrithday());
        archiveDateBase.setJwZoneCode(archive.getJwCountryCode());
        archiveDateBase.setIdentityType(1);
        archiveDateBase.setIdentityCardNo(p.getIdcard());
        archiveDateBase.setHomePhone(p.getMobile());
        archiveDateBase.setHomeAddress(archive.getAdress());
        archiveDateBase.setOrgId("0");
        archiveDateBase.setResidence(1);
        archiveDateBase.setNational(archive.getNation());
        if (StringUtils.isEmpty(archive.getOrgGo())){
            archiveDateBase.setOrigo("350200");
        }else{
            archiveDateBase.setOrigo(archive.getOrgGo());
        }
        archiveDateBase.setBlood(Integer.valueOf(archive.getBlood()));
        archiveDateBase.setBloodRh(1);
        archiveDateBase.setMarriage(Integer.valueOf(archive.getMarry()));
        archiveDateBase.setInsurCardNo(p.getSsc());
        //补充参数
@ -930,8 +943,11 @@ public class PatientInfoService extends BaseService {
        socialSecurityInfoDao.save(info);
        //保存建档记录信息到服务器数据库
        archiveInfo.setCode(getCode());
        archiveInfo.setArchiveCode(response);
        String code = getCode();
        archiveDateBase.setCode(code);
        archiveDateBase.setArchiveCode(response);//基卫code
        archiveInfo.setArchiveCode(code);//详细信息表关联建档记录表code
        patientArchiveDao.save(archiveDateBase);
        patientArchiveInfoDao.save(archiveInfo);
        return 1;
@ -940,6 +956,7 @@ public class PatientInfoService extends BaseService {
    public int createProfile(PatientArchivesDto archive) throws Exception{
        Patient p = patientDao.findByCode(archive.getPatient());
        Archive archiveDataBase = new Archive();
        ArchiveInfo archiveInfo = new ArchiveInfo();
        Doctor doctorObj = doctorDao.findByCode(archive.getDoctorCode());
@ -957,41 +974,49 @@ public class PatientInfoService extends BaseService {
        json.put("ORG_ID","0");//新增默认传0
        json.put("RESIDENCE","1");//户籍【1.户籍 2.非户籍】
        json.put("NATIONAL",archive.getNation());//民族【NATION_DICT】
        json.put("ORIGO","350200");//户口所在地【ZONE_DICT】
        if (StringUtils.isEmpty(archive.getOrgGo())){
            json.put("ORIGO","350200");//户口所在地【ZONE_DICT】
        }else{
            json.put("ORIGO",archive.getOrgGo());//户口所在地【ZONE_DICT】
        }
        json.put("BLOOD",archive.getBlood());//血型【1.A型 2.3.O型4.AB型 5.不详】
        json.put("BLOOD_RH","1");//RH阴性【1.否 2.是 3.不详】
        json.put("MARRIAGE",archive.getMarry());//婚姻状况【10.未婚 20.已婚 30.丧偶 40.离婚 90.未说明的婚姻状况】
        json.put("INSUR_CARD_NO",p.getSsc());//医保卡号
        //保存建档记录信息
        archiveInfo.setSickName(p.getName());
        archiveInfo.setDoctorCode(archive.getDoctorCode());
        archiveDataBase.setSickName(p.getName());
        archiveDataBase.setDoctorCode(archive.getDoctorCode());
        if (doctorObj!=null){
            archiveInfo.setArchiveOperatorName(doctorObj.getName());
            archiveDataBase.setArchiveOperatorName(doctorObj.getName());
        }
        archiveInfo.setArchiveTime(DateUtil.getStringDateShort());
        archiveDataBase.setArchiveTime(DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss"));
        int isSign = signFamilyDao.hasSingStatus(p.getIdcard());
        if (isSign>0){
            archiveInfo.setSignStatus(1);
            archiveDataBase.setSignStatus(1);
        }else{
            archiveInfo.setSignStatus(0);
            archiveDataBase.setSignStatus(0);
        }
        archiveDataBase.setArchiveStatus(3);
        archiveDataBase.setSickSex(p.getSex());
        archiveDataBase.setBirthday(archive.getBrithday());
        archiveDataBase.setJwZoneCode(archive.getJwCountryCode());
        archiveDataBase.setIdentityType(1);
        archiveDataBase.setIdentityCardNo(p.getIdcard());
        archiveDataBase.setHomePhone(p.getMobile());
        archiveDataBase.setHomeAddress(archive.getAdress());
        archiveDataBase.setOrgId("0");
        archiveDataBase.setResidence(1);
        archiveDataBase.setNational(archive.getNation());
        if (StringUtils.isEmpty(archive.getOrgGo())){
            archiveDataBase.setOrigo("350200");
        }else {
            archiveDataBase.setOrigo(archive.getOrgGo());
        }
        archiveInfo.setArchiveStatus(3);
        archiveInfo.setSickSex(p.getSex());
        archiveInfo.setBirthday(archive.getBrithday());
        archiveInfo.setJwZoneCode(archive.getJwCountryCode());
        archiveInfo.setIdentityType(1);
        archiveInfo.setIdentityCardNo(p.getIdcard());
        archiveInfo.setHomePhone(p.getMobile());
        archiveInfo.setHomeAddress(archive.getAdress());
        archiveInfo.setOrgId("0");
        archiveInfo.setResidence(1);
        archiveInfo.setNational(archive.getNation());
        archiveInfo.setOrigo("350200");
        archiveInfo.setBlood(Integer.valueOf(archive.getBlood()));
        archiveInfo.setBloodRh(1);
        archiveInfo.setMarriage(Integer.valueOf(archive.getMarry()));
        archiveInfo.setInsurCardNo(p.getSsc());
        archiveDataBase.setBlood(Integer.valueOf(archive.getBlood()));
        archiveDataBase.setBloodRh(1);
        archiveDataBase.setMarriage(Integer.valueOf(archive.getMarry()));
        archiveDataBase.setInsurCardNo(p.getSsc());
        //补充参数
        json.put("ALLERGIC_WITHOUT","1");//药物过敏史--无【0不勾选 1勾选】(同一类别,新增时,默认勾选)",
@ -1016,7 +1041,8 @@ public class PatientInfoService extends BaseService {
        }
        //药物过敏史
        if(StringUtils.isNotBlank(archive.getDrugAllergys())){
        //if(StringUtils.isNotBlank(archive.getDrugAllergys())){
        if (archive.getDrugAllergys()!=null){
            String allergicStr = "";
            json.put("ALLERGIC_WITHOUT","0");//药物过敏历史
            String as[] = archive.getDrugAllergys().split(",");
@ -1033,7 +1059,8 @@ public class PatientInfoService extends BaseService {
                    json.put("ALLERGIC_STREPTOMYCIN","1");//药物过敏史--链霉素
                    allergicStr +="3,";
                }
                if("4".equals(str)){
                //if("4".equals(str)){
                if (StringUtils.isBlank(str)){
                    json.put("ALLERGIC_OTHER","1");//药物过敏史--其它
                    allergicStr +="4,";
                    archiveInfo.setAllergicOtherContent(archive.getDrugOtherContent());
@ -1048,7 +1075,8 @@ public class PatientInfoService extends BaseService {
            archiveInfo.setAllergic("0");
        }
        //既往史
        if(StringUtils.isNotBlank(archive.getPastHistorys())){
        //if(StringUtils.isNotBlank(archive.getPastHistorys())){
        if (archive.getPastHistorys() != null){
            String pastStr = "";
            String pastDateStr = "";
            json.put("PAST_NONE","0");//既往史
@ -1076,7 +1104,8 @@ public class PatientInfoService extends BaseService {
//                        json.put("PAST_HYPERTENSION_DATE",dates[i]);//既往史--疾病--高血压日期
//                    }
//                }
                else if("4".equals(phs[i])){
                //else if("4".equals(phs[i])){
                else if(StringUtils.isBlank(phs[i])){
                    json.put("PAST_OTHER","1");//既往史--疾病--其它【0不勾选 1勾选】
                    pastStr +="4,";
                    if(!"0".equals(dates[i])){
@ -1319,10 +1348,10 @@ public class PatientInfoService extends BaseService {
            }
            //子女
            if(StringUtils.isNotBlank(archive.getFamilyBrotherHistorys())){
            if(StringUtils.isNotBlank(archive.getFamilyChildrenHistorys())){
                String chidrenStr = "";
                json.put("FAMILY_CHILDREN_NONE","0");//家族史--兄弟姐妹--无【0不勾选 1勾选】
                String bhs[] = archive.getFamilyBrotherHistorys().split(",");
                json.put("FAMILY_CHILDREN_NONE","0");//家族史--子女--无【0不勾选 1勾选】
                String bhs[] = archive.getFamilyChildrenHistorys().split(",");
                for(String bh : bhs){
                    if("1".equals(bh)){
                        json.put("FAMILY_CHILDREN_HYPERTENSION","1");//家族史--子女--高血压【0不勾选 1勾选】
@ -1402,8 +1431,11 @@ public class PatientInfoService extends BaseService {
        socialSecurityInfoDao.save(info);
        //保存建档记录信息到服务器数据库
        archiveInfo.setCode(getCode());
        archiveInfo.setArchiveCode(response);
        String code = getCode();
        archiveDataBase.setCode(code);
        archiveDataBase.setArchiveCode(response);//基卫返回的建档code
        archiveInfo.setArchiveCode(code);//详细信息表关联建档记录的唯一标识code
        patientArchiveDao.save(archiveDataBase);
        patientArchiveInfoDao.save(archiveInfo);
        return 1;

+ 48 - 21
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/archives/PatientArchiveInfoService.java

@ -3,15 +3,16 @@ package com.yihu.wlyy.service.app.archives;
import com.yihu.wlyy.entity.address.City;
import com.yihu.wlyy.entity.address.Country;
import com.yihu.wlyy.entity.dict.SystemDict;
import com.yihu.wlyy.entity.doctor.archive.ArchiveInfo;
import com.yihu.wlyy.entity.doctor.archive.Archive;
import com.yihu.wlyy.entity.doctor.archive.vo.ArchiveInfoDto;
import com.yihu.wlyy.repository.address.CityDao;
import com.yihu.wlyy.repository.address.CountryDao;
import com.yihu.wlyy.repository.archive.PatientArchiveInfoDao;
import com.yihu.wlyy.repository.archive.PatientArchiveDao;
import com.yihu.wlyy.repository.dict.SystemDictDao;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
@ -28,7 +29,7 @@ public class PatientArchiveInfoService {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private PatientArchiveInfoDao patientArchiveInfoDao;
    private PatientArchiveDao patientArchiveDao;
    @Autowired
    private SystemDictDao systemDictDao;
    @Autowired
@ -51,45 +52,71 @@ public class PatientArchiveInfoService {
    public List<Map<String,Object>> findArchiveList(String doctorCode, String signStatus, String startTime, String endTime, String keyWord, int pageNo, int pageSize){
        List<Map<String,Object>> archiveInfoList = new ArrayList<>();
        String sql = "SELECT " +
                " ai.code AS code, " +
                " ai.sick_name AS sickName, " +
                " ai.identity_card_no AS identityCardNo, " +
                " ai.archive_time archiveTime, " +
                " ai.sign_status AS signStatus, " +
                " a.code AS code, " +
                " a.sick_name AS sickName, " +
                " a.identity_card_no AS identityCardNo, " +
                " a.archive_time archiveTime, " +
                " a.sign_status AS signStatus, " +
                " c.name AS zoneName, " +
                " c.code AS zoneCode, " +
                " c.jw_code AS jwZoneCode " +
                " FROM " +
                " wlyy_archive_info ai " +
                " LEFT JOIN dm_country c ON ai.jw_zone_code = c.jw_code " +
                " wlyy_archive a " +
                " LEFT JOIN dm_country c ON a.jw_zone_code = c.jw_code " +
                " WHERE " +
                " doctor_code ='"+doctorCode+"'";
                " a.doctor_code ='"+doctorCode+"'";
        if (StringUtils.isNotBlank(signStatus)){
            sql += " AND ai.sign_status = "+signStatus;
            sql += " AND a.sign_status = "+signStatus;
        }
        if (StringUtils.isNotBlank(startTime) && StringUtils.isNotBlank(endTime)){
            startTime += " 00:00:00";
            endTime += " 23:59:59";
            sql += " AND ai.archive_time >= '"+startTime+"'" +
                    " AND ai.archive_time <= '"+endTime+"'";
            sql += " AND a.archive_time >= '"+startTime+"'" +
                    " AND a.archive_time <= '"+endTime+"'";
        }
        if (StringUtils.isNotBlank(keyWord)){
            sql += " AND (" +
                    " ai.sick_name LIKE '%"+keyWord+"%'" +
                    " OR ai.identity_card_no LIKE '%"+keyWord+"%'" +
                    " a.sick_name LIKE '%"+keyWord+"%'" +
                    " OR a.identity_card_no LIKE '%"+keyWord+"%'" +
                    " )";
        }
        int start = (pageNo-1)*pageSize;
        sql += " ORDER BY ai.archive_time DESC limit ?,?";
        sql += " ORDER BY a.archive_time DESC limit ?,?";
        archiveInfoList = jdbcTemplate.queryForList(sql,new Object[]{start,pageSize});
        return  archiveInfoList;
    }
    public ArchiveInfoDto findArchiveDetailsByCode(String code){
        ArchiveInfo archiveInfo = patientArchiveInfoDao.findArchiveDetailsByCode(code);
        String detailSql ="SELECT" +
                " a.*, i.allergic," +
                " i.allergic_other_content," +
                " i.disability," +
                " i.disability_other_content," +
                " i.education," +
                " i.family_brothers," +
                " i.family_children," +
                " i.family_father," +
                " i.family_mother," +
                " i.family_none," +
                " i.genetic," +
                " i.genetic_disease_name," +
                " i.medical_expenses," +
                " i.occupation," +
                " i.past," +
                " i.past_date," +
                " i.past_other_content" +
                " FROM" +
                " wlyy_archive a" +
                " LEFT JOIN wlyy_archive_info i ON a.code = i.archive_code" +
                " WHERE" +
                " a.code = '"+code+"'";
        List<ArchiveInfoDto> archiveInfoDtoList = jdbcTemplate.query(detailSql,new BeanPropertyRowMapper(ArchiveInfoDto.class));
        ArchiveInfoDto archiveInfoDto = new ArchiveInfoDto();
        BeanUtils.copyProperties(archiveInfo,archiveInfoDto);
        if (archiveInfoDtoList!=null && archiveInfoDtoList.size()>0){
            archiveInfoDto = archiveInfoDtoList.get(0);
        }
        List<SystemDict> bloodType = systemDictDao.findByDictName("BLOOD_TYPE");
        List<SystemDict> marryState = systemDictDao.findByDictName("MARRY_STATE");
        String sql = "SELECT t.NATION_CODE,t.NATION_NAME FROM zy_nation_dict t ";
@ -112,14 +139,14 @@ public class PatientArchiveInfoService {
        }
        //设置所属社区具体地址
        Country country = countryDao.findByJwCode(archiveInfo.getJwZoneCode());
        Country country = countryDao.findByJwCode(archiveInfoDto.getJwZoneCode());
        if (country != null){
            archiveInfoDto.setZoneCode(country.getCode());
            archiveInfoDto.setZoneName(country.getName());
        }
        //设置户口所在地具体地址
        City city = cityDao.findByCode(archiveInfo.getOrigo());
        City city = cityDao.findByCode(archiveInfoDto.getOrigo());
        if (city!=null){
            archiveInfoDto.setOrigoStr(city.getName());
        }

+ 20 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionService.java

@ -483,14 +483,30 @@ public class PrescriptionService extends BaseService {
     * @return
     */
    public List<Map<String,Object>> getPrescriptionByKeyWord(String keyWord,int pageNo,int pageSize){
        String sql = "SELECT p.code,p.patient_name,p.doctor_name,p.hospital_name,p.dispensary_type,p.status," +
                "p.create_time,GROUP_CONCAT(d.health_problem) AS health_problem, GROUP_CONCAT(d.health_problem_name) AS health_problem_name " +
                "FROM wlyy_prescription p LEFT JOIN wlyy_prescription_diagnosis d ON p.code = d.prescription_code WHERE 1=1 " ;
        String sql = "SELECT" +
                " p. CODE," +
                " p.patient_name," +
                " p.doctor_name," +
                " p.hospital_name," +
                " p.dispensary_type," +
                " p. STATUS," +
                " p.create_time," +
                " GROUP_CONCAT(d.health_problem) AS health_problem," +
                " GROUP_CONCAT(d.health_problem_name) AS health_problem_name"+
                " FROM" +
                " wlyy_prescription p" +
                " LEFT JOIN wlyy_prescription_diagnosis d ON p. CODE = d.prescription_code" +
                //" LEFT JOIN wlyy_prescription_pay a ON p.code = a.prescription_code" +
                " WHERE" +
                " 1 = 1 " ;
        //判断关键字
        if (StringUtils.isNotBlank(keyWord)){
            sql += " AND (p.patient_name like '%"+keyWord+"%' or p.doctor_name like '%"+keyWord+"%')";
        }
        sql += " GROUP BY p.code ORDER  BY p.create_time DESC limit ?,?";
        sql += " GROUP BY p.code ORDER  BY p.create_time DESC ";
        sql+=" limit ?,?";
        int start = (pageNo-1)*pageSize;
        List<Map<String,Object>> resultList = jdbcTemplate.queryForList(sql,new Object[]{start,pageSize});
        return resultList;

+ 6 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkedu/service/EduArticleService.java

@ -757,7 +757,7 @@ public class EduArticleService {
            int i = 0;
            jestClient = elasticFactory.getJestClient();
            Bulk.Builder bulk = new Bulk.Builder().defaultIndex(esIndex).defaultType(esType);
            String sql = "select id from " + esIndex + " where batchNo='" + batchNo + "'";
            String sql = "select id from " + esIndex + " where batchNo='" + batchNo + "' limit 0,50000";
            List<Map<String, Object>> returnList = elasticsearchUtil.excuteDataModel(sql);
            //根据id批量删除
            for (Map<String, Object> obj : returnList) {
@ -810,8 +810,8 @@ public class EduArticleService {
        final String firstId = firstIdStr;
        //4.获取同一个批次号的推送记录,基本同一个批次号是同一个医生发送的,也是同一篇文章
        String sql = "select * from wlyy_health_edu_article_patient_copy where admin_team_code IS NOT NULL AND batch_no IS NOT NULL AND batch_no='" + batchNo + "'";
        List<HealthEduArticlePatient> healthEduArticlePatients = jdbcTemplate.query(sql, new BeanPropertyRowMapper(HealthEduArticlePatient.class));
        String sql = "select ap.*,p.name AS patientName from wlyy_health_edu_article_patient_copy ap LEFT JOIN wlyy_patient p ON ap.patient = p.code where ap.admin_team_code IS NOT NULL AND ap.batch_no IS NOT NULL AND ap.batch_no='" + batchNo + "'";
        List<HealthEduArticlePatientDTO> healthEduArticlePatients = jdbcTemplate.query(sql, new BeanPropertyRowMapper(HealthEduArticlePatientDTO.class));
        //5.转换成新的健康教育需要的数据
        List<HealthEduArticleES> healthEduArticleESSaveList = new ArrayList<>();
@ -820,12 +820,12 @@ public class EduArticleService {
            Doctor doctor = doctorDao.findByCode(doctorCode);
            AdminTeam adminTeam = doctorAdminTeamDao.findOne(healthEduArticlePatients.get(0).getAdminTeamCode());
            HealthEduArticle healthEduArticle = healthEduArticleDao.findByCode(healthEduArticlePatients.get(0).getArticle());
            for (HealthEduArticlePatient healthEduArticlePatient : healthEduArticlePatients) {
            for (HealthEduArticlePatientDTO healthEduArticlePatient : healthEduArticlePatients) {
                HealthEduArticleES healthEduArticleES = new HealthEduArticleES();
                healthEduArticleES.setBatchNo(batchNo);
                healthEduArticleES.setPatientCode(healthEduArticlePatient.getPatient());
                healthEduArticleES.setPatientName(patientDao.findByCode(healthEduArticlePatient.getPatient()).getName());
                healthEduArticleES.setPatientName(healthEduArticlePatient.getPatientName());
                //医生
                healthEduArticleES.setDoctorCode(doctor.getCode());
@ -988,7 +988,7 @@ public class EduArticleService {
        //4.获取医生的推送记录
        //String sql = "select * from wlyy_health_edu_article_patient_copy where admin_team_code IS NOT NULL AND batch_no IS NOT NULL AND doctor='" + doctorCode + "'";
        String sql = "select ap.*,p.name AS patienName from wlyy_health_edu_article_patient_copy ap LEFT JOIN wlyy_patient p ON ap.patient = p.code where ap.admin_team_code IS NOT NULL AND ap.batch_no IS NOT NULL AND ap.doctor='"+doctorCode+"'";
        String sql = "select ap.*,p.name AS patientName from wlyy_health_edu_article_patient_copy ap LEFT JOIN wlyy_patient p ON ap.patient = p.code where ap.admin_team_code IS NOT NULL AND ap.batch_no IS NOT NULL AND ap.doctor='"+doctorCode+"'";
        List<HealthEduArticlePatientDTO> healthEduArticlePatients = jdbcTemplate.query(sql, new BeanPropertyRowMapper(HealthEduArticlePatientDTO.class));
        //推送记录按照批次号分组
        Map<String, List<HealthEduArticlePatientDTO>> healthEduArticlePatientMap = new HashMap<>();