瀏覽代碼

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

hzp 8 年之前
父節點
當前提交
ab5b4162ab
共有 20 個文件被更改,包括 1637 次插入1363 次删除
  1. 5 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/PatientDao.java
  2. 2 2
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/PatientInfoService.java
  3. 1 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/ExpensesRemindService.java
  4. 72 14
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java
  5. 185 169
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/PatientService.java
  6. 9 3
      patient-co-wlyy/src/main/java/com/yihu/wlyy/task/PushMsgTask.java
  7. 5 2
      patient-co-wlyy/src/main/java/com/yihu/wlyy/util/CommonUtil.java
  8. 1 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/util/SystemConf.java
  9. 2 23
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/WeixinBaseController.java
  10. 225 266
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/FileUploadController.java
  11. 96 93
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/WechatController.java
  12. 30 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java
  13. 4 3
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/consult/DoctorConsultController.java
  14. 4 3
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/consult/DoctorConsultPublicController.java
  15. 2 2
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthEduArticleController.java
  16. 20 3
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/account/PatientController.java
  17. 589 600
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/BookingController.java
  18. 7 1
      patient-co-wlyy/src/main/resources/config/fdfs_client.conf
  19. 149 176
      patient-co-wlyy/src/main/resources/system.properties
  20. 229 0
      patient-co-wlyy/src/main/resources/system_bak.properties

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

@ -6,6 +6,8 @@
 *******************************************************************************/
package com.yihu.wlyy.repository.patient;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
@ -55,4 +57,7 @@ public interface PatientDao extends PagingAndSortingRepository<Patient, Long> {
	@Query(" select p from Patient p where password is null ")
	List<Patient> findAllIdCardPatientAndNoPassword();
	@Query("select p from Patient p where p.status = 1 and p.openid = ?1 order by p.czrq desc")
	Page<Patient> findPatientByOpenid(String openid, Pageable pageable);
}

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

