Browse Source

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

zd_123 7 years ago
parent
commit
10b872f598
24 changed files with 1355 additions and 73 deletions
  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. 5 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyDao.java
  6. 432 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/PatientInfoService.java
  7. 37 10
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelInfoService.java
  8. 37 19
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/message/MessageService.java
  9. 6 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/physicalExamination/PhysicalExaminationRemindService.java
  10. 87 17
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PatientPrescriptionPayService.java
  11. 2 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionExpressageService.java
  12. 1 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java
  13. 4 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/call/CustomerService.java
  14. 117 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/message/SendMessageService.java
  15. 1 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/template/DoctorFeldsherTemplateService.java
  16. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/service/OnePayService.java
  17. 2 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/call/CallRecordController.java
  18. 3 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/message/DoctorMessageController.java
  19. 139 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/PatientInfoController.java
  20. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionExpressageController.java
  21. 16 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/account/PatientController.java
  22. 1 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionController.java
  23. 88 11
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionPayController.java
  24. 17 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/util/WeiXinTempMsgSendUtils.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);
}

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

@ -29,6 +29,11 @@ public interface SignFamilyDao extends PagingAndSortingRepository<SignFamily, Lo
    @Query("update SignFamily a set a.mobile = ?2 where a.patient = ?1")
    int updatePatientMobile(String patient, String mobile);
    //更新有效签约患者手机号
    @Modifying
    @Query("update SignFamily a set a.mobile = ?2 where a.patient = ?1 and a.status > 0 ")
    int updateSignMobile(String patient, String mobile);
    @Query("select a from SignFamily a where a.idcard = ?1 and status = ?2 and a.type = 2")
    SignFamily findByPatientStatus(String idcard, int status);

