Преглед изворни кода

1.新增签约CODE 以作统计使用

trick9191 пре 8 година
родитељ
комит
df6d14ce7a

+ 10 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/consult/Consult.java

@ -43,6 +43,8 @@ public class Consult extends IdEntity {
	private String del;
	// 结束时间
	private Date endTime;
	//签约表Code
	private String  signCode;
	public String getCode() {
		return code;
@ -124,4 +126,12 @@ public class Consult extends IdEntity {
	public void setGuidance(Long guidance) {
		this.guidance = guidance;
	}
	public String getSignCode() {
		return signCode;
	}
	public void setSignCode(String signCode) {
		this.signCode = signCode;
	}
}

+ 11 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/education/HealthEduArticlePatient.java

@ -53,6 +53,9 @@ public class HealthEduArticlePatient extends IdEntity {
	//批次号记录发送所属批次
	private String batchNo;
	//签约表code
	private String signCode;
	public String getBatchNo() {
		return batchNo;
	}
@ -167,4 +170,12 @@ public class HealthEduArticlePatient extends IdEntity {
	public void setSummary(String summary) {
		this.summary = summary;
	}
	public String getSignCode() {
		return signCode;
	}
	public void setSignCode(String signCode) {
		this.signCode = signCode;
	}
}

+ 11 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/followup/Followup.java

@ -62,6 +62,9 @@ public class Followup extends IdEntity {
	// 行政团队
	private Long adminTeamCode;
	//签约表Code
	private String signCode;
	public Date getFollowupPlanDate() {
		return followupPlanDate;
	}
@ -241,4 +244,12 @@ public class Followup extends IdEntity {
	public void setAdminTeamCode(Long adminTeamCode) {
		this.adminTeamCode = adminTeamCode;
	}
	public String getSignCode() {
		return signCode;
	}
	public void setSignCode(String signCode) {
		this.signCode = signCode;
	}
}

+ 10 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/PatientHealthGuidance.java

@ -44,6 +44,8 @@ public class PatientHealthGuidance extends IdEntity {
	private int readStatus;
//	指导创建时间
	private Date createTime;
	//签约表Code
	private String signCode;
	public Date getCreateTime() {
		return createTime;
@ -133,4 +135,12 @@ public class PatientHealthGuidance extends IdEntity {
	public void setAdminTeamCode(Long adminTeamCode) {
		this.adminTeamCode = adminTeamCode;
	}
	public String getSignCode() {
		return signCode;
	}
	public void setSignCode(String signCode) {
		this.signCode = signCode;
	}
}

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

@ -33,6 +33,7 @@ import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.app.scheduling.DoctorWorkTimeService;
import com.yihu.wlyy.service.app.talk.TalkGroupService;
import com.yihu.wlyy.service.common.SMSService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.ImUtill;
@ -111,6 +112,7 @@ public class DoctorInfoService extends BaseService {
    @Autowired
    private WeiXinOpenIdUtils weiXinOpenIdUtils;
    /**
     * 获取医生的签约病人
     *

+ 5 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultService.java

@ -7,6 +7,7 @@ import java.util.List;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.util.SendPatientUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
@ -55,6 +56,9 @@ public class ConsultService extends BaseService {
	@Autowired
	private SignFamilyDao signFamilyDao;
	@Autowired
	private PatientService patientService;
	/**
	 * 添加一条咨询记录
	 * @param patient 患者信息
@ -72,6 +76,7 @@ public class ConsultService extends BaseService {
		consult.setSymptoms(symptoms);
		consult.setImages(images);
		consult.setType(type);
		consult.setSignCode(patientService.getSignCodeByPatient(patient));
		return consultDao.save(consult);
	}

+ 10 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/followup/FollowUpService.java

@ -17,6 +17,7 @@ import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.team.DrHealthTeamService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.service.system.SystemDictService;
import com.yihu.wlyy.task.FollowupUploadTask;
import com.yihu.wlyy.task.PushMsgTask;
@ -77,6 +78,9 @@ public class FollowUpService extends BaseService {
    @Autowired
    SystemDictService dictService;
    @Autowired
    private PatientService patientService;
    /**
     * 转译随访信息
     */
@ -309,6 +313,9 @@ public class FollowUpService extends BaseService {
                followup.setCreater(doctorCode);
                followup.setAdminTeamCode(signFamily.getAdminTeamId());
                followup.setSignType(2);
                //新增签约保存CODE
                followup.setSignCode(patientService.getSignCodeByPatient(patientCode));
                followupPlan.add(followup);
            }
@ -399,6 +406,9 @@ public class FollowUpService extends BaseService {
        followup.setCreater(doctorCode);
        followup.setAdminTeamCode(signFamily.getAdminTeamId());
        followup.setSignType(2);
        //保存质询code
        followup.setSignCode(patientService.getSignCodeByPatient(patientCode));
        followupDao.save(followup);
        re = String.valueOf(followup.getId());
        return re;

+ 5 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/PatientHealthGuidanceService.java

@ -9,6 +9,7 @@ import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.PatientHealthGuidanceDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
@ -46,6 +47,8 @@ public class PatientHealthGuidanceService extends BaseService {
	JdbcTemplate jdbcTemplate;
	@Autowired
	WeiXinOpenIdUtils weiXinOpenIdUtils;
	@Autowired
	private PatientService patientService;
	public JSONObject findById(Long id){
		PatientHealthGuidance guidance = patientHealthGuidanceDao.findOne(id);
@ -111,6 +114,8 @@ public class PatientHealthGuidanceService extends BaseService {
		guidance.setDel("1");
		guidance.setAdminTeamCode(signFamily.getAdminTeamId());
		guidance.setSignType(2);
		//保存签约CODE
		guidance.setSignCode(patientService.getSignCodeByPatient(patient.getCode()));
		guidance = patientHealthGuidanceDao.save(guidance);
		String openId = null;

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

@ -6,6 +6,7 @@ import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.patient.SignFamilyRenew;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.app.team.AdminTeamService;
import com.yihu.wlyy.service.common.account.DoctorService;
@ -356,8 +357,57 @@ public class SignWebService extends BaseService {
    }
    public JSONArray getSigns(String patient){
        List<SignFamily> signFamilys =  signFamilyDao.findAllActiveSignByPatient(patient);
        JSONArray jsonArray = new JSONArray();
        //加入续签表数据
        List<SignFamilyRenew> renews = jdbcTemplate.queryForList(
                "SELECT * FROM wlyy_sign_family_renew t " +
                        "WHERE t.patient = '"+patient+"' AND t.status <> -1 and t.status <> -2",SignFamilyRenew.class);
        for(SignFamilyRenew renew: renews){
            AdminTeam adminTeam = null;
            Doctor doctor = null;
            if(renew.getAdminTeamId()!=null){
                adminTeam = adminTeamService.getTeam(renew.getAdminTeamId());
                doctor = doctorService.findDoctorByCode(adminTeam.getLeaderCode());
            }
            if(adminTeam==null)adminTeam = new AdminTeam();
            if(doctor==null)doctor = new Doctor();
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("hospitalName",renew.getHospitalName());
            jsonObject.put("hospital",renew.getHospital());
            jsonObject.put("code",renew.getCode());
            jsonObject.put("teamCode",renew.getTeamCode());
            jsonObject.put("begin",renew.getBegin());
            jsonObject.put("end",renew.getEnd());
            jsonObject.put("status",renew.getStatus());
            jsonObject.put("leader",adminTeam.getLeaderCode());
            jsonObject.put("leaderName",doctor.getName());
            jsonObject.put("doctor",renew.getDoctor());
            jsonObject.put("doctorHealth",renew.getDoctorHealth());
            jsonObject.put("doctorName",renew.getDoctorName());
            jsonObject.put("doctorHealthName",renew.getDoctorHealthName());
            jsonObject.put("expensesStatus",StringUtils.isNotBlank(renew.getExpensesStatus())?renew.getExpensesStatus():"1");
            jsonObject.put("applyDate",renew.getApplyDate());
            jsonObject.put("createTime",renew.getCzrq());
            jsonObject.put("type",renew.getType());
            jsonObject.put("typeName",renew.getType()==1?"三师签约":"家庭签约");
            String statusName = "";
            switch (jsonObject.getInt("status")){
                case -4 : statusName = "已到期";break;
                case -3 : statusName ="已解约";break;
                case 0 : statusName ="待审核";break;
                case 1 : if(jsonObject.getInt("expensesStatus")==1){statusName ="已签约";}else{statusName ="待缴费";} break;
                case 2 : statusName ="患者申请取消签约";break;
                case 3 : statusName ="医生申请取消签约";break;
            }
            jsonObject.put("statusName",statusName);
            jsonArray.put(jsonObject);
        }
        //查询签约表数据
        List<SignFamily> signFamilys =  signFamilyDao.findAllActiveSignByPatient(patient);
        for(SignFamily signFamily: signFamilys){
            AdminTeam adminTeam = null;
            Doctor doctor = null;

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

@ -9,6 +9,7 @@ import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorPatient;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.patient.SignFamilyRenew;
import com.yihu.wlyy.entity.security.Token;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.doctor.DoctorPatientDao;
@ -30,6 +31,7 @@ import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springside.modules.utils.Clock;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
@ -295,7 +297,74 @@ public class PatientService extends TokenService {
        return null;
    }
    /**
     * 判断是否续签
     * @param patient
     * @return
     */
    public JSONObject checkCanRenew(String patient){
        return  null;
        // 是否可以续签逻辑
        //A:wlyy_sign_family
        //B: wlyy_sign_family_renew
        //签约状态(-1患者已取消,-2已拒绝,-3已解约,-4已到期,0待签约,1已签约,2患者申请取消签约,3医生申请取消签约
        //扣费状态 【0未扣费 1已扣费 2已退费】
        JSONObject rs = new JSONObject();
        //判断是否签约
        List<SignFamily> signs =  jdbcTemplate.queryForList("SELECT t.id FROM wlyy_sign_family t WHERE t.status >=0 AND t.expenses_status ='1' AND  t.patient ='"+patient+"'  NOW() >= t.begin and NOW() <= t.end",SignFamily.class);
        if(signs!=null){
            //当前年度已经签约
            rs.put("issign","1");
        }else{
            //当前年度未签约
            rs.put("issign","0");
        }
        //A表有已签约,但还没有扣费的记录的,不允许续签
        List<SignFamily>  signFamilys1 = jdbcTemplate.queryForList("SELECT t.id FROM wlyy_sign_family t WHERE t.status >=0 AND t.expenses_status <>'1' AND t.patient ='"+patient+"'",SignFamily.class);
        if(signFamilys1!=null){
            rs.put("isrenew","0");
            return rs;
        }
        //A表有已签约,且已扣费,当前日期超过了7月1日,且当前日期在合约的有效期范围内,不允许续签
        Calendar calendar =Calendar.getInstance();
        String year = calendar.get(Calendar.YEAR)+"";
        List<SignFamily>  signFamilys2 = jdbcTemplate.queryForList("SELECT t.id FROM wlyy_sign_family t WHERE t.status >=0 AND t.expenses_status ='1' AND  t.patient ='"+patient+"' AND CURDATE()>'"+year+"-07-01' NOW() >= t.begin and NOW() <= t.end",SignFamily.class);
        if(signFamilys2!=null){
            rs.put("isrenew","0");
            return rs;
        }
        //B表:已签约且未生效,不允许续签
        List<SignFamilyRenew> signFamilyRenews = jdbcTemplate.queryForList("SELECT t.id FROM wlyy_sign_family_renew t WHERE t.status>=0 AND  t.is_valid = 0 AND t.patient ='"+patient+"'",SignFamilyRenew.class);
        if(signFamilyRenews!=null){
            rs.put("isrenew","0");
            return rs;
        }
        //都未有记录则允许续签
        rs.put("isrenew","1");
        return rs;
    }
    /**
     * 根据居民ID查询签约CODE
     * @param patient
     * @return
     */
    public String getSignCodeByPatient(String patient){
        if(StringUtils.isBlank(patient)){
            return "";
        }
        try{
            List<SignFamily> signFamilies = jdbcTemplate.queryForList("SELECT * FROM wlyy_sign_family WHERE t.patient = '"+patient+"' AND t.status >=0 AND t.expenses_status ='1' ",SignFamily.class);
            if(signFamilies!=null && signFamilies.size()>0){
                return signFamilies.get(0).getCode();
            }
        }catch (Exception e){
            return "";
        }
        return "";
    }
}

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

@ -414,6 +414,7 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
                    heap.setBatchNo(batchNo);
                    //创建时间
                    heap.setCzrq(createTime);
                    heap.setSignCode(patientService.getSignCodeByPatient(p));
                    list.add(heap);
                    consultService.sendMucMessageBySingnType(doctor.getCode(), doctor.getName(), p, "{\"title\":\"" + temp.getTitle()+ "\",\"type\":0,\"id\":\"" + temp.getCode() + "\",\"img\":\"" + temp.getUrl() + "\",\"content\":\"为了您的健康,我给您发送了一篇文章,请咨询查阅,如有问题,可随时与我沟通\"}", "4", patientTemp.getName());
                    if(StringUtils.isNotBlank(attachedContent)){

+ 12 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/sign/FamilyContractController.java

@ -613,9 +613,19 @@ public class FamilyContractController extends BaseController {
        }
    }
    /**
     * 验证是否允许签约
     * @param patient
     * @return
     */
    @RequestMapping(value = "/checkCanRenew", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    public String checkCanRenew(String patient){
        return  null;
    public String checkCanRenew(@RequestParam(required = true) String patient){
        try {
            JSONObject result = patientService.checkCanRenew(patient);
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {
            return error(-1, "查询失败");
        }
    }
}