Browse Source

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

yeshijie 7 years ago
parent
commit
ba9011797f
26 changed files with 1276 additions and 59 deletions
  1. 6 2
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/config/jpa/MedicineJpa.java
  2. 41 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/entity/IdEntity.java
  3. 68 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/entity/medicine/MedicineAnswerLog.java
  4. 91 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/entity/medicine/MedicineExaminationAnwser.java
  5. 3 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/SwaggerConfig.java
  6. 106 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/dict/HealthProblemDict.java
  7. 60 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/dict/HpIcd10Relation.java
  8. 114 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/dict/Icd10Dict.java
  9. 9 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionExpressage.java
  10. 2 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/service/SignFamilyService.java
  11. 0 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/DoctorAdminTeamDao.java
  12. 5 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/service/SignFamilyServiceDao.java
  13. 5 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/service/SignFamilyServiceItemDao.java
  14. 65 22
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java
  15. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionDispensaryCodeService.java
  16. 203 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java
  17. 55 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignFamilyServiceService.java
  18. 157 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/system/Icd10DictServcie.java
  19. 30 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/system/KeyValueModel.java
  20. 77 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/icd/Icd10Controller.java
  21. 1 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/data/DataHandlingController.java
  22. 32 10
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java
  23. 69 14
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionInfoController.java
  24. 73 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/sign/PatientSignFamilyServiceNoFilterController.java
  25. 1 1
      patient-co/patient-co-wlyy/src/main/resources/application.yml
  26. 2 2
      patient-co/patient-co-wlyy/src/main/resources/config/fdfs_client.conf

+ 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;
    }
}

+ 3 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/SwaggerConfig.java

@ -16,7 +16,6 @@ import static springfox.documentation.builders.PathSelectors.regex;
@EnableSwagger2
@Configuration
public class SwaggerConfig {
    private static final String PUBLIC_API = "Default";
    private static final String Doctor_API = "doctor";
    private static final String Patient_API = "patient";
    private static final String Other_API = "other";
@ -104,7 +103,10 @@ public class SwaggerConfig {
                        regex("/wlyy_service/.*"),
                        regex("/wlyy_service/.*"),
                        regex("/wechat/.*"),
                        regex("/nofilter/.*"),
                        regex("/idc10/.*"),
                        regex("/express/.*")
                ))
                .build()
                .apiInfo(otherApiInfo());

+ 106 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/dict/HealthProblemDict.java

@ -0,0 +1,106 @@
package com.yihu.wlyy.entity.dict;
import javax.persistence.*;
import java.util.Date;
/**
 * Created by chenweida on 2017/8/9.
 */
@Entity
@Table(name = "health_problem_dict")
public class HealthProblemDict {
    private Long id;
    private String hpcode;
    private String hpname;
    private String code;//'字典编码'
    private String name;//'字典名称'
    private String description;//'描述'
    private String createUser;
    private Date createDate;
    private String updateUser;
    private Date updateDate;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    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;
    }
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
    public String getCreateUser() {
        return createUser;
    }
    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }
    public Date getCreateDate() {
        return createDate;
    }
    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }
    public String getUpdateUser() {
        return updateUser;
    }
    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }
    public Date getUpdateDate() {
        return updateDate;
    }
    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }
    @Transient
    public String getHpcode() {
        return hpcode;
    }
    public void setHpcode(String hpcode) {
        this.hpcode = hpcode;
    }
    @Transient
    public String getHpname() {
        return hpname;
    }
    public void setHpname(String hpname) {
        this.hpname = hpname;
    }
}

+ 60 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/dict/HpIcd10Relation.java

@ -0,0 +1,60 @@
package com.yihu.wlyy.entity.dict;
import javax.persistence.*;
import java.util.Date;
/**
 * Created by chenweida on 2017/8/9.
 */
@Entity
@Table(name = "hp_icd10_relation")
public class HpIcd10Relation {
    private Long id;
    private Long hpId;//健康问题字典id
    private Long icd10Id;//icd10字典id
    private String createUser;
    private Date createDate;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public Long getHpId() {
        return hpId;
    }
    public void setHpId(Long hpId) {
        this.hpId = hpId;
    }
    public Long getIcd10Id() {
        return icd10Id;
    }
    public void setIcd10Id(Long icd10Id) {
        this.icd10Id = icd10Id;
    }
    public String getCreateUser() {
        return createUser;
    }
    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }
    public Date getCreateDate() {
        return createDate;
    }
    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }
}

+ 114 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/dict/Icd10Dict.java

@ -0,0 +1,114 @@
package com.yihu.wlyy.entity.dict;
import javax.persistence.*;
import java.util.Date;
/**
 * Created by chenweida on 2017/8/9.
 */
@Entity
@Table(name = "icd10_dict")
public class Icd10Dict {
    private Long id;
    private String code;//'icd10字典编码'
    private String name;//'icd10字典名称'
    private String phoneticCode;//字典名称拼音首字母
    private String chronicFlag;//是否慢病
    private String infectiousFlag;//是否传染病
    private String description;//'描述'
    private String createUser;
    private Date createDate;
    private String updateUser;
    private Date updateDate;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    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;
    }
    public String getPhoneticCode() {
        return phoneticCode;
    }
    public void setPhoneticCode(String phoneticCode) {
        this.phoneticCode = phoneticCode;
    }
    public String getChronicFlag() {
        return chronicFlag;
    }
    public void setChronicFlag(String chronicFlag) {
        this.chronicFlag = chronicFlag;
    }
    public String getInfectiousFlag() {
        return infectiousFlag;
    }
    public void setInfectiousFlag(String infectiousFlag) {
        this.infectiousFlag = infectiousFlag;
    }
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
    public String getCreateUser() {
        return createUser;
    }
    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }
    public Date getCreateDate() {
        return createDate;
    }
    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }
    public String getUpdateUser() {
        return updateUser;
    }
    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }
    public Date getUpdateDate() {
        return updateDate;
    }
    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }
}

