Przeglądaj źródła

Merge branch 'dev' of liuwenbin/patient-co-management into dev

trick9191 7 lat temu
rodzic
commit
377d66db5b

+ 6 - 2
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/config/jpa/MedicineJpa.java

@ -1,5 +1,6 @@
package com.yihu.mm.config.jpa;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
@ -22,14 +23,15 @@ import javax.sql.DataSource;
/**
 * Created by chenweida on 2017/4/6.
 */
@Configuration
@EnableTransactionManagement
@EnableJpaRepositories(
        entityManagerFactoryRef = "medicineEntityManagerFactory",
        transactionManagerRef = "medicineTransactionManager",
        basePackages = {"com.yihu.mm.repository.medicine"})  //设置Repository所在位置
        basePackages = {"com.yihu.mm.repository.medicine"})   //设置Repository所在位置
public class MedicineJpa {
    @Autowired
    private HibernateProperties hibernateProperties;
@ -58,6 +60,8 @@ public class MedicineJpa {
    }
    @Primary
    @Bean(name = "medicineTransactionManager")
    JpaTransactionManager medicineTransactionManager(

+ 41 - 0
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/entity/IdEntity.java

@ -0,0 +1,41 @@
/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.mm.entity;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import java.io.Serializable;
/**
 * 统一定义id的entity基类.
 * 
 * 基类统一定义id的属性名称、数据类型、列名映射及生成策略.
 * Oracle需要每个Entity独立定义id的SEQUCENCE时,不继承于本类而改为实现一个Idable的接口。
 * 
 * @author calvin
 */
// JPA 基类的标识
@MappedSuperclass
public abstract class IdEntity implements Serializable {
	private static final long serialVersionUID = 3673803562328635206L;
	protected Long id;  // 非业务主键
	@Id
	@GeneratedValue(generator = "uuid")
	@GenericGenerator(name = "uuid", strategy = "uuid")
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
}

+ 68 - 0
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/entity/medicine/MedicineAnswerLog.java

@ -0,0 +1,68 @@
package com.yihu.mm.entity.medicine;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.mm.entity.IdEntity;
import java.util.Date;
/**
 * Created by Administrator on 2017/8/9.
 */
public class MedicineAnswerLog extends IdEntity{
    private String patientCode; //客户code
    private String tpId;    //试卷编号
    private String tpName; //试卷名称
    private Date createTime;    //创建时间
    private String remark;      //备注
    private String problems;    //问题的集合
    public String getPatientCode() {
        return patientCode;
    }
    public void setPatientCode(String patientCode) {
        this.patientCode = patientCode;
    }
    public String getTpId() {
        return tpId;
    }
    public void setTpId(String tpId) {
        this.tpId = tpId;
    }
    public String getTpName() {
        return tpName;
    }
    public void setTpName(String tpName) {
        this.tpName = tpName;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public String getProblems() {
        return problems;
    }
    public void setProblems(String problems) {
        this.problems = problems;
    }
}

+ 91 - 0
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/entity/medicine/MedicineExaminationAnwser.java

@ -0,0 +1,91 @@
package com.yihu.mm.entity.medicine;
import com.yihu.mm.entity.IdEntity;
/**
 * Created by Administrator on 2017/8/9.
 */
public class MedicineExaminationAnwser extends IdEntity{
    private String tpId;    //试卷编号
    private String tpName;  //试卷名称
    private Integer tpType; //'问卷类型',1:初筛问卷,2:助理问卷,4:现场问卷
    private String pbId;    //因素编号
    private String pbTitle; //因素题目
    private String pbAlternative;   //备选答案
    private String tpsId;    //试卷因素编号
    private Integer tpsSort;  //排序编号
    private Integer iMultiselect;   //是否多选,1:单选,2:多选
    public String getTpId() {
        return tpId;
    }
    public void setTpId(String tpId) {
        this.tpId = tpId;
    }
    public String getTpName() {
        return tpName;
    }
    public void setTpName(String tpName) {
        this.tpName = tpName;
    }
    public Integer getTpType() {
        return tpType;
    }
    public void setTpType(Integer tpType) {
        this.tpType = tpType;
    }
    public String getPbId() {
        return pbId;
    }
    public void setPbId(String pbId) {
        this.pbId = pbId;
    }
    public String getPbTitle() {
        return pbTitle;
    }
    public void setPbTitle(String pbTitle) {
        this.pbTitle = pbTitle;
    }
    public String getPbAlternative() {
        return pbAlternative;
    }
    public void setPbAlternative(String pbAlternative) {
        this.pbAlternative = pbAlternative;
    }
    public String getTpsId() {
        return tpsId;
    }
    public void setTpsId(String tpsId) {
        this.tpsId = tpsId;
    }
    public Integer getTpsSort() {
        return tpsSort;
    }
    public void setTpsSort(Integer tpsSort) {
        this.tpsSort = tpsSort;
    }
    public Integer getiMultiselect() {
        return iMultiselect;
    }
    public void setiMultiselect(Integer iMultiselect) {
        this.iMultiselect = iMultiselect;
    }
}

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

@ -15,6 +15,7 @@ import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeamMember;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.patient.WlyyPatientSick;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.repository.address.CityDao;
import com.yihu.wlyy.repository.address.ProvinceDao;
import com.yihu.wlyy.repository.address.TownDao;
@ -25,6 +26,7 @@ import com.yihu.wlyy.repository.doctor.*;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.PatientSickDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.scheduling.DoctorWorkTimeService;
import com.yihu.wlyy.service.app.talk.TalkGroupService;
@ -116,9 +118,12 @@ public class DoctorInfoService extends BaseService {
    @Autowired
    private PushMsgTask pushMsgTask;
    @Autowired
    private PrescriptionDao prescriptionDao;
    //基卫服务地址
    @Value("${sign.check_upload}")
    private String jwUrl;
    private String jwUrl;//="http://192.168.131.105:8011";
    @Autowired
    private HttpClientUtil HttpClientUtil;
@ -1295,19 +1300,49 @@ public class DoctorInfoService extends BaseService {
//        doctor.setCheckPassword(Encodes.encodeHex(hashPassword));
//    }
    /**
     *  判断实名软证书是否已申请
     */
    public boolean judgeRealNameSoftCertIsApplied(String doctorCode) throws Exception{
        Doctor doctor = findDoctorByCode(doctorCode);
        String strUserIdcardNum = doctor.getIdcard();
        String data ="";
        String url = jwUrl+"/third/prescription/IsApplied";
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("strUserIdcardNum",strUserIdcardNum));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        if (!StringUtils.isEmpty(response)){
            JSONObject responseObject = new JSONObject(response);
            int status = responseObject.getInt("status");
            if (status == 200) {
                data = responseObject.getString("data");
                if (!StringUtils.isEmpty(data) && data.startsWith("error")) {
                    throw new Exception(data);
                }else{
                    if("0".equals(data)){
                        return true;
                    }
                }
            }
        }else {
            throw new Exception("null response.");
        }
        return false;
    }
    /**
     * 获取线上CA是否认证过
     */
    public JSONObject isAuthentication(String doctorCode)  throws Exception{
    public JSONObject isAuthentication(String doctorCode) throws Exception{
        Doctor doctor = findDoctorByCode(doctorCode);
        String strUserIdcardNum = doctor.getIdcard();
//        String strUserIdcardNum = doctor.getIdcard();
        Boolean isSuccess = true;
        JSONObject jsonObject = new JSONObject();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        if(doctor.getIscertified()==1){
            if(doctor.getCertifiedOvertime().getTime()>System.currentTimeMillis()){
                //1、线上未认证,有证书,并有效,2、线上未认证,有证书,已过期,3、线上未认证,无证书,4、线上已认证,并有效
                jsonObject.put("type",4);
                String data = simpleDateFormat.format(doctor.getCertifiedOvertime());
                jsonObject.put("time",data);
@ -1315,17 +1350,20 @@ public class DoctorInfoService extends BaseService {
                jsonObject = getCAPastDue(doctorCode,jsonObject);
            }
        }else{
            jsonObject = getCAPastDue(doctorCode,jsonObject);
            boolean j = judgeRealNameSoftCertIsApplied(doctorCode);
            if(j){
                jsonObject = getCAPastDue(doctorCode,jsonObject);
            }else{
                jsonObject.put("type",3);
            }
        }
        return jsonObject;
    }
    /**
     * 获取CA证书过期时间
     */
    @Transactional
    public JSONObject getCAPastDue(String doctorCode,JSONObject jsonObject)  throws Exception{
        Doctor doctor = findDoctorByCode(doctorCode);
        String strUserIdcardNum = doctor.getIdcard();
@ -1340,7 +1378,6 @@ public class DoctorInfoService extends BaseService {
        if (!StringUtils.isEmpty(response)){
            JSONObject responseObject = new JSONObject(response);
            int status = responseObject.getInt("status");
            String msg = responseObject.getString("msg");
            if (status == 200) {
                data = responseObject.getString("data");
                if (!StringUtils.isEmpty(data) && data.startsWith("error")) {
@ -1358,12 +1395,13 @@ public class DoctorInfoService extends BaseService {
                            jsonObject.put("type",2);
                        }
                    }else{
                        jsonObject.put("type",3);
//                        jsonObject.put("type",3);
                        throw new Exception("null data.");
                    }
                }
            } else {
                throw new Exception(responseObject.getString("msg"));
                jsonObject.put("type",3);
            }
        }else {
            throw new Exception("null response.");
@ -1413,18 +1451,19 @@ public class DoctorInfoService extends BaseService {
     * @param strUserIdcardNum
     * @param strRealNameSoftCertCalledPasswd
     * @param strOriginalData
     * @param srcBusinessStreamNO
     * @return
     * @throws Exception
     */
    public boolean requestRealNameSoftCertAndSign(String strUserIdcardNum,String strRealNameSoftCertCalledPasswd,String strOriginalData, String srcBusinessStreamNO) throws Exception{
    @Transactional
    public JSONObject requestRealNameSoftCertAndSign(String strUserIdcardNum,String strRealNameSoftCertCalledPasswd,String strOriginalData,String prescriptionCode) throws Exception{
        String url = jwUrl+"/third/prescription/RequestRealNameSoftCertAndSign";
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("strUserIdcardNum",strUserIdcardNum));
        params.add(new BasicNameValuePair("strRealNameSoftCertCalledPasswd",strRealNameSoftCertCalledPasswd));
        params.add(new BasicNameValuePair("strOriginalData",strOriginalData));
        params.add(new BasicNameValuePair("srcBusinessStreamNO",srcBusinessStreamNO));
        params.add(new BasicNameValuePair("strOriginalData",MD5.GetMD5Code(strOriginalData)));
//        params.add(new BasicNameValuePair("srcBusinessStreamNO",srcBusinessStreamNO));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        if (!StringUtils.isEmpty(response)){
            JSONObject responseObject = new JSONObject(response);
@ -1438,11 +1477,17 @@ public class DoctorInfoService extends BaseService {
                    String[] str = data.split("||");
//                    String strSignData = str[0];
//                    String strCertData = str[1];
//                    JSONObject jsonObject = new JSONObject();
//                    jsonObject.put("strSignData",str[0]);
//                    jsonObject.put("strCertData",str[1]);
                    return verifySignOnMultiServer(str[0],str[1],strOriginalData);
//                    return jsonObject;
                    JSONObject jsonObject = new JSONObject();
                    jsonObject.put("strSignData",str[0]);
                    jsonObject.put("strCertData",str[1]);
                    jsonObject.put("srcBusinessStreamNO",str[2]);
                    Prescription prescription = prescriptionDao.findByCode(prescriptionCode);
                    prescription.setCaMessage(str[0]);
                    prescription.setCaCertData(str[1]);
                    prescriptionDao.save(prescription);
//                    String srcBusinessStreamNO = str[2];//CA 数字签名唯一流水号
//                    return verifySignOnMultiServer(str[0],str[1],strOriginalData);
                    return jsonObject;
                }
            }else{
                throw new Exception(responseObject.getString("msg"));
@ -1459,7 +1504,7 @@ public class DoctorInfoService extends BaseService {
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("strSignData",strSignData));
        params.add(new BasicNameValuePair("strCertData",strCertData));
        params.add(new BasicNameValuePair("strOriginalData",strOriginalData));
        params.add(new BasicNameValuePair("strOriginalData",MD5.GetMD5Code(strOriginalData)));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        if (!StringUtils.isEmpty(response)){
            JSONObject responseObject = new JSONObject(response);
@ -1485,8 +1530,6 @@ public class DoctorInfoService extends BaseService {
    //校验医师输入的CA证书是否正确
    public boolean  checkCertificate(String doctorCode,String certificateNum){
        List<NameValuePair> params = new ArrayList<>();
        String response = HttpClientUtil.post("http://120.77.209.211:5000/yueren/phonekey", params, "UTF-8");
        int count = doctorDao.checkCertificate(doctorCode,certificateNum);
        if(count>0){
            return true;

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionDispensaryCodeService.java

@ -193,7 +193,7 @@ public class PrescriptionDispensaryCodeService extends BaseService {
    }
    public Map<String, Object> getQrcode(String dispensaryCode ,String patientCode ,Integer type){
        String sql = "select p2.code as dispensaryCode,p2.img_url,p3.hospital_name as hospitalName  from wlyy_prescription_dispensary_code p2 " +
        String sql = "select  p2.is_use as isUse,p2.code as dispensaryCode,p2.img_url,p3.hospital_name as hospitalName  from wlyy_prescription_dispensary_code p2 " +
                " left join  wlyy_prescription p1 on p2.prescription_code=p1.code LEFT JOIN wlyy_prescription_expressage p3 on p1.code=p3.prescription_code " +
                " where p2.prescription_code=? and p1.patient=? and p2.type=?  and p2.is_Use=0 ";
        Map<String, Object> result = jdbcTemplate.queryForMap(sql,dispensaryCode,patientCode,type);

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

@ -1871,11 +1871,12 @@ public class DoctorController extends BaseController {
    @RequestMapping(value = "/isAuthentication", method = RequestMethod.GET)
    public String isAuthentication(){
        try {
            //0de6a26a62dd11e69faffa163e8aee56
            JSONObject data = doctorInfoService.isAuthentication(getRepUID());
            return write(200, "获取信息成功!", "data", data);
        }catch (Exception e) {
            error(e);
            return error(-1, "获取信息失败!");
            return error(-1, e.getMessage());
        }
    }
@ -1896,7 +1897,7 @@ public class DoctorController extends BaseController {
            return error(-1, "修改密码失败!");
        }catch (Exception e) {
            error(e);
            return error(-1, "修改密码失败!");
            return error(-1, e.getMessage());
        }
    }
@ -1910,19 +1911,19 @@ public class DoctorController extends BaseController {
    public String requestRealNameSoftCertAndSign(
            @RequestParam(value = "strRealNameSoftCertCalledPasswd",required = true) String strRealNameSoftCertCalledPasswd,
            @RequestParam(value = "strOriginalData",required = true) String strOriginalData,
            @RequestParam(value = "srcBusinessStreamNO",required = true) String srcBusinessStreamNO){
            @RequestParam(value = "prescriptionCode",required = true) String prescriptionCode){
        try {
            Doctor doctor = doctorInfoService.findDoctorByCode(getRepUID());
//            JSONObject obj = doctorInfoService.requestRealNameSoftCertAndSign(doctor.getIdcard(),strRealNameSoftCertCalledPasswd,strOriginalData,srcBusinessStreamNO);
            boolean b = doctorInfoService.requestRealNameSoftCertAndSign(doctor.getIdcard(),strRealNameSoftCertCalledPasswd,strOriginalData,srcBusinessStreamNO);
            if(b){
                return write(200, "认证成功!", "data", b);
            }
            return error(-1, "认证失败!");
            JSONObject jsonObject = doctorInfoService.requestRealNameSoftCertAndSign(doctor.getIdcard(),strRealNameSoftCertCalledPasswd,strOriginalData,prescriptionCode);
//            if(b){
            return write(200, "获取信息成功!", "data", jsonObject);
//            }
//            return error(-1, "认证失败!");
        }catch (Exception e) {
            error(e);
            return error(-1, "认证失败!");
            return error(-1, e.getMessage());
        }
    }
@ -1940,8 +1941,29 @@ public class DoctorController extends BaseController {
            return write(200, "获取信息成功!", "data", b);
        }catch (Exception e) {
            error(e);
            return error(-1, "获取信息失败!");
            return error(-1, e.getMessage());
        }
    }
    /**
     * 验证签名( ( 带多服务器负载均衡) )
     */
    @ApiOperation("验证签名")
    @ObserverRequired
    @ResponseBody
    @RequestMapping(value = "/verifySignOnMultiServer", method = RequestMethod.GET)
    public String verifySignOnMultiServer(
            @RequestParam(value = "strSignData",required = true) String strSignData,
            @RequestParam(value = "strCertData",required = true) String strCertData,
            @RequestParam(value = "strOriginalData",required = true) String strOriginalData){
            try {
                boolean b = doctorInfoService.verifySignOnMultiServer(strSignData,strCertData,strOriginalData);
                return write(200, "获取信息成功!", "data", b);
            }catch (Exception e) {
                error(e);
                return error(-1, e.getMessage());
            }
    }
}

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

@ -9,7 +9,7 @@ http.secret_key = FastDFS1234567890
#tracker_server = 172.19.103.54:22122
#-------------测试环境---------------#
#tracker_server = 172.19.103.54:22122
tracker_server = 172.19.103.54:22122
#-------------正式环境---------------#
tracker_server = 192.168.0.239:22122
#tracker_server = 192.168.0.239:22122