浏览代码

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

esb 9 年之前
父节点
当前提交
1e9d2fcfcf

+ 2 - 0
src/main/java/com/yihu/wlyy/entity/dict/FoundationMedicalSystemParam.java

@ -24,6 +24,8 @@ public class FoundationMedicalSystemParam implements java.io.Serializable {
	private String bmlevel;//表码级别(1国家,2省,3市,4自定义)
	private String bmlevel;//表码级别(1国家,2省,3市,4自定义)
	private String description;//描述
	private String description;//描述
    public FoundationMedicalSystemParam(){}
	public FoundationMedicalSystemParam(String paramname, String code, Integer ord,
	public FoundationMedicalSystemParam(String paramname, String code, Integer ord,
                                        String paramchina, String namespell, String iscustom,
                                        String paramchina, String namespell, String iscustom,
                                        String cancel, String paramdesc, String canceldate,
                                        String cancel, String paramdesc, String canceldate,

+ 32 - 60
src/main/java/com/yihu/wlyy/entity/doctor/profile/Doctor.java

@ -14,81 +14,53 @@ import com.fasterxml.jackson.annotation.JsonFormat;
/**
/**
 * 医生信息
 * 医生信息
 * @author George
 * @author George
 *
 */
 */
@Entity
@Entity
@Table(name = "wlyy_doctor")
@Table(name = "wlyy_doctor")
public class Doctor extends IdEntity {
public class Doctor extends IdEntity {
	/**
	 * 
	 */
	private static final long serialVersionUID = -6585552029939285364L;
	private static final long serialVersionUID = -6585552029939285364L;
	// 业务主键
	private String code;
	// 姓名
    
	private String code;        // 业务主键
	
	private String name;
	private String name;
	// 性别(1男,2女)
	private Integer sex;
	// 生日
	private Integer sex;        // 性别(1男,2女)
	private Date birthday;
	private Date birthday;
	// 头像
	private String photo;
	private String photo;
	// 手机号
	private String mobile;
	private String mobile;
	// 登录密码
	private String password;
	private String password;
	// 密码标识
	private String salt;
	// 状态(1正常,0禁用)
	private Integer status;
	// 省
	private String salt;        // 密码标识
	private Integer status;     // 状态(1正常,0禁用)
	
	private String province;
	private String province;
	// 市
	private String city;	
	// 區縣代碼
	private String city;
	private String town;
	private String town;
	// 省名
	private String provinceName;
	private String provinceName;
	// 市名
	private String cityName;
	private String cityName;
	// 區縣名
    private String townName;
    private String townName;
	// 医院标识
	private String hospital;
	// 医院名称
	
	private String hospital;        // 医院代码
	private String hosptialName;
	private String hosptialName;
	// 科室标识
	private String dept;
	// 科室名
	private String dept;            // 科室代码
	private String deptName;
	private String deptName;
	// 职称
	private String job;
	// 职称名
	private String jobName;
	// 医生专长
	private String expertise;
	// 医生介绍
	private String introduce;
	// 类型:1专科医生,2全科医生,3健康管理师
	private Integer level;
	// 资格是否认证通过,1是,0否
	private Integer iscertified;
	// 二维码
	private String qrcode;
	// 更新时间
	private Date czrq;
	// 状态(1正常,0删除)
	private Integer del;
	private String idcard;//身份证号
	private String job;             // 职称代码
	private String jobName;         // 职称名
	
	private String expertise;       // 医生专长
	private String introduce;       // 医生介绍
	
	private Integer level;          // 类型:1专科医生,2全科医生,3健康管理师
	private Integer isCertified;   // 资格是否认证通过,1是,0否
	
	private String qrcode;          // 二维码
	
	private Date czrq;              // 更新时间
	private Integer del;            // 状态(1正常,0删除)
	private Integer isFamous;//是否是名医 1是  0或者空不是
	private String idcard;          //身份证号
	private Integer isFamous;       //是否是名医 1是  0或者空不是
	public Doctor() {
	}
	public Doctor() {}
	public String getCode() {
	public String getCode() {
		return code;
		return code;
@ -290,12 +262,12 @@ public class Doctor extends IdEntity {
		this.level = level;
		this.level = level;
	}
	}
	public Integer getIscertified() {
		return iscertified;
	public Integer getIsCertified() {
		return isCertified;
	}
	}
	public void setIscertified(Integer iscertified) {
		this.iscertified = iscertified;
	public void setIsCertified(Integer isCertified) {
		this.isCertified = isCertified;
	}
	}
	public String getQrcode() {
	public String getQrcode() {

+ 1 - 1
src/main/java/com/yihu/wlyy/entity/doctor/schedule/DoctorFamousConsultTimesRemain.java

@ -1,4 +1,4 @@
package com.yihu.wlyy.entity.doctor;
package com.yihu.wlyy.entity.doctor.schedule;
import com.yihu.wlyy.entity.IdEntity;
import com.yihu.wlyy.entity.IdEntity;
import org.springframework.data.repository.cdi.Eager;
import org.springframework.data.repository.cdi.Eager;

+ 3 - 1
src/main/java/com/yihu/wlyy/repository/doctor/DoctorAdminTeamMemberDao.java

@ -27,7 +27,9 @@ public interface DoctorAdminTeamMemberDao extends
    @Query("SELECT d FROM AdminTeamMember m, AdminTeam t, Doctor d WHERE t.id = :teamId AND t.id = m" +
    @Query("SELECT d FROM AdminTeamMember m, AdminTeam t, Doctor d WHERE t.id = :teamId AND t.id = m" +
            ".teamId AND m.doctorCode = d.code")
            ".teamId AND m.doctorCode = d.code")
    List<Doctor> findTeamMembers(@Param(value = "teamId") long teamId);
    List<Doctor> findAllMembers(@Param(value = "teamId") long teamId);
    //List<Doctor> findMembersByRole(@Param(value = "teamId") long teamId, @Param(value = "role") String role);
    @Query("SELECT 1 FROM AdminTeamMember WHERE teamId = :teamId AND doctorCode = :doctorCode")
    @Query("SELECT 1 FROM AdminTeamMember WHERE teamId = :teamId AND doctorCode = :doctorCode")
    Integer isMemberExist(@Param(value = "teamId") long teamId, @Param(value = "doctorCode") String doctorCode);
    Integer isMemberExist(@Param(value = "teamId") long teamId, @Param(value = "doctorCode") String doctorCode);

+ 114 - 13
src/main/java/com/yihu/wlyy/service/app/disease/PatientDiseaseService.java

@ -197,6 +197,21 @@ public class PatientDiseaseService extends BaseService {
                    groupInfoDao.save(ncdGroup);
                    groupInfoDao.save(ncdGroup);
                }
                }
                if (groupInfoDao.countDoctorPatientGroupType(jjSign.getDoctorHealth(), patient, "2", "2") < 1) {
                    DoctorPatientGroupInfo ncdJgGroup = new DoctorPatientGroupInfo();
                    ncdJgGroup.setDoctor(jjSign.getDoctorHealth());
                    ncdJgGroup.setPatient(patient);
                    ncdJgGroup.setSignType("2");
                    ncdJgGroup.setCzrq(new Date());
                    ncdJgGroup.setStatus(1);
                    ncdJgGroup.setPname(jjSign.getName());
                    ncdJgGroup.setQyrq(jjSign.getApplyDate());
                    ncdJgGroup.setDqrq(jjSign.getEnd());
                    ncdJgGroup.setGroup("2");
                    groupInfoDao.save(ncdJgGroup);
                }
            }
            }
            if (ssSign != null) {
            if (ssSign != null) {
                if (groupInfoDao.countDoctorPatientGroupType(ssSign.getDoctor(), patient, "2", "1") < 1) {
                if (groupInfoDao.countDoctorPatientGroupType(ssSign.getDoctor(), patient, "2", "1") < 1) {
@ -214,9 +229,26 @@ public class PatientDiseaseService extends BaseService {
                    groupInfoDao.save(ncdGroup);
                    groupInfoDao.save(ncdGroup);
                }
                }
                if (groupInfoDao.countDoctorPatientGroupType(ssSign.getDoctorHealth(), patient, "2", "1") < 1) {
                    DoctorPatientGroupInfo ncdJgGroup = new DoctorPatientGroupInfo();
                    ncdJgGroup.setDoctor(ssSign.getDoctorHealth());
                    ncdJgGroup.setPatient(patient);
                    ncdJgGroup.setSignType("1");
                    ncdJgGroup.setCzrq(new Date());
                    ncdJgGroup.setStatus(1);
                    ncdJgGroup.setPname(ssSign.getName());
                    ncdJgGroup.setQyrq(ssSign.getApplyDate());
                    ncdJgGroup.setDqrq(ssSign.getEnd());
                    ncdJgGroup.setGroup("2");
                    groupInfoDao.save(ncdJgGroup);
                }
            }
            }
            groupInfoDao.updateDoctorPatientGroup(jjSign != null ? jjSign.getDoctor() : ssSign.getDoctor(), patient, "1", 0);
            groupInfoDao.updateDoctorPatientGroup(jjSign != null ? jjSign.getDoctor() : ssSign.getDoctor(), patient, "1", 0);
            groupInfoDao.updateDoctorPatientGroup(jjSign != null ? jjSign.getDoctor() : ssSign.getDoctor(), patient, "3", 0);
            groupInfoDao.updateDoctorPatientGroup(jjSign != null ? jjSign.getDoctor() : ssSign.getDoctor(), patient, "3", 0);
            groupInfoDao.updateDoctorPatientGroup(jjSign != null ? jjSign.getDoctorHealth() : ssSign.getDoctorHealth(), patient, "1", 0);
            groupInfoDao.updateDoctorPatientGroup(jjSign != null ? jjSign.getDoctorHealth() : ssSign.getDoctorHealth(), patient, "3", 0);
        } else {
        } else {
            boolean isSixFive = false;
            boolean isSixFive = false;
            String birth = p.getIdcard().substring(6, 14);
            String birth = p.getIdcard().substring(6, 14);
@ -251,6 +283,21 @@ public class PatientDiseaseService extends BaseService {
                        groupInfoDao.save(ncdGroup);
                        groupInfoDao.save(ncdGroup);
                    }
                    }
                    if (groupInfoDao.countDoctorPatientGroupType(jjSign.getDoctorHealth(), patient, "3", "2") < 1) {
                        DoctorPatientGroupInfo ncdJgGroup = new DoctorPatientGroupInfo();
                        ncdJgGroup.setDoctor(jjSign.getDoctorHealth());
                        ncdJgGroup.setPatient(patient);
                        ncdJgGroup.setSignType("2");
                        ncdJgGroup.setCzrq(new Date());
                        ncdJgGroup.setStatus(1);
                        ncdJgGroup.setPname(jjSign.getName());
                        ncdJgGroup.setQyrq(jjSign.getApplyDate());
                        ncdJgGroup.setDqrq(jjSign.getEnd());
                        ncdJgGroup.setGroup("3");
                        groupInfoDao.save(ncdJgGroup);
                    }
                }
                }
                if (ssSign != null) {
                if (ssSign != null) {
                    if (groupInfoDao.countDoctorPatientGroupType(ssSign.getDoctor(), patient, "3", "1") < 1) {
                    if (groupInfoDao.countDoctorPatientGroupType(ssSign.getDoctor(), patient, "3", "1") < 1) {
@ -268,9 +315,26 @@ public class PatientDiseaseService extends BaseService {
                        groupInfoDao.save(ncdGroup);
                        groupInfoDao.save(ncdGroup);
                    }
                    }
                    if (groupInfoDao.countDoctorPatientGroupType(ssSign.getDoctorHealth(), patient, "3", "1") < 1) {
                        DoctorPatientGroupInfo ncdJgGroup = new DoctorPatientGroupInfo();
                        ncdJgGroup.setDoctor(ssSign.getDoctorHealth());
                        ncdJgGroup.setPatient(patient);
                        ncdJgGroup.setSignType("1");
                        ncdJgGroup.setCzrq(new Date());
                        ncdJgGroup.setStatus(1);
                        ncdJgGroup.setPname(ssSign.getName());
                        ncdJgGroup.setQyrq(ssSign.getApplyDate());
                        ncdJgGroup.setDqrq(ssSign.getEnd());
                        ncdJgGroup.setGroup("3");
                        groupInfoDao.save(ncdJgGroup);
                    }
                }
                }
                groupInfoDao.updateDoctorPatientGroup(jjSign != null ? jjSign.getDoctor() : ssSign.getDoctor(), patient, "1", 0);
                groupInfoDao.updateDoctorPatientGroup(jjSign != null ? jjSign.getDoctor() : ssSign.getDoctor(), patient, "1", 0);
                groupInfoDao.updateDoctorPatientGroup(jjSign != null ? jjSign.getDoctor() : ssSign.getDoctor(), patient, "2", 0);
                groupInfoDao.updateDoctorPatientGroup(jjSign != null ? jjSign.getDoctor() : ssSign.getDoctor(), patient, "2", 0);
                groupInfoDao.updateDoctorPatientGroup(jjSign != null ? jjSign.getDoctorHealth() : ssSign.getDoctorHealth(), patient, "1", 0);
                groupInfoDao.updateDoctorPatientGroup(jjSign != null ? jjSign.getDoctorHealth() : ssSign.getDoctorHealth(), patient, "2", 0);
            } else {
            } else {
                // 普通分组
                // 普通分组
                if (jjSign != null) {
                if (jjSign != null) {
@ -289,6 +353,21 @@ public class PatientDiseaseService extends BaseService {
                        groupInfoDao.save(ncdGroup);
                        groupInfoDao.save(ncdGroup);
                    }
                    }
                    if (groupInfoDao.countDoctorPatientGroupType(jjSign.getDoctorHealth(), patient, "1", "2") < 1) {
                        DoctorPatientGroupInfo ncdJgGroup = new DoctorPatientGroupInfo();
                        ncdJgGroup.setDoctor(jjSign.getDoctorHealth());
                        ncdJgGroup.setPatient(patient);
                        ncdJgGroup.setSignType("2");
                        ncdJgGroup.setCzrq(new Date());
                        ncdJgGroup.setStatus(1);
                        ncdJgGroup.setPname(jjSign.getName());
                        ncdJgGroup.setQyrq(jjSign.getApplyDate());
                        ncdJgGroup.setDqrq(jjSign.getEnd());
                        ncdJgGroup.setGroup("1");
                        groupInfoDao.save(ncdJgGroup);
                    }
                }
                }
                if (ssSign != null) {
                if (ssSign != null) {
                    if (groupInfoDao.countDoctorPatientGroupType(ssSign.getDoctor(), patient, "1", "1") < 1) {
                    if (groupInfoDao.countDoctorPatientGroupType(ssSign.getDoctor(), patient, "1", "1") < 1) {
@ -306,9 +385,26 @@ public class PatientDiseaseService extends BaseService {
                        groupInfoDao.save(ncdGroup);
                        groupInfoDao.save(ncdGroup);
                    }
                    }
                    if (groupInfoDao.countDoctorPatientGroupType(ssSign.getDoctorHealth(), patient, "1", "1") < 1) {
                        DoctorPatientGroupInfo ncdJgGroup = new DoctorPatientGroupInfo();
                        ncdJgGroup.setDoctor(ssSign.getDoctorHealth());
                        ncdJgGroup.setPatient(patient);
                        ncdJgGroup.setSignType("1");
                        ncdJgGroup.setCzrq(new Date());
                        ncdJgGroup.setStatus(1);
                        ncdJgGroup.setPname(ssSign.getName());
                        ncdJgGroup.setQyrq(ssSign.getApplyDate());
                        ncdJgGroup.setDqrq(ssSign.getEnd());
                        ncdJgGroup.setGroup("1");
                        groupInfoDao.save(ncdJgGroup);
                    }
                }
                }
                groupInfoDao.updateDoctorPatientGroup(jjSign != null ? jjSign.getDoctor() : ssSign.getDoctor(), patient, "2", 0);
                groupInfoDao.updateDoctorPatientGroup(jjSign != null ? jjSign.getDoctor() : ssSign.getDoctor(), patient, "2", 0);
                groupInfoDao.updateDoctorPatientGroup(jjSign != null ? jjSign.getDoctor() : ssSign.getDoctor(), patient, "3", 0);
                groupInfoDao.updateDoctorPatientGroup(jjSign != null ? jjSign.getDoctor() : ssSign.getDoctor(), patient, "3", 0);
                groupInfoDao.updateDoctorPatientGroup(jjSign != null ? jjSign.getDoctorHealth() : ssSign.getDoctorHealth(), patient, "2", 0);
                groupInfoDao.updateDoctorPatientGroup(jjSign != null ? jjSign.getDoctorHealth() : ssSign.getDoctorHealth(), patient, "3", 0);
            }
            }
        }
        }
