瀏覽代碼

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

LiTaohong 7 年之前
父節點
當前提交
bd74fc6d97
共有 32 個文件被更改,包括 554 次插入184 次删除
  1. 11 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/profile/Doctor.java
  2. 2 2
      common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/team/sign/DoctorTeamMember.java
  3. 1 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/SignFamily.java
  4. 23 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionInfo.java
  5. 2 1
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/vo/PatientVO.java
  6. 19 3
      common/common-entity/src/main/java/com/yihu/wlyy/entity/zydict/ZyIvOrgPhysicAllotDict.java
  7. 14 29
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/device/DeviceHealthIndexService.java
  8. 19 1
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvOrgPhysicAllotDict.java
  9. 1 1
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/LogService.java
  10. 3 3
      patient-co/patient-co-statistics-es/src/main/resources/application-prod.yml
  11. 1 1
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/activemq/HealthArtListener.java
  12. 5 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionService.java
  13. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/Application.java
  14. 10 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/adapter/PresModeAdapter.java
  15. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/DoctorTeamDao.java
  16. 2 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/DoctorTeamMemberDao.java
  17. 4 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/message/MessageDao.java
  18. 0 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyDao.java
  19. 3 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java
  20. 1 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelInfoService.java
  21. 10 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/message/MessageService.java
  22. 25 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java
  23. 165 55
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java
  24. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java
  25. 29 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/ZyDictService.java
  26. 3 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/MessageType.java
  27. 20 20
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/WechatController.java
  28. 2 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionInfoController.java
  29. 170 35
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorFamilyContractController.java
  30. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/ConsultController.java
  31. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionInfoController.java
  32. 3 3
      patient-co/patient-co-wlyy/src/main/resources/application-prod.yml

+ 11 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/profile/Doctor.java