+ 432 - 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;
@ -128,6 +131,25 @@ public class PatientInfoService extends BaseService {
        return 1;
    }
    /**
     * 患者更换手机号
     *
     * @param patient 患者code
     * @param mobile  新手机号
     * @return
     */
    public int updateMobile(String patient, String mobile) throws Exception {
        Patient p = patientDao.findByCode(patient);
        if (p == null) {
            return -1;
        }
        p.setMobile(mobile);
        patientDao.save(p);
        signFamilyDao.updateSignMobile(patient, mobile);
        return 1;
    }
    /**
     * 手机号是否注册
     *
@ -373,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)){
@ -393,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 ";
@ -502,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;
    }
}

+ 37 - 10
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelInfoService.java

@ -392,16 +392,22 @@ public class SignPatientLabelInfoService extends BaseService {
//                if (p == null) {
//                    continue;
//                }
                PatientVO p = new PatientVO();
                List<PatientVO> plist = new ArrayList<>();
                if(sign.get("patient") != null){
                    String patientsql = "select a.*,b.deviceType as deviceType,c.disease as disease from wlyy_patient a" +
                            "  left join (select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on a.code = b.user" +
                            "  left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3 and status=1 " +
                            " and (label = 1 or label = 2) and patient = '"+sign.get("patient").toString()+"' GROUP BY patient) c on a.code = c.patient" +
                            " where a.status =1 and a.code = '"+sign.get("patient").toString()+"'";
                    p = (PatientVO)jdbcTemplate.queryForObject(patientsql,new BeanPropertyRowMapper(PatientVO.class));
    
                    plist = jdbcTemplate.query(patientsql,new BeanPropertyRowMapper(PatientVO.class));
                    
                    if(plist.isEmpty()){
                        continue;
                    }else{
                        p = plist.get(0);
                    }
                }else{
                    continue;
                }
@ -3821,14 +3827,21 @@ public class SignPatientLabelInfoService extends BaseService {
//                }
                //查找居民 改造成获取绑定的设备和疾病类型--huangwenjie-2017.11.21
                PatientVO p = new PatientVO();
                List<PatientVO> plist = new ArrayList<>();
                if(sign.get("patient") != null){
                    String patientsql = "select a.*,b.deviceType as deviceType,c.disease as disease from wlyy_patient a" +
                            "  left join (select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on a.code = b.user" +
                            "  left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3 AND status =1 " +
                            "  left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3 and status=1 " +
                            " and (label = 1 or label = 2) and patient = '"+sign.get("patient").toString()+"' GROUP BY patient) c on a.code = c.patient" +
                            " where a.status =1 and a.code = '"+sign.get("patient").toString()+"'";
                    p = (PatientVO)jdbcTemplate.queryForObject(patientsql,new BeanPropertyRowMapper(PatientVO.class));
        
                    plist = jdbcTemplate.query(patientsql,new BeanPropertyRowMapper(PatientVO.class));
        
                    if(plist.isEmpty()){
                        continue;
                    }else{
                        p = plist.get(0);
                    }
                }else{
                    continue;
                }
@ -4259,14 +4272,21 @@ public class SignPatientLabelInfoService extends BaseService {
        if (signList != null && signList.size() > 0) {
            for (Map<String, Object> sign : signList) {
                PatientVO p = new PatientVO();
                List<PatientVO> plist = new ArrayList<>();
                if(sign.get("patient") != null){
                    String patientsql = "select a.*,b.deviceType as deviceType,c.disease as disease from wlyy_patient a" +
                            "  left join (select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on a.code = b.user" +
                            "  left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3 and status=1 " +
                            " and (label = 1 or label = 2) and patient = '"+sign.get("patient").toString()+"' GROUP BY patient) c on a.code = c.patient" +
                            " where a.status =1 and a.code = '"+sign.get("patient").toString()+"'";
                    p = (PatientVO)jdbcTemplate.queryForObject(patientsql,new BeanPropertyRowMapper(PatientVO.class));
        
                    plist = jdbcTemplate.query(patientsql,new BeanPropertyRowMapper(PatientVO.class));
        
                    if(plist.isEmpty()){
                        continue;
                    }else{
                        p = plist.get(0);
                    }
                }else{
                    continue;
                }
@ -4463,14 +4483,21 @@ public class SignPatientLabelInfoService extends BaseService {
        if (signList != null && signList.size() > 0) {
            for (Map<String, Object> sign : signList) {
                PatientVO p = new PatientVO();
                List<PatientVO> plist = new ArrayList<>();
                if(sign.get("patient") != null){
                    String patientsql = "select a.*,b.deviceType as deviceType,c.disease as disease from wlyy_patient a" +
                            "  left join (select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on a.code = b.user" +
                            "  left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3 and status=1 " +
                            " and (label = 1 or label = 2) and patient = '"+sign.get("patient").toString()+"' GROUP BY patient) c on a.code = c.patient" +
                            " where a.status =1 and a.code = '"+sign.get("patient").toString()+"'";
                    p = (PatientVO)jdbcTemplate.queryForObject(patientsql,new BeanPropertyRowMapper(PatientVO.class));
        
                    plist = jdbcTemplate.query(patientsql,new BeanPropertyRowMapper(PatientVO.class));
        
                    if(plist.isEmpty()){
                        continue;
                    }else{
                        p = plist.get(0);
                    }
                }else{
                    continue;
                }

+ 37 - 19
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/message/MessageService.java

@ -23,6 +23,7 @@ import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
@ -56,6 +57,10 @@ public class MessageService extends BaseService {
    private HttpClientUtil HttpClientUtil;
    @Autowired
    private MessageNoticeSettingDao messageNoticeSettingDao;
    @Autowired
    private StringRedisTemplate redisTemplate;
    private final String MESSAGE_NOTICESETTING = "wlyy:message:setting:";
    @Value("${im.im_list_get}")
    private String im_list_get;
@ -496,26 +501,34 @@ public class MessageService extends BaseService {
     * @param type
     * @return
     */
    public MessageNoticeSetting getMessageNoticSetting(String user,String type){
        MessageNoticeSetting messageNoticeSetting = messageNoticeSettingDao.findByUserAndType(user,type);
        if(messageNoticeSetting == null){
            messageNoticeSetting = new MessageNoticeSetting();
            messageNoticeSetting.setCreateTime(new Date());
            messageNoticeSetting.setFamilyTopicSwitch(1);
            messageNoticeSetting.setCoordinationSwitch(1);
            messageNoticeSetting.setHealthSignSwitch(1);
            messageNoticeSetting.setImSwitch(1);
            messageNoticeSetting.setMasterSwitch(1);
            messageNoticeSetting.setPrescriptionSwitch(1);
            messageNoticeSetting.setSignSwitch(1);
            messageNoticeSetting.setSoundSwitch(1);
            messageNoticeSetting.setSystemSwitch(1);
            messageNoticeSetting.setType(type);
            messageNoticeSetting.setUser(user);
            messageNoticeSetting.setVibrationSwitch(1);
            messageNoticeSettingDao.save(messageNoticeSetting);
    public com.alibaba.fastjson.JSONObject getMessageNoticSetting(String user, String type){
        com.alibaba.fastjson.JSONObject re = null;
        String key = MESSAGE_NOTICESETTING+user+":"+type;
        String response = redisTemplate.opsForValue().get(key);
        if(StringUtils.isBlank(response)){
            MessageNoticeSetting messageNoticeSetting = messageNoticeSettingDao.findByUserAndType(user,type);
            if(messageNoticeSetting == null){
                messageNoticeSetting = new MessageNoticeSetting();
                messageNoticeSetting.setCreateTime(new Date());
                messageNoticeSetting.setFamilyTopicSwitch(1);
                messageNoticeSetting.setCoordinationSwitch(1);
                messageNoticeSetting.setHealthSignSwitch(1);
                messageNoticeSetting.setImSwitch(1);
                messageNoticeSetting.setMasterSwitch(1);
                messageNoticeSetting.setPrescriptionSwitch(1);
                messageNoticeSetting.setSignSwitch(1);
                messageNoticeSetting.setSoundSwitch(1);
                messageNoticeSetting.setSystemSwitch(1);
                messageNoticeSetting.setType(type);
                messageNoticeSetting.setUser(user);
                messageNoticeSetting.setVibrationSwitch(1);
                messageNoticeSettingDao.save(messageNoticeSetting);
            }
            response = com.alibaba.fastjson.JSONObject.toJSONString(messageNoticeSetting);
            redisTemplate.opsForValue().set(key,response);
        }
        return messageNoticeSetting;
        re = com.alibaba.fastjson.JSONObject.parseObject(response);
        return re;
    }
    /**
@ -528,5 +541,10 @@ public class MessageService extends BaseService {
        messageNoticeSetting.setCreateTime(oldSetting.getCreateTime());
        messageNoticeSetting.setType(oldSetting.getType());
        messageNoticeSettingDao.save(messageNoticeSetting);
        //更新缓存
        String key = MESSAGE_NOTICESETTING+oldSetting.getUser()+":"+oldSetting.getType();
        String response = com.alibaba.fastjson.JSONObject.toJSONString(messageNoticeSetting);
        redisTemplate.opsForValue().set(key,response);
    }
}

+ 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 - 17
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PatientPrescriptionPayService.java

@ -5,6 +5,7 @@ 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;
@ -16,6 +17,7 @@ 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;
@ -130,6 +132,8 @@ public class PatientPrescriptionPayService extends BaseService {
    private PushMsgTask pushMsgTask;
    @Autowired
    private PrescriptionDispensaryCodeService codeService;
    @Autowired
    private PopupsDao popupsDao;
    /**
     * 长处方配送信息查询接口
@ -759,17 +763,17 @@ public class PatientPrescriptionPayService extends BaseService {
                                Doctor doctor = doctorDao.findByCode(receiver);
                                String doctorOpenID = doctor.getOpenid();
                                if (StringUtils.isNotEmpty(doctorOpenID)) {
                                        String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
                                        List<NameValuePair> sendParams = new ArrayList<>();
                                        sendParams.add(new BasicNameValuePair("type", "9"));
                                        sendParams.add(new BasicNameValuePair("openId", doctorOpenID));
                                        sendParams.add(new BasicNameValuePair("url", targetUrl));
                                        sendParams.add(new BasicNameValuePair("first", doctor.getName()+"医生您好。" + content + ",一个尽快分配。"));
                                        sendParams.add(new BasicNameValuePair("remark", "请进入手机APP查看"));
                                        String keywords = "分配配送员" + "," + doctor.getHospitalName() + "," +doctor.getName();
                                        sendParams.add(new BasicNameValuePair("keywords", keywords));
                                        httpClientUtil.post(url, sendParams, "UTF-8");
                                    String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
                                    List<NameValuePair> sendParams = new ArrayList<>();
                                    sendParams.add(new BasicNameValuePair("type", "9"));
                                    sendParams.add(new BasicNameValuePair("openId", doctorOpenID));
                                    sendParams.add(new BasicNameValuePair("url", targetUrl));
                                    sendParams.add(new BasicNameValuePair("first", doctor.getName() + "医生您好。" + content + ",一个尽快分配。"));
                                    sendParams.add(new BasicNameValuePair("remark", "请进入手机APP查看"));
                                    String keywords = "分配配送员" + "," + doctor.getHospitalName() + "," + doctor.getName();
                                    sendParams.add(new BasicNameValuePair("keywords", keywords));
                                    httpClientUtil.post(url, sendParams, "UTF-8");
                                }
                            } catch (Exception e) {
                                e.printStackTrace();
@ -1052,7 +1056,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();
@ -1067,7 +1071,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))) {
@ -1121,14 +1125,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");
@ -1175,10 +1179,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;
                }
@ -1553,5 +1557,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);

+ 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());

+ 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+"'" ;
		}

+ 117 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/message/SendMessageService.java

@ -0,0 +1,117 @@
package com.yihu.wlyy.service.message;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.common.SMSService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
import com.yihu.wlyy.wechat.util.WeiXinTempMsgSendUtils;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
 * 消息类发送(系统消息、模板消息、短信消息)
 * <p>
 * Created by Reece on 2017/11/27/007.
 */
@Service
@Transactional
public class SendMessageService extends BaseService {
    @Autowired
    private WeiXinTempMsgSendUtils tempMsgSendUtils;
    @Autowired
    private PushMsgTask pushMsgTask;
    @Autowired
    private SMSService smsService;
    @Autowired
    WeiXinOpenIdUtils weiXinOpenIdUtils;
    @Autowired
    WeiXinAccessTokenUtils weiXinAccessTokenUtils;
    @Autowired
    private PatientDao patientDao;
    private static final Logger logger = LoggerFactory.getLogger(SendMessageService.class);
    /**
     * 拼装参数并发送模板消息
     *
     * @param type     typeMsg对应参数
     * @param patient  居民code
     * @param url      带参数跳转链接
     * @param first
     * @param remark
     * @param keywords
     * @return
     */
    public Boolean sendTemplate(int type, String patient, String url, String first, String remark, String... keywords) {
        Boolean flag = false;
        try {
            Patient patient1 = patientDao.findByCode(patient);
            String openid = patient1.getOpenid();
            String name = patient1.getName();
            String accessToken = weiXinAccessTokenUtils.getAccessToken();
            JSONObject data = tempMsgSendUtils.getTemplateContent(first, remark, keywords);
            data.put("url", url+"&represented="+patient);
            if (StringUtils.isNotEmpty(openid)) {
                pushMsgTask.putWxMsg(accessToken, type, openid, name, data);
                flag = true;
            }else {
                //发送代理人
                JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(patient, openid);
                if (jsonArray != null && jsonArray.length() > 0) {
                    for (int i = 0; i < jsonArray.length(); i++) {
                        JSONObject j = jsonArray.getJSONObject(i);
                        Patient member = (Patient) j.get("member");
                        JSONObject json = data;
                        data.remove("first");
                        data.remove("url");
                        data.put("url",url+"&represented="+member.getCode());
                        data.put("first", weiXinOpenIdUtils.getTitleMes(patient1, j.getInt("relation"), name) + first);
                        pushMsgTask.putWxMsg(accessToken, type, member.getOpenid(), name, data);
                        flag = true;
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
        return flag;
    }
    /**
     * 拼装参数并发送短信消息
     *
     * @param mobile 发送手机号
     * @param msg    发送短信内容
     * @return
     */
    public String sendMessage(String mobile, String msg) {
        String response = null;
        try {
            //发送短信消息,调用总部发送信息的接口
            JSONObject resultJson = smsService.sendMsg(mobile, msg);
            if (resultJson != null && resultJson.getInt("result") != 0) {
                response = "短信提醒失败!(原因:" + resultJson.getString("description") + ")";
            }
            response = "短信发送成功!";
        } catch (Exception e) {
            e.printStackTrace();
        }
        return response;
    }
}

+ 1 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/template/DoctorFeldsherTemplateService.java

@ -108,8 +108,7 @@ public class DoctorFeldsherTemplateService extends BaseService {
            Doctor doctor = doctorDao.findByCode(doctorCode);
            String doctorName = doctor.getName();
//            String doctorOpenId = doctor.getOpenid();
            String doctorOpenId = "o7NFZw1QM4YR1O19mLjwfX1Hh11A";
            String doctorOpenId = doctor.getOpenid();
            String first = businessType;
            sendJson.put("keyword1", content);

+ 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,"保存失败");

+ 3 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/message/DoctorMessageController.java

@ -374,7 +374,7 @@ public class DoctorMessageController extends BaseController {
    @ApiOperation("获取消息设置")
    public String getMessageNoticeSetting(){
        try {
            MessageNoticeSetting messageNoticeSetting = messageService.getMessageNoticSetting(getUID(),"1");
            com.alibaba.fastjson.JSONObject messageNoticeSetting = messageService.getMessageNoticSetting(getUID(),"1");
            return write(200,"查询成功","data",messageNoticeSetting);
        } catch (Exception e){
            e.printStackTrace();
@ -382,11 +382,11 @@ public class DoctorMessageController extends BaseController {
        }
    }
    @RequestMapping(value = "saveMessageNoticeSettion",method = RequestMethod.POST)
    @RequestMapping(value = "saveMessageNoticeSetting",method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("保存消息提醒设置")
    @ObserverRequired
    public String saveMessageNoticeSettion(@ApiParam(name = "json", value = "数据json")
    public String saveMessageNoticeSetting(@ApiParam(name = "json", value = "数据json")
                                           @RequestParam(value = "json", required = true) String json){
        try {
            MessageNoticeSetting messageNoticeSetting = objectMapper.readValue(json, MessageNoticeSetting.class);

+ 139 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/PatientInfoController.java

@ -17,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;
@ -26,7 +28,11 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.net.URLDecoder;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
 * 医生端:患者分组管理
@ -48,6 +54,11 @@ public class PatientInfoController extends BaseController {
    private SocialSecurityInfoDao socialSecurityInfoDao;
    @Autowired
    private PatientDao patientDao;
    @Autowired
    private SendMessageService sendMessageService;
    private static Logger logger = LoggerFactory.getLogger(PatientInfoController.class);
    /**
     * 获取患者基本信息
     *
@ -102,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("获取民族信息列表")
@ -256,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, "建档失败!");
        }
    }
    /**
     * 患者注册
     *
@ -360,4 +398,105 @@ public class PatientInfoController extends BaseController {
            return error(-1, "注册失败!");
        }
    }
    /**
     * 修改居民手机号码
     * @param patient 居民code
     * @param newMobile 新手机号
     * @param oldMobile 旧手机号
     * @return
     */
    @ObserverRequired
    @RequestMapping(value = "/updateMobile", method = RequestMethod.POST)
    @ResponseBody
    public String updatePatientMobile(@ApiParam(value = "居民code", name = "patient") @RequestParam(required = true) String patient,
                         @ApiParam(value = "新手机号", name = "newMobile") @RequestParam(required = true) String newMobile,
                         @ApiParam(value = "旧手机号", name = "oldMobile") @RequestParam(required = false) String oldMobile) {
        try {
            if (StringUtils.isEmpty(patient)) {
                return error(-1, "居民不允许为空!");
            }
            if (StringUtils.isEmpty(newMobile)) {
                return error(-1, "新手机号不允许为空!");
            }
            String keyword = "新手机号码"+newMobile;
            if (StringUtils.isNotEmpty(oldMobile)) {
                keyword = "原关联手机号码"+oldMobile+"变更为"+keyword;
            }
            String reg = "^1[34578][0-9]{9}$";
            Pattern pattern = Pattern.compile(reg);
            Matcher matcher = pattern.matcher(newMobile);
            Boolean flag = matcher.matches();
            if (!flag){
                return error(-1, "新手机号格式不正确!");
            }
            Patient patient1 = patientDao.findByCode(patient);
            String patientName = patient1.getName();
            String openid = patient1.getOpenid();
            int result = patientInfoService.updateMobile(patient, newMobile);
            if (result == -1) {
                return error(-1, "居民信息查找失败");
            } else if (result == 1) {
                String first = patientName+",您好!\n"+"您的家庭医生已将您账号关联的手机号码进行变更";
                String remark = "您可使用新手机号码登录i健康平台";
                String url = "/grzx/html/my-detail.html?openid=" + openid + "&toUser=" + patient + "&toName=" + patientName;
                SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
                Boolean mark = sendMessageService.sendTemplate(10,patient,url,first,remark,patientName,format.format(new Date()),keyword);
                if (!mark){
                    String msg = patientName+",您好!您的家庭医生已将您账号关联的手机号码变更:"+keyword+".您可以使用新手机号码登录i健康平台.";
                    String response = sendMessageService.sendMessage(newMobile,msg);
                    logger.info("message response : "+response);
                }
                return write(200, "手机号更新成功");
            } else {
                return write(-1, "手机号更新失败");
            }
        } catch (Exception e) {
            e.printStackTrace();
            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, "查询失败!");
        }
    }
}

+ 17 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/util/WeiXinTempMsgSendUtils.java

@ -97,4 +97,21 @@ public class WeiXinTempMsgSendUtils {
        return data;
    }
    /**
     * 构建微信模板内容消息体 加入队列发送无字体格式
     *
     * @param first    消息头
     * @param remark   备注
     * @param keywords 消息体
     * @return
     */
    public JSONObject getTemplateContent(String first, String remark, String... keywords) throws Exception{
        JSONObject data = new JSONObject();
        data.put("first", first);
        data.put("remark", remark);
        for (int i = 0; i < keywords.length; i++) {
            data.put("keyword" + (i + 1), keywords[i]);
        }
        return data;
    }
}