瀏覽代碼

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

yeshijie 7 年之前
父節點
當前提交
0209ea5430
共有 25 個文件被更改,包括 2536 次插入101 次删除
  1. 2 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/config/SpringSecurityConfig.java
  2. 147 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/datastatic/PrescriptionStaticController.java
  3. 86 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/device/WlyyDeviceController.java
  4. 767 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/prescription/Prescription.java
  5. 323 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/prescription/PrescriptionInfo.java
  6. 101 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/prescription/PrescriptionVO.java
  7. 35 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionDao.java
  8. 22 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/device/WlyyDeviceService.java
  9. 1 1
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/user/UserService.java
  10. 197 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/prescription/PrescriptionService.java
  11. 16 3
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/device/device_list.jsp
  12. 30 0
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/device/device_list_js.jsp
  13. 28 0
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/main.jsp
  14. 65 0
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/prescription/prescription_list.jsp
  15. 459 0
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/prescription/prescription_list_js.jsp
  16. 4 0
      patient-co-manage/wlyy-manage/src/main/webapp/static/js/menu.js
  17. 31 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/PatientInfoService.java
  18. 20 21
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/express/SFExpressService.java
  19. 146 41
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelInfoService.java
  20. 23 22
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/physicalExamination/PhysicalExaminationRemindService.java
  21. 3 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java
  22. 3 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/PatientService.java
  23. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/consult/DoctorConsultMoviController.java
  24. 23 9
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/DoctorPatientGroupController.java
  25. 3 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/PatientInfoController.java

+ 2 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/config/SpringSecurityConfig.java

@ -35,6 +35,8 @@ public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
                "/admin/team/importData",
                "/admin/hos/importData",
                "/admin/hos/doctor/toExcel",
                "/admin/device/toExcel",
                "/admin/static/prescription/toExcel",
                "/admin/basedata/importData",
                "/admin/wlyyUserRole/importData",
                "/WEB—INF/views/**"

+ 147 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/datastatic/PrescriptionStaticController.java

@ -0,0 +1,147 @@
package com.yihu.wlyy.controller.manager.datastatic;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.device.entity.WlyyDevice;
import com.yihu.wlyy.entity.SignFamily;
import com.yihu.wlyy.entity.prescription.Prescription;
import com.yihu.wlyy.entity.prescription.PrescriptionVO;
import com.yihu.wlyy.service.prescription.PrescriptionService;
import jxl.Workbook;
import jxl.write.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
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.ResponseBody;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
/**
 * 长处方统计
 * @author huangwenjie
 * @date 2017/12/8 08:54
 */
@Controller
@RequestMapping(value="/admin/static/prescription")
public class PrescriptionStaticController extends BaseController {
	
	@Autowired
	private PrescriptionService prescriptionService;
	
	//长处方统计管理*******************************
	@RequestMapping(value = "initial", method = RequestMethod.GET)
	public String listInit(){
		return "prescription/prescription_list";
	}
	
	@RequestMapping(value = "list")
	@ResponseBody
	public String searchPatientList(
			@RequestParam(value = "town",required = false)String town,
			@RequestParam(value = "hospital",required = false)String hospital,
			@RequestParam(value = "disease",required = false)String disease,
			@RequestParam(value = "dispensarytype",required = false)String dispensarytype,
			@RequestParam(value = "status",required = false)String status,
			@RequestParam(value = "beginDate",required = false)String beginDate,
			@RequestParam(value = "endDate",required = false)String endDate,
			@RequestParam(value = "page",required = true)Integer page,
			@RequestParam(value = "rows",required = true)Integer pageSize
	){
		try {
			List<PrescriptionVO> datalist = prescriptionService.getPrescriptionList(hospital,disease,dispensarytype,status,beginDate,endDate,page,pageSize,true);
			Long totalcount = prescriptionService.getPrescriptionListCount(hospital,disease,dispensarytype,status,beginDate,endDate);
			return write(200,"操作成功",page,pageSize,totalcount,datalist);
		}catch (Exception ex){
			error(ex);
			return error(-1, "操作失败!");
		}
	}
	
	//导出设备报表
	@RequestMapping(value="toExcel",method = RequestMethod.POST,produces = "application/json;charset=UTF-8" )
	public void exportList(
			@RequestParam(value = "town",required = false)String town,
			@RequestParam(value = "hospital",required = false)String hospital,
			@RequestParam(value = "disease",required = false)String disease,
			@RequestParam(value = "dispensarytype",required = false)String dispensarytype,
			@RequestParam(value = "status",required = false)String status,
			@RequestParam(value = "beginDate",required = false)String beginDate,
			@RequestParam(value = "endDate",required = false)String endDate,
			HttpServletResponse response){
		try {
			ObjectMapper objectMapper = new ObjectMapper();
			JavaType javaType = objectMapper.getTypeFactory().constructParametricType(ArrayList.class, WlyyDevice.class);
			List<PrescriptionVO> datalist = prescriptionService.getPrescriptionList(hospital,disease,dispensarytype,status,beginDate,endDate,0,0,false);
			response.setContentType("octets/stream");
			response.setHeader("Content-Disposition", "attachment; filename="+ new String( "prescriptionDataList.xls"));
			OutputStream os = response.getOutputStream();
			this.write(os,datalist);
		}catch (Exception ex){
			error(ex);
		}
	}
	
	
	public void addHeader(WritableSheet ws) throws WriteException {
		String[] header = {"姓名","身份证","电话","社区", "申请时间","开方医生", "诊断", "取药方式", "状态","更新时间"};
		int i = 0;
		for (String h : header) {
			addCell(ws, 0, i, h);//表名,行,列,header
			i++;
		}
	}
	
	public void write(WritableWorkbook wwb, List ls) throws Exception {
		try {
			WritableSheet ws;
			ws = wwb.createSheet("sheet",1);
			addHeader(ws);
			int i = 1;
			for (PrescriptionVO m : (List<PrescriptionVO>) ls) {
				addCell(ws, i, 0, m.getPatient_name()+"","");
				addCell(ws, i, 1, m.getIdcard(),"");
				addCell(ws, i, 2, m.getMobile(),"");
				addCell(ws, i, 3, m.getHospital_name(),"");
				addCell(ws, i, 4, m.getCreate_time(),"");
				addCell(ws, i, 5, m.getDoctor_name(),"");
				addCell(ws, i, 6, m.getHealth_problem_name(),"");
				addCell(ws, i, 7, m.getPay(),"");
				addCell(ws, i, 8, m.getStatusName(),"");
				addCell(ws, i, 9, m.getCreate_time(),"");
				i++;
			}
			wwb.write();
			wwb.close();
		} catch (IOException e) {
			e.printStackTrace();
			if (wwb != null) wwb.close();
			throw e;
		}
	}
	public void write(OutputStream os, List ls) throws Exception{
		write(Workbook.createWorkbook(os), ls);
	}
	//添加单元格内容
	public void addCell(WritableSheet ws, int row, int column,  String data) throws WriteException {
		Label label = new Label(column ,row, data);
		ws.addCell(label);
	}
	//添加单元格内容
	public void addCell(WritableSheet ws, int row, int column, String data, String memo) throws WriteException {
		Label label = new Label(column ,row, data);
		if(!org.springframework.util.StringUtils.isEmpty(memo)){
			WritableCellFeatures cellFeatures = new WritableCellFeatures();
			cellFeatures.setComment(memo);
			label.setCellFeatures(cellFeatures);
		}
		ws.addCell(label);
	}
}

+ 86 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/device/WlyyDeviceController.java

@ -1,9 +1,12 @@
package com.yihu.wlyy.controller.manager.device;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.device.entity.WlyyDevice;
import com.yihu.wlyy.service.manager.device.WlyyDeviceService;
import jxl.Workbook;
import jxl.write.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
@ -12,6 +15,12 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
/**
 * Created by yww on 2016/12/2.
 * 设备管理
@ -131,4 +140,81 @@ public class WlyyDeviceController extends BaseController {
    public String isCodeExist(String deviceCode) {
        return deviceService.existDeviceCode(deviceCode);
    }
    
    
    //导出设备报表
    @RequestMapping(value="toExcel",method = RequestMethod.POST,produces = "application/json;charset=UTF-8" )
    public void exportList(
            @RequestParam(value = "deviceName",required = false)String deviceName,
            @RequestParam(value = "deviceCode",required = false) String deviceCode,
            @RequestParam(value = "orgName",required = false)String orgName,
            @RequestParam(value = "linkman",required = false) String linkman,
            HttpServletResponse response){
        try {
            ObjectMapper objectMapper = new ObjectMapper();
            JavaType javaType = objectMapper.getTypeFactory().constructParametricType(ArrayList.class, WlyyDevice.class);
            List<WlyyDevice> wlyyDevices = deviceService.exporthDeviceList(deviceName,deviceCode,orgName,linkman);
            response.setContentType("octets/stream");
            response.setHeader("Content-Disposition", "attachment; filename="+ new String( "deviceDataList.xls"));
            OutputStream os = response.getOutputStream();
            this.write(os,wlyyDevices);
        }catch (Exception ex){
            error(ex);
        }
    }
    
    public void addHeader(WritableSheet ws) throws WriteException {
        
        String[] header = {"ID","设备名称","型号","SN码", "SIM卡号","机构名称", "联系人", "联系电话", "厂家名称"};
        int i = 0;
        for (String h : header) {
            addCell(ws, 0, i, h);//表名,行,列,header
            i++;
        }
    }
    
    public void write(WritableWorkbook wwb, List ls) throws Exception {
        try {
            WritableSheet ws;
            ws = wwb.createSheet("sheet",1);
            addHeader(ws);
            int i = 1;
            for (WlyyDevice m : (List<WlyyDevice>) ls) {
                addCell(ws, i, 0, m.getId()+"","");
                addCell(ws, i, 1, m.getDeviceName(),"");
                addCell(ws, i, 2, m.getDeviceModel(),"");
                addCell(ws, i, 3, m.getDeviceCode(),"");
                addCell(ws, i, 4, m.getSim()+"","");
                addCell(ws, i, 5, m.getOrgName(),"");
                addCell(ws, i, 6, m.getLinkman(),"");
                addCell(ws, i, 7, m.getTel(),"");
                addCell(ws, i, 8, m.getManufacturer(),"");
                i++;
            }
            wwb.write();
            wwb.close();
        } catch (IOException e) {
            e.printStackTrace();
            if (wwb != null) wwb.close();
            throw e;
        }
    }
    public void write(OutputStream os, List ls) throws Exception{
        write(Workbook.createWorkbook(os), ls);
    }
    //添加单元格内容
    public void addCell(WritableSheet ws, int row, int column,  String data) throws WriteException {
        Label label = new Label(column ,row, data);
        ws.addCell(label);
    }
    //添加单元格内容
    public void addCell(WritableSheet ws, int row, int column, String data, String memo) throws WriteException {
        Label label = new Label(column ,row, data);
        if(!org.springframework.util.StringUtils.isEmpty(memo)){
            WritableCellFeatures cellFeatures = new WritableCellFeatures();
            cellFeatures.setComment(memo);
            label.setCellFeatures(cellFeatures);
        }
        ws.addCell(label);
    }
}

+ 767 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/prescription/Prescription.java

@ -0,0 +1,767 @@
package com.yihu.wlyy.entity.prescription;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.entity.IdEntity;
import org.springframework.util.StringUtils;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
import java.util.List;
/**
 * Created by Administrator on 2017/7/21.
 * 处方
 */