@ -319,24 +415,29 @@ public class PatientDiseaseService extends BaseService {
     * 更新患者疾病到redis
     * 更新患者疾病到redis
     */
     */
    public void updateToRedis() {
    public void updateToRedis() {
        String sql = "select * from wlyy_patient_disease where del = '1'";
        String sql = "select * from wlyy_patient_disease";
        List<Map<String, Object>> patientDiseases = jdbcTemplate.queryForList(sql);
        List<Map<String, Object>> patientDiseases = jdbcTemplate.queryForList(sql);
        Map<String, JSONArray> diseases = new HashMap<>();
        Map<String, JSONArray> diseases = new HashMap<>();
        if (patientDiseases != null) {
        if (patientDiseases != null) {
            for (Map<String, Object> map : patientDiseases) {
            for (Map<String, Object> map : patientDiseases) {
                JSONObject disease = new JSONObject();
                disease.put("disease", map.get("disease"));
                disease.put("diseaseName", map.get("disease_name"));
                disease.put("del", map.get("del"));
                disease.put("signType", map.get("sign_type"));
                if (diseases.containsKey(map.get("patient").toString())) {
                    diseases.get(map.get("patient").toString()).put(disease);
                } else {
                    JSONArray jsonArray = new JSONArray();
                    jsonArray.put(disease);
                    diseases.put(map.get("patient").toString(), jsonArray);
                if(!diseases.containsKey(map.get("patient").toString())){
                    diseases.put(map.get("patient").toString(), new JSONArray());
                }
                if(map.get("del").toString().equals("1")) {
                    JSONObject disease = new JSONObject();
                    disease.put("disease", map.get("disease"));
                    disease.put("diseaseName", map.get("disease_name"));
                    disease.put("del", map.get("del"));
                    disease.put("signType", map.get("sign_type"));
                    if (diseases.containsKey(map.get("patient").toString())) {
                        diseases.get(map.get("patient").toString()).put(disease);
                    } else {
                        JSONArray jsonArray = new JSONArray();
                        jsonArray.put(disease);
                        diseases.put(map.get("patient").toString(), jsonArray);
                    }
                }
                }
            }
            }
        }
        }

+ 8 - 2
src/main/java/com/yihu/wlyy/service/app/team/AdminTeamService.java

@ -9,6 +9,7 @@ import com.yihu.wlyy.service.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import java.util.Date;
import java.util.Date;
import java.util.List;
import java.util.List;
@ -93,8 +94,13 @@ public class AdminTeamService extends BaseService {
        if(member != null) memberDao.delete(member);
        if(member != null) memberDao.delete(member);
    }
    }
    public List<Doctor> getMembers(long teamId){
        return memberDao.findTeamMembers(teamId);
    public List<Doctor> getMembers(long teamId, String role){
        return memberDao.findAllMembers(teamId);
        /*if(StringUtils.isEmpty(role)){
            return memberDao.findAllMembers(teamId);
        } else {
            return memberDao.findMembersByRole(teamId, role);
        }*/
    }
    }
    private void saveTeam(AdminTeam team) {
    private void saveTeam(AdminTeam team) {

+ 107 - 0
src/main/java/com/yihu/wlyy/service/common/QrcodeService.java

@ -1,7 +1,9 @@
package com.yihu.wlyy.service.common;
package com.yihu.wlyy.service.common;
import com.yihu.wlyy.entity.address.Hospital;
import com.yihu.wlyy.entity.address.Hospital;
import com.yihu.wlyy.entity.address.Town;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.repository.address.TownDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.organization.HospitalDao;
import com.yihu.wlyy.repository.organization.HospitalDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.BaseService;
@ -30,6 +32,8 @@ public class QrcodeService extends BaseService {
    private DoctorDao doctorDao;
    private DoctorDao doctorDao;
    @Autowired
    @Autowired
    private HospitalDao hospitalDao;
    private HospitalDao hospitalDao;
    @Autowired
    private TownDao townDao;
    /**
    /**
     * 所有医生二维码生成
     * 所有医生二维码生成
@ -104,6 +108,39 @@ public class QrcodeService extends BaseService {
        return true;
        return true;
    }
    }
    /**
     * 生成区二维码
     *
     * @param town
     * @param token
     * @return
     * @throws Exception
     */
    public boolean makeTownQrcode(String town,String token) throws Exception{
        try{
            Town twn = townDao.findByCode(town);
            if (twn != null) {
                // 二维码内容
                String content = "tw_" + twn.getCode() + "_" + twn.getName();
                // 二维码图片文件名
                String fileName = twn.getCode();
                String path = QrcodeService.class.getResource("/").getPath().replace("/WEB-INF/classes/", "")
                        + File.separator + "qrcode";
                // 通过微信接口生成区二维码
                makeQrcodeFromWeiXin(content, fileName.replaceAll("\r\n", ""), path, token);
                return true;
            } else {
                throw new Exception("can not find town info");
            }
        }catch (Exception e){
            e.printStackTrace();
            return false;
        }
    }
    /**
    /**
     * 社区二维码生成打包为zip
     * 社区二维码生成打包为zip
     *
     *
@ -250,6 +287,74 @@ public class QrcodeService extends BaseService {
        }
        }
    }
    }
    /**
     * 区二维码生成打包为zip
     *
     * @param city
     * @param token
     * @return
     * @throws Exception
     */
    public File downLoadTownQrcodes(String city,String token) throws Exception{
        // 查找所有医生
        Iterable<Town> towns = null;
        String zipFileName = "town_qrcode";
        if (StringUtils.isNotEmpty(city)) {
            towns = townDao.findByCity(city);
        } else {
            towns = townDao.findAll();
        }
        String path = QrcodeService.class.getResource("/").getPath().replace("/WEB-INF/classes/", "")
                + File.separator + "qrcode_download";
        File file = new File(path);
        // 删除文件夹、文件
        if (file.exists()) {
            File[] files = file.listFiles();
            if (files != null && files.length > 0) {
                for (File f : files) {
                    f.delete();
                }
            }
            file.delete();
        }
        if (towns != null) {
            for (Town town : towns) {
                if (StringUtils.isNotEmpty(city)) {
                    zipFileName = town.getCity();
                }
                // 二维码内容
                String content = "tw_" + town.getCode() + "_" + town.getName();
                // 二维码图片文件名
                String fileName = town.getName() + "_" + town.getCode();
                if (StringUtils.isEmpty(fileName)) {
                    continue;
                }
                // 通过微信接口生成医生二维码
                makeQrcodeFromWeiXin(content, fileName.replaceAll("\r\n", ""), path, token);
            }
            File zipFile = new File(path.replace("qrcode_download", "") + zipFileName + ".zip");
            if (zipFile.exists()) {
                zipFile.delete();
            }
            // 打包文件夹
            if (fileToZip(path, path.replace("qrcode_download", ""), zipFileName)) {
                return new File(path.replace("qrcode_download", "") + zipFileName + ".zip");
            } else {
                return null;
            }
        } else {
            return null;
        }
    }
    /**
    /**
     * 打包文件夹
     * 打包文件夹
     *
     *
@ -388,4 +493,6 @@ public class QrcodeService extends BaseService {
            throw new Exception(e.getMessage());
            throw new Exception(e.getMessage());
        }
        }
    }
    }
}
}

+ 2 - 1
src/main/java/com/yihu/wlyy/task/PushMsgTask.java

@ -164,7 +164,7 @@ public class PushMsgTask {
//	private static final String termination = "C0tdXtA_8k-Cy4a1EkzQuI877vqaqAtRkc-e_Gsd7sk";
//	private static final String termination = "C0tdXtA_8k-Cy4a1EkzQuI877vqaqAtRkc-e_Gsd7sk";
//	private static final String appointmentSuccess = "FY3Pqa66tHIE1Fv-irbFBPOh5cYP71fkOzfZKH4S-Fo";
//	private static final String appointmentSuccess = "FY3Pqa66tHIE1Fv-irbFBPOh5cYP71fkOzfZKH4S-Fo";
//	private static final String appointmentCancel = "tldWEb9AN7p_RoHoD8ml0GxWW3V1V_mpEEhp2v6p56s";
//	private static final String appointmentCancel = "tldWEb9AN7p_RoHoD8ml0GxWW3V1V_mpEEhp2v6p56s";
	private static final String url = "http://www.xmtyw.cn/wlyy/wx/html/";
//	private static final String url = "http://www.xmtyw.cn/wlyy/wx/html/";
	/**
	/**
	 * 发送微信模板消息
	 * 发送微信模板消息
@ -213,6 +213,7 @@ public class PushMsgTask {
	 */
	 */
	public String typeMsg(int type, String openid, String name, JSONObject json) {
	public String typeMsg(int type, String openid, String name, JSONObject json) {
		try {
		try {
			String url = SystemConf.getInstance().getSystemProperties().getProperty("server_url") + "wx/html/";
			WechatTemplate temp = new WechatTemplate();
			WechatTemplate temp = new WechatTemplate();
			temp.setTouser(openid);
			temp.setTouser(openid);
			temp.setTopcolor("#000000");
			temp.setTopcolor("#000000");

+ 99 - 0
src/main/java/com/yihu/wlyy/web/common/qrcode/QrcodeController.java

@ -85,6 +85,28 @@ public class QrcodeController extends WeixinBaseController {
        }
        }
    }
    }
    /**
     * 生成区二维码
     *
     * @param town
     * @return
     */
    @RequestMapping(value = "/town")
    @ResponseBody
    public String makeTownQrcode(String town){
        try{
            if(qrcodeService.makeTownQrcode(town,getAccessToken())){
                return write(200,"生成二维码成功!");
            }else{
                return error(-1,"生成二维码失败!");
            }
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"生成二维码失败!");
        }
    }
    /**
    /**
     * 下载某个社区的二维码
     * 下载某个社区的二维码
     *
     *
@ -127,6 +149,47 @@ public class QrcodeController extends WeixinBaseController {
        }
        }
    }
    }
    /**
     * 下载某个区的二维码
     *
     * @param town
     * @param response
     */
    @RequestMapping(value = "/town_img")
    public void downloadTownQrcode(String town, HttpServletResponse response){
        try{
            File file = new File(QrcodeController.class.getResource("/").getPath().replace("/WEB-INF/classes/", "") +
                    File.separator +"qrcode" + File.separator + town + ".png");
            boolean flag = false;
            if(!file.exists()){
                flag = qrcodeService.makeTownQrcode(town,getAccessToken());
            }else{
                flag = true;
            }
            if(flag = true) {
                response.setCharacterEncoding("utf-8");
                String path = request.getSession().getServletContext().getRealPath("/")
                        + File.separator + "qrcode" + File.separator + town + ".png";
                InputStream inputStream = new FileInputStream(path);
                OutputStream outputStream = response.getOutputStream();
                byte[] b = new byte[2048];
                int length = 0;
                while ((length = inputStream.read(b)) > 0) {
                    outputStream.write(b, 0, length);
                }
                outputStream.close();
                inputStream.close();
            }else{
                response.setStatus(404);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /**
    /**
     * 下载某个医生的二维码
     * 下载某个医生的二维码
@ -297,4 +360,40 @@ public class QrcodeController extends WeixinBaseController {
        }
        }
    }
    }
    /**
     * 下载某个城市的区的二维码图片
     *
     * @param city
     * @param response
     */
    @RequestMapping(value = "/download/towns")
    public void downloadTownQrcodes(String city,HttpServletResponse response){
        try{
            File file = qrcodeService.downLoadTownQrcodes(city,getAccessToken());
            if(file != null){
                response.setCharacterEncoding("utf-8");
                response.setContentType("multipart/form-data");
                response.setHeader("Content-Disposition", "attachment;fileName=towns_qrcode.zip");
                InputStream inputStream = new FileInputStream(file);
                OutputStream outputStream = response.getOutputStream();
                byte[] b = new byte[2048];
                int length = 0;
                while ((length = inputStream.read(b)) > 0) {
                    outputStream.write(b, 0, length);
                }
                outputStream.close();
                inputStream.close();
            }else{
                response.setStatus(500);
            }
        }catch (Exception e){
            e.printStackTrace();
            response.setStatus(500);
        }
    }
}
}

+ 7 - 6
src/main/java/com/yihu/wlyy/web/doctor/team/AdminTeamController.java

@ -95,7 +95,7 @@ public class AdminTeamController extends BaseController {
    @RequestMapping(value = "/{team_id}/leader", method = RequestMethod.PUT)
    @RequestMapping(value = "/{team_id}/leader", method = RequestMethod.PUT)
    @ApiOperation(value = "更新团队领导")
    @ApiOperation(value = "更新团队领导")
    public String updateTeamLeader(@PathVariable("team_id") long teamId,
    public String updateTeamLeader(@PathVariable("team_id") long teamId,
                                 @RequestParam("doctor_code") String doctorCode) {
                                   @RequestParam("doctor_code") String doctorCode) {
        try {
        try {
            AdminTeam team = teamService.updateTeamLeader(teamId, doctorCode);
            AdminTeam team = teamService.updateTeamLeader(teamId, doctorCode);
@ -122,7 +122,7 @@ public class AdminTeamController extends BaseController {
    @ResponseBody
    @ResponseBody
    @RequestMapping(value = "/{team_id}/members", method = RequestMethod.POST)
    @RequestMapping(value = "/{team_id}/members", method = RequestMethod.POST)
    @ApiOperation(value = "添加成员")
    @ApiOperation(value = "添加团队成员")
    public String addMember(@PathVariable("team_id") long teamId,
    public String addMember(@PathVariable("team_id") long teamId,
                            @RequestParam("doctor_code") String doctorCode) {
                            @RequestParam("doctor_code") String doctorCode) {
        try {
        try {
@ -138,9 +138,10 @@ public class AdminTeamController extends BaseController {
    @ResponseBody
    @ResponseBody
    @RequestMapping(value = "/{team_id}/members", method = RequestMethod.GET)
    @RequestMapping(value = "/{team_id}/members", method = RequestMethod.GET)
    @ApiOperation(value = "获取团队成员")
    @ApiOperation(value = "获取团队成员")
    public String getTeamMembers(@PathVariable("team_id") long teamId) {
    public String getTeamMembers(@PathVariable("team_id") long teamId,
                                 @RequestParam(value = "doctor_role", required = false) String role) {
        try {
        try {
            List<Doctor> members = memberService.getMembers(teamId);
            List<Doctor> members = memberService.getMembers(teamId, role);
            return write(200, "OK", "data", new JSONArray(members));
            return write(200, "OK", "data", new JSONArray(members));
        } catch (Exception e) {
        } catch (Exception e) {
@ -170,11 +171,11 @@ public class AdminTeamController extends BaseController {
    @RequestMapping(value = "/team/{doctor_code}/teams", method = RequestMethod.GET)
    @RequestMapping(value = "/team/{doctor_code}/teams", method = RequestMethod.GET)
    @ApiOperation(value = "获取医生团队列表")
    @ApiOperation(value = "获取医生团队列表")
    public String getDoctorTeams(@PathVariable("doctor_code") String doctorCode) {
    public String getDoctorTeams(@PathVariable("doctor_code") String doctorCode) {
        try{
        try {
            List<AdminTeam> teamList = teamService.getDoctorTeams(doctorCode);
            List<AdminTeam> teamList = teamService.getDoctorTeams(doctorCode);
            return write(200, "OK", "data", new JSONArray(teamList));
            return write(200, "OK", "data", new JSONArray(teamList));
        } catch (Exception e){
        } catch (Exception e) {
            error(e);
            error(e);
            return error(-1, e.getMessage());
            return error(-1, e.getMessage());
        }
        }

+ 29 - 0
src/main/java/com/yihu/wlyy/wechat/process/WeiXinEventProcess.java

@ -148,6 +148,35 @@ public class WeiXinEventProcess {
            article.put("Description","请点击查看社区详情");
            article.put("Description","请点击查看社区详情");
            article.put("PicUrl",picUrl);
            article.put("PicUrl",picUrl);
            articles.add(article);
            // 消息XML
            result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"),message.get("ToUserName"),articles);
        } else if(StringUtils.isNotEmpty(eventKey) && (eventKey.startsWith("tw_") ||
                eventKey.startsWith("qrscene_tw_"))){
            // 配置信息
            Properties systemConf = SystemConf.getInstance().getSystemProperties();
            // 图文信息
            List<Map<String,String>> articles =  new ArrayList<>();
            Map<String,String> article = new HashMap<>();
            // 社区二维码跳转URL
            String url = systemConf.getProperty("doctor_town_qrcode_url");
            // 图片URL
            String picUrl = systemConf.getProperty("doctor_qrcode_pic_url");
            // 二维码参数
            String[] keys = eventKey.replace("qrscene_tw_","").replace("tw_","").split("_");
            // 图文消息URL
            url = url.replace("{server}", systemConf.getProperty("wechat_base_url"))
                    .replace("{appId}", systemConf.getProperty("appId"))
                    .replace("{town}",keys[0]);
            //图片地址
            picUrl = picUrl.replace("{server}", systemConf.getProperty("server_url"));
            article.put("Url",url);
            article.put("Title",keys[1]);
            article.put("Description","请点击查看区详情");
            article.put("PicUrl",picUrl);
            articles.add(article);
            articles.add(article);
            // 消息XML
            // 消息XML
            result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"),message.get("ToUserName"),articles);
            result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"),message.get("ToUserName"),articles);

+ 1 - 0
src/main/resources/system.properties

@ -89,6 +89,7 @@ chat_file_path=/var/local/upload/chat
doctor_qrcode_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri={server}%2fwx%2fhtml%2fssgg%2fhtml%2fdoctor-homepage-new.html&amp;response_type=code&amp;scope=snsapi_base&amp;state={doctorCode}#wechat_redirect
doctor_qrcode_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri={server}%2fwx%2fhtml%2fssgg%2fhtml%2fdoctor-homepage-new.html&amp;response_type=code&amp;scope=snsapi_base&amp;state={doctorCode}#wechat_redirect
doctor_hos_qrcode_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri={server}%2fwx%2fhtml%2fqygl%2fhtml%2fsearch-doctor.html&amp;response_type=code&amp;scope=snsapi_base&amp;state={hospital}#wechat_redirect
doctor_hos_qrcode_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri={server}%2fwx%2fhtml%2fqygl%2fhtml%2fsearch-doctor.html&amp;response_type=code&amp;scope=snsapi_base&amp;state={hospital}#wechat_redirect
doctor_subscribe_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri={server}%2fwx%2fhtml%2fqygl%2fhtml%2fsigning-welcome.html&amp;response_type=code&amp;scope=snsapi_base&amp;state=code#wechat_redirect
doctor_subscribe_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri={server}%2fwx%2fhtml%2fqygl%2fhtml%2fsigning-welcome.html&amp;response_type=code&amp;scope=snsapi_base&amp;state=code#wechat_redirect
doctor_town_qrcode_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri={server}%2fwx%2fhtml%2fqygl%2fhtml%2fsearch-community.html&amp;response_type=code&amp;scope=snsapi_base&amp;state={town}#wechat_redirect
doctor_qrcode_pic_url={server}/images/familycontract.png
doctor_qrcode_pic_url={server}/images/familycontract.png
doctor_invitel_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&redirect_uri={server}%2fwx%2fhtml%2fssgg%2fhtml%2fdoctor-homepage-new.html&response_type=code&scope=snsapi_base&state={doctorCode}__{invilogcode}__{currentPatient}__{currentZH}#wechat_redirect
doctor_invitel_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&redirect_uri={server}%2fwx%2fhtml%2fssgg%2fhtml%2fdoctor-homepage-new.html&response_type=code&scope=snsapi_base&state={doctorCode}__{invilogcode}__{currentPatient}__{currentZH}#wechat_redirect