Browse Source

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

liuwenbin 7 năm trước cách đây
mục cha
commit
6658955109
20 tập tin đã thay đổi với 606 bổ sung147 xóa
  1. 52 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/dict/SignDict.java
  2. 14 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/profile/Doctor.java
  3. 124 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/PatientCertificate.java
  4. 1 1
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/httplog/PayLogService.java
  5. 7 1
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/wechat/WechatService.java
  6. 2 2
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/static/static_wechat.jsp
  7. 14 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/dict/SignDictDao.java
  8. 2 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/DoctorDao.java
  9. 15 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/PatientCertificateDao.java
  10. 2 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyServerDao.java
  11. 77 13
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java
  12. 34 23
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java
  13. 3 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/PatientService.java
  14. 3 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/specialist/SpecialistService.java
  15. 114 91
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorSignController.java
  16. 47 11
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/sign/FamilyContractController.java
  17. 58 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/clean/ImCleanController.java
  18. 35 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/process/WeiXinEventProcess.java
  19. 2 0
      patient-co/patient-co-wlyy/src/main/resources/system.properties
  20. BIN
      patient-co/patient-co-wlyy/src/main/webapp/images/activity.png

+ 52 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/dict/SignDict.java

@ -0,0 +1,52 @@
package com.yihu.wlyy.entity.dict;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * add by hzp 20170608
 * 签约字典
 */