@ -178,8 +178,8 @@ public class PatientInfoService extends BaseService {
        // 绑定用户手机号和openid
        if (!StringUtils.equals(fp.getOpenid(), openid)) {
            fp.setOpenid(openid);
            patientService.updatePatient(fp);
            //fp.setOpenid(openid);
            patientService.updatePatient(fp, openid);
        }
        if (StringUtils.isNoneEmpty(openid)) {

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

@ -192,7 +192,7 @@ public class ExpensesRemindService extends BaseService {
                json.put("doctor", doc.getCode());
                json.put("doctorName", doc.getName());
                json.put("date", DateUtil.dateToStrShort(new Date()));
                json.put("content", "为完成家庭医生签约,尽早为您提供家庭医生服务,请尽快到" + hos.getName() + "(地址:" + hos.getAddress() + ")缴费");
                json.put("content", p.getName() + ",您好!为完成家庭医生签约,尽早为您提供家庭医生服务,请尽快到" + hos.getName() + "(地址:" + hos.getAddress() + ")缴费");
                json.put("remark", "");
                // 添加到发送队列
                PushMsgTask.getInstance().putWxMsg(tokenUtils.getAccessToken(), 8, p.getOpenid(), p.getName(), json);

+ 72 - 14
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java

@ -864,13 +864,42 @@ public class FamilyContractService extends BaseService {
        // 保存用户信息
        patientDao.save(patient);
        Calendar now = Calendar.getInstance();
        int month = now.get(Calendar.MONTH) + 1;
        Calendar begin = Calendar.getInstance();
        Calendar end = Calendar.getInstance();
        // 起始时间
        begin.set(Calendar.HOUR,0);
        begin.set(Calendar.MINUTE,0);
        end.set(Calendar.SECOND,0);
        begin.set(Calendar.MILLISECOND,0);
        // 结束时间
        end.set(Calendar.HOUR,0);
        end.set(Calendar.MINUTE,0);
        end.set(Calendar.SECOND,0);
        end.set(Calendar.MILLISECOND,0);
        end.set(Calendar.MONTH, 6);
        end.set(Calendar.DATE,30);
        if (month < 3 || month > 6) {
            if (month > 6) {
                end.add(Calendar.YEAR, 1);
            }
        } else {
            begin.set(Calendar.MONTH, 7);
            begin.set(Calendar.DATE,1);
            end.add(Calendar.YEAR, 1);
        }
        // 更新签约日期
        sf.setBegin(begin.getTime());
        sf.setEnd(end.getTime());
        sf.setOpenid(patient.getOpenid());
        sf.setPatient(patient.getCode());
        // 改为签约生效
        sf.setStatus(1);
        // 更新签约日期
        sf.setBegin(DateUtil.getNowDateShort());
        sf.setEnd(DateUtil.strToDateShort(DateUtil.getNextYear(DateUtil.getNowDateShort(), 1)));
        //建立团队
        DoctorTeam doctorTeam = new DoctorTeam();
        String doctorTeamCode = getCode();
@ -929,7 +958,7 @@ public class FamilyContractService extends BaseService {
            Doctor doc = doctorDao.findByCode(sf.getDoctor());
            Hospital hos = hospitalDao.findByCode(doc.getHospital());
            String content = "祝贺您,成功签约" + sf.getDoctorName() + "医生团队,您已可以享受家庭医生所带来的无微不至的健康保健服务。" +
            String content = sf.getName() + ",您好!祝贺您,成功签约" + sf.getDoctorName() + "医生团队,您已可以享受家庭医生所带来的无微不至的健康保健服务。" +
                    "为了给您提供更好的服务,请尽快到" + (hos != null ? hos.getName() : "") + "社区(地址:" +
                    (hos != null ? hos.getAddress() : "") + ")缴费。";
            JSONObject json = new JSONObject();
@ -1023,14 +1052,43 @@ public class FamilyContractService extends BaseService {
            List<SystemDict> systemDicts = systemDictDao.findByDictName("SIGN_YEAR");
            String year = systemDicts.get(0).getCode();
            Calendar now = Calendar.getInstance();
            int month = now.get(Calendar.MONTH) + 1;
            Calendar begin = Calendar.getInstance();
            Calendar end = Calendar.getInstance();
            // 起始时间
            begin.set(Calendar.HOUR,0);
            begin.set(Calendar.MINUTE,0);
            end.set(Calendar.SECOND,0);
            begin.set(Calendar.MILLISECOND,0);
            // 结束时间
            end.set(Calendar.HOUR,0);
            end.set(Calendar.MINUTE,0);
            end.set(Calendar.SECOND,0);
            end.set(Calendar.MILLISECOND,0);
            end.set(Calendar.MONTH, 6);
            end.set(Calendar.DATE,30);
            if (month < 3 || month > 6) {
                if (month > 6) {
                    end.add(Calendar.YEAR, 1);
                }
            } else {
                begin.set(Calendar.MONTH, 7);
                begin.set(Calendar.DATE,1);
                end.add(Calendar.YEAR, 1);
            }
            // 更新签约日期
            sf.setBegin(begin.getTime());
            sf.setEnd(end.getTime());
            //签约类型:1三师签约,2家庭签约
            // 改为签约生效
            sf.setStatus(1);
            // 更新签约日期
            sf.setBegin(DateUtil.getNowDateShort());
            sf.setSignType("1");//患者发起签约
            sf.setExpensesType(StringUtils.isEmpty(expenses) ? "01" : expenses);//收费类别
            sf.setEnd(DateUtil.strToDateShort(DateUtil.getNextYear(DateUtil.getNowDateShort(), 1)));
            sf.setAdminTeamId(adminTeamCode);
            if (StringUtils.isNotEmpty(doctor)) {
                //设置全科医生
@ -1112,7 +1170,7 @@ public class FamilyContractService extends BaseService {
            json.put("doctor", StringUtils.isEmpty(sf.getDoctor()) ? sf.getDoctorHealth() : sf.getDoctor());
            json.put("doctorName", StringUtils.isEmpty(sf.getDoctor()) ? sf.getDoctorHealthName() : sf.getDoctorName());
            json.put("date", DateUtil.dateToStrShort(new Date()));
            json.put("content", "您与 " + (StringUtils.isEmpty(sf.getDoctor()) ? sf.getDoctorHealthName() : sf.getDoctorName()) + " 医生建立家庭医生签约关系失败,请查看!");
            json.put("content", sf.getName() + ",您好!您与 " + (StringUtils.isEmpty(sf.getDoctor()) ? sf.getDoctorHealthName() : sf.getDoctorName()) + " 医生建立家庭医生签约关系失败,请查看!");
            json.put("remark", "您好,签约家庭医生失败通知");
            // 添加到发送队列
            PushMsgTask.getInstance().putWxMsg(access_token, 2, sf.getOpenid(), sf.getName(), json);
@ -1131,7 +1189,7 @@ public class FamilyContractService extends BaseService {
            Doctor doc = doctorDao.findByCode(StringUtils.isNotEmpty(doctor) ? sf.getDoctorHealth() : sf.getDoctor());
            Hospital hos = hospitalDao.findByCode(doc.getHospital());
            String content = "祝贺您,成功签约" + doc.getName() + "医生团队,您已可以享受家庭医生所带来的无微不至的健康保健服务。" +
            String content = sf.getName() + ",您好!祝贺您,成功签约" + doc.getName() + "医生团队,您已可以享受家庭医生所带来的无微不至的健康保健服务。" +
                    "为了给您提供更好的服务,请尽快到" + (hos != null ? hos.getName() : "") + "社区(地址:" +
                    (hos != null ? hos.getAddress() : "") + ")缴费。";
            // 同意签约
@ -1200,7 +1258,7 @@ public class FamilyContractService extends BaseService {
            json.put("doctor", sf.getDoctor());
            json.put("doctorName", sf.getDoctorName());
            json.put("orgName", sf.getHospitalName());
            json.put("remark", "您好,您的签约医生已同意您的解约申请,解约已生效。");
            json.put("remark", sf.getName() + ",您好!您的签约医生已同意您的解约申请,解约已生效。");
            // 添加到发送队列
            PushMsgTask.getInstance().putWxMsg(access_token, 5, sf.getOpenid(), sf.getName(), json);
        } else {
@ -1214,7 +1272,7 @@ public class FamilyContractService extends BaseService {
            json.put("doctor", sf.getDoctor());
            json.put("doctorName", sf.getDoctorName());
            json.put("orgName", sf.getHospitalName());
            json.put("remark", "您好,您的签约医生拒绝您的解约申请,解约失败。");
            json.put("remark", sf.getName() + ",您好!您的签约医生拒绝您的解约申请,解约失败。");
            // 添加到发送队列
            PushMsgTask.getInstance().putWxMsg(access_token, 5, sf.getOpenid(), sf.getName(), json);
        }
@ -1913,7 +1971,7 @@ public class FamilyContractService extends BaseService {
                " WHERE " +
                " sf.type = 2 " +
                " AND sf. STATUS > 0 " +
               // " and sf.doctor = ? " +
                // " and sf.doctor = ? " +
                " and sf.admin_team_code = ? " +
                " AND ( sf.doctor_health is null or sf.doctor_health ='' ) ";
        List<Map<String, Object>> datas = null;
@ -1921,7 +1979,7 @@ public class FamilyContractService extends BaseService {
        datas = jdbcTemplate.queryForList(sql, labelType, teamCode);
        //根据类别查找标签
        List<SignPatientLabel> s =  labelDao.findByLabelTypeAndStatusAndTeamCode(labelType, 1,teamCode);
        List<SignPatientLabel> s = labelDao.findByLabelTypeAndStatusAndTeamCode(labelType, 1, teamCode);
        if (s != null && s.size() > 0) {
            for (SignPatientLabel one : s) {
                returnMap.put(one.getLabelName(), new JSONArray());
@ -2249,7 +2307,7 @@ public class FamilyContractService extends BaseService {
            throw new Exception("参数错误!");
        }
        //根据类别查找标签
        List<SignPatientLabel> s = labelDao.findByLabelTypeAndStatusAndTeamCode(labelType, 1,team);
        List<SignPatientLabel> s = labelDao.findByLabelTypeAndStatusAndTeamCode(labelType, 1, team);
        if (s != null && s.size() > 0) {
            for (SignPatientLabel one : s) {
                returnMap.put(one.getLabelName(), new JSONArray());

+ 185 - 169
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/PatientService.java

@ -20,188 +20,204 @@ import com.yihu.wlyy.util.IdcardInfoExtractor;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springside.modules.utils.Clock;
import java.util.Date;
import java.util.List;
/**
 * 患者基本信息类.
 * 
 *
 * @author George
 */
@Component
@Transactional(rollbackFor = Exception.class)
public class PatientService extends TokenService {
	@Autowired
	private SignFamilyDao signFamilyDao;
	@Autowired
	private PatientDao patientDao;
	@Autowired
	private DoctorDao doctorDao;
	@Autowired
	private DoctorPatientDao doctorPatientDao;
	private Clock clock = Clock.DEFAULT;
	public void setClock(Clock clock) {
		this.clock = clock;
	}
	public Patient findByCode(String code) {
		return patientDao.findByCode(code);
	}
	public Patient findByIdcard(String idcard) {
		return patientDao.findByIdcard(idcard);
	}
	public Patient findBySsc(String ssc) {
		return patientDao.findBySsc(ssc);
	}
	public Patient findByMobile(String mobile) {
		return patientDao.findByMobile(mobile);
	}
	public Patient findByOpenid(String openid) {
		return patientDao.findByOpenid(openid);
	}
	public int countByOpenid(String openid) {
		return patientDao.countByOpenid(openid);
	}
	/**
	 * 修改患者密码
	 * @param patient
	 */
	public void updatePatientPwd(Patient patient) {
		patientDao.save(patient);
	}
	public void updatePatientInfo(Patient patient) {
		patientDao.save(patient);
	}
	/**
	 * 修改患者openid
	 * @param patient
	 */
	public void updatePatient(Patient patient) {
		if (StringUtils.isNotEmpty(patient.getOpenid())) {
			patientDao.clearOpenid(patient.getCode(), patient.getOpenid());
		}
		patientDao.save(patient);
		if (StringUtils.isNotEmpty(patient.getOpenid())) {
			signFamilyDao.updateOpenidByPatient(patient.getOpenid(), patient.getCode());
		}
	}
	public void deletePatient(Patient patient) {
		patientDao.delete(patient);
	}
	public void deletePatients(Iterable<Patient> patients) {
		patientDao.delete(patients);
	}
	/**
	 * 患者註冊
	 * @param patient
	 * @return
	 * @throws Exception
	 */
	public JSONObject register(Patient patient, String imei, int platform) throws Exception {
		IdcardInfoExtractor ie = new IdcardInfoExtractor(patient.getIdcard());
		patient.setBirthday(ie.getBirthday());
		patient.setSex(ie.getGender());
		patient.setCode(getCode());
		patient.setStatus(1);
		patient.setCzrq(clock.getCurrentDate());
		patient.setDisease(0);
		patient.setDiseaseCondition(0);
		patient.setRecordAmount(0);
		patient.setPoints(0);
		Patient temp = patientDao.save(patient);
		if (temp != null) {
			// 更新openid
			updatePatient(temp);
			// 生成登录tokey
			Token token = newToken(temp.getCode(), imei, platform);
			if (token != null) {
				// 生成登录信息成功
				JSONObject json = new JSONObject();
				json.put("id", temp.getId());
				json.put("uid", temp.getCode());
				json.put("token", token.getToken());
				json.put("name", temp.getName());
				json.put("photo", temp.getPhoto());
				//new Thread(new SignSsGetTask(patient.getIdcard())).start();
				return json;
			}
		}
		return null;
	}
	/**
	 * 建立三师团队与患者的关系
	 * @param sf
	 * @param patient
	 * @param doctorCode
	 * @param doctorType
	 */
	private void bindDoctorPatient(SignFamily sf, Patient patient, String doctorCode, int doctorType) {
		DoctorPatient dp = doctorPatientDao.findByPatientDoctorTeamType(patient.getCode(), doctorCode, doctorType);
		if (dp == null) {
			Doctor doctor = doctorDao.findByCode(doctorCode);
			dp = new DoctorPatient();
			dp.setBirthday(patient.getBirthday());
			dp.setCzrq(new Date());
			dp.setDoctor(doctor.getCode());
			dp.setDoctorName(doctor.getName());
			// 健康管理师
			dp.setDoctorType(doctorType);
			dp.setPatient(patient.getCode());
			dp.setPatientName(patient.getName());
			dp.setSex(patient.getSex());
			if (sf != null) {
				// 三师和家庭都存在
				dp.setSignType("11");
			} else {
				// 只有家庭签约
				dp.setSignType("01");
			}
			dp.setStatus(1);
			// 设置为三师团队
			dp.setTeamType(1);
			// 保存到数据库
			doctorPatientDao.save(dp);
		}
	}
	/**
	 * 微信端患者註冊
	 * @param patient
	 * @return
	 * @throws Exception
	 */
	public JSONObject register(Patient patient) throws Exception {
		patient.setCode(getCode());
		patient.setCzrq(clock.getCurrentDate());
		EncodesUtil.entryptPassword(patient);
		Patient temp = patientDao.save(patient);
		if (temp != null) {
			JSONObject json = new JSONObject();
			json.put("id", temp.getId());
			json.put("uid", temp.getCode());
			json.put("name", "");
			json.put("openid", temp.getOpenid());
			return json;
		}
		return null;
	}
    @Autowired
    private SignFamilyDao signFamilyDao;
    @Autowired
    private PatientDao patientDao;
    @Autowired
    private DoctorDao doctorDao;
    @Autowired
    private DoctorPatientDao doctorPatientDao;
    private Clock clock = Clock.DEFAULT;
    public void setClock(Clock clock) {
        this.clock = clock;
    }
    public Patient findByCode(String code) {
        return patientDao.findByCode(code);
    }
    public Patient findByIdcard(String idcard) {
        return patientDao.findByIdcard(idcard);
    }
    public Patient findBySsc(String ssc) {
        return patientDao.findBySsc(ssc);
    }
    public Patient findByMobile(String mobile) {
        return patientDao.findByMobile(mobile);
    }
    public Patient findByOpenid(String openid) {
        return patientDao.findByOpenid(openid);
    }
    public int countByOpenid(String openid) {
        return patientDao.countByOpenid(openid);
    }
    /**
     * 修改患者密码
     *
     * @param patient
     */
    public void updatePatientPwd(Patient patient) {
        patientDao.save(patient);
    }
    public void updatePatientInfo(Patient patient) {
        patientDao.save(patient);
    }
    /**
     * 修改患者openid
     *
     * @param patient
     */
    public void updatePatient(Patient patient, String openid) {
        if (patientDao.countByOpenid(openid) >= 10) {
            Sort sort = new Sort(Sort.Direction.ASC, "czrq");
            PageRequest pageRequest = new PageRequest(0, 1, sort);
            Page<Patient> pPage = patientDao.findPatientByOpenid(openid, pageRequest);
            for (Patient p : pPage) {
                p.setOpenid("");
                patientDao.save(p);
            }
        }
        patientDao.save(patient);
        if (StringUtils.isNotEmpty(patient.getOpenid())) {
            signFamilyDao.updateOpenidByPatient(patient.getOpenid(), patient.getCode());
        }
    }
    public void deletePatient(Patient patient) {
        patientDao.delete(patient);
    }
    public void deletePatients(Iterable<Patient> patients) {
        patientDao.delete(patients);
    }
    /**
     * 患者註冊
     *
     * @param patient
     * @return
     * @throws Exception
     */
    public JSONObject register(Patient patient, String imei, int platform) throws Exception {
        IdcardInfoExtractor ie = new IdcardInfoExtractor(patient.getIdcard());
        patient.setBirthday(ie.getBirthday());
        patient.setSex(ie.getGender());
        patient.setCode(getCode());
        patient.setStatus(1);
        patient.setCzrq(clock.getCurrentDate());
        patient.setDisease(0);
        patient.setDiseaseCondition(0);
        patient.setRecordAmount(0);
        patient.setPoints(0);
        patient.setOpenid("");
        Patient temp = patientDao.save(patient);
        if (temp != null) {
            // 更新openid
            updatePatient(temp, imei);
            // 生成登录tokey
            Token token = newToken(temp.getCode(), imei, platform);
            if (token != null) {
                // 生成登录信息成功
                JSONObject json = new JSONObject();
                json.put("id", temp.getId());
                json.put("uid", temp.getCode());
                json.put("token", token.getToken());
                json.put("name", temp.getName());
                json.put("photo", temp.getPhoto());
                //new Thread(new SignSsGetTask(patient.getIdcard())).start();
                return json;
            }
        }
        return null;
    }
    /**
     * 建立三师团队与患者的关系
     *
     * @param sf
     * @param patient
     * @param doctorCode
     * @param doctorType
     */
    private void bindDoctorPatient(SignFamily sf, Patient patient, String doctorCode, int doctorType) {
        DoctorPatient dp = doctorPatientDao.findByPatientDoctorTeamType(patient.getCode(), doctorCode, doctorType);
        if (dp == null) {
            Doctor doctor = doctorDao.findByCode(doctorCode);
            dp = new DoctorPatient();
            dp.setBirthday(patient.getBirthday());
            dp.setCzrq(new Date());
            dp.setDoctor(doctor.getCode());
            dp.setDoctorName(doctor.getName());
            // 健康管理师
            dp.setDoctorType(doctorType);
            dp.setPatient(patient.getCode());
            dp.setPatientName(patient.getName());
            dp.setSex(patient.getSex());
            if (sf != null) {
                // 三师和家庭都存在
                dp.setSignType("11");
            } else {
                // 只有家庭签约
                dp.setSignType("01");
            }
            dp.setStatus(1);
            // 设置为三师团队
            dp.setTeamType(1);
            // 保存到数据库
            doctorPatientDao.save(dp);
        }
    }
    /**
     * 微信端患者註冊
     *
     * @param patient
     * @return
     * @throws Exception
     */
    public JSONObject register(Patient patient) throws Exception {
        patient.setCode(getCode());
        patient.setCzrq(clock.getCurrentDate());
        EncodesUtil.entryptPassword(patient);
        Patient temp = patientDao.save(patient);
        if (temp != null) {
            JSONObject json = new JSONObject();
            json.put("id", temp.getId());
            json.put("uid", temp.getCode());
            json.put("name", "");
            json.put("openid", temp.getOpenid());
            return json;
        }
        return null;
    }
}

+ 9 - 3
patient-co-wlyy/src/main/java/com/yihu/wlyy/task/PushMsgTask.java

@ -6,6 +6,7 @@ import java.util.concurrent.LinkedBlockingQueue;
import com.yihu.wlyy.util.SystemConf;
import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
@ -188,6 +189,11 @@ public class PushMsgTask {
     */
    private boolean sendWeixinMessage(String access_token, int type, String openid, String name, JSONObject json) {
        try {
            if (StringUtils.isEmpty(openid)) {
                logger.error("send wechat message failed:openid is empty");
                return false;
            }
            if (access_token != null) {
                String token_url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + access_token;
                String params = typeMsg(type, openid, name, json);
@ -386,8 +392,8 @@ public class PushMsgTask {
                keyword4.setColor("#000000");
                keyword4.setValue(json.getString("content"));
                m.put("remark", keyword4);
            }else if (type == 9) {
                temp.setUrl(url + "jkjy/html/article.html?openid=" + openid + "&dataId=" + json.getString("article")+"&toUser="+ json.getString("toUser"));
            } else if (type == 9) {
                temp.setUrl(url + "jkjy/html/article.html?openid=" + openid + "&dataId=" + json.getString("article") + "&toUser=" + json.getString("toUser"));
                temp_id = SystemConf.getInstance().getSystemProperties().getProperty("template_healthy_article");
                temp.setTemplate_id(temp_id);
                WechatTemplateData keyword1 = new WechatTemplateData();
@ -410,7 +416,7 @@ public class PushMsgTask {
                keyword5.setColor("#000000");
                keyword5.setValue(json.getString("remark"));
                m.put("remark", keyword5);
            } else if (type == 10){
            } else if (type == 10) {
                temp.setUrl(url + "qygl/html/signing-doctors.html?openid=" + openid + "&state=" + openid + "&toUser=" + json.getString("toUser"));
                temp.setTemplate_id(SystemConf.getInstance().getSystemProperties()
                        .getProperty("template_doctor_change"));

+ 5 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/util/CommonUtil.java

@ -230,8 +230,9 @@ public class CommonUtil {
    public static String copyTempImage(String files) throws Exception {
        // 文件保存的临时路径
        String tempPath = SystemConf.getInstance().getTempPath() + File.separator;
        String serverUrl = SystemConf.getInstance().getSystemProperties().getProperty("fastdfs_file_url");
        String[] fileArray = files.split(",");
        FastDFSUtil fastDFSUtil = new FastDFSConfig().fastDFSUtil();
        FastDFSUtil fastDFSUtil = new FastDFSUtil();
        String fileUrls = "";
        for (String file : fileArray) {
@ -243,7 +244,9 @@ public class CommonUtil {
                ObjectNode result = fastDFSUtil.upload(in, fileName.substring(fileName.lastIndexOf(".") + 1), "");
                in.close();
                if (result != null) {
                    fileUrls += (StringUtils.isEmpty(fileUrls) ? "" : ",") + result.get("fileUrl").toString().replaceAll("\"", "");
                    fileUrls += (StringUtils.isEmpty(fileUrls) ? "" : ",") + serverUrl
                            + result.get("groupName").toString().replaceAll("\"", "") + "/"
                            + result.get("remoteFileName").toString().replaceAll("\"", "");
                    f.delete();
                    if (fs.exists()) {
                        fs.delete();

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/util/SystemConf.java

@ -97,7 +97,7 @@ public class SystemConf {
		if (systemProperties == null) {
			InputStream is = null;
			try {
				is = this.getClass().getResourceAsStream("/system.properties");
				is = this.getClass().getResourceAsStream("/system_bak.properties");
				systemProperties = new Properties();
				systemProperties.load(is);
			} catch (IOException e1) {

+ 2 - 23
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/WeixinBaseController.java

@ -76,29 +76,8 @@ public class WeixinBaseController extends BaseController {
			Map<Object, Object> map = new HashMap<Object, Object>();
			if (json.has("openid")) {
				String openid = json.get("openid").toString();
				Patient patient = patientService.findByOpenid(openid);
				if (patient != null) {
					// 返回用户信息
					map.put("id", patient.getId());
					map.put("uid", patient.getCode());
					map.put("name", patient.getName());
					map.put("openid", patient.getOpenid());
					map.put("photo", patient.getPhoto());
					// 查询token
					Token token = SystemData.wxPatientTokens.get(patient.getCode());
					if (token == null) {
						// 从数据库加载
						token = tokenService.findWxToken(patient.getCode());
					}
					if (token == null) {
						// 生成新的token
						token = tokenService.newTxToken(patient.getCode(), openid);
					}
					map.put("token", token.getToken());
					return write(200, "获取成功", "data", map);
				} else {
					return error(100, openid);
				}
				map.put("openid", openid);
				return write(200, "获取成功", "data", map);
			} else {
				return error(Integer.parseInt(json.get("errcode").toString()), "操作失败:" + json.get("errmsg").toString());
			}

+ 225 - 266
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/FileUploadController.java

@ -3,16 +3,15 @@ package com.yihu.wlyy.web.common;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.yihu.wlyy.util.fastdfs.FastDFSUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import org.apache.commons.io.FileUtils;
import org.json.JSONObject;
import org.springframework.http.MediaType;
@ -33,269 +32,229 @@ import com.yihu.wlyy.web.BaseController;
@RequestMapping(value = "/upload", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "文件上传")
public class FileUploadController extends BaseController {
	/**
	 * 患者头像上传
	 * @return
	 * @throws IOException
	 * @throws IllegalStateException
	 */
	@RequestMapping(value = "patientPhoto", method = RequestMethod.POST/* , headers = "Accept=image/png" */)
	@ResponseBody
	public String patientPhoto(HttpServletRequest request, HttpServletResponse response,String photo) {
		// 圖片列表
		//List<File> images = new ArrayList<File>();
		//List<String> tempPaths = new ArrayList<String>();
		// 文件保存的临时路径
		//String tempPath = SystemConf.getInstance().getImagePath() + File.separator;
		// 拼接年月日路径
		//String datePath = DateUtil.getStringDate("yyyy") + File.separator + DateUtil.getStringDate("MM") + File.separator + DateUtil.getStringDate("dd") + File.separator;
		try {
			MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
			Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
			// 创建文件夹
			//File file = new File(tempPath + datePath);
			//if (!file.exists()) {
			//	file.mkdirs();
			//}
			String fileName = null;
			String  firstPhoto=null;
			for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
				// 上传文件
				MultipartFile mf = entity.getValue();
				fileName = mf.getOriginalFilename();
				String fileExt = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
				// 重命名文件
				firstPhoto=photo.substring(0, photo.lastIndexOf("."))+"_small."+fileExt;
				File uploadFile = new File(SystemConf.getInstance().getImagePath() + File.separator+firstPhoto);
				// 拷贝文件流到指定文件路径
				FileCopyUtils.copy(mf.getBytes(), uploadFile);
				// 生成缩略图
				//ImageCompress.compress(uploadFile.getAbsolutePath(), uploadFile.getAbsolutePath() + "_small", 300, 300);
				// 添加到上传成功数组中
				//images.add(uploadFile);
				//tempPaths.add(datePath + newFileName);
			}
			String urls = firstPhoto;
			JSONObject json = new JSONObject();
			json.put("status", 200);
			json.put("msg", "上传成功");
			// 图片标识对象的HTTP链接
			json.put("urls", urls);
			System.out.println("图片上传:" + json.toString());
			return json.toString();
		} catch (Exception e) {
			error(e);
			return error(-1, "上传失败");
		}
	}
	/** 
	 * 图片上传 
	 * @return 
	 * @throws IOException  
	 * @throws IllegalStateException  
	 */
	@RequestMapping(value = "image", method = RequestMethod.POST/* , headers = "Accept=image/png" */)
	@ResponseBody
	public String image(HttpServletRequest request, HttpServletResponse response) {
		// 圖片列表
		List<File> images = new ArrayList<File>();
		List<String> tempPaths = new ArrayList<String>();
		// 文件保存的临时路径
		String tempPath = SystemConf.getInstance().getTempPath() + File.separator;
		// 拼接年月日路径
		String datePath = DateUtil.getStringDate("yyyy") + File.separator + DateUtil.getStringDate("MM") + File.separator + DateUtil.getStringDate("dd") + File.separator;
		try {
			MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
			Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
			// 创建文件夹
			File file = new File(tempPath + datePath);
			if (!file.exists()) {
				file.mkdirs();
			}
			String fileName = null;
			for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
				// 上传文件
				MultipartFile mf = entity.getValue();
				fileName = mf.getOriginalFilename();
				String fileExt = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
				// 重命名文件
				SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
				String newFileName = df.format(new Date()) + "_" + new Random().nextInt(1000) + "." + fileExt;
				File uploadFile = new File(tempPath + datePath + newFileName);
				// 拷贝文件流到指定文件路径
				FileCopyUtils.copy(mf.getBytes(), uploadFile);
				// 生成缩略图
				ImageCompress.compress(uploadFile.getAbsolutePath(), uploadFile.getAbsolutePath() + "_small", 300, 300);
				// 添加到上传成功数组中
				images.add(uploadFile);
				tempPaths.add(datePath + newFileName);
			}
			String urls = "";
			for (String image : tempPaths) {
				if (urls.length() == 0) {
					urls = image;
				} else {
					urls += "," + image;
				}
			}
			JSONObject json = new JSONObject();
			json.put("status", 200);
			json.put("msg", "上传成功");
			// 图片标识对象的HTTP链接
			json.put("urls", urls);
			System.out.println("图片上传:" + json.toString());
			return json.toString();
		} catch (Exception e) {
			error(e);
			try {
				// 清除垃圾图片
				for (File file : images) {
					FileUtils.forceDelete(file);
				}
			} catch (Exception e2) {
				error(e2);
			}
			return error(-1, "上传失败");
		}
	}
	/** 
	 * 聊天附件上传
	 * @return 
	 * @throws IOException  
	 * @throws IllegalStateException  
	 */
	@RequestMapping(value = "chat", method = RequestMethod.POST)
	@ResponseBody
	public String chatFile(HttpServletRequest request, HttpServletResponse response) {
		// 圖片列表
		List<File> files = new ArrayList<File>();
		List<String> tempPaths = new ArrayList<String>();
		// 获取聊天文件保存路径
		String tempPath = SystemConf.getInstance().getChatPath() + File.separator;
		// 拼接年月日路径
		String datePath = DateUtil.getStringDate("yyyy") + File.separator + DateUtil.getStringDate("MM") + File.separator + DateUtil.getStringDate("dd") + File.separator;
		try {
			MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
			Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
			// 创建文件夹
			File file = new File(tempPath + datePath);
			if (!file.exists()) {
				file.mkdirs();
			}
			String fileName = null;
			for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
				// 上传文件
				MultipartFile mf = entity.getValue();
				fileName = mf.getOriginalFilename();
				String fileExt = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
				// 重命名文件
				SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
				String newFileName = df.format(new Date()) + "_" + new Random().nextInt(1000) + "." + fileExt;
				File uploadFile = new File(tempPath + datePath + newFileName);
				// 拷贝文件流到指定文件路径
				FileCopyUtils.copy(mf.getBytes(), uploadFile);
				// 添加到上传成功数组中
				files.add(uploadFile);
				tempPaths.add(datePath + newFileName);
			}
			String urls = "";
			for (String temp : tempPaths) {
				if (urls.length() == 0) {
					urls = SystemConf.getInstance().getChatServer() + temp;
				} else {
					urls += "," + SystemConf.getInstance().getChatServer() + temp;
				}
			}
			JSONObject json = new JSONObject();
			json.put("status", 200);
			json.put("msg", "上传成功");
			// 图片标识对象的HTTP链接
			json.put("urls", urls);
			System.out.println("附件上传:" + json.toString());
			return json.toString();
		} catch (Exception e) {
			error(e);
			try {
				// 清除垃圾图片
				for (File file : files) {
					FileUtils.forceDelete(file);
				}
			} catch (Exception e2) {
				error(e2);
			}
			return error(-1, "上传失败");
		}
	}
    @ApiParam
    FastDFSUtil fastDFSUtil;
	/**
	 * 语音上传
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "voice", method = RequestMethod.POST)
	@ResponseBody
	public String voice(HttpServletRequest request, HttpServletResponse response) {
		// 圖片列表
		List<File> voices = new ArrayList<File>();
		List<String> tempPaths = new ArrayList<String>();
		// 文件保存的临时路径
		String tempPath = SystemConf.getInstance().getTempPath() + File.separator;
		// 拼接年月日路径
		String datePath = DateUtil.getStringDate("yyyy") + File.separator + DateUtil.getStringDate("MM") + File.separator + DateUtil.getStringDate("dd") + File.separator;
		try {
			MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
			Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
			// 创建文件夹
			File file = new File(tempPath + datePath);
			if (!file.exists()) {
				file.mkdirs();
			}
			String fileName = null;
			for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
				// 上传文件
				MultipartFile mf = entity.getValue();
				fileName = mf.getOriginalFilename();
				String fileExt = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
				// 重命名文件
				SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
				String newFileName = df.format(new Date()) + "_" + new Random().nextInt(1000) + "." + fileExt;
				File uploadFile = new File(tempPath + datePath + newFileName);
				// 拷贝文件流到指定文件路径
				FileCopyUtils.copy(mf.getBytes(), uploadFile);
				// 添加到上传成功数组中
				voices.add(uploadFile);
				tempPaths.add(datePath + newFileName);
			}
			String urls = "";
			for (String voice : tempPaths) {
				if (urls.length() == 0) {
					urls = voice;
				} else {
					urls += "," + voice;
				}
			}
			JSONObject json = new JSONObject();
			json.put("status", 200);
			json.put("msg", "上传成功");
			// 图片标识对象的HTTP链接
			json.put("urls", urls);
			System.out.println("语音上传:" + json.toString());
			return json.toString();
		} catch (Exception e) {
			error(e);
			try {
				// 清除垃圾图片
				for (File file : voices) {
					FileUtils.forceDelete(file);
				}
			} catch (Exception e2) {
				error(e2);
			}
			return error(-1, "上传失败");
		}
	}
    /**
     * 患者头像上传
     *
     * @return
     * @throws IOException
     * @throws IllegalStateException
     */
    @RequestMapping(value = "patientPhoto", method = RequestMethod.POST/* , headers = "Accept=image/png" */)
    @ResponseBody
    public String patientPhoto(HttpServletRequest request, HttpServletResponse response, String photo) {
        try {
            String fastUrl = SystemConf.getInstance().getSystemProperties().getProperty("fastdfs_file_url");
            MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
            Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
            String fileName = null;
            String firstPhoto = null;
            for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
                // 上传文件
                MultipartFile mf = entity.getValue();
                fileName = mf.getOriginalFilename();
                String fileExt = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
                // 重命名文件
                firstPhoto = photo.substring(0, photo.lastIndexOf(".")) + "_small." + fileExt;
                File uploadFile = new File(SystemConf.getInstance().getTempPath() + File.separator + firstPhoto);
                // 拷贝文件流到指定文件路径
                FileCopyUtils.copy(mf.getBytes(), uploadFile);
            }
            JSONObject json = new JSONObject();
            json.put("status", 200);
            json.put("msg", "上传成功");
            // 图片标识对象的HTTP链接
            json.put("urls", String.join(",", firstPhoto));
            System.out.println("图片上传:" + json.toString());
            return json.toString();
        } catch (Exception e) {
            error(e);
            return error(-1, "上传失败");
        }
    }
    /**
     * 图片上传
     *
     * @return
     * @throws IOException
     * @throws IllegalStateException
     */
    @RequestMapping(value = "image", method = RequestMethod.POST/* , headers = "Accept=image/png" */)
    @ResponseBody
    public String image(HttpServletRequest request, HttpServletResponse response) {
        // 圖片列表
        List<File> images = new ArrayList<File>();
        List<String> tempPaths = new ArrayList<String>();
        // 文件保存的临时路径
        String tempPath = SystemConf.getInstance().getTempPath() + File.separator;
        // 拼接年月日路径
        String datePath = DateUtil.getStringDate("yyyy") + File.separator + DateUtil.getStringDate("MM") + File.separator + DateUtil.getStringDate("dd") + File.separator;
        try {
            MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
            Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
            // 创建文件夹
            File file = new File(tempPath + datePath);
            if (!file.exists()) {
                file.mkdirs();
            }
            String fileName = null;
            for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
                // 上传文件
                MultipartFile mf = entity.getValue();
                fileName = mf.getOriginalFilename();
                String fileExt = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
                // 重命名文件
                SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
                String newFileName = df.format(new Date()) + "_" + new Random().nextInt(1000) + "." + fileExt;
                File uploadFile = new File(tempPath + datePath + newFileName);
                // 拷贝文件流到指定文件路径
                FileCopyUtils.copy(mf.getBytes(), uploadFile);
                // 生成缩略图
                ImageCompress.compress(uploadFile.getAbsolutePath(), uploadFile.getAbsolutePath() + "_small", 300, 300);
                // 添加到上传成功数组中
                images.add(uploadFile);
                tempPaths.add(datePath + newFileName);
            }
            String urls = "";
            for (String image : tempPaths) {
                if (urls.length() == 0) {
                    urls = image;
                } else {
                    urls += "," + image;
                }
            }
            JSONObject json = new JSONObject();
            json.put("status", 200);
            json.put("msg", "上传成功");
            // 图片标识对象的HTTP链接
            json.put("urls", urls);
            System.out.println("图片上传:" + json.toString());
            return json.toString();
        } catch (Exception e) {
            error(e);
            try {
                // 清除垃圾图片
                for (File file : images) {
                    FileUtils.forceDelete(file);
                }
            } catch (Exception e2) {
                error(e2);
            }
            return error(-1, "上传失败");
        }
    }
    /**
     * 聊天附件上传
     *
     * @return
     * @throws IOException
     * @throws IllegalStateException
     */
    @RequestMapping(value = "chat", method = RequestMethod.POST)
    @ResponseBody
    public String chatFile(HttpServletRequest request, HttpServletResponse response) {
        List<String> tempPaths = new ArrayList<String>();
        try {
            String fastUrl = SystemConf.getInstance().getSystemProperties().getProperty("fastdfs_file_url");
            MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
            Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
            String fileName = null;
            for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
                // 上传文件
                MultipartFile mf = entity.getValue();
                fileName = mf.getOriginalFilename();
                String fileExt = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
                ObjectNode objectNode = fastDFSUtil.upload(mf.getInputStream(),fileExt,"");
                tempPaths.add(fastUrl + objectNode.get("groupName").toString().replaceAll("\"","")
                        + "/" + objectNode.get("remoteFileName").toString().replaceAll("\"",""));
            }
            String urls = String.join(",", tempPaths);
            JSONObject json = new JSONObject();
            json.put("status", 200);
            json.put("msg", "上传成功");
            // 图片标识对象的HTTP链接
            json.put("urls", urls);
            System.out.println("附件上传:" + json.toString());
            return json.toString();
        } catch (Exception e) {
            error(e);
            return error(-1, "上传失败");
        }
    }
    /**
     * 语音上传
     *
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value = "voice", method = RequestMethod.POST)
    @ResponseBody
    public String voice(HttpServletRequest request, HttpServletResponse response) {
        // 圖片列表
        List<File> voices = new ArrayList<File>();
        List<String> tempPaths = new ArrayList<String>();
        // 文件保存的临时路径
        String tempPath = SystemConf.getInstance().getTempPath() + File.separator;
        // 拼接年月日路径
        String datePath = DateUtil.getStringDate("yyyy") + File.separator + DateUtil.getStringDate("MM") + File.separator + DateUtil.getStringDate("dd") + File.separator;
        try {
            MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
            Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
            // 创建文件夹
            File file = new File(tempPath + datePath);
            if (!file.exists()) {
                file.mkdirs();
            }
            String fileName = null;
            for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
                // 上传文件
                MultipartFile mf = entity.getValue();
                fileName = mf.getOriginalFilename();
                String fileExt = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
                // 重命名文件
                SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
                String newFileName = df.format(new Date()) + "_" + new Random().nextInt(1000) + "." + fileExt;
                File uploadFile = new File(tempPath + datePath + newFileName);
                // 拷贝文件流到指定文件路径
                FileCopyUtils.copy(mf.getBytes(), uploadFile);
                // 添加到上传成功数组中
                voices.add(uploadFile);
                tempPaths.add(datePath + newFileName);
            }
            String urls = "";
            for (String voice : tempPaths) {
                if (urls.length() == 0) {
                    urls = voice;
                } else {
                    urls += "," + voice;
                }
            }
            JSONObject json = new JSONObject();
            json.put("status", 200);
            json.put("msg", "上传成功");
            // 图片标识对象的HTTP链接
            json.put("urls", urls);
            System.out.println("语音上传:" + json.toString());
            return json.toString();
        } catch (Exception e) {
            error(e);
            try {
                // 清除垃圾图片
                for (File file : voices) {
                    FileUtils.forceDelete(file);
                }
            } catch (Exception e2) {
                error(e2);
            }
            return error(-1, "上传失败");
        }
    }
}

+ 96 - 93
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/WechatController.java

@ -133,16 +133,16 @@ public class WechatController extends WeixinBaseController {
    /**
     * 注册信息验证
     *
     * @param name 姓名
     * @param name   姓名
     * @param idcard 身份证号
     * @param ssc 社保卡号
     * @param ssc    社保卡号
     * @param mobile 手机号
     * @return
     */
    @RequestMapping(value = "/check_regist_info")
    @ResponseBody
    public String checkRegistInfo(String name,String idcard,String ssc,String mobile){
        try{
    public String checkRegistInfo(String name, String idcard, String ssc, String mobile) {
        try {
            if (StringUtils.isEmpty(name)) {
                return error(-1, "姓名不允许为空");
            }
@ -177,38 +177,38 @@ public class WechatController extends WeixinBaseController {
            SocialSecurityInfo socialSecurityInfo = socialSecurityInfoDao.findBySfzh18Max(idcard);
            if(socialSecurityInfo != null){
                if(name.compareTo(socialSecurityInfo.getXming0() == null ? "" : socialSecurityInfo.getXming0()) != 0){
                    return error(-1,"身份证号与姓名不一致,请检查后重新输入");
            if (socialSecurityInfo != null) {
                if (name.compareTo(socialSecurityInfo.getXming0() == null ? "" : socialSecurityInfo.getXming0()) != 0) {
                    return error(-1, "身份证号与姓名不一致,请检查后重新输入");
                }
                if(ssc.compareTo(socialSecurityInfo.getCardno() == null ? "" : socialSecurityInfo.getCardno()) != 0&&ssc.compareTo(socialSecurityInfo.getCard16() == null ? "" : socialSecurityInfo.getCard16()) != 0){
                    return error(-1,"身份证号与医保卡号不一致,请检查后重新输入");
                if (ssc.compareTo(socialSecurityInfo.getCardno() == null ? "" : socialSecurityInfo.getCardno()) != 0 && ssc.compareTo(socialSecurityInfo.getCard16() == null ? "" : socialSecurityInfo.getCard16()) != 0) {
                    return error(-1, "身份证号与医保卡号不一致,请检查后重新输入");
                }
            }else{
                return error(-1,"对不起,暂不支持16年6月份之后办理的医保卡注册");
            } else {
                return error(-1, "对不起,暂不支持16年6月份之后办理的医保卡注册");
            }
            Patient patient = patientDao.findByIdcard(idcard);
            if(patient != null){
            if (patient != null) {
                if (!StringUtils.isEmpty(patient.getMobile())) {
                    return error(-1, "该身份证已被注册");
                }
            }
            return write(200,"验证成功");
        }catch(Exception e){
            return write(200, "验证成功");
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1,"验证失败");
            return error(-1, "验证失败");
        }
    }
    /**
     * 患者注册
     *
     * @param idcard   身份證號
     * @param mobile   登录手机号
     * @param captcha  手机验证码
     * @param idcard  身份證號
     * @param mobile  登录手机号
     * @param captcha 手机验证码
     * @return
     */
    @RequestMapping(value = "regist")
@ -227,9 +227,9 @@ public class WechatController extends WeixinBaseController {
            if (StringUtils.isEmpty(idcard)) {
                return error(-1, "身份证号不允许为空!");
            }
			if (StringUtils.isEmpty(ssc)) {
				return error(-1, "社保卡号不允许为空!");
			}
            if (StringUtils.isEmpty(ssc)) {
                return error(-1, "社保卡号不允许为空!");
            }
            if (StringUtils.isEmpty(mobile)) {
                return error(-1, "手机号不允许为空!");
            }
@ -269,26 +269,26 @@ public class WechatController extends WeixinBaseController {
            SocialSecurityInfo socialSecurityInfo = socialSecurityInfoDao.findBySfzh18Max(idcard);
            if(socialSecurityInfo != null){
                if(name.compareTo(socialSecurityInfo.getXming0() == null ? "" : socialSecurityInfo.getXming0()) != 0){
                    return error(-1,"身份证号与姓名不一致<br/>请检查后重新输入");
            if (socialSecurityInfo != null) {
                if (name.compareTo(socialSecurityInfo.getXming0() == null ? "" : socialSecurityInfo.getXming0()) != 0) {
                    return error(-1, "身份证号与姓名不一致<br/>请检查后重新输入");
                }
                if(ssc.compareTo(socialSecurityInfo.getCardno() == null ? "" : socialSecurityInfo.getCardno()) != 0){
                    if(ssc.compareTo(socialSecurityInfo.getCard16() == null ? "" : socialSecurityInfo.getCard16()) != 0){
                         return error(-1,"身份证号与医保卡号不一致,请检查后重新输入");
                    }else{
                        ssc= socialSecurityInfo.getCardno();//统一只存英文字母开头的医保卡
                if (ssc.compareTo(socialSecurityInfo.getCardno() == null ? "" : socialSecurityInfo.getCardno()) != 0) {
                    if (ssc.compareTo(socialSecurityInfo.getCard16() == null ? "" : socialSecurityInfo.getCard16()) != 0) {
                        return error(-1, "身份证号与医保卡号不一致,请检查后重新输入");
                    } else {
                        ssc = socialSecurityInfo.getCardno();//统一只存英文字母开头的医保卡
                    }
                }
            }else{
                return error(-1,"对不起,暂不支持16年6月份之后办理的医保卡注册");
            } else {
                return error(-1, "对不起,暂不支持16年6月份之后办理的医保卡注册");
            }
            Patient patient = patientDao.findByIdcard(idcard);
            if(patient == null){
            if (patient == null) {
                patient = new Patient();
            }else{
            } else {
                if (!StringUtils.isEmpty(patient.getMobile())) {
                    return error(-1, "该身份证已被注册!");
                }
@ -297,13 +297,13 @@ public class WechatController extends WeixinBaseController {
            patient.setIdcard(idcard);
            patient.setMobile(mobile);
            //增加密码
            String salt= UUID.randomUUID().toString().replace("-","");
            String salt = UUID.randomUUID().toString().replace("-", "");
            patient.setSalt(salt);
            password = RSAUtils.getInstance(patientService).decryptString(password);
            password=StringUtils.reverse(password);
            patient.setPassword(MD5.GetMD5Code(password+salt));
            password = StringUtils.reverse(password);
            patient.setPassword(MD5.GetMD5Code(password + salt));
			patient.setSsc(ssc);
            patient.setSsc(ssc);
            patient.setOpenid(openid);
            JSONObject json = patientService.register(patient, openid, 3);
            if (json != null) {
@ -322,7 +322,7 @@ public class WechatController extends WeixinBaseController {
    /**
     * 患者微信登录接口
     *
     * @param captcha 短信号
     * @param captcha  短信号
     * @param mobile   电话号码
     * @param password 登录密码
     * @return
@ -335,60 +335,60 @@ public class WechatController extends WeixinBaseController {
            @RequestParam(required = false) String password,
            String openid) {
        String errorMessage;
        LoginLog loginLog=new LoginLog();
        LoginLog loginLog = new LoginLog();
        loginLog.setCreateTime(new Date());
        loginLog.setPhone(mobile);
        loginLog.setType("2");
        loginLog.setUserType("1");
        try {
            //账号登录 mobile可能是电话号也可能是身份证
            if(StringUtils.isNoneEmpty(mobile)&&StringUtils.isNoneEmpty(password)&&!org.springframework.util.StringUtils.isEmpty(mobile)){
            if (StringUtils.isNoneEmpty(mobile) && StringUtils.isNoneEmpty(password) && !org.springframework.util.StringUtils.isEmpty(mobile)) {
                Patient patient = patientService.findByMobile(mobile);
                if(patient==null){
                    patient= patientService.findByIdcard(mobile);
                if (patient == null) {
                    patient = patientService.findByIdcard(mobile);
                }
                loginLog.setLoginType("2");
                if (patient == null) {
                    if(mobile.length()==11){
                        errorMessage="该手机号暂未注册账号,请确认后重新输入!";
                    }else{
                        errorMessage="该身份证号暂未注册账号,请确认后重新输入!";
                    if (mobile.length() == 11) {
                        errorMessage = "该手机号暂未注册账号,请确认后重新输入!";
                    } else {
                        errorMessage = "该身份证号暂未注册账号,请确认后重新输入!";
                    }
                    loginLog.setErrorMessage(errorMessage);
                    loginLogService.saveLog(loginLog);
                    return error(-1, errorMessage);
                } else if (patient.getStatus() == 0) {
                    if(mobile.length()==11){
                      errorMessage="该手机号已被禁止使用!";
                    }else{
                      errorMessage="该身份证号已被禁止使用!";
                    if (mobile.length() == 11) {
                        errorMessage = "该手机号已被禁止使用!";
                    } else {
                        errorMessage = "该身份证号已被禁止使用!";
                    }
                    loginLog.setErrorMessage(errorMessage);
                    loginLogService.saveLog(loginLog);
                    return error(-1,errorMessage );
                    return error(-1, errorMessage);
                } else if (patient.getStatus() == 2) {
                    errorMessage="该账号正在审核中,请确认审核通过后再登录,“如有疑问,拨打400-6677-400转2人工客服”";
                    errorMessage = "该账号正在审核中,请确认审核通过后再登录,“如有疑问,拨打400-6677-400转2人工客服”";
                    loginLog.setErrorMessage(errorMessage);
                    loginLogService.saveLog(loginLog);
                    return error(-1, errorMessage);
                } else if (StringUtils.isEmpty(openid)) {
                    errorMessage="无效的OpenID!";
                    errorMessage = "无效的OpenID!";
                    loginLog.setErrorMessage(errorMessage);
                    loginLogService.saveLog(loginLog);
                    return error(-1,errorMessage);
                    return error(-1, errorMessage);
                }
                loginLog.setUserCode(patient.getCode());
                //解密
                password = RSAUtils.getInstance(patientService).decryptString(password);
                password=StringUtils.reverse(password);
                password = StringUtils.reverse(password);
                //生成MD5
                String loginPassword= MD5.GetMD5Code(password+patient.getSalt());
                String loginPassword = MD5.GetMD5Code(password + patient.getSalt());
                //判断d登录密码是否正确
                if(loginPassword.equals(patient.getPassword())){
                if (loginPassword.equals(patient.getPassword())) {
                    // 绑定用户手机号和openid
                    if (!StringUtils.equals(patient.getOpenid(), openid)) {
                        patient.setOpenid(openid);
                        patientService.updatePatient(patient);
                        //patient.setOpenid(openid);
                        patientService.updatePatient(patient, openid);
                    }
                    // 用户校验通过,生成token
@ -399,7 +399,7 @@ public class WechatController extends WeixinBaseController {
                    map.put("name", patient.getName());
                    map.put("token", token.getToken());
                    map.put("photo", patient.getPhoto());
                    if(StringUtils.isNoneEmpty(openid)){
                    if (StringUtils.isNoneEmpty(openid)) {
                        //发送微信模板
                        familyService.sendWXMessage(patient);
                    }
@ -407,61 +407,64 @@ public class WechatController extends WeixinBaseController {
                    loginLog.setLoginType("1");
                    loginLogService.saveLog(loginLog);
                    return write(200, "登录成功", "data", map);
                }else{
                    errorMessage="密码错误,登录失败";
                } else {
                    errorMessage = "密码错误,登录失败";
                    loginLog.setErrorMessage(errorMessage);
                    loginLogService.saveLog(loginLog);
                    return error(-1, errorMessage);
                }
            }
            //短信登录
            if(StringUtils.isNoneEmpty(mobile)&&StringUtils.isNoneEmpty(captcha)){
            if (StringUtils.isNoneEmpty(mobile) && StringUtils.isNoneEmpty(captcha)) {
                // 对验证码进行校验
                int res = smsService.check(mobile, 4, captcha);
                switch (res) {
                    case -2:{
                        errorMessage="验证码已过期!";
                    case -2: {
                        errorMessage = "验证码已过期!";
                        loginLog.setErrorMessage(errorMessage);
                        loginLogService.saveLog(loginLog);
                        return error(-1, errorMessage);}
                    case -1:{
                        errorMessage="请输入正确的验证码!";
                        return error(-1, errorMessage);
                    }
                    case -1: {
                        errorMessage = "请输入正确的验证码!";
                        loginLog.setErrorMessage(errorMessage);
                        loginLogService.saveLog(loginLog);
                        return error(-1, errorMessage);}
                    case 0:{
                        errorMessage="验证码无效!";
                        return error(-1, errorMessage);
                    }
                    case 0: {
                        errorMessage = "验证码无效!";
                        loginLog.setErrorMessage(errorMessage);
                        loginLogService.saveLog(loginLog);
                        return error(-1, errorMessage);}
                        return error(-1, errorMessage);
                    }
                }
                Patient patient = patientService.findByMobile(mobile);
                loginLog.setLoginType("1");
                if (patient == null) {
                    if(mobile.length()==11){
                        errorMessage="该手机号暂未注册账号,请确认后重新输入!";
                    }else{
                        errorMessage="该身份证号暂未注册账号,请确认后重新输入!";
                    if (mobile.length() == 11) {
                        errorMessage = "该手机号暂未注册账号,请确认后重新输入!";
                    } else {
                        errorMessage = "该身份证号暂未注册账号,请确认后重新输入!";
                    }
                    loginLog.setErrorMessage(errorMessage);
                    loginLogService.saveLog(loginLog);
                    return error(-1, errorMessage);
                } else if (patient.getStatus() == 0) {
                    if(mobile.length()==11){
                        errorMessage="该手机号已被禁止使用!";
                    }else{
                        errorMessage="该身份证号已被禁止使用!";
                    if (mobile.length() == 11) {
                        errorMessage = "该手机号已被禁止使用!";
                    } else {
                        errorMessage = "该身份证号已被禁止使用!";
                    }
                    loginLog.setErrorMessage(errorMessage);
                    loginLogService.saveLog(loginLog);
                    return error(-1, errorMessage);
                } else if (patient.getStatus() == 2) {
                    errorMessage="该账号正在审核中,请确认审核通过后再登录,“如有疑问,拨打400-6677-400转2人工客服”";
                    errorMessage = "该账号正在审核中,请确认审核通过后再登录,“如有疑问,拨打400-6677-400转2人工客服”";
                    loginLog.setErrorMessage(errorMessage);
                    loginLogService.saveLog(loginLog);
                    return error(-1, errorMessage);
                } else if (StringUtils.isEmpty(openid)) {
                    errorMessage="无效的OpenID!";
                    errorMessage = "无效的OpenID!";
                    loginLog.setErrorMessage(errorMessage);
                    loginLogService.saveLog(loginLog);
                    return error(-1, errorMessage);
@ -469,8 +472,8 @@ public class WechatController extends WeixinBaseController {
                loginLog.setUserCode(patient.getCode());
                // 绑定用户手机号和openid
                if (!StringUtils.equals(patient.getOpenid(), openid)) {
                    patient.setOpenid(openid);
                    patientService.updatePatient(patient);
                    //patient.setOpenid(openid);
                    patientService.updatePatient(patient, openid);
                }
                // 用户校验通过,生成token
@ -481,7 +484,7 @@ public class WechatController extends WeixinBaseController {
                map.put("name", patient.getName());
                map.put("token", token.getToken());
                map.put("photo", patient.getPhoto());
                if(StringUtils.isNoneEmpty(openid)){
                if (StringUtils.isNoneEmpty(openid)) {
                    //发送微信模板
                    familyService.sendWXMessage(patient);
                }
@ -492,7 +495,7 @@ public class WechatController extends WeixinBaseController {
            return error(-1, "登录失败");
        } catch (Exception e) {
            errorMessage="系统异常,登录失败";
            errorMessage = "系统异常,登录失败";
            loginLog.setErrorMessage(errorMessage);
            loginLogService.saveLog(loginLog);
            error(e);
@ -641,20 +644,20 @@ public class WechatController extends WeixinBaseController {
     */
    @RequestMapping(value = "/is_subscribe")
    @ResponseBody
    public String getIsSubscribe(String openid){
        try{
            String userInfo_url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token="+ getAccessToken()+ "&openid=" + openid + "&lang=zh_CN";
    public String getIsSubscribe(String openid) {
        try {
            String userInfo_url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=" + getAccessToken() + "&openid=" + openid + "&lang=zh_CN";
            String params = "";
            String result = HttpUtil.sendGet(userInfo_url, params);
            JSONObject json = new JSONObject(result);
            if (json.has("subscribe")) {
                return write(200,"查询成功","subsribe",json.get("subscribe").toString());
                return write(200, "查询成功", "subsribe", json.get("subscribe").toString());
            } else {
                return error(-1,json.getString("errmsg"));
                return error(-1, json.getString("errmsg"));
            }
        }catch (Exception e){
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1,"查询失败");
            return error(-1, "查询失败");
        }
    }
}

+ 30 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java

@ -3,6 +3,7 @@ package com.yihu.wlyy.web.doctor.account;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import com.yihu.wlyy.entity.organization.Hospital;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
@ -21,6 +22,7 @@ import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@ -73,6 +75,8 @@ public class DoctorController extends BaseController {
    private HospitalDeptService deptService;
    @Autowired
    private DoctorWorkTimeService workTimeService;
    @Autowired
    StringRedisTemplate redisTemplate;
    /**
     * 社区医院下医生列表查询接口 没分页
@ -1559,9 +1563,18 @@ public class DoctorController extends BaseController {
                                          @RequestParam(required = false) String patients,
                                          @RequestParam(required = false) String isAll) {
        try {
            String status = redisTemplate.opsForValue().get("jianguanshifenpei:" + getUID());
            status = StringUtils.isEmpty(status) ? "0" : status;
            if(!status.equals("1")){
                redisTemplate.opsForValue().set("jianguanshifenpei:" + getUID(),"1");
                redisTemplate.expire("jianguanshifenpei:" + getUID(), 20, TimeUnit.MINUTES);
            } else {
                return error(-2,"正在分配,请勿重复操作");
            }
            if (StringUtils.isNotEmpty(isAll) && isAll.equals("1")) {
                int result = doctorInfoService.updateTeamHealthDoctorsAll(newDoctorCode, getUID());
                redisTemplate.opsForValue().set("jianguanshifenpei:" + getUID(),"0");
                redisTemplate.expire("jianguanshifenpei:" + getUID(), 10, TimeUnit.MINUTES);
                if (result == 1) {
                    return write(200, "分配健管师成功");
                } else if (result == 2) {
@ -1573,8 +1586,12 @@ public class DoctorController extends BaseController {
                }
                doctorInfoService.updateTeamHealthDoctors(newDoctorCode, oldDoctorCode, patients, getUID());
            }
            redisTemplate.opsForValue().set("jianguanshifenpei:" + getUID(),"0");
            redisTemplate.expire("jianguanshifenpei:" + getUID(), 10, TimeUnit.MINUTES);
            return write(200, "更新成功");
        } catch (Exception e) {
            redisTemplate.opsForValue().set("jianguanshifenpei:" + getUID(), "0");
            redisTemplate.expire("jianguanshifenpei:" + getUID(), 10, TimeUnit.MINUTES);
            e.printStackTrace();
            return error(-1, "更新失败");
        }
@ -1594,9 +1611,21 @@ public class DoctorController extends BaseController {
                                    String oldDoctorCode,
                                    String patients) {
        try {
            String status = redisTemplate.opsForValue().get("quankeyishengfenpei:" + getUID());
            status = StringUtils.isEmpty(status) ? "0" : status;
            if(!status.equals("1")){
                redisTemplate.opsForValue().set("quankeyishengfenpei:" + getUID(),"1");
                redisTemplate.expire("quankeyishengfenpei:" + getUID(), 20, TimeUnit.MINUTES);
            } else {
                return error(-2,"正在分配,请勿重复操作");
            }
            doctorInfoService.updateTeamDoctors(newDoctorCode, oldDoctorCode, patients, getUID());
            redisTemplate.opsForValue().set("quankeyishengfenpei:" + getUID(), "0");
            redisTemplate.expire("quankeyishengfenpei:" + getUID(), 10, TimeUnit.MINUTES);
            return write(200, "更新成功");
        } catch (Exception e) {
            redisTemplate.opsForValue().set("quankeyishengfenpei:" + getUID(), "0");
            redisTemplate.expire("quankeyishengfenpei:" + getUID(), 10, TimeUnit.MINUTES);
            e.printStackTrace();
            return error(-1, "更新失败");
        }

+ 4 - 3
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/consult/DoctorConsultController.java

@ -503,10 +503,11 @@ public class DoctorConsultController extends WeixinBaseController {
                    Patient p = patientService.findByCode(patient);
                    if (ct != null && p != null && StringUtils.isNotEmpty(p.getOpenid())) {
                        JSONObject json = new JSONObject();
                        json.put("first", "问诊回复提醒");
                        json.put("first", p.getName() + ",您好!\n您的健康咨询有新的回复");
                        json.put("toUser", p.getCode());
                        json.put("consultcontent", ct.getSymptoms());
                        String replycontent = content.length() > 15 ? content.substring(0, 15) + "..." : content;
                        String symp = ct.getSymptoms();
                        json.put("consultcontent", StringUtils.isNotEmpty(symp) && symp.length() > 50 ? (symp.substring(0, 50) + "...")  : content);
                        String replycontent = content.length() > 50 ? content.substring(0, 50) + "..." : content;
                        if (type == 2) {
                            replycontent = "[图片]";
                        } else if (type == 3) {

+ 4 - 3
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/consult/DoctorConsultPublicController.java

@ -231,10 +231,11 @@ public class DoctorConsultPublicController extends BaseController {
				Patient p = patientService.findByCode(cp.getPatient());
				JSONObject json = new JSONObject();
				json.put("isPublic", 1);
				json.put("first", "您的公共咨询有新的回复");
				json.put("first", p.getName() + ",您好!\n您的公共咨询有新的回复");
				json.put("toUser", p.getCode());
				json.put("consultcontent", cp.getContent());
				String replycontent = content.length() > 15 ? content.substring(0, 15) + "..." : content;
				String symp = cp.getContent();
				json.put("consultcontent", StringUtils.isNotEmpty(symp) && symp.length() > 50 ? (symp.substring(0, 50) + "...")  : content);
				String replycontent = content.length() > 50 ? content.substring(0, 50) + "..." : content;
				json.put("consult", consult);
				json.put("replycontent", replycontent);
				json.put("doctorName", doctor.getName());

+ 2 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthEduArticleController.java

@ -271,7 +271,7 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
			}
			// 查询医生信息
			Doctor doctor = doctorService.findDoctorByCode(getUID());
			String msgHead = doctor.getName()+"医生给您发来了一篇患教文章";
			String msgHead =  doctor.getName()+"医生给您发来了一篇患教文章";
			String endMsg = "为了您的健康,"+doctor.getName()+"医生给您发送了一篇患教文章,请仔细查阅,如有问题,可随时咨询医生。";
			JSONArray messages = new JSONArray();
			for (String p : patientSet) {
@ -309,7 +309,7 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
					if (StringUtils.isNotEmpty(patientTemp.getOpenid())) {
						// 推送消息给微信端
						JSONObject json = new JSONObject();
						json.put("first",msgHead);
						json.put("first", patientTemp.getName() + ",您好!\n" + msgHead);
						json.put("toUser",p);
						json.put("article",temp.getCode()+"");
						json.put("title",temp.getTitle());

+ 20 - 3
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/account/PatientController.java

@ -1,11 +1,14 @@
package com.yihu.wlyy.web.patient.account;
import com.sun.org.apache.regexp.internal.RE;
import com.yihu.wlyy.entity.dict.SystemDict;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeamMember;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.security.Token;
import com.yihu.wlyy.repository.security.TokenDao;
import com.yihu.wlyy.service.app.account.PatientInfoService;
import com.yihu.wlyy.service.app.sign.FamilyContractService;
import com.yihu.wlyy.service.app.team.AdminTeamService;
@ -56,6 +59,8 @@ public class PatientController extends WeixinBaseController {
    private DoctorService doctorService;
    @Autowired
    AdminTeamService teamService;
    @Autowired
    TokenDao tokenDao;
    /**
     * 患者基本信息查询接口
@ -343,10 +348,22 @@ public class PatientController extends WeixinBaseController {
            if (patient == null) {
                return error(-1, "退出失败,用户不存在");
            } else {
                patient.setOpenid("");
                patientInfoService.updateUser(patient);
                //patient.setOpenid("");
                //patientInfoService.updateUser(patient);
                Token token = SystemData.wxPatientTokens.get(getUID());
                if (token == null) {
                    token = tokenDao.findByPatient(getUID(), 3);
                }
                if(token == null){
                    return error(-1,"用户未登录");
                }
                token.setDel("0");
                tokenDao.save(token);
                SystemData.wxPatientTokens.remove(getUID());
                return success("已成功退出!");
            }
            return success("已成功退出!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "操作失败!");

+ 589 - 600
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/BookingController.java

@ -1,8 +1,10 @@
package com.yihu.wlyy.web.third;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.PatientReservation;
import com.yihu.wlyy.service.app.reservation.PatientReservationService;
import com.yihu.wlyy.service.common.account.DoctorService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.service.third.guahao.GuahaoDoctor;
import com.yihu.wlyy.service.third.guahao.GuahaoXMService;
@ -32,6 +34,7 @@ import java.util.*;
/**
 * 预约挂号
 *
 * @author hzp at 2016-08-30
 */
@Controller
@ -39,246 +42,244 @@ import java.util.*;
@Api(description = "预约挂号接口")
public class BookingController extends WeixinBaseController {
	@Autowired
	private GuahaoXMService guahaoXM;
    @Autowired
    private GuahaoXMService guahaoXM;
	@Autowired
	private GuahaoYihuService guahaoYihu;
    @Autowired
    private GuahaoYihuService guahaoYihu;
	@Autowired
	private PatientReservationService patientReservationService;
    @Autowired
    private PatientReservationService patientReservationService;
	@Autowired
	private PatientService patientService;
    @Autowired
    private PatientService patientService;
	/**
	 * 根据城市编码获取相应挂号服务
	 * @return
    @Autowired
    private DoctorService doctorService;
    /**
     * 根据城市编码获取相应挂号服务
     *
     * @return
     */
    private IGuahaoService getService(String city) {
        IGuahaoService re = guahaoYihu;
        if (city != null && city.equals("350200")) {
            re = guahaoXM;
        }
        return re;
    }
    /**
     * 获取机构列表
     */
    @RequestMapping(value = "GetOrgList", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("获取机构列表")
    public String GetOrgList(@ApiParam(name = "city", value = "城市编码", defaultValue = "350200")
                             @RequestParam(value = "city", required = true) String city,
                             @ApiParam(name = "filter", value = "过滤条件", defaultValue = "")
                             @RequestParam(value = "filter", required = false) String filter,
                             @ApiParam(name = "type", value = "类型", defaultValue = "1")
                             @RequestParam(value = "type", required = false) String type,
                             @ApiParam(name = "pageIndex", value = "第几页", defaultValue = "")
                             @RequestParam(value = "pageIndex", required = false) Integer pageIndex,
                             @ApiParam(name = "pageSize", value = "每页记录数", defaultValue = "")
                             @RequestParam(value = "pageSize", required = false) Integer pageSize) {
        try {
            List<Map<String, String>> list = getService(city).GetOrgList(city, filter, type, pageIndex, pageSize);
            return write(200, "获取机构列表成功!", "data", list);
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
    /**
     * 获取科室接口
     */
    @RequestMapping(value = "GetOrgDepList", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("获取科室接口")
    public String GetOrgDepList(@ApiParam(name = "city", value = "城市编码", defaultValue = "350200")
                                @RequestParam(value = "city", required = true) String city,
                                @ApiParam(name = "hospitalId", value = "医院ID", defaultValue = "350211A1001")
                                @RequestParam(value = "hospitalId", required = true) String hospitalId,
                                @ApiParam(name = "filter", value = "过滤条件", defaultValue = "")
                                @RequestParam(value = "filter", required = false) String filter,
                                @ApiParam(name = "pageIndex", value = "第几页", defaultValue = "")
                                @RequestParam(value = "pageIndex", required = false) Integer pageIndex,
                                @ApiParam(name = "pageSize", value = "每页记录数", defaultValue = "")
                                @RequestParam(value = "pageSize", required = false) Integer pageSize) {
        try {
            List<Map<String, String>> list = getService(city).GetOrgDepList(hospitalId, filter, pageIndex, pageSize);
            return write(200, "获取科室列表成功!", "data", list);
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
    /**
     * 获取医生列表接口
     */
    @RequestMapping(value = "GetDoctorList", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("获取医生接口")
    public String GetDoctorList(@ApiParam(name = "city", value = "城市编码", defaultValue = "350200")
                                @RequestParam(value = "city", required = true) String city,
                                @ApiParam(name = "hospitalId", value = "医院ID", defaultValue = "350211A1001")
                                @RequestParam(value = "hospitalId", required = true) String hospitalId,
                                @ApiParam(name = "hosDeptId", value = "科室ID", defaultValue = "1040610")
                                @RequestParam(value = "hosDeptId", required = true) String hosDeptId,
                                @ApiParam(name = "filter", value = "过滤条件", defaultValue = "")
                                @RequestParam(value = "filter", required = false) String filter,
                                @ApiParam(name = "pageIndex", value = "第几页", defaultValue = "")
                                @RequestParam(value = "pageIndex", required = false) Integer pageIndex,
                                @ApiParam(name = "pageSize", value = "每页记录数", defaultValue = "")
                                @RequestParam(value = "pageSize", required = false) Integer pageSize) {
        try {
            List<GuahaoDoctor> list = getService(city).GetDoctorList(hospitalId, hosDeptId, filter, pageIndex, pageSize);
            return write(200, "获取医生列表成功!", "data", list);
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
    /**
     * 获取医生排班接口
     */
    @RequestMapping(value = "GetDoctorArrange", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("获取医生排班接口(包含排班详细)")
    public String GetDoctorArrange(@ApiParam(name = "city", value = "城市编码", defaultValue = "350200")
                                   @RequestParam(value = "city", required = true) String city,
                                   @ApiParam(name = "hospitalId", value = "医院ID", defaultValue = "350211G1102")
                                   @RequestParam(value = "hospitalId", required = true) String hospitalId,
                                   @ApiParam(name = "hosDeptId", value = "科室ID", defaultValue = "3020001")
                                   @RequestParam(value = "hosDeptId", required = true) String hosDeptId,
                                   @ApiParam(name = "doctorId", value = "医生ID", defaultValue = "AA2")
                                   @RequestParam(value = "doctorId", required = true) String doctorId) {
        try {
            List<Map<String, Object>> list = getService(city).GetDoctorArrange(hospitalId, hosDeptId, doctorId);
            return write(200, "获取医生排班成功!", "data", list);
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
    /**
     * 获取医生排班接口
     */
    @RequestMapping(value = "GetDoctorArrangeSimple", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("获取医生排班接口(一级)")
    public String GetDoctorArrangeSimple(@ApiParam(name = "city", value = "城市编码", defaultValue = "350200")
                                         @RequestParam(value = "city", required = true) String city,
                                         @ApiParam(name = "hospitalId", value = "医院ID", defaultValue = "350211A1001")
                                         @RequestParam(value = "hospitalId", required = true) String hospitalId,
                                         @ApiParam(name = "hosDeptId", value = "科室ID", defaultValue = "1010210")
                                         @RequestParam(value = "hosDeptId", required = true) String hosDeptId,
                                         @ApiParam(name = "doctorId", value = "医生ID", defaultValue = "03101")
                                         @RequestParam(value = "doctorId", required = true) String doctorId) {
        try {
            List<Map<String, String>> list = getService(city).GetDoctorArrangeSimple(hospitalId, hosDeptId, doctorId);
            return write(200, "获取医生排班成功!", "data", list);
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
    /**
     * 根据医生编码获取医生详细信息
     */
    @RequestMapping(value = "GetDoctorInfo", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("根据医生编码获取医生详细信息")
    public String GetDoctorInfo(@ApiParam(name = "city", value = "城市编码", defaultValue = "350200")
                                @RequestParam(value = "city", required = true) String city,
                                @ApiParam(name = "doctorId", value = "医生id", defaultValue = "07101")
                                @RequestParam(value = "doctorId", required = true) String doctorId,
                                @ApiParam(name = "hospitalId", value = "医院id", defaultValue = "350211A1001")
                                @RequestParam(value = "hospitalId", required = true) String hospitalId,
                                @ApiParam(name = "hosDeptId", value = "科室id", defaultValue = "1040610")
                                @RequestParam(value = "hosDeptId", required = true) String hosDeptId) {
        try {
            GuahaoDoctor doctor = getService(city).GetDoctorInfo(doctorId, hospitalId, hosDeptId);
            return write(200, "获取医生信息成功!", "data", doctor);
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
    /**
     * 创建挂号单
     */
	private  IGuahaoService getService(String city)
	{
		IGuahaoService re = guahaoYihu;
		if(city!=null && city.equals("350200"))
		{
			re = guahaoXM;
		}
		return re;
	}
	/**
	 * 获取机构列表
	 */
	@RequestMapping(value = "GetOrgList",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("获取机构列表")
	public String GetOrgList(@ApiParam(name="city",value="城市编码",defaultValue = "350200")
							  @RequestParam(value="city",required = true) String city,
							  @ApiParam(name="filter",value="过滤条件",defaultValue = "")
							  @RequestParam(value="filter",required = false) String filter,
							  @ApiParam(name="type",value="类型",defaultValue = "1")
							  @RequestParam(value="type",required = false) String type,
							  @ApiParam(name="pageIndex",value="第几页",defaultValue = "")
							  @RequestParam(value="pageIndex",required = false) Integer pageIndex,
							  @ApiParam(name="pageSize",value="每页记录数",defaultValue = "")
							  @RequestParam(value="pageSize",required = false) Integer pageSize) {
		try {
			List<Map<String,String>> list =  getService(city).GetOrgList(city,filter,type,pageIndex,pageSize);
			return write(200, "获取机构列表成功!", "data", list);
		} catch (Exception e) {
			return error(-1,e.getMessage());
		}
	}
	/**
	 * 获取科室接口
	 */
	@RequestMapping(value = "GetOrgDepList",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("获取科室接口")
	public String GetOrgDepList(@ApiParam(name="city",value="城市编码",defaultValue = "350200")
							  @RequestParam(value="city",required = true) String city,
							  @ApiParam(name="hospitalId",value="医院ID",defaultValue = "350211A1001")
							  @RequestParam(value="hospitalId",required = true) String hospitalId,
							  @ApiParam(name="filter",value="过滤条件",defaultValue = "")
							  @RequestParam(value="filter",required = false) String filter,
							  @ApiParam(name="pageIndex",value="第几页",defaultValue = "")
							  @RequestParam(value="pageIndex",required = false) Integer pageIndex,
							  @ApiParam(name="pageSize",value="每页记录数",defaultValue = "")
							  @RequestParam(value="pageSize",required = false) Integer pageSize) {
		try {
			List<Map<String,String>> list =  getService(city).GetOrgDepList(hospitalId,filter,pageIndex,pageSize);
			return write(200, "获取科室列表成功!", "data", list);
		} catch (Exception e) {
			return error(-1,e.getMessage());
		}
	}
	/**
	 * 获取医生列表接口
	 */
	@RequestMapping(value = "GetDoctorList",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("获取医生接口")
	public String GetDoctorList(@ApiParam(name="city",value="城市编码",defaultValue = "350200")
								@RequestParam(value="city",required = true) String city,
								@ApiParam(name="hospitalId",value="医院ID",defaultValue = "350211A1001")
								@RequestParam(value="hospitalId",required = true) String hospitalId,
								@ApiParam(name="hosDeptId",value="科室ID",defaultValue = "1040610")
								@RequestParam(value="hosDeptId",required = true) String hosDeptId,
								@ApiParam(name="filter",value="过滤条件",defaultValue = "")
								@RequestParam(value="filter",required = false) String filter,
								@ApiParam(name="pageIndex",value="第几页",defaultValue = "")
								@RequestParam(value="pageIndex",required = false) Integer pageIndex,
								@ApiParam(name="pageSize",value="每页记录数",defaultValue = "")
								@RequestParam(value="pageSize",required = false) Integer pageSize) {
		try {
			List<GuahaoDoctor> list =  getService(city).GetDoctorList(hospitalId,hosDeptId,filter,pageIndex,pageSize);
			return write(200, "获取医生列表成功!", "data", list);
		}
		catch (Exception e)
		{
			return error(-1,e.getMessage());
		}
	}
	/**
	 * 获取医生排班接口
	 */
	@RequestMapping(value = "GetDoctorArrange",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("获取医生排班接口(包含排班详细)")
	public String GetDoctorArrange(@ApiParam(name="city",value="城市编码",defaultValue = "350200")
								@RequestParam(value="city",required = true) String city,
								@ApiParam(name="hospitalId",value="医院ID",defaultValue = "350211G1102")
								@RequestParam(value="hospitalId",required = true) String hospitalId,
								@ApiParam(name="hosDeptId",value="科室ID",defaultValue = "3020001")
								@RequestParam(value="hosDeptId",required = true) String hosDeptId,
								@ApiParam(name="doctorId",value="医生ID",defaultValue = "AA2")
								@RequestParam(value="doctorId",required = true) String doctorId) {
		try {
			List<Map<String,Object>> list =  getService(city).GetDoctorArrange(hospitalId,hosDeptId,doctorId);
			return write(200, "获取医生排班成功!", "data", list);
		} catch (Exception e) {
			return error(-1,e.getMessage());
		}
	}
	/**
	 * 获取医生排班接口
	*/
	@RequestMapping(value = "GetDoctorArrangeSimple",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("获取医生排班接口(一级)")
	public String GetDoctorArrangeSimple(@ApiParam(name="city",value="城市编码",defaultValue = "350200")
								   @RequestParam(value="city",required = true) String city,
								   @ApiParam(name="hospitalId",value="医院ID",defaultValue = "350211A1001")
								   @RequestParam(value="hospitalId",required = true) String hospitalId,
								   @ApiParam(name="hosDeptId",value="科室ID",defaultValue = "1010210")
								   @RequestParam(value="hosDeptId",required = true) String hosDeptId,
								   @ApiParam(name="doctorId",value="医生ID",defaultValue = "03101")
								   @RequestParam(value="doctorId",required = true) String doctorId) {
		try {
			List<Map<String,String>> list =  getService(city).GetDoctorArrangeSimple(hospitalId,hosDeptId,doctorId);
			return write(200, "获取医生排班成功!", "data", list);
		} catch (Exception e) {
			return error(-1,e.getMessage());
		}
	}
	/**
	 * 根据医生编码获取医生详细信息
	 */
	@RequestMapping(value = "GetDoctorInfo",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("根据医生编码获取医生详细信息")
	public String GetDoctorInfo(@ApiParam(name="city",value="城市编码",defaultValue = "350200")
								@RequestParam(value="city",required = true) String city,
								@ApiParam(name="doctorId",value="医生id",defaultValue = "07101")
								@RequestParam(value="doctorId",required = true) String doctorId,
								@ApiParam(name="hospitalId",value="医院id",defaultValue = "350211A1001")
								@RequestParam(value="hospitalId",required = true) String hospitalId,
								@ApiParam(name="hosDeptId",value="科室id",defaultValue = "1040610")
								@RequestParam(value="hosDeptId",required = true) String hosDeptId)
	{
		try {
			GuahaoDoctor doctor = getService(city).GetDoctorInfo(doctorId,hospitalId,hosDeptId);
			return write(200, "获取医生信息成功!","data",doctor);
		} catch (Exception e) {
			return error(-1,e.getMessage());
		}
	}
	/**
	 * 创建挂号单
	 */
	@RequestMapping(value = "CreateOrder",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("创建挂号单")
	public String CreateOrder(@ApiParam(name="city",value="城市编码",defaultValue = "350200")
								   @RequestParam(value="city",required = true) String city,
								   @ApiParam(name="hospitalId",value="医院ID",defaultValue = "350211A1001")
								   @RequestParam(value="hospitalId",required = true) String hospitalId,
							       @ApiParam(name="hospitalName",value="医院名称",defaultValue = "厦门大学附属第一医院")
								   @RequestParam(value="hospitalName",required = true) String hospitalName,
								   @ApiParam(name="hosDeptId",value="科室ID",defaultValue = "1040610")
								   @RequestParam(value="hosDeptId",required = true) String hosDeptId,
							       @ApiParam(name="hosDeptName",value="医院科室名称",defaultValue = "儿二科")
								   @RequestParam(value="hosDeptName",required = true) String hosDeptName,
								   @ApiParam(name="doctorId",value="医生ID",defaultValue = "07101")
								   @RequestParam(value="doctorId",required = true) String doctorId,
							       @ApiParam(name="doctorName",value="医生姓名",defaultValue = "林素莲")
								   @RequestParam(value="doctorName",required = true) String doctorName,
							       @ApiParam(name="arrangeDate",value="排班信息",defaultValue = "{\"sectionType\":\"a\",\"startTime\":\"2016-09-02 08:20:00\",\"endTime\":\"2016-09-02 08:30:00\"}")
								   @RequestParam(value="arrangeDate",required = true) String arrangeDate,
							       @ApiParam(name="patient",value="患者代码",defaultValue = "01954b2ebbb24a40a05da9d2f5c94795")
								   @RequestParam(value="patient",required = true) String patient,
							       @ApiParam(name="patientName",value="患者姓名",defaultValue = "张锦川")
								   @RequestParam(value="patientName",required = true) String patientName,
							       @ApiParam(name="cardNo",value="身份证号码",defaultValue = "35052419880511553X")
								   @RequestParam(value="cardNo",required = true) String cardNo,
							       @ApiParam(name="clinicCard",value="市民卡号",defaultValue = "D57117706")
								   @RequestParam(value="clinicCard",required = true) String clinicCard,
							       @ApiParam(name="patientPhone",value="患者手机",defaultValue = "13950116510")
								   @RequestParam(value="patientPhone",required = true) String patientPhone) {
		try {
			if (StringUtils.isEmpty(patientName)) {
				return error(-1, "未设置姓名!");
			}
			if (StringUtils.isEmpty(cardNo)) {
				return error(-1, "未设置身份证号!");
			}
			if (StringUtils.isEmpty(clinicCard)) {
				return error(-1, "未设置社保卡号!");
			}
			if (StringUtils.isEmpty(patientPhone)) {
				return error(-1, "未设置手机号码!");
			}
			String orderCode =  getService(city).CreateOrder(hospitalId,hospitalName,hosDeptId,hosDeptName,doctorId,doctorName,arrangeDate,patient,patientName,cardNo,clinicCard,patientPhone,null,null);
			//预约发送微信消息
			PatientReservation obj = patientReservationService.findByCode(orderCode);
			if(obj!=null)
			{
				Patient p = patientService.findByCode(obj.getPatient());
				String msg = "您成功预约了 " + obj.getOrgName() + " " + obj.getDoctorName() + " " + obj.getStartTime() + " 的号源!";
				if (StringUtils.isNotEmpty(p.getOpenid())) {
					// 推送消息给微信端
					JSONObject json = new JSONObject();
					json.put("first", "预约挂号提醒");
					json.put("toUser", p.getCode());
					json.put("id",obj.getId());
					json.put("date", obj.getStartTime());
					json.put("orgName", obj.getOrgName());
					json.put("doctorName", obj.getDoctorName());
					json.put("deptName", obj.getDeptName());
					json.put("remark", msg);
					PushMsgTask.getInstance().putWxMsg(getAccessToken(), 6, p.getOpenid(), p.getName(), json);
				}
				//发送短信小时
				// 调用总部发送信息的接口
				String result = HttpClientUtil.post(SystemConf.getInstance().getSmsUrl(), buildSmsParams(msg, p.getMobile()), "GBK");
				JSONObject json = toJson(result);
    @RequestMapping(value = "CreateOrder", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("创建挂号单")
    public String CreateOrder(@ApiParam(name = "city", value = "城市编码", defaultValue = "350200")
                              @RequestParam(value = "city", required = true) String city,
                              @ApiParam(name = "hospitalId", value = "医院ID", defaultValue = "350211A1001")
                              @RequestParam(value = "hospitalId", required = true) String hospitalId,
                              @ApiParam(name = "hospitalName", value = "医院名称", defaultValue = "厦门大学附属第一医院")
                              @RequestParam(value = "hospitalName", required = true) String hospitalName,
                              @ApiParam(name = "hosDeptId", value = "科室ID", defaultValue = "1040610")
                              @RequestParam(value = "hosDeptId", required = true) String hosDeptId,
                              @ApiParam(name = "hosDeptName", value = "医院科室名称", defaultValue = "儿二科")
                              @RequestParam(value = "hosDeptName", required = true) String hosDeptName,
                              @ApiParam(name = "doctorId", value = "医生ID", defaultValue = "07101")
                              @RequestParam(value = "doctorId", required = true) String doctorId,
                              @ApiParam(name = "doctorName", value = "医生姓名", defaultValue = "林素莲")
                              @RequestParam(value = "doctorName", required = true) String doctorName,
                              @ApiParam(name = "arrangeDate", value = "排班信息", defaultValue = "{\"sectionType\":\"a\",\"startTime\":\"2016-09-02 08:20:00\",\"endTime\":\"2016-09-02 08:30:00\"}")
                              @RequestParam(value = "arrangeDate", required = true) String arrangeDate,
                              @ApiParam(name = "patient", value = "患者代码", defaultValue = "01954b2ebbb24a40a05da9d2f5c94795")
                              @RequestParam(value = "patient", required = true) String patient,
                              @ApiParam(name = "patientName", value = "患者姓名", defaultValue = "张锦川")
                              @RequestParam(value = "patientName", required = true) String patientName,
                              @ApiParam(name = "cardNo", value = "身份证号码", defaultValue = "35052419880511553X")
                              @RequestParam(value = "cardNo", required = true) String cardNo,
                              @ApiParam(name = "clinicCard", value = "市民卡号", defaultValue = "D57117706")
                              @RequestParam(value = "clinicCard", required = true) String clinicCard,
                              @ApiParam(name = "patientPhone", value = "患者手机", defaultValue = "13950116510")
                              @RequestParam(value = "patientPhone", required = true) String patientPhone) {
        try {
            if (StringUtils.isEmpty(patientName)) {
                return error(-1, "未设置姓名!");
            }
            if (StringUtils.isEmpty(cardNo)) {
                return error(-1, "未设置身份证号!");
            }
            if (StringUtils.isEmpty(clinicCard)) {
                return error(-1, "未设置社保卡号!");
            }
            if (StringUtils.isEmpty(patientPhone)) {
                return error(-1, "未设置手机号码!");
            }
            String orderCode = getService(city).CreateOrder(hospitalId, hospitalName, hosDeptId, hosDeptName, doctorId, doctorName, arrangeDate, patient, patientName, cardNo, clinicCard, patientPhone, null, null);
            //预约发送微信消息
            PatientReservation obj = patientReservationService.findByCode(orderCode);
            if (obj != null) {
                Patient p = patientService.findByCode(obj.getPatient());
                String msg = "您成功预约了 " + obj.getOrgName() + " " + obj.getDoctorName() + " " + obj.getStartTime() + " 的号源!";
                if (StringUtils.isNotEmpty(p.getOpenid())) {
                    // 推送消息给微信端
                    JSONObject json = new JSONObject();
                    json.put("first", "");
                    json.put("toUser", p.getCode());
                    json.put("id", obj.getId());
                    json.put("date", obj.getStartTime());
                    json.put("orgName", obj.getOrgName());
                    json.put("doctorName", obj.getDoctorName());
                    json.put("deptName", obj.getDeptName());
                    json.put("remark", p.getName() + ",您好!" + msg);
                    PushMsgTask.getInstance().putWxMsg(getAccessToken(), 6, p.getOpenid(), p.getName(), json);
                }
                //发送短信小时
                // 调用总部发送信息的接口
                //String result = HttpClientUtil.post(SystemConf.getInstance().getSmsUrl(), buildSmsParams(msg, p.getMobile()), "GBK");
                //JSONObject json = toJson(result);
//				if (json == null) {
//					// 发送失败
//					throw new Exception("短信发送失败!");
@ -287,370 +288,358 @@ public class BookingController extends WeixinBaseController {
//				} else {
//					//发送成功,保存到数据库
//				}
				return write(200, "创建挂号单成功!");
			}
			else{
				return error(-1,"创建挂号单失败!");
			}
		}
		catch (Exception e) {
			return error(-1,e.getMessage());
		}
	}
	public static List<NameValuePair> buildSmsParams(String content, String mobile) {
		List<NameValuePair> params = new ArrayList<NameValuePair>();
		params.add(new BasicNameValuePair("SpCode", SystemConf.getInstance().getSmsCode()));
		params.add(new BasicNameValuePair("LoginName", SystemConf.getInstance().getSmsName()));
		params.add(new BasicNameValuePair("Password", SystemConf.getInstance().getSmsPassword()));
		params.add(new BasicNameValuePair("MessageContent", content));
		params.add(new BasicNameValuePair("UserNumber", mobile));
		params.add(new BasicNameValuePair("SerialNumber", String.valueOf(System.currentTimeMillis())));
		params.add(new BasicNameValuePair("ScheduleTime", ""));
		params.add(new BasicNameValuePair("f", "1"));
		return params;
	}
	public static JSONObject toJson(String result) {
		JSONObject json = new JSONObject();
		try {
			String[] temps = result.split("&");
			for (String temp : temps) {
				if (temp.split("=").length != 2) {
					continue;
				}
				String key = temp.split("=")[0];
				String value = temp.split("=")[1];
				json.put(key, value);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return json;
	}
	/**
	 * 创建挂号单
	 */
	@RequestMapping(value = "CreateOrderByDoctor",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("创建挂号单")
	public String CreateOrderByDoctor(@ApiParam(name="city",value="城市编码",defaultValue = "350200")
							  @RequestParam(value="city",required = true) String city,
							  @ApiParam(name="hospitalId",value="医院ID",defaultValue = "350211A1001")
							  @RequestParam(value="hospitalId",required = true) String hospitalId,
							  @ApiParam(name="hospitalName",value="医院名称",defaultValue = "厦门大学附属第一医院")
							  @RequestParam(value="hospitalName",required = true) String hospitalName,
							  @ApiParam(name="hosDeptId",value="科室ID",defaultValue = "1040610")
							  @RequestParam(value="hosDeptId",required = true) String hosDeptId,
							  @ApiParam(name="hosDeptName",value="医院科室名称",defaultValue = "儿二科")
							  @RequestParam(value="hosDeptName",required = true) String hosDeptName,
							  @ApiParam(name="doctorId",value="医生ID",defaultValue = "07101")
							  @RequestParam(value="doctorId",required = true) String doctorId,
							  @ApiParam(name="doctorName",value="医生姓名",defaultValue = "林素莲")
							  @RequestParam(value="doctorName",required = true) String doctorName,
							  @ApiParam(name="arrangeDate",value="排班信息",defaultValue = "{\"sectionType\":\"a\",\"startTime\":\"2016-09-02 08:20:00\",\"endTime\":\"2016-09-02 08:30:00\"}")
							  @RequestParam(value="arrangeDate",required = true) String arrangeDate,
							  @ApiParam(name="patient",value="患者代码",defaultValue = "01954b2ebbb24a40a05da9d2f5c94795")
							  @RequestParam(value="patient",required = true) String patient,
							  @ApiParam(name="patientName",value="患者姓名",defaultValue = "张锦川")
							  @RequestParam(value="patientName",required = true) String patientName,
							  @ApiParam(name="cardNo",value="身份证号码",defaultValue = "35052419880511553X")
							  @RequestParam(value="cardNo",required = true) String cardNo,
							  @ApiParam(name="clinicCard",value="市民卡号",defaultValue = "D57117706")
							  @RequestParam(value="clinicCard",required = true) String clinicCard,
							  @ApiParam(name="patientPhone",value="患者手机",defaultValue = "13950116510")
							  @RequestParam(value="patientPhone",required = true) String patientPhone,
                              @ApiParam(name="dcode",value="代预约医生编号",defaultValue = "test00000000005")
							  @RequestParam(value="dcode",required = true) String dcode,
							  @ApiParam(name="dname",value="代预约医生名称",defaultValue = "组2全科医生")
					 		  @RequestParam(value="dname",required = true) String dname) {
		try {
			if (StringUtils.isEmpty(patientName)) {
				return error(-1, "未设置姓名!");
			}
			if (StringUtils.isEmpty(cardNo)) {
				return error(-1, "未设置身份证号!");
			}
			if (StringUtils.isEmpty(clinicCard)) {
				return error(-1, "未设置社保卡号!");
			}
			if (StringUtils.isEmpty(patientPhone)) {
				return error(-1, "未设置手机号码!");
			}
			String orderCode =  getService(city).CreateOrder(hospitalId,hospitalName,hosDeptId,hosDeptName,doctorId,doctorName,arrangeDate,patient,patientName,cardNo,clinicCard,patientPhone,dname,dcode);
			//获取预约信息查询是否挂号成功
			PatientReservation obj = patientReservationService.findByCode(orderCode);
			if(obj!=null)
			{
				Patient p = patientService.findByCode(obj.getPatient());
				String msg = "您成功预约了 " + obj.getOrgName() + " " + obj.getDoctorName() + " " + obj.getStartTime() + " 的号源!";
				if (StringUtils.isNotEmpty(p.getOpenid())) {
					// 推送消息给微信端
					JSONObject json = new JSONObject();
					json.put("first", "预约挂号提醒");
					json.put("toUser", p.getCode());
					json.put("id",obj.getId());
					json.put("date", obj.getStartTime());
					json.put("orgName", obj.getOrgName());
					json.put("doctorName", obj.getDoctorName());
					json.put("deptName", obj.getDeptName());
					json.put("remark", msg);
					PushMsgTask.getInstance().putWxMsg(getAccessToken(), 6, p.getOpenid(), p.getName(), json);
				}
				//发送短信小时
				// 调用总部发送信息的接口
				String result = HttpClientUtil.post(SystemConf.getInstance().getSmsUrl(), buildSmsParams(msg, p.getMobile()), "GBK");
				return write(200, "创建挂号单成功!");
			}
			else{
				return error(-1,"创建挂号单失败!");
			}
		}
		catch (Exception e) {
			return error(-1,e.getMessage());
		}
	}
	/**
	 * 取消挂号单
	 */
	@RequestMapping(value = "CancelOrder",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("取消挂号单")
	public String CancelOrder(@ApiParam(name="orderId",value="订单id",defaultValue = "9")
							  @RequestParam(value="orderId",required = true) String orderId) {
		try {
			//获取订单信息
			PatientReservation obj = patientReservationService.findById(orderId);
			boolean re = false;
			if(obj!=null) {
				String type = obj.getType();
				String code = obj.getCode();
				if (type.equals("0")) {  //医护网接口
					re = guahaoYihu.CancelOrder(code);
				}
				else if (type.equals("1"))   //厦门市民健康预约接口
				{
					re = guahaoXM.CancelOrder(code,obj.getSsc());
				}
			}
			if(re)
			{
				//更新状态
				patientReservationService.updateStatus(obj.getCode(),0);
				//微信消息
				Patient p = patientService.findByCode(obj.getPatient());
				if (StringUtils.isNotEmpty(p.getOpenid())) {
					JSONObject json = new JSONObject();
					json.put("first", "取消预约挂号提醒");
					json.put("toUser", p.getCode());
					json.put("name", obj.getName());
					json.put("date", obj.getStartTime());
					json.put("doctorName", obj.getDoctorName());
					json.put("orgName", obj.getOrgName());
					json.put("remark", "您好,您已取消了" + obj.getStartTime() + "的挂号!");
					PushMsgTask.getInstance().putWxMsg(getAccessToken(), 7, p.getOpenid(), obj.getName(), json);
				}
				return write(200, "取消挂号单成功!");
			}
			else{
				return error(-1,"取消挂号单失败!");
			}
		} catch (Exception e) {
			return error(-1,e.getMessage());
		}
	}
	/**
	 * 获取患者预约信息列表接口
	 */
	@RequestMapping(value = "GetPatientReservationList",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("获取患者预约信息列表接口-医生端")
	public String GetPatientReservation(@ApiParam(name="pageIndex",value="第几页",defaultValue = "1")
										@RequestParam(value="pageIndex",required = false) Integer pageIndex,
										@ApiParam(name="pageSize",value="每页记录数",defaultValue = "10")
										@RequestParam(value="pageSize",required = false) Integer pageSize,
										@ApiParam(name="patient",value="患者编号",defaultValue = "10")
										@RequestParam(value="patient",required = false) String patient,
										@ApiParam(name="doctor",value="医生编号",defaultValue = "10")
										@RequestParam(value="doctor",required = false) String doctor) {
		try {
			List<PatientReservation> list =  patientReservationService.getReservationByPatient(patient,doctor,pageIndex,pageSize);
			//遍历更新预约状态
			for(PatientReservation item :list)
			{
				String type = item.getType();
				String code = item.getCode();
				if (type.equals("0")) {  //医护网接口
				}
				else if (type.equals("1"))   //厦门市民健康预约接口
				{
					Integer status = guahaoXM.GetOrderStatus(item.getOrgCode(),code,item.getSsc());
					//更新状态
					if(status!=null) {
						patientReservationService.updateStatus(item.getCode(), 0);
						item.setStatus(status);
					}
				}
			}
			return write(200, "获取患者预约信息列表成功!", "data", list);
		} catch (Exception e) {
			return error(-1,e.getMessage());
		}
	}
	/**
	 * 获取医生代预约信息列表接口
	 */
	@RequestMapping(value = "GetDoctorReservationList",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("获取医生代预约信息列表接口-医生端")
	public String GetDoctorReservation(@ApiParam(name="pageIndex",value="第几页",defaultValue = "1")
										@RequestParam(value="pageIndex",required = false) Integer pageIndex,
										@ApiParam(name="pageSize",value="每页记录数",defaultValue = "10")
										@RequestParam(value="pageSize",required = false) Integer pageSize,
										@ApiParam(name="doctor",value="医生编号",defaultValue = "10")
										@RequestParam(value="doctor",required = false) String doctor) {
		try {
			List<PatientReservation> list =  patientReservationService.getReservationByDoctor(doctor,pageIndex,pageSize);
			//遍历更新预约状态
			for(PatientReservation item :list)
			{
				String type = item.getType();
				String code = item.getCode();
				if (type.equals("0")) {  //医护网接口
				}
				else if (type.equals("1"))   //厦门市民健康预约接口
				{
					Integer status = guahaoXM.GetOrderStatus(item.getOrgCode(),code,item.getSsc());
					//更新状态
					if(status!=null) {
						patientReservationService.updateStatus(item.getCode(), 0);
						item.setStatus(status);
					}
				}
			}
			return write(200, "获取患者预约信息列表成功!", "data", list);
		} catch (Exception e) {
			return error(-1,e.getMessage());
		}
	}
	/**
	 * 获取患者预约信息列表接口
	 */
	@RequestMapping(value = "GetRegList",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("获取患者预约信息列表接口--患者端")
	public String GetRegList(@ApiParam(name="patient",value="患者编号",defaultValue = "1")
										@RequestParam(value="patient",required = false) String patient) {
		try {
			SimpleDateFormat sm = new SimpleDateFormat("yyyy-MM-dd");
			Date nowDate = new Date();
			Date threeMonthBefore = getMonthBefore(nowDate, 3);
			List<PatientReservation> list  = guahaoXM.GetRegList(patient,sm.format(threeMonthBefore),sm.format(nowDate));
			return write(200, "获取患者预约信息列表成功!", "data", list);
		} catch (Exception e) {
			return error(-1,e.getMessage());
		}
	}
	public static Date getMonthBefore(Date d, int month) {
		Calendar now = Calendar.getInstance();
		now.setTime(d);
		now.set(Calendar.MONTH, now.get(Calendar.MONTH) - month);
		return now.getTime();
	}
	/**
	 * 获取患者预约信息单条
	 */
	@RequestMapping(value = "GetPatientReservation",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("获取患者预约信息单条-医生端")
	public String GetPatientReservation(@ApiParam(name="orderId",value="订单id",defaultValue = "9")
										 @RequestParam(value="orderId",required = true) String orderId) {
		try {
			PatientReservation obj = null;
			try{
				obj =  patientReservationService.findById(orderId);
			}catch (Exception e){
				obj = patientReservationService.findByCode(orderId);
			}
			if(obj!=null) {
				String type = obj.getType();
				String code = obj.getCode();
				Integer status = null;
				if (type.equals("0")) {  //医护网接口
				}
				else if (type.equals("1"))   //厦门市民健康预约接口
				{
					status = guahaoXM.GetOrderStatus(obj.getOrgCode(), code, obj.getSsc());
				}
				//更新状态
				if (status != null) {
					patientReservationService.updateStatus(obj.getCode(), 0);
					obj.setStatus(status);
				}
				return write(200, "获取患者预约信息成功!", "data", obj);
			}
			else{
				return error(-1,"不存在该条预约信息!");
			}
		} catch (Exception e) {
			return error(-1,e.getMessage());
		}
	}
	/**
	 * 获取患者预约信息单条
	 */
	@RequestMapping(value = "GetPatientReservationXm",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("获取患者预约信息单条-患者端")
	public String GetPatientReservationXm(@ApiParam(name="patientCode",value="患者编号")
										@RequestParam(value="patientCode",required = true) String patientCode,
										@ApiParam(name="orgCode",value="机构编码")
										@RequestParam(value="orgCode",required = true) String orgCode,
										@ApiParam(name="regCode",value="挂号单号")
										@RequestParam(value="regCode",required = true) String regCode) {
		try {
			PatientReservation obj =  guahaoXM.getRegDetail(patientCode,orgCode,regCode);
			return write(200, "获取患者预约信息成功!", "data", obj);
		} catch (Exception e) {
			return error(-1,e.getMessage());
		}
	}
	/**
	 * 获取医生为患者预约的总数
	 */
	@RequestMapping(value = "CountReservationByDoctorForPatient",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("获取患者预约信息单条-患者端")
	public String CountReservationByDoctorForPatient(@ApiParam(name="doctor",value="医生编号")
										  @RequestParam(value="doctor",required = true) String doctor,
										  @ApiParam(name="patient",value="患者编号")
										  @RequestParam(value="patient",required = true) String patient) {
		try {
			Long obj =  patientReservationService.countReservationByDoctorForPatient(doctor, patient);
			return write(200, "获取患者预约信息成功!", "data", obj);
		} catch (Exception e) {
			return error(-1,e.getMessage());
		}
	}
                return write(200, "创建挂号单成功!");
            } else {
                return error(-1, "创建挂号单失败!");
            }
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
    public static List<NameValuePair> buildSmsParams(String content, String mobile) {
        List<NameValuePair> params = new ArrayList<NameValuePair>();
        params.add(new BasicNameValuePair("SpCode", SystemConf.getInstance().getSmsCode()));
        params.add(new BasicNameValuePair("LoginName", SystemConf.getInstance().getSmsName()));
        params.add(new BasicNameValuePair("Password", SystemConf.getInstance().getSmsPassword()));
        params.add(new BasicNameValuePair("MessageContent", content));
        params.add(new BasicNameValuePair("UserNumber", mobile));
        params.add(new BasicNameValuePair("SerialNumber", String.valueOf(System.currentTimeMillis())));
        params.add(new BasicNameValuePair("ScheduleTime", ""));
        params.add(new BasicNameValuePair("f", "1"));
        return params;
    }
    public static JSONObject toJson(String result) {
        JSONObject json = new JSONObject();
        try {
            String[] temps = result.split("&");
            for (String temp : temps) {
                if (temp.split("=").length != 2) {
                    continue;
                }
                String key = temp.split("=")[0];
                String value = temp.split("=")[1];
                json.put(key, value);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return json;
    }
    /**
     * 创建挂号单
     */
    @RequestMapping(value = "CreateOrderByDoctor", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("创建挂号单")
    public String CreateOrderByDoctor(@ApiParam(name = "city", value = "城市编码", defaultValue = "350200")
                                      @RequestParam(value = "city", required = true) String city,
                                      @ApiParam(name = "hospitalId", value = "医院ID", defaultValue = "350211A1001")
                                      @RequestParam(value = "hospitalId", required = true) String hospitalId,
                                      @ApiParam(name = "hospitalName", value = "医院名称", defaultValue = "厦门大学附属第一医院")
                                      @RequestParam(value = "hospitalName", required = true) String hospitalName,
                                      @ApiParam(name = "hosDeptId", value = "科室ID", defaultValue = "1040610")
                                      @RequestParam(value = "hosDeptId", required = true) String hosDeptId,
                                      @ApiParam(name = "hosDeptName", value = "医院科室名称", defaultValue = "儿二科")
                                      @RequestParam(value = "hosDeptName", required = true) String hosDeptName,
                                      @ApiParam(name = "doctorId", value = "医生ID", defaultValue = "07101")
                                      @RequestParam(value = "doctorId", required = true) String doctorId,
                                      @ApiParam(name = "doctorName", value = "医生姓名", defaultValue = "林素莲")
                                      @RequestParam(value = "doctorName", required = true) String doctorName,
                                      @ApiParam(name = "arrangeDate", value = "排班信息", defaultValue = "{\"sectionType\":\"a\",\"startTime\":\"2016-09-02 08:20:00\",\"endTime\":\"2016-09-02 08:30:00\"}")
                                      @RequestParam(value = "arrangeDate", required = true) String arrangeDate,
                                      @ApiParam(name = "patient", value = "患者代码", defaultValue = "01954b2ebbb24a40a05da9d2f5c94795")
                                      @RequestParam(value = "patient", required = true) String patient,
                                      @ApiParam(name = "patientName", value = "患者姓名", defaultValue = "张锦川")
                                      @RequestParam(value = "patientName", required = true) String patientName,
                                      @ApiParam(name = "cardNo", value = "身份证号码", defaultValue = "35052419880511553X")
                                      @RequestParam(value = "cardNo", required = true) String cardNo,
                                      @ApiParam(name = "clinicCard", value = "市民卡号", defaultValue = "D57117706")
                                      @RequestParam(value = "clinicCard", required = true) String clinicCard,
                                      @ApiParam(name = "patientPhone", value = "患者手机", defaultValue = "13950116510")
                                      @RequestParam(value = "patientPhone", required = true) String patientPhone,
                                      @ApiParam(name = "dcode", value = "代预约医生编号", defaultValue = "test00000000005")
                                      @RequestParam(value = "dcode", required = true) String dcode,
                                      @ApiParam(name = "dname", value = "代预约医生名称", defaultValue = "组2全科医生")
                                      @RequestParam(value = "dname", required = true) String dname) {
        try {
            if (StringUtils.isEmpty(patientName)) {
                return error(-1, "未设置姓名!");
            }
            if (StringUtils.isEmpty(cardNo)) {
                return error(-1, "未设置身份证号!");
            }
            if (StringUtils.isEmpty(clinicCard)) {
                return error(-1, "未设置社保卡号!");
            }
            if (StringUtils.isEmpty(patientPhone)) {
                return error(-1, "未设置手机号码!");
            }
            String orderCode = getService(city).CreateOrder(hospitalId, hospitalName, hosDeptId, hosDeptName, doctorId, doctorName, arrangeDate, patient, patientName, cardNo, clinicCard, patientPhone, dname, dcode);
            //获取预约信息查询是否挂号成功
            PatientReservation obj = patientReservationService.findByCode(orderCode);
            if (obj != null) {
                Patient p = patientService.findByCode(obj.getPatient());
                Doctor d = doctorService.findDoctorByCode(getUID());
                String msg = d.getName() + "医生已成功为您预约:" + obj.getStartTime() + "," + obj.getOrgName() +
                        obj.getDeptName() + obj.getDeptName() + "医生的号源。您可直接前往医院就诊。";
                if (StringUtils.isNotEmpty(p.getOpenid())) {
                    // 推送消息给微信端
                    JSONObject json = new JSONObject();
                    json.put("first", "");
                    json.put("toUser", p.getCode());
                    json.put("id", obj.getId());
                    json.put("date", obj.getStartTime());
                    json.put("orgName", obj.getOrgName());
                    json.put("doctorName", obj.getDeptName());
                    json.put("deptName", obj.getDeptName());
                    json.put("remark", p.getName() + ",您好!\n" + msg);
                    PushMsgTask.getInstance().putWxMsg(getAccessToken(), 6, p.getOpenid(), p.getName(), json);
                }
                //发送短信小时
                // 调用总部发送信息的接口
                String result = HttpClientUtil.post(SystemConf.getInstance().getSmsUrl(), buildSmsParams(msg, p.getMobile()), "GBK");
                return write(200, "创建挂号单成功!");
            } else {
                return error(-1, "创建挂号单失败!");
            }
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
    /**
     * 取消挂号单
     */
    @RequestMapping(value = "CancelOrder", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("取消挂号单")
    public String CancelOrder(@ApiParam(name = "orderId", value = "订单id", defaultValue = "9")
                              @RequestParam(value = "orderId", required = true) String orderId) {
        try {
            //获取订单信息
            PatientReservation obj = patientReservationService.findById(orderId);
            boolean re = false;
            if (obj != null) {
                String type = obj.getType();
                String code = obj.getCode();
                if (type.equals("0")) {  //医护网接口
                    re = guahaoYihu.CancelOrder(code);
                } else if (type.equals("1"))   //厦门市民健康预约接口
                {
                    re = guahaoXM.CancelOrder(code, obj.getSsc());
                }
            }
            if (re) {
                //更新状态
                patientReservationService.updateStatus(obj.getCode(), 0);
                //微信消息
                Patient p = patientService.findByCode(obj.getPatient());
                if (StringUtils.isNotEmpty(p.getOpenid())) {
                    JSONObject json = new JSONObject();
                    json.put("first", "");
                    json.put("toUser", p.getCode());
                    json.put("name", obj.getName());
                    json.put("date", obj.getStartTime());
                    json.put("doctorName", obj.getDoctorName());
                    json.put("orgName", obj.getOrgName());
                    json.put("remark", obj.getName() + ",您好!\n您已取消了" + obj.getStartTime() + "的挂号!");
                    PushMsgTask.getInstance().putWxMsg(getAccessToken(), 7, p.getOpenid(), obj.getName(), json);
                }
                return write(200, "取消挂号单成功!");
            } else {
                return error(-1, "取消挂号单失败!");
            }
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
    /**
     * 获取患者预约信息列表接口
     */
    @RequestMapping(value = "GetPatientReservationList", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("获取患者预约信息列表接口-医生端")
    public String GetPatientReservation(@ApiParam(name = "pageIndex", value = "第几页", defaultValue = "1")
                                        @RequestParam(value = "pageIndex", required = false) Integer pageIndex,
                                        @ApiParam(name = "pageSize", value = "每页记录数", defaultValue = "10")
                                        @RequestParam(value = "pageSize", required = false) Integer pageSize,
                                        @ApiParam(name = "patient", value = "患者编号", defaultValue = "10")
                                        @RequestParam(value = "patient", required = false) String patient,
                                        @ApiParam(name = "doctor", value = "医生编号", defaultValue = "10")
                                        @RequestParam(value = "doctor", required = false) String doctor) {
        try {
            List<PatientReservation> list = patientReservationService.getReservationByPatient(patient, doctor, pageIndex, pageSize);
            //遍历更新预约状态
            for (PatientReservation item : list) {
                String type = item.getType();
                String code = item.getCode();
                if (type.equals("0")) {  //医护网接口
                } else if (type.equals("1"))   //厦门市民健康预约接口
                {
                    Integer status = guahaoXM.GetOrderStatus(item.getOrgCode(), code, item.getSsc());
                    //更新状态
                    if (status != null) {
                        patientReservationService.updateStatus(item.getCode(), 0);
                        item.setStatus(status);
                    }
                }
            }
            return write(200, "获取患者预约信息列表成功!", "data", list);
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
    /**
     * 获取医生代预约信息列表接口
     */
    @RequestMapping(value = "GetDoctorReservationList", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("获取医生代预约信息列表接口-医生端")
    public String GetDoctorReservation(@ApiParam(name = "pageIndex", value = "第几页", defaultValue = "1")
                                       @RequestParam(value = "pageIndex", required = false) Integer pageIndex,
                                       @ApiParam(name = "pageSize", value = "每页记录数", defaultValue = "10")
                                       @RequestParam(value = "pageSize", required = false) Integer pageSize,
                                       @ApiParam(name = "doctor", value = "医生编号", defaultValue = "10")
                                       @RequestParam(value = "doctor", required = false) String doctor) {
        try {
            List<PatientReservation> list = patientReservationService.getReservationByDoctor(doctor, pageIndex, pageSize);
            //遍历更新预约状态
            for (PatientReservation item : list) {
                String type = item.getType();
                String code = item.getCode();
                if (type.equals("0")) {  //医护网接口
                } else if (type.equals("1"))   //厦门市民健康预约接口
                {
                    Integer status = guahaoXM.GetOrderStatus(item.getOrgCode(), code, item.getSsc());
                    //更新状态
                    if (status != null) {
                        patientReservationService.updateStatus(item.getCode(), 0);
                        item.setStatus(status);
                    }
                }
            }
            return write(200, "获取患者预约信息列表成功!", "data", list);
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
    /**
     * 获取患者预约信息列表接口
     */
    @RequestMapping(value = "GetRegList", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("获取患者预约信息列表接口--患者端")
    public String GetRegList(@ApiParam(name = "patient", value = "患者编号", defaultValue = "1")
                             @RequestParam(value = "patient", required = false) String patient) {
        try {
            SimpleDateFormat sm = new SimpleDateFormat("yyyy-MM-dd");
            Date nowDate = new Date();
            Date threeMonthBefore = getMonthBefore(nowDate, 3);
            List<PatientReservation> list = guahaoXM.GetRegList(patient, sm.format(threeMonthBefore), sm.format(nowDate));
            return write(200, "获取患者预约信息列表成功!", "data", list);
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
    public static Date getMonthBefore(Date d, int month) {
        Calendar now = Calendar.getInstance();
        now.setTime(d);
        now.set(Calendar.MONTH, now.get(Calendar.MONTH) - month);
        return now.getTime();
    }
    /**
     * 获取患者预约信息单条
     */
    @RequestMapping(value = "GetPatientReservation", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("获取患者预约信息单条-医生端")
    public String GetPatientReservation(@ApiParam(name = "orderId", value = "订单id", defaultValue = "9")
                                        @RequestParam(value = "orderId", required = true) String orderId) {
        try {
            PatientReservation obj = null;
            try {
                obj = patientReservationService.findById(orderId);
            } catch (Exception e) {
                obj = patientReservationService.findByCode(orderId);
            }
            if (obj != null) {
                String type = obj.getType();
                String code = obj.getCode();
                Integer status = null;
                if (type.equals("0")) {  //医护网接口
                } else if (type.equals("1"))   //厦门市民健康预约接口
                {
                    status = guahaoXM.GetOrderStatus(obj.getOrgCode(), code, obj.getSsc());
                }
                //更新状态
                if (status != null) {
                    patientReservationService.updateStatus(obj.getCode(), 0);
                    obj.setStatus(status);
                }
                return write(200, "获取患者预约信息成功!", "data", obj);
            } else {
                return error(-1, "不存在该条预约信息!");
            }
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
    /**
     * 获取患者预约信息单条
     */
    @RequestMapping(value = "GetPatientReservationXm", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("获取患者预约信息单条-患者端")
    public String GetPatientReservationXm(@ApiParam(name = "patientCode", value = "患者编号")
                                          @RequestParam(value = "patientCode", required = true) String patientCode,
                                          @ApiParam(name = "orgCode", value = "机构编码")
                                          @RequestParam(value = "orgCode", required = true) String orgCode,
                                          @ApiParam(name = "regCode", value = "挂号单号")
                                          @RequestParam(value = "regCode", required = true) String regCode) {
        try {
            PatientReservation obj = guahaoXM.getRegDetail(patientCode, orgCode, regCode);
            return write(200, "获取患者预约信息成功!", "data", obj);
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
    /**
     * 获取医生为患者预约的总数
     */
    @RequestMapping(value = "CountReservationByDoctorForPatient", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("获取患者预约信息单条-患者端")
    public String CountReservationByDoctorForPatient(@ApiParam(name = "doctor", value = "医生编号")
                                                     @RequestParam(value = "doctor", required = true) String doctor,
                                                     @ApiParam(name = "patient", value = "患者编号")
                                                     @RequestParam(value = "patient", required = true) String patient) {
        try {
            Long obj = patientReservationService.countReservationByDoctorForPatient(doctor, patient);
            return write(200, "获取患者预约信息成功!", "data", obj);
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
}

+ 7 - 1
patient-co-wlyy/src/main/resources/config/fdfs_client.conf

@ -5,5 +5,11 @@ http.tracker_http_port = 80
http.anti_steal_token = no
http.secret_key = FastDFS1234567890
#tracker_server = 172.19.103.13:22122
#-------------开发环境---------------#
tracker_server = 172.19.103.54:22122
#-------------测试环境---------------#
#tracker_server = 172.19.103.13:22122
#-------------正式环境---------------#
#tracker_server = 192.168.0.239:23000

+ 149 - 176
patient-co-wlyy/src/main/resources/system.properties

@ -1,113 +1,25 @@
####--------------IMPORTANT!!! PRODUCTION ENVIRONMENT------------------------------#####
#server_ip=www.xmtyw.cn
#server_port=
#server_domain=wlyy
#server_url=http://www.xmtyw.cn/wlyy/
#
#im_group_server=http://120.41.253.95:3000/api/v1/chats/gm
#msg_push_server=http://120.41.253.95:3000/api/v1/chats/sm
#file upload temp path
#upload_temp_path=/var/local/temp
##image store path
#image_server=http://www.xmtyw.cn/res/images/
#voice_server=http://www.xmtyw.cn/res/voice/
#chat_server=http://www.xmtyw.cn/res/chat/
#
#image_path=/var/local/upload/images
#voice_path=/var/local/upload/voice
#chat_file_path=/var/local/upload/chat
#
#appId=wxad04e9c4c5255acf
#appSecret=ae77c48ccf1af5d07069f5153d1ac8d3
####--------------IMPORTANT!!! 11.1.2 DEMO 环境 ENVIRONMENT------------------------------#####
#server_ip=ehr.yihu.com
#server_port=
#server_domain=ssgg
#server_url=http://ehr.yihu.com/ssgg/
#im_group_server=http://ehr.yihu.com/api/v1/chats/gm
#msg_push_server=http://ehr.yihu.com/api/v1/chats/sm
#file upload temp path
#upload_temp_path=/var/local/temp
##image store path
#image_server==http://ehr.yihu.com/res/images/
#voice_server==http://ehr.yihu.com/res/voice/
#chat_server==http://ehr.yihu.com/res/chat/
#image_path=/var/local/upload/images
#voice_path=/var/local/upload/voice
#chat_file_path=/var/local/upload/chat
#appId=wxeb86020158cf9141
#appSecret=c8f417aa7fe2aab1c4f09721f35930ee
##wechat config
#wechat_token=27eb3bb24f149a7760cf1bb154b08040
#wechat_base_url=http%3a%2f%2fehr.yihu.com%2fssgg
####--------------DEVELOPMENT ENVIRONMENT------------------------------#####
#---------健康之路当阳---------#
server_ip=weixin.xmtyw.cn
server_port=
server_domain=wlyy
server_url=http://weixin.xmtyw.cn/wlyy/
appId=wxd03f859efdf0873d
appSecret=2935b54b53a957d9516c920a544f2537
wechat_base_url=http%3a%2f%2fweixin.xmtyw.cn%2fwlyy
wechat_token=27eb3bb24f149a7760cf1bb154b08040
#是否签约检查和签约数据上传
sign_check_upload=http://172.19.103.87:8011/wlyy_service
#im一对一列表获取
im_list_get=http://172.19.103.76:3000/
#-------------测试------------#
#server_ip=ehr.yihu.com
#server_port=
#server_domain=wlyy
#server_url=http://ehr.yihu.com/wlyy/
#appId=wx1f129f7b51701428
#appSecret=988f005d8309ed1795939e0f042431fb
#wechat_base_url=http%3a%2f%2fehr.yihu.com%2fwlyy
#wechat_token=27eb3bb24f149a7760cf1bb154b08040
##是否签约检查和签约数据上传
#sign_check_upload=http://172.19.103.85:8011/wlyy_service
##im一对一列表获取
#im_list_get=http://172.19.103.88:3000/
#----------------正式环境卫计委签约调用接口地址-------------------#
#sign_check_upload=http://59.61.92.90:8072/wlyy_service
#-------------------------鍏卞悓閰嶇疆-----------------------------#
# 棰勭害閰嶇疆鍙傛暟
guahao_url = http://www.xmsmjk.com/UrpNetService/ReservationNet.asmx
guahao_namespace = http://www.zysoft.com.cn/
im_group_server=http://120.41.252.108:3031/api/v1/chats/gm
msg_push_server=http://192.168.131.102:3000/api/v1/chats/sm
weixin_websocket_server = http://172.19.103.76:8000/user/senddata.do
# 鍩哄崼瀵规帴鏈嶅姟鍦板潃
jw_url = http://59.61.92.90:8072/wlyy_service
#file upload temp path
upload_temp_path=/var/local/temp
#image store path
image_server=http://weixin.xmtyw.cn/res/images/
voice_server=http://weixin.xmtyw.cn/res/voice/
chat_server=http://weixin.xmtyw.cn/res/chat/
image_path=/var/local/upload/images
voice_path=/var/local/upload/voice
chat_file_path=/var/local/upload/chat
# EHR妗f�鏈嶅姟鍦板潃
ehr_used = false
ehr_services = http://localhost:9009/api/v1.0/
ehr_services_base = http://localhost:10220/api/v1.0/
#wechat config
# 寰�俊鍥炬枃娑堟伅URL
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_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_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
#总部地址
# SMS鐭�俊閰嶇疆
yihu_sms_url=https://smsapi.ums86.com:9600/sms/Api/Send.do
yihu_sms_code=229336
yihu_sms_name=jkzldxjr
@ -116,106 +28,167 @@ yihu_guahao_url=http://ssotest.yihu.cn/OpenPlatform/cgiBin/1.0/
yihu_guahao_appid=sanshi
yihu_guahao_secret=sanshi
#微信模板消息ID
#----------------开发环境-----------------#
#签约邀请
# 涓婁紶鏂囦欢閰嶇疆
upload_temp_path=/var/local/temp
image_path=/var/local/upload/images
voice_path=/var/local/upload/voice
chat_file_path=/var/local/upload/chat
#-------------------------开发环境配置-------------------------#
# 服务器基本配置
server_ip=weixin.xmtyw.cn
server_port=
server_domain=wlyy
server_url=http://weixin.xmtyw.cn/wlyy/
# 涓婁紶鏂囦欢閰嶇疆
image_server=http://weixin.xmtyw.cn/res/images/
voice_server=http://weixin.xmtyw.cn/res/voice/
chat_server=http://weixin.xmtyw.cn/res/chat/
# 鏄�惁绛剧害妫€鏌ュ拰绛剧害鏁版嵁涓婁紶
sign_check_upload=http://172.19.103.87:8011/wlyy_service
# IM閰嶇疆
im_list_get=http://172.19.103.29:3000/
im_group_server=http://172.19.103.29:3000/api/v1/chats/gm
msg_push_server=http://172.19.103.29:3000/api/v1/chats/sm
# 寰�俊鍩烘湰閰嶇疆
appId=wxd03f859efdf0873d
appSecret=2935b54b53a957d9516c920a544f2537
wechat_base_url=http%3a%2f%2fweixin.xmtyw.cn%2fwlyy
wechat_token=27eb3bb24f149a7760cf1bb154b08040
# 寰�俊妯℃澘娑堟伅ID
#签约邀请
doctor_invitel_template=TLWrBtNE2kBJaFCdVzDOOnQC8N2TtRY9ZxEzwZXQcR0
#咨询回复
#鍜ㄨ�鍥炲�
template_consult_notice=qSOW0DBxO3qEBm4ucG0Ial0jxsOyD7_f2TFK5e-mQEc
#签约成功
#绛剧害鎴愬姛
template_sign_success=hDWV_sknKlhxhOwR5h68OCXbAhRpcgnx9INrT8BybE8
#签约失败
#绛剧害澶辫触
template_sign_failed=ezgttXE7rG4rAboQK2ituG1dKq4PeyCj3LxGJWO_vOA
#健康指导提醒
#鍋ュ悍鎸囧�鎻愰啋
template_health_notice=128RCfyCHi22jW8PZzo7vabKMsA3SBv5VeHaDPr2Bhw
#解约提醒
#瑙g害鎻愰啋
template_termination=LrrzHjnIF67ww5uQUvSiv3_pVKJiIK4ZE3fKrvsT0AE
#预约成功
#棰勭害鎴愬姛
template_appoint_success=Bo2yqNczSU9zkg4wXoouv9tSeefZ6TziggWL3dTXPYE
#预约取消
#棰勭害鍙栨秷
template_appoint_failed=pErTBTdweIdrNRf_1Oo62YtQC0aHwPvtLaCzw44JzCQ
#缴费提醒
#缂磋垂鎻愰啋
template_expenses_remind=BkTGJ8S18qZ3DfaptAXnZznAk8RJjx9v93og5vyO0bs
#健康教育
#鍋ュ悍鏁欒偛
template_healthy_article=LA7erINJ0CSsG2G_ZCrgsDaX3krhsI4qg_NSHEyL_l4
#医生变更
#鍖荤敓鍙樻洿
template_doctor_change=TNIDMjduVKgVL4-k71umYLpHROvFB8K6mmm8aZC_EH8
#----------------正式环境-----------------#
##签约邀请
#doctor_invitel_template=MQn79bx1ofb6hekhmRIuqLU7KjySJQzaBzrimgqVrzA
##咨询回复
#template_consult_notice=0mF_vHj-ILx8EH8DwzmAi7LqzjqYiU9IrSRRmziTZyc
##签约成功
#template_sign_success=0D2vYZVRzFz15p9Y_pkZ1DKutDq8UOsks79FXUKS0tA
##签约失败
#template_sign_failed=My2VNERjJt4NXR4Ibh42pdrP6B6ka8rQxZeWinQh99s
##健康指导提醒
#template_health_notice=uv31ES_VCmq3tBYtyGmEQvIwU_zh9LDhF3bFpbIUt5g
##解约提醒
#template_termination=C0tdXtA_8k-Cy4a1EkzQuI877vqaqAtRkc-e_Gsd7sk
##预约成功
#template_appoint_success=FY3Pqa66tHIE1Fv-irbFBPOh5cYP71fkOzfZKH4S-Fo
##预约取消
#template_appoint_failed=tldWEb9AN7p_RoHoD8ml0GxWW3V1V_mpEEhp2v6p56s
##缴费提醒
#template_expenses_remind=tldWEb9AN7p_RoHoD8ml0GxWW3V1V_mpEEhp2v6p56s
##健康教育
#template_healthy_article=a5-ZGf-IUUULsuRNoHWQiBMU6pSYhLgPPqV67SjdLRo
##医生变更
#template_doctor_change=dtzSHImbPKfwcrjWlJEjAw3lGlvrLjsobSOE8g4adZA
# FastDFS鏂囦欢Http璁块棶鍦板潃
fastdfs_file_url=http://172.19.103.54:80/
#----------------测试环境(健康之路i厦门)----------------#
##签约邀请
#-------------------------娴嬭瘯鐜��閰嶇疆-------------------------#
## 服务器基本配置
#server_ip=ehr.yihu.com
#server_port=
#server_domain=wlyy
#server_url=http://ehr.yihu.com/wlyy/
#
## 涓婁紶鏂囦欢閰嶇疆
#image_server=http://ehr.yihu.com/res/images/
#voice_server=http://ehr.yihu.com/res/voice/
#chat_server=http://ehr.yihu.com/res/chat/
#
## 鏄�惁绛剧害妫€鏌ュ拰绛剧害鏁版嵁涓婁紶
#sign_check_upload=http://172.19.103.85:8011/wlyy_service
#
## IM閰嶇疆
#im_list_get=http://172.19.103.88:3000/
#im_group_server=http://172.19.103.88:3000/api/v1/chats/gm
#msg_push_server=http://172.19.103.88:3000/api/v1/chats/sm
#
## 寰�俊鍩烘湰閰嶇疆
#appId=wx1f129f7b51701428
#appSecret=988f005d8309ed1795939e0f042431fb
#wechat_base_url=http%3a%2f%2fehr.yihu.com%2fwlyy
#wechat_token=27eb3bb24f149a7760cf1bb154b08040
#
## 寰�俊妯℃澘娑堟伅ID
##签约邀请
#doctor_invitel_template=uXdBJVbrhKG-WLaCG4s8C4SXSr2kknQ94vKFt-3rIiA
##咨询回复
##鍜ㄨ�鍥炲�
#template_consult_notice=-dr4QNyFoRvVsf8uWxXMC1dRyjwnbUuJwJ21vBLhf18
##签约成功
##绛剧害鎴愬姛
#template_sign_success=bw0_fVIxATsCuOwKYF8gzUyuZQ9IosC4Jf8ZU5IKMS4
##签约失败
##绛剧害澶辫触
#template_sign_failed=m221Jrkm0UUY00ExTCpQNTB8t_1U_V4LR9Bg8BgH9-o
##健康指导提醒
##鍋ュ悍鎸囧�鎻愰啋
#template_health_notice=5Nts8lA_at9Cd1JuTK-qDxx95lchpcmUfPTEwYDgXYQ
##解约提醒
##瑙g害鎻愰啋
#template_termination=qZm1NwSueAsbHaOf9DrnLoSj0X5gZuh9W7aDYzLWNds
##预约成功
##棰勭害鎴愬姛
#template_appoint_success=-vU5x2tGyk1zUngBrEqMfnFqqMa6M8J98w8k5MCSUYM
##预约取消
##棰勭害鍙栨秷
#template_appoint_failed=r-bVEKgXVyl8O96saoJXlLd7DX1zW7fXA4a0PZHxiQM
##缴费提醒
##缂磋垂鎻愰啋
#template_expenses_remind=r-bVEKgXVyl8O96saoJXlLd7DX1zW7fXA4a0PZHxiQM
##健康教育
##鍋ュ悍鏁欒偛
#template_healthy_article=aO_qqk5nAXaGXhsikPVLNelqzwlrp1LTPfIQ1qRMpxo
##医生变更
##鍖荤敓鍙樻洿
#template_doctor_change=V5h0F84t972kUzQvWy8qYrgdaYGJVj10pFeFVl19Nb8
#----------------演示环境(健康之路i健康)-----------------#
##签约邀请
#doctor_invitel_template=oYwur5ewPtp9ynRmkj8Md8tLT0WzK5zL36es_XVljy4
##咨询回复
#template_consult_notice=57X7nz2V2jFRej0NqxVV6_UWhTJgJlTp3AFJn6EmPsE
##签约成功
#template_sign_success=Mk5bpDcQMlddALxZnv-WV6HVKdhFbukQr40F5jskcFE
##签约失败
#template_sign_failed=5UsnhXosGmm7BoafWRTTUu2zsACCb6JrG9KEChbwS0o
##健康指导提醒
#template_health_notice=mvmcCTwWOm8ao5pt1bmeazf09jy2Yz7PhRUJ_ytpU8k
##解约提醒
#template_termination=UpspUMDswlLOTgQ4HTa6Oj6bXRTY4SAVb80-Om21ir4
##预约成功
#template_appoint_success=6B2bhbs9c0pCSK2bvBWmr7fLDo0KAVpKH2YcxSv-dQ4
##预约取消
#template_appoint_failed=zHeo9QCfY-k1FHtOePK97R1N2uwD4mZjET1ZUy02lu0
##缴费提醒
#template_expenses_remind=r-bVEKgXVyl8O96saoJXlLd7DX1zW7fXA4a0PZHxiQM
# 预约配置参数
guahao_url = http://www.xmsmjk.com/UrpNetService/ReservationNet.asmx
guahao_namespace = http://www.zysoft.com.cn/
## FastDFS鏂囦欢Http璁块棶鍦板潃
#fastdfs_file_url=http://172.19.103.54:80/
#EHR档案服务地址
ehr_used = false
ehr_services = http://localhost:9009/api/v1.0/
ehr_services_base = http://localhost:10220/api/v1.0/
#-------------------------姝e紡鐜��閰嶇疆-------------------------#
## 服务器基本配置
#server_ip=www.xmtyw.cn
#server_port=
#server_domain=wlyy
#server_url=http://www.xmtyw.cn/wlyy/
#
## 涓婁紶鏂囦欢閰嶇疆
#image_server=http://www.xmtyw.cn/res/images/
#voice_server=http://www.xmtyw.cn/res/voice/
#chat_server=http://www.xmtyw.cn/res/chat/
#
## 鏄�惁绛剧害妫€鏌ュ拰绛剧害鏁版嵁涓婁紶
#sign_check_upload=http://59.61.92.90:8072/wlyy_service
#
## IM閰嶇疆
#im_list_get=http://120.41.253.95:3000/
#im_group_server=http://120.41.253.95:3000/api/v1/chats/gm
#msg_push_server=http://120.41.253.95:3000/api/v1/chats/sm
#
## 寰�俊鍩烘湰閰嶇疆
#appId=wxad04e9c4c5255acf
#appSecret=ae77c48ccf1af5d07069f5153d1ac8d3
#wechat_token=27eb3bb24f149a7760cf1bb154b08040
#wechat_base_url=http%3a%2f%2fwww.xmtyw.cn%2fwlyy
#
## 寰�俊妯℃澘娑堟伅ID
##签约邀请
#doctor_invitel_template=MQn79bx1ofb6hekhmRIuqLU7KjySJQzaBzrimgqVrzA
##鍜ㄨ�鍥炲�
#template_consult_notice=0mF_vHj-ILx8EH8DwzmAi7LqzjqYiU9IrSRRmziTZyc
##绛剧害鎴愬姛
#template_sign_success=0D2vYZVRzFz15p9Y_pkZ1DKutDq8UOsks79FXUKS0tA
##绛剧害澶辫触
#template_sign_failed=My2VNERjJt4NXR4Ibh42pdrP6B6ka8rQxZeWinQh99s
##鍋ュ悍鎸囧�鎻愰啋
#template_health_notice=uv31ES_VCmq3tBYtyGmEQvIwU_zh9LDhF3bFpbIUt5g
##瑙g害鎻愰啋
#template_termination=C0tdXtA_8k-Cy4a1EkzQuI877vqaqAtRkc-e_Gsd7sk
##棰勭害鎴愬姛
#template_appoint_success=FY3Pqa66tHIE1Fv-irbFBPOh5cYP71fkOzfZKH4S-Fo
##棰勭害鍙栨秷
#template_appoint_failed=tldWEb9AN7p_RoHoD8ml0GxWW3V1V_mpEEhp2v6p56s
##缂磋垂鎻愰啋
#template_expenses_remind=AcrlihhoGbm22A8cdFFDQ4u38ptRw0aiIPf-aGvNxMM
##鍋ュ悍鏁欒偛
#template_healthy_article=a5-ZGf-IUUULsuRNoHWQiBMU6pSYhLgPPqV67SjdLRo
##鍖荤敓鍙樻洿
#template_doctor_change=dtzSHImbPKfwcrjWlJEjAw3lGlvrLjsobSOE8g4adZA
## FastDFS鏂囦欢Http璁块棶鍦板潃
#fastdfs_file_url=http://www.xmtyw.cn/

+ 229 - 0
patient-co-wlyy/src/main/resources/system_bak.properties

@ -0,0 +1,229 @@
####--------------IMPORTANT!!! PRODUCTION ENVIRONMENT------------------------------#####
#server_ip=www.xmtyw.cn
#server_port=
#server_domain=wlyy
#server_url=http://www.xmtyw.cn/wlyy/
#
#im_group_server=http://120.41.253.95:3000/api/v1/chats/gm
#msg_push_server=http://120.41.253.95:3000/api/v1/chats/sm
#file upload temp path
#upload_temp_path=/var/local/temp
##image store path
#image_server=http://www.xmtyw.cn/res/images/
#voice_server=http://www.xmtyw.cn/res/voice/
#chat_server=http://www.xmtyw.cn/res/chat/
#
#image_path=/var/local/upload/images
#voice_path=/var/local/upload/voice
#chat_file_path=/var/local/upload/chat
#
#appId=wxad04e9c4c5255acf
#appSecret=ae77c48ccf1af5d07069f5153d1ac8d3
####--------------IMPORTANT!!! 11.1.2 DEMO 环境 ENVIRONMENT------------------------------#####
#server_ip=ehr.yihu.com
#server_port=
#server_domain=ssgg
#server_url=http://ehr.yihu.com/ssgg/
#im_group_server=http://ehr.yihu.com/api/v1/chats/gm
#msg_push_server=http://ehr.yihu.com/api/v1/chats/sm
#file upload temp path
#upload_temp_path=/var/local/temp
##image store path
#image_server==http://ehr.yihu.com/res/images/
#voice_server==http://ehr.yihu.com/res/voice/
#chat_server==http://ehr.yihu.com/res/chat/
#image_path=/var/local/upload/images
#voice_path=/var/local/upload/voice
#chat_file_path=/var/local/upload/chat
#appId=wxeb86020158cf9141
#appSecret=c8f417aa7fe2aab1c4f09721f35930ee
##wechat config
#wechat_token=27eb3bb24f149a7760cf1bb154b08040
#wechat_base_url=http%3a%2f%2fehr.yihu.com%2fssgg
####--------------DEVELOPMENT ENVIRONMENT------------------------------#####
#---------健康之路当阳---------#
server_ip=weixin.xmtyw.cn
server_port=
server_domain=wlyy
server_url=http://weixin.xmtyw.cn/wlyy/
appId=wxd03f859efdf0873d
appSecret=2935b54b53a957d9516c920a544f2537
wechat_base_url=http%3a%2f%2fweixin.xmtyw.cn%2fwlyy
wechat_token=27eb3bb24f149a7760cf1bb154b08040
#是否签约检查和签约数据上传
sign_check_upload=http://172.19.103.87:8011/wlyy_service
#im一对一列表获取
im_list_get=http://172.19.103.76:3000/
#-------------测试------------#
#server_ip=ehr.yihu.com
#server_port=
#server_domain=wlyy
#server_url=http://ehr.yihu.com/wlyy/
#appId=wx1f129f7b51701428
#appSecret=988f005d8309ed1795939e0f042431fb
#wechat_base_url=http%3a%2f%2fehr.yihu.com%2fwlyy
#wechat_token=27eb3bb24f149a7760cf1bb154b08040
##是否签约检查和签约数据上传
#sign_check_upload=http://172.19.103.85:8011/wlyy_service
##im一对一列表获取
#im_list_get=http://172.19.103.88:3000/
#----------------正式环境卫计委签约调用接口地址-------------------#
#sign_check_upload=http://59.61.92.90:8072/wlyy_service
im_group_server=http://120.41.252.108:3031/api/v1/chats/gm
msg_push_server=http://192.168.131.102:3000/api/v1/chats/sm
weixin_websocket_server = http://172.19.103.76:8000/user/senddata.do
#file upload temp path
upload_temp_path=/var/local/temp
#image store path
image_server=http://weixin.xmtyw.cn/res/images/
voice_server=http://weixin.xmtyw.cn/res/voice/
chat_server=http://weixin.xmtyw.cn/res/chat/
image_path=/var/local/upload/images
voice_path=/var/local/upload/voice
chat_file_path=/var/local/upload/chat
#wechat config
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_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_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
#总部地址
yihu_sms_url=https://smsapi.ums86.com:9600/sms/Api/Send.do
yihu_sms_code=229336
yihu_sms_name=jkzldxjr
yihu_sms_password=jkzldxjrpwd123
yihu_guahao_url=http://ssotest.yihu.cn/OpenPlatform/cgiBin/1.0/
yihu_guahao_appid=sanshi
yihu_guahao_secret=sanshi
#微信模板消息ID
#----------------开发环境-----------------#
#签约邀请
doctor_invitel_template=TLWrBtNE2kBJaFCdVzDOOnQC8N2TtRY9ZxEzwZXQcR0
#咨询回复
template_consult_notice=qSOW0DBxO3qEBm4ucG0Ial0jxsOyD7_f2TFK5e-mQEc
#签约成功
template_sign_success=hDWV_sknKlhxhOwR5h68OCXbAhRpcgnx9INrT8BybE8
#签约失败
template_sign_failed=ezgttXE7rG4rAboQK2ituG1dKq4PeyCj3LxGJWO_vOA
#健康指导提醒
template_health_notice=128RCfyCHi22jW8PZzo7vabKMsA3SBv5VeHaDPr2Bhw
#解约提醒
template_termination=LrrzHjnIF67ww5uQUvSiv3_pVKJiIK4ZE3fKrvsT0AE
#预约成功
template_appoint_success=Bo2yqNczSU9zkg4wXoouv9tSeefZ6TziggWL3dTXPYE
#预约取消
template_appoint_failed=pErTBTdweIdrNRf_1Oo62YtQC0aHwPvtLaCzw44JzCQ
#缴费提醒
template_expenses_remind=BkTGJ8S18qZ3DfaptAXnZznAk8RJjx9v93og5vyO0bs
#健康教育
template_healthy_article=LA7erINJ0CSsG2G_ZCrgsDaX3krhsI4qg_NSHEyL_l4
#医生变更
template_doctor_change=TNIDMjduVKgVL4-k71umYLpHROvFB8K6mmm8aZC_EH8
#------------------FastDFS文件配置-----------------#
#FastDFS文件Http地址
fastdfs_file_url=http://172.19.103.54:80/
#----------------正式环境-----------------#
##签约邀请
#doctor_invitel_template=MQn79bx1ofb6hekhmRIuqLU7KjySJQzaBzrimgqVrzA
##咨询回复
#template_consult_notice=0mF_vHj-ILx8EH8DwzmAi7LqzjqYiU9IrSRRmziTZyc
##签约成功
#template_sign_success=0D2vYZVRzFz15p9Y_pkZ1DKutDq8UOsks79FXUKS0tA
##签约失败
#template_sign_failed=My2VNERjJt4NXR4Ibh42pdrP6B6ka8rQxZeWinQh99s
##健康指导提醒
#template_health_notice=uv31ES_VCmq3tBYtyGmEQvIwU_zh9LDhF3bFpbIUt5g
##解约提醒
#template_termination=C0tdXtA_8k-Cy4a1EkzQuI877vqaqAtRkc-e_Gsd7sk
##预约成功
#template_appoint_success=FY3Pqa66tHIE1Fv-irbFBPOh5cYP71fkOzfZKH4S-Fo
##预约取消
#template_appoint_failed=tldWEb9AN7p_RoHoD8ml0GxWW3V1V_mpEEhp2v6p56s
##缴费提醒
#template_expenses_remind=tldWEb9AN7p_RoHoD8ml0GxWW3V1V_mpEEhp2v6p56s
##健康教育
#template_healthy_article=a5-ZGf-IUUULsuRNoHWQiBMU6pSYhLgPPqV67SjdLRo
##医生变更
#template_doctor_change=dtzSHImbPKfwcrjWlJEjAw3lGlvrLjsobSOE8g4adZA
#------------------FastDFS文件配置-----------------#
#FastDFS文件Http地址
#fastdfs_file_url=http://www.xmtyw.cn/
#----------------测试环境(健康之路i厦门)----------------#
##签约邀请
#doctor_invitel_template=uXdBJVbrhKG-WLaCG4s8C4SXSr2kknQ94vKFt-3rIiA
##咨询回复
#template_consult_notice=-dr4QNyFoRvVsf8uWxXMC1dRyjwnbUuJwJ21vBLhf18
##签约成功
#template_sign_success=bw0_fVIxATsCuOwKYF8gzUyuZQ9IosC4Jf8ZU5IKMS4
##签约失败
#template_sign_failed=m221Jrkm0UUY00ExTCpQNTB8t_1U_V4LR9Bg8BgH9-o
##健康指导提醒
#template_health_notice=5Nts8lA_at9Cd1JuTK-qDxx95lchpcmUfPTEwYDgXYQ
##解约提醒
#template_termination=qZm1NwSueAsbHaOf9DrnLoSj0X5gZuh9W7aDYzLWNds
##预约成功
#template_appoint_success=-vU5x2tGyk1zUngBrEqMfnFqqMa6M8J98w8k5MCSUYM
##预约取消
#template_appoint_failed=r-bVEKgXVyl8O96saoJXlLd7DX1zW7fXA4a0PZHxiQM
##缴费提醒
#template_expenses_remind=r-bVEKgXVyl8O96saoJXlLd7DX1zW7fXA4a0PZHxiQM
##健康教育
#template_healthy_article=aO_qqk5nAXaGXhsikPVLNelqzwlrp1LTPfIQ1qRMpxo
##医生变更
#template_doctor_change=V5h0F84t972kUzQvWy8qYrgdaYGJVj10pFeFVl19Nb8
#------------------FastDFS文件配置-----------------#
#FastDFS文件Http地址
#fastdfs_file_url=http://172.19.103.54:80/
#----------------演示环境(健康之路i健康)-----------------#
##签约邀请
#doctor_invitel_template=oYwur5ewPtp9ynRmkj8Md8tLT0WzK5zL36es_XVljy4
##咨询回复
#template_consult_notice=57X7nz2V2jFRej0NqxVV6_UWhTJgJlTp3AFJn6EmPsE
##签约成功
#template_sign_success=Mk5bpDcQMlddALxZnv-WV6HVKdhFbukQr40F5jskcFE
##签约失败
#template_sign_failed=5UsnhXosGmm7BoafWRTTUu2zsACCb6JrG9KEChbwS0o
##健康指导提醒
#template_health_notice=mvmcCTwWOm8ao5pt1bmeazf09jy2Yz7PhRUJ_ytpU8k
##解约提醒
#template_termination=UpspUMDswlLOTgQ4HTa6Oj6bXRTY4SAVb80-Om21ir4
##预约成功
#template_appoint_success=6B2bhbs9c0pCSK2bvBWmr7fLDo0KAVpKH2YcxSv-dQ4
##预约取消
#template_appoint_failed=zHeo9QCfY-k1FHtOePK97R1N2uwD4mZjET1ZUy02lu0
##缴费提醒
#template_expenses_remind=r-bVEKgXVyl8O96saoJXlLd7DX1zW7fXA4a0PZHxiQM
# 预约配置参数
guahao_url = http://www.xmsmjk.com/UrpNetService/ReservationNet.asmx
guahao_namespace = http://www.zysoft.com.cn/
#EHR档案服务地址
ehr_used = false
ehr_services = http://localhost:9009/api/v1.0/
ehr_services_base = http://localhost:10220/api/v1.0/