yeshijie 7 роки тому
батько
коміт
388ec148b1
21 змінених файлів з 1508 додано та 89 видалено
  1. 62 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/charge/PatientPopups.java
  2. 276 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/vo/PatientArchivesDto.java
  3. 1 1
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/physicalExamination/PatientPhysicalExaminationService.java
  4. 19 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/charge/PopupsDao.java
  5. 4 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyDao.java
  6. 413 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/PatientInfoService.java
  7. 6 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/physicalExamination/PhysicalExaminationRemindService.java
  8. 87 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PatientPrescriptionPayService.java
  9. 2 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionExpressageService.java
  10. 10 13
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/PatientRemindService.java
  11. 1 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java
  12. 328 45
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java
  13. 4 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/call/CustomerService.java
  14. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/service/OnePayService.java
  15. 2 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/call/CallRecordController.java
  16. 74 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/PatientInfoController.java
  17. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionExpressageController.java
  18. 16 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/account/PatientController.java
  19. 1 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionController.java
  20. 88 11
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionPayController.java
  21. 112 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java

+ 62 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/charge/PatientPopups.java

@ -0,0 +1,62 @@
package com.yihu.wlyy.entity.charge;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * 居民支付弹窗设置
 * @author Reece 2017.11.29
 */
@Entity
@Table(name = "wlyy_patient_popups")
public class PatientPopups extends IdEntity {
    private String patient; //支付主体居民code
    private int type;  //弹窗类型(0签约支付 1续方支付)
    private String status;  //弹出状态(0不弹出 1弹出)
    private Date createTime;
    private Date czrq;
    public String getPatient() {
        return patient;
    }
    public int getType() {
        return type;
    }
    public void setType(int type) {
        this.type = type;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Date getCzrq() {
        return czrq;
    }
    public void setCzrq(Date czrq) {
        this.czrq = czrq;
    }
}

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

@ -0,0 +1,276 @@
package com.yihu.wlyy.entity.patient.vo;
/**
 * Created by Trick on 2017/11/28.
 */
public class PatientArchivesDto {
    private String doctorCode; //医生code
    private String patient; //患者code
    private String sex; //性别
    private String idcard; //身份证
    private String mobile; //电话
    private String ssc; //社保号
    private String name; //名字
    private String brithday; //生日
    private String jwCountryCode; //基卫社区code
    private String nation; //民族
    private String blood; // 血型
    private String marry; //结婚
    private String adress;  //地址
    private String education; //教育水平
    private String occupation; //职业
    private String payment; //支付方式
    private String drugAllergys; //药物过敏历史,如:1,2.4
    private String drugOtherContent; //药物过敏其他内容
    private String pastHistorys; //既往史,如1,2,4
    private String pastHistoryDate; //时间,如2014-05-11,2014-12-01
    private String pastHistoryContent; //既往史其他内容
    private String geneticFlag; //有无遗传病历史0。无,1.有
    private String geneticContent;//遗传病历史内容
    private String disabilitys; //残疾,如1,2,4
    private String familyHistoryFlag;//有无0.无,1.有
    private String familyFatherHistorys;//父亲的疾病
    private String familyMotherHistorys; //母亲的疾病
    private String familyBrotherHistorys; //兄弟的疾病
    private String familyChildrenHistorys; //子女的疾病
    public String getDoctorCode() {
        return doctorCode;
    }
    public void setDoctorCode(String doctorCode) {
        this.doctorCode = doctorCode;
    }
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getBrithday() {
        return brithday;
    }
    public void setBrithday(String brithday) {
        this.brithday = brithday;
    }
    public String getJwCountryCode() {
        return jwCountryCode;
    }
    public void setJwCountryCode(String jwCountryCode) {
        this.jwCountryCode = jwCountryCode;
    }
    public String getNation() {
        return nation;
    }
    public void setNation(String nation) {
        this.nation = nation;
    }
    public String getBlood() {
        return blood;
    }
    public void setBlood(String blood) {
        this.blood = blood;
    }
    public String getMarry() {
        return marry;
    }
    public void setMarry(String marry) {
        this.marry = marry;
    }
    public String getAdress() {
        return adress;
    }
    public void setAdress(String adress) {
        this.adress = adress;
    }
    public String getEducation() {
        return education;
    }
    public void setEducation(String education) {
        this.education = education;
    }
    public String getOccupation() {
        return occupation;
    }
    public void setOccupation(String occupation) {
        this.occupation = occupation;
    }
    public String getPayment() {
        return payment;
    }
    public void setPayment(String payment) {
        this.payment = payment;
    }
    public String getDrugAllergys() {
        return drugAllergys;
    }
    public void setDrugAllergys(String drugAllergys) {
        this.drugAllergys = drugAllergys;
    }
    public String getDrugOtherContent() {
        return drugOtherContent;
    }
    public void setDrugOtherContent(String drugOtherContent) {
        this.drugOtherContent = drugOtherContent;
    }
    public String getPastHistorys() {
        return pastHistorys;
    }
    public void setPastHistorys(String pastHistorys) {
        this.pastHistorys = pastHistorys;
    }
    public String getPastHistoryDate() {
        return pastHistoryDate;
    }
    public void setPastHistoryDate(String pastHistoryDate) {
        this.pastHistoryDate = pastHistoryDate;
    }
    public String getPastHistoryContent() {
        return pastHistoryContent;
    }
    public void setPastHistoryContent(String pastHistoryContent) {
        this.pastHistoryContent = pastHistoryContent;
    }
    public String getGeneticFlag() {
        return geneticFlag;
    }
    public void setGeneticFlag(String geneticFlag) {
        this.geneticFlag = geneticFlag;
    }
    public String getGeneticContent() {
        return geneticContent;
    }
    public void setGeneticContent(String geneticContent) {
        this.geneticContent = geneticContent;
    }
    public String getDisabilitys() {
        return disabilitys;
    }
    public void setDisabilitys(String disabilitys) {
        this.disabilitys = disabilitys;
    }
    public String getFamilyHistoryFlag() {
        return familyHistoryFlag;
    }
    public void setFamilyHistoryFlag(String familyHistoryFlag) {
        this.familyHistoryFlag = familyHistoryFlag;
    }
    public String getFamilyFatherHistorys() {
        return familyFatherHistorys;
    }
    public void setFamilyFatherHistorys(String familyFatherHistorys) {
        this.familyFatherHistorys = familyFatherHistorys;
    }
    public String getFamilyMotherHistorys() {
        return familyMotherHistorys;
    }
    public void setFamilyMotherHistorys(String familyMotherHistorys) {
        this.familyMotherHistorys = familyMotherHistorys;
    }
    public String getFamilyBrotherHistorys() {
        return familyBrotherHistorys;
    }
    public void setFamilyBrotherHistorys(String familyBrotherHistorys) {
        this.familyBrotherHistorys = familyBrotherHistorys;
    }
    public String getFamilyChildrenHistorys() {
        return familyChildrenHistorys;
    }
    public void setFamilyChildrenHistorys(String familyChildrenHistorys) {
        this.familyChildrenHistorys = familyChildrenHistorys;
    }
    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 String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
    public String getSex() {
        return sex;
    }
    public void setSex(String sex) {
        this.sex = sex;
    }
}

+ 1 - 1
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/physicalExamination/PatientPhysicalExaminationService.java

@ -58,7 +58,7 @@ public class PatientPhysicalExaminationService extends BaseService {
        Date yesteryear = c.getTime();
        JSONObject json = new JSONObject();
        String first = "温馨提醒,您已经超过一年没有到社区进行健康体检啦,为了您和您的家庭医生了解您近期的健康状况,请及时到签约社区进行免费的健康体检哟~";
        String first = "温馨提醒,您已经超过一年没有到社区进行健康体检啦,为了您和您的家庭医生了解您近期的健康状况,请及时到签约社区进行65岁以上老年人的免费健康体检哟~(如今年已体检请忽略)";
        json.put("remark", "");
        json.put("keyword1", "健康体检");
        json.put("keyword2", format.format(new Date()));

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

@ -0,0 +1,19 @@
/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.wlyy.repository.charge;
import com.yihu.wlyy.entity.charge.PatientPopups;
import com.yihu.wlyy.entity.charge.WlyyCharge;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface PopupsDao extends PagingAndSortingRepository<PatientPopups, Long>, JpaSpecificationExecutor<PatientPopups> {
    //根据居民code和type查询弹窗设置
    @Query("select a from PatientPopups a where a.patient = ?1 and a.type = ?2 ")
    PatientPopups findByCodeAndType(String patient,int type);
}

+ 4 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyDao.java

@ -423,4 +423,8 @@ public interface SignFamilyDao extends PagingAndSortingRepository<SignFamily, Lo
    // 查询团队已签约的总数
    @Query("select count(1) from SignFamily a where  a.adminTeamId = ?1 and (a.status = 1 or a.status = 2) and a.type = 2")
    int countAmountSignedByAdminTeam(Long id);
    // 查询已签约未缴费居民
    @Query("select a from SignFamily a where  a.patient = ?1 and a.type = 2 and a.expensesStatus = '0' and a.status >0")
    SignFamily findUnpay(String patient);
}

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

@ -15,6 +15,7 @@ import com.yihu.wlyy.entity.patient.PatientFamilyMember;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.patient.SocialSecurityInfo;
import com.yihu.wlyy.entity.patient.invitation.PatientInvitationLog;
import com.yihu.wlyy.entity.patient.vo.PatientArchivesDto;
import com.yihu.wlyy.entity.security.Token;
import com.yihu.wlyy.repository.address.CityDao;
import com.yihu.wlyy.repository.address.ProvinceDao;
@ -35,10 +36,12 @@ 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 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.JdbcTemplate;
import org.springframework.objenesis.ObjenesisBase;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@ -392,6 +395,8 @@ public class PatientInfoService extends BaseService {
        json.put("PAST_NONE","1");//  既往史--疾病--无【0不勾选 1勾选】(同一类别,新增时,默认勾选)
        String doctor = doctorCode;
        String response = jwArchivesService.saveSickArchiveRecord(com.alibaba.fastjson.JSONObject.toJSONString(json, SerializerFeature.WriteMapNullValue),doctor);
        if("0".equals(response)){
@ -412,6 +417,318 @@ public class PatientInfoService extends BaseService {
        socialSecurityInfoDao.save(info);
        return 1;
    }
    public int createProfile(String archiveJson) throws Exception{
        net.sf.json.JSONObject j  = net.sf.json.JSONObject.fromObject(archiveJson);
        PatientArchivesDto archive = (PatientArchivesDto) net.sf.json.JSONObject.toBean(j,PatientArchivesDto.class);
        Patient p = patientDao.findByCode(archive.getPatient());
        com.alibaba.fastjson.JSONObject json = new com.alibaba.fastjson.JSONObject();
        json.put("ARCHIVE_TIME", DateUtil.getStringDateShort());//建档时间
        json.put("ARCHIVE_STATUS","3");//档案状态【1.未管理 2.死亡 3.正常 4.高危】
        json.put("SICK_NAME",p.getName());//姓名
        json.put("SICK_SEX",archive.getSex());//性别【1.男 2.女 9 未知】
        json.put("BIRTHDAY",archive.getBrithday());//出生日期
        json.put("ZONE_CODE",archive.getJwCountryCode());//所属社区【ZONE_DICT】
        json.put("IDENTITY_TYPE","1");//证件类型【IDENTITY_TYPE_DICT】
        json.put("IDENTITY_CARD_NO",p.getIdcard());//身份证号
        json.put("HOME_PHONE",p.getMobile());//本人电话
        json.put("HOME_ADDRESS",archive.getAdress());//现住址
        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("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("ALLERGIC_WITHOUT","1");//药物过敏史--无【0不勾选 1勾选】(同一类别,新增时,默认勾选)",
        json.put("TRAUMA","0");// "TRAUMA":"既往史--外伤--【0 无 1 有】(同一类别,新增时,默认选无)",
        json.put("TRANSFUSION","0");//   "TRANSFUSION":"既往史--输血--【0 无 1 有】(同一类别,新增时,默认选无)",
        json.put("EXPOSE_WITHOUT","1");//"EXPOSE_WITHOUT":"暴露史--无【0不勾选 1勾选】(同一类别,新增时,默认勾选)",
        //教育程度
        if(StringUtils.isNotBlank(archive.getEducation())){
            json.put("EDUCATION",archive.getEducation()+"");//文化程度
        }
        //职业
        if(StringUtils.isNotBlank(archive.getOccupation())){
            json.put("OCCUPATION",archive.getOccupation()+"");//职业
        }
        //支付方式
        if(StringUtils.isNotBlank(archive.getPayment())){
            json.put("MEDICAL_EXPENSES",archive.getPayment()+"");//支付方式
        }
        //药物过敏史
        if(StringUtils.isNotBlank(archive.getDrugAllergys())){
            json.put("ALLERGIC_WITHOUT","0");//药物过敏历史
            String as[] = archive.getDrugAllergys().split(",");
            for(String str : as){
                if("1".equals(str)){
                    json.put("ALLERGIC_PENICILLIN","1");//药物过敏史--青霉素
                }
                if("2".equals(str)){
                    json.put("ALLERGIC_SULFANILAMIDE","1");//药物过敏史--磺胺
                }
                if("3".equals(str)){
                    json.put("ALLERGIC_STREPTOMYCIN","1");//药物过敏史--链霉素
                }
                if("4".equals(str)){
                    json.put("ALLERGIC_OTHER","1");//药物过敏史--其它
                }
            }
        }else{
            json.put("ALLERGIC_WITHOUT","1");//药物过敏历史
        }
        //既往史
        if(StringUtils.isNotBlank(archive.getPastHistorys())){
            json.put("PAST_NONE","0");//既往史
            String phs[] = archive.getPastHistorys().split(",");
            String dates[] = archive.getPastHistoryDate().split(",");
            for(int i=0 ;i<phs.length ; i++){
                if("1".equals(phs[i])){
                    json.put("PAST_HYPERTENSION","1");//既往史--疾病--高血压【0不勾选 1勾选】
                    if(StringUtils.isNotBlank(dates[i])){
                        json.put("PAST_HYPERTENSION_DATE",dates[i]);//既往史--疾病--高血压日期
                    }
                }
                if("2".equals(phs[i])){
                    json.put("PAST_DIABETES","1");//既往史--疾病--糖尿病【0不勾选 1勾选】
                    if(StringUtils.isNotBlank(dates[i])){
                        json.put("PAST_DIABETES_DATE",dates[i]);//既往史--疾病--糖尿病日期
                    }
                }
//                if("3".equals(phs[i])){
//                    json.put("SURGERY","1");//既往史--手术--【0 无 1 有】
//                    if(StringUtils.isNotBlank(dates[i])){
//                        json.put("PAST_HYPERTENSION_DATE",dates[i]);//既往史--疾病--高血压日期
//                    }
//                }
                if("4".equals(phs[i])){
                    json.put("PAST_OTHER","1");//既往史--疾病--其它【0不勾选 1勾选】
                    if(StringUtils.isNotBlank(dates[i])){
                        json.put("PAST_OTHER_CONTENT_DATE",dates[i]);//既往史--疾病--高血压日期
                    }
                }
            }
        }else{
            json.put("PAST_NONE","1");//既往史
        }
        //遗传病史
        if(StringUtils.isNotBlank(archive.getGeneticFlag())){
            json.put("GENETIC","1");//遗传病史【0 无 1 有】
            json.put("GENETIC_DISEASENAME",archive.getGeneticContent());//疾病名称
        }else{
            json.put("GENETIC","0");//遗传病史【0 无 1 有】
        }
        //残疾
        if(StringUtils.isNotBlank(archive.getDisabilitys())){
            String ds[] = archive.getDisabilitys().split(",");
            for(String d :ds){
                if("1".equals(d)){
                    json.put("DISABILITY_WITHOUT","1");//有无残疾--无残疾【0不勾选 1勾选】
                }
                if("2".equals(d)){
                    json.put("DISABILITY_EYES","1");//有无残疾--视力残疾【0不勾选 1勾选】
                    json.put("DISABILITY_WITHOUT","0");//有无残疾--无残疾【0不勾选 1勾选】
                }
                if("3".equals(d)){
                    json.put("DISABILITY_EAR","1");//有无残疾--听力残疾【0不勾选 1勾选】
                    json.put("DISABILITY_WITHOUT","0");//有无残疾--无残疾【0不勾选 1勾选】
                }
                if("4".equals(d)){
                    json.put("DISABILITY_SPEECH","1");//有无残疾--言语残疾【0不勾选 1勾选】
                    json.put("DISABILITY_WITHOUT","0");//有无残疾--无残疾【0不勾选 1勾选】
                }
                if("5".equals(d)){
                    json.put("DISABILITY_LIMB","1");//有无残疾--肢体残疾【0不勾选 1勾选】
                    json.put("DISABILITY_WITHOUT","0");//有无残疾--无残疾【0不勾选 1勾选】
                }
                if("6".equals(d)){
                    json.put("DISABILITY_INTELLECTUAL","1");//有无残疾--智力残疾【0不勾选 1勾选】
                    json.put("DISABILITY_WITHOUT","0");//有无残疾--无残疾【0不勾选 1勾选】
                }
                if("7".equals(d)){
                    json.put("DISABILITY_OTHER","1");//有无残疾--其它残疾【0不勾选 1勾选】
                    json.put("DISABILITY_WITHOUT","0");//有无残疾--无残疾【0不勾选 1勾选】
                }
            }
        }else{
            json.put("DISABILITY_WITHOUT","1");//  "DISABILITY_WITHOUT":"有无残疾--无残疾【0不勾选 1勾选】(同一类别,新增时,默认勾选)",
        }
        //家族史
        if(StringUtils.isNotBlank(archive.getFamilyHistoryFlag())&&"1".equals(archive.getFamilyHistoryFlag())){
            //父亲
            if(StringUtils.isNotBlank(archive.getFamilyFatherHistorys())){
                json.put("FAMILY_FATHER_NONE","0");//家族史--父亲--无【0不勾选 1勾选】
                String fhs[] = archive.getFamilyFatherHistorys().split(",");
                for(String fh : fhs){
                    if("1".equals(fh)){
                        json.put("FAMILY_FATHER_HYPERTENSION","1");//家族史--父亲--高血压【0不勾选 1勾选】
                    } else if("2".equals(fh)){
                        json.put("FAMILY_FATHER_DIABETES","1");//家族史--父亲--糖尿病【0不勾选 1勾选】
                    } else if("3".equals(fh)){
                        json.put("FAMILY_FATHER_CORONARY","1");//家族史--父亲--冠心病【0不勾选 1勾选】
                    } else if("4".equals(fh)){
                        json.put("FAMILY_FATHER_ALLERGY","1");//家族史--父亲--慢性阻塞性肺疾病【0不勾选 1勾选】
                    } else if("5".equals(fh)){
                        json.put("FAMILY_FATHER_MALIGNANT","1");//家族史--父亲--恶性肿瘤【0不勾选 1勾选】
                    } else if("6".equals(fh)){
                        json.put("FAMILY_FATHER_STROKE","1");//家族史--父亲--脑卒中【0不勾选 1勾选】
                    } else if("7".equals(fh)){
                        json.put("FAMILY_FATHER_SCHIZOPHRENIA","1");//家族史--父亲--重性精神疾病【0不勾选 1勾选】
                    } else if("8".equals(fh)){
                        json.put("FAMILY_FATHER_TB","1");//家族史--父亲--结核病【0不勾选 1勾选】
                    } else if("9".equals(fh)){
                        json.put("FAMILY_FATHER_HEPATITIS","1");//家族史--父亲--肝炎【0不勾选 1勾选】
                    } else if("10".equals(fh)){
                        json.put("FAMILY_FATHER_CONGENITAL","1");//家族史--父亲--先天畸形【0不勾选 1勾选】
                    } else if("11".equals(fh)){
                        json.put("FAMILY_FATHER_OTHER","1");//家族史--父亲--其它【0不勾选 1勾选】
                    }
                }
            }else{
                json.put("FAMILY_FATHER_NONE","1");//家族史--父亲--无【0不勾选 1勾选】
            }
            //母亲
            if(StringUtils.isNotBlank(archive.getFamilyMotherHistorys())){
                json.put("FAMILY_MOTHER_NONE","0");//家族史--母亲--无【0不勾选 1勾选】
                String mhs[] = archive.getFamilyMotherHistorys().split(",");
                for(String mh : mhs){
                    if("1".equals(mh)){
                        json.put("FAMILY_MOTHER_HYPERTENSION","1");//家族史--母亲--高血压【0不勾选 1勾选】
                    } else if("2".equals(mh)){
                        json.put("FAMILY_MOTHER_DIABETES","1");//家族史--母亲--糖尿病【0不勾选 1勾选】
                    } else if("3".equals(mh)){
                        json.put("FAMILY_MOTHER_CORONARY","1");//家族史--母亲--冠心病【0不勾选 1勾选】
                    } else if("4".equals(mh)){
                        json.put("FAMILY_MOTHER_ALLERGY","1");//家族史--母亲--慢性阻塞性肺疾病【0不勾选 1勾选】
                    } else if("5".equals(mh)){
                        json.put("FAMILY_MOTHER_MALIGNANT","1");//家族史--母亲--恶性肿瘤【0不勾选 1勾选】
                    } else if("6".equals(mh)){
                        json.put("FAMILY_MOTHER_STROKE","1");//家族史--母亲--脑卒中【0不勾选 1勾选】
                    } else if("7".equals(mh)){
                        json.put("FAMILY_MOTHER_SCHIZOPHRENIA","1");//家族史--母亲--重性精神疾病【0不勾选 1勾选】
                    } else if("8".equals(mh)){
                        json.put("FAMILY_MOTHER_TB","1");//家族史--母亲--结核病【0不勾选 1勾选】
                    } else if("9".equals(mh)){
                        json.put("FAMILY_MOTHER_HEPATITIS","1");//家族史--母亲--肝炎【0不勾选 1勾选】
                    } else if("10".equals(mh)){
                        json.put("FAMILY_MOTHER_CONGENITAL","1");//家族史--母亲--先天畸形【0不勾选 1勾选】
                    } else if("11".equals(mh)){
                        json.put("FAMILY_MOTHER_OTHER","1");//家族史--母亲--其它【0不勾选 1勾选】
                    }
                }
            }else{
                json.put("FAMILY_MOTHER_NONE","1");//家族史--母亲--无【0不勾选 1勾选】
            }
            //兄妹
            if(StringUtils.isNotBlank(archive.getFamilyBrotherHistorys())){
                json.put("FAMILY_BROTHERS_NONE","0");//家族史--兄弟姐妹--无【0不勾选 1勾选】
                String bhs[] = archive.getFamilyBrotherHistorys().split(",");
                for(String bh : bhs){
                    if("1".equals(bh)){
                        json.put("FAMILY_BROTHERS_HYPERTENSION","1");//家族史--兄弟姐妹--高血压【0不勾选 1勾选】
                    } else if("2".equals(bh)){
                        json.put("AMILY_BROTHERS_DIABETES","1");//家族史--兄弟姐妹--糖尿病【0不勾选 1勾选】
                    } else if("3".equals(bh)){
                        json.put("FAMILY_BROTHERS_CORONARY","1");//家族史--兄弟姐妹--冠心病【0不勾选 1勾选】
                    } else if("4".equals(bh)){
                        json.put("FAMILY_BROTHERS_ALLERGY","1");//家族史--兄弟姐妹--慢性阻塞性肺疾病【0不勾选 1勾选】
                    } else if("5".equals(bh)){
                        json.put("FAMILY_BROTHERS_MALIGNANT","1");//家族史--兄弟姐妹--恶性肿瘤【0不勾选 1勾选】
                    } else if("6".equals(bh)){
                        json.put("FAMILY_BROTHERS_STROKE","1");//家族史--兄弟姐妹--脑卒中【0不勾选 1勾选】
                    } else if("7".equals(bh)){
                        json.put("FAMILY_BROTHERS_SCHIZOPHRENIA","1");//家族史--兄弟姐妹--重性精神疾病【0不勾选 1勾选】
                    } else if("8".equals(bh)){
                        json.put("FAMILY_BROTHERS_TB","1");//家族史--兄弟姐妹--结核病【0不勾选 1勾选】
                    } else if("9".equals(bh)){
                        json.put("FAMILY_BROTHERS_HEPATITIS","1");//家族史--兄弟姐妹--肝炎【0不勾选 1勾选】
                    } else if("10".equals(bh)){
                        json.put("FAMILY_BROTHERS_CONGENITAL","1");//家族史--兄弟姐妹--先天畸形【0不勾选 1勾选】
                    } else if("11".equals(bh)){
                        json.put("FAMILY_BROTHERS_OTHER","1");//家族史--兄弟姐妹--其它【0不勾选 1勾选】
                    }
                }
            }else{
                json.put("FAMILY_BROTHERS_NONE","1");//家族史--兄弟姐妹--无【0不勾选 1勾选】
            }
            //子女
            if(StringUtils.isNotBlank(archive.getFamilyBrotherHistorys())){
                json.put("FAMILY_CHILDREN_NONE","0");//家族史--兄弟姐妹--无【0不勾选 1勾选】
                String bhs[] = archive.getFamilyBrotherHistorys().split(",");
                for(String bh : bhs){
                    if("1".equals(bh)){
                        json.put("FAMILY_CHILDREN_HYPERTENSION","1");//家族史--子女--高血压【0不勾选 1勾选】
                    } else if("2".equals(bh)){
                        json.put("FAMILY_CHILDREN_DIABETES","1");//家族史--子女--糖尿病【0不勾选 1勾选】
                    } else if("3".equals(bh)){
                        json.put("FAMILY_CHILDREN_CORONARY","1");//家族史--子女--冠心病【0不勾选 1勾选】
                    } else if("4".equals(bh)){
                        json.put("FAMILY_CHILDREN_ALLERGY","1");//家族史--子女--慢性阻塞性肺疾病【0不勾选 1勾选】
                    } else if("5".equals(bh)){
                        json.put("FAMILY_CHILDREN_MALIGNANT","1");//家族史--子女--恶性肿瘤【0不勾选 1勾选】
                    } else if("6".equals(bh)){
                        json.put("FAMILY_CHILDREN_STROKE","1");//家族史--子女--脑卒中【0不勾选 1勾选】
                    } else if("7".equals(bh)){
                        json.put("FAMILY_CHILDREN_SCHIZOPHRENIA","1");//家族史--子女--重性精神疾病【0不勾选 1勾选】
                    } else if("8".equals(bh)){
                        json.put("FAMILY_BROTHERS_TB","1");//家族史--子女--结核病【0不勾选 1勾选】
                    } else if("9".equals(bh)){
                        json.put("FAMILY_CHILDREN_HEPATITIS","1");//家族史--子女--肝炎【0不勾选 1勾选】
                    } else if("10".equals(bh)){
                        json.put("FAMILY_CHILDREN_CONGENITAL","1");//家族史--子女--先天畸形【0不勾选 1勾选】
                    } else if("11".equals(bh)){
                        json.put("FAMILY_CHILDREN_OTHER","1");//家族史--子女--其它【0不勾选 1勾选】
                    }
                }
            }else{
                json.put("FAMILY_CHILDREN_NONE","1");//家族史--子女--无【0不勾选 1勾选】
            }
        }else{
            json.put("FAMILY_FATHER_NONE","1");// "FAMILY_FATHER_NONE":"家族史--父亲--无【0不勾选 1勾选】(同一类别,新增时,默认勾选)",
            json.put("FAMILY_MOTHER_NONE","1");// "FAMILY_MOTHER_NONE":"家族史--母亲--无【0不勾选 1勾选】(同一类别,新增时,默认勾选)",
            json.put("FAMILY_BROTHERS_NONE","1");//  "FAMILY_BROTHERS_NONE":"家族史--兄弟姐妹--无【0不勾选 1勾选】(同一类别,新增时,默认勾选)",
            json.put("FAMILY_CHILDREN_NONE","1");//  "FAMILY_CHILDREN_NONE":"家族史--子女--无【0不勾选 1勾选】(同一类别,新增时,默认勾选)",
        }
        json.put("SURGERY","0");// "SURGERY":"既往史--手术--【0 无 1 有】(同一类别,新增时,默认选无)",
        String response = jwArchivesService.saveSickArchiveRecord(com.alibaba.fastjson.JSONObject.toJSONString(json, SerializerFeature.WriteMapNullValue),archive.getDoctorCode());
        if("0".equals(response)){
            return -1;
        }
        //保存建档记录
        SocialSecurityInfo info = new SocialSecurityInfo();
        info.setXming0(p.getName());
        info.setXbie00(p.getSex()+"");
        info.setSfzh18(p.getIdcard());
        info.setId0000(p.getIdcard());
        info.setCardno(p.getSsc());
        info.setCard16(p.getSsc());
        info.setCsrqi0(archive.getBrithday().replace("-",""));
        info.setGrsfen("8");
        info.setGzztai("01");
        socialSecurityInfoDao.save(info);
        return 1;
    }
    public  List<Map<String,Object>> getNationDict(){
        String sql = "SELECT t.NATION_CODE,t.NATION_NAME FROM zy_nation_dict t ";
@ -521,4 +838,100 @@ public class PatientInfoService extends BaseService {
        return rs;
    }
    public JSONObject createProfileAndSign(String archiveJson)throws Exception{
        net.sf.json.JSONObject j  = net.sf.json.JSONObject.fromObject(archiveJson);
        PatientArchivesDto archive = (PatientArchivesDto) net.sf.json.JSONObject.toBean(j,PatientArchivesDto.class);
        JSONObject rs = new  JSONObject();
        // 解密身份证号
        rsaUtils.setBaseService(patientService);
        String idcard = rsaUtils.decryptString(archive.getIdcard());
        idcard = URLDecoder.decode(idcard, "UTF-8");
        idcard = StringUtils.reverse(idcard);
        // 校验身份证号
        IdcardValidator validator = new IdcardValidator();
        if (validator.isValidatedAllIdcard(idcard)) {
            if (idcard.length() == 15) {
                idcard = validator.convertIdcarBy15bit(idcard);
                if (StringUtils.isEmpty(idcard)) {
                    rs.put("code","-1");
                    rs.put("mes","身份证格式不正确!") ;
                    return rs;
                }
            }
        } else {
            rs.put("code","-1");
            rs.put("mes","身份证格式不正确!") ;
            return rs;
        }
        if(archive.getMobile().length()!=11){
            rs.put("code","-2");
            rs.put("mes","手机格式不正确!") ;
            return rs;
        }
        String salt = UUID.randomUUID().toString().replace("-", "");
        String password = idcard.substring(idcard.length()-6,idcard.length());
        password = MD5.GetMD5Code(password + salt);
        Patient p = patientService.registerAPPBydoctor(idcard,archive.getSsc(),archive.getName(),archive.getMobile(),password,salt,salt,3);
        createProfile(archiveJson);
        rs.put("code","1");
        rs.put("mes","操作成功!") ;
        return rs;
    }
    public Map<String,Object> getArchiveComboList(){
        List<SystemDict> education =systemDictDao.findByDictName("ZY_DEGREE_EDUCATION");
        List<SystemDict> occupation =systemDictDao.findByDictName("ZY_OCCUPATION");
        List<SystemDict> payment =systemDictDao.findByDictName("ZY_PAYMENT_METHOD");
        List<SystemDict> allergy =systemDictDao.findByDictName("ZY_HISTORY_OF_DRUG_ALLERGY");
        List<SystemDict> pastHistory =systemDictDao.findByDictName("ZY_PAST_HISTORY");
        List<SystemDict> disability =systemDictDao.findByDictName("ZY_DISABILITY");
        List<SystemDict> familyHistory =systemDictDao.findByDictName("ZY_FAMILY_HISTORY");
        Map<String,Object> rs = new HashedMap();
        rs.put("education",education);
        rs.put("occupation",occupation);
        rs.put("payment",payment);
        rs.put("allergy",allergy);
        rs.put("pastHistory",pastHistory);
        rs.put("disability",disability);
        rs.put("familyHistory",familyHistory);
        return rs;
    }
    public JSONObject getPatientJWInfo(String idcard)throws Exception{
        org.json.JSONArray jsonArray = jwArchivesService.getSickArchiveRecord(idcard);
        JSONObject rs = (JSONObject) jsonArray.get(0);
        String sql ="SELECT " +
                " TIMESTAMPDIFF(YEAR,p.birthday,SYSDATE()) age, " +
                " p.photo, " +
                " FROM " +
                " wlyy_patient p " +
                " WHERE " +
                " p.idcard = '"+idcard+"'";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        if(list!=null&&list.size()>0){
            Map<String,Object>  s = list.get(0);
            rs.put("age",s.get("age"));
            rs.put("photo",s.get("photo"));
        }
        return rs;
    }
    public  Map<String,Object> getPatientSignFamily(String idcard){
        SignFamily f = signFamilyDao.findByIdcard(idcard);
        Map<String,Object> rs = new HashedMap();
        rs.put("SignFamily",f);
        return rs;
    }
}

+ 6 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/physicalExamination/PhysicalExaminationRemindService.java

@ -336,13 +336,13 @@ public class PhysicalExaminationRemindService extends BaseService {
        Boolean flag = true;
        // 推送消息给微信端
        String url = "jkda/html/jiankangtijian.html?openid=" + patient.getOpenid() +"&toUser="+patient.getCode()+"&toName=" + patient.getName();
        String first = "您的家庭医生" + doctName + "提醒,您可以到签约社区进行免费的健康体检啦~";
        String first = "您的家庭医生" + doctName + "提醒,您可以到签约社区进行65岁以上老年人的免费健康体检啦~";
        JSONObject json = new org.json.JSONObject();
        json.put("first",first);
        json.put("url",url);
        json.put("keyword1", "健康体检");
        json.put("keyword2", format.format(new Date()));
        json.put("remark", "为了您和您的家庭医生了解您近期的健康状况,请及时到您签约的社区体检哟~");
        json.put("remark", "为了您和您的家庭医生了解您近期的健康状况,请及时到您签约的社区体检哟~(如已体检请忽略)");
        if (StringUtils.isNotBlank(patient.getOpenid())) {
            pushMsgTask.putWxMsg(accessToken, 11, patient.getOpenid(), patient.getName(), json);
            flag = false;
@ -372,7 +372,7 @@ public class PhysicalExaminationRemindService extends BaseService {
        }
//        微信发送失败发送短信
        if (flag && StringUtils.isNotEmpty(mobile)) {
            smsService.sendMsg(mobile, "厦门i健康家庭医生温馨提醒,您已经超过一年没有到社区进行健康体检啦,为了您和您的家庭医生了解您近期的健康状况,请及时到签约社区进行免费的健康体检");
            smsService.sendMsg(mobile, "厦门i健康家庭医生温馨提醒,您已经超过一年没有到社区进行健康体检啦,为了您和您的家庭医生了解您近期的健康状况,请及时到签约社区进行免费的健康体检(如已体检请忽略)");
        }
        //保存发送提醒
@ -401,7 +401,7 @@ public class PhysicalExaminationRemindService extends BaseService {
        JSONObject json = new org.json.JSONObject();
        json.put("keyword1", "健康体检");
        json.put("keyword2", format.format(new Date()));
        json.put("remark", "为了您和您的家庭医生了解您近期的健康状况,请及时到您签约的社区体检哟~");
        json.put("remark", "为了您和您的家庭医生了解您近期的健康状况,请及时到您签约的社区体检哟~(如已体检请忽略)");
        Calendar c = Calendar.getInstance();
        c.setTime(new Date());
@ -410,7 +410,7 @@ public class PhysicalExaminationRemindService extends BaseService {
        List<Patient> patients = patientDao.findExaminationRemind(teamId, yesteryear);
        for (Patient patient : patients) {
            String url = "jkda/html/jiankangtijian.html?openid=" + patient.getOpenid() +"&toUser="+patient.getCode()+"&toName=" + patient.getName();
            String first = "您的家庭医生" + doctName + "提醒,您可以到签约社区进行免费的健康体检啦~";
            String first = "您的家庭医生" + doctName + "提醒,您可以到签约社区进行65岁以上老年人的免费健康体检啦~";
            json.put("first",first);
            json.put("url",url);
            String mobile = patient.getMobile();
@ -447,7 +447,7 @@ public class PhysicalExaminationRemindService extends BaseService {
            }
            //        微信发送失败发送短信
            if (flag && StringUtils.isNotEmpty(mobile)) {
                smsService.sendMsg(mobile, "厦门i健康家庭医生温馨提醒,您已经超过一年没有到社区进行健康体检啦,为了您和您的家庭医生了解您近期的健康状况,请及时到签约社区进行免费的健康体检");
                smsService.sendMsg(mobile, "厦门i健康家庭医生温馨提醒,您已经超过一年没有到社区进行健康体检啦,为了您和您的家庭医生了解您近期的健康状况,请及时到签约社区进行免费的健康体检(如已体检请忽略)");
            }
            flag = true;
            //保存发送提醒

+ 87 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PatientPrescriptionPayService.java

@ -3,15 +3,22 @@ package com.yihu.wlyy.service.app.prescription;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.entity.charge.PatientPopups;
import com.yihu.wlyy.entity.charge.WlyyCharge;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.entity.message.MessageNoticeSetting;
import com.yihu.wlyy.entity.organization.Hospital;
import com.yihu.wlyy.entity.organization.HospitalMapping;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.patient.prescription.*;
import com.yihu.wlyy.entity.ylz.PayConfigura;
import com.yihu.wlyy.entity.zydict.ZyPushLog;
import com.yihu.wlyy.repository.charge.ChargeDao;
import com.yihu.wlyy.repository.charge.PopupsDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.repository.organization.HospitalDao;
@ -22,14 +29,18 @@ import com.yihu.wlyy.repository.prescription.PrescriptionExpressageDao;
import com.yihu.wlyy.repository.prescription.PrescriptionInfoDao;
import com.yihu.wlyy.repository.prescription.PrescriptionPayDao;
import com.yihu.wlyy.repository.ylz.PayConfiguraDao;
import com.yihu.wlyy.repository.zydict.ZyPushLogDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.message.MessageService;
import com.yihu.wlyy.service.third.ylz.PayLogService;
import com.yihu.wlyy.service.weixin.wxpay.model.BindCard;
import com.yihu.wlyy.service.weixin.wxpay.model.Charge;
import com.yihu.wlyy.service.weixin.wxpay.service.OnePayService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.MessageType;
import com.yihu.wlyy.util.SystemConf;
import com.yihu.wlyy.web.wx.OnePayController;
import com.ylzinfo.onepay.sdk.OnepayDefaultClient;
import com.ylzinfo.onepay.sdk.domain.RequestParams;
import com.ylzinfo.onepay.sdk.domain.ResponseParams;
@ -43,6 +54,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.security.access.method.P;
import org.springframework.stereotype.Service;
import org.springframework.util.StreamUtils;
@ -52,6 +64,7 @@ import javax.transaction.Transactional;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.reflect.Method;
import java.nio.charset.Charset;
import java.text.SimpleDateFormat;
import java.util.*;
@ -122,6 +135,8 @@ public class PatientPrescriptionPayService extends BaseService {
    private PushMsgTask pushMsgTask;
    @Autowired
    private PrescriptionDispensaryCodeService codeService;
    @Autowired
    private PopupsDao popupsDao;
    /**
     * 长处方配送信息查询接口
@ -1047,7 +1062,7 @@ public class PatientPrescriptionPayService extends BaseService {
            String resName = "";
            String resSsc = "";
            String resIdNo = "";
            if (!patient.equals(repUid)){
            if (!patient.equals(repUid)) {
                List<BindCard> bindCard = onePayService.bindCardList(openid);
                for (BindCard cards : bindCard) {
                    String attachCardNo = cards.getAttachCardNo();
@ -1062,7 +1077,7 @@ public class PatientPrescriptionPayService extends BaseService {
                    resultMap.put("status", "-1");
                    return resultMap;
                }
            }else {
            } else {
                logger.info("================================>" + "after get BindCard");
//            验证续方人与绑卡人(或代理人)是否一致
                if (!(payName.equals(name) && paySsc.equals(ssc) && payIdcard.equals(idNo))) {
@ -1116,14 +1131,14 @@ public class PatientPrescriptionPayService extends BaseService {
            String visitNo = prescription.getVisitNo();//续方挂号号
            String recipeNo = prescription.getRecipeNo();//基位处方code(开方成功后返回)
            JSONObject jsonParams = null;
            if (!patient.equals(repUid)){
            if (!patient.equals(repUid)) {
                logger.debug("======================> getPayInfo " + resSsc + visitNo);
                if (visitNo == null || resSsc == null || recipeNo == null) {
                    resultMap.put("status", "-2");
                    return resultMap;
                }
                jsonParams = prescriptionService.getPayInfo(resSsc, visitNo, recipeNo);
            }else{
            } else {
                logger.debug("======================> getPayInfo " + ssc + visitNo);
                if (visitNo == null || ssc == null || recipeNo == null) {
                    resultMap.put("status", "-2");
@ -1170,10 +1185,10 @@ public class PatientPrescriptionPayService extends BaseService {
                        principalCardNo = repSsc;
                    }
                }
                if (StringUtils.isNotEmpty(principalCardNo)){
                if (StringUtils.isNotEmpty(principalCardNo)) {
                    map.put("principalCardNo", principalCardNo); //实际签约卡号( 默认为绑卡主体卡号)
                    prescriptionPay.setPrincipalCardNo(principalCardNo);
                }else {
                } else {
                    resultMap.put("status", "-4");
                    return resultMap;
                }
@ -1548,5 +1563,71 @@ public class PatientPrescriptionPayService extends BaseService {
        return result;
    }
    /**
     * 保存及修改居民支付弹窗设置
     *
     * @param type    弹窗类型
     * @param patient 支付主体code
     * @param status  弹窗状态
     * @return
     * @throws Exception
     */
    public void savePopups(int type, String patient, String status) throws Exception {
        try {
            Date today = new Date();
            PatientPopups popups = popupsDao.findByCodeAndType(patient, type);
            if (popups == null) {
                popups = new PatientPopups();
                popups.setPatient(patient);
                popups.setType(type);
                popups.setCreateTime(today);
            }
            popups.setStatus(status);
            popups.setCzrq(today);
            popupsDao.save(popups);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    /**
     * 查询居民支付弹窗设置
     *
     * @param type    弹窗类型
     * @param patient 支付主体code
     * @return
     * @throws Exception
     */
    public PatientPopups getPopups(int type, String patient) throws Exception {
        PatientPopups popups = null;
        try {
            popups = popupsDao.findByCodeAndType(patient, type);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return popups;
    }
    /**
     * 查询缴费居民手机绑定情况
     *
     * @param user 需要缴费的患者code(共济支付为被代理人)
     * @return
     * @throws Exception
     */
    public String getPatientMobile(String user) throws Exception {
        String mobile = null;
        try {
            Patient patient = patientDao.findByCode(user);
            if (patient != null) {
                mobile = patient.getMobile();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return mobile;
    }
}

+ 2 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionExpressageService.java

@ -724,6 +724,8 @@ public class PrescriptionExpressageService extends BaseService {
                " wlyy_prescription p " +
                " WHERE " +
                " p.hospital = '"+d.getHospital()+"' " +
                " AND p.drug_delivery_operator IS NOT NULL" +
                " AND p.drug_delivery_operator <>'' " +
                " GROUP BY " +
                " p.drug_delivery_operator ";
        List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);

+ 10 - 13
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/PatientRemindService.java

@ -3,6 +3,7 @@ package com.yihu.wlyy.service.app.sign;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.organization.Hospital;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.organization.HospitalDao;
import com.yihu.wlyy.repository.patient.PatientDao;
@ -202,6 +203,15 @@ public class PatientRemindService extends BaseService {
            boolean isMobileExist = false;
            boolean isOpenIdExist = false;
            //过滤只提醒已签约未扣费居民 by wujunjie 2017.11.29
            SignFamily signFamily = signFamilyDao.findUnpay(p.getCode());
            if (signFamily == null){
                JSONObject response = new JSONObject();
                response.put("status", -1);
                response.put("msg", "未找到该居民已签约未缴费信息!");
                return response;
            }
            if (StringUtils.isNotEmpty(p.getMobile())) {
                isMobileExist = true;
                JSONObject result = smsService.sendMsg(p.getMobile(), doc.getName() + "医生提醒您:为完成家庭医生签约," +
@ -213,7 +223,6 @@ public class PatientRemindService extends BaseService {
                    mDesc = result.getString("description");
                }
            }
//            if (StringUtils.isNotEmpty(p.getOpenid())) {
            // 微信提醒
            JSONObject json = new JSONObject();
@ -234,17 +243,6 @@ public class PatientRemindService extends BaseService {
                pushMsgTask.putWxMsg(tokenUtils.getAccessToken(), 8, p.getOpenid(), p.getName(), json);
                wFlag = true;
            }
//                else{
//                    JSONObject j  = weiXinOpenIdUtils.getFamilyOpenId(p.getCode());
//                    Patient member = (Patient) j.get("member");
//                    if(StringUtils.isNotBlank(member.getOpenid())){
//                        isOpenIdExist = true;
//                        String first = (String) json.get("doctorName");
//                        json.remove("doctorName");
//                        json.put("doctorName",weiXinOpenIdUtils.getTitleMes(p,j.getInt("relation"),member.getName())+"\n"+first);
//                        PushMsgTask.getInstance().putWxMsg(tokenUtils.getAccessToken(), 8, member.getOpenid(), member.getName(), json);
//                    }
//                }
            //发送代理人
            JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(p.getCode(),p.getOpenid());
            if(jsonArray!=null&&jsonArray.length()>0){
@ -264,7 +262,6 @@ public class PatientRemindService extends BaseService {
            }
//            }
            //发送IM
            consultService.sendMucMessageBySingnType(doc.getCode(), doc.getName(), p.getCode(), doc.getName() + "医生提醒您:为完成家庭医生签约," +
                    "尽早为您提供家庭医生服务,请尽快到" + hos.getName() + "(地址:" + hos.getAddress() + ")缴费", "1",p.getName());

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

@ -2286,6 +2286,7 @@ public class SignWebService extends BaseService {
        SignFamilyRenewLog log = new SignFamilyRenewLog();
        //存储新记录
        log.setRenewSignCode(renew.getCode());
        log.setSignCode(renew.getCode());
        log.setSignYear(renew.getSignYear());
        log.setIdcard(renew.getIdcard());
        log.setAdminTeamId(renew.getAdminTeamId());

+ 328 - 45
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java

@ -2711,10 +2711,10 @@ public class StatisticsESService {
        if (StringUtils.isEmpty(lowCode)) {
            //续签量
            renewSaveModels = elasticsearchUtil.findDateQuotaLevel0(timeKey, timeKey, area, level, index, "2", "", low_level);
            renewSaveModels = elasticsearchUtil.findDateQuotaLevel0(timeKey, timeKey, area, level, index, SaveModel.timeLevel_DDL, "", low_level);
        } else {
            //续签量
            renewSaveModels = elasticsearchUtil.findDateQuotaLevel1(timeKey,timeKey, area, level, index, "2", lowCode, "", low_level);
            renewSaveModels = elasticsearchUtil.findDateQuotaLevel1(timeKey,timeKey, area, level, index, SaveModel.timeLevel_DDL, lowCode, "", low_level);
        }
@ -2740,9 +2740,9 @@ public class StatisticsESService {
            //查询去年的签约转map
            List<SaveModel> yearsList = new ArrayList();
            if (StringUtils.isBlank(lowCode)) {
                yearsList = elasticsearchUtil.findDateQuotaLevel0(lastDate, lastDate, area, level, "1", "2", "", low_level);
                yearsList = elasticsearchUtil.findDateQuotaLevel0(lastDate, lastDate, area, level, "1", SaveModel.timeLevel_DDL, "", low_level);
            } else {
                yearsList = elasticsearchUtil.findDateQuotaLevel1(lastDate, lastDate, area, level, "17", "2", lowCode, "", low_level);
                yearsList = elasticsearchUtil.findDateQuotaLevel1(lastDate, lastDate, area, level, "17", SaveModel.timeLevel_DDL, lowCode, "", low_level);
            }
            Map<String, SaveModel> resultMap = new HashMap<>();
@ -4272,21 +4272,27 @@ public class StatisticsESService {
            totalModelList = (List<SaveModel>) elasticsearchUtil.findListDateQuotaLevel0(date, area, level, "1", SaveModel.timeLevel_DDL, low_level);
        }
        Map<String, Object> signOnlineMap = new HashMap<String, Object>();
        if (esModelList != null && esModelList.size() > 0) {
            for (SaveModel one : esModelList) {
                Map<String, Object> maps = new HashMap<String, Object>();
                maps.put("amount", one.getResult2().intValue());
                //signOnlineMap.put("amount", one.getResult2().intValue());
                /*if (low_level.equals("3") && one.getTown() != null) {
                    signOnlineMap.put("code", one.getTown());
                    signOnlineMap.put("name", one.getTownName());
                } else if (low_level.equals("4") && one.getHospital() != null) {
                    signOnlineMap.put("code", one.getHospital());
                    signOnlineMap.put("name", one.getHospitalName());
                } else if (low_level.equals("5") && one.getTeam() != null) {
                    signOnlineMap.put("code", one.getTeam());
                    signOnlineMap.put("name", one.getTeamName());
                }*/
                if (low_level.equals("3") && one.getTown() != null) {
                    maps.put("code", one.getTown());
                    maps.put("name", one.getTownName());
                    signOnlineMap.put(one.getTown(), one.getResult2().intValue());
                } else if (low_level.equals("4") && one.getHospital() != null) {
                    maps.put("code", one.getHospital());
                    maps.put("name", one.getHospitalName());
                    signOnlineMap.put(one.getHospital(), one.getResult2().intValue());
                } else if (low_level.equals("5") && one.getTeam() != null) {
                    maps.put("code", one.getTeam());
                    maps.put("name", one.getTeamName());
                    signOnlineMap.put(one.getTeam(), one.getResult2().intValue());
                }
                resultList.add(maps);
            }
        }
@ -4294,39 +4300,39 @@ public class StatisticsESService {
        if (resultList == null || resultList.size() < 1) {
            resultList = getLowLevelMapKey(level, low_level, area);
        }
        if (resultList != null) {
            DecimalFormat df = new DecimalFormat("0.0000");
            for (int i = 0; i < resultList.size(); i++) {
                Map<String, Object> map = resultList.get(i);
                long signOnline =Long.valueOf(String.valueOf(map.get("amount")));
                map.put("amount", map.get("amount") != null ? signOnline : 0L);
                for (SaveModel totalOne : totalModelList) {
                    if (low_level.equals("3") && String.valueOf(map.get("code")).equals(totalOne.getTown())) {
                        map.put("signAmount",totalOne.getResult2().longValue());
                        map.put("rate",df.format(signOnline*1.0/totalOne.getResult2().longValue()*1000));
                    } else if (low_level.equals("4") &&  String.valueOf(map.get("code")).equals(totalOne.getHospital())) {
                        map.put("signAmount",totalOne.getResult2().longValue());
                        map.put("rate",df.format(signOnline*1.0/totalOne.getResult2().longValue()*1000));
                    } else if (low_level.equals("5") && totalOne.getTeam() != null) {
                        map.put("signAmount",totalOne.getResult2().longValue());
                        map.put("rate",df.format(signOnline*1.0/totalOne.getResult2().longValue()*1000));
                    }
        if (resultList != null && resultList.size()>0) {
            //查询今年的线上续签转map
            Map<String, SaveModel> resultMap = new HashMap<>();
            totalModelList.stream().forEach(one->{
                if ("5".equals(low_level)) {
                    resultMap.put(one.getTeam(), one);
                } else if ("4".equals(low_level)) {
                    resultMap.put(one.getHospital(), one);
                } else if ("3".equals(low_level)) {
                    resultMap.put(one.getTown(), one);
                }
            });
                /*if (!low_level.equals("5")) {
                    String code = String.valueOf(map.get("code"));
                    PopulationBase peopleNum = getPopulationBase(code, year);
                    if (peopleNum != null) {
                        map.put("rate", df.format(((long) map.get("amount") * 1.0000) / peopleNum.getNum() * 100));
                        map.put("taskRate", df.format(((long) map.get("amount") * 1.0000) / peopleNum.getTaskNum() * 100));
                        map.put("targetRate", df.format(peopleNum.getTaskNum() * 1.0000 / peopleNum.getNum() * 100));
                        map.put("rateString", map.get("amount") + "/" + peopleNum.getNum());
                        map.put("taskRateString", map.get("amount") + "/" + peopleNum.getTaskNum());
                        map.put("targetRateString", peopleNum.getTaskNum() + "/" + peopleNum.getNum());
                        map.put("num", peopleNum.getNum());
                        map.put("task", peopleNum.getTaskNum());
            for (Map<String, Object> reMap : resultList) {
                reMap.put("amount", reMap.get("amount") != null ? Long.valueOf(reMap.get("amount").toString()) : 0L);
                Integer signNun = 0;
                Integer signOnlineNum = 0;
                //获取签约量
                if (resultMap != null && resultMap.size() > 0) {
                    SaveModel one = resultMap.get(reMap.get("code").toString());
                    if (one != null) {
                        signNun = one.getResult2().intValue();
                    }
                }*/
                }
                if (signOnlineMap != null && signOnlineMap.size() > 0) {
                    signOnlineNum = (Integer) signOnlineMap.get(String.valueOf(reMap.get("code")));
                    if (signOnlineNum == null) {
                        signOnlineNum = 0;
                    }
                }
                reMap.put("signNun", signNun);
                reMap.put("signOnlineNum", signOnlineNum);
                reMap.put("rate", getRange(signOnlineNum, signNun, 2));//线上签约率是 线上签约量/签约量
            }
            if ((level == 2 && "5".equals(lowLevel)) || (level == 4) || (level == 3 && "5".equals(lowLevel))) {
@ -4335,8 +4341,8 @@ public class StatisticsESService {
            Collections.sort(resultList, new Comparator<Map<String, Object>>() {
                public int compare(Map<String, Object> o1, Map<String, Object> o2) {
                    long map1value = (long) o1.get("amount");
                    long map2value = (long) o2.get("amount");
                    long map1value = (long) o1.get("signOnlineNum");
                    long map2value = (long) o2.get("signOnlineNum");
                    if (map1value - map2value > 0) {
                        return sort == 1 ? -1 : 1;
@ -4353,6 +4359,16 @@ public class StatisticsESService {
        }
    }
    /**
     * 线上续签率
     *
     * @param index
     * @param level
     * @param area
     * @param year
     * @param lowCode
     * @return
     */
    public JSONObject getRenewPercentOnline(String index, Integer level, String area, String year, String lowCode) {
        JSONObject jo = new JSONObject();
        String renewOnlineIndex = "";//线上续签index
@ -4441,4 +4457,271 @@ public class StatisticsESService {
        }
        return jo;
    }
    /**
     * 线上续签各等级地区的列表
     * @param area
     * @param level
     * @param index
     * @param sort
     * @param lowLevel
     * @param year
     * @param lowCode
     * @return
     * @throws Exception
     */
    public JSONArray getLevelTwoLowLevelTotalRenewOnline(String area, int level, String index, int sort, String lowLevel, String year, String lowCode) throws Exception {
        String timeKey = elasticsearchUtil.getQuotaTime();
        String low_level = String.valueOf(StringUtils.isEmpty(lowLevel) ? (level + 1) : lowLevel);
        String renewIndex = "";//续签指标
        if (level==3){//区
            if (StringUtils.isNotBlank(lowCode)){
                renewIndex="44";
            }else{
                renewIndex="54";
            }
        }
        if (level==4){//社区
            if (StringUtils.isNotBlank(lowCode)){
                renewIndex="43";
            }else{
                renewIndex="53";
            }
        }
        if (level==5){//团队
            if (StringUtils.isNotBlank(lowCode)){
                renewIndex="42";
            }else{
                renewIndex="52";
            }
        }
        List<Map<String, Object>> resultList = new ArrayList<>();//续签量
        Map<String, Integer> renewMap = new HashMap<>(); //续签的的列表转map
        List<SaveModel> renewSaveModels = new ArrayList<SaveModel>();
        List<SaveModel> renewOnlineList = new ArrayList<SaveModel>();
        if (StringUtils.isEmpty(lowCode)) {
            //续签量
            renewSaveModels = elasticsearchUtil.findDateQuotaLevel0(timeKey, timeKey, area, level, renewIndex, SaveModel.timeLevel_DDL, "", low_level);
            //线上续签量
            renewOnlineList = elasticsearchUtil.findDateQuotaLevel0(timeKey, timeKey, area, level, index, SaveModel.timeLevel_DDL, "", low_level);
        } else {
            //续签量
            renewSaveModels = elasticsearchUtil.findDateQuotaLevel1(timeKey,timeKey, area, level, renewIndex, SaveModel.timeLevel_DDL, lowCode, "", low_level);
            //线上续签量
            renewOnlineList = elasticsearchUtil.findDateQuotaLevel1(timeKey, timeKey, area, level, index, SaveModel.timeLevel_DDL, lowCode, "", low_level);
        }
        if (renewSaveModels != null && renewSaveModels.size() > 0) {
            for (SaveModel saveModel : renewSaveModels) {
                if ("3".equals(low_level) && saveModel.getTown() != null) {
                    renewMap.put(saveModel.getTown(), saveModel.getResult2().intValue());
                } else if ("4".equals(low_level) && saveModel.getHospital() != null) {
                    renewMap.put(saveModel.getHospital(), saveModel.getResult2().intValue());
                } else if ("5".equals(low_level) && saveModel.getTeam() != null) {
                    renewMap.put(saveModel.getTeam(), saveModel.getResult2().intValue());
                } else {
                    continue;
                }
            }
        }
        //自建结果集
        resultList = getLowLevelMapKey(level, low_level, area);
        if (resultList != null && resultList.size() > 0) {
            //查询今年的线上续签转map
            Map<String, SaveModel> resultMap = new HashMap<>();
            renewOnlineList.stream().forEach(one -> {
                if ("5".equals(low_level)) {
                    resultMap.put(one.getTeam(), one);
                } else if ("4".equals(low_level)) {
                    resultMap.put(one.getHospital(), one);
                } else if ("3".equals(low_level)) {
                    resultMap.put(one.getTown(), one);
                }
            });
            for (Map<String, Object> reMap : resultList) {
                reMap.put("amount", reMap.get("amount") != null ? Long.valueOf(reMap.get("amount").toString()) : 0L);
                int renewOnlineNum = 0;
                Integer renewNum = 0;
                //获取线上续签数量
                if (resultMap != null && resultMap.size() > 0) {
                    SaveModel one = resultMap.get(reMap.get("code").toString());
                    if (one != null) {
                        renewOnlineNum = one.getResult2().intValue();
                    }
                }
                if (renewMap != null && renewMap.size() > 0) {
                    renewNum = renewMap.get(reMap.get("code").toString());
                    if (renewNum == null) {
                        renewNum = 0;
                    }
                }
                reMap.put("renewNum", renewNum);
                reMap.put("renewOnlineNum", renewOnlineNum);
                reMap.put("rate", getRange(renewOnlineNum, renewNum, 2));//线上续签率是 线上续签量/续签量
            }
            if ((level == 2 && "5".equals(lowLevel)) || (level == 4) || (level == 3 && "5".equals(lowLevel))) {
                translateTeamLeaderName(resultList);
            }
            //对结果进行排序
            Collections.sort(resultList, new Comparator<Map<String, Object>>() {
                public int compare(Map<String, Object> o1, Map<String, Object> o2) {
                    int map1value = (int) o1.get("renewOnlineNum");
                    int map2value = (int) o2.get("renewOnlineNum");
                    if (map1value - map2value > 0) {
                        return sort == 1 ? -1 : 1;
                    } else if (map1value - map2value < 0) {
                        return sort == 1 ? 1 : -1;
                    } else {
                        return 0;
                    }
                }
            });
            return new JSONArray(resultList);
        } else {
            return new JSONArray();
        }
    }
    /**
     * 居民分析--线上和线下缴费
     * @param level
     * @param area
     * @param year
     * @return
     */
    public JSONObject getSignPayOnline(Integer level, String area, String year) {
        JSONObject jo = new JSONObject();
        String timeKey ="";
        try{
            if (StringUtils.isNotEmpty(year)) {
                if (Constant.getNowYear().equals(year)) {
                    timeKey = elasticsearchUtil.getQuotaTime();
                } else {
                    Integer coutYear = Integer.parseInt(year);
                    timeKey = coutYear + 1 + "-06-30";
                }
            }
            //获取已缴费的总人数
            SaveModel signSaveModel = elasticsearchUtil.findOneDateQuotaLevel0(timeKey,area,level,"1",SaveModel.timeLevel_DDL);
            //获取线上缴费的人数
            SaveModel signPayOnlineSaveModel = elasticsearchUtil.findOneDateQuotaLevel0(timeKey,area,level,"82",SaveModel.timeLevel_DDL);
            int signNum = signSaveModel.getResult2().intValue();
            int signPayOnlineNum = signPayOnlineSaveModel.getResult2().intValue();
            //线下缴费=已缴费的总人数-线上缴费
            int signPayUnderNum = signNum-signPayOnlineNum;
            jo.put("signPayOnlineNum", signPayOnlineNum);//线上缴费数量
            jo.put("signPayUnderNum", signPayUnderNum);//线下缴费数量
            jo.put("signPayOnlineRate", getRange(signPayOnlineNum, signNum, 2));//线上缴费率  50.00%
            jo.put("signPayUnderRate", getRange(signPayUnderNum, signNum, 2));//线下缴费率  50.00%
        } catch (Exception e) {
            e.getMessage();
            jo.put("status", "0");
            jo.put("error", "查询失败" + e.getMessage());
            return jo;
        }
        return jo;
    }
    public JSONArray getLowLevelSignPayOnline(String area, int level, String index, int sort, String lowLevel, String year) throws Exception {
        String timeKey = "";
        if (StringUtils.isNotEmpty(year)) {
            if (Constant.getNowYear().equals(year)) {
                timeKey = elasticsearchUtil.getQuotaTime();
            } else {
                Integer coutYear = Integer.parseInt(year);
                timeKey = coutYear + 1 + "-06-30";
            }
        }
        String low_level = String.valueOf(StringUtils.isEmpty(lowLevel) ? (level + 1) : lowLevel);
        List<Map<String, Object>> resultList = new ArrayList<>();
        Map<String, Integer> onlineMap = new HashMap<>();
        List<SaveModel> signList = new ArrayList<SaveModel>();
        List<SaveModel> signPayOnlineList = new ArrayList<SaveModel>();
        //总缴费人数
        signList = elasticsearchUtil.findDateQuotaLevel0(timeKey, timeKey, area, level, "1", SaveModel.timeLevel_DDL, "", low_level);
        //线上缴费人数
        signPayOnlineList = elasticsearchUtil.findDateQuotaLevel0(timeKey, timeKey, area, level, index, SaveModel.timeLevel_DDL, "", low_level);
        if (signPayOnlineList != null && signPayOnlineList.size() > 0) {
            for (SaveModel saveModel : signPayOnlineList) {
                if ("3".equals(low_level) && saveModel.getTown() != null) {
                    onlineMap.put(saveModel.getTown(), saveModel.getResult2().intValue());
                } else if ("4".equals(low_level) && saveModel.getHospital() != null) {
                    onlineMap.put(saveModel.getHospital(), saveModel.getResult2().intValue());
                } else if ("5".equals(low_level) && saveModel.getTeam() != null) {
                    onlineMap.put(saveModel.getTeam(), saveModel.getResult2().intValue());
                } else {
                    continue;
                }
            }
        }
        //自建结果集
        resultList = getLowLevelMapKey(level, low_level, area);
        if (resultList != null && resultList.size() > 0) {
            //查询今年的线上续签转map
            Map<String, SaveModel> resultMap = new HashMap<>();
            signList.stream().forEach(one -> {
                if ("5".equals(low_level)) {
                    resultMap.put(one.getTeam(), one);
                } else if ("4".equals(low_level)) {
                    resultMap.put(one.getHospital(), one);
                } else if ("3".equals(low_level)) {
                    resultMap.put(one.getTown(), one);
                }
            });
            for (Map<String, Object> reMap : resultList) {
                //reMap.put("amount", reMap.get("amount") != null ? Long.valueOf(reMap.get("amount").toString()) : 0L);
                int signNum = 0;
                Integer signPayOnlineNum = 0;
                //获取总缴费人数
                if (resultMap != null && resultMap.size() > 0) {
                    SaveModel one = resultMap.get(String.valueOf(reMap.get("code")));
                    if (one != null) {
                        signNum = one.getResult2().intValue();
                    }
                }
                //获取线上缴费人数
                if (onlineMap != null && onlineMap.size() > 0) {
                    signPayOnlineNum = onlineMap.get(String.valueOf(reMap.get("code")));
                    if (signPayOnlineNum == null) {
                        signPayOnlineNum = 0;
                    }
                }
                reMap.put("signNum", signNum);
                reMap.put("signPayOnlineNum", signPayOnlineNum);
            }
            if ((level == 2 && "5".equals(lowLevel)) || (level == 4) || (level == 3 && "5".equals(lowLevel))) {
                translateTeamLeaderName(resultList);
            }
            //对结果进行排序
            Collections.sort(resultList, new Comparator<Map<String, Object>>() {
                public int compare(Map<String, Object> o1, Map<String, Object> o2) {
                    int map1value = (int) o1.get("signPayOnlineNum");
                    int map2value = (int) o2.get("signPayOnlineNum");
                    if (map1value - map2value > 0) {
                        return sort == 1 ? -1 : 1;
                    } else if (map1value - map2value < 0) {
                        return sort == 1 ? 1 : -1;
                    } else {
                        return 0;
                    }
                }
            });
            return new JSONArray(resultList);
        } else {
            return new JSONArray();
        }
    }
}

+ 4 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/call/CustomerService.java

@ -37,7 +37,7 @@ public class CustomerService extends BaseService{
	@Autowired
	private MessageDao messageDao;
	public List<Map<String,Object>> getCallServices(String keyword, Integer serverType,Integer state,String patientName,String ssc,String idCard,String doctorName,String code,Integer adminTeamCode ,String startDate,String endDate,Integer page,Integer size){
	public List<Map<String,Object>> getCallServices(String keyword, Integer serverType,Integer state,String patientName,String ssc,String idCard,String doctor,String doctorName,String code,Integer adminTeamCode ,String startDate,String endDate,Integer page,Integer size){
		String sql = "SELECT " +
				" s.`code`, " +
				" s.patient, " +
@ -76,6 +76,9 @@ public class CustomerService extends BaseService{
		if(StringUtils.isNotBlank(idCard)){
			sql +=" AND s.IdCard ='"+idCard+"'" ;
		}
		if(StringUtils.isNotBlank(doctor)){
			sql +=" AND s.doctor ='"+doctor+"'" ;
		}
		if(StringUtils.isNotBlank(doctorName)){
			sql +=" AND s.doctor_name ='"+doctorName+"'" ;
		}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/service/OnePayService.java

@ -335,7 +335,7 @@ public class OnePayService {
                familyContent.put("moRegNo", moregNo);//医院签约号限长20  signFamily code
                familyContent.put("moRegName", signFamily.getName()); //签约人姓名
                familyContent.put("moRegAddr", user.getAddress()); //签约人地址
                familyContent.put("moRegTelephone", signFamily.getMobile());//签约人联系电话
                familyContent.put("moRegTelephone", user.getMobile());//签约人联系电话
                familyContent.put("moRegOrgNo", sbCode); //签约机构 限长4
                familyContent.put("moRegDocNo", doctor.getIdcard());//签约医生编号 限长18 身份证号
                familyContent.put("moRegDocName", signFamily.getSignDoctorName()); //签约医生姓名

+ 2 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/call/CallRecordController.java

@ -33,6 +33,7 @@ public class CallRecordController extends BaseController {
                                  @ApiParam(name="patientName",value="患者姓名")@RequestParam(required = false)String patientName,
                                  @ApiParam(name="ssc",value="医保卡号")@RequestParam(required = false)String ssc,
                                  @ApiParam(name="idCard",value="身份证号")@RequestParam(required = false)String idCard,
                                  @ApiParam(name="doctor",value="医生code")@RequestParam(required = false)String doctor,
                                  @ApiParam(name="doctorName",value="医生姓名")@RequestParam(required = false)String doctorName,
                                  @ApiParam(name="code",value="服务编号")@RequestParam(required = false)String code,
                                  @ApiParam(name="adminTeamCode",value="签约医生团队团队")@RequestParam(required = false)Integer adminTeamCode,
@ -42,7 +43,7 @@ public class CallRecordController extends BaseController {
                                  @ApiParam(name="size",value="每页大小")@RequestParam(required = true)Integer size){
        try {
            return write(200,"保存成功","data",customerService.getCallServices(keyword, serverType,state,patientName,ssc,idCard,doctorName, code,adminTeamCode,startDate, endDate, page, size));
            return write(200,"保存成功","data",customerService.getCallServices(keyword, serverType,state,patientName,ssc,idCard,doctor,doctorName, code,adminTeamCode,startDate, endDate, page, size));
        }catch (Exception e){
            error(e);
            return error(-1,"保存失败");

+ 74 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/PatientInfoController.java

@ -8,7 +8,6 @@ import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.SocialSecurityInfoDao;
import com.yihu.wlyy.service.app.account.PatientInfoService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.service.message.SendMessageService;
import com.yihu.wlyy.util.IdcardValidator;
import com.yihu.wlyy.util.MD5;
import com.yihu.wlyy.util.RSAUtils;
@ -18,6 +17,8 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
@ -56,6 +57,8 @@ public class PatientInfoController extends BaseController {
    @Autowired
    private SendMessageService sendMessageService;
    private static Logger logger = LoggerFactory.getLogger(PatientInfoController.class);
    /**
     * 获取患者基本信息
     *
@ -110,6 +113,20 @@ public class PatientInfoController extends BaseController {
        }
    }
    @RequestMapping(value = "createProfileDetail",method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("档案详情建立")
    @ObserverRequired
    public String createProfile(@ApiParam(value = "建档实体", name = "archiveJson") @RequestParam(required = true)String archiveJson ){
        try {
            // 获取医生下的患者
            return write(200, "档案建立成功!", "data", patientInfoService.createProfile(archiveJson));
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "档案建立失败!");
        }
    }
    @RequestMapping(value = "getNationDict",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取民族信息列表")
@ -264,6 +281,19 @@ public class PatientInfoController extends BaseController {
        }
    }
    @RequestMapping(value = "createProfileAndSignDeail",method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("居民注册与建档详情")
    public String createProfileAndSign(@ApiParam(value = "建档实体", name = "archiveJson") @RequestParam(required = true)String archiveJson){
        try {
            // 获取医生下的患者
            return write(200, "请求成功", "data",patientInfoService.createProfileAndSign(archiveJson));
        } catch (Exception e) {
            error(e);
            return error( -1, "建档失败!");
        }
    }
    /**
     * 患者注册
     *
@ -416,7 +446,8 @@ public class PatientInfoController extends BaseController {
                Boolean mark = sendMessageService.sendTemplate(10,patient,url,first,remark,patientName,format.format(new Date()),keyword);
                if (!mark){
                    String msg = patientName+",您好!您的家庭医生已将您账号关联的手机号码变更:"+keyword+".您可以使用新手机号码登录i健康平台.";
                    sendMessageService.sendMessage(newMobile,msg);
                    String response = sendMessageService.sendMessage(newMobile,msg);
                    logger.info("message response : "+response);
                }
                return write(200, "手机号更新成功");
            } else {
@ -427,4 +458,45 @@ public class PatientInfoController extends BaseController {
            return error(-1, "注册失败!");
        }
    }
    @RequestMapping(value = "getArchiveComboList", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("获取居民建档详细信息下拉列表集合")
    public String getArchiveComboList(){
        try {
            // 获取医生下的患者
            return write(200, "请求成功", "data",patientInfoService.getArchiveComboList());
        } catch (Exception e) {
            error(e);
            return error( -1, "查询失败!");
        }
    }
    @RequestMapping(value = "getPatientJWInfo", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取居民建档信息")
    public String getPatientJWInfo(@ApiParam(value = "身份证号", name = "idcard") @RequestParam(required = true)String idcard){
        try {
            // 获取医生下的患者
            return write(200, "请求成功", "data",patientInfoService.getPatientJWInfo(idcard));
        } catch (Exception e) {
            error(e);
            return error( -1, "查询失败!");
        }
    }
    @RequestMapping(value = "getPatientSignFamily", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取居民签约信息")
    public String getPatientSignFamily(@ApiParam(value = "身份证号", name = "idcard") @RequestParam(required = true)String idcard){
        try {
            // 获取医生下的患者
            return write(200, "请求成功", "data",patientInfoService.getPatientSignFamily(idcard));
        } catch (Exception e) {
            error(e);
            return error( -1, "查询失败!");
        }
    }
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionExpressageController.java

@ -132,7 +132,7 @@ public class PrescriptionExpressageController extends WeixinBaseController {
                                   @ApiParam(name = "startDate", value = "开始时间yyyy-MM--dd") @RequestParam(required = false)String startDate,
                                   @ApiParam(name = "endDate", value = "结束时间yyyy-MM-dd") @RequestParam(required = false)String endDate,
                                   @ApiParam(name = "operator", value = "操作人") @RequestParam(required = false)String operator,
                                   @ApiParam(name = "flag", value = "1.扫描2.异常出药") @RequestParam(required = false)String flag,
                                   @ApiParam(name = "flag", value = "1为异常出药,0为正常") @RequestParam(required = false)String flag,
                                   @ApiParam(name = "page", value = "页面") @RequestParam(required = true)Integer page,
                                   @ApiParam(name = "pageSize", value = "页面大小") @RequestParam(required = true)Integer pageSize){
        try {

+ 16 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/account/PatientController.java

@ -945,6 +945,22 @@ public class PatientController extends WeixinBaseController {
        }
    }
    @RequestMapping(value = "createProfileDetail",method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("档案详情建立")
    @ObserverRequired
    public String createProfile(@ApiParam(value = "建档实体", name = "archiveJson") @RequestParam(required = true)String archiveJson ){
        try {
            // 获取医生下的患者
            return write(200, "档案建立成功!", "data", patientInfoService.createProfile(archiveJson));
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "档案建立失败!");
        }
    }
    @RequestMapping(value = "getNationDict",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取民族信息列表")

+ 1 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionController.java

@ -246,6 +246,7 @@ public class PatientPrescriptionController extends WeixinBaseController {
                jo.put("dispensaryDispensaryTypeName", prescription.getDispensaryTypeName());//处方配送方式
                jo.put("prescriptionStatus", prescription.getStatus());//处方状态
                jo.put("prescriptionStatusName", prescription.getStatusName(prescription.getStatus(), "",""));//处方状态名称
                jo.put("ssc",prescription.getSsc());//医保卡号
            }
            return write(200, "查询成功", "data", jo);
        } catch (Exception e) {

+ 88 - 11
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionPayController.java

@ -1,5 +1,7 @@
package com.yihu.wlyy.web.patient.prescription;
import com.yihu.wlyy.entity.charge.PatientPopups;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.service.app.prescription.PatientPrescriptionPayService;
import com.yihu.wlyy.service.app.prescription.PrescriptionAdressService;
import com.yihu.wlyy.service.app.prescription.PrescriptionNoticesService;
@ -9,6 +11,7 @@ import com.yihu.wlyy.web.WeixinBaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
@ -19,6 +22,8 @@ import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
import static com.yihu.wlyy.interceptors.GateWayInterceptor.status;
/**
 * Created by Reece on 2017/7/28.
 */
@ -215,24 +220,26 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
            return error(-1, "发送失败!");
        }
    }
//===========================v1.3.9======================================================================
    //===========================v1.3.9======================================================================
    @RequestMapping(value = "/getAddressList", method = RequestMethod.POST)
    @ApiOperation(value = "获取患者所有地址")
    public String getAdressList( @ApiParam(name = "patient", value = "居民code")
                                     @RequestParam(value = "patient", required = true)String patient){
    public String getAdressList(@ApiParam(name = "patient", value = "居民code")
                                @RequestParam(value = "patient", required = true) String patient) {
        try {
            return write(200, "获取成功!","data",prescriptionAdressService.getAdressList(patient));
            return write(200, "获取成功!", "data", prescriptionAdressService.getAdressList(patient));
        } catch (Exception e) {
            return error(-1, "获取失败!");
        }
    }
    @RequestMapping(value = "/getDefAddress", method = RequestMethod.POST)
    @ApiOperation(value = "获取患者默认地址")
    public String getDefAdress(String patient){
    public String getDefAdress(String patient) {
        try {
            return write(200, "获取成功!","data",prescriptionAdressService.getDefAdress(patient));
            return write(200, "获取成功!", "data", prescriptionAdressService.getDefAdress(patient));
        } catch (Exception e) {
            error(e);
            return error(-1, "发送失败!");
@ -242,7 +249,7 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
    @RequestMapping(value = "/saveAddress", method = RequestMethod.POST)
    @ApiOperation(value = "保存地址")
    public String saveAdress(@ApiParam(name = "addressJson", value = "实体json串")
                             @RequestParam(value = "addressJson", required = true)String addressJson){
                             @RequestParam(value = "addressJson", required = true) String addressJson) {
        try {
            return write(200, "获取成功!", "data", prescriptionAdressService.saveAdress(addressJson));
@ -251,10 +258,11 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
            return error(-1, "获取失败!");
        }
    }
    @RequestMapping(value = "/delAddress", method = RequestMethod.POST)
    @ApiOperation(value = "删除地址")
    public String delAdress(@ApiParam(name = "id", value = "主键")
                                @RequestParam(value = "id", required = true)Long id){
                            @RequestParam(value = "id", required = true) Long id) {
        try {
            return write(200, "获取成功!", "data", prescriptionAdressService.delAdress(id));
@ -266,7 +274,7 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
    @RequestMapping(value = "/getProvince", method = RequestMethod.POST)
    @ApiOperation(value = "获取省会")
    public String getProvince(){
    public String getProvince() {
        try {
            return write(200, "获取成功!", "data", prescriptionAdressService.getProvince());
@ -279,7 +287,7 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
    @RequestMapping(value = "/getCityByProvince", method = RequestMethod.POST)
    @ApiOperation(value = "根据省会获取城市")
    public String getCityByProvince(@ApiParam(name = "province", value = "省会code")
                                        @RequestParam(value = "province", required = true)String province){
                                    @RequestParam(value = "province", required = true) String province) {
        try {
            return write(200, "获取成功!", "data", prescriptionAdressService.getCityByProvince(province));
@ -292,7 +300,7 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
    @RequestMapping(value = "/getTowmByCity", method = RequestMethod.POST)
    @ApiOperation(value = "根据城市获取区")
    public String getTowmByCity(@ApiParam(name = "city", value = "城市code")
                                    @RequestParam(value = "city", required = true)String city){
                                @RequestParam(value = "city", required = true) String city) {
        try {
            return write(200, "获取成功!", "data", prescriptionAdressService.getTowmByCity(city));
@ -301,4 +309,73 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
            return error(-1, "获取失败!");
        }
    }
    /**
     * 保存居民支付弹窗设置
     *
     * @param type   弹窗类型(0:签约支付 1续方支付)
     * @param status 弹出状态(0不弹出 1弹出)
     * @return
     */
    @RequestMapping(value = "/savePopups", method = RequestMethod.POST)
    @ApiOperation(value = "保存居民支付弹窗设置")
    public String savePopups(@ApiParam(name = "type", value = "弹窗类型")
                             @RequestParam(value = "type", required = true) int type,
                             @ApiParam(name = "status", value = "弹窗状态")
                             @RequestParam(value = "status", required = true) String status) {
        try {
            payService.savePopups(type, getUID(), status);
            return write(200, "保存成功!");
        } catch (Exception e) {
            error(e);
            return error(-1, "保存失败!");
        }
    }
    /**
     * 查询居民支付弹窗设置
     *
     * @param type 弹窗类型(0:签约支付 1续方支付)
     * @return
     */
    @RequestMapping(value = "/getPopups", method = RequestMethod.GET)
    @ApiOperation(value = "查询居民支付弹窗设置")
    public String getPopups(@ApiParam(name = "type", value = "弹窗类型")
                            @RequestParam(value = "type", required = true) int type) {
        try {
            String status = "1";
            PatientPopups popups = payService.getPopups(type, getUID());
            if (popups != null) {
                status = popups.getStatus();
                return write(200, "查询成功!", "data", status);
            } else {
                return write(200, "该居民未设置弹窗!", "data", status);
            }
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
    /**
     * 查询缴费居民手机绑定情况
     *
     * @return
     */
    @RequestMapping(value = "/getPatientMobile", method = RequestMethod.GET)
    @ApiOperation(value = "查询缴费居民手机绑定情况")
    public String getPatientMobile() {
        try {
            String status = "1";
            String mobile = payService.getPatientMobile(getRepUID());
            if (StringUtils.isEmpty(mobile)){
                status = "0";
            }
            return write(200, "查询成功!", "data", status);
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
}

+ 112 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java

@ -1925,7 +1925,7 @@ public class EsStatisticsController extends BaseController {
    /**
     * 获取 线上续签率和续签率
     * 前端:线上续签
     * 前端:线上续签.
     *
     * @param index 29,43,44 (51,53,54 服务类型维度)
     * @param level 等级  4 市  3区  2社区 1团队
@ -1953,5 +1953,116 @@ public class EsStatisticsController extends BaseController {
            return error(-1, "查询失败");
        }
    }
    /**
     * 今年的线上续签量,续签量和线上续签率 列表
     *
     * @param index    75,76,77 (79,80,81 服务类型维度)
     * @param area     每个层级大的code  例如湖里区 350206  xx社区 3502060100
     * @param level    level1_type等级 1:团队 2社区机构 3区级 4市级
     * @param sort     0:升序 1:降序
     * @param lowLevel 只有可能是 1,2,3,不传默认是level-1;
     * @param year     不管根据当前时间找年度
     * @param lowCode  如果是服务类型维度code(老年人3,高血压1,糖尿病2)
     * @return
     */
    @RequestMapping("/lowlevel_all_sign_renew_online")
    @ResponseBody
    public String lowlevel_all_sign_renew_online(
            @RequestParam(required = true) String index,
            @RequestParam(required = true) String area,
            @RequestParam(required = true) int level,
            @RequestParam(required = true) int sort,
            @RequestParam(required = false) String lowLevel,
            @RequestParam(required = false) String year,
            @RequestParam(required = false) String lowCode) {
        try {
            JSONObject result = new JSONObject();
            //如果年度是空,按当前时间计算是年度是属于那个年度
            if (org.springframework.util.StringUtils.isEmpty(year)) {
                year = Constant.getNowYear();
            }
            //lowLevel不传默认是 level-1
            if (org.springframework.util.StringUtils.isEmpty(lowLevel)) {
                lowLevel = level - 1 + "";
            }
            result.put("index_" + index, statisticsESService.getLevelTwoLowLevelTotalRenewOnline(area,elasticsearchUtil.changeLevel(level), index, sort, String.valueOf(elasticsearchUtil.changeLevel(Integer.valueOf(lowLevel))), year, lowCode));
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "查询失败");
        }
    }
    /**
     *获取线上和线下缴费的比例
     * @author zhangdan 2017-11-29
     * @param area
     * @param level
     * @param year
     * @return
     */
    @ApiOperation("获取线上缴费和线下缴费的比例")
    @RequestMapping("/signPayOnline")
    @ResponseBody
    public String signPayOnline(
            @RequestParam(required = true)String area,
            @RequestParam(required = true)int level,
            @RequestParam(required = true)String year){
        try{
            JSONObject result = new JSONObject();
            //如果年度是空,按当前时间计算是年度是属于那个年度
            if (org.springframework.util.StringUtils.isEmpty(year)) {
                year = Constant.getNowYear();
            }
            result.put("data" , statisticsESService.getSignPayOnline(elasticsearchUtil.changeLevel(level),area,year));
            return write(200, "查询成功", "data", result);
        }catch (Exception e) {
            e.printStackTrace();
            return error(-1, "查询失败");
        }
    }
    /**
     * 获取线上缴费的各个读取的列表
     * @author zhangdan 2017-11-29
     * @param index
     * @param area
     * @param level
     * @param sort
     * @param lowLevel
     * @param year
     * @return
     */
    @ApiOperation("获取线上缴费的各个地区的列表")
    @RequestMapping("/lowlevel_all_sign_pay_online")
    @ResponseBody
    public String lowlevel_all_sign_pay_online(
            @RequestParam(required = true) String index,
            @RequestParam(required = true) String area,
            @RequestParam(required = true) int level,
            @RequestParam(required = true) int sort,
            @RequestParam(required = false) String lowLevel,
            @RequestParam(required = false) String year){
        try {
            JSONObject result = new JSONObject();
            //如果年度是空,按当前时间计算是年度是属于那个年度
            if (org.springframework.util.StringUtils.isEmpty(year)) {
                year = Constant.getNowYear();
            }
            //lowLevel不传默认是 level-1
            if (StringUtils.isEmpty(lowLevel)) {
                lowLevel = level - 1 + "";
            }
            result.put("index_" + index, statisticsESService.getLowLevelSignPayOnline(area,elasticsearchUtil.changeLevel(level), index, sort, String.valueOf(elasticsearchUtil.changeLevel(Integer.valueOf(lowLevel))), year));
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "查询失败");
        }
    }
    /*==================================版本1.4.1统计优化结束 end=====================================*/
}