@Entity
@Table(name = "wlyy_prescription")
public class Prescription extends IdEntity {
    private String code;                    //业务主键
    private String jwCode;                  //基卫的历史处方code
    private String visitNo;                  //基卫的挂号code(调用基位开方接口后回调给我们后才有值)
    private String recipeNo;                  //基卫的处方code(调用基位开方接口后回调给我们后才有值)
    private String parentCode;             //如果是续方 那就是处方的code
    private Date createTime;               //处方创建时间
    private Date reviewedTime;             //审核时间
    private Date payTime;                   //支付时间
    private Date failTime;                  //基位 开方失败时间
    private String failReason;                  //基位 开方失败原因
    private Date dosageTime;                //配药完成时间
    private Date dispatchingTime;          //配送员领药时间
    private Date expressageTime;            //配送员到服务站的时间
    private Date finishTime;                //配送员确认送达或居民确认取药的时间
    private String patient;                  //关联 wlyy_patient code
    private String patientName;             //患者名称
    private String ssc;//社保卡号
    private Integer type;                    //1 处方 2 续方
    private Integer status;                  //(-5线下取消 -4线下退费 -3 支付过期 -2 患者自己取消 )续方取消,-1 审核不通过 ,
    // (0 待审核, 2调整中,3调整成功, 4调整失败 ,10 医生审核(CA)通过)审核中,
    // 20药师审核中,21.药师审核失败,30 开方中/药师审核成功,31.开方失败/预结算失败,
    // (40开方完成/待支付 ,41 支付失败 )待支付,  50 支付成功/待配药,(60配药成功/待配送)等待领药,
    // (61配送失败62分配健管师 65配送中,69配送到服务站)配送中,(100配送到患者手中/已完成)已完成',
    private String doctor;                   //开处方的医生code 关联 wlyy_doctor
    private String doctorName;               //医生名称
    private Long adminTeamId;             //患者签约的行政团队
    private String hospital;                  //医院 关联 dm_hospital code
    private String hospitalName;              //医院 关联 dm_hospital name
    private String dept;                       //科室code
    private String deptName;                   //科室名称
    private String diagnosisCode;             //诊断的病种code
    private String diagnosis;                  //诊断名称
    private String consult;                    //咨询id 1对1
    //    private String dispensary_code;           //取药编码  关联wlyy_prescription_dispensary_code  code
//    private String dispensaryAddress;         //取药地址
    private Integer dispensaryType;            //取药类型:1 自取 2快递配送 3健管师配送
    private String caCertData;                  //ca加密信息(签名证书主题数据)
    //    private String expressNum;                  //快递单号
//    private String expressCompanyName;         //快递公司名称
    private String caMessage;                   //ca指纹信息(签名值)
    private String remark;                     //处方备注
    private String reason;                      //续方原因
    //    private Double ybCost;                      //医保费用
//    private Double myCost;                      //自己付费
    private Integer prescriptionType;          //处方类型:1、门诊处方,2、住院处方
    private String cancelReason;
    private String adjustReason;
    private String statusName; //
    private String digitalSignNo;//CA数字签名唯一流水号
    private String originalDataAbstract;//原文的MD5摘要
    private String strOriginalData; //CA原文数据
    private List<PrescriptionInfo> prescriptionInfo;
    private String reviewedState;
    private String jwDeptCode;  //基卫-开处方的科室编码
    private String jwHospital;  //基卫-开处方的医院编码
    private String jwDoctorCode; //基卫-开方医生的编码
    private String jwGisterTypeCode;//基卫-挂号类型编码
    private String jwRateTypeCode;//基卫-费别类型编码
    private String jwRegisterFee; //基卫-诊金
    private String prescribeReason; //开方失败/成功原因
    private Date prescribeTime;//开方失败、成功时间
    //用于药品用药情况排序
    private Integer minDrugDay; //药品最小用药天数
    private Date presCreateTime; //处方建立时间
    private String dispensaryTypeName; //类型翻译
    private Integer jwPayStatus;//处方结算状态,0为未结算,1为结算成功,默认为0
    private Integer zyCancelState; //智业同步取消表示:0 位同步取消 1已经同步取消
    //1.4.0新增字段
    private Integer drugDeliveryFlag;   //是否异常出药0为正常 1为异常
    private String drugDeliveryReasonCode; //原因字典对应Code
    private String drugDeliveryReasonValue; //原因字典对应Name
    private String drugDeliveryReason; //详细原因
    private String drugDeliveryOperator; //操作人员code
    private String drugDeliveryOperatorName; //操作人员名字
    private Date drugDeliveryTime; //异常出药时间
    @Column(name = "code", unique = true, nullable = false)
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "parent_code")
    public String getParentCode() {
        return parentCode;
    }
    public void setParentCode(String parentCode) {
        this.parentCode = parentCode;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "reviewed_time")
    public Date getReviewedTime() {
        return reviewedTime;
    }
    public void setReviewedTime(Date reviewedTime) {
        this.reviewedTime = reviewedTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "pay_time")
    public Date getPayTime() {
        return payTime;
    }
    public void setPayTime(Date payTime) {
        this.payTime = payTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "dosage_time")
    public Date getDosageTime() {
        return dosageTime;
    }
    public void setDosageTime(Date dosageTime) {
        this.dosageTime = dosageTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "dispatching_time")
    public Date getDispatchingTime() {
        return dispatchingTime;
    }
    public void setDispatchingTime(Date dispatchingTime) {
        this.dispatchingTime = dispatchingTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "finish_time")
    public Date getFinishTime() {
        return finishTime;
    }
    public void setFinishTime(Date finishTime) {
        this.finishTime = finishTime;
    }
    @Column(name = "patient")
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    @Column(name = "patient_name")
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    @Column(name = "type")
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    @Column(name = "status")
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    @Column(name = "doctor")
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    @Column(name = "doctor_name")
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    @Column(name = "admin_team_id")
    public Long getAdminTeamId() {
        return adminTeamId;
    }
    public void setAdminTeamId(Long adminTeamId) {
        this.adminTeamId = adminTeamId;
    }
    @Column(name = "hospital")
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    @Column(name = "hospital_name")
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
    @Column(name = "dept")
    public String getDept() {
        return dept;
    }
    public void setDept(String dept) {
        this.dept = dept;
    }
    @Column(name = "dept_name")
    public String getDeptName() {
        return deptName;
    }
    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }
    @Column(name = "diagnosis_code")
    public String getDiagnosisCode() {
        return diagnosisCode;
    }
    public void setDiagnosisCode(String diagnosisCode) {
        this.diagnosisCode = diagnosisCode;
    }
    @Column(name = "diagnosis")
    public String getDiagnosis() {
        return diagnosis;
    }
    public void setDiagnosis(String diagnosis) {
        this.diagnosis = diagnosis;
    }
    @Column(name = "consult")
    public String getConsult() {
        return consult;
    }
    public void setConsult(String consult) {
        this.consult = consult;
    }
    @Column(name = "remark")
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    @Column(name = "dispensary_type")
    public Integer getDispensaryType() {
        return dispensaryType;
    }
    public void setDispensaryType(Integer dispensaryType) {
        this.dispensaryType = dispensaryType;
    }
    @Column(name = "ca_message")
    public String getCaMessage() {
        return caMessage;
    }
    public void setCaMessage(String caMessage) {
        this.caMessage = caMessage;
    }
    public String getJwCode() {
        return jwCode;
    }
    public void setJwCode(String jwCode) {
        this.jwCode = jwCode;
    }
    public String getReason() {
        return reason;
    }
    public void setReason(String reason) {
        this.reason = reason;
    }
    public String getCaCertData() {
        return caCertData;
    }
    public void setCaCertData(String caCertData) {
        this.caCertData = caCertData;
    }
    public Integer getPrescriptionType() {
        return prescriptionType;
    }
    public void setPrescriptionType(Integer prescriptionType) {
        this.prescriptionType = prescriptionType;
    }
    @Transient
    public String getStatusName() {
        return statusName;
    }
    public void setStatusName(String statusName) {
        this.statusName = getStatusName(status, null, null);
    }
    public Date getExpressageTime() {
        return expressageTime;
    }
    public void setExpressageTime(Date expressageTime) {
        this.expressageTime = expressageTime;
    }
    @Transient
    public static String getStatusName(Integer status, String hospitalName, String userName) {
        /**
         *  no_reviewed("审核不通过", -1),
         revieweding("待审核", 0),
         changeing("调整中",2),
         reviewed_success("审核通过/开方中", 10),
         wait_pay("开方完成/待支付", 20),
         pay_error("支付失败", 21),
         wait_expressage("配药成功/待配送", 40),
         expressageing_error("配送失败", 41),
         expressageJGS("分配健管师", 42),
         expressageing("配送中", 45),
         pay_success("支付成功/待配药", 50),
         expressage2hospital("配送到服务站", 49),
         finish("配送到患者手中/已完成", 100);
         */
        //-1 审核不通过 , 0 审核中, 10 审核通过/待支付 ,21支付失败  20 配药中/支付成功, 21 等待领药 ,30 配送中 ,100配送成功/已完成
        switch (status) {
            case -3: {
                return "支付超时";
            }
            case -2: {
                return "患者自己取消";
            }
            case -1: {
                return "审核不通过";
            }
            case 0: {
                return "待审核";
            }
            case 2: {
                return "调整处方中";
            }
            case 3: {
                return "调整成功";
            }
            case 4: {
                return "调整失败";
            }
            case 21: {
                return "药师审核失败";
            }
            case 31: {
                return "开方失败";
            }
            case 10: {
                return "开方中";
            }
            case 20: {
                return "药师审核中";
            }
            case 30: {
                return "开方中/药师审核成功";
            }
            case 40: {
                return "开方完成/待支付 ";
            }
            case 41: {
                return "支付失败";
            }
            case 50: {
                return " 订单已支付";
            }
            case 60: {
                return "配药完成";
            }
            case 61: {
                return "配送失败";
            }
            case 62: {
                return "分配健管师 ";
            }
            case 65: {
                return "配送中 ";
            }
            case 69: {
                if (StringUtils.isEmpty(hospitalName) || StringUtils.isEmpty(userName)) {
                    return "配送到服务站";
                }
                {
                    return "配送到" + hospitalName + ",接收人:" + userName;
                }
            }
            case 100: {
                if (StringUtils.isEmpty(userName)) {
                    return "续方完成";
                } else {
                    return "续方完成,确认人:" + userName;
                }
            }
        }
        return "未知";
    }
    public String getCancelReason() {
        return cancelReason;
    }
    public void setCancelReason(String cancelReason) {
        this.cancelReason = cancelReason;
    }
    public String getAdjustReason() {
        return adjustReason;
    }
    public void setAdjustReason(String adjustReason) {
        this.adjustReason = adjustReason;
    }
    public String getVisitNo() {
        return visitNo;
    }
    public void setVisitNo(String visitNo) {
        this.visitNo = visitNo;
    }
    public String getRecipeNo() {
        return recipeNo;
    }
    public void setRecipeNo(String recipeNo) {
        this.recipeNo = recipeNo;
    }
    public Date getFailTime() {
        return failTime;
    }
    public void setFailTime(Date failTime) {
        this.failTime = failTime;
    }
    public String getFailReason() {
        return failReason;
    }
    public void setFailReason(String failReason) {
        this.failReason = failReason;
    }
    public String getSsc() {
        return ssc;
    }
    public void setSsc(String ssc) {
        this.ssc = ssc;
    }
    public String getOriginalDataAbstract() {
        return originalDataAbstract;
    }
    public void setOriginalDataAbstract(String originalDataAbstract) {
        this.originalDataAbstract = originalDataAbstract;
    }
    public String getDigitalSignNo() {
        return digitalSignNo;
    }
    public void setDigitalSignNo(String digitalSignNo) {
        this.digitalSignNo = digitalSignNo;
    }
    public String getStrOriginalData() {
        return strOriginalData;
    }
    public void setStrOriginalData(String strOriginalData) {
        this.strOriginalData = strOriginalData;
    }
    @Transient
    public List<PrescriptionInfo> getPrescriptionInfo() {
        return prescriptionInfo;
    }
    public void setPrescriptionInfo(List<PrescriptionInfo> prescriptionInfo) {
        this.prescriptionInfo = prescriptionInfo;
    }
    @Transient
    public String getReviewedState() {
        return reviewedState;
    }
    public void setReviewedState(String reviewedState) {
        this.reviewedState = reviewedState;
    }
    public String getJwDeptCode() {
        return jwDeptCode;
    }
    public void setJwDeptCode(String jwDeptCode) {
        this.jwDeptCode = jwDeptCode;
    }
    public String getJwDoctorCode() {
        return jwDoctorCode;
    }
    public void setJwDoctorCode(String jwDoctorCode) {
        this.jwDoctorCode = jwDoctorCode;
    }
    public String getJwGisterTypeCode() {
        return jwGisterTypeCode;
    }
    public void setJwGisterTypeCode(String jwGisterTypeCode) {
        this.jwGisterTypeCode = jwGisterTypeCode;
    }
    public String getJwRateTypeCode() {
        return jwRateTypeCode;
    }
    public void setJwRateTypeCode(String jwRateTypeCode) {
        this.jwRateTypeCode = jwRateTypeCode;
    }
    public String getJwHospital() {
        return jwHospital;
    }
    public void setJwHospital(String jwHospital) {
        this.jwHospital = jwHospital;
    }
    public String getJwRegisterFee() {
        return jwRegisterFee;
    }
    public void setJwRegisterFee(String jwRegisterFee) {
        this.jwRegisterFee = jwRegisterFee;
    }
    @Transient
    public String getDispensaryTypeName() {
        if (dispensaryType != null) {
            switch (this.dispensaryType) {
                case 1: {
                    return "自取";
                }
                case 2: {
                    return "快递配送";
                }
                case 3: {
                    return "健管师配送";
                }
            }
        }
        return "";
    }
    public String getPrescribeReason() {
        return prescribeReason;
    }
    public void setPrescribeReason(String prescribeReason) {
        this.prescribeReason = prescribeReason;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getPrescribeTime() {
        return prescribeTime;
    }
    public void setPrescribeTime(Date prescribeTime) {
        this.prescribeTime = prescribeTime;
    }
    public void setDispensaryTypeName(String dispensaryTypeName) {
        this.dispensaryTypeName = dispensaryTypeName;
    }
    public Integer getJwPayStatus() {
        return jwPayStatus;
    }
    public void setJwPayStatus(Integer jwPayStatus) {
        this.jwPayStatus = jwPayStatus;
    }
    public Integer getMinDrugDay() {
        return minDrugDay;
    }
    public void setMinDrugDay(Integer minDrugDay) {
        this.minDrugDay = minDrugDay;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getPresCreateTime() {
        return presCreateTime;
    }
    public void setPresCreateTime(Date presCreateTime) {
        this.presCreateTime = presCreateTime;
    }
    public Integer getZyCancelState() {
        return zyCancelState;
    }
    public void setZyCancelState(Integer zyCancelState) {
        this.zyCancelState = zyCancelState;
    }
    public Integer getDrugDeliveryFlag() {
        return drugDeliveryFlag;
    }
    public void setDrugDeliveryFlag(Integer drugDeliveryFlag) {
        this.drugDeliveryFlag = drugDeliveryFlag;
    }
    public String getDrugDeliveryReasonCode() {
        return drugDeliveryReasonCode;
    }
    public void setDrugDeliveryReasonCode(String drugDeliveryReasonCode) {
        this.drugDeliveryReasonCode = drugDeliveryReasonCode;
    }
    public String getDrugDeliveryReasonValue() {
        return drugDeliveryReasonValue;
    }
    public void setDrugDeliveryReasonValue(String drugDeliveryReasonValue) {
        this.drugDeliveryReasonValue = drugDeliveryReasonValue;
    }
    public String getDrugDeliveryReason() {
        return drugDeliveryReason;
    }
    public void setDrugDeliveryReason(String drugDeliveryReason) {
        this.drugDeliveryReason = drugDeliveryReason;
    }
    public String getDrugDeliveryOperator() {
        return drugDeliveryOperator;
    }
    public void setDrugDeliveryOperator(String drugDeliveryOperator) {
        this.drugDeliveryOperator = drugDeliveryOperator;
    }
    public String getDrugDeliveryOperatorName() {
        return drugDeliveryOperatorName;
    }
    public void setDrugDeliveryOperatorName(String drugDeliveryOperatorName) {
        this.drugDeliveryOperatorName = drugDeliveryOperatorName;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getDrugDeliveryTime() {
        return drugDeliveryTime;
    }
    public void setDrugDeliveryTime(Date drugDeliveryTime) {
        this.drugDeliveryTime = drugDeliveryTime;
    }
}

+ 323 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/prescription/PrescriptionInfo.java

@ -0,0 +1,323 @@
package com.yihu.wlyy.entity.prescription;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by Administrator on 2017/7/21.
 * 处方详细
 */
@Entity
@Table(name = "wlyy_prescription_info")
public class PrescriptionInfo extends IdEntity{
    //drugRate(频率:一天用次数)*dayCount(天数)*physicDose(单次用量)
    //
    private String code;                    //业务主键
    private String prescriptionCode;      //处方code 关联表wlyy_prescription code
    private String drugCode;               //药品code
    private String drugName;               //药品名称
    private String subjectClass;               //科目类别编码
    private String drugRate;               //吃药频率
    private String drugRateName;          //用药频次名称
    private String drugFormat;             //药品规格
    private Integer num;                    //药品总量(用来计算价格)
    private Integer isRefrigerate;         //是否冷藏 1是 0否
    private String direction;               //药品用法
    private Integer price;                    //药品单价 单位是分
    private Integer del;               //1可用 0删除 不填数据库默认是1
    private String jwSubCode;//智业子处方号
    private String drugNumUnit;//数量单位编码
    private String drugNumUnitName;//数量单位名称
    private Integer cost;//计算总额(num*price) 单位是分
    private Integer charge;//自付 单位是分
    private String bindFlag;//成组标志, 0.非成组,1.成组
    private Integer dayCount;//用药天数
    private String drugUsage;//用药方法编码
    private String usageName;//用药方法名称
    private String physicDose;//用药剂量
    private String physicDoseUnit;//剂量单位编码
    private String physicDoseUnitName;//剂量单位名称
    private String physicAmount;//用药总量(实际用药量)
    private String physicAmountUnit;//总量单位编码
    private String physicAmountUnitName;//总量单位名称
    private String physicInjectPlace;//注射地点编码
    private String physicInjectPlaceName;//注射地点名称
    private String physicSkinTest;//注射地点名称
    private String physicSkinTestName;//皮试类型名称
    private String remark;//备注
    @Column(name = "code",unique = true , nullable=false)
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "prescription_code")
    public String getPrescriptionCode() {
        return prescriptionCode;
    }
    public void setPrescriptionCode(String prescriptionCode) {
        this.prescriptionCode = prescriptionCode;
    }
    @Column(name = "drug_code")
    public String getDrugCode() {
        return drugCode;
    }
    public void setDrugCode(String drugCode) {
        this.drugCode = drugCode;
    }
    @Column(name = "drug_name")
    public String getDrugName() {
        return drugName;
    }
    public void setDrugName(String drugName) {
        this.drugName = drugName;
    }
    public String getDrugRate() {
        return drugRate;
    }
    public void setDrugRate(String drugRate) {
        this.drugRate = drugRate;
    }
    public String getDrugFormat() {
        return drugFormat;
    }
    public void setDrugFormat(String drugFormat) {
        this.drugFormat = drugFormat;
    }
    public Integer getNum() {
        return num;
    }
    public void setNum(Integer num) {
        this.num = num;
    }
    public Integer getIsRefrigerate() {
        return isRefrigerate;
    }
    public void setIsRefrigerate(Integer isRefrigerate) {
        this.isRefrigerate = isRefrigerate;
    }
    public String getDirection() {
        return direction;
    }
    public void setDirection(String direction) {
        this.direction = direction;
    }
    public Integer getPrice() {
        return price;
    }
    public void setPrice(Integer price) {
        this.price = price;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    public String getJwSubCode() {
        return jwSubCode;
    }
    public void setJwSubCode(String jwSubCode) {
        this.jwSubCode = jwSubCode;
    }
    public String getDrugNumUnit() {
        return drugNumUnit;
    }
    public void setDrugNumUnit(String drugNumUnit) {
        this.drugNumUnit = drugNumUnit;
    }
    public String getDrugNumUnitName() {
        return drugNumUnitName;
    }
    public void setDrugNumUnitName(String drugNumUnitName) {
        this.drugNumUnitName = drugNumUnitName;
    }
    public Integer getCost() {
        return cost;
    }
    public void setCost(Integer cost) {
        this.cost = cost;
    }
    public Integer getCharge() {
        return charge;
    }
    public void setCharge(Integer charge) {
        this.charge = charge;
    }
    @Column(name = "bind_flag")
    public String getBindFlag() {
        return bindFlag;
    }
    public void setBindFlag(String bindFlag) {
        this.bindFlag = bindFlag;
    }
    @Column(name = "day_count")
    public Integer getDayCount() {
        return dayCount;
    }
    public void setDayCount(Integer dayCount) {
        this.dayCount = dayCount;
    }
    public String getDrugUsage() {
        return drugUsage;
    }
    public void setDrugUsage(String drugUsage) {
        this.drugUsage = drugUsage;
    }
    @Column(name = "usage_name")
    public String getUsageName() {
        return usageName;
    }
    public void setUsageName(String usageName) {
        this.usageName = usageName;
    }
    @Column(name = "physic_dose")
    public String getPhysicDose() {
        return physicDose;
    }
    public void setPhysicDose(String physicDose) {
        this.physicDose = physicDose;
    }
    public String getPhysicDoseUnit() {
        return physicDoseUnit;
    }
    public void setPhysicDoseUnit(String physicDoseUnit) {
        this.physicDoseUnit = physicDoseUnit;
    }
    public String getPhysicDoseUnitName() {
        return physicDoseUnitName;
    }
    public void setPhysicDoseUnitName(String physicDoseUnitName) {
        this.physicDoseUnitName = physicDoseUnitName;
    }
    public String getPhysicAmount() {
        return physicAmount;
    }
    public void setPhysicAmount(String physicAmount) {
        this.physicAmount = physicAmount;
    }
    public String getPhysicAmountUnit() {
        return physicAmountUnit;
    }
    public void setPhysicAmountUnit(String physicAmountUnit) {
        this.physicAmountUnit = physicAmountUnit;
    }
    public String getPhysicAmountUnitName() {
        return physicAmountUnitName;
    }
    public void setPhysicAmountUnitName(String physicAmountUnitName) {
        this.physicAmountUnitName = physicAmountUnitName;
    }
    public String getPhysicInjectPlace() {
        return physicInjectPlace;
    }
    public void setPhysicInjectPlace(String physicInjectPlace) {
        this.physicInjectPlace = physicInjectPlace;
    }
    public String getPhysicInjectPlaceName() {
        return physicInjectPlaceName;
    }
    public void setPhysicInjectPlaceName(String physicInjectPlaceName) {
        this.physicInjectPlaceName = physicInjectPlaceName;
    }
    public String getPhysicSkinTest() {
        return physicSkinTest;
    }
    public void setPhysicSkinTest(String physicSkinTest) {
        this.physicSkinTest = physicSkinTest;
    }
    public String getPhysicSkinTestName() {
        return physicSkinTestName;
    }
    public void setPhysicSkinTestName(String physicSkinTestName) {
        this.physicSkinTestName = physicSkinTestName;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public String getDrugRateName() {
        return drugRateName;
    }
    public void setDrugRateName(String drugRateName) {
        this.drugRateName = drugRateName;
    }
    public String getSubjectClass() {
        return subjectClass;
    }
    public void setSubjectClass(String subjectClass) {
        this.subjectClass = subjectClass;
    }
}

+ 101 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/prescription/PrescriptionVO.java

@ -0,0 +1,101 @@
package com.yihu.wlyy.entity.prescription;
/**
 * 长处方VO类
 * @author huangwenjie
 * @date 2017/12/8 09:21
 */
public class PrescriptionVO {
	
	private String prescription_code;
	private String patient_name;
	private String idcard;
	private String mobile;
	private String hospital_name;
	private String create_time;
	private String doctor_name;
	private String health_problem_name;
	private String pay;
	private String statusName;
	
	public String getPrescription_code() {
		return prescription_code;
	}
	
	public void setPrescription_code(String prescription_code) {
		this.prescription_code = prescription_code;
	}
	
	public String getPatient_name() {
		return patient_name;
	}
	
	public void setPatient_name(String patient_name) {
		this.patient_name = patient_name;
	}
	
	public String getIdcard() {
		return idcard;
	}
	
	public void setIdcard(String idcard) {
		this.idcard = idcard;
	}
	
	public String getMobile() {
		return mobile;
	}
	
	public void setMobile(String mobile) {
		this.mobile = mobile;
	}
	
	public String getHospital_name() {
		return hospital_name;
	}
	
	public void setHospital_name(String hospital_name) {
		this.hospital_name = hospital_name;
	}
	
	public String getCreate_time() {
		return create_time;
	}
	
	public void setCreate_time(String create_time) {
		this.create_time = create_time;
	}
	
	public String getDoctor_name() {
		return doctor_name;
	}
	
	public void setDoctor_name(String doctor_name) {
		this.doctor_name = doctor_name;
	}
	
	public String getHealth_problem_name() {
		return health_problem_name;
	}
	
	public void setHealth_problem_name(String health_problem_name) {
		this.health_problem_name = health_problem_name;
	}
	
	public String getPay() {
		return pay;
	}
	
	public void setPay(String pay) {
		this.pay = pay;
	}
	
	public String getStatusName() {
		return statusName;
	}
	
	public void setStatusName(String statusName) {
		this.statusName = statusName;
	}
}

+ 35 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionDao.java

@ -0,0 +1,35 @@
package com.yihu.wlyy.repository.prescription;
import com.yihu.wlyy.entity.prescription.Prescription;
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;
import java.util.List;
/**
 * Created by chenweida on 2017/7/27.
 */
public interface PrescriptionDao extends PagingAndSortingRepository<Prescription, Long>, JpaSpecificationExecutor<Prescription> {
    @Query("from Prescription p where p.code=?1")
    Prescription findByCode(String prescriptionCode);
    @Modifying
    @Query("update Prescription p set p.status=?2 where p.code=?1")
    void updateStatus(String prescriptionCode, Integer status);
    @Query("select p from Prescription p where p.jwCode=?1 and p.status=?2 and p.patient=?3 ")
    List<Prescription> fingdByJwCodeAndStatus(String jwcode, Integer status, String patient);
//    //根据处方code得到患者信息
//    @Query("select p from Prescription pt,Patient p where p.code=pt.patient  and pt.code=?1")
//    Patient findPatientByPrescriptionCode(String prescriptionCode);
    @Query("from Prescription p where p.visitNo=?1 and p.recipeNo=?2 ")
    Prescription findByVisitNoAndRecipeNo(String visitNo, String recipeNo);
    @Modifying
    @Query("update Prescription p set p.jwPayStatus=1 where p.code=?1")
    void updatejwPayStatus(String prescriptionCode);
}

+ 22 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/device/WlyyDeviceService.java

@ -15,6 +15,7 @@ package com.yihu.wlyy.service.manager.device;
        import javax.persistence.EntityManager;
        import java.util.Date;
        import java.util.HashMap;
        import java.util.List;
        import java.util.Map;
/**
@ -99,4 +100,25 @@ public class WlyyDeviceService {
        if(device == null){return "false";}
        return "true";
    }
    
    
    public List<WlyyDevice> exporthDeviceList(String deviceName, String deviceCode, String orgName, String linkman){
        
        Map<String,SearchFilter> filter = new HashMap<>();
        
        if(!StringUtils.isEmpty(orgName)){
            filter.put("orgName",new SearchFilter("orgName", SearchFilter.Operator.LIKE,orgName));
        }
        if(!StringUtils.isEmpty(deviceCode)){
            filter.put("deviceCode",new SearchFilter("deviceCode",SearchFilter.Operator.EQ,deviceCode));
        }
        if(!StringUtils.isEmpty(deviceName)){
            filter.put("deviceName",new SearchFilter("deviceName",SearchFilter.Operator.LIKE,deviceName));
        }
        if(!StringUtils.isEmpty(linkman)){
            filter.put("linkman",new SearchFilter("linkman",SearchFilter.Operator.EQ,linkman));
        }
        Specification<WlyyDevice> spec = DynamicSpecifications.bySearchFilter(filter.values(), WlyyDevice.class);
        return deviceDao.findAll(spec);
    }
}

+ 1 - 1
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/user/UserService.java

@ -196,7 +196,7 @@ public class UserService extends BaseJpaService<User,UserDao> {
            String[] codes = code.split(",");
            List<ManageDictEntry> manageDictEntries = manageDictEntryDao.findByDictIdAndCodes(dictId, codes);
            if (null != manageDictEntries && manageDictEntries.size() > 0) {
                return manageDictEntries.get(0).getValue();
                return "http://localhost:8180/admin/main";
            }
        }
        return null;

+ 197 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/prescription/PrescriptionService.java

@ -0,0 +1,197 @@
package com.yihu.wlyy.service.prescription;
import com.yihu.wlyy.entity.prescription.PrescriptionVO;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
import com.yihu.wlyy.service.BaseService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
 * @author huangwenjie
 * @date 2017/12/8 09:00
 */
@Service
public class PrescriptionService extends BaseService {
	
	@Autowired
	JdbcTemplate jdbcTemplate;
	
	@Autowired
	private PrescriptionDao prescriptionDao;
	
	private static Logger logger = LoggerFactory.getLogger(PrescriptionService.class);
	
	public List<PrescriptionVO> getPrescriptionList(String hospital,
	                                                String disease,
	                                                String dispensarytype,
	                                                String status,
	                                                String beginDate,
	                                                String endDate,
	                                                Integer page,
	                                                Integer pageSize,
	                                                boolean ispage) throws Exception{
		
		List<PrescriptionVO> list = new ArrayList<>();
		String prescriptionsql = "SELECT " +
				"p.code as prescription_code,"+
				"p.patient_name," +
				"CONCAT(LEFT (p.idcard,6),'**********',RIGHT (p.idcard,2)) idcard," +
				"p.mobile," +
				"p.hospital_name," +
				"p.create_time," +
				"p.doctor_name," +
				"p.health_problem_name," +
				"p.pay," +
				"CASE p.STATUS " +
					"WHEN 31 THEN '开方失败' " +
					"WHEN 40 THEN '开方完成/待支付' " +
					"WHEN 50 THEN '支付成功/待配药' " +
					"WHEN 60 THEN '配药成功/待配送' " +
					"WHEN 65 THEN '配送中' " +
					"WHEN 100 THEN '配送到患者手中/已完成' " +
					"WHEN-4 THEN '线下退费' " +
					"WHEN-3 THEN '支付超时' " +
					"WHEN-2 THEN '患者自己取消' " +
					"WHEN-1 THEN '审核不通过' " +
					"WHEN 0 THEN '待审核' " +
					"WHEN 2 THEN '调整中' " +
				"END statusName,(" +
				"SELECT max(create_time) FROM wlyy_prescription_log l WHERE p.CODE=l.prescription_code) FROM (" +
					"SELECT " +
							"p1.CODE," +
							"p1.patient_name," +
							"p2.idcard," +
							"p2.mobile," +
							"p1.hospital_name," +
							"p1.create_time," +
							"p1.doctor_name," +
							"d.health_problem_name," +
							"CASE p1.dispensary_type " +
								"WHEN 1 THEN '自取' " +
								"WHEN 2 THEN '快递配送' " +
								"WHEN 3 THEN '健管师配送' " +
							"END pay,p1.STATUS " +
					"FROM wlyy_prescription p1," +
					"wlyy_patient p2,(" +
				    "SELECT prescription_code," +
						"GROUP_CONCAT(health_problem_name) health_problem_name " +
						"FROM wlyy_prescription_diagnosis ";
		
			//疾病
			if (StringUtils.isNotBlank(disease)) {
				prescriptionsql = prescriptionsql + " where health_problem = '" + disease+"' ";
			}
				prescriptionsql = prescriptionsql +	" GROUP BY prescription_code) d " +
				    "WHERE p1.patient=p2.CODE AND p1.CODE=d.prescription_code ";
						
//					"WHERE p.patient_name NOT IN ('谭仁祝','林美美','曾丽玉','陈新梅','罗金水','陈友财') " +
		//社区
		if (StringUtils.isNotBlank(hospital)) {
			prescriptionsql = prescriptionsql + " and p1.hospital = '" + hospital+"' ";
		}
		
		//取药方式
		if (StringUtils.isNotBlank(dispensarytype)) {
			prescriptionsql = prescriptionsql + " and p1.dispensary_type = '" + dispensarytype+"' ";
		}
		
		//状态
		if (StringUtils.isNotBlank(status)) {
			prescriptionsql = prescriptionsql + " and p1.status = '" + status+"' ";
		}
		
		//开始时间
		if (StringUtils.isNotBlank(beginDate) && !" 00:00:00".equals(beginDate)) {
			prescriptionsql = prescriptionsql + " and  p1.create_time <= '" + beginDate+"' ";
		}
		
		//结束时间
		if (StringUtils.isNotBlank(endDate) && !" 23:59:59".equals(endDate)) {
			prescriptionsql = prescriptionsql + " and  p1.create_time >= '" + endDate+"' ";
		}
		
		prescriptionsql = prescriptionsql+ ") p ORDER BY p.create_time DESC";
		
		if(ispage){
			if(1 == page){
				page = page-1;
			}
			prescriptionsql = prescriptionsql +" limit " + page+", "+pageSize;
		}
		
		list =  jdbcTemplate.query(prescriptionsql,new BeanPropertyRowMapper(PrescriptionVO.class));
		
		return list ;
	}
	
	public Long getPrescriptionListCount(String hospital, String disease, String dispensarytype, String status, String beginDate, String endDate) {
		
		String prescriptionsql = "SELECT count(p.code) FROM (" +
				"SELECT " +
				"p1.CODE," +
				"p1.patient_name," +
				"p2.idcard," +
				"p2.mobile," +
				"p1.hospital_name," +
				"p1.create_time," +
				"p1.doctor_name," +
				"d.health_problem_name," +
				"CASE p1.dispensary_type " +
				"WHEN 1 THEN '自取' " +
				"WHEN 2 THEN '快递配送' " +
				"WHEN 3 THEN '健管师配送' " +
				"END pay,p1.STATUS " +
				"FROM wlyy_prescription p1," +
				"wlyy_patient p2,(" +
				"SELECT prescription_code," +
				"GROUP_CONCAT(health_problem_name) health_problem_name " +
				"FROM wlyy_prescription_diagnosis ";
		
		//疾病
		if (StringUtils.isNotBlank(disease)) {
			prescriptionsql = prescriptionsql + " where health_problem = '" + disease+"' ";
		}
		prescriptionsql = prescriptionsql +	" GROUP BY prescription_code) d " +
				"WHERE p1.patient=p2.CODE AND p1.CODE=d.prescription_code";
//					"WHERE p.patient_name NOT IN ('谭仁祝','林美美','曾丽玉','陈新梅','罗金水','陈友财') " +
		//社区
		if (StringUtils.isNotBlank(hospital)) {
			prescriptionsql = prescriptionsql + " and p1.hospital = '" + hospital+"' ";
		}
		
		//取药方式
		if (StringUtils.isNotBlank(dispensarytype)) {
			prescriptionsql = prescriptionsql + " and p1.dispensary_type = '" + dispensarytype+"' ";
		}
		
		//状态
		if (StringUtils.isNotBlank(status)) {
			prescriptionsql = prescriptionsql + " and p1.status = '" + status+"' ";
		}
		
		//开始时间
		if (StringUtils.isNotBlank(beginDate) && !" 00:00:00".equals(beginDate)) {
			prescriptionsql = prescriptionsql + " and p1.create_time <= '" + beginDate+"' ";
		}
		
		//结束时间
		if (StringUtils.isNotBlank(endDate) && !" 23:59:59".equals(endDate)) {
			prescriptionsql = prescriptionsql + " and p1.create_time >= '" + endDate+"' ";
		}
		
		prescriptionsql = prescriptionsql + ") p ";
		
		Long total = jdbcTemplate.queryForObject(prescriptionsql, Long.class);
		
		return total ;
	}
}

+ 16 - 3
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/device/device_list.jsp

@ -26,20 +26,32 @@
			<%--<div class="m-form-control f-ml15">--%>
				<%--<input type="text" id="inp_device_model" placeholder="请输入设备型号" class="f-ml10" data-attr-scan="deviceModel"/>--%>
			<%--</div>--%>
			<div id="div_error_list_grid">
			<div class="m-form-control f-ml15">
				<input type="text" id="inp_device_code" placeholder="请输入设备SN码" class="f-ml10" data-attr-scan="deviceCode"/>
				<input type="text" id="inp_device_code" name="inp_device_code" placeholder="请输入设备SN码" class="f-ml10" data-attr-scan="deviceCode"/>
			</div>
			<div class="m-form-control f-ml15">
				<input type="text" id="inp_org_name" placeholder="请输入机构名称" class="f-ml10" data-attr-scan="orgName"/>
				<input type="text" id="inp_org_name" name="inp_org_name" placeholder="请输入机构名称" class="f-ml10" data-attr-scan="orgName"/>
			</div>
			<div class="m-form-control f-ml15">
				<input type="text" id="inp_linkman" placeholder="请输入机构联系人" class="f-ml10" data-attr-scan="linkman"/>
				<input type="text" id="inp_linkman" name="inp_linkman" placeholder="请输入机构联系人" class="f-ml10" data-attr-scan="linkman"/>
			</div>
			<sec:authorize url="/admin/device/deviceList">
			<div id="btn_search" class="l-button u-btn u-btn-primary u-btn-small f-ib f-vam  f-ml10" >
				<span>查询</span>
			</div>
			</sec:authorize>
			<sec:authorize url="/admin/device/toExcel">
			<div class="m-form-control m-form-control-fr">
				<div id="btn_export" class="l-button u-btn u-btn-primary u-btn-small f-ib f-vam">
					<span>导出</span>
				</div>
			</div>
			</sec:authorize>
			<sec:authorize url="/admin/device/create">
			<div class="m-form-control m-form-control-fr">
				<div id="btn_add" class="l-button u-btn u-btn-primary u-btn-small f-ib f-vam" style="margin-right: 20px;">
@ -48,6 +60,7 @@
			</div>
			</sec:authorize>
		</div>
	</div>
	<!-- 列表 -->

+ 30 - 0
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/device/device_list_js.jsp

@ -29,6 +29,7 @@
				$element: $('.m-retrieve-area'),
				$searchBtn: $('#btn_search'),
				$addBtn: $('#btn_add'),
                $exportBtn: $('#btn_export'),
				$deviceName: $("#inp_device_name"),//设备名称
				$deviceCode: $("#inp_device_code"),
@ -53,6 +54,35 @@
					self.$addBtn.click(function () {
						$.publish("device:info:create", [0]);
					});
					//导出
                    //生成Excel表
                    self.$exportBtn.click(function () {
                        //定义一个form表单
                        var myform = $("<form></form>");
                        myform.attr('method','post')
                        myform.attr('action',ctx + '/admin/device/toExcel');
                        //设备名称
                        var deviceName = $("<input type='hidden' name='deviceName' />")
                        deviceName.attr('value',$("#inp_device_name").val());
                        //设备编号
                        var deviceCode = $("<input type='hidden' name='deviceCode' />")
                        deviceName.attr('value',$("#deviceCode").val());
                        //社区名称
                        var orgName = $("<input type='hidden' name='orgName' />")
                        deviceName.attr('value',$("#orgName").val());
                        //联系人
                        var orgName = $("<input type='hidden' name='linkman' />")
                        deviceName.attr('value',$("#linkman").val());
                        myform.append(deviceName);
                        myform.append(deviceCode);
                        myform.append(orgName);
                        myform.appendTo('body').submit(); //must add this line for higher html spec
                    })
				}
			};
			master = {

+ 28 - 0
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/main.jsp

@ -117,6 +117,33 @@
				</div>
				</sec:authorize>
				<%-- 数据统计--%>
				<sec:authorize url="/admin/static/center">
				<div class="a-divider"></div>
				<div class="a-menu">
					<div class="a-menu-tit"><i class="icons icons-aside-2 icons-24 mr15"></i>数据统计</div>
					<div class="a-menu-list c-hide">
						<ul>
							</sec:authorize>
							<sec:authorize url="/admin/static/prescription/initial">
								<li><a href="javascript:locationMenu('staticPrescription');">长处方数据统计</a></li>
							</sec:authorize>
							<sec:authorize url="/admin/static/wechat/initial">
								<li><a href="javascript:locationMenu('staticWechat');">微信统计报表</a></li>
							</sec:authorize>
							<sec:authorize url="/admin/static/sign/initial">
								<li><a href="javascript:locationMenu('staticSign');">签约统计报表</a></li>
							</sec:authorize>
							<sec:authorize url="/admin/static/device/initial">
								<li><a href="javascript:locationMenu('staticDevice');">设备统计报表</a></li>
							</sec:authorize>
							<sec:authorize url="/admin/static/static/center">
						</ul>
					</div>
				</div>
				</sec:authorize>
				<%-- 问卷调查管理中心--%>
				<sec:authorize url="/admin/survey/center">
				<div class="a-divider"></div>
@ -228,6 +255,7 @@
					</div>
					</sec:authorize>
                <!-- 原有先注释 20160901  ********-->
                <!-- <div class="a-divider"></div>
                <div class="a-menu">

+ 65 - 0
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/prescription/prescription_list.jsp

@ -0,0 +1,65 @@
<%--
  Created by IntelliJ IDEA.
  User: huangwenjie
  Date: 2017/12/8
  Time: 10:29
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html; charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <%@ include file="../head/page_head.jsp" %>
    <title>长处方统计</title>
</head>
<body>
<div id="div_wrapper">
    <!-- 检索条件 -->
    <div class="m-retrieve-area f-h50 f-dn f-pr m-form-inline" data-role-form style='display: block;'>
        <div class="m-form-group f-mt10">
            <div class="m-form-group f-mt10">
                <div class="m-form-control f-ml15" style="display: none">
                    <input type="text" id="inp_device_name" placeholder="请选择城市" class="f-ml10"/>
                </div>
                <div class="m-form-control f-ml15">
                    <input type="text" id="inp_categoryCode" placeholder="请选择市区" class="f-ml10"/>
                </div>
                <div class="m-form-control f-ml15">
                    <input type="text" id="inp_hos" placeholder="请选择机构" class="f-ml10"/>
                </div>
                <div class="m-form-control f-ml15" style="display: none">
                    <input type="text" id="inp_team" placeholder="请选择团队" class="f-ml10"/>
                </div>
                <div class="m-form-control f-ml15">
                    <input type="text" id="inp_star_date" placeholder="开始日期" class="f-ml10" data-attr-scan="beginDate"/>
                </div>
                <div class="m-form-control f-ml15">
                    <input type="text" id="inp_end_date" placeholder="结束日期" class="f-ml10" data-attr-scan="endDate"/>
                </div>
                <div class="m-form-control f-ml15">
                    <input type="text" id="inp_disease" placeholder="请选择病种" class="f-ml10" data-attr-scan="disease"/>
                </div>
                <div class="m-form-control f-ml15">
                    <input type="text" id="inp_dispensarytype" placeholder="请选择取药方式" class="f-ml10" data-attr-scan="dispensarytype"/>
                </div>
                <div class="m-form-control f-ml15">
                    <input type="text" id="inp_status" placeholder="请选择状态" class="f-ml10" data-attr-scan="status"/>
                </div>
                <div id="btn_search" class="l-button u-btn u-btn-primary u-btn-small f-ib f-vam  f-ml10" >
                    <span>查询</span>
                </div>
                <div id="btn_export" class="l-button u-btn u-btn-primary u-btn-small f-ib f-vam  f-ml10" >
                    <span>导出</span>
                </div>
            </div>
        </div>
    </div>
    <!-- 列表 -->
    <div id="div_prescription_list">
    </div>
</div>
</body>
<%@ include file="../head/page_foot.jsp" %>
<%@ include file="prescription_list_js.jsp" %>
</html>

+ 459 - 0
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/prescription/prescription_list_js.jsp

@ -0,0 +1,459 @@
<%--
  Created by IntelliJ IDEA.
  User: Mewtwo
  Date: 2017/12/8
  Time: 11:29
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<script>
    (function ( $, win) {
        $(function () {
            /* ************************** 变量定义 ******************************** */
            // 通用工具类库
            var Util = $.Util;
            var retrieve = null;
            var inpStarDate = null,inpEndDate = null;
            var now = new Date(); //当前日期
            var nowDayOfWeek = now.getDay(); //今天本周的第几天
            var nowDay = now.getDate(); //当前日
            var nowMonth = now.getMonth(); //当前月
            var nowYear = now.getYear(); //当前年
            nowYear += (nowYear < 2000) ? 1900 : 0;
            retrieve = {
                $element: $('.m-retrieve-area'),
                patientInfoDialog: null,
                remindInfoDialog:null,
                $noReply: $('#noReply'),
                $count: $('#count'),
                $rate: $('#rate'),
                grid: null,
                url: {
                    //接口链接
                    /*
                    列表
                    */
                    list: '/admin/static/prescription/list',
                    /*
                    * 省,市,区
                    * */
                    district: '/common/district',
                    /*
                    *获取医院列表
                    * */
                    hospitalsByType: '/admin/hos/hospitalsByType',
                    /*
                    * 获取社区的团队
                    * */
                    team: '/admin/team/list'
                },
                $inpDeviceName: $('#inp_device_name'),//城市
                $inpCategoryCode: $('#inp_categoryCode'),//区
                $inpHos: $('#inp_hos'),//机构
                $inpTeam: $('#inp_team'),//团队
                $inpDisease:$('#inp_disease'),//病种
                $inpDispensarytype:$('#inp_dispensarytype'),//取药方式
                $inpStatus:$('#inp_status'),//状态
                dnc: null,
                ccc: null,
                hc: null,
                tc: null,
                $inpNotReturn: $('#inp_not_return'),
                $inpDocName: $('#inp_doc_name'),
                $inpStarDate: $('#inp_star_date'),
                $inpEndDate: $('#inp_end_date'),
                $btnSearch: $('#btn_search'),
                $btnExport: $('#btn_export'),
                init: function () {
                    this.initComboBox();
                    inpStarDate = this.$inpStarDate.ligerDateEditor({
                        format: "yyyy-MM-dd",
                        showTime: false,
                        labelWidth: 100,
                        labelAlign: 'center',
                        cancelable: true
                    });
                    inpEndDate = this.$inpEndDate.ligerDateEditor({
                        format: "yyyy-MM-dd",
                        showTime: false,
                        labelWidth: 100,
                        labelAlign: 'center',
                        cancelable: true
                    });
                    this.$inpNotReturn.ligerTextBox({width: 200});
                    this.$inpDocName.ligerTextBox({width: 200});
                    this.getList(this);
                    this.bindEvents();
                    //疾病下拉框
                    retrieve.diseaseBox = $("#inp_disease").ligerComboBox({
                        width: 150,
                        data: [
                            {text: '高血压病', statusId: 'HP0093'},
                            {text: '糖尿病', statusId: 'HP0047'}
                        ],
                        initIsTriggerEvent: false,
                        valueField: 'statusId',
                    });
                    //请选择取药方式拉框
                    retrieve.dispensarytypeBox = $("#inp_dispensarytype").ligerComboBox({
                        width: 150,
                        data: [
                            {text: '自取', statusId: '1'},
                            {text: '快递配送', statusId: '2'},
                            {text: '健管师配送', statusId: '3'}
                        ],
                        initIsTriggerEvent: false,
                        valueField: 'statusId',
                    });
                    //状态拉框
                    retrieve.statusBox = $("#inp_status").ligerComboBox({
                        width: 150,
                        data: [
                            {text: '开方失败', statusId: '31'},
                            {text: '开方完成/待支付', statusId: '40'},
                            {text: '支付成功/待配药', statusId: '50'},
                            {text: '配药成功/待配送', statusId: '60'},
                            {text: '配送中', statusId: '65'},
                            {text: '配送到患者手中/已完成', statusId: '100'},
                            {text: '线下退费', statusId: '-4'},
                            {text: '支付超时', statusId: '-3'},
                            {text: '患者自己取消', statusId: '-2'},
                            {text: '审核不通过', statusId: '-1'},
                            {text: '待审核', statusId: '0'},
                            {text: '调整中', statusId: '2'},
                        ],
                        initIsTriggerEvent: false,
                        valueField: 'statusId',
                    });
                    //查询
                    me.$btnSearch.on('click',function () {
                        me.reloadGrid(me);
                    });
                },
                //初始化市区下拉框
                initComboBox: function () {
                    this.dnc = this.$inpDeviceName.ligerComboBox({
                        width: 150,
                        data: [
                            {text: '厦门市', statusId: '350200'}
                        ],
                        initIsTriggerEvent: false,
                        valueField: 'statusId',
                    });
                    this.dnc.selectValue('350200');//默认选中厦门市
                    this.setCityFun(this);
                    this.initInpCat( [], this);
                    this.initHc( [], this);
                    this.initTc( [], this);
                },
                //区
                initInpCat: function ( d, me) {
                    me.ccc = me.$inpCategoryCode.ligerComboBox({
                        width: 150,
                        data: d,
                        initIsTriggerEvent: false,
                        valueField: 'statusId',
                    });
                },
                //机构
                initHc: function ( d, me) {
                    me.hc = me.$inpHos.ligerComboBox({
                        width: 250,
                        data: d,
                        initIsTriggerEvent: false,
                        valueField: 'statusId',
                    });
                },
                //团队
                initTc: function ( d, me) {
                    me.tc = me.$inpTeam.ligerComboBox({
                        width: 200,
                        data: d,
                        initIsTriggerEvent: false,
                        valueField: 'statusId',
                    });
                },
                //获取列表
                getList: function (me) {
                    me.$element.attrScan();
                    var values = me.$element.Fields.getValues();
                    values.beginDate = values.beginDate + ' 00:00:00';
                    values.endDate = values.endDate + ' 23:59:59';
                    values.city = me.dnc.getValue();
                    values.town = me.ccc.getValue();
                    values.hospital = me.hc.getValue();
                    values.teamCode = me.tc.getValue();
                    console.log(values);
                    me.grid = $("#div_prescription_list").ligerGrid($.LigerGridEx.config({
                        url: ctx + me.url.list,
                        parms: {
                            "town": values.town,
                            "hospital": values.hospital,
                            "disease": values.disease,
                            "dispensarytype": values.dispensarytype,
                            "status":values.status,
                            "beginDate":values.beginDate,
                            "endDate":values.endDate,
                        },
                        ajaxHeader: ajaxHeaderName,
                        ajaxHeaderValue: ajaxHeaderValue,
                        columns: [
                            {display: 'code', name: 'prescription_code', hide: true},
                            {display: '姓名', name: 'patient_name', width: '5%', align: "center"},
                            {display: '身份证号', name: 'idcard', width: '12%', align: "left"},
                            {display: '手机号码', name: 'mobile', width: '10%', align: "center"},
                            {display: '签约医院', name: 'hospital_name', width: '17%', align: "left"},
                            {display: '医生', name: 'doctor_name', width: '10%', align: "center"},
                            {display: '疾病', name: 'health_problem_name', align: "center"},
                            {display: '状态', name: 'statusName', align: "center"},
                            {display: '配送方式', name: 'pay', align: "center"},
                            {display: '时间', name: 'create_time', width: '12%', align: "center"},
                            {
                                display: '操作', name: 'operator', width: '10%', align: "center", isSort: false,
                                <%--render: function (row) {--%>
                                <%--var html = '';--%>
                                <%--html += '<a  href="javascript:void(0)" onclick="javascript:' + Util.format("$.publish('{0}',['{1}'])", "sign:info:view", row.id) + '">明细</a>';--%>
                                <%--//html += '<a  style="margin-left:10px;"href="javascript:void(0)" onclick="javascript:' + Util.format("$.publish('{0}',['{1}'])", "patient:info:edit", row.id) + '">编辑</a>';--%>
                                <%--//html += '<a  style="margin-left:10px;" title="删除" href="javascript:void(0)" onclick="javascript:' + Util.format("$.publish('{0}',['{1}','{2}'])", "patient:info:del", row.id,row.code) + '">删除</a>';--%>
                                <%--if (row.adminTeamId) {--%>
                                <%--<sec:authorize url="/admin/sign/memberList">--%>
                                <%--html += '<a style="margin-left:10px;" href="' + ctx + '/admin/team/signTeamInfo/' + row.adminTeamId + '" target="centerFrame">行政团队</a>';--%>
                                <%--</sec:authorize>--%>
                                <%--}--%>
                                <%--return html;--%>
                                <%--}--%>
                            }
                        ],
                    }));
                    // 自适应宽度
                    me.grid.adjustToWidth();
                },
                setCityFun: function (me) {
                    var v = me.dnc.getValue();
                    if (v != '') {
                        me.rAjax( me.url.district, {
                            type: 3,
                            code: v
                        }, function (data) {
                            var d = [];
                            for (var i = 0; i < data.list.length; i++) {
                                d.push({
                                    text: data.list[i].name,
                                    statusId: data.list[i].code
                                });
                            }
                            //区
                            me.initInpCat( d, me);
                        })
                    } else {
                        me.initInpCat( [], me);
                        me.initHc( [], me);
                        me.initTc( [], me);
                    }
                },
                setAreaFun: function (me) {
                    var v = me.ccc.getValue();
                    if (v != '') {
                        me.rAjax( me.url.hospitalsByType, {
                            type: 2,
                            code: v
                        }, function (data) {
                            var d = [];
                            for (var i = 0; i < data.list.length; i++) {
                                d.push({
                                    text: data.list[i].name,
                                    statusId: data.list[i].code
                                });
                            }
                            //机构
                            me.initHc( d, me);
                        })
                    } else {
                        me.initHc( [], me);
                        me.initTc( [], me);
                    }
                },
                setJgFun: function (me) {
                    var v = me.hc.getValue();
                    if (v != '') {
                        me.rAjax( me.url.team, {
                            orgCode: v
                        }, function (data) {
                            var d = [];
                            for (var i = 0; i < data.list.length; i++) {
                                d.push({
                                    text: data.list[i].name,
                                    statusId: data.list[i].id
                                });
                            }
                            //tuandui
                            me.initTc( d, me);
                        })
                    } else {
                        me.initTc( [], me);
                    }
                },
                bindEvents: function () {
                    var me = this;
                    //城市下拉
                    me.$inpDeviceName.on( 'change', function () {
                        me.setCityFun(me);
                    });
                    //区下拉
                    me.$inpCategoryCode.on( 'change', function () {
                        me.setAreaFun(me);
                        me.hc.setValue('');
                        me.tc.setValue('');
                    });
                    //机构
                    me.$inpHos.on( 'change', function () {
                        me.setJgFun(me);
                        me.tc.setValue('');
                    });
                    //查询
                    me.$btnSearch.on('click',function () {
                        me.reloadGrid(me);
                    });
                    //导出
                    me.$btnExport.on('click',function () {
                        //定义一个form表单
                        var myform = $("<form></form>");
                        myform.attr('method','post')
                        myform.attr('action',ctx + '/admin/static/prescription/toExcel');
                        me.$element.attrScan();
                        var values = me.$element.Fields.getValues();
                        values.beginDate = values.beginDate + ' 00:00:00';
                        values.endDate = values.endDate + ' 23:59:59';
                        values.city = me.dnc.getValue();
                        values.town = me.ccc.getValue();
                        values.hospital = me.hc.getValue();
                        values.teamCode = me.tc.getValue();
                        //疾病
                        var disease = $("<input type='hidden' name='disease' />")
                        disease.attr('value',$("#inp_disease_val").val());
                        //取药方式
                        var dispensarytype = $("<input type='hidden' name='dispensarytype' />")
                        dispensarytype.attr('value',$("#inp_dispensarytype_val").val());
                        //状态
                        var status = $("<input type='hidden' name='status' />")
                        status.attr('value',$("#inp_status_val").val());
                        //区
                        var town = $("<input type='hidden' name='town' />")
                        town.attr('value',values.town);
                        //社区医院
                        var hospital = $("<input type='hidden' name='hospital' />")
                        hospital.attr('value',values.hospital);
                        //开始时间
                        var beginDate = $("<input type='hidden' name='beginDate' />")
                        beginDate.attr('value',values.beginDate);
                        //结束时间
                        var endDate = $("<input type='hidden' name='endDate' />")
                        endDate.attr('value',values.endDate);
                        myform.append(disease);
                        myform.append(dispensarytype);
                        myform.append(status);
                        myform.append(town);
                        myform.append(hospital);
                        myform.append(beginDate);
                        myform.append(endDate);
                        myform.appendTo('body').submit(); //must add this line for higher html spec
                    });
                },
                reloadGrid: function (me) {
                    me.$element.attrScan();
                    var values = me.$element.Fields.getValues();
                    values.beginDate = values.beginDate + ' 00:00:00';
                    values.endDate = values.endDate + ' 23:59:59';
                    values.city = me.dnc.getValue();
                    values.town = me.ccc.getValue();
                    values.hospital = me.hc.getValue();
                    values.teamCode = me.tc.getValue();
                    values.disease = $('#inp_disease_val').val();
                    values.dispensarytype = $('#inp_dispensarytype_val').val();
                    values.status = $('#inp_status_val').val();
                    console.log(values);
                    me.selReloadGrid.call(me, values);
                },
                selReloadGrid: function (params) {
                    this.grid.options.newPage = 1;
                    this.grid.setOptions({parms: params});
                    this.grid.loadData(true);
                },
                rAjax: function ( url, d, cb) {
                    $.ajax({
                        url: ctx + url,
                        data: d,
                        type: 'POST',
                        dataType: 'json',
                        success: function (data) {
                            if (data.status == 200) {
                                cb && cb.call( this, data);
                            } else {
                                $.Notice.error(data.msg);
                            }
                        }
                    });
                },
                formatDate:function (date) {//格式化日期
                    var myyear = date.getFullYear();
                    var mymonth = date.getMonth()+1;
                    var myweekday = date.getDate();
                    if(mymonth < 10){
                        mymonth = "0" + mymonth;
                    }
                    if(myweekday < 10){
                        myweekday = "0" + myweekday;
                    }
                    return (myyear+"-"+mymonth + "-" + myweekday);
                },
                getNowDay:function(){
                    var me = this;
                    var nowDate = new Date(nowYear, nowMonth, nowDay);
                    return me.formatDate(nowDate);
                },
                getWeekStartDate:function () {//获得本周的开始日期
                    var me = this;
                    var weekStartDate = new Date(nowYear, nowMonth, nowDay - nowDayOfWeek + 1);
                    return me.formatDate(weekStartDate);
                },
                getMonthStartDate:function(){ //获得本月的开始日期
                    var me = this;
                    var monthStartDate = new Date(nowYear, nowMonth, 1);
                    return me.formatDate(monthStartDate);
                }
            };
            win.reloadMasterUpdateGrid = function () {
                retrieve.reloadGrid(retrieve);
            };
            retrieve.init();
        });
    })( jQuery, window);
</script>

+ 4 - 0
patient-co-manage/wlyy-manage/src/main/webapp/static/js/menu.js

@ -21,6 +21,10 @@ var menu = {
    "deviceHealthIndex": "/admin/healthIndex/initial",//健康体征数据查询页面
    "patientDevice": "/admin/patientDevice/initial",//居民设备查询页面
    //数据统计
    "static": "/admin/static/center",//数据统计
    "staticPrescription": "/admin/static/prescription/initial",//长处方数据统计
    //安全管理
    "user": "/admin/user/initial",//人员管理界面
    "roles": "/admin/roles/initial",//用户角色管理界面

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

@ -16,6 +16,7 @@ import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.patient.SocialSecurityInfo;
import com.yihu.wlyy.entity.patient.invitation.PatientInvitationLog;
import com.yihu.wlyy.entity.patient.vo.PatientArchivesDto;
import com.yihu.wlyy.entity.patient.vo.PatientVO;
import com.yihu.wlyy.entity.security.Token;
import com.yihu.wlyy.repository.address.CityDao;
import com.yihu.wlyy.repository.address.ProvinceDao;
@ -40,6 +41,7 @@ import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.objenesis.ObjenesisBase;
import org.springframework.stereotype.Component;
@ -1289,4 +1291,33 @@ public class PatientInfoService extends BaseService {
        return rs;
    }
    
    
    /**
     *根据居民CODE获取居民VO对象
     *@author huangwenjie
     *@date 2017/12/6 08:40
     */
    public PatientVO getPatientVOByCode(String code){
        PatientVO p = new PatientVO();
        List<PatientVO> plist = new ArrayList<>();
        if(StringUtils.isNotBlank(code)){
            String patientsql = "select a.*,b.deviceType as deviceType,c.disease as disease from wlyy_patient a" +
                    "  left join (select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on a.code = b.user" +
                    "  left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3 and status=1 " +
                    " and patient = '"+code+"' GROUP BY patient) c on a.code = c.patient" +
                    " where a.status =1 and a.code = '"+code+"'";
            
            plist = jdbcTemplate.query(patientsql,new BeanPropertyRowMapper(PatientVO.class));
            
            if(plist.isEmpty()){
                return null;
            }else{
                p = plist.get(0);
                return p;
            }
        }else{
            return null;
        }
    }
}

+ 20 - 21
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/express/SFExpressService.java

@ -252,27 +252,26 @@ public class SFExpressService extends BaseService {
        Document doc = DocumentHelper.parseText(re);
        String headvalue = doc.selectSingleNode("/Response/Head").getText();
        if(StringUtils.isNotBlank(headvalue) && "OK".equals(headvalue)) {
        }
        Element root = doc.getRootElement();
        if (root.element("Body") != null)     //取报文根节点
        {
            root = root.element("Body");
        }
        List<?> child = root.elements();
        String mailno = "";
        Map<String,List<PrescriptionExpressageLog>> wayroutlsit = new HashMap<>();
        for (Object o : child) {
            Element e = (Element) o;
            mailno = e.attributeValue("mailno");
            //判断快递单号不为空,且和我们本地的一致
            if(StringUtils.isNotBlank(mailno) &&
                    sfexpress_obj.getMailno().equals(mailno)){
                //解析报文,结合本地数据返回最终的日志结果
                return this.xmltologlist(e,sfexpresslogList,sfexpress_obj);
            }else{
                continue;
            Element root = doc.getRootElement();
            if (root.element("Body") != null)     //取报文根节点
            {
                root = root.element("Body");
            }
            List<?> child = root.elements();
            String mailno = "";
            Map<String,List<PrescriptionExpressageLog>> wayroutlsit = new HashMap<>();
            for (Object o : child) {
                Element e = (Element) o;
                mailno = e.attributeValue("mailno");
                //判断快递单号不为空,且和我们本地的一致
                if(StringUtils.isNotBlank(mailno) &&
                        sfexpress_obj.getMailno().equals(mailno)){
            
                    //解析报文,结合本地数据返回最终的日志结果
                    return this.xmltologlist(e,sfexpresslogList,sfexpress_obj);
                }else{
                    continue;
                }
            }
        }
        return null;

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

@ -18,6 +18,7 @@ import com.yihu.wlyy.repository.doctor.SignPatientLabelDao;
import com.yihu.wlyy.repository.doctor.SignPatientLabelInfoDao;
import com.yihu.wlyy.repository.patient.*;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.account.PatientInfoService;
import com.yihu.wlyy.service.app.team.AdminTeamService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.IdCardUtil;
@ -74,6 +75,8 @@ public class SignPatientLabelInfoService extends BaseService {
    SignFamilyRenewDao signFamilyRenewDao;
    @Autowired
    SignPatientLabelInfoDao signPatientLabelInfoDao;
    @Autowired
    PatientInfoService patientInfoService;
    private final Logger logger = LoggerFactory.getLogger(this.getClass());
@ -86,7 +89,8 @@ public class SignPatientLabelInfoService extends BaseService {
     */
    public JSONObject getPatient(String patient) throws Exception {
        JSONObject json = new JSONObject();
        Patient p = patientDao.findByCode(patient);
//        Patient p = patientDao.findByCode(patient);
        PatientVO p = patientInfoService.getPatientVOByCode(patient);
        if (p == null) {
            throw new Exception("patient info can not find");
@ -119,6 +123,15 @@ public class SignPatientLabelInfoService extends BaseService {
        json.put("address", p.getAddress());
        // 社保号
        json.put("ssc", p.getSsc());
    
        //病情类型:0健康,1高血压,2糖尿病,(1,2)高血压+糖尿病
        json.put("disease",p.getDisease());
        // 病情:0绿标,1黄标,2红标,
        json.put("diseaseCondition",p.getDiseaseCondition());
        //预警状态
        json.put("standardStatus",p.getStandardStatus());
        //设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
        json.put("deviceType",p.getDeviceType());
        SignFamily ssSign = signFamilyDao.findSignByPatient(patient, 1);
        SignFamily familySign = signFamilyDao.findSignByPatient(patient, 2);
@ -267,10 +280,12 @@ public class SignPatientLabelInfoService extends BaseService {
            Calendar today = Calendar.getInstance();
            Calendar startDate = Calendar.getInstance();
            SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
            sql = "select * " +
            sql = "select DISTINCT * " +
                    " from " +
                    "     wlyy_sign_family " +
                    " where (doctor = ? or doctor_health = ?) and status > 0 and admin_team_code = ? ";
                    "     wlyy_sign_family t1" +
                    "  LEFT JOIN wlyy_patient p on p.code = t1.patient  "+
                    "  LEFT JOIN wlyy_sign_patient_label_info t2 on t2.patient = t1.patient and t2.label_type = 3 and t2.status=1 "+
                    " where (t1.doctor = ? or t1.doctor_health = ?) and t1.status > 0 and t1.admin_team_code = ? ";
            if (labelCode.equals("1")) {
                int week = today.get(Calendar.DAY_OF_WEEK) - 2;
@ -279,53 +294,43 @@ public class SignPatientLabelInfoService extends BaseService {
                    week = 6;
                }
                startDate.add(Calendar.DATE, -week);
                sql += " and apply_date between '" + (df.format(startDate.getTime()) + " 00:00:00")
                sql += " and t1.apply_date between '" + (df.format(startDate.getTime()) + " 00:00:00")
                        + "' and '" + (df.format(today.getTime()) + " 23:59:59'");
            } else if (labelCode.equals("2")) {
                startDate.set(Calendar.DATE, 1);
                sql += " and apply_date between '" + (df.format(startDate.getTime()) + " 00:00:00")
                sql += " and t1.apply_date between '" + (df.format(startDate.getTime()) + " 00:00:00")
                        + "' and '" + (df.format(today.getTime()) + " 23:59:59'");
            } else if (labelCode.equals("3")) {
                startDate.add(Calendar.DATE, 30);
                sql += " and end between '" + (df.format(today.getTime()) + " 00:00:00")
                sql += " and t1.end between '" + (df.format(today.getTime()) + " 00:00:00")
                        + "' and '" + (df.format(startDate.getTime()) + " 23:59:59'");
            } else {
                throw new Exception("label is not exist");
            }
            sql += " order by openid desc,convert(name using gbk) ";
            sql += " order by p.standard_status DESC ,p.disease_condition DESC,t2.label DESC,t1.openid DESC ,convert(t1.name using gbk) ";
            args = new Object[]{doctor, doctor, teamCode};
        }else if("1".equals(labelType)){
            sql = "SELECT " +
                    " f.* " +
                    "FROM " +
                    " wlyy_sign_family_server s ,( " +
                    "  SELECT " +
                    "   t1.*, p.openid AS ptOpenid " +
            sql ="  SELECT " +
                    "  DISTINCT t1.* " +
                    "  FROM " +
                    "   wlyy_sign_family t1, " +
                    "   wlyy_patient p " +
                    "  WHERE " +
                    "  p. CODE = t1.patient " +
                    "  AND ( " +
                    "   wlyy_sign_family t1 " +
                    "   LEFT JOIN wlyy_patient p on p. CODE = t1.patient " +
                    "   LEFT JOIN wlyy_sign_patient_label_info t2 on t2.patient = t1.patient and t2.label_type = 3 and t2.status=1 "+
                    "   LEFT JOIN wlyy_sign_family_server s on s.sign_code = t1.code and s.server_type = '"+labelCode+"' "+
                    "  WHERE ( " +
                    "   t1.doctor = ? " +
                    "   OR t1.doctor_health = ? " +
                    "  ) " +
                    "  AND t1. STATUS > 0  AND t1.admin_team_code = ?";
            if(isSlowDisease){
                sql = sql + "  AND p.disease >0 " ;
            }
            if(StringUtils.isNotBlank(diseaseCondition)){
                sql = sql + " AND p.disease_condition ="+diseaseCondition;
            }
            sql = sql +" ) f " +
                    "WHERE " +
                    " f. CODE = s.sign_code " +
                    " AND s.server_type ='"+labelCode+"'  ORDER BY f.ptOpenid DESC";
            sql = sql +" order by p.standard_status DESC ,p.disease_condition DESC,t2.label DESC,t1.openid DESC ,convert(t1.name using gbk) ";
            args = new Object[]{doctor, doctor, teamCode};
        }else if("3".equals(labelType) && isSlowDisease){
            //慢病管理
            sql = "SELECT " +
                    "    DISTINCT t1.* " +
                    "  DISTINCT t1.* " +
                    "  FROM  wlyy_sign_family t1 " +
                    "  LEFT JOIN wlyy_patient p on p.code = t1.patient  "+
                    "  RIGHT JOIN wlyy_sign_patient_label_info t2 on t2.patient = t1.patient ";
@ -355,11 +360,12 @@ public class SignPatientLabelInfoService extends BaseService {
                        " left join " +
                        "    (select l.patient,l.label,l.label_type,l.label_name from wlyy_sign_family f left join wlyy_sign_patient_label_info l on f.patient = l.patient where (f.doctor = '" + doctor + "' or f.doctor_health = '" + doctor + "') and f.status > 0 and l.label_type = ? and l.status = 1) t2 " +
                        " on t1.patient = t2.patient " +
                        " left join wlyy_patient p on p.code = t1.patient "+
                        " WHERE " +
                        "    t2.patient is null " +
                        "    AND (t1.doctor = ? or t1.doctor_health = ?) " +
                        "    AND t1.status > 0 " +
                        "    AND t1.admin_team_code = ? order by t1.openid desc,convert(t1.name using gbk) ";
                        "    AND t1.admin_team_code = ? order by p.standard_status DESC ,p.disease_condition DESC,t2.label DESC,t1.openid DESC ,convert(t1.name using gbk)";
                args = new Object[]{labelType, doctor, doctor, teamCode};
            }else {
@ -368,6 +374,7 @@ public class SignPatientLabelInfoService extends BaseService {
                        " FROM " +
                        "    wlyy_sign_family t1, " +
                        "    wlyy_sign_patient_label_info t2 " +
                        "    wlyy_patient p "+
                        " WHERE " +
                        "    t2.label = ? " +
                        "    AND t2.label_type = ? " +
@ -375,7 +382,7 @@ public class SignPatientLabelInfoService extends BaseService {
                        "    AND t1.patient = t2.patient " +
                        "    AND (t1.doctor = ? or t1.doctor_health = ?)" +
                        "    AND t1.status > 0 " +
                        "    AND t1.admin_team_code = ? order by t1.openid desc,convert(t1.name using gbk) ";
                        "    AND t1.admin_team_code = ? order by p.standard_status DESC ,p.disease_condition DESC,t2.label DESC,p.openid DESC ,convert(t1.name using gbk)";
                args = new Object[]{labelCode, labelType, doctor, doctor, teamCode};
            }
@ -2299,9 +2306,23 @@ public class SignPatientLabelInfoService extends BaseService {
        if (signList != null && signList.size() > 0) {
            for (Map<String, Object> sign : signList) {
                Patient p = patientDao.findByCode(sign.get("patient") == null ? "" : sign.get("patient").toString());
                if (p == null) {
                PatientVO p = new PatientVO();
                List<PatientVO> plist = new ArrayList<>();
                if(sign.get("patient") != null){
                    String patientsql = "select a.*,b.deviceType as deviceType,c.disease as disease from wlyy_patient a" +
                            "  left join (select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on a.code = b.user" +
                            "  left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3 and status=1 " +
                            " and (label = 1 or label = 2) and patient = '"+sign.get("patient").toString()+"' GROUP BY patient) c on a.code = c.patient" +
                            " where a.status =1 and a.code = '"+sign.get("patient").toString()+"'";
        
                    plist = jdbcTemplate.query(patientsql,new BeanPropertyRowMapper(PatientVO.class));
        
                    if(plist.isEmpty()){
                        continue;
                    }else{
                        p = plist.get(0);
                    }
                }else{
                    continue;
                }
@ -2425,6 +2446,17 @@ public class SignPatientLabelInfoService extends BaseService {
                    // 缴费情况
                    json.put("expensesStatus", "1");
                }
    
                //病情类型:0健康,1高血压,2糖尿病,3高血压+糖尿病
                json.put("disease", p.getDisease());
                // 病情:0绿标,1黄标,2红标,
                json.put("diseaseCondition", p.getDiseaseCondition());
                //预警状态
                json.put("standardStatus", p.getStandardStatus());
                //设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
                json.put("deviceType",p.getDeviceType());
                
                
                boolean epTime = false;
                try {
                    epTime = redisTemplate.opsForSet().isMember("wechat:focus:remind:set", p.getCode());
@ -2552,9 +2584,23 @@ public class SignPatientLabelInfoService extends BaseService {
        if (signList != null && signList.size() > 0) {
            for (Map<String, Object> sign : signList) {
                Patient p = patientDao.findByCode(sign.get("patient") == null ? "" : sign.get("patient").toString());
                if (p == null) {
                PatientVO p = new PatientVO();
                List<PatientVO> plist = new ArrayList<>();
                if(sign.get("patient") != null){
                    String patientsql = "select a.*,b.deviceType as deviceType,c.disease as disease from wlyy_patient a" +
                            "  left join (select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on a.code = b.user" +
                            "  left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3 and status=1 " +
                            " and (label = 1 or label = 2) and patient = '"+sign.get("patient").toString()+"' GROUP BY patient) c on a.code = c.patient" +
                            " where a.status =1 and a.code = '"+sign.get("patient").toString()+"'";
        
                    plist = jdbcTemplate.query(patientsql,new BeanPropertyRowMapper(PatientVO.class));
        
                    if(plist.isEmpty()){
                        continue;
                    }else{
                        p = plist.get(0);
                    }
                }else{
                    continue;
                }
@ -2678,6 +2724,16 @@ public class SignPatientLabelInfoService extends BaseService {
                    // 缴费情况
                    json.put("expensesStatus", "1");
                }
    
                //病情类型:0健康,1高血压,2糖尿病,3高血压+糖尿病
                json.put("disease", p.getDisease());
                // 病情:0绿标,1黄标,2红标,
                json.put("diseaseCondition", p.getDiseaseCondition());
                //预警状态
                json.put("standardStatus", p.getStandardStatus());
                //设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
                json.put("deviceType",p.getDeviceType());
                
                boolean epTime = false;
                try {
                    epTime = redisTemplate.opsForSet().isMember("wechat:focus:remind:set", p.getCode());
@ -3342,6 +3398,7 @@ public class SignPatientLabelInfoService extends BaseService {
                "    DISTINCT t1.* " +
                " FROM " +
                "    wlyy_sign_family t1 " +
                "  LEFT JOIN wlyy_patient p on p.code = t1.patient  "+
                (isIdcard ? ",wlyy_patient p " : "") +
                " WHERE " +
                (isIdcard ? " t1.patient = p.code  and " : "") +
@ -3355,9 +3412,23 @@ public class SignPatientLabelInfoService extends BaseService {
        if (signList != null && signList.size() > 0) {
            for (Map<String, Object> sign : signList) {
                Patient p = patientDao.findByCode(sign.get("patient") == null ? "" : sign.get("patient").toString());
                if (p == null) {
                PatientVO p = new PatientVO();
                List<PatientVO> plist = new ArrayList<>();
                if(sign.get("patient") != null){
                    String patientsql = "select a.*,b.deviceType as deviceType,c.disease as disease from wlyy_patient a" +
                            "  left join (select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on a.code = b.user" +
                            "  left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3 and status=1 " +
                            " and (label = 1 or label = 2) and patient = '"+sign.get("patient").toString()+"' GROUP BY patient) c on a.code = c.patient" +
                            " where a.status =1 and a.code = '"+sign.get("patient").toString()+"'";
        
                    plist = jdbcTemplate.query(patientsql,new BeanPropertyRowMapper(PatientVO.class));
        
                    if(plist.isEmpty()){
                        continue;
                    }else{
                        p = plist.get(0);
                    }
                }else{
                    continue;
                }
@ -3465,6 +3536,16 @@ public class SignPatientLabelInfoService extends BaseService {
                    // 缴费情况
                    json.put("expensesStatus", "1");
                }
                
                //病情类型:0健康,1高血压,2糖尿病,3高血压+糖尿病
                json.put("disease", p.getDisease());
                // 病情:0绿标,1黄标,2红标,
                json.put("diseaseCondition", p.getDiseaseCondition());
                //预警状态
                json.put("standardStatus", p.getStandardStatus());
                //设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
                json.put("deviceType",p.getDeviceType());
                
                boolean epTime = false;
                try {
                    epTime = redisTemplate.opsForSet().isMember("wechat:focus:remind:set", p.getCode());
@ -3520,9 +3601,23 @@ public class SignPatientLabelInfoService extends BaseService {
        if (signList != null && signList.size() > 0) {
            for (Map<String, Object> sign : signList) {
                Patient p = patientDao.findByCode(sign.get("patient") == null ? "" : sign.get("patient").toString());
                if (p == null) {
                PatientVO p = new PatientVO();
                List<PatientVO> plist = new ArrayList<>();
                if(sign.get("patient") != null){
                    String patientsql = "select a.*,b.deviceType as deviceType,c.disease as disease from wlyy_patient a" +
                            "  left join (select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on a.code = b.user" +
                            "  left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3 and status=1 " +
                            " and (label = 1 or label = 2) and patient = '"+sign.get("patient").toString()+"' GROUP BY patient) c on a.code = c.patient" +
                            " where a.status =1 and a.code = '"+sign.get("patient").toString()+"'";
        
                    plist = jdbcTemplate.query(patientsql,new BeanPropertyRowMapper(PatientVO.class));
        
                    if(plist.isEmpty()){
                        continue;
                    }else{
                        p = plist.get(0);
                    }
                }else{
                    continue;
                }
@ -3630,6 +3725,16 @@ public class SignPatientLabelInfoService extends BaseService {
                    // 缴费情况
                    json.put("expensesStatus", "1");
                }
    
                //病情类型:0健康,1高血压,2糖尿病,3高血压+糖尿病
                json.put("disease", p.getDisease());
                // 病情:0绿标,1黄标,2红标,
                json.put("diseaseCondition", p.getDiseaseCondition());
                //预警状态
                json.put("standardStatus", p.getStandardStatus());
                //设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
                json.put("deviceType",p.getDeviceType());
                
                boolean epTime = false;
                try {
                    epTime = redisTemplate.opsForSet().isMember("wechat:focus:remind:set", p.getCode());

+ 23 - 22
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/physicalExamination/PhysicalExaminationRemindService.java

@ -5,6 +5,7 @@ import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.PatientRemindRecords;
import com.yihu.wlyy.entity.patient.PatientTeamRemindRecord;
import com.yihu.wlyy.entity.patient.vo.PatientVO;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.PatientRemindRecordsDao;
@ -23,6 +24,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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;
@ -157,7 +159,6 @@ public class PhysicalExaminationRemindService extends BaseService {
        Map<String, JSONObject> result = new TreeMap<>();
        List<Map<String, Object>> signList = new ArrayList<>();
        Map<String, Object> patientDeviceTypeMap = new HashMap<>();//用于存储患者设备绑定情况
        int start = page * pagesize;
        String sql = "";
        Object[] args = null;
@ -167,6 +168,8 @@ public class PhysicalExaminationRemindService extends BaseService {
                "    DISTINCT t1.* " +
                " FROM " +
                "    wlyy_sign_family t1 " +
                "  LEFT JOIN wlyy_patient p on p.code = t1.patient  "+
                "  LEFT JOIN wlyy_sign_patient_label_info t2 on t2.patient = t1.patient "+
                " WHERE " +
                "     t1.status > 0 " +
                "    AND t1.admin_team_code = ? " +
@ -178,29 +181,32 @@ public class PhysicalExaminationRemindService extends BaseService {
                "                wlyy_old_people_physical_examination o" +
                "           WHERE s.admin_team_code=? and s.`status`>0 and s.idcard = o.id_card " +
                "                 and o.medical_time>?)" +
                " order by t1.openid desc,convert(t1.name using gbk) ";
                " order by p.standard_status DESC ,p.disease_condition DESC,t2.label DESC,t1.openid DESC";
        args = new Object[]{teamCode,doctor,doctor, teamCode, DateUtil.getLastYear()};
        sql = sql + " limit " + start + "," + pagesize;
        signList = jdbcTemplate.queryForList(sql, args);
        //查询患者设备绑定情况
        String _pdsql = "select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user";
        List<Map<String, Object>> patientCodeDeviceTypes = jdbcTemplate.queryForList(_pdsql);
        if (!patientCodeDeviceTypes.isEmpty()) {
            for (Map<String, Object> patientCodeDeviceType : patientCodeDeviceTypes) {
                String user = String.valueOf(patientCodeDeviceType.get("user"));
                String sum = String.valueOf(patientCodeDeviceType.get("deviceType"));
                patientDeviceTypeMap.put(user, sum);
            }
        }
        if (signList != null && signList.size() > 0) {
            for (Map<String, Object> sign : signList) {
                Patient p = patientDao.findByCode(sign.get("patient") == null ? "" : sign.get("patient").toString());
                if (p == null) {
                PatientVO p = new PatientVO();
                List<PatientVO> plist = new ArrayList<>();
                if(sign.get("patient") != null){
                    String patientsql = "select a.*,b.deviceType as deviceType,c.disease as disease from wlyy_patient a" +
                            "  left join (select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on a.code = b.user" +
                            "  left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3 and status=1 " +
                            " and (label = 1 or label = 2) and patient = '"+sign.get("patient").toString()+"' GROUP BY patient) c on a.code = c.patient" +
                            " where a.status =1 and a.code = '"+sign.get("patient").toString()+"'";
        
                    plist = jdbcTemplate.query(patientsql,new BeanPropertyRowMapper(PatientVO.class));
        
                    if(plist.isEmpty()){
                        continue;
                    }else{
                        p = plist.get(0);
                    }
                }else{
                    continue;
                }
@ -265,12 +271,7 @@ public class PhysicalExaminationRemindService extends BaseService {
                //预警状态
                json.put("standardStatus", p.getStandardStatus());
                //设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
                String deviceType = "";
                if (!patientDeviceTypeMap.isEmpty() && patientDeviceTypeMap.keySet().contains(p.getCode())) {
                    deviceType = (String) patientDeviceTypeMap.get(p.getCode());
                }
                json.put("deviceType", deviceType);
                json.put("deviceType",p.getDeviceType());
                boolean epTime = false;
                try {

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

@ -1886,10 +1886,11 @@ public class SignWebService extends BaseService {
    public JSONObject getOverDuePatients(String year, Long teamCode, String doctor, Integer page, Integer pageSize) {
        StringBuffer sql = new StringBuffer("SELECT IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age," +
                "t.patient code,t.idcard,t.name,t.mobile,t.openid,p.photo," +
                "t.ssc,t.type signType,p.sex ,t.expenses_status expensesStatus " +
                "t.ssc,t.type signType,p.sex ,t.expenses_status expensesStatus,c.disease " +
                " FROM wlyy_sign_family t " +
                " LEFT JOIN wlyy_patient p ON t.patient = p.code " +
                " WHERE t.doctor ='" + doctor + "' AND t.admin_team_code =" + teamCode + " AND t.sign_year ='" + year + "' AND t.status =-4 LIMIT " + page * pageSize + "," + pageSize);
                " LEFT JOIN (select patient,group_concat(label) disease,sum(label) lablesum from wlyy_sign_patient_label_info where label_type = 3 and status=1 GROUP BY patient) c on t.patient = c.patient " +
                " WHERE t.doctor ='" + doctor + "' AND t.admin_team_code =" + teamCode + " AND t.sign_year ='" + year + "' AND t.status =-4 order by p.standard_status DESC ,p.disease_condition DESC,c.lablesum DESC,p.openid DESC LIMIT " + page * pageSize + "," + pageSize);
        List<Map<String, Object>> rs = jdbcTemplate.queryForList(sql.toString());
        JSONObject json = new JSONObject();
        json.put("result", rs);

+ 3 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/PatientService.java

@ -12,6 +12,7 @@ import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.ServerLabelTree;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.patient.SignFamilyRenew;
import com.yihu.wlyy.entity.patient.vo.PatientVO;
import com.yihu.wlyy.entity.security.Token;
import com.yihu.wlyy.repository.doctor.DoctorAdminTeamDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
@ -30,6 +31,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@ -1097,4 +1099,5 @@ public class PatientService extends TokenService {
        }
        return true;
    }
}

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

@ -148,7 +148,7 @@ public class DoctorConsultMoviController extends BaseController {
	/**
	 * 结束视频咨询
	 * @param consult 咨询标识
	 * @param movi_finish 咨询标识
	 * @return
	 */
	@ApiOperation("结束视频咨询")

+ 23 - 9
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/DoctorPatientGroupController.java

@ -7,6 +7,7 @@ import com.yihu.wlyy.entity.doctor.team.sign.DoctorPatientGroupInfo;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeam;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.patient.vo.PatientVO;
import com.yihu.wlyy.repository.doctor.DoctorTeamDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.app.account.DoctorInfoService;
@ -605,7 +606,9 @@ public class DoctorPatientGroupController extends BaseController {
    @ApiOperation("患者信息查询接口")
    public String patient(String code, String jyStatus) {
        try {
            Patient temp = patientInfoService.findByCode(code);
        
//            Patient temp = patientInfoService.findByCode(code);
            PatientVO temp = patientInfoService.getPatientVOByCode(code);
            if (temp != null) {
                JSONObject json = new JSONObject();
                // 设置患者标识
@ -620,9 +623,9 @@ public class DoctorPatientGroupController extends BaseController {
                json.put("sex", temp.getSex());
                // 设置患者病情:0绿标,1黄标,2红标
                json.put("diseaseLevel", temp.getDiseaseCondition());
                // 疾病类型名称,0健康,1高血压,2糖尿病,3高血压+糖尿病
                // 疾病类型名称,0健康,1高血压,2糖尿病,(1,2)高血压+糖尿病
                json.put("diseaseName", getDiseaseName(temp.getDisease()));
                // 疾病类型,0健康,1高血压,2糖尿病,3高血压+糖尿病
                // 疾病类型,0健康,1高血压,2糖尿病,(1,2)高血压+糖尿病
                json.put("disease", temp.getDisease());
                // 设置患者身份证号
                json.put("idCard", temp.getIdcard());
@ -692,6 +695,15 @@ public class DoctorPatientGroupController extends BaseController {
                } else {
                    json.put("ssSign", "");
                }
    
                //病情类型:0健康,1高血压,2糖尿病,(1,2)高血压+糖尿病
                json.put("disease",temp.getDisease());
                // 病情:0绿标,1黄标,2红标,
                json.put("diseaseCondition",temp.getDiseaseCondition());
                //预警状态
                json.put("standardStatus",temp.getStandardStatus());
                //设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
                json.put("deviceType",temp.getDeviceType());
                return write(200, "患者信息查询成功!", "data", json);
            } else {
@ -1131,21 +1143,23 @@ public class DoctorPatientGroupController extends BaseController {
    }
    /**
     * 根据patient表的disease字段转换成相应的疾病类型 疾病类型,0健康,1高血压,2糖尿病,3高血压+糖尿病
     * 根据patient表的disease字段转换成相应的疾病类型 疾病类型,0健康,1高血压,2糖尿病,(1,2)高血压+糖尿病
     *
     * @return string
     */
    private String getDiseaseName(Integer disease) {
    private String getDiseaseName(String disease) {
        if (disease != null) {
            switch (disease) {
                case 0:
                case "0":
                    return "健康";
                case 1:
                case "1":
                    return "高血压";
                case 2:
                case "2":
                    return "糖尿病";
                case 3:
                case "1,2":
                    return "高血压+糖尿病";
                case "2,1":
                    return "高血压+糖尿病";
                default:

+ 3 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/PatientInfoController.java

@ -3,6 +3,7 @@ package com.yihu.wlyy.web.doctor.patient;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SocialSecurityInfo;
import com.yihu.wlyy.entity.patient.vo.PatientVO;
import com.yihu.wlyy.logs.BusinessLogs;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.SocialSecurityInfoDao;
@ -71,7 +72,8 @@ public class PatientInfoController extends BaseController {
    public String getPatient(String patient) {
        try {
            // 获取医生下的患者
            Patient temp = patientInfoService.findByCode(patient);
//            Patient temp = patientInfoService.findByCode(patient);
            PatientVO temp = patientInfoService.getPatientVOByCode(patient);
            return write(200, "获取患者信息成功!", "data", temp);
        } catch (Exception e) {
            error(e);