Browse Source

Merge branch 'dev-1.3.7' of trick9191/patient-co-management into dev-1.3.7

trick9191 7 years ago
parent
commit
a74e80c3c3

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

@ -460,7 +460,7 @@ public class PatientInfoService extends BaseService {
        String password = mobile.substring(5,10);
        String salt = UUID.randomUUID().toString().replace("-", "");
        JSONObject p = patientService.registerAPP(idcard,ssc,name,mobile,password,salt,salt,3);
        JSONObject p = patientService.registerAPP(idcard,ssc,name,mobile,password,salt,null,3);
        createProfile(doctorCode , p.getString("uid"), brithday, jwCountryCode, nation, blood, marry,adress);

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

@ -130,6 +130,8 @@ public class FamilyContractService extends BaseService {
    private SignFamilyMappingDao signFamilyMappingDao;
    @Autowired
    private JwArchivesService jwArchivesService;
    @Autowired
    private FamilyContractService familyContractService;
    @Autowired
    private ImUtill ImUtill;
@ -885,7 +887,7 @@ public class FamilyContractService extends BaseService {
     * @return
     * @throws Exception
     */
    synchronized public SignFamily agent(String access_token, String name,
    synchronized public String agent(String access_token, String name,
                                         String doctor, String doctorName,
                                         String doctorHealth, String doctorHealthName,
                                         String hospital, String hospitalName,
@ -900,14 +902,15 @@ public class FamilyContractService extends BaseService {
        if (sc != null) {
            throw new Exception("已签约了家庭医生!");
        }
        //判断是否有三师签约 并且判断全科医生一致
        //屏蔽三师签约判断
//        SignFamily sssignFamily = signFamilyDao.findSSByIdcard(idcard);
//        if (sssignFamily != null && !doctor.equals(sssignFamily.getDoctor())) {
//            throw new Exception("全科医生不一致!");
//        }
        // 查询该患者是否已注册
        Patient patient = patientDao.findByIdcard(idcard);
        //1.3.7.2  判断是否建档---------------------------
        String rp = familyContractService.getSickArchiveFlag(patient.getCode());
        if("0".equals(rp)){
            return "-1";
        }
        //1.3.7.2  end------------------------------------
//        List<SystemDict> systemDicts = systemDictDao.findByDictName("SIGN_YEAR");
        Calendar cal = Calendar.getInstance();
        int m = cal.get(Calendar.MONTH) + 1;
        String signYear = "";
@ -973,8 +976,7 @@ public class FamilyContractService extends BaseService {
        if (StringUtils.isNotBlank(sevId)) {
            signWebService.setSevId(sf, sevId);
        }
        // 查询该患者是否已注册
        Patient patient = patientDao.findByIdcard(idcard);
        if (patient == null) {
            // 插入患者基本信息
            IdcardInfoExtractor ie = new IdcardInfoExtractor(idcard);
@ -1190,9 +1192,9 @@ public class FamilyContractService extends BaseService {
        }
        BusinessLogs.info(BusinessLogs.BusinessType.sign, signDoctorCode, sf.getPatient(), new JSONObject(sf));
        //签约成功之后给患者新增标签
        String openId = sf.getOpenid();
        hospital = sf.getHospital();
        return temp;
//        String openId = sf.getOpenid();
//        hospital = sf.getHospital();
        return "1";
    }
    /**

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

@ -1885,7 +1885,7 @@ public class SignWebService extends BaseService {
     */
    public JSONObject getOverDuePatients(String year, Long teamCode, String doctor, Integer page, Integer pageSize) {
        StringBuffer sql = new StringBuffer("SELECT IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age," +
                "t.patient code,t.idcard,t.name,t.mobile,t.openid," +
                "t.patient code,t.idcard,t.name,t.mobile,t.openid,p.photo," +
                "t.ssc,t.type signType,p.sex ,t.expenses_status expensesStatus " +
                " FROM wlyy_sign_family t " +
                " LEFT JOIN wlyy_patient p ON t.patient = p.code " +

+ 113 - 17
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/PatientInfoController.java

@ -1,35 +1,24 @@
package com.yihu.wlyy.web.doctor.patient;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorPatientGroup;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorPatientGroupInfo;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.patient.SocialSecurityInfo;
import com.yihu.wlyy.logs.BusinessLogs;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.repository.patient.SocialSecurityInfoDao;
import com.yihu.wlyy.service.app.account.DoctorInfoService;
import com.yihu.wlyy.service.app.account.DoctorPatientGroupService;
import com.yihu.wlyy.service.app.account.PatientInfoService;
import com.yihu.wlyy.service.app.team.DrHealthTeamService;
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.MD5;
import com.yihu.wlyy.util.RSAUtils;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
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.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@ -37,9 +26,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.net.URLDecoder;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.UUID;
/**
 * 医生端:患者分组管理
@ -179,7 +166,11 @@ public class PatientInfoController extends BaseController {
     */
    @RequestMapping(value = "/check_regist_info", method = RequestMethod.POST)
    @ResponseBody
    public String checkRegistInfo(String name, String idcard, String ssc, String mobile) {
    @ApiOperation("注册信息验证")
    public String checkRegistInfo(@ApiParam(value = "居民姓名", name = "name") @RequestParam(required = true)String name,
                                  @ApiParam(value = "居民身份证", name = "idcard") @RequestParam(required = true)String idcard,
                                  @ApiParam(value = "居民社保卡", name = "ssc") @RequestParam(required = true)String ssc,
                                  @ApiParam(value = "居民手机", name = "mobile") @RequestParam(required = true)String mobile) {
        try {
            if (StringUtils.isEmpty(name)) {
                return error(-1, "姓名不允许为空");
@ -264,4 +255,109 @@ public class PatientInfoController extends BaseController {
            return error( -1, "建档失败!");
        }
    }
    /**
     * 患者注册
     *
     * @param idcard  身份證號
     * @param mobile  登录手机号
     * @return
     */
    @RequestMapping(value = "regist", method = RequestMethod.POST)
    @ResponseBody
    public String regist(@ApiParam(value = "姓名", name = "name") @RequestParam(required = true) String name,
                         @ApiParam(value = "身份证", name = "idcard") @RequestParam(required = true)String idcard,
                         @ApiParam(value = "社保卡", name = "ssc") @RequestParam(required = true) String ssc,
                         @ApiParam(value = "手机", name = "mobile") @RequestParam(required = true) String mobile) {
        try {
            if (StringUtils.isEmpty(name)) {
                return error(-1, "姓名不允许为空!");
            }
            if (StringUtils.isEmpty(idcard)) {
                return error(-1, "身份证号不允许为空!");
            }
            if (StringUtils.isEmpty(ssc)) {
                return error(-1, "社保卡号不允许为空!");
            }
            if (StringUtils.isEmpty(mobile)) {
                return error(-1, "手机号不允许为空!");
            }
            // 解密身份证号
            rsaUtils.setBaseService(patientService);
            idcard = rsaUtils.decryptString(idcard);
            idcard = URLDecoder.decode(idcard, "UTF-8");
            idcard = StringUtils.reverse(idcard);
            // 校验身份证号
            IdcardValidator validator = new IdcardValidator();
            if (validator.isValidatedAllIdcard(idcard)) {
                if (idcard.length() == 15) {
                    idcard = validator.convertIdcarBy15bit(idcard);
                    if (StringUtils.isEmpty(idcard)) {
                        return error(-1, "请输入正确的身份证号!");
                    }
                }
            } else {
                return error(-1, "请输入正确的身份证号!");
            }
            SocialSecurityInfo socialSecurityInfo = socialSecurityInfoDao.findBySfzh18Max(idcard);
            if (socialSecurityInfo != null) {
                if (name.compareTo(socialSecurityInfo.getXming0() == null ? "" : socialSecurityInfo.getXming0()) != 0) {
                    return error(-1, "身份证号与姓名不一致<br/>请检查后重新输入");
                }
                if (ssc.compareTo(socialSecurityInfo.getCardno() == null ? "" : socialSecurityInfo.getCardno()) != 0) {
                    if (ssc.compareTo(socialSecurityInfo.getCard16() == null ? "" : socialSecurityInfo.getCard16()) != 0) {
                        return error(-1, "身份证号与医保卡号不一致,请检查后重新输入");
                    } else {
                        ssc = socialSecurityInfo.getCardno();//统一只存英文字母开头的医保卡
                    }
                }
            } else {
                return error(-1, "对不起,暂不支持16年6月份之后办理的医保卡注册");
            }
            Patient patient = patientDao.findByIdcard(idcard);
            if (patient == null) {
                patient = new Patient();
            } else {
                if (!StringUtils.isEmpty(patient.getMobile())) {
                    return error(-2, "该身份证已被注册!");
                }
            }
            patient.setName(name);
            patient.setIdcard(idcard);
            patient.setMobile(mobile);
            //增加密码
            String salt = UUID.randomUUID().toString().replace("-", "");
            patient.setSalt(salt);
            rsaUtils.setBaseService(patientService);
            String password = mobile.substring(5,10);
            password = rsaUtils.decryptString(password);
            password = StringUtils.reverse(password);
            patient.setPassword(MD5.GetMD5Code(password + salt));
            patient.setSsc(ssc);
            JSONObject json = patientService.register(idcard, ssc, name, mobile, MD5.GetMD5Code(password + salt)
                    ,salt,salt,3);
            if (json != null) {
                try {
                    Patient p = patientDao.findByIdcard(idcard);
                    BusinessLogs.info(BusinessLogs.BusinessType.register, p.getCode(), p.getCode(), new JSONObject(p));
                } catch (Exception e) {
                    e.printStackTrace();
                }
                // 注册成功
                return write(200, "注册成功!", "data", json);
            } else {
                // 注册失败
                return error(-1, "注册失败!");
            }
        } catch (Exception e) {
            error(e);
            return error(-1, "注册失败!");
        }
    }
}

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

@ -493,11 +493,11 @@ public class DoctorFamilyContractController extends WeixinBaseController {
            /**end**/
            Doctor cDoctor = doctorService.findDoctorByCode(getUID());
            //1.3.5 新增居委会字段countryCode
            SignFamily sf = familyContractService.agent(getAccessToken(), name, doctor, doctorName,
            String sf = familyContractService.agent(getAccessToken(), name, doctor, doctorName,
                    healthDoctor, healthDoctorName, cDoctor.getHospital(), cDoctor.getHospitalName(),
                    idcard, ssc, mobile, emerMobile, images, healthLabel, customLabel, disease, expenses, signDoctorCode, signDoctorName, signDoctorLevel, adminTeamCode, sevId, countryCode);
            if (sf == null) {
                return error(-1, "代理签约失败!");
            if ("-1".equals(sf)) {
                return error(-2, "居民未建档!");
            } else {
                try {
                    Patient p = patientService.findByIdcard(idcard);