@ -71,6 +71,8 @@ public class Doctor extends IdEntity {
    private String certificateNum;     //CA证书编号
    private String openid; //医生微信openID
    //=====================非hibernate字段=========================
    private String concernCode;//关注code
    public Double getEvaluateScore() {
        return evaluateScore;
@ -438,4 +440,13 @@ public class Doctor extends IdEntity {
    public void setOpenid(String openid) {
        this.openid = openid;
    }
    @Transient
    public String getConcernCode() {
        return concernCode;
    }
    public void setConcernCode(String concernCode) {
        this.concernCode = concernCode;
    }
}

+ 2 - 2
common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/team/sign/DoctorTeamMember.java

@ -22,10 +22,10 @@ public class DoctorTeamMember extends IdEntity {
    private String memberCode;
    private String code;
    private String name;
    private Integer type;//医生类型:1专科医生,2全科医生,3健康管理师,4临时专科 5.患者
    private Integer type;//医生类型:1服务医生
    private Date czrq;
    private String del;//是否作废,1正常,0作废
    private String signType;//签约类型(1表示三师签约,2表示家庭签约)
    private String signType;//签约类型(1表示三师签约,2表示家庭签约)  废弃字段
    /**
     * default constructor

+ 1 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/SignFamily.java

@ -379,6 +379,7 @@ public class SignFamily extends IdEntity {
        this.patientApplyDate = patientApplyDate;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "patient_apply_unsgin_date")
    public Date getPatientApplyUnsignDate() {
        return patientApplyUnsignDate;

+ 23 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionInfo.java

@ -5,6 +5,7 @@ import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
/**
 * Created by Administrator on 2017/7/21.
@ -49,6 +50,10 @@ public class PrescriptionInfo extends IdEntity{
    private String physicSkinTestName;//皮试类型名称
    private String remark;//备注
    //非数据库字段
    private Integer dispQuantityUntuckFlag;//门诊数量可拆标志 0不可拆,1可拆
    private Integer dispPackUntuckFlag;//门诊包装可拆标志 0不可拆,1可拆
    @Column(name = "code",unique = true , nullable=false)
    public String getCode() {
        return code;
@ -320,4 +325,22 @@ public class PrescriptionInfo extends IdEntity{
    public void setSubjectClass(String subjectClass) {
        this.subjectClass = subjectClass;
    }
    @Transient
    public Integer getDispQuantityUntuckFlag() {
        return dispQuantityUntuckFlag;
    }
    public void setDispQuantityUntuckFlag(Integer dispQuantityUntuckFlag) {
        this.dispQuantityUntuckFlag = dispQuantityUntuckFlag;
    }
    @Transient
    public Integer getDispPackUntuckFlag() {
        return dispPackUntuckFlag;
    }
    public void setDispPackUntuckFlag(Integer dispPackUntuckFlag) {
        this.dispPackUntuckFlag = dispPackUntuckFlag;
    }
}

+ 2 - 1
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/vo/PatientVO.java

@ -299,7 +299,8 @@ public class PatientVO {
	public void setOpenid(String openid) {
		this.openid = openid;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	public Date getOpenidTime() {
		return openidTime;
	}

+ 19 - 3
common/common-entity/src/main/java/com/yihu/wlyy/entity/zydict/ZyIvOrgPhysicAllotDict.java

@ -4,9 +4,6 @@ import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;
/**
@ -21,6 +18,8 @@ public class ZyIvOrgPhysicAllotDict extends IdEntity implements java.io.Serializ
	private String orgCode;//机构编码
	private String physicCode;//药品代码
	private Integer dispQuantityUntuckFlag;//门诊数量可拆标志 0不可拆,1可拆
	private Integer dispPackUntuckFlag;//门诊包装可拆标志 0不可拆,1可拆
	// Constructors
@ -53,4 +52,21 @@ public class ZyIvOrgPhysicAllotDict extends IdEntity implements java.io.Serializ
		this.physicCode = physicCode;
	}
	@Column(name = "disp_quantity_untuck_flag")
	public Integer getDispQuantityUntuckFlag() {
		return dispQuantityUntuckFlag;
	}
	public void setDispQuantityUntuckFlag(Integer dispQuantityUntuckFlag) {
		this.dispQuantityUntuckFlag = dispQuantityUntuckFlag;
	}
	@Column(name = "disp_pack_untuck_flag")
	public Integer getDispPackUntuckFlag() {
		return dispPackUntuckFlag;
	}
	public void setDispPackUntuckFlag(Integer dispPackUntuckFlag) {
		this.dispPackUntuckFlag = dispPackUntuckFlag;
	}
}

+ 14 - 29
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/device/DeviceHealthIndexService.java

@ -211,10 +211,10 @@ public class DeviceHealthIndexService extends BaseDeviceJpaService<DeviceHealthI
            filter.append(" and (s.doctor_name like '%"+doctorName+"%' or s.doctor_health_name like '%"+doctorName+"%') ");
        }
        if(!StringUtils.isEmpty(deviceSn)){
            filter.append(" and i.deviceSn="+deviceSn);
            filter.append(" and i.device_sn='"+deviceSn+"' ");
        }
        if(!StringUtils.isEmpty(idcard)){
            filter.append(" and i.idcard="+idcard);
            filter.append(" and i.idcard='"+idcard+"' ");
        }
        //体征数据创建时间
        if(!StringUtils.isEmpty(date)){
@ -234,35 +234,20 @@ public class DeviceHealthIndexService extends BaseDeviceJpaService<DeviceHealthI
            filter.append(" and i.type="+indexType);
        }
        //体征数据
        if("1".equals(indexType)||"2".equals(indexType)||"4".equals(indexType)){
            if(indexTypeMin1!=null){
                filter.append(" and value1>="+indexTypeMin1);
            }
            if(indexTypeMax1!=null){
                filter.append(" and value1<="+indexTypeMax1);
            }
            if(indexTypeMin2!=null){
                filter.append(" and value2>="+indexTypeMin2);
            }
            if(indexTypeMax2!=null){
                filter.append(" and value2<="+indexTypeMax2);
            }
        }else{
            if(indexTypeMin1!=null){
                filter.append(" and value3>="+indexTypeMin1);
            }
            if(indexTypeMax1!=null){
                filter.append(" and value3<="+indexTypeMax1);
            }
            if(indexTypeMin2!=null){
                filter.append(" and value4>="+indexTypeMin2);
            }
            if(indexTypeMax2!=null){
                filter.append(" and value4<="+indexTypeMax2);
            }
        if(indexTypeMin1!=null){
            filter.append(" and value1>="+indexTypeMin1);
        }
        if(indexTypeMax1!=null){
            filter.append(" and value1<="+indexTypeMax1);
        }
        if(indexTypeMin2!=null){
            filter.append(" and value2>="+indexTypeMin2);
        }
        if(indexTypeMax2!=null){
            filter.append(" and value2<="+indexTypeMax2);
        }
        String f = filter.toString();
        List<Map<String, Object>> resultList = jdbcTemplate.queryForList(sql+f+" order by i.czrq desc ");
        List<Map<String, Object>> resultList = jdbcTemplate.queryForList(sql+f+" order by i.czrq desc limit 0,1000");
        String regex = "(\\w{3})(\\w+)(\\w{3})";
        List<DeviceHealthIndexVO> listTemp = new ArrayList<>();

+ 19 - 1
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvOrgPhysicAllotDict.java

@ -19,7 +19,8 @@ public class ZyIvOrgPhysicAllotDict extends IdEntity implements java.io.Serializ
	private String orgCode;//机构编码
	private String physicCode;//药品代码
	private String dispQuantityUntuckFlag;//门诊数量可拆标志
	private String dispPackUntuckFlag;//门诊包装可拆标志
	// Constructors
	/** default constructor */
@ -51,4 +52,21 @@ public class ZyIvOrgPhysicAllotDict extends IdEntity implements java.io.Serializ
		this.physicCode = physicCode;
	}
	@Column(name = "disp_quantity_untuck_flag")
	public String getDispQuantityUntuckFlag() {
		return dispQuantityUntuckFlag;
	}
	public void setDispQuantityUntuckFlag(String dispQuantityUntuckFlag) {
		this.dispQuantityUntuckFlag = dispQuantityUntuckFlag;
	}
	@Column(name = "disp_pack_untuck_flag")
	public String getDispPackUntuckFlag() {
		return dispPackUntuckFlag;
	}
	public void setDispPackUntuckFlag(String dispPackUntuckFlag) {
		this.dispPackUntuckFlag = dispPackUntuckFlag;
	}
}

+ 1 - 1
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/LogService.java

@ -107,7 +107,7 @@ public class LogService {
            detail.setError(error);
            detail.setCreateTime(new Date());
            if(re.length()>10652261){
                detail.setResponse("超过longtext限制");
                detail.setResponse("超过longtext限制:"+re.substring(0,500));
            }else {
                detail.setResponse(JSONObject.toJSONString(re, SerializerFeature.WriteMapNullValue));
            }

+ 3 - 3
patient-co/patient-co-statistics-es/src/main/resources/application-prod.yml

@ -16,9 +16,9 @@ spring:
      password: im!)123
  redis:
    host: 27.155.101.77 # Redis server host.
    port: 6380 # Redis server port.
    password: jkzl_ehr
     host: 59.61.92.90 # Redis server host.
     port: 9054  # Redis server port.
     password: jkzlehr
  followupMessage:
    cron : 0 5 0 * * ?

+ 1 - 1
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/activemq/HealthArtListener.java

@ -137,7 +137,7 @@ public class HealthArtListener implements MessageListener {
            }
            // 推送消息给微信端
            org.json.JSONObject json = new org.json.JSONObject();
            json.put("first", one.getPatientName() + ",您好! " + one.getSendName() + technicalName +"给您发来了一篇患教文章");
            json.put("first", one.getPatientName() + ",您好! " + one.getSendName() + technicalName +"给您发来了一篇健康宣教文章");
            json.put("toUser", one.getPatientCode());
            json.put("article", one.getArticleId() + "");
            json.put("title", one.getArticleTitle());

+ 5 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionService.java

@ -118,6 +118,11 @@ public class PrescriptionService extends BaseService {
                    String re = JSONArray.fromObject(list).toString();
                    redisTemplate.opsForValue().set(key,re,180, TimeUnit.DAYS);
                }
                Prescription prescription = prescriptionDao.findByCode(prescriptionCode);
                if(messageService.getMessageNoticeSettingByMessageType(prescription.getDoctor(),"1", MessageNoticeSetting.MessageTypeEnum.prescriptionSwitch.getValue())){
                    String content = "您有一条新的续方订单线下调整已完成!";
                    pushMsgTask.put(prescription.getDoctor(), MessageType.MESSAGE_TYPE_PRESCRIPTION_WAIT_TAKE_DRUG.D_P_WRD.name(), MessageType.MESSAGE_TYPE_PRESCRIPTION_WAIT_TAKE_DRUG.续方消息.name(), content, prescription.getCode());
                }
            }
        }
        catch (Exception ex) {

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/Application.java

@ -11,7 +11,7 @@ import org.springframework.boot.autoconfigure.elasticsearch.jest.JestAutoConfigu
import org.springframework.context.ApplicationContext;
/**
 * Created by chenweida on 2017/7/28.
 * Created by chenweida on 2017/7/281.111111
 */
@SpringBootApplication
@EnableAutoConfiguration(exclude = {

+ 10 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/adapter/PresModeAdapter.java

@ -26,9 +26,10 @@ public class PresModeAdapter {
    private static Logger logger = LoggerFactory.getLogger(PresModeAdapter.class);
    @Autowired
    private Icd10DictServcie icd10DictServcie;
    @Autowired
    private ZyDictService zyDictService;
    @Autowired
    private Icd10DictServcie icd10DictServcie;
    /**
     * 处方模板适配器
@ -36,7 +37,7 @@ public class PresModeAdapter {
     * @return
     * @throws Exception
     */
    public JSONArray modeTopresInfo(String json){
    public JSONArray modeTopresInfo(String json,String doctor){
        try{
            JSONObject oldJson = JSONObject.parseObject(json);
            if(oldJson.getInteger("status")!=200){
@ -93,6 +94,12 @@ public class PresModeAdapter {
                            prescriptionInfo.setPhysicInjectPlaceName("");//注射地点名称
                            prescriptionInfo.setPhysicSkinTest(info.getString("PHYSIC_SKIN_TEST"));//皮试类型名称
                            prescriptionInfo.setPhysicSkinTestName(info.getString("PHYSIC_SKIN_TEST_NAME"));//皮试类型名称
                            //获取可拆标志
//                            List<Map<String, Object>> list = zyDictService.findDispDictByCode(doctor,info.getString("ITEM_CODE"));
//                            if(list!=null&&list.size()>0){
//                                prescriptionInfo.setDispPackUntuckFlag(Integer.valueOf(list.get(0).get("dispPackUntuckFlag").toString()));
//                                prescriptionInfo.setDispQuantityUntuckFlag(Integer.valueOf(list.get(0).get("dispQuantityUntuckFlag").toString()));
//                            }
                            is.add(prescriptionInfo);
                        }
                        m.put("prescriptionInfo",is);

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

@ -25,7 +25,7 @@ JpaSpecificationExecutor<DoctorTeam> {
	DoctorTeam findByParientCodeAndSignType(String parientCode, String type);
	@Modifying
	@Query("update DoctorTeam a set a.del =0  where a.code = ?1 and signType='2'")
	@Query("update DoctorTeam a set a.del =0  where a.code = ?1 ")
	void deleteTeam(String teamCode);
	/**

+ 2 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/DoctorTeamMemberDao.java

@ -33,9 +33,10 @@ public interface DoctorTeamMemberDao extends PagingAndSortingRepository<DoctorTe
    void updateType1Del(String code);
    @Modifying
    @Query("update DoctorTeamMember a set a.del = '0' where a.team = ?1 and signType='2' ")
    @Query("update DoctorTeamMember a set a.del = '0' where a.team = ?1  ")
    void deleteMember(String code);
    @Query("select count(a) FROM DoctorTeamMember a WHERE a.memberCode =?1 and  a.del='1'")
    Integer teamListByDoctorCode(String doctorCode);

+ 4 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/message/MessageDao.java

@ -20,10 +20,10 @@ import java.util.List;
public interface MessageDao extends PagingAndSortingRepository<Message, Long>, JpaSpecificationExecutor<Message> {
    @Query("select count(1) from Message a where a.type =1 and a.read= 1 and a.receiver=?1 ")
    @Query("select count(1) from Message a where a.type in(1,101) and a.read= 1 and a.receiver=?1 ")
    Integer amountUnreadByReceiver(String doctor);
    @Query("select a from Message a where a.type =1 and a.read= 1 and a.receiver=?1 order by a.czrq desc")
    @Query("select a from Message a where a.type in(1,101) and a.read= 1 and a.receiver=?1 order by a.czrq desc")
    Page<Message> amountUnreadLastByReceiver(String doctor, Pageable pageRequest);
    @Query("select count(1) from Message a where a.type =2 and a.read= 1 and a.receiver=?1 ")
@ -56,13 +56,13 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @Query("update Message a set a.read = 0 where a.receiver = ?1 and a.sender=?2 and a.tzType=?3")
    int updateHealthIndexMessageByPatient(String doctor, String patient, String type);
    @Query("select a from Message a where a.read= 1 and a.receiver = ?1 and a.type not in (1,2,6,7,12) order by a.czrq desc")
    @Query("select a from Message a where a.read= 1 and a.receiver = ?1 and a.type not in (1,2,6,7,12,101) order by a.czrq desc")
    List<Message> getSystemMessageUnread(String doctor);
    @Query("select a from Message a where a.receiver = ?1 and a.prescriptionStatus=?2 and a.type in (6,7) order by a.createTime desc")
    List<Message> getSysTemMessageByPrescription(String doctor, String prescriptionStatus);
    @Query("select a from Message a where a.receiver = ?1 and a.type not in (1,2,6,7,12) and (a.del = '1' or a.del is null) ")
    @Query("select a from Message a where a.receiver = ?1 and a.type not in (1,2,6,7,12,101) and (a.del = '1' or a.del is null) ")
    List<Message> getSystemMessage(String doctor, Pageable pageRequest);
    @Query("select a from Message a where a.receiver = ?1 and a.type=?2 and a.prescriptionStatus='0' ")

+ 0 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyDao.java

@ -46,8 +46,6 @@ public interface SignFamilyDao extends PagingAndSortingRepository<SignFamily, Lo
    @Query("select a from SignFamily a where a.patient = ?1 and a.type = ?2 and a.status >= 1")
    SignFamily findByPatientAndType(String patient, int type);
    SignFamily findByCodeAndType(String code, Integer type);
    SignFamily findByFamilyCode(String familyCode);
    SignFamily findByTeamCode(String TeamCode);

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

@ -901,7 +901,8 @@ public class DoctorInfoService extends BaseService {
                data.put("remark", remark);
//                data.put("remark", newD.getName() + "健管师将专门为您提供优质健康服务");
            } else {
                remark = remark.replace("key1",newD.getName() + "健管师与" + signFamily.getDoctorName() + "医生一道,");
                remark = remark.replace("key1",newD.getName()==null?"":newD.getName());
                remark = remark.replace("key2",signFamily.getDoctorName()==null?"":signFamily.getDoctorName());
                data.put("remark", remark);
//                data.put("remark", newD.getName() + "健管师与" + signFamily.getDoctorName() + "医生一道,为您提供优质健康服务");
            }
@ -929,7 +930,7 @@ public class DoctorInfoService extends BaseService {
            } else {
                templateConfig = templateConfigDao.findByScene("template_doctor_change","jgsxzqk");
                remark = templateConfig.getRemark();
                remark.replace("key1",(newD.getName()==null?"":newD.getName())).replace("key2",(signFamily.getDoctorName()==null?"":signFamily.getDoctorName()));
                remark = remark.replace("key1",(newD.getName()==null?"":newD.getName())).replace("key2",(signFamily.getDoctorName()==null?"":signFamily.getDoctorName()));
//                data.put("remark", newD.getName() + "健管师与" + signFamily.getDoctorName() + "医生一道,为您提供优质健康服务");
                data.put("remark", remark);
            }

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

@ -108,6 +108,7 @@ public class SignPatientLabelInfoService extends BaseService {
        json.put("mobile", p.getMobile());
        // 设置患者微信openid
        json.put("openid", StringUtils.isNotEmpty(p.getOpenid()) ? p.getOpenid() : "");
        json.put("openidTime",DateUtil.dateToStr(p.getOpenidTime(), DateUtil.YYYY_MM_DD_HH_MM_SS));
        // 设置患者联系电话
        json.put("phone", p.getPhone());
        // 设置患者头像

+ 10 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/message/MessageService.java

@ -115,7 +115,8 @@ public class MessageService extends BaseService {
                    msgJson.put("title", msg.getTitle());
                    msgJson.put("type", msg.getType());
                    if (msg.getSignStatus().equals("4")) {
                        msgJson.put("msg", msg.getSenderName() + "申请与您解除家庭签约");
                        //msgJson.put("msg", msg.getSenderName() + "申请与您解除家庭签约");
                        msgJson.put("msg", "您有一条取消家庭签约消息,请查看。");
                    } else if(msg.getSignStatus().equals("8")){
                        msgJson.put("msg", msg.getSenderName() + "申请与您续签家庭医生");
                    }else{
@ -615,4 +616,12 @@ public class MessageService extends BaseService {
        return re==1;
    }
    public String setMessageRead(Long messid){
        Message mess = messageDao.findOne(messid);
        mess.setRead(0);
        mess.setOver("0");
        messageDao.save(mess);
        return "1";
    }
}

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

@ -21,9 +21,9 @@ import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.message.MessageService;
import com.yihu.wlyy.service.system.Icd10DictServcie;
import com.yihu.wlyy.service.third.jw.JwPrescriptionService;
import com.yihu.wlyy.service.third.jw.ZyDictService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
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;
@ -115,6 +115,8 @@ public class PrescriptionInfoService extends BaseService {
	private HttpClientUtil httpClientUtil;
    @Autowired
    private MessageService messageService;
    @Autowired
    private ZyDictService zyDictService;
    private static final Logger logger = LoggerFactory.getLogger(PrescriptionInfoService.class);
@ -889,6 +891,14 @@ public class PrescriptionInfoService extends BaseService {
    public com.alibaba.fastjson.JSONObject getContinuedPrescriptionAsDoctor(String code) {
        Prescription prescription = prescriptionDao.findByCode(code);
        List<PrescriptionInfo> prescriptionInfos = prescriptionInfoDao.findByPrescriptionCode(code);
        //获取药品可拆标志
//        prescriptionInfos.forEach(info->{
//            List<Map<String,Object>> list = zyDictService.findDispDictByCode(prescription.getDoctor(),info.getDrugCode());
//            if(list!=null&&list.size()>0){
//                info.setDispPackUntuckFlag(Integer.valueOf(list.get(0).get("dispPackUntuckFlag").toString()));
//                info.setDispQuantityUntuckFlag(Integer.valueOf(list.get(0).get("dispQuantityUntuckFlag").toString()));
//            }
//        });
        PrescriptionReviewed reviewed = prescriptionReviewedDao.findByPrescriptionCode(code);
        List<PrescriptionAdjust> prescriptionAdjusts = prescriptionAdjustDao.findByPrescriptionCodeOrderByIdDesc(code);
        com.alibaba.fastjson.JSONObject rs = new com.alibaba.fastjson.JSONObject();
@ -1781,7 +1791,7 @@ public class PrescriptionInfoService extends BaseService {
     */
    public com.alibaba.fastjson.JSONArray getPrescriptionTemp(String doctor) throws Exception {
        String rp = jwPrescriptionService.getRecipeTemplate(doctor);
        com.alibaba.fastjson.JSONArray rs = presModeAdapter.modeTopresInfo(rp);
        com.alibaba.fastjson.JSONArray rs = presModeAdapter.modeTopresInfo(rp,doctor);
        return rs;
    }
@ -1833,7 +1843,7 @@ public class PrescriptionInfoService extends BaseService {
        return new JSONArray(rs);
    }
    public List<Map<String, Object>> getPhysicInfo(String code) {
    public List<Map<String, Object>> getPhysicInfo(String code,String doctor) {
        StringBuffer sql = new StringBuffer("SELECT " +
                " t.min_dose AS minDose, " +
                " t.physic_code AS physicCode, " +
@ -1845,9 +1855,19 @@ public class PrescriptionInfoService extends BaseService {
                " t.pack_unit As packUnit, " +
                " com3.`name` As packUnitName, " +
                " pack_spec AS packSpec, " +
                " subject_class AS subjectClass" +
                " subject_class AS subjectClass," +
                " d.dispQuantityUntuckFlag," +
                " d.dispPackUntuckFlag" +
                " FROM " +
                " zy_iv_physic_dict t, " +
                " (SELECT  o.disp_quantity_untuck_flag dispQuantityUntuckFlag, " +
                "          o.disp_pack_untuck_flag dispPackUntuckFlag " +
                "   FROM " +
                "        wlyy_doctor_mapping h, " +
                "        zy_iv_org_physic_allot_dict o " +
                "   WHERE o.org_code = h.jw_doctor_hospital " +
                "         AND h.doctor_code = ? " +
                "         AND o.physic_code = ?) d, " +
                " (SELECT code,name FROM zy_common_dict WHERE dict_name = 'IV_MEASURE_UNIT_DICT') com1, " +
                " (SELECT code,name FROM zy_common_dict WHERE dict_name = 'IV_MEASURE_UNIT_DICT') com2, " +
                " (SELECT code,name FROM zy_common_dict WHERE dict_name = 'IV_MEASURE_UNIT_DICT') com3 " +
@ -1856,7 +1876,7 @@ public class PrescriptionInfoService extends BaseService {
                " AND com2.`code` = t.quantity_unit   " +
                " AND com3.`code` = t.pack_unit   " +
                " AND t.physic_code = ?");
        List<Map<String, Object>> rs = jdbcTemplate.queryForList(sql.toString(),new Object[]{code});
        List<Map<String, Object>> rs = jdbcTemplate.queryForList(sql.toString(),new Object[]{doctor,code,code});
        return rs;
    }

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

@ -60,6 +60,7 @@ import org.springside.modules.persistence.DynamicSpecifications;
import org.springside.modules.persistence.SearchFilter;
import org.springside.modules.persistence.SearchFilter.Operator;
import javax.persistence.criteria.CriteriaBuilder;
import java.text.SimpleDateFormat;
import java.util.*;
@ -170,7 +171,7 @@ public class FamilyContractService extends BaseService {
    public SignFamily findSignFamilyByCode(String code) {
        return signFamilyDao.findByCodeAndType(code, 2);
        return signFamilyDao.findByCode(code);
    }
    public SignFamily findByPatientByType(String patient, int type) {
@ -812,6 +813,7 @@ public class FamilyContractService extends BaseService {
        }
        if (sf != null) {
            sf.setStatus(-1);
            sf.setPatientApplyUnsignDate(new Date());
        } else {
            return -2;
        }
@ -823,9 +825,37 @@ public class FamilyContractService extends BaseService {
                if (message != null) {
                    message.setRead(0);
                    message.setOver("0");
                    messageDao.save(message);
                }
            }
        }
        Patient p = patientDao.findByCode(patient);
        // 添加取消签约消息
        Message message = new Message();
        message.setCzrq(new Date());
        message.setCreateTime(new Date());
        message.setContent("您有一条新的家庭签约取消通知!");
        message.setRead(1);//设置未读
        message.setReceiver(doctor);//设置接受医生的code
        message.setSender(patient);//设置发送的用户
        message.setSenderName(p.getName());
        message.setCode(getCode());
        message.setSenderPhoto(p.getPhoto());
        message.setTitle("家庭签约取消通知");
        message.setType(101);//家庭签约取消信息
        message.setReadonly(1);//是否只读消息
        message.setSex(p.getSex());
        message.setOver("1");//未处理
        message.setData(sf.getCode());
        message.setSignStatus("4");
        message.setDel("1");
        message.setState(1);
        messageDao.save(message);
        if(messageService.getMessageNoticeSettingByMessageType(doctor,"1",MessageNoticeSetting.MessageTypeEnum.signSwitch.getValue())) {
            pushMsgTask.put(doctor, MessageType.MESSAGE_TYPE_DOCTOR_SIGN_WEB_RELIEVE.D_SW_02.name(), MessageType.MESSAGE_TYPE_DOCTOR_SIGN_WEB_RELIEVE.患者取消家庭签约.name(), "您有一条取消家庭签约消息,请查看。", patient);
        }
        return 200;
    }
@ -839,19 +869,12 @@ public class FamilyContractService extends BaseService {
     */
    public int unsignRenew(String patient, String doctor) throws Exception {
        if (4 < DateUtil.getNowMonth() && DateUtil.getNowMonth() < 7) {
            SignFamilyRenew sf = signFamilyRenewDao.findByDoctorPatient(doctor, patient);
            if (sf != null && sf.getStatus() != 0 && sf.getStatus() != 2) {
                return -2;
            }
            sf.setStatus(-1);
        } else {
            SignFamily sf = signFamilyDao.findByDoctorPatient(doctor, patient);
            if (sf != null && sf.getStatus() != 0 && sf.getStatus() != 2) {
                return -2;
            }
            sf.setStatus(-1);
        SignFamily sf = signFamilyDao.findByDoctorPatient(doctor, patient);
        if (sf != null && sf.getStatus() != 0 && sf.getStatus() != 2) {
            return -2;
        }
        sf.setStatus(-1);
        sf.setPatientApplyUnsignDate(new Date());
        //结束与医生所有消息
        List<Message> messages = messageDao.findByPatientRenew(patient, doctor);
@ -867,6 +890,33 @@ public class FamilyContractService extends BaseService {
            }
        }
        Patient p = patientDao.findByCode(patient);
        // 添加取消签约消息
        Message message = new Message();
        message.setCzrq(new Date());
        message.setCreateTime(new Date());
        message.setContent("您有一条新的家庭签约取消通知!");
        message.setRead(1);//设置未读
        message.setReceiver(doctor);//设置接受医生的code
        message.setSender(patient);//设置发送的用户
        message.setSenderName(p.getName());
        message.setCode(getCode());
        message.setSenderPhoto(p.getPhoto());
        message.setTitle("家庭签约取消通知");
        message.setType(101);//家庭签约取消信息
        message.setReadonly(1);//是否只读消息
        message.setSex(p.getSex());
        message.setOver("1");//未处理
        message.setData(sf.getCode());
        message.setSignStatus("4");
        message.setDel("1");
        message.setState(1);
        messageDao.save(message);
        if(messageService.getMessageNoticeSettingByMessageType(doctor,"1",MessageNoticeSetting.MessageTypeEnum.signSwitch.getValue())) {
            pushMsgTask.put(doctor, MessageType.MESSAGE_TYPE_DOCTOR_SIGN_WEB_RELIEVE.D_SW_02.name(), MessageType.MESSAGE_TYPE_DOCTOR_SIGN_WEB_RELIEVE.患者取消家庭签约.name(), "您有一条取消家庭签约消息,请查看。", patient);
        }
        return 200;
    }
@ -1862,6 +1912,48 @@ public class FamilyContractService extends BaseService {
        return messageDao.findAll(spec, pageRequest);
    }
    public List<Map<String,Object>> findSignMesByDoctor(String doctor,Long id,int pagesize){
        if (pagesize <= 0) {
            pagesize = 10;
        }
        String sql = "SELECT m.id," +
                "   m.code, " +
                "   m.receiver," +
                "   m.sender," +
                "   m.data AS signCode," +
                "   m.title," +
                "   m.content AS message," +
                "   m.type," +
                "   m.platform," +
                "   m.state," +
                "   m.has_read AS 'read'," +
                "   m.readonly," +
                "   m.czrq," +
                "   m.del," +
                "   m.over AS status," +
                "   m.value1," +
                "   m.value2," +
                "   m.sign_status AS signStatus," +
                "   m.receiver_name AS receiverName," +
                "   m.sender_photo AS senderPhoto," +
                "   m.sender_name AS senderName," +
                "   m.reason," +
                "   m.sex," +
                "   m.relation_code AS relationCode," +
                "   m.create_time AS createTime " +
                " FROM wlyy_message m " +
                " WHERE m.receiver ='"+doctor+"'  " +
                " AND m.over = '1' " +
                " AND m.has_read =1 " +
                " AND m.type IN (1,101) ";
        if (id > 0) {
            sql +=" AND id >"+id;
        }
        sql += " ORDER BY m.id DESC LIMIT 0,"+pagesize;
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        return list;
    }
    /**
     * 查询已签约总数
     *
@ -3237,7 +3329,7 @@ public class FamilyContractService extends BaseService {
                    "  sp.id labelid, " +
                    " CASE WHEN sp.label_name is null THEN '未标注' WHEN sp.label_name='' THEN '未标注' else sp.label_name END labelname, " +
                    "  sp.label_type labeltype, " +
                    "  p.idcard idcard " +
                    "  p.idcard idcard" +
                    " FROM " +
                    " wlyy_sign_family sf " +
                    " JOIN wlyy_patient p ON sf.patient = p.CODE " +
@ -3261,7 +3353,8 @@ public class FamilyContractService extends BaseService {
                    "  sp.id labelid, " +
                    " CASE WHEN sp.label_name is null THEN '未标注' WHEN sp.label_name='' THEN '未标注' else sp.label_name END labelname, " +
                    "  sp.label_type labeltype, " +
                    "  p.idcard idcard " +
                    "  p.idcard idcard ," +
                    "  p.openid" +
                    " FROM " +
                    " wlyy_sign_family sf " +
                    " JOIN wlyy_patient p ON sf.patient = p.CODE " +
@ -3933,17 +4026,20 @@ public class FamilyContractService extends BaseService {
        maping.setIdcard(idCard);
        maping.setNeedUpdate("0");
        maping.setSignYear(signYear);
        maping.setNeedUpload("1");
        maping.setNeedRenewUpload("0");
        //判断是否是预签约
        //判断规则:如果在4月份到7月份为预签约
        int month = DateUtil.getNowMonth();
        if (month >= 4 && month < 7) {
            //预签约逻辑
            maping.setNeedUpload("0");
            maping.setNeedRenewUpload("1");
        } else {
            maping.setNeedUpload("1");
            maping.setNeedRenewUpload("0");
        }
//        int month = DateUtil.getNowMonth();
//        if (month >= 4 && month < 7) {
//            //预签约逻辑
//            maping.setNeedUpload("0");
//            maping.setNeedRenewUpload("1");
//        } else {
//            maping.setNeedUpload("1");
//            maping.setNeedRenewUpload("0");
//        }
        signFamilyMappingDao.save(maping);
    }
@ -3964,8 +4060,13 @@ public class FamilyContractService extends BaseService {
                " f.patient, " +
                " f.sign_year, " +
                " t.server_type AS serverType, " +
                " t.server_type_name AS specialPopulation " +
                "FROM " +
                " t.server_type_name AS specialPopulation," +
                " p.name," +
                " p.sex," +
                " IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age," +
                " p.photo," +
                " CASE WHEN p.openid is null THEN '0' WHEN p.openid='' THEN '0' else 1 END hasopenid" +
                " FROM " +
                " wlyy_sign_family_server t, " +
                " ( " +
                "  SELECT " +
@ -3978,9 +4079,11 @@ public class FamilyContractService extends BaseService {
                "   s.`status` >= 0 " +
                "  AND s.admin_team_code = " + teamCode +
                "  AND s.doctor_health IS NULL " +
                " ) f " +
                "WHERE " +
                " t.sign_code = f. CODE ";
                " ) f," +
                " wlyy_patient p " +
                " WHERE " +
                " t.sign_code = f. CODE AND " +
                " p.code = f.patient ";
        List<Map<String, Object>> patientList = jdbcTemplate.queryForList(patientSql);
        String totalSql = " SELECT " +
                " s.patient" +
@ -4000,19 +4103,17 @@ public class FamilyContractService extends BaseService {
            if (patientList != null) {
                for (Map<String, Object> map : serlist) {
                    String labelCode = (String) map.get("labelCode");
                    List<Map<String, String>> codes = new ArrayList<>();
                    List<Map<String, Object>> codes = new ArrayList<>();
                    Iterator iterator = patientList.iterator();
                    while (iterator.hasNext()) {
                        Map<String, Object> p = (Map<String, Object>) iterator.next();
                        String serverType = p.get("serverType") == null ? "" : ((String) p.get("serverType"));
                        if (labelCode.equals(serverType)) {
                            Map<String, String> code = new HashMap<>();
                            code.put("code", (String) p.get("patient"));
                            codes.add(code);
                            codes.add(p);
                            iterator.remove();
                        }
                    }
                    map.put("codes", codes);
                    map.put("ps", codes);
                    map.put("number", (codes != null && codes.size() > 0) ? codes.size() : 0);
                }
            }
@ -4024,9 +4125,14 @@ public class FamilyContractService extends BaseService {
    public JSONObject getCountryPatientList(Long teamCode) {
        String totalSql = " SELECT " +
                " s.patient,ifnull(s.sick_village,0) as labelCode" +
                " s.patient,ifnull(s.sick_village,0) as labelCode," +
                " p.name," +
                " p.sex," +
                " IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age," +
                " p.photo," +
                " CASE WHEN p.openid is null THEN '0' WHEN p.openid='' THEN '0' else 1 END hasopenid " +
                " FROM " +
                " wlyy_sign_family s " +
                " wlyy_sign_family s JOIN  wlyy_patient p ON p.code = s.patient" +
                " WHERE " +
                " s.`status` >= 0 " +
                " AND s.admin_team_code = ? " +
@ -4054,19 +4160,17 @@ public class FamilyContractService extends BaseService {
            for (Map<String, Object> map : patientList) {
                String labelCode = (String) map.get("labelCode");
                if (StringUtils.isNotBlank(labelCode)) {
                    List<Map<String, String>> codes = new ArrayList<>();
                    List<Map<String, Object>> codes = new ArrayList<>();
                    Iterator iterator = totalList.iterator();
                    while (iterator.hasNext()) {
                        Map<String, Object> p = (Map<String, Object>) iterator.next();
                        String lbCode = p.get("labelCode") == null ? "" : ((String) p.get("labelCode"));
                        if (labelCode.equals(lbCode)) {
                            Map<String, String> code = new HashMap<>();
                            code.put("code", (String) p.get("patient"));
                            codes.add(code);
                            codes.add(p);
                            iterator.remove();
                        }
                    }
                    map.put("codes", codes);
                    map.put("ps", codes);
                }
            }
        }
@ -4076,9 +4180,14 @@ public class FamilyContractService extends BaseService {
    public JSONObject getTeamCountryPatientChangeDoctorList(Long teamCode, String level, String oldDoctorCode) {
        String totalSql = " SELECT " +
                " s.patient,ifnull(s.sick_village,0) as labelCode" +
                " s.patient,ifnull(s.sick_village,0) as labelCode," +
                " p.name," +
                " p.sex," +
                " IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age," +
                " p.photo," +
                " CASE WHEN p.openid is null THEN '0' WHEN p.openid='' THEN '0' else 1 END hasopenid" +
                " FROM " +
                " wlyy_sign_family s " +
                " wlyy_sign_family s JOIN wlyy_patient p ON p.code = s.patient" +
                " WHERE " +
                " s.`status` >= 0 " +
                " AND s.admin_team_code = ? ";
@ -4114,19 +4223,17 @@ public class FamilyContractService extends BaseService {
            for (Map<String, Object> map : patientList) {
                String labelCode = (String) map.get("labelCode");
                if (StringUtils.isNotBlank(labelCode)) {
                    List<Map<String, String>> codes = new ArrayList<>();
                    List<Map<String, Object>> codes = new ArrayList<>();
                    Iterator iterator = totalList.iterator();
                    while (iterator.hasNext()) {
                        Map<String, Object> p = (Map<String, Object>) iterator.next();
                        String lbCode = p.get("labelCode") == null ? "" : ((String) p.get("labelCode"));
                        if (labelCode.equals(lbCode)) {
                            Map<String, String> code = new HashMap<>();
                            code.put("code", (String) p.get("patient"));
                            codes.add(code);
                            codes.add(p);
                            iterator.remove();
                        }
                    }
                    map.put("codes", codes);
                    map.put("ps", codes);
                }
            }
        }
@ -4148,7 +4255,12 @@ public class FamilyContractService extends BaseService {
        String patientSql = "SELECT  " +
                " f.patient, " +
                " s.server_type AS serverType, " +
                " s.server_type_name AS serverTypeName " +
                " s.server_type_name AS serverTypeName, " +
                " p.name," +
                " p.sex," +
                " IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age," +
                " p.photo," +
                " CASE WHEN p.openid is null THEN '0' WHEN p.openid='' THEN '0' else 1 END hasopenid " +
                " FROM  " +
                " wlyy_sign_family_server s, " +
                "( " +
@ -4166,7 +4278,7 @@ public class FamilyContractService extends BaseService {
        } else {
            patientSql = patientSql + " AND s.doctor_health ='" + oldDoctorCode + "'";
        }
        patientSql = patientSql + " ) f WHERE f.`code` =s.sign_code";
        patientSql = patientSql + " ) f,wlyy_patient p WHERE f.`code` =s.sign_code AND p.code = f.patient";
        List<Map<String, Object>> patientList = jdbcTemplate.queryForList(patientSql);
        String totalSql = " SELECT " +
@ -4192,19 +4304,17 @@ public class FamilyContractService extends BaseService {
            if (patientList != null) {
                for (Map<String, Object> map : serlist) {
                    String labelCode = (String) map.get("labelCode");
                    List<Map<String, String>> codes = new ArrayList<>();
                    List<Map<String, Object>> codes = new ArrayList<>();
                    Iterator iterator = patientList.iterator();
                    while (iterator.hasNext()) {
                        Map<String, Object> p = (Map<String, Object>) iterator.next();
                        String serverType = p.get("serverType") == null ? "" : ((String) p.get("serverType"));
                        if (labelCode.equals(serverType)) {
                            Map<String, String> code = new HashMap<>();
                            code.put("code", (String) p.get("patient"));
                            codes.add(code);
                            codes.add(p);
                            iterator.remove();
                        }
                    }
                    map.put("codes", codes);
                    map.put("ps", codes);
                    map.put("number", (codes != null && codes.size() > 0) ? codes.size() : 0);
                }
            }

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

@ -952,7 +952,7 @@ public class SignWebService extends BaseService {
        //统计当年咨询数量
        String consult_sql = "select count(1) as count from wlyy_consult_team  w where w.doctor = ? and w.patient =? and w.czrq>='"+yearBegin+"' and w.czrq<'"+yearEnd+"'";
        //统计随访数量
        String followup_sql = "select count(1) as count from wlyy_followup  w where (w.doctor_code = ? or w.doctor_code =?) and w.patient_code =? and w.create_time>='"+yearBegin+"' and w.create_time<'"+yearEnd+"'  and w.followup_class is not null ";
        String followup_sql = "select count(1) as count from wlyy_followup  w where (w.doctor_code = ? or w.doctor_code =?) and w.patient_code =? and w.create_time>='"+yearBegin+"' and w.create_time<'"+yearEnd+"'  and w.status>0 ";
        //统计待预约数量
        String reservation_sql = "select count(1) as count from wlyy_patient_reservation  w where (w.doctor = ? or w.doctor =?) and w.patient =? and w.czrq>='"+yearBegin+"' and w.czrq<'"+yearEnd+"'";
        //统计健康教育数量
@ -1065,7 +1065,7 @@ public class SignWebService extends BaseService {
        //获取咨询
        String consult_sql = "select w.consult,w.symptoms,w.czrq,w.status,1 as type from wlyy_consult_team  w where w.doctor = ? and w.patient =? and w.czrq>='"+yearBegin+"' and w.czrq<'"+yearEnd+"'";
        //获取随访
        String followup_sql = "select w.id,w.followup_type,w.followup_class,w.followup_date as czrq,w.followup_manager_status,w.status,2 as type from wlyy_followup  w where (w.doctor_code = ? or w.doctor_code =?) and w.patient_code =? and w.create_time>='"+yearBegin+"' and w.create_time<'"+yearEnd+"' and w.followup_class is not null";
        String followup_sql = "select w.id,w.followup_type,w.followup_class,w.followup_date as czrq,w.followup_manager_status,w.status,2 as type from wlyy_followup  w where (w.doctor_code = ? or w.doctor_code =?) and w.patient_code =? and w.create_time>='"+yearBegin+"' and w.create_time<'"+yearEnd+"' and w.status>0 ";
        //获取待预约
        String reservation_sql = "select w.code,w.id, w.doctor_name,w.doctor_code,w.doctor_job,w.doctor,w.dname,w.org_code,w.status,w.start_time as czrq,3 as type from wlyy_patient_reservation  w where (w.doctor = ? or w.doctor =?) and w.patient =? and w.czrq>='"+yearBegin+"' and w.czrq<'"+yearEnd+"'";
        //获取健康教育

+ 29 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/ZyDictService.java

@ -23,8 +23,8 @@ import java.util.Map;
 */
@Service
public class ZyDictService {
    @Autowired
    private JwPrescriptionService jwPrescriptionService;
//    @Autowired
//    private JwPrescriptionService jwPrescriptionService;
    @Autowired
    private HospitalDao hospitalDao;
    @Autowired
@ -186,6 +186,27 @@ public class ZyDictService {
        return "";
    }
    /**
     * 获取药品字典的可拆标志
     * @param doctor
     * @param code
     * @return
     */
    public List<Map<String, Object>> findDispDictByCode(String doctor,String code){
        String sql = "SELECT " +
                    "     o.disp_quantity_untuck_flag dispQuantityUntuckFlag, " +
                    "     o.disp_pack_untuck_flag dispPackUntuckFlag " +
                    "        FROM " +
                    "   wlyy_doctor_mapping h, " +
                    "   zy_iv_org_physic_allot_dict o " +
                    "  WHERE " +
                    "   o.org_code = h.jw_doctor_hospital " +
                    "   AND h.doctor_code = ? " +
                    "   AND o.physic_code = ? " ;
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql,doctor,code);
        return list;
    }
    /**
     * 获取药品字典
@ -208,6 +229,8 @@ public class ZyDictService {
                " yp.quantity_unit drugNumUnit, " +
                " com2.`name` drugNumUnitName, " +
                " yp.retail_price retailPrice, " +
                " yp.dispQuantityUntuckFlag, " +
                " yp.dispPackUntuckFlag, " +
                " yp.storage_conditions storageConditions" +
                " FROM " +
                " (SELECT code,name FROM zy_common_dict WHERE dict_name = 'IV_MEASURE_UNIT_DICT') com1, " +
@ -226,12 +249,16 @@ public class ZyDictService {
                "   p.min_dose, " +
                "   p.pack_spec," +
                "   p.retail_price," +
                "   ho.dispQuantityUntuckFlag, " +
                "   ho.dispPackUntuckFlag, " +
                "   p.storage_conditions" +
                "    FROM  " +
                "   zy_iv_physic_dict p, " +
                "  ( " +
                "    SELECT " +
                "     o.physic_code, " +
                "     o.disp_quantity_untuck_flag dispQuantityUntuckFlag, " +
                "     o.disp_pack_untuck_flag dispPackUntuckFlag, " +
                "     o.org_code " +
                "        FROM " +
                "   wlyy_doctor_mapping h, " +

+ 3 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/MessageType.java

@ -131,7 +131,7 @@ public class MessageType {
	// 患者申请取消家庭签约消息
	public static enum MESSAGE_TYPE_DOCTOR_SIGN_WEB_RELIEVE {
		D_SW_02, 家庭签约, 患者申请解除家庭签约
		D_SW_02, 家庭签约, 患者取消家庭签约
	};
	// 医生申请取消家庭签约患者同意消息
@ -177,4 +177,6 @@ public class MessageType {
		D_P_WRD, 续方消息, 待取药
	}
}

+ 20 - 20
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/WechatController.java

@ -188,7 +188,7 @@ public class WechatController extends WeixinBaseController {
    @ResponseBody
    public String regist(@RequestParam(value = "name", required = true) String name,
                         @RequestParam(value = "idcard", required = true) String idcard,
                         @RequestParam(value = "ssc", required = true) String ssc,
                         @RequestParam(value = "ssc", required = false) String ssc,
                         @RequestParam(value = "mobile", required = true) String mobile,
                         @RequestParam(value = "captcha", required = true) String captcha,
                         @RequestParam(value = "openid", required = true) String openid,
@ -200,9 +200,9 @@ public class WechatController extends WeixinBaseController {
            if (StringUtils.isEmpty(idcard)) {
                return error(-1, "身份证号不允许为空!");
            }
            if (StringUtils.isEmpty(ssc)) {
                return error(-1, "社保卡号不允许为空!");
            }
//            if (StringUtils.isEmpty(ssc)) {
//                return error(-1, "社保卡号不允许为空!");
//            }
            if (StringUtils.isEmpty(mobile)) {
                return error(-1, "手机号不允许为空!");
            }
@ -241,22 +241,22 @@ public class WechatController extends WeixinBaseController {
                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月份之后办理的医保卡注册");
            }
//            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);

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

@ -24,7 +24,6 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.endpoint.jmx.DataEndpointMBean;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
@ -473,7 +472,7 @@ public class PrescriptionInfoController extends BaseController {
    @ApiOperation(value = "测试适配器")
    public String testAdapter(@RequestParam(required = true) @ApiParam(value = "字符串", name = "json") String json) {
        try {
            return write(200, "操作成功!", "data", adapter.modeTopresInfo(json));
            return write(200, "操作成功!", "data", adapter.modeTopresInfo(json,""));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
@ -589,7 +588,7 @@ public class PrescriptionInfoController extends BaseController {
    @ApiOperation(value = "获取药品信息")
    public String getPhysicInfo(@RequestParam(required = true) @ApiParam(name = "code", value = "药品code") String code) {
        try {
            return write(200, "查询成功!", "data", prescriptionInfoService.getPhysicInfo(code));
            return write(200, "查询成功!", "data", prescriptionInfoService.getPhysicInfo(code,getUID()));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");

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

@ -20,6 +20,7 @@ import com.yihu.wlyy.util.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
@ -261,15 +262,19 @@ public class DoctorFamilyContractController extends WeixinBaseController {
                for (int i = 0; i < jsonArray.length(); i++) {
                    JSONObject json = jsonArray.getJSONObject(i);
                    Map info = new HashMap();
                    String code = json.getString("code");
                    String name = json.getString("name");
                    info.put("code", code);
                    info.put("name", name);
                    info.put("patient", json.getString("code").toString());
                    info.put("name", json.getString("name").toString());
                    info.put("photo",json.getString("photo").toString());
                    info.put("age",json.getInt("age"));
                    info.put("sex",json.getString("sex").toString());
                    info.put("hasopenid",json.getString("hasopenid").toString());
                    codes.add(info);
                }
                int length = codes.size();
                map.put("label", labelName);
                map.put("codes", codes);
                map.put("ps", codes);
                map.put("number", length);
                listNum.add(map);
                count += length;
@ -281,16 +286,20 @@ public class DoctorFamilyContractController extends WeixinBaseController {
                for (int i = 0; i < noGroup.length(); i++) {
                    JSONObject json = noGroup.getJSONObject(i);
                    Map info = new HashMap();
                    String code = json.getString("code");
                    String name = json.getString("name");
                    info.put("code", code);
                    info.put("name", name);
                    info.put("patient", json.getString("code").toString());
                    info.put("name", json.getString("name").toString());
                    info.put("photo",json.getString("photo").toString());
                    info.put("age",json.getInt("age"));
                    info.put("sex",json.getString("sex").toString());
                    info.put("hasopenid",json.getString("hasopenid").toString());
                    codes.add(info);
                }
                Map map = new HashMap();
                int size = noGroup.length();
                map.put("label", "未标注");
                map.put("codes", codes);
                map.put("ps", codes);
                map.put("number", size);
                listNum.add(map);
                count += size;
@ -301,6 +310,7 @@ public class DoctorFamilyContractController extends WeixinBaseController {
            map.put("patients", listNum);
            return write(200, "查询成功", "data", map);
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
@ -722,6 +732,22 @@ public class DoctorFamilyContractController extends WeixinBaseController {
        }
    }
    /**
     * 查询患者相关的签约消息
     *
     * @return
     */
    @RequestMapping(value = "getSignMessages")
    @ResponseBody
    public String getSignMessages(long id, int pagesize) {
        try {
            return write(200, "获取消息列表成功!", "list", familyContractService.findSignMesByDoctor(getUID(), id, pagesize));
        } catch (Exception e) {
            error(e);
            return error(-1, "获取消息列表失败!");
        }
    }
    public static void main(String[] args) {
        String idcard = "350628198711215041";
        IdcardInfoExtractor ie = new IdcardInfoExtractor(idcard);
@ -933,6 +959,81 @@ public class DoctorFamilyContractController extends WeixinBaseController {
        }
    }
    /**
     * 查询待签约患者数据
     *
     * @param patient
     * @return
     */
    @RequestMapping(value = "/patient_cancel_signing")
    @ResponseBody
    public String getSigningPatientInfo(@RequestParam String patient,@RequestParam String signCode) {
        try {
            Patient temp = patientInfoService.findByCode(patient);
            if (temp != null) {
                JSONObject json = new JSONObject();
                // 设置患者标识
                json.put("code", temp.getCode());
                // 设置患者姓名
                json.put("name", temp.getName());
                // 设置患者头像
                json.put("photo", temp.getPhoto());
                // 设置患者年龄
                json.put("age", DateUtil.getAgeByBirthday(temp.getBirthday()));
                // 设置患者性别
                json.put("sex", temp.getSex());
                // 设置患者病情:0绿标,1黄标,2红标
                json.put("diseaseLevel", temp.getDiseaseCondition());
                // 设置患者身份证号
                json.put("idCard", temp.getIdcard());
                //1.4.2 医疗保险号
                json.put("medicareNumber", temp.getMedicareNumber()==null?"":temp.getMedicareNumber());
                // 设置患者出生年月
                json.put("birthday", DateUtil.dateToStr(temp.getBirthday(), DateUtil.YYYY_MM_DD));
                // 设置患者手机号码
                json.put("mobile", temp.getMobile());
                // 设置患者联系电话
                json.put("phone", temp.getPhone());
                // 设置患者居住省份
                json.put("provinceName", temp.getProvinceName());
                json.put("cityName", temp.getCityName());
                json.put("townName", temp.getTownName());
                json.put("streetName", temp.getStreetName());
                // 设置患者地址
                json.put("address", temp.getAddress());
                //设置患者医保号
                json.put("ssc", temp.getSsc());
                String diseases = redisTemplate.opsForValue().get("disease:" + patient);
                if (!StringUtils.isEmpty(diseases)) {
                    json.put("diseases", new JSONArray(diseases));
                } else {
                    json.put("diseases", "");
                }
                SignFamily jtSign = familyContractService.findSignFamilyByCode(signCode);
                // 家庭签约
                if (jtSign != null) {
                    json.put("applySurrDate", jtSign.getPatientApplyUnsignDate());
                    json.put("applyDate", jtSign.getPatientApplyDate());
                    json.put("jtSign", new JSONObject(jtSign));
                }
                json.put("countryCode", temp.getSickVillage() == null ? "" : temp.getSickVillage());
                json.put("countryName", temp.getSickVillageName() == null ? "" : temp.getSickVillageName());
                return write(200, "患者信息查询成功!", "data", json);
            } else {
                return error(-1, "患者信息查询失败!");
            }
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "患者信息查询失败");
        }
    }
    /**
     * 查询最近签约过期患者数据
     *
@ -1208,16 +1309,20 @@ public class DoctorFamilyContractController extends WeixinBaseController {
                    JSONArray jsonArray = list.getJSONArray(label.getLabelName());
                    List codes = new ArrayList();
                    for (Object patient : jsonArray) {
                        Map tempmap = new HashMap();
                        JSONObject jsonObject = new JSONObject(patient.toString());
                        String code = jsonObject.get("code").toString();
                        tempmap.put("code", code);
                        codes.add(tempmap);
                        Map<String,Object> p = new HashedMap();
                        p.put("patient",jsonObject.get("code").toString());
                        p.put("name",jsonObject.get("name").toString());
                        p.put("sex",jsonObject.get("sex").toString());
                        p.put("age",jsonObject.get("age").toString());
                        p.put("photo",jsonObject.get("photo").toString());
                        p.put("hasopenid",jsonObject.get("hasopenid").toString());
                        codes.add(p);
                    }
                    int length = jsonArray.length();
                    map.put("label", labelName);
                    map.put("number", length);
                    map.put("codes", codes);
                    map.put("ps", codes);
                    listNum.add(map);
                }
@ -1225,16 +1330,20 @@ public class DoctorFamilyContractController extends WeixinBaseController {
                    JSONArray jsonArray = list.getJSONArray("未标注");
                    List codes = new ArrayList();
                    for (Object patient : jsonArray) {
                        Map tempmap = new HashMap();
                        JSONObject jsonObject = new JSONObject(patient.toString());
                        String code = jsonObject.get("code").toString();
                        tempmap.put("code", code);
                        codes.add(tempmap);
                        Map<String,Object> p = new HashedMap();
                        p.put("patient",jsonObject.get("code").toString());
                        p.put("name",jsonObject.get("name").toString());
                        p.put("sex",jsonObject.get("sex").toString());
                        p.put("age",jsonObject.get("age").toString());
                        p.put("photo",jsonObject.get("photo").toString());
                        p.put("hasopenid",jsonObject.get("hasopenid").toString());
                        codes.add(p);
                    }
                    Map map = new HashMap();
                    map.put("label", "未标注");
                    map.put("number", jsonArray.length());
                    map.put("codes", codes);
                    map.put("ps", codes);
                    listNum.add(map);
                }
            } else {
@ -1244,12 +1353,17 @@ public class DoctorFamilyContractController extends WeixinBaseController {
                    map.put("label", "孕产妇");
                    List temp = new ArrayList();
                    for (Object str : jsonArray) {
                        Map tempmap = new HashMap();
                        Object code = new JSONObject(str.toString()).get("code");
                        tempmap.put("code", code);
                        temp.add(tempmap);
                        JSONObject jsonObject = new JSONObject(str.toString());
                        Map<String,Object> p = new HashedMap();
                        p.put("patient",jsonObject.get("code").toString());
                        p.put("name",jsonObject.get("name").toString());
                        p.put("sex",jsonObject.get("sex").toString());
                        p.put("age",jsonObject.get("age").toString());
                        p.put("photo",jsonObject.get("photo").toString());
                        p.put("hasopenid",jsonObject.get("hasopenid").toString());
                        temp.add(p);
                    }
                    map.put("codes", temp);
                    map.put("ps", temp);
                    map.put("number", jsonArray.length());
                    listNum.add(map);
                }
@ -1259,12 +1373,17 @@ public class DoctorFamilyContractController extends WeixinBaseController {
                    map1.put("label", "未标注");
                    List temp1 = new ArrayList();
                    for (Object str : jsonArray1) {
                        Map tempmap = new HashMap();
                        Object code = new JSONObject(str.toString()).get("code");
                        tempmap.put("code", code);
                        temp1.add(tempmap);
                        JSONObject jsonObject = new JSONObject(str.toString());
                        Map<String,Object> p = new HashedMap();
                        p.put("patient",jsonObject.get("code").toString());
                        p.put("name",jsonObject.get("name").toString());
                        p.put("sex",jsonObject.get("sex").toString());
                        p.put("age",jsonObject.get("age").toString());
                        p.put("photo",jsonObject.get("photo").toString());
                        p.put("hasopenid",jsonObject.get("hasopenid").toString());
                        temp1.add(p);
                    }
                    map1.put("codes", temp1);
                    map1.put("ps", temp1);
                    map1.put("number", jsonArray1.length());
                    listNum.add(map1);
                }
@ -1274,12 +1393,17 @@ public class DoctorFamilyContractController extends WeixinBaseController {
                    map2.put("label", "儿童");
                    List temp2 = new ArrayList();
                    for (Object str : jsonArray2) {
                        Map tempmap = new HashMap();
                        Object code = new JSONObject(str.toString()).get("code");
                        tempmap.put("code", code);
                        temp2.add(tempmap);
                        JSONObject jsonObject = new JSONObject(str.toString());
                        Map<String,Object> p = new HashedMap();
                        p.put("patient",jsonObject.get("code").toString());
                        p.put("name",jsonObject.get("name").toString());
                        p.put("sex",jsonObject.get("sex").toString());
                        p.put("age",jsonObject.get("age").toString());
                        p.put("photo",jsonObject.get("photo").toString());
                        p.put("hasopenid",jsonObject.get("hasopenid").toString());
                        temp2.add(p);
                    }
                    map2.put("codes", temp2);
                    map2.put("ps", temp2);
                    map2.put("number", jsonArray2.length());
                    listNum.add(map2);
                }
@ -1680,4 +1804,15 @@ public class DoctorFamilyContractController extends WeixinBaseController {
            return error(-1, "查询失败");
        }
    }
    @RequestMapping(value = "/setMessageRead")
    @ResponseBody
    public String setMessageRead(@RequestParam(required = true)Long messid){
        try {
            return write(200, "查询成功", "data", messageService.setMessageRead(messid));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/ConsultController.java

@ -1219,7 +1219,7 @@ public class ConsultController extends WeixinBaseController {
            if(messageService.getMessageNoticeSettingByMessageType(doctor,"1",MessageNoticeSetting.MessageTypeEnum.prescriptionSwitch.getValue())){
                // 推送消息给医生
                pushMsgTask.put(doctor, MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.D_CT_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_FAMOUS_CONSULT_TEAM_PRESCRIPTION.续方咨询.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_FAMOUS_CONSULT_TEAM_PRESCRIPTION.您有新的续方咨询.name(), consult.getConsult());
                pushMsgTask.put(doctor, MessageType.MESSAGE_TYPE_DOCTOR_NEW_FAMOUS_CONSULT_TEAM_PRESCRIPTION.D_CT_05.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_FAMOUS_CONSULT_TEAM_PRESCRIPTION.续方咨询.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_FAMOUS_CONSULT_TEAM_PRESCRIPTION.您有新的续方咨询.name(), consult.getConsult());
                try {
                    //            新增发送医生助手模板消息 v1.4.0 by wujunjie
                    Doctor doctor1 = doctorDao.findByCode(doctor);

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionInfoController.java

@ -66,7 +66,7 @@ public class PatientPrescriptionInfoController extends BaseController {
                                      @RequestParam(required = false)@ApiParam(name="size",value="每页记录数")Integer size){
        try {
//            com.alibaba.fastjson.JSONObject json = prescriptionInfoService.getRecipeMasterList("ec7572875d27446cb4f067b13a85d72a",startDate,endDate,isRenewal,diagnosisCode,page,size);
            com.alibaba.fastjson.JSONObject json = prescriptionInfoService.getRecipeMasterList(getRepUID(),"2017-12-01","2018-01-01",isRenewal,diagnosisCode,page,size);
            com.alibaba.fastjson.JSONObject json = prescriptionInfoService.getRecipeMasterList(getRepUID(),startDate,endDate,isRenewal,diagnosisCode,page,size);
            return write(200, "查询成功!", "data",json);
        }catch (Exception e){
            error(e);

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

@ -16,9 +16,9 @@ spring:
      password: jkzlehr@123
  redis:
     host: 27.155.101.77 # Redis server host.
     port: 6380 # Redis server port.
     password: jkzl_ehr
     host: 59.61.92.90 # Redis server host.
     port: 9054  # Redis server port.
     password: jkzlehr
server:
  server_url: http://www.xmtyw.cn/wlyy/