Parcourir la source

患者首页信息添加

lyr il y a 8 ans
Parent
commit
94ee54cbbf

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

@ -21,6 +21,7 @@ import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -53,7 +54,8 @@ public class SignPatientLabelInfoService extends BaseService {
    JdbcTemplate jdbcTemplate;
    @Autowired
    SignFamilyDao signFamilyDao;
    @Autowired
    StringRedisTemplate redisTemplate;
    /**
     * 根据标签查询患者信息
     *
@ -177,6 +179,10 @@ public class SignPatientLabelInfoService extends BaseService {
                json.put("name", p.getName());
                // 设置患者手机号
                json.put("mobile", p.getMobile());
                // 设置患者联系电话
                json.put("phone", p.getPhone());
                // 设置患者紧急联系人
                json.put("emerMobile", sign.get("emer_mobile") == null ? "" : String.valueOf(sign.get("emer_mobile")));
                // 设置患者头像
                json.put("photo", p.getPhoto());
                // 设置患者年龄
@ -198,6 +204,15 @@ public class SignPatientLabelInfoService extends BaseService {
                // 缴费类型
                json.put("expensesType", sign.get("expenses_type") != null ? String.valueOf(sign.get("expenses_type")): "");
                if (StringUtils.isEmpty(String.valueOf(json.get("expensesStatus"))) || String.valueOf(json.get("expensesStatus")).equals("0")) {
                    String epTime = redisTemplate.opsForValue().get("expenses:remind:" + p.getCode());
                    if (StringUtils.isEmpty(epTime)) {
                        json.put("expensesRemindStatus", 0);
                    } else {
                        json.put("expensesRemindStatus", new SimpleDateFormat("yyyy-MM-dd").format(new Date()).equals(epTime) ? 1 : 0);
                    }
                }
                // 患者标签
                //json.put("labels", labels == null ? "" : labels);
@ -281,6 +296,10 @@ public class SignPatientLabelInfoService extends BaseService {
                json.put("name", p.getName());
                // 设置患者手机号
                json.put("mobile", p.getMobile());
                // 设置患者联系电话
                json.put("phone", p.getPhone());
                // 设置患者紧急联系人
                json.put("emerMobile", sign.get("emer_mobile") == null ? "" : String.valueOf(sign.get("emer_mobile")));
                // 设置患者头像
                json.put("photo", p.getPhoto());
                // 设置患者年龄
@ -301,6 +320,15 @@ public class SignPatientLabelInfoService extends BaseService {
                json.put("expensesTime", sign.get("expenses_time") != null ? DateUtil.dateToStr((Date) sign.get("expenses_time"), DateUtil.YYYY_MM_DD_HH_MM) : "");
                // 缴费类型
                json.put("expensesType", sign.get("expenses_type") != null ? String.valueOf(sign.get("expenses_type")): "");
                if (StringUtils.isEmpty(String.valueOf(json.get("expensesStatus"))) || String.valueOf(json.get("expensesStatus")).equals("0")) {
                    String epTime = redisTemplate.opsForValue().get("expenses:remind:" + p.getCode());
                    if (StringUtils.isEmpty(epTime)) {
                        json.put("expensesRemindStatus", 0);
                    } else {
                        json.put("expensesRemindStatus", new SimpleDateFormat("yyyy-MM-dd").format(new Date()).equals(epTime) ? 1 : 0);
                    }
                }
                // 患者标签
                json.put("labels", labels == null ? "" : labels);
@ -730,6 +758,10 @@ public class SignPatientLabelInfoService extends BaseService {
                json.put("name", p.getName());
                // 设置患者手机号
                json.put("mobile", p.getMobile());
                // 设置患者联系电话
                json.put("phone", p.getPhone());
                // 设置患者紧急联系人
                json.put("emerMobile", sign.get("emer_mobile") == null ? "" : String.valueOf(sign.get("emer_mobile")));
                // 设置患者头像
                json.put("photo", p.getPhoto());
                // 设置患者年龄
@ -750,6 +782,15 @@ public class SignPatientLabelInfoService extends BaseService {
                json.put("expensesTime", sign.get("expenses_time") != null ? DateUtil.dateToStr((Date) sign.get("expenses_time"), DateUtil.YYYY_MM_DD_HH_MM) : "");
                // 缴费类型
                json.put("expensesType", sign.get("expenses_type") != null ? String.valueOf(sign.get("expenses_type")): "");
                if (StringUtils.isEmpty(String.valueOf(json.get("expensesStatus"))) || String.valueOf(json.get("expensesStatus")).equals("0")) {
                    String epTime = redisTemplate.opsForValue().get("expenses:remind:" + p.getCode());
                    if (StringUtils.isEmpty(epTime)) {
                        json.put("expensesRemindStatus", 0);
                    } else {
                        json.put("expensesRemindStatus", new SimpleDateFormat("yyyy-MM-dd").format(new Date()).equals(epTime) ? 1 : 0);
                    }
                }
                // 患者标签
                json.put("labels", labels == null ? "" : labels);

+ 50 - 21
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorFamilyContractController.java

@ -3,6 +3,7 @@ package com.yihu.wlyy.web.doctor.sign;
import java.net.URLDecoder;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -244,8 +245,8 @@ public class DoctorFamilyContractController extends WeixinBaseController {
            }
            Doctor cDoctor = doctorService.findDoctorByCode(getUID());
            SignFamily sf = familyContractService.agent(getAccessToken(), name, doctor, doctorName,
                    healthDoctor, healthDoctorName,cDoctor.getHospital(), cDoctor.getHosptialName(),
                    idcard, ssc, mobile, emerMobile, images, healthLabel, customLabel, disease, expenses, signDoctorCode, signDoctorName, signDoctorLevel,adminTeamCode);
                    healthDoctor, healthDoctorName, cDoctor.getHospital(), cDoctor.getHosptialName(),
                    idcard, ssc, mobile, emerMobile, images, healthLabel, customLabel, disease, expenses, signDoctorCode, signDoctorName, signDoctorLevel, adminTeamCode);
            if (sf == null) {
                return error(-1, "代理签约失败!");
@ -268,17 +269,17 @@ public class DoctorFamilyContractController extends WeixinBaseController {
     * @param msgid            消息id
     * @param patientIDcard    患者身份证
     * @param type             处理类型:1同意,2拒绝
     * @param adminTeamCode     行政团队code
     * @param adminTeamCode    行政团队code
     * @return
     */
    @RequestMapping(value = "sign")
    @ResponseBody
    public String sign(
            @RequestParam(required = true, defaultValue = "1") String signType,
            @RequestParam(required = false, defaultValue = "")String healthDoctor,
            @RequestParam(required = false, defaultValue = "")String healthDoctorName,
            @RequestParam(required = false, defaultValue = "") String healthDoctor,
            @RequestParam(required = false, defaultValue = "") String healthDoctorName,
            @RequestParam(required = false, defaultValue = "") String doctor,
            @RequestParam(required = false, defaultValue = "")String doctorName,
            @RequestParam(required = false, defaultValue = "") String doctorName,
            String healthLabel,
            @RequestParam(required = false, defaultValue = "") String customLabel,
            @RequestParam(required = false, defaultValue = "") String disease,
@ -311,7 +312,7 @@ public class DoctorFamilyContractController extends WeixinBaseController {
                }
            }
            if(StringUtils.isEmpty(doctor) && StringUtils.isEmpty(healthDoctor)){
            if (StringUtils.isEmpty(doctor) && StringUtils.isEmpty(healthDoctor)) {
                return error(-1, "全科医生或健管师不能为空!");
            }
@ -319,7 +320,7 @@ public class DoctorFamilyContractController extends WeixinBaseController {
                return error(-1, "健康情况标签不能为空!");
            }
            int res = familyContractService.handleSign(signType, getAccessToken(),doctor,doctorName, healthDoctor, healthDoctorName, msgid, patientIDcard, type, healthLabel, customLabel, disease, expenses,adminTeamCode);
            int res = familyContractService.handleSign(signType, getAccessToken(), doctor, doctorName, healthDoctor, healthDoctorName, msgid, patientIDcard, type, healthLabel, customLabel, disease, expenses, adminTeamCode);
            if (res == -1) {
                return error(-1, "未知的处理类型!");
            } else if (res == 0) {
@ -350,9 +351,9 @@ public class DoctorFamilyContractController extends WeixinBaseController {
        try {
            Map<String, Object> res = familyContractService.getSanshiSignByPatientCode(patientCode);
            if(String.valueOf(res.get("hasSanshi")).equals("true") && StringUtils.isNotEmpty(signDoctor)){
                List<AdminTeam> teams = teamService.findDoctorsTeams(signDoctor,String.valueOf(res.get("qkCode")));
                res.put("team",teams != null ? teams : new ArrayList<AdminTeam>());
            if (String.valueOf(res.get("hasSanshi")).equals("true") && StringUtils.isNotEmpty(signDoctor)) {
                List<AdminTeam> teams = teamService.findDoctorsTeams(signDoctor, String.valueOf(res.get("qkCode")));
                res.put("team", teams != null ? teams : new ArrayList<AdminTeam>());
            }
            return write(200, "获取消息列表成功!", "data", res);
@ -502,7 +503,7 @@ public class DoctorFamilyContractController extends WeixinBaseController {
     */
    @RequestMapping(value = "patient_sanshi_signinfo")
    @ResponseBody
    public String getPatientSanshiSignByIdCard(String idCard,@RequestParam(required = false) String signDoctor) {
    public String getPatientSanshiSignByIdCard(String idCard, @RequestParam(required = false) String signDoctor) {
        try {
            if (StringUtils.isEmpty(idCard)) {
                return error(-1, "请输入身份证号!");
@ -540,9 +541,9 @@ public class DoctorFamilyContractController extends WeixinBaseController {
            result = familyContractService.getSanshiSingInfoByPatientIdCard(idCard);
            if(result.getString("signStatus").equals("1") && StringUtils.isNotEmpty(signDoctor)){
                List<AdminTeam> teams = teamService.findDoctorsTeams(signDoctor,result.getString("doctor"));
                result.put("team",teams != null ? new JSONArray(teams) : new JSONArray());
            if (result.getString("signStatus").equals("1") && StringUtils.isNotEmpty(signDoctor)) {
                List<AdminTeam> teams = teamService.findDoctorsTeams(signDoctor, result.getString("doctor"));
                result.put("team", teams != null ? new JSONArray(teams) : new JSONArray());
            }
            return write(200, "查询成功!", "data", result);
@ -731,18 +732,18 @@ public class DoctorFamilyContractController extends WeixinBaseController {
    @RequestMapping(value = "/sign_info_update")
    @ResponseBody
    public String updateSignInfo(String patient, @RequestParam(required = false) String healthDoctor,
             @RequestParam(required = false) String doctor,
             @RequestParam(required = false) String expensesType) {
                                 @RequestParam(required = false) String doctor,
                                 @RequestParam(required = false) String expensesType) {
        try {
            if (StringUtils.isEmpty(patient)) {
                return error(-1, "患者不能为空");
            }
            if (StringUtils.isEmpty(healthDoctor) && StringUtils.isEmpty(expensesType) && StringUtils.isEmpty(doctor) ) {
            if (StringUtils.isEmpty(healthDoctor) && StringUtils.isEmpty(expensesType) && StringUtils.isEmpty(doctor)) {
                return error(-1, "参数不能同时为空");
            }
            JSONObject result = familyContractService.updateSignInfo(patient, healthDoctor,doctor, expensesType);
            JSONObject result = familyContractService.updateSignInfo(patient, healthDoctor, doctor, expensesType);
            if (result.getInt("status") != 1) {
                return error(-1, result.getString("msg"));
@ -837,10 +838,10 @@ public class DoctorFamilyContractController extends WeixinBaseController {
    @RequestMapping(value = "/expenses_remind")
    @ResponseBody
    public String remindPatientExpenses(@RequestParam(required = false) String patient
            ,@RequestParam(required = false)  String isAll) {
            , @RequestParam(required = false) String isAll) {
        try {
            if (StringUtils.isEmpty(patient) && StringUtils.isEmpty(isAll)) {
                return error(-1,"参数不能都为空");
                return error(-1, "参数不能都为空");
            }
            if (StringUtils.isNotEmpty(patient)) {
@ -861,4 +862,32 @@ public class DoctorFamilyContractController extends WeixinBaseController {
            return error(-1, "提醒失败");
        }
    }
    /**
     * 患者今天是否已提醒缴费
     *
     * @param patient 患者code
     * @return
     */
    @RequestMapping(value = "/is_patient_remind_expenses")
    @ResponseBody
    public String isPatientExpensesRemindToday(String patient) {
        try {
            if (StringUtils.isEmpty(patient)) {
                return error(-1, "患者不能为空");
            }
            int result = 0;
            String epTime = redisTemplate.opsForValue().get("expenses:remind:" + patient);
            if (StringUtils.isEmpty(epTime)) {
                result = 0;
            } else {
                result = new SimpleDateFormat("yyyy-MM-dd").format(new Date()).equals(epTime) ? 1 : 0;
            }
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "查询失败");
        }
    }
}

+ 1 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/account/PatientController.java

@ -17,6 +17,7 @@ import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;