@Entity
@Table(name = "wlyy_sign_dict")
public class SignDict extends IdEntity {
    private String year;
    private String type;
    private String code;
    private String name;
    public String getYear() {
        return year;
    }
    public void setYear(String year) {
        this.year = year;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
}

+ 14 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/profile/Doctor.java

@ -74,6 +74,8 @@ public class Doctor extends IdEntity {
    //=====================非hibernate字段=========================
    private String concernCode;//关注code
    private String activityPath;//活动路径
    public Double getEvaluateScore() {
        return evaluateScore;
    }
@ -449,4 +451,16 @@ public class Doctor extends IdEntity {
    public void setConcernCode(String concernCode) {
        this.concernCode = concernCode;
    }
    public static long getSerialVersionUID() {
        return serialVersionUID;
    }
    public String getActivityPath() {
        return activityPath;
    }
    public void setActivityPath(String activityPath) {
        this.activityPath = activityPath;
    }
}

+ 124 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/PatientCertificate.java

@ -0,0 +1,124 @@
package com.yihu.wlyy.entity.patient;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by Trick on 2018/7/20.
 */
@Entity
@Table(name = "wlyy_patient_certificate")
public class PatientCertificate extends IdEntity {
    private String code;//业务主键',
    private String signDictCode;//服务类型',
    private String signDictName;//服务类型名称',
    private String signYear;//签约年度',
    private String patient;//居民',
    private String patientName;//居民名称',
    private String certificatePath;//证书地址',
    private String del;//1.有效,0删除',
    private String content;//说明',
    private String remark;//备注',
    private Date createTime;//,
    private Date updateTime;//,
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getSignDictCode() {
        return signDictCode;
    }
    public void setSignDictCode(String signDictCode) {
        this.signDictCode = signDictCode;
    }
    public String getSignDictName() {
        return signDictName;
    }
    public void setSignDictName(String signDictName) {
        this.signDictName = signDictName;
    }
    public String getSignYear() {
        return signYear;
    }
    public void setSignYear(String signYear) {
        this.signYear = signYear;
    }
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    public String getCertificatePath() {
        return certificatePath;
    }
    public void setCertificatePath(String certificatePath) {
        this.certificatePath = certificatePath;
    }
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
}

+ 1 - 1
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/httplog/PayLogService.java

@ -50,7 +50,7 @@ public class PayLogService extends BaseJpaService<PayLog,PayLogDao> {
            filters.append("and create_time < '"+endDate+"' ");
        }
        payLogList = jdbcTemplate.query(sql+filters.toString()+" order by p.create_time "+" limit "+(page-1)*pageSize+","+pageSize, new BeanPropertyRowMapper<>(PayLog.class));
        payLogList = jdbcTemplate.query(sql+filters.toString()+" order by p.create_time desc"+" limit "+(page-1)*pageSize+","+pageSize, new BeanPropertyRowMapper<>(PayLog.class));
        if(payLogList.size()<=0){
            return new PageImpl<PayLog>(new ArrayList<>(), pageRequest, 0);
        }

+ 7 - 1
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/wechat/WechatService.java

@ -4,6 +4,7 @@ import com.yihu.wlyy.entity.wechat.WechatSignVO;
import com.yihu.wlyy.entity.wechat.WechatTotalVO;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.DateUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
@ -58,6 +59,9 @@ public class WechatService extends BaseService {
					"SELECT b.patient,b.mobile,b.idcard,b.doctor_name,b.doctor_health_name,b.hospital_name FROM wlyy_sign_family b WHERE b.hospital='"+hospital+"' AND b.sign_year='"+year+"' AND b.STATUS=1 AND b.expenses_status=1) a,wlyy_patient t WHERE t.CODE=a.patient) m," +
					"(SELECT t.openid,count(t.openid) tcount FROM wlyy_patient t WHERE t.`code` IN (" +
					"SELECT patient FROM wlyy_sign_family s WHERE s.hospital='"+hospital+"' AND s.sign_year='"+year+"' AND s.expenses_status=1 AND s.STATUS=1 AND s.sign_source = '"+signSource+"') GROUP BY t.openid) n WHERE m.openid=n.openid";
			if(StringUtils.isBlank(signSource)){
				sql = sql.replace("AND s.sign_source = ''","");
			}
		}else if("0".equals(attention)){
			sql = "SELECT m.* FROM (" +
					"SELECT a.mobile," +
@ -74,8 +78,10 @@ public class WechatService extends BaseService {
					"a.street_name FROM (" +
					"SELECT t.CODE,t.NAME,t.address,t.sick_village_name,t.street_name,t.medicare_number,idcard,mobile,openid_time FROM wlyy_patient t WHERE t.`code` IN (" +
					"SELECT patient FROM wlyy_sign_family s WHERE s.hospital='"+hospital+"' AND s.sign_year='"+year+"' AND s.expenses_status=1 AND s.STATUS=1 AND s.expenses_time IS NOT NULL) AND t.openid IS NULL) a,wlyy_sign_family b WHERE b.hospital='"+hospital+"' AND b.sign_year='"+year+"' AND b.STATUS=1 AND b.expenses_status=1 AND a.CODE=b.patient AND b.expenses_time IS NOT NULL AND b.sign_source ='"+signSource+"') m";
			if(StringUtils.isBlank(signSource)){
				sql = sql.replace("AND b.sign_source =''","");
			}
		}
		
		list =  jdbcTemplate.query(sql,new BeanPropertyRowMapper(WechatSignVO.class));
		return list ;

+ 2 - 2
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/static/static_wechat.jsp

@ -29,8 +29,8 @@
                        <input type="text" id="inp_att" placeholder="请选择关注状态" class="required useTitle f-ml10" required-title="关注状态不能为空"  />
                    </div>
                    <br>
                    <div class="m-form-control f-ml15 essential">
                        <input type="text" id="inp_signSource" placeholder="请选择签约来源" class="required useTitle f-ml10" required-title="签约来源不能为空" />
                    <div class="m-form-control f-ml15">
                        <input type="text" id="inp_signSource" placeholder="请选择签约来源" class="f-ml10" required-title="签约来源不能为空" />
                    </div>
                    <br>
                    <div id="export_list" class="l-button u-btn u-btn-primary u-btn-small f-ib f-vam  f-ml10" >

+ 14 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/dict/SignDictDao.java

@ -0,0 +1,14 @@
package com.yihu.wlyy.repository.dict;
import com.yihu.wlyy.entity.dict.SignDict;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Trick on 2018/7/23.
 */
public interface SignDictDao  extends PagingAndSortingRepository<SignDict, Long>, JpaSpecificationExecutor<SignDict> {
    List<SignDict> findByYear(String year);
}

+ 2 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/DoctorDao.java

@ -30,6 +30,8 @@ public interface DoctorDao extends PagingAndSortingRepository<Doctor, Long>, Jpa
    @Query("select p from Doctor p where p.code = ?1")
    Doctor findByCode(String code);
    Doctor findByCodeAndDel(String code,String del);
    @Query("select d from Doctor d where d.del = 1")
    List<Doctor> findAllDoctors();

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

@ -0,0 +1,15 @@
package com.yihu.wlyy.repository.patient;
import com.yihu.wlyy.entity.patient.PatientCertificate;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Trick on 2018/7/20.
 */
public interface PatientCertificateDao extends PagingAndSortingRepository<PatientCertificate, Long>, JpaSpecificationExecutor<PatientCertificate> {
    List<PatientCertificate> findByPatientAndSignYearAndDel(String patient,String signYear,String del);
}

+ 2 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyServerDao.java

@ -17,4 +17,6 @@ public interface SignFamilyServerDao extends PagingAndSortingRepository<SignFami
    List<SignFamilyServer> findBySignCodeAndType(String signCode);
    List<SignFamilyServer> findBySignCode(String signCode);
    SignFamilyServer findBySignCodeAndServerType(String signCode,String serverType);
}

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

@ -2,6 +2,7 @@ package com.yihu.wlyy.service.app.sign;
import com.yihu.wlyy.entity.consult.Consult;
import com.yihu.wlyy.entity.consult.ConsultTeam;
import com.yihu.wlyy.entity.dict.SignDict;
import com.yihu.wlyy.entity.doctor.OperatorLog;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.profile.DoctorService;
@ -18,6 +19,7 @@ import com.yihu.wlyy.entity.wechat.WechatTemplateConfig;
import com.yihu.wlyy.logs.BusinessLogs;
import com.yihu.wlyy.repository.consult.ConsultDao;
import com.yihu.wlyy.repository.consult.ConsultTeamDao;
import com.yihu.wlyy.repository.dict.SignDictDao;
import com.yihu.wlyy.repository.dict.SystemDictDao;
import com.yihu.wlyy.repository.doctor.*;
import com.yihu.wlyy.repository.message.MessageDao;
@ -38,6 +40,7 @@ import com.yihu.wlyy.task.SignUploadTask;
import com.yihu.wlyy.util.*;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
@ -168,6 +171,10 @@ public class FamilyContractService extends BaseService {
    private TrackPatientDao trackPatientDao;
    @Autowired
    private WechatTemplateConfigDao templateConfigDao;
    @Autowired
    private PatientCertificateDao patientCertificateDao;
    @Autowired
    private SignDictDao signDictDao;
    public SignFamily findSignFamilyByCode(String code) {
@ -371,9 +378,13 @@ public class FamilyContractService extends BaseService {
        json.put("services", services);
        //是否签约上限
        JSONObject signLimit = signWebService.getSickFamilyDoctorSignLimit(doctor);
        json.put("signTotal", signLimit.getInt("signTotal"));//签约总数
        json.put("limitTotal", signLimit.getInt("limitTotal"));//限制总数
//        JSONObject signLimit = signWebService.getSickFamilyDoctorSignLimit(doctor);
//        json.put("signTotal", signLimit.getInt("signTotal"));//签约总数
//        json.put("limitTotal", signLimit.getInt("limitTotal"));//限制总数
        //上线记得切换正式
        json.put("signTotal", 20);//签约总数
        json.put("limitTotal", 1000);//限制总数
        return json;
    }
@ -526,7 +537,8 @@ public class FamilyContractService extends BaseService {
                           String idcard,
                           String ssc,
                           String mobile,
                           String emerMobile) throws Exception {
                           String emerMobile,
                           String sevId) throws Exception {
        // 查询三师签约
        JSONObject json = new JSONObject();
        SignFamily sc = signFamilyDao.findByIdcard(idcard);
@ -612,6 +624,10 @@ public class FamilyContractService extends BaseService {
        patient = p.getCode();
        sf.setPatient(patient);
        SignFamily temp = signFamilyDao.save(sf);
        //1.4.9.1版本新增服务类型
        signWebService.setSevId(temp,sevId);
        if (temp != null) {
            // 添加签约消息
            Message message = new Message();
@ -671,7 +687,7 @@ public class FamilyContractService extends BaseService {
     * @param patient 居民code
     * @return
     */
    public int sign(String doctor, String patient, String countryCode,String medicareNumber) throws Exception {
    public int sign(String doctor, String patient, String countryCode,String medicareNumber,String sevId) throws Exception {
        Patient p = patientDao.findByCode(patient);
        if (p == null) {
            return -1;
@ -732,6 +748,10 @@ public class FamilyContractService extends BaseService {
        SignFamily temp = signFamilyDao.save(sf);
        //设置居民服务类型
        //1.4.9.1版本
        signWebService.setSevId(temp,sevId);
        if (temp != null) {
            // 添加签约消息
            Message message = new Message();
@ -3505,6 +3525,7 @@ public class FamilyContractService extends BaseService {
     * @param patient 居民code
     * @return
     */
    @Deprecated
    @Transactional
    public int signRenew(String doctor, String healthDoctor, String patient, String reason,String medicareNumber) throws Exception {
        Patient p = patientDao.findByCode(patient);
@ -3728,7 +3749,7 @@ public class FamilyContractService extends BaseService {
     * @return
     */
    @Transactional
    public int signRenewOverdue(String doctor, String healthDoctor, String patient, String reason, String countryCode,String medicareNumber) throws Exception {
    public int signRenewOverdue(String doctor, String healthDoctor, String patient, String reason, String countryCode,String medicareNumber,String sevId) throws Exception {
        Patient p = patientDao.findByCode(patient);
        if (p == null) {
            return -1;
@ -3878,6 +3899,10 @@ public class FamilyContractService extends BaseService {
        SignFamily temp = signFamilyDao.save(sf);
        //设置居民服务类型
        //1.4.9.1版本
        signWebService.setSevId(temp,sevId);
        if (temp != null) {
            // 添加签约消息
            Message message = new Message();
@ -3954,8 +3979,8 @@ public class FamilyContractService extends BaseService {
    }
    public JSONArray getSignDoctorMessageOverDue(String patientCode) {
        JSONArray jsonArray = new JSONArray();
    public JSONObject getSignDoctorMessageOverDue(String patientCode) {
        JSONObject obj = new JSONObject();
        //找出患者的三师签约信息
        Patient patient = patientDao.findByCode(patientCode);
@ -3967,8 +3992,8 @@ public class FamilyContractService extends BaseService {
        if (jtSignFamily != null) {
            //家庭签约只找全科医生
            Doctor doctor = doctorDao.findByCode(jtSignFamily.getDoctor());
            Doctor doctorHealth = doctorDao.findByCode(jtSignFamily.getDoctorHealth());
            Doctor doctor = doctorDao.findByCodeAndDel(jtSignFamily.getDoctor(),"1");
            Doctor doctorHealth = doctorDao.findByCodeAndDel(jtSignFamily.getDoctorHealth(),"1");
            if (doctor != null) {
                JSONObject jo = new JSONObject();
                jo.put("code", doctor.getCode());
@ -3987,7 +4012,7 @@ public class FamilyContractService extends BaseService {
                    jo.put("qyDate", DateUtil.dateToStrShort(jtSignFamily.getBegin()));//签约时间
                    jo.put("endDate", DateUtil.dateToStrShort(jtSignFamily.getEnd()));//结束时间
                }
                jsonArray.put(jo);
                obj.put("doctor",jo);
            }
            if (doctorHealth != null) {
                JSONObject jo = new JSONObject();
@ -4007,10 +4032,10 @@ public class FamilyContractService extends BaseService {
                    jo.put("qyDate", DateUtil.dateToStrShort(jtSignFamily.getBegin()));//签约时间
                    jo.put("endDate", DateUtil.dateToStrShort(jtSignFamily.getEnd()));//结束时间
                }
                jsonArray.put(jo);
                obj.put("doctorHealth",jo);
            }
        }
        return jsonArray;
        return obj;
    }
    /**
@ -4512,4 +4537,43 @@ public class FamilyContractService extends BaseService {
            }
        }
    }
    public String  saveCertificate(String patient,String imgPath,String sevId){
        try{
            if (StringUtils.isNotBlank(sevId)) {
                String[] sevIds = sevId.split(",");
                for (int i = 0; i < sevIds.length; i++) {
                    String sql = "select d.name from wlyy_sign_dict d where d.code = '" + sevIds[i] + "' and d.year ='" + DateUtil.getSignYear() + "' ";
                    List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
                    Patient p = patientDao.findByCode(patient);
                    String[] img = imgPath.split(",");
                    for(String im :img){
                        PatientCertificate patientCertificate = new PatientCertificate();
                        patientCertificate.setCode(getCode());
                        //设置患者
                        patientCertificate.setPatient(patient);
                        patientCertificate.setPatientName(p.getName());
                        //设置类型
                        Map<String, Object> map = list.get(0);
                        String serverName = (String) map.get("name");
                        patientCertificate.setSignDictName(serverName);
                        patientCertificate.setSignDictCode(sevIds[i]);
                        //设置路径
                        patientCertificate.setCertificatePath(im);
                        patientCertificate.setDel("1");
                        patientCertificate.setCreateTime(new Date());
                        patientCertificateDao.save(patientCertificate);
                    }
                }
            }
        }catch (Exception e){
            logger.info(e.getMessage()+"___:"+e.toString());
        }
        return "1";
    }
    public List<SignDict> getSignDict(){
        return signDictDao.findByYear(DateUtil.getSignYear()+"");
    }
}

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

@ -6,7 +6,6 @@ import com.yihu.wlyy.entity.address.Street;
import com.yihu.wlyy.entity.address.Town;
import com.yihu.wlyy.entity.charge.WlyyCharge;
import com.yihu.wlyy.entity.consult.Consult;
import com.yihu.wlyy.entity.device.PatientDevice;
import com.yihu.wlyy.entity.device.PatientDeviceLog;
import com.yihu.wlyy.entity.dict.SystemDict;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
@ -31,7 +30,6 @@ import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.repository.patient.*;
import com.yihu.wlyy.repository.wechat.WechatTemplateConfigDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.device.PatientDeviceService;
import com.yihu.wlyy.service.app.label.SignPatientLabelInfoService;
import com.yihu.wlyy.service.app.statistics.ServiceStatisticsService;
import com.yihu.wlyy.service.app.team.AdminTeamService;
@ -47,7 +45,6 @@ import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
@ -150,6 +147,8 @@ public class SignWebService extends BaseService {
    public static String city = "350200";
    @Autowired
    private ServiceStatisticsService serviceStatisticsService;
    @Autowired
    private PatientCertificateDao patientCertificateDao;
    /**
     * 根据医生代码及签约状态编码 获取该医生签约患者的信息列表
@ -1692,6 +1691,7 @@ public class SignWebService extends BaseService {
     * @return
     * @throws Exception
     */
    @Deprecated
    public int agreeRenew(String access_token, String dotorCode, String patientCode, String state, Long mesId, String signYear, String code,
                          String health,
                          String disease,
@ -2441,6 +2441,7 @@ public class SignWebService extends BaseService {
     * @param renew
     * @param sevId
     */
    @Deprecated
    public void setSevId(SignFamilyRenew renew, String sevId) {
        if (StringUtils.isNotBlank(sevId)) {
            if (StringUtils.isNotBlank(sevId)) {
@ -2448,15 +2449,18 @@ public class SignWebService extends BaseService {
                for (int i = 0; i < sevIds.length; i++) {
                    String sql = "select d.name from wlyy_sign_dict d where d.code = '" + sevIds[i] + "' and d.year ='" + DateUtil.getSignYear() + "' ";
                    List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
                    SignFamilyServer server = new SignFamilyServer();
                    server.setSignCode(renew.getCode());
                    server.setCreateTime(new Date());
                    server.setServerType(sevIds[i]);
                    Map<String, Object> map = list.get(0);
                    String serverName = (String) map.get("name");
                    server.setServerTypeName(serverName);
                    server.setCzrq(new Date());
                    signFamilyServerDao.save(server);
                    SignFamilyServer s =  signFamilyServerDao.findBySignCodeAndServerType(renew.getCode(),sevIds[i]);
                    if(s==null){
                        SignFamilyServer server = new SignFamilyServer();
                        server.setSignCode(renew.getCode());
                        server.setCreateTime(new Date());
                        server.setServerType(sevIds[i]);
                        Map<String, Object> map = list.get(0);
                        String serverName = (String) map.get("name");
                        server.setServerTypeName(serverName);
                        server.setCzrq(new Date());
                        signFamilyServerDao.save(server);
                    }
                }
            }
        }
@ -2474,15 +2478,18 @@ public class SignWebService extends BaseService {
            for (int i = 0; i < sevIds.length; i++) {
                String sql = "select d.name from wlyy_sign_dict d where d.code = '" + sevIds[i] + "' and d.year ='" + DateUtil.getSignYear() + "' ";
                List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
                SignFamilyServer server = new SignFamilyServer();
                server.setSignCode(renew.getCode());
                server.setCreateTime(new Date());
                server.setServerType(sevIds[i]);
                Map<String, Object> map = list.get(0);
                String serverName = (String) map.get("name");
                server.setServerTypeName(serverName);
                server.setCzrq(new Date());
                signFamilyServerDao.save(server);
                SignFamilyServer s =  signFamilyServerDao.findBySignCodeAndServerType(renew.getCode(),sevIds[i]);
                if(s==null){
                    SignFamilyServer server = new SignFamilyServer();
                    server.setSignCode(renew.getCode());
                    server.setCreateTime(new Date());
                    server.setServerType(sevIds[i]);
                    Map<String, Object> map = list.get(0);
                    String serverName = (String) map.get("name");
                    server.setServerTypeName(serverName);
                    server.setCzrq(new Date());
                    signFamilyServerDao.save(server);
                }
            }
        }
    }
@ -2906,7 +2913,8 @@ public class SignWebService extends BaseService {
        Integer signTotal = 0;
        Integer limitTotal = 0;
        List<AdminTeam> adminTeams = doctorAdminTeamMemberDao.findDoctorTeams(doctorCode);
        for(AdminTeam one:adminTeams){
        for (int i =0;i<(adminTeams.size()>=4?4:adminTeams.size());i++){
            AdminTeam one = adminTeams.get(i);
            //获取团队签约数
            Integer signCount = signFamilyDao.findByAdminTeamIdAndStatus(one.getId(),0);
            signTotal+=signCount;
@ -2935,5 +2943,8 @@ public class SignWebService extends BaseService {
    }
    public List<PatientCertificate> findPatientCertificate(String patient){
       List<PatientCertificate>  list =  patientCertificateDao.findByPatientAndSignYearAndDel(patient,DateUtil.getSignYear()+"","1");
       return list;
    }
}

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

@ -1142,6 +1142,9 @@ public class PatientService extends TokenService {
            patientRecordLog.setPatientName(patient.getName());
            patientRecordLog.setSsc(patient.getSsc());
            patientRecordLogDao.save(patientRecordLog);
            //清登录缓存
            SystemData.patientTokens.remove(patient.getCode());
        }
        patientDao.clearOpenidByOpenid(openid);
        return "";

+ 3 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/specialist/SpecialistService.java

@ -568,6 +568,9 @@ public class SpecialistService extends BaseService {
                //推送给居民模板消息
                pushWeiTemp(token, "0", remark, p, d);
            } else {
                //推送给居民模板消息
                pushWeiTemp(token, "1", "", p, d);
                //医生同意,推送全科医生消息
                SignFamily sign = signFamilyDao.findByPatient(josn.getString("patient"));
                //判断是否有家庭医生,有家庭医生则通知家庭医生
@ -599,11 +602,7 @@ public class SpecialistService extends BaseService {
                    dataJson.put("dept", d.getDept());
                    dataJson.put("deptName", d.getDeptName());
                    message.setReason(dataJson.toString());
                    messageDao.save(message);
                    //推送给居民模板消息
                    pushWeiTemp(token, "1", "", p, d);
                }
            }
            return "1";

+ 114 - 91
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorSignController.java

@ -54,19 +54,19 @@ public class DoctorSignController extends WeixinBaseController {
    @Autowired
    private PatientService patientService;
    @RequestMapping(value = "getPatientFamilyServer",method = RequestMethod.GET)
    @RequestMapping(value = "getPatientFamilyServer", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取居民慢病服务类型")
    public String getPatientFamilyServer(@ApiParam(name = "patient", value = "居民code") @RequestParam(required = true) String patient){
    public String getPatientFamilyServer(@ApiParam(name = "patient", value = "居民code") @RequestParam(required = true) String patient) {
        try {
            JSONObject json = signWebService.getPatientFamilyServer(patient);
            if(json.has("msg")){
                return error(-1,json.getString("msg"));
            if (json.has("msg")) {
                return error(-1, json.getString("msg"));
            }
            return write(200,"获取成功","data",json);
        }catch (Exception e){
            return write(200, "获取成功", "data", json);
        } catch (Exception e) {
            error(e);
            return error(-1,"请求失败");
            return error(-1, "请求失败");
        }
    }
@ -127,14 +127,14 @@ public class DoctorSignController extends WeixinBaseController {
            String doctor = getUID();
            Page<Object> page = infoService.findPatientByDoctorSign(doctor, id, pagesize, patientName);
            JSONArray array = new JSONArray();
            Map<Object,Object> exitMap = new HashMap<>();
            Map<Object, Object> exitMap = new HashMap<>();
            if (page != null) {
                for (Object obj : page) {
                    Object[] temp = (Object[]) obj;
                    if (temp == null) {
                        continue;
                    }
                    if(exitMap.get(temp[9])!=null){//防止患者既有三师签约也有家庭签约导致数据重复
                    if (exitMap.get(temp[9]) != null) {//防止患者既有三师签约也有家庭签约导致数据重复
                        continue;
                    }
                    JSONObject json = new JSONObject();
@ -159,7 +159,7 @@ public class DoctorSignController extends WeixinBaseController {
                    //患者联系方式
                    json.put("mobile", temp[10]);
                    array.put(json);
                    exitMap.put(temp[9],temp);
                    exitMap.put(temp[9], temp);
                }
            }
            return write(200, "查询成功!", "list", array);
@ -229,11 +229,12 @@ public class DoctorSignController extends WeixinBaseController {
     */
    @RequestMapping("/sign_info")
    public String getSignInfoByDoctor(
            @RequestParam(required = false)Integer status,
            @RequestParam(required = false)Integer doctorType,
            @RequestParam(required = false)Integer page,
            @RequestParam(required = false)Integer pageSize) {
        try {page = page > 0 ? page -1 : 0;
            @RequestParam(required = false) Integer status,
            @RequestParam(required = false) Integer doctorType,
            @RequestParam(required = false) Integer page,
            @RequestParam(required = false) Integer pageSize) {
        try {
            page = page > 0 ? page - 1 : 0;
            List<Map<String, Object>> listSign = signWebService.getSignWebByDoctor(getUID(), status, page, pageSize);
            JSONObject data = new JSONObject();
@ -296,7 +297,7 @@ public class DoctorSignController extends WeixinBaseController {
                    if (status == 3) {
                        boolean epTime = false;
                        try {
                            epTime = redisTemplate.hasKey("wechat:focus:remind:flag:"+temp.get("patient"));
                            epTime = redisTemplate.hasKey("wechat:focus:remind:flag:" + temp.get("patient"));
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
@ -339,12 +340,12 @@ public class DoctorSignController extends WeixinBaseController {
    @RequestMapping("/sign_info_count")
    @ApiOperation(value = "签约居民数目")
    public String getSignWebByDoctorCount(){
        try{
    public String getSignWebByDoctorCount() {
        try {
            //hxmD201703150222
            return write(200,"查询成功","data",signWebService.getSignWebByDoctorCount(getUID()));
        }catch (Exception e){
            return error(-1,"查询失败");
            return write(200, "查询成功", "data", signWebService.getSignWebByDoctorCount(getUID()));
        } catch (Exception e) {
            return error(-1, "查询失败");
        }
    }
@ -355,11 +356,11 @@ public class DoctorSignController extends WeixinBaseController {
     */
    @RequestMapping(value = "/is_remind_focus_all")
    @ApiOperation(value = "今天是否已全部提醒关注")
    public String isRemindFocusAllToday(){
        try{
            return write(200,"查询成功","data",signWebService.isRemindFocusAll(getUID()));
        }catch (Exception e){
            return error(-1,"查询失败");
    public String isRemindFocusAllToday() {
        try {
            return write(200, "查询成功", "data", signWebService.isRemindFocusAll(getUID()));
        } catch (Exception e) {
            return error(-1, "查询失败");
        }
    }
@ -370,29 +371,29 @@ public class DoctorSignController extends WeixinBaseController {
     */
    @RequestMapping(value = "/is_remind_expenses_all")
    @ApiOperation(value = "今天是否已全部提醒缴费")
    public String isRemindFExpensesAllToday(){
        try{
            return write(200,"查询成功","data",signWebService.isRemindExpensesAll(getUID()));
        }catch (Exception e){
    public String isRemindFExpensesAllToday() {
        try {
            return write(200, "查询成功", "data", signWebService.isRemindExpensesAll(getUID()));
        } catch (Exception e) {
            error(e);
            return error(-1,"查询失败");
            return error(-1, "查询失败");
        }
    }
    /**
     * 获取续签约患者信息
     *
     * @param status     签约状态 1:待签约 2 待缴费 3 已签约
     * @param status 签约状态 1:待签约 2 待缴费 3 已签约
     * @return
     */
    @RequestMapping("/sign_info_renew")
    @ApiOperation(value = "医生获取获取列表")
    public String getSignRenewInfoByDoctor(
            @RequestParam(required = true)int status,
            @RequestParam(required = true)int page,
            @RequestParam(required = true)int pageSize) {
            @RequestParam(required = true) int status,
            @RequestParam(required = true) int page,
            @RequestParam(required = true) int pageSize) {
        try {
            page = page > 0 ? page -1 : 0;
            page = page > 0 ? page - 1 : 0;
            List<Map<String, Object>> listSign = signWebService.getSignRenewWebByDoctor(getUID(), status, page, pageSize);
            //List<Map<String, Object>> listSign = signWebService.getSignRenewWebByDoctor("64de930c-5b15-11e6-8344-fa163e8aee56", status, page, pageSize);
            JSONObject data = new JSONObject();
@ -417,7 +418,7 @@ public class DoctorSignController extends WeixinBaseController {
                    json.put("status", temp.get("status"));
                    json.put("openid", temp.get("openid"));
                    json.put("renewTime", temp.get("czrq"));
                    json.put("renewFlag",temp.get("renewFlag"));
                    json.put("renewFlag", temp.get("renewFlag"));
                    String statusName = "";
                    switch (Integer.parseInt(temp.get("status").toString())) {
                        case 0:
@ -453,27 +454,28 @@ public class DoctorSignController extends WeixinBaseController {
    /**
     * 批量提醒居民续签
     *
     * @return
     */
    @RequestMapping("/sendRenewToPatients")
    @ApiOperation(value = "提醒用户签约接口")
    @ObserverRequired
    public String sendRenewToPatients(){
        try{
            int rs ;
            if(DateUtil.getNowMonth()>=7){
                rs = signWebService.sendRenewOverToPatients(getAccessToken(),getUID());
            }else{
                rs = signWebService.sendRenewToPatients(getAccessToken(),getUID());
    public String sendRenewToPatients() {
        try {
            int rs;
            if (DateUtil.getNowMonth() >= 7) {
                rs = signWebService.sendRenewOverToPatients(getAccessToken(), getUID());
            } else {
                rs = signWebService.sendRenewToPatients(getAccessToken(), getUID());
            }
            //int rs = signWebService.sendRenewToPatients(getAccessToken(),"zbqD201703150222");
            if(rs == 0){
            if (rs == 0) {
                return write(200, "您当前签约用户无需提醒!", "data", rs);
            }else{
            } else {
                return write(200, "提醒成功!", "data", rs);
            }
        }catch (Exception e){
        } catch (Exception e) {
            error(e);
            return error(-1, "提醒失败");
        }
@ -481,18 +483,18 @@ public class DoctorSignController extends WeixinBaseController {
    /**
     * 同意或拒绝
     *
     * @param state
     * @param refuseReason 医生拒签原因
     *
     * @return
     */
    @RequestMapping("/agreeRenew")
    @ApiOperation(value = "医生处理签约")
    @ObserverRequired
    public String agreeRenew(@RequestParam(required = true)String state,
                             @RequestParam(required = true)String patient,
    public String agreeRenew(@RequestParam(required = true) String state,
                             @RequestParam(required = true) String patient,
                             @RequestParam(required = false) Long mesId,
                             @RequestParam(required = false)String signCode,
                             @RequestParam(required = false) String signCode,
                             @RequestParam(required = false) String health,
                             @RequestParam(required = false) String disease,
                             @RequestParam(required = false) String custom,
@ -500,16 +502,16 @@ public class DoctorSignController extends WeixinBaseController {
                             @RequestParam(required = false) String healthDoctor,
                             @RequestParam(required = false) Long teamCode,
                             @RequestParam(required = false) String expenses,
                             @RequestParam(required = false) String refuseReason){
        try{
                             @RequestParam(required = false) String refuseReason) {
        try {
            //屏蔽了预签约
            int rs = 0;
            rs =signWebService.agreeRenewOverDue(getAccessToken(),getUID(),patient,state,mesId,"",signCode,health,disease,custom,sevId,healthDoctor,teamCode,expenses,refuseReason);
            if(rs != 1){
            rs = signWebService.agreeRenewOverDue(getAccessToken(), getUID(), patient, state, mesId, "", signCode, health, disease, custom, sevId, healthDoctor, teamCode, expenses, refuseReason);
            if (rs != 1) {
                //设置代码为已读
                signWebService.setMessState(mesId);
                return  write(200, "未找到签约记录", "data", rs);
            }else{
                return write(200, "未找到签约记录", "data", rs);
            } else {
                return write(200, "操作成功!", "data", rs);
            }
@ -544,7 +546,7 @@ public class DoctorSignController extends WeixinBaseController {
//            }else{
//                return write(200, "操作成功!", "data", rs);
//            }
        }catch (Exception e){
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
@ -590,19 +592,19 @@ public class DoctorSignController extends WeixinBaseController {
//    }
    /**
     *
     *统计
     * 统计
     * 咨询量、获取待预约、获取健康教育、获取健康指导
     *
     * @return
     */
    @RequestMapping("/getSignCountInfoInYear")
    @ApiOperation(value = "统计咨询量、获取待预约、获取健康教育、获取健康指导")
    public String getSignCountInfoInYear(@RequestParam(required = true)String patient){
        try{
            JSONObject rs =signWebService.getSignCountInfoInYear(patient);
    public String getSignCountInfoInYear(@RequestParam(required = true) String patient) {
        try {
            JSONObject rs = signWebService.getSignCountInfoInYear(patient);
            //JSONObject rs =signWebService.getRenewYearCount("64de930c-5b15-11e6-8344-fa163e8aee56");
            return write(200, "操作成功!", "data", rs);
        }catch (Exception e){
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
@ -611,19 +613,19 @@ public class DoctorSignController extends WeixinBaseController {
    @RequestMapping("/remindPatientRenew")
    @ApiOperation(value = "提醒居民续签")
    @ObserverRequired
    public String remindPatientRenew(@RequestParam(required = true)String patient){
        try{
            int rs =signWebService.remainPatientRenew(getAccessToken(),patient,getUID());
    public String remindPatientRenew(@RequestParam(required = true) String patient) {
        try {
            int rs = signWebService.remainPatientRenew(getAccessToken(), patient, getUID());
            //int rs =signWebService.remainPatientRenew(getAccessToken(),patient,"zbqD201703150222");
            if(rs==-1){
            if (rs == -1) {
                return error(-1, "提醒失败");
            }else if(rs ==1){
            } else if (rs == 1) {
                return write(200, "微信提醒成功!", "data", rs);
            }else if(rs ==2){
            } else if (rs == 2) {
                return write(200, "短信提醒成功!", "data", rs);
            }
            return error(-1, "提醒失败");
        }catch (Exception e){
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
@ -631,12 +633,13 @@ public class DoctorSignController extends WeixinBaseController {
    /**
     * 验证是否允许签约
     *
     * @param patient
     * @return
     */
    @RequestMapping(value = "/checkCanRenew", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    public String checkCanRenew(@RequestParam(required = true) String patient){
    public String checkCanRenew(@RequestParam(required = true) String patient) {
        try {
            //JSONObject result = patientService.checkCanSignRenew(patient);
            JSONObject result = patientService.checkCanRenewNew(patient);
@ -649,11 +652,12 @@ public class DoctorSignController extends WeixinBaseController {
    /**
     * 获取签约字典数据
     *
     * @return
     */
    @RequestMapping(value = "/getSigndict", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    public String getSigndict(@RequestParam(required = false) String signYear){
    public String getSigndict(@RequestParam(required = false) String signYear) {
        try {
            JSONArray result = patientService.getSigndict(signYear);
            return write(200, "查询成功", "data", result);
@ -665,11 +669,12 @@ public class DoctorSignController extends WeixinBaseController {
    /**
     * 获取签约字典数据
     *
     * @return
     */
    @RequestMapping(value = "/getSigndictTree", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    public String getSigndictTree(@RequestParam(required = true) Long teamCode){
    public String getSigndictTree(@RequestParam(required = true) Long teamCode) {
        try {
            JSONArray result = patientService.getSignByTeamCodeGpbyServer(teamCode);
            return write(200, "查询成功", "data", result);
@ -681,13 +686,14 @@ public class DoctorSignController extends WeixinBaseController {
    /**
     * 获取当前医生签约关系分组
     *
     * @return
     */
    @RequestMapping(value = "/getSignByDoctorCodeGpbyServer", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    public String getSignByDoctorCodeGpbyServer(){
    public String getSignByDoctorCodeGpbyServer() {
        try {
            JSONArray result = patientService.getSignByDoctorCodeGpbyServer(getUID(),null, false, "");
            JSONArray result = patientService.getSignByDoctorCodeGpbyServer(getUID(), null, false, "");
            //JSONArray result = patientService.getSignByDoctorCodeGpbyServer("xh1D201703150222");
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {
@ -697,12 +703,13 @@ public class DoctorSignController extends WeixinBaseController {
    }
    /**
     *  获取团队名称
     * 获取团队名称
     *
     * @return
     */
    @RequestMapping(value = "/getTeamNameByTeamCode", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    public String getTeamNameByTeamCode(@RequestParam(required = true) Long teamCode){
    public String getTeamNameByTeamCode(@RequestParam(required = true) Long teamCode) {
        try {
            String result = patientService.getTeamNameByTeamCode(teamCode);
            return write(200, "查询成功", "data", result);
@ -713,7 +720,7 @@ public class DoctorSignController extends WeixinBaseController {
    @RequestMapping(value = "/getPatientSignLogInfo", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    public String getPatientSignLogInfo(@RequestParam(required = true)String patient){
    public String getPatientSignLogInfo(@RequestParam(required = true) String patient) {
        try {
            JSONObject result = signWebService.getPatientSignLogInfo(patient);
            return write(200, "查询成功", "data", result);
@ -725,12 +732,12 @@ public class DoctorSignController extends WeixinBaseController {
    @RequestMapping(value = "/updateSignServerByCode", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    @ObserverRequired
    public String updateSignServerByCode(@RequestParam(required = true)String signCode,@RequestParam(required = true)String sevId){
    public String updateSignServerByCode(@RequestParam(required = true) String signCode, @RequestParam(required = true) String sevId) {
        try {
            int result = signWebService.updateSignServerByCode(signCode,sevId);
            if(result==1){
            int result = signWebService.updateSignServerByCode(signCode, sevId);
            if (result == 1) {
                return write(200, "保存成功", "data", result);
            }else{
            } else {
                return write(200, "保存失败", "data", result);
            }
        } catch (Exception e) {
@ -741,11 +748,12 @@ public class DoctorSignController extends WeixinBaseController {
    /**
     * 获取厦门市区
     *
     * @return
     */
    @RequestMapping(value = "/getTownList", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    public String getTownList(){
    public String getTownList() {
        try {
            return write(200, "查询成功", "data", signWebService.getTownList());
        } catch (Exception e) {
@ -756,12 +764,13 @@ public class DoctorSignController extends WeixinBaseController {
    /**
     * 获取区域下街道
     *
     * @param town
     * @return
     */
    @RequestMapping(value = "/getStreetListByTown", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    public String getStreetListByTown(@RequestParam(required = true)String town){
    public String getStreetListByTown(@RequestParam(required = true) String town) {
        try {
            return write(200, "查询成功", "data", signWebService.getStreetListByTown(town));
        } catch (Exception e) {
@ -773,12 +782,13 @@ public class DoctorSignController extends WeixinBaseController {
    /**
     * 获取街道下居委会
     *
     * @param street
     * @return
     */
    @RequestMapping(value = "/getCountryListByStreet", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    public String getCountryListByStreet(@RequestParam(required = true)String street){
    public String getCountryListByStreet(@RequestParam(required = true) String street) {
        try {
            return write(200, "查询成功", "data", signWebService.getCountryListByStreet(street));
        } catch (Exception e) {
@ -789,35 +799,48 @@ public class DoctorSignController extends WeixinBaseController {
    /**
     * 获取居委会字段
     *
     * @param countryCode
     * @return
     */
    @RequestMapping(value = "/updatePatientCountry", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    public String setPatientCountry(@RequestParam(required = true)String countryCode){
    public String setPatientCountry(@RequestParam(required = true) String countryCode) {
        try {
            return write(200, "保存成功", "data", signWebService.setPatientCountry(countryCode,getRepUID()));
            return write(200, "保存成功", "data", signWebService.setPatientCountry(countryCode, getRepUID()));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
    
    /**
     * 根据身份证号同步居民签约信息
     *
     * @param idcard
     * @return
     */
    @RequestMapping(value = "/loadSignFamilyByIdcard", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    public String loadSignFamilyByIdcard(@RequestParam(required = true)String idcard){
    public String loadSignFamilyByIdcard(@RequestParam(required = true) String idcard) {
        try {
            String re = jwSignService.LoadSignFamilyByIdcard(idcard);
            Patient patient = patientService.findByIdcard(idcard);
            return write(200, "更新签约成功","patient",patient);
            return write(200, "更新签约成功", "patient", patient);
        } catch (Exception e) {
            error(e);
            return error(-1, "更新签约失败!");
        }
    }
    @RequestMapping(value = "/findPatientCertificate", method = {RequestMethod.GET})
    @ResponseBody
    @ApiOperation("获取居民服务类型凭证")
    public String findPatientCertificate(@ApiParam(name = "patient", value = "居民code") @RequestParam(required = true)String patient) {
        try {
            return write(200, "查询成功", "data", signWebService.findPatientCertificate(patient));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
}

+ 47 - 11
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/sign/FamilyContractController.java

@ -13,10 +13,11 @@ import com.yihu.wlyy.service.app.sign.FamilyContractService;
import com.yihu.wlyy.service.app.sign.SignWebService;
import com.yihu.wlyy.service.common.account.DoctorService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.util.CommonUtil;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.IdcardValidator;
import com.yihu.wlyy.util.RSAUtils;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.web.WeixinBaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -33,7 +34,6 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.net.URLDecoder;
import java.util.Calendar;
import java.util.List;
/**
@ -44,7 +44,7 @@ import java.util.List;
@Controller
@RequestMapping(value = "/patient/family_contract", produces = MediaType.APPLICATION_JSON_UTF8_VALUE,method = {RequestMethod.GET,RequestMethod.POST})
@Api(description = "患者端-家庭签约")
public class FamilyContractController extends BaseController {
public class FamilyContractController extends WeixinBaseController {
    @Autowired
    private FamilyContractService familyContractService;
@ -60,6 +60,8 @@ public class FamilyContractController extends BaseController {
    private SignWebService signWebService;
    @Autowired
    private RSAUtils rsaUtils;
    @Autowired
    private CommonUtil CommonUtil;
    /**
     * 得到患者的签约的医生的信息
     *
@ -96,13 +98,11 @@ public class FamilyContractController extends BaseController {
    @RequestMapping(value = "getSignMessageOverdue")
    @ResponseBody
    @ApiOperation("")
    @ApiOperation("获取签约过期全科医生过期信息")
    public String getSignDoctorMessageOverDue(String patientCode) {
        try {
            JSONArray array = familyContractService.getSignDoctorMessageOverDue(patientCode);
            return write(200, "获取列表成功!", "list", array);
            return write(200, "获取列表成功!", "list", familyContractService.getSignDoctorMessageOverDue(patientCode));
        } catch (Exception e) {
            error(e);
            return error(-1, "获取列表失败!");
@ -425,7 +425,8 @@ public class FamilyContractController extends BaseController {
    public String sign(@RequestParam(required = false)String doctor,
                       @RequestParam(required = false)String patient,
                       @RequestParam(required = false)String countryCode,
                       @RequestParam(required = true)String medicareNumber) {
                       @RequestParam(required = true)String medicareNumber,
                       @RequestParam(required = false)String sevId) {
        try {
            if (StringUtils.isEmpty(doctor)) {
                return error(-1, "签约医生不能为空");
@ -437,7 +438,7 @@ public class FamilyContractController extends BaseController {
            }
            //==1.3.7===end===
            //1.4.2加入MedicareNumber字段入参
            int result = familyContractService.sign(doctor,patient,countryCode,medicareNumber);
            int result = familyContractService.sign(doctor,patient,countryCode,medicareNumber,sevId);
            if (result == -1) {
                return error(-1, "用户信息查询失败");
@ -446,6 +447,18 @@ public class FamilyContractController extends BaseController {
            } else if (result == -3) {
                return error(-1, "医生信息查询失败");
            } else {
                //1.4.9.1加入证件说明
                // 图片消息
                String content = fetchWxImages();
                // 将临时图片拷贝到正式存储路径下
                if (StringUtils.isNotEmpty(content)) {
                    content = CommonUtil.copyTempImage(content);
                    if (StringUtils.isNotEmpty(content)) {
                        familyContractService.saveCertificate(patient,content,sevId);
                    }
                }
                return write(200, "签约申请成功");
            }
        } catch (Exception e) {
@ -468,7 +481,8 @@ public class FamilyContractController extends BaseController {
                            @RequestParam(required = false) String patient,
                            @RequestParam(required = false) String reason,
                            @RequestParam(required = false) String countryCode,
                            @RequestParam(required = true) String medicareNumber) {
                            @RequestParam(required = true) String medicareNumber,
                            @RequestParam(required = false)String sevId) {
        try {
            if (StringUtils.isEmpty(doctor)) {
                return error(-1, "签约医生不能为空");
@ -483,7 +497,7 @@ public class FamilyContractController extends BaseController {
//                result = familyContractService.signRenewOverdue(doctor,healthDoctor,patient,reason,countryCode,medicareNumber);
//            }
            int result = -1;
            result = familyContractService.signRenewOverdue(doctor,healthDoctor,patient,reason,countryCode,medicareNumber);
            result = familyContractService.signRenewOverdue(doctor,healthDoctor,patient,reason,countryCode,medicareNumber,sevId);
            if (result == -1) {
                return error(-1, "用户信息查询失败");
@ -496,6 +510,17 @@ public class FamilyContractController extends BaseController {
            } else if (result == -5) {
                return error(-1, "未找到有效团队记录");
            } else {
                //1.4.9.1加入证件说明
                // 图片消息
                String content = fetchWxImages();
                // 将临时图片拷贝到正式存储路径下
                if (StringUtils.isNotEmpty(content)) {
                    content = CommonUtil.copyTempImage(content);
                    if (StringUtils.isNotEmpty(content)) {
                        familyContractService.saveCertificate(patient,content,sevId);
                    }
                }
                return write(200, "签约申请成功");
            }
        } catch (Exception e) {
@ -728,5 +753,16 @@ public class FamilyContractController extends BaseController {
        }
    }
    @RequestMapping("/getSignDict")
    @ApiOperation(value = "获取当前年度服务类型")
    @ResponseBody
    public String getSignDict() {
        try{
            return write(200, "操作成功!", "data", familyContractService.getSignDict());
        }catch (Exception e){
            error(e);
            return error(-1, "请求失败");
        }
    }
}

+ 58 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/clean/ImCleanController.java

@ -0,0 +1,58 @@
package com.yihu.wlyy.web.third.clean;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/**
 * @author yeshijie on 2018/7/18.
 */
@RestController
@RequestMapping(value = "/imclean",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "im清理")
public class ImCleanController  extends BaseController {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Value("${im.data_base_name}")
    private String imDb;
    @RequestMapping(value = "/clean",method = RequestMethod.POST)
    @ApiOperation("清理")
    public String clean(){
        try {
            String sql1 = "SELECT * from wlyy_sign_family WHERE `status`>0 and patient in(SELECT DISTINCT patient from wlyy_consult_team)";
            List<Map<String,Object>> list = jdbcTemplate.queryForList(sql1);
            list.stream().forEach(one->{
                String patient = one.get("patient").toString();
                String teamCode = one.get("team_code").toString();
                String sessionId = patient+"_"+teamCode+"_2";
                String doctor = one.get("doctor").toString();
                String doctor_health = null;
                String sql2 = "";
                if(one.get("doctor_health")!=null){
                    doctor_health = one.get("doctor_health").toString();
                    sql2 = "delete from "+imDb+".participants where session_id = '"+sessionId+"' and participant_id not in ('"+patient+"','"+doctor+"','"+doctor_health+"')" ;
                }else {
                    sql2 = "delete from "+imDb+".participants where session_id = '"+sessionId+"' and participant_id not in ('"+patient+"','"+doctor+"')" ;
                }
                jdbcTemplate.execute(sql2);
            });
            return success("清理成功");
        }catch (Exception e){
            error(e);
            return error(-1, e.getMessage());
        }
    }
}

+ 35 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/process/WeiXinEventProcess.java

@ -1,7 +1,9 @@
package com.yihu.wlyy.wechat.process;
import com.yihu.wlyy.entity.dict.SystemDict;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.repository.dict.SystemDictDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.SystemConf;
@ -22,7 +24,7 @@ import java.util.*;
/**
 * 微信事件处理
 * <p>
 * Created by lyr on 2016/08/11.
 * Created by lyr on 2016/08/11
 */
@Component
public class WeiXinEventProcess {
@ -45,6 +47,8 @@ public class WeiXinEventProcess {
    
    @Autowired
    private PatientService patientService;
    @Autowired
    private DoctorDao doctorDao;
    /**
     * 微信推送事件处理
@ -691,6 +695,8 @@ public class WeiXinEventProcess {
            articles.add(article);
            //设置医生活动二维码
            setDoctorActivity(keys[0],articles,systemConf);
            //设置通用链接
            setUrlItems(articles, systemConf);
            //加入续签图文
@ -851,6 +857,13 @@ public class WeiXinEventProcess {
        return result;
    }
    /**
     * 设置专科医生二维码
     * @param articles
     * @param doctor
     * @param teamId
     * @param systemConf
     */
    public void setSpDisease(List<Map<String, String>> articles,String doctor,String teamId,Properties systemConf){
        String url = systemDictDao.findByDictName("SP_DISEASE").get(0).getCode();
@ -872,6 +885,11 @@ public class WeiXinEventProcess {
        articles.add(articleConsult);
    }
    /**
     * 设置通用二维码
     * @param articles
     * @param systemConf
     */
    public void setCurrency(List<Map<String, String>> articles,Properties systemConf){
        String url = systemDictDao.findByDictName("WX_CURRENCY_QR_PATH").get(0).getCode();
@ -894,6 +912,22 @@ public class WeiXinEventProcess {
        articles.add(articleConsult);
    }
    public void setDoctorActivity(String doctor,List<Map<String, String>> articles,Properties systemConf){
        Doctor d = doctorDao.findByCode(doctor);
        if(d!=null&&StringUtils.isNotBlank(d.getActivityPath())){
            logger.info("setDoctorActivity:"+d.getActivityPath());
            // 图文消息图片URL
            String activityPath = systemConf.getProperty("doctor_activity_url");
            activityPath = activityPath.replace("{server}", serverUrl);
            Map<String, String> articleConsult = new HashMap<>();
            articleConsult.put("Url", d.getActivityPath());
            articleConsult.put("Title", "家庭医生线上签约指引");
            articleConsult.put("Description", "贴心家庭医生为居民提供健康指导、随访等服务\n");
            articleConsult.put("PicUrl", activityPath);
            articles.add(articleConsult);
        }
    }
    /**
     * 构建单个图文消息工具类
     *

+ 2 - 0
patient-co/patient-co-wlyy/src/main/resources/system.properties

@ -38,6 +38,8 @@ patient_wifi_pic_url = {server}/images/wifi.png
patient_draw_pic_url = {server}/images/banner02.png
#专科医生签约图片地址
specialist_sign_url = {server}/images/SpBanner.png
#专科医生签约图片地址
doctor_activity_url = {server}/images/activity.png
#通用活动图片地址
currency_url = {server}/images/currency.png
#居民wifi链接

BIN
patient-co/patient-co-wlyy/src/main/webapp/images/activity.png