+ 9 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionExpressage.java

@ -36,7 +36,8 @@ public class PrescriptionExpressage extends IdEntity{
    private Integer weight;                  //快递重量  单位是g
    //配送人信息
    private String hospitalName;            // 如果配送方式是健管师那么这个字段存服务站名称,如果是快递配送那么是快递公司名称
    private String hospitalAddress;         // 机构地址
    private String hospitalAddress;         // 配送机构地址
    private String hospitalCode;            //配送机构code
    private String expressageName;          //配送人名称
    private String expressageCode;          //配送人code
    private String expressageMobile;        //配送人电话
@ -55,6 +56,13 @@ public class PrescriptionExpressage extends IdEntity{
    private Integer del;    //1可用 0删除
    public String getHospitalCode() {
        return hospitalCode;
    }
    public void setHospitalCode(String hospitalCode) {
        this.hospitalCode = hospitalCode;
    }
    @Column(name = "code", unique = true , nullable=false)
    public String getCode() {

+ 2 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/service/SignFamilyService.java

@ -139,4 +139,6 @@ public class SignFamilyService extends IdEntity {
    public void setRemark(String remark) {
        this.remark = remark;
    }
}

+ 0 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/DoctorAdminTeamDao.java

@ -93,5 +93,4 @@ public interface DoctorAdminTeamDao extends
    //  查询当前医生是否为团队长
    @Query("SELECT t.id from AdminTeam t WHERE t.available = true  AND t.leaderCode = ?1 ")
    Integer findLeader(String leaderCode);
}

+ 5 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/service/SignFamilyServiceDao.java

@ -3,6 +3,7 @@ package com.yihu.wlyy.repository.service;
import com.yihu.wlyy.entity.service.ServiceItem;
import com.yihu.wlyy.entity.service.SignFamilyService;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
@ -14,4 +15,8 @@ import java.util.List;
public interface SignFamilyServiceDao extends PagingAndSortingRepository<SignFamilyService, Long>, JpaSpecificationExecutor<SignFamilyService> {
    @Query("select s from ServiceItem s,SignFamilyServiceItem si where s.code=si.serviceItemCode and si.patient=?1")
    List<ServiceItem> getPatientServiceItems(String patient);
    @Modifying
    @Query(" update SignFamilyService s set s.del=0 where s.signCode=?3 and s.serviceCode=?2 and s.patient=?1")
    void deletePatientService(String patientCode, String serviceCode, String signCode);
}

+ 5 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/service/SignFamilyServiceItemDao.java

@ -3,10 +3,15 @@ package com.yihu.wlyy.repository.service;
import com.yihu.wlyy.entity.service.SignFamilyService;
import com.yihu.wlyy.entity.service.SignFamilyServiceItem;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by chenweida on 2017/8/8.
 */
public interface SignFamilyServiceItemDao extends PagingAndSortingRepository<SignFamilyServiceItem, Long>, JpaSpecificationExecutor<SignFamilyServiceItem> {
    @Modifying
    @Query(" update SignFamilyServiceItem s set s.del=0 where s.signCode=?3 and s.serviceCode=?2 and s.patient=?1")
    void deletePatiengServiceItem(String patientCode, String serviceCode, String signCode);
}

+ 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);

+ 203 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java

@ -1,10 +1,16 @@
package com.yihu.wlyy.service.app.prescription;
import com.yihu.wlyy.util.HttpUtil;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import com.yihu.wlyy.wechat.util.WeiXinMessageUtils;
import org.json.JSONObject;
import com.yihu.wlyy.entity.dict.SystemDict;
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.prescription.*;
import com.yihu.wlyy.repository.dict.SystemDictDao;
import com.yihu.wlyy.repository.doctor.DoctorAdminTeamDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.repository.patient.PatientDao;
@ -13,9 +19,9 @@ import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpUtil;
import com.yihu.wlyy.util.ImUtill;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -58,6 +64,8 @@ public class PrescriptionInfoService extends BaseService {
    @Autowired
    private ImUtill imUtill;
    @Autowired
    private DoctorAdminTeamDao doctorAdminTeamDao;
    @Autowired
    private MessageDao messageDao;
    private static final Logger logger = LoggerFactory.getLogger(HttpUtil.class);
@ -546,7 +554,7 @@ public class PrescriptionInfoService extends BaseService {
     * @param size 分页大小
     * @return
     */
    public JSONArray getDoctorPrescriptionExpressage(String type,String doctor, String nameKey,String startDate,String endDate,String hospital,String state,Integer page,Integer size){
    public JSONArray getHDoctorPrescriptionExpressage(String type,String doctor, String nameKey,String startDate,String endDate,String hospital,String state,Integer page,Integer size){
        StringBuffer pre_sql = new StringBuffer("SELECT " +
                " p.`name`, " +
@ -584,7 +592,7 @@ public class PrescriptionInfoService extends BaseService {
            }
        }
        if(StringUtils.isNotBlank(nameKey)){
            pre_sql.append(" AND p.name = ? ");
            pre_sql.append(" AND p.name LIKE ? ");
            param.add("%"+nameKey+"%");
        }
        if(StringUtils.isNotBlank(startDate)){
@ -672,4 +680,196 @@ public class PrescriptionInfoService extends BaseService {
        }
        return 0;
    }
    public JSONObject getPrescriptionExpressageAsdoctorFilter(){
        JSONObject rs = new JSONObject();
        List<Map<String,Object>> states = new ArrayList<>();
        Map<String,Object> map1 = new HashMap<>();
        map1.put("name","订单已支付");
        map1.put("code",PrescriptionLog.PrescriptionLogStatus.pay_success.getValue());
        states.add(map1);
        Map<String,Object> map2 = new HashMap<>();
        map2.put("name","配药完成");
        map2.put("code",PrescriptionLog.PrescriptionLogStatus.wait_expressage.getValue());
        states.add(map2);
        Map<String,Object> map3 = new HashMap<>();
        map3.put("name","配送中");
        map3.put("code",PrescriptionLog.PrescriptionLogStatus.expressageing.getValue());
        states.add(map3);
        Map<String,Object> map4 = new HashMap<>();
        map4.put("name","药品到达服务站");
        map4.put("code",PrescriptionLog.PrescriptionLogStatus.expressage2hospital.getValue());
        states.add(map4);
        Map<String,Object> map5 = new HashMap<>();
        map2.put("name","配药完成");
        map2.put("code",PrescriptionLog.PrescriptionLogStatus.finish.getValue());
        states.add(map2);
        //设置配送状态下拉框
        rs.put("states",states);
        //1 自取 2快递配送 3健管师配送
        List<Map<String,Object>> dispensaryTypes = new ArrayList<>();
        Map<String,Object> type1 = new HashMap<>();
        type1.put("name","自取");
        type1.put("code","1");
        dispensaryTypes.add(type1);
        Map<String,Object> type2 = new HashMap<>();
        type2.put("name","快递配送");
        type2.put("code","2");
        dispensaryTypes.add(type2);
        Map<String,Object> type3 = new HashMap<>();
        type3.put("name","健管师配送");
        type3.put("code","3");
        dispensaryTypes.add(type3);
        //设置配送状态下拉框
        rs.put("dispensaryTypes",dispensaryTypes);
        return rs;
    }
    public JSONArray getDoctorPrescriptionExpressage(String teamCode, String nameKey,String startDate,String endDate,String hospital,String state,String dispensaryType,String AllocationType,Integer page,Integer size){
        StringBuffer pre_sql = new StringBuffer("SELECT " +
                " p.`name`, " +
                " TIMESTAMPDIFF(YEAR,p.birthday,SYSDATE()) age, " +
                " p.sex, " +
                " p.photo, " +
                " pr.`status`, " +
                " pr.`code`, " +
                " LEFT(pr.create_time,19) AS createTime, " +
                " pr.doctor, " +
                " pr.dispensary_type,"+
                " e.expressage_code AS expressageCode "+
                " FROM " +
                " wlyy_prescription pr " +
                " LEFT JOIN wlyy_patient p ON pr.patient = p.`code` " +
                " JOIN wlyy_prescription_expressage e ON pr.code = e.prescription_code " +
                " JOIN wlyy_prescription_reviewed r ON pr.code = r.prescription_code " +
                " WHERE 1=1 " );
        List<Object> params = new ArrayList<>();
        setDoctorExpressageSql(pre_sql,params, teamCode,  nameKey, startDate, endDate, hospital, state,dispensaryType,AllocationType, page, size);
        List<Map<String,Object>> rs = jdbcTemplate.queryForList(pre_sql.toString(),params.toArray());
        //通过缓存查找药品和疾病
        for(Map<String,Object> map :rs){
            String code = (String)map.get("code");
            map.put("prescriptionInfo",prescriptionDiagnosisService.getPrescriptionInfo(code));
            map.put("prescriptionDt", prescriptionDiagnosisService.getPrescriptionDiagnosis(code));
        }
        return new JSONArray(rs);
    }
    public void setDoctorExpressageSql(StringBuffer pre_sql,List<Object> param,String teamCode, String nameKey,String startDate,String endDate,String hospital,String state,String dispensaryType,String AllocationType,Integer page,Integer size){
        if(StringUtils.isNotBlank(nameKey)){
            pre_sql.append(" AND p.name LIKE ? ");
            param.add("%"+nameKey+"%");
        }
        if(StringUtils.isNotBlank(teamCode)){
            pre_sql.append(" AND p.admin_team_id = ? ");
            param.add("%"+teamCode+"%");
        }
        if(StringUtils.isNotBlank(startDate)){
            pre_sql.append(" AND pr.create_time >= ? ");
            param.add(startDate+" 00:00:00");
        }
        if(StringUtils.isNotBlank(endDate)){
            pre_sql.append(" AND pr.create_time <= ? ");
            param.add(startDate+" 23:59:59");
        }
        if(StringUtils.isNotBlank(hospital)){
            pre_sql.append(" AND e.hospital_code = ? ");
            param.add(hospital);
        }
        if(StringUtils.isNotBlank(state)){
            pre_sql.append(" AND pr.status = ? ");
            param.add(state);
        }
        if(StringUtils.isNotBlank(dispensaryType)){
            pre_sql.append(" AND pr.dispensary_type = ? ");
            param.add(dispensaryType);
        }
        if(StringUtils.isNotBlank(AllocationType)){
            //1为未分配建管师列表
            if("1".equals(AllocationType)){
                pre_sql.append(" AND pr.expressage_code IS NULL ");
            }
        }
        pre_sql.append(" ORDER BY r.reviewed_time DESC ");
        if(page!=null&&size!=null){
            pre_sql.append(" LIMIT "+(page-1)*size+","+size);
        }
    }
    public JSONObject getCountExpressage(String teamCode){
        StringBuffer pre_sql = new StringBuffer("SELECT count(1) AS count FROM  " +
                "  wlyy_prescription pr " +
                "  JOIN wlyy_prescription_expressage e ON pr.code = e.prescription_code " +
                "  WHERE pr.admin_team_id = ? "+
                "  AND pr.dispensary_type =3" +
                "  AND e.expressage_code IS NULL");
        List<Map<String,Object>> list = jdbcTemplate.queryForList(pre_sql.toString(),new Object[]{teamCode});
        if(list!=null&&list.size()>0){
            Map<String,Object> map = list.get(0);
            return new JSONObject(map);
        }else{
            JSONObject rs = new JSONObject();
            rs.put("count",0);
            return rs;
        }
    }
    public JSONArray getHospitalListTitle(String teamCode){
        StringBuffer pre_sql = new StringBuffer("SELECT e.hospital_code AS hospitalCode ,e.hospital_name AS hospitalName FROM " +
                "  wlyy_prescription pr " +
                "  JOIN wlyy_prescription_expressage e ON pr.code = e.prescription_code " +
                "  WHERE pr.admin_team_id = ? "+
                "  AND e.expressage_code IS NULL " +
                "  AND pr.dispensary_type =3 " +
                "  GROUP BY e.hospital_code ");
        List<Map<String,Object>> list = jdbcTemplate.queryForList(pre_sql.toString(),new Object[]{teamCode});
        return new JSONArray(list);
    }
    public JSONArray getTeamHealthDoctorCount(String doctor){
        Doctor d = doctorDao.findByCode(doctor);
        List<AdminTeam> adminTeams = doctorAdminTeamDao.findByOrgCode(d.getHospital());
        List<Map<String,Object>> rsList = new ArrayList<>();
        if(adminTeams!=null&&adminTeams.size()>0){
            for(AdminTeam adminTeam : adminTeams){
                Map<String,Object> m = new HashedMap();
                m.put("adminTeamCode",adminTeam.getId());
                m.put("adminTeamName",adminTeam.getName());
                StringBuffer pre_sql = new StringBuffer("SELECT " +
                        " COUNT(1) AS count " +
                        " FROM " +
                        " wlyy_admin_team_member m " +
                        " JOIN wlyy_doctor d ON d. CODE = m.doctor_code " +
                        " WHERE " +
                        " d.`level` = 3 " +
                        " AND m.team_id = ? ");
                List<Map<String,Object>> list = jdbcTemplate.queryForList(pre_sql.toString(),new Object[]{adminTeam.getId()});
                if(list!=null&&list.size()>0){
                    Map<String,Object> map = list.get(0);
                    m.put("count",map.get("count"));
                }else{
                    m.put("count",0);
                }
                rsList.add(m);
            }
        }
        return new JSONArray(rsList);
    }
}

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

@ -72,6 +72,8 @@ public class SignFamilyServiceService {
            String signServiceCode = UUID.randomUUID().toString();
            signFamilyService.setCode(signServiceCode);
            signFamilyService.setCreateTime(new Date());
            signFamilyService.setPatient(patientCode);
            signFamilyService.setPatientName(sgnFamily.getName());
            signFamilyService.setSignCode(sgnFamily.getCode());
            signFamilyService.setSignTime(new Date());
            signFamilyService.setDel(1);
@ -82,6 +84,7 @@ public class SignFamilyServiceService {
                signFamilyServiceItem.setCode(UUID.randomUUID().toString());
                signFamilyServiceItem.setCreateTime(new Date());
                signFamilyServiceItem.setDel(1);
                signFamilyServiceItem.setPatient(patientCode);
                signFamilyServiceItem.setServiceCode(service.getCode());
                signFamilyServiceItem.setServiceItemCode(oneServiceItem.getCode());
                signFamilyServiceItem.setSignCode(sgnFamily.getCode());
@ -120,6 +123,8 @@ public class SignFamilyServiceService {
        String signServiceCode = UUID.randomUUID().toString();
        signFamilyService.setCode(signServiceCode);
        signFamilyService.setCreateTime(new Date());
        signFamilyService.setPatientName(sgnFamily.getName());
        signFamilyService.setPatient(patient);
        signFamilyService.setSignCode(sgnFamily.getCode());
        signFamilyService.setSignTime(new Date());
        signFamilyService.setDel(1);
@ -132,6 +137,7 @@ public class SignFamilyServiceService {
            signFamilyServiceItem.setDel(1);
            signFamilyServiceItem.setServiceCode(service.getCode());
            signFamilyServiceItem.setServiceItemCode(oneServiceItem.getCode());
            signFamilyServiceItem.setPatient(patient);
            signFamilyServiceItem.setSignCode(sgnFamily.getCode());
            signFamilyServiceItem.setSignServiceCode(signServiceCode);
            saveSignFamilyServiceItemeList.add(signFamilyServiceItem);
@ -157,7 +163,7 @@ public class SignFamilyServiceService {
                "   wlyy_service_item s, " +
                "   wlyy_sign_family_service_item si " +
                " WHERE " +
                "   s.`code` = si.service_item_code ");
                "   s.`code` = si.service_item_code and si.del=1 ");
        if (!StringUtils.isEmpty(patient)) {
            sql.append(" and si.patient = '" + patient + "'");
        }
@ -173,4 +179,52 @@ public class SignFamilyServiceService {
        List<SignFamily> signFamilies = jdbcTemplate.query(sql, new BeanPropertyRowMapper(SignFamily.class));
        return signFamilies.get(0);
    }
    /**
     * 给患者批量删除服务
     *
     * @param patients    患者code
     * @param serviceCode 服务code
     * @throws Exception
     */
    @Transactional
    public JSONObject patientsDeleteService(List<String> patients, String serviceCode) {
        JSONObject jo = new JSONObject();
        List<String> errorPatient = new ArrayList<>();
        for (String patientCode : patients) {
            if (!patientsDeleteService(patientCode, serviceCode)) {
                errorPatient.add(patientCode);
            }
        }
        jo.put("status", 1);//执行成功
        jo.put("errorPatients", errorPatient);//未成功的患者
        return jo;
    }
    /**
     * 给患者批量删除服务
     *
     * @param patientCode 患者code
     * @param serviceCode 服务code
     * @throws Exception
     */
    @Transactional
    public boolean patientsDeleteService(String patientCode, String serviceCode) {
        try {
            //判断患者是否有签约
            SignFamily signFamily=signFamilyDao.findByPatient(patientCode);
            if(signFamily==null){
                return false;
            }
            //修改患者的服务状态为删除
            signFamilyServiceDao.deletePatientService(patientCode,serviceCode,signFamily.getCode());
            //修改患者的服务项状态为删除
            signFamilyServiceItemDao.deletePatiengServiceItem(patientCode,serviceCode,signFamily.getCode());
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }
}

+ 157 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/system/Icd10DictServcie.java

@ -0,0 +1,157 @@
package com.yihu.wlyy.service.system;
import com.yihu.wlyy.entity.dict.HealthProblemDict;
import com.yihu.wlyy.util.DateUtil;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.thymeleaf.util.DartUtils;
import javax.annotation.PostConstruct;
import java.util.*;
/**
 * Created by chenweida on 2017/8/9.
 */
@Service
public class Icd10DictServcie {
    private final String keyIcd10 = "wlyy:dict:idc:Icd10:";
    private final String keyHealthProblem = "wlyy:dict:idc:HealthProblem:";
    private final String keyDict2healthProblem = "wlyy:dict:idc:Icd10ToHealthProblem:";
    private final String keyHealthProblem2Dict = "wlyy:dict:idc:HealthProblemToIcd10:";
    private final String ok = "wlyy:dict:idc:init";
    @Autowired
    private StringRedisTemplate redisTemplate;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 根据icd10的 code 获取name
     *
     * @param Icd10Code
     * @return
     */
    public String getIcd10Name(String Icd10Code) {
        return redisTemplate.opsForValue().get(keyIcd10 + Icd10Code);
    }
    /**
     * 根据健康问题code获取name
     *
     * @param HealthProblemCode
     * @return
     */
    public String getHealthProblemName(String HealthProblemCode) {
        return redisTemplate.opsForValue().get(keyHealthProblem + HealthProblemCode);
    }
    /**
     * 根据icd10的 code 获取全部的健康问题
     *
     * @param Icd10Code
     * @return
     */
    public String getHealthProblemsByIcd10Code(String Icd10Code) {
        return redisTemplate.opsForValue().get(keyDict2healthProblem + Icd10Code);
    }
    /**
     * 根据健康问题的 code 获取全部的icd10
     *
     * @param HealthProblemCode
     * @return
     */
    public String getIcd10ByHealthProblemCode(String HealthProblemCode) {
        return redisTemplate.opsForValue().get(keyHealthProblem2Dict + HealthProblemCode);
    }
    //==============================初始化数据到redis=============================
    /**
     * 把icd10缓存到redis
     *
     * @return
     */
    @PostConstruct
    public boolean cacheDict() {
        if (redisTemplate.hasKey(ok)) {
            return true;
        }
        List<HealthProblemDict> healthProblemDicts = getHealthProblemDicts();
        //缓存keyIcd10
        cacheIcd10(healthProblemDicts);
        //缓存keyHealthProblem
        cacheHealthProblem(healthProblemDicts);
        //缓存keyHealthProblem2Dict
        cacheHealthProblem2Dict(healthProblemDicts);
        //缓存keyDict2healthProblem
        cacheDict2healthProblem(healthProblemDicts);
        redisTemplate.opsForValue().set(ok, DateUtil.dateToStrLong(new Date()) + "初始化完成");
        return true;
    }
    @Async
    private void cacheIcd10(List<HealthProblemDict> healthProblemDicts) {
        healthProblemDicts.stream().forEach(one -> {
            String key = keyIcd10 + one.getCode();
            redisTemplate.opsForValue().set(key, one.getName());
        });
    }
    @Async
    private void cacheHealthProblem(List<HealthProblemDict> healthProblemDicts) {
        healthProblemDicts.stream().forEach(one -> {
            String key = keyHealthProblem + one.getHpcode();
            redisTemplate.opsForValue().set(key, one.getHpname());
        });
    }
    /**
     * key是 code   value是 hpcode  1对1
     */
    @Async
    private void cacheDict2healthProblem(List<HealthProblemDict> healthProblemDicts) {
        healthProblemDicts.stream().forEach(one -> {
            String key = keyDict2healthProblem + one.getCode();
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("key", one.getHpcode());
            jsonObject.put("value", one.getHpname());
            redisTemplate.opsForValue().set(key, jsonObject.toString());
        });
    }
    /**
     * key是 hpcode    value是 code  1对多
     */
    @Async
    private void cacheHealthProblem2Dict(List<HealthProblemDict> healthProblemDicts) {
        Map<String, List<KeyValueModel>> saveMap = new HashMap<>();
        healthProblemDicts.stream().forEach(one -> {
            List<KeyValueModel> valueList = saveMap.get(one.getHpcode());
            if (valueList == null) {
                valueList = new ArrayList<KeyValueModel>();
            }
            valueList.add(new KeyValueModel(one.getCode(), one.getName()));
            saveMap.put(one.getHpcode(), valueList);
        });
        for (Map.Entry<String, List<KeyValueModel>> one : saveMap.entrySet()) {
            String key = keyHealthProblem2Dict + one.getKey();
            redisTemplate.opsForValue().set(key, JSONArray.fromObject(one.getValue()).toString());
        }
    }
    private List<HealthProblemDict> getHealthProblemDicts() {
        String sql = "select i.*,p.code hpcode,p.`name` hpname from icd10_dict i,hp_icd10_relation hp,health_problem_dict p where i.id=hp.icd10_id and hp.hp_id=p.id";
        return jdbcTemplate.query(sql, new BeanPropertyRowMapper(HealthProblemDict.class));
    }
}

+ 30 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/system/KeyValueModel.java

@ -0,0 +1,30 @@
package com.yihu.wlyy.service.system;
/**
 * Created by chenweida on 2017/8/9.
 */
public class KeyValueModel {
    private String key;
    private String value;
    public KeyValueModel(String key, String value) {
        this.key = key;
        this.value = value;
    }
    public String getKey() {
        return key;
    }
    public void setKey(String key) {
        this.key = key;
    }
    public String getValue() {
        return value;
    }
    public void setValue(String value) {
        this.value = value;
    }
}

+ 77 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/icd/Icd10Controller.java

@ -0,0 +1,77 @@
package com.yihu.wlyy.web.common.icd;
import com.yihu.wlyy.service.system.Icd10DictServcie;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
 * Created by chenweida on 2017/8/9.
 */
@RestController
@RequestMapping("/idc10/")
@Api(description = "icd10和健康问题接口管理")
public class Icd10Controller extends BaseController {
    @Autowired
    private Icd10DictServcie icd10DictServcie;
    @ApiOperation("根据icd10字典的code找到name")
    @RequestMapping(value = "/getIdc10NameByCode", method = RequestMethod.GET)
    public String getTopic(
            @ApiParam(required = true, name = "code", value = "icd10字典code") @RequestParam(required = true, value = "code") String code) {
        try {
            return write(200, "查询成功", "data", icd10DictServcie.getIcd10Name(code));
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
    @ApiOperation("根据icd10的code找到健康问题字典")
    @RequestMapping(value = "/getIcd10ByHealthProCode", method = RequestMethod.GET)
    public String getIcd10ByHealthProCode(
            @ApiParam(required = true, name = "code", value = "icd10字典code") @RequestParam(required = true, value = "code") String code) {
        try {
            return write(200, "查询成功", "data", icd10DictServcie.getIcd10ByHealthProblemCode(code));
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
    @ApiOperation("根据健康问题字典的code找到name")
    @RequestMapping(value = "/getHealthProNameByCode", method = RequestMethod.GET)
    public String getHealthProNameByCode(
            @ApiParam(required = true, name = "code", value = "健康问题字典code") @RequestParam(required = true, value = "code") String code) {
        try {
            return write(200, "查询成功", "data", icd10DictServcie.getHealthProblemName(code));
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
    @ApiOperation("根据健康问题字典的code找到icd10字典")
    @RequestMapping(value = "/getHealthProByIcd10Code", method = RequestMethod.GET)
    public String getHealthProByIcd10Code(
            @ApiParam(required = true, name = "code", value = "健康问题字典code") @RequestParam(required = true, value = "code") String code) {
        try {
            return write(200, "查询成功", "data", icd10DictServcie.getHealthProblemsByIcd10Code(code));
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
    @ApiOperation("初始化全部数据到redis")
    @RequestMapping(value = "/init2Redis", method = RequestMethod.POST)
    public String init2Redis() {
        try {
            icd10DictServcie.cacheDict();
            return write(200, "查询成功");
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
}

+ 1 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/data/DataHandlingController.java

@ -72,4 +72,5 @@ public class DataHandlingController extends BaseController {
            return error(-1, e.getMessage());
        }
    }
}

+ 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());
            }
    }
}

+ 69 - 14
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionInfoController.java

@ -41,7 +41,6 @@ public class PrescriptionInfoController extends BaseController{
    @RequestMapping(value = "/getPrescriptionFilter", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "获取过滤规则信息列表")
    public String getPrescriptionFilter(){
        try {
@ -53,7 +52,6 @@ public class PrescriptionInfoController extends BaseController{
    }
    @RequestMapping(value = "/getDoctorPrescription", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "获取全科医生/建管师续方列表/搜索")
    public String getDoctorPrescription(@RequestParam(required = true)@ApiParam(value = "团队code", name = "teamCode") Integer teamCode,
                                        @RequestParam(required = false)@ApiParam(value = "续方状态", name = "state") String state,
@ -73,7 +71,6 @@ public class PrescriptionInfoController extends BaseController{
    }
    @RequestMapping(value = "/getContinuedPrescriptionAsDoctor", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "续方详情")
    public String getContinuedPrescriptionAsDoctor(@RequestParam(required = true)@ApiParam(value = "续方CODE", name = "code") String code,
                                                   @RequestParam(required = true)@ApiParam(value = "团队长标识:1:是;2否", name = "type") String type){
@ -86,7 +83,6 @@ public class PrescriptionInfoController extends BaseController{
    }
    @RequestMapping(value = "/reviewPrescription", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "续方审核")
    public String reviewPrescription(@RequestParam(required = true)@ApiParam(value = "续方CODE", name = "code") String code,
                                     @RequestParam(required = false)@ApiParam(value = "不同意原因", name = "reason") String reason,
@ -100,7 +96,6 @@ public class PrescriptionInfoController extends BaseController{
    }
    @RequestMapping(value = "/updatePresInfo", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "调整处方")
    @ObserverRequired
    public String updatePresInfo(@RequestParam(required = true)@ApiParam(value = "续方CODE", name = "code") String code,
@ -116,7 +111,6 @@ public class PrescriptionInfoController extends BaseController{
    }
    @RequestMapping(value = "/getInfoTitle", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "调整处方-药品分类及种类数目")
    public String getInfoTitle(){
        try {
@ -128,7 +122,6 @@ public class PrescriptionInfoController extends BaseController{
    }
    @RequestMapping(value = "/getInfoListByParentCode", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "药品类别获取药品")
    private String getInfoListByParentCode(@RequestParam(required = true)@ApiParam(value = "药品类别Code", name = "code") String code){
        try {
@ -177,7 +170,6 @@ public class PrescriptionInfoController extends BaseController{
    }
    @RequestMapping(value = "/getDrugTimes", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "药品品使用频次字典")
    public String getDrugTimes(){
        try {
@ -188,10 +180,9 @@ public class PrescriptionInfoController extends BaseController{
        }
    }
    @RequestMapping(value = "/getDoctorPrescriptionExpressage", method = RequestMethod.GET)
    @ResponseBody
    @RequestMapping(value = "/getHDoctorPrescriptionExpressage", method = RequestMethod.GET)
    @ApiOperation(value = "获取续方订单列表")
    public String getDoctorPrescriptionExpressage(@RequestParam(required = false) @ApiParam(value = "1:需跟踪;2:已接收", name = "type")  String type,
    public String getHDoctorPrescriptionExpressage(@RequestParam(required = false) @ApiParam(value = "1:需跟踪;2:已接收", name = "type")  String type,
                                                  @RequestParam(required = false) @ApiParam(value = "患者姓名关键字", name = "nameKey")String nameKey,
                                                  @RequestParam(required = false) @ApiParam(value = "开始时间", name = "startDate")String startDate,
                                                  @RequestParam(required = false) @ApiParam(value = "结束时间", name = "endDate")String endDate,
@ -200,7 +191,7 @@ public class PrescriptionInfoController extends BaseController{
                                                  @RequestParam(required = false) @ApiParam(value = "页数", name = "page")Integer page,
                                                  @RequestParam(required = false) @ApiParam(value = "每页大小", name = "size")Integer size){
        try {
            return write(200, "操作成功!", "data",prescriptionInfoService.getDoctorPrescriptionExpressage(type,"hxmD201703150222",nameKey,startDate,endDate,hospital,state,page,size));
            return write(200, "操作成功!", "data",prescriptionInfoService.getHDoctorPrescriptionExpressage(type,getUID(),nameKey,startDate,endDate,hospital,state,page,size));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
@ -208,11 +199,75 @@ public class PrescriptionInfoController extends BaseController{
    }
    @RequestMapping(value = "/getPrescriptionExpressageFilter", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "获取续方订单列表过滤条件")
    public String getPrescriptionExpressageFilter(){
        try {
            return write(200, "操作成功!", "data",prescriptionInfoService.getPrescriptionExpressageFilter("hxmD201703150222"));
            return write(200, "操作成功!", "data",prescriptionInfoService.getPrescriptionExpressageFilter(getUID()));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "/getPrescriptionExpressageAsdoctorFilter", method = RequestMethod.GET)
    @ApiOperation(value = "获取全科医生续方订单列表过滤条件")
    public String getPrescriptionExpressageAsdoctorFilter(){
        try {
            return write(200, "操作成功!", "data",prescriptionInfoService.getPrescriptionExpressageAsdoctorFilter());
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "/getDoctorPrescriptionExpressage", method = RequestMethod.GET)
    @ApiOperation(value = "获取全科医生续方订单列表过滤条件")
    public String getDoctorPrescriptionExpressage(@RequestParam(required = false) @ApiParam(value = "团队Code", name = "teamCode")String teamCode,
                                                  @RequestParam(required = false) @ApiParam(value = "居民搜素关键字", name = "nameKey")String nameKey,
                                                  @RequestParam(required = false) @ApiParam(value = "开始时间", name = "startDate")String startDate,
                                                  @RequestParam(required = false) @ApiParam(value = "结束时间", name = "endDate")String endDate,
                                                  @RequestParam(required = false) @ApiParam(value = "机构", name = "hospital")String hospital,
                                                  @RequestParam(required = false) @ApiParam(value = "配送状态", name = "state")String state,
                                                  @RequestParam(required = false) @ApiParam(value = "配送方式:1 自取 2快递配送 3健管师配送", name = "dispensaryType")String dispensaryType,
                                                  @RequestParam(required = false) @ApiParam(value = "未分配健管师", name = "传1为未分配健管师")String AllocationType,
                                                  @RequestParam(required = false) @ApiParam(value = "起始页", name = "page")Integer page,
                                                  @RequestParam(required = false) @ApiParam(value = "每页大小", name = "size")Integer size){
        try {
            return write(200, "操作成功!", "data",
                    prescriptionInfoService.
                            getDoctorPrescriptionExpressage(teamCode, nameKey, startDate, endDate, hospital, state, dispensaryType,AllocationType, page, size));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "/getCountExpressage", method = RequestMethod.GET)
    @ApiOperation(value = "获取指定团队未分配建管师订单数目")
    public String getCountExpressage(@RequestParam(required = true) @ApiParam(value = "团队Code", name = "teamCode")String teamCode){
        try {
            return write(200, "操作成功!", "data", prescriptionInfoService.getCountExpressage(teamCode));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "/getHospitalListTitle", method = RequestMethod.GET)
    @ApiOperation(value = "获取指定团队未分配建管师订单数目")
    public String getHospitalListTitle(@RequestParam(required = true) @ApiParam(value = "团队Code", name = "teamCode")String teamCode){
        try {
            return write(200, "操作成功!", "data", prescriptionInfoService.getHospitalListTitle(teamCode));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "/getTeamHealthDoctorCount", method = RequestMethod.GET)
    @ApiOperation(value = "获取医生同社区底下所有团队建管师数目")
    public String getTeamHealthDoctorCount(){
        try {
            return write(200, "操作成功!", "data", prescriptionInfoService.getTeamHealthDoctorCount(getUID()));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");

+ 73 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/sign/PatientSignFamilyServiceNoFilterController.java

@ -0,0 +1,73 @@
package com.yihu.wlyy.web.patient.sign;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.service.ServiceItem;
import com.yihu.wlyy.service.app.sign.SignFamilyServiceService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
/**
 * Created by chenweida on 2017/8/8.
 */
@RestController
@Api(description = "患者签约服务(没有走拦截器)")
@RequestMapping("/nofilter/sign/service")
public class PatientSignFamilyServiceNoFilterController extends BaseController {
    @Autowired
    private SignFamilyServiceService signFamilyServiceService;
    @RequestMapping(value = "/getPatientService", method = RequestMethod.GET)
    @ApiOperation("根据患者code获取患者的服务")
    public String getPatientService(
            @RequestParam(required = false, value = "patientCode") @ApiParam(required = false, value = "患者code", name = "patientCode") String patientCode
    ) {
        try {
            List<ServiceItem> serviceItems = signFamilyServiceService.getPatientServiceItem(patientCode, null);
            return write(200, "请求成功", "data", serviceItems);
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
    @RequestMapping(value = "/patientAddService", method = RequestMethod.POST)
    @ApiOperation("给患者添加服务")
    public String patientAddService(
            @RequestParam(required = true, value = "patientCodes") @ApiParam(required = true, value = "患者code,多个逗号分割", name = "patientCodes") String patientCodes,
            @RequestParam(required = true, value = "serviceCode") @ApiParam(required = true, value = "服务code", name = "serviceCode") String serviceCode
    ) {
        try {
            String[] patientCode = patientCodes.split(",");
            JSONObject jsonObject = signFamilyServiceService.patientsAddService(Arrays.asList(patientCode), serviceCode);
            return write(200, "请求成功", "data", jsonObject);
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
    @RequestMapping(value = "/patientDeleteService", method = RequestMethod.POST)
    @ApiOperation("给患者删除服务")
    public String patientDeleteService(
            @RequestParam(required = true, value = "patientCodes") @ApiParam(required = true, value = "患者code,多个逗号分割", name = "patientCodes") String patientCodes,
            @RequestParam(required = true, value = "serviceCode") @ApiParam(required = true, value = "服务code", name = "serviceCode") String serviceCode
    ) {
        try {
            String[] patientCode = patientCodes.split(",");
            JSONObject jsonObject = signFamilyServiceService.patientsDeleteService(Arrays.asList(patientCode), serviceCode);
            return write(200, "请求成功", "data", jsonObject);
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/resources/application.yml

@ -289,7 +289,7 @@ spring:
      password: 123456
  redis:
    host: 172.19.103.88 # Redis server host.
    host: 172.19.103.47 # Redis server host.
    port: 6379 # Redis server port.
#    password: jkzl_ehr

+ 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