Browse Source

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

trick9191 7 years ago
parent
commit
cabfd44fa6

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

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

+ 14 - 14
patient-co-service/wlyy_service/src/main/resources/system.properties

@ -1,20 +1,20 @@
###基卫测试环境服务
gateway_url = http://117.25.173.18:18280/
gateway_licence = 5YGl5bq45LmL7Lev
gateway_public_key = PublicKeyTest.key
jw_hospital = 350211B1013
jw_licence = 5YGl5bq45LmL7Lev
ca_url = http://117.29.183.114:8081/XMCAService?wsdl
ca_namespace = http://platfomservice.xmca.com/
#gateway_url = http://117.25.173.18:18280/
#gateway_licence = 5YGl5bq45LmL7Lev
#gateway_public_key = PublicKeyTest.key
#jw_hospital = 350211B1013
#jw_licence = 5YGl5bq45LmL7Lev
#ca_url = http://117.29.183.114:8081/XMCAService?wsdl
#ca_namespace = http://platfomservice.xmca.com/
##基卫服务
guahao_url =  http://10.95.18.10/urp.service/urp.open.service/ReservationPulic.asmx
guahao_namespace = http://www.zysoft.com.cn/
#gateway_url = http://10.95.21.21:18280/
#gateway_licence = 5YGl5bq45LmL7Lev
#gateway_public_key = PublicGov.key
#jw_hospital = 350211B1004
#jw_licence = 5YGl5bq35LmL6LevMzUwMjExQjEwMDQ=
#ca_url = http://10.95.21.21:18280/base/XMCA6_UnifiedCallInterface
#ca_namespace = http://platfomservice.xmca.com/
gateway_url = http://10.95.21.21:18280/
gateway_licence = 5YGl5bq45LmL7Lev
gateway_public_key = PublicGov.key
jw_hospital = 350211B1004
jw_licence = 5YGl5bq35LmL6LevMzUwMjExQjEwMDQ=
ca_url = http://10.95.21.21:18280/base/XMCA6_UnifiedCallInterface
ca_namespace = http://platfomservice.xmca.com/

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

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

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

@ -20,7 +20,7 @@ import java.util.List;
public interface MessageDao extends PagingAndSortingRepository<Message, Long>, JpaSpecificationExecutor<Message> {
    @Query("select count(1) from Message a where a.type =1 and a.read= 1 and a.receiver=?1 ")
    @Query("select count(1) from Message a where a.type in(1,101) and a.read= 1 and a.receiver=?1 ")
    Integer amountUnreadByReceiver(String doctor);
    @Query("select a from Message a where a.type =1 and a.read= 1 and a.receiver=?1 order by a.czrq desc")

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

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

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

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

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

@ -615,4 +615,12 @@ public class MessageService extends BaseService {
        return re==1;
    }
    public String setMessageRead(Long messid){
        Message mess = messageDao.findOne(messid);
        mess.setRead(0);
        mess.setOver("0");
        messageDao.save(mess);
        return "1";
    }
}

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

@ -60,6 +60,7 @@ import org.springside.modules.persistence.DynamicSpecifications;
import org.springside.modules.persistence.SearchFilter;
import org.springside.modules.persistence.SearchFilter.Operator;
import javax.persistence.criteria.CriteriaBuilder;
import java.text.SimpleDateFormat;
import java.util.*;
@ -170,7 +171,7 @@ public class FamilyContractService extends BaseService {
    public SignFamily findSignFamilyByCode(String code) {
        return signFamilyDao.findByCodeAndType(code, 2);
        return signFamilyDao.findByCode(code);
    }
    public SignFamily findByPatientByType(String patient, int type) {
@ -812,6 +813,7 @@ public class FamilyContractService extends BaseService {
        }
        if (sf != null) {
            sf.setStatus(-1);
            sf.setPatientApplyUnsignDate(new Date());
        } else {
            return -2;
        }
@ -823,9 +825,32 @@ public class FamilyContractService extends BaseService {
                if (message != null) {
                    message.setRead(0);
                    message.setOver("0");
                    messageDao.save(message);
                }
            }
        }
        Patient p = patientDao.findByCode(patient);
        // 添加取消签约消息
        Message message = new Message();
        message.setCzrq(new Date());
        message.setCreateTime(new Date());
        message.setContent("您有一条新的家庭签约取消通知!");
        message.setRead(1);//设置未读
        message.setReceiver(doctor);//设置接受医生的code
        message.setSender(patient);//设置发送的用户
        message.setSenderName(p.getName());
        message.setCode(getCode());
        message.setSenderPhoto(p.getPhoto());
        message.setTitle("家庭签约取消通知");
        message.setType(101);//家庭签约取消信息
        message.setReadonly(1);//是否只读消息
        message.setSex(p.getSex());
        message.setOver("1");//未处理
        message.setData(sf.getCode());
        messageDao.save(message);
        return 200;
    }
@ -839,19 +864,12 @@ public class FamilyContractService extends BaseService {
     */
    public int unsignRenew(String patient, String doctor) throws Exception {
        if (4 < DateUtil.getNowMonth() && DateUtil.getNowMonth() < 7) {
            SignFamilyRenew sf = signFamilyRenewDao.findByDoctorPatient(doctor, patient);
            if (sf != null && sf.getStatus() != 0 && sf.getStatus() != 2) {
                return -2;
            }
            sf.setStatus(-1);
        } else {
            SignFamily sf = signFamilyDao.findByDoctorPatient(doctor, patient);
            if (sf != null && sf.getStatus() != 0 && sf.getStatus() != 2) {
                return -2;
            }
            sf.setStatus(-1);
        SignFamily sf = signFamilyDao.findByDoctorPatient(doctor, patient);
        if (sf != null && sf.getStatus() != 0 && sf.getStatus() != 2) {
            return -2;
        }
        sf.setStatus(-1);
        sf.setPatientApplyUnsignDate(new Date());
        //结束与医生所有消息
        List<Message> messages = messageDao.findByPatientRenew(patient, doctor);
@ -867,6 +885,27 @@ public class FamilyContractService extends BaseService {
            }
        }
        Patient p = patientDao.findByCode(patient);
        // 添加取消签约消息
        Message message = new Message();
        message.setCzrq(new Date());
        message.setCreateTime(new Date());
        message.setContent("您有一条新的家庭签约取消通知!");
        message.setRead(1);//设置未读
        message.setReceiver(doctor);//设置接受医生的code
        message.setSender(patient);//设置发送的用户
        message.setSenderName(p.getName());
        message.setCode(getCode());
        message.setSenderPhoto(p.getPhoto());
        message.setTitle("家庭签约取消通知");
        message.setType(101);//家庭签约取消信息
        message.setReadonly(1);//是否只读消息
        message.setSex(p.getSex());
        message.setOver("1");//未处理
        message.setData(sf.getCode());
        messageDao.save(message);
        return 200;
    }
@ -1862,6 +1901,48 @@ public class FamilyContractService extends BaseService {
        return messageDao.findAll(spec, pageRequest);
    }
    public List<Map<String,Object>> findSignMesByDoctor(String doctor,Long id,int pagesize){
        if (pagesize <= 0) {
            pagesize = 10;
        }
        String sql = "SELECT m.id," +
                "   m.code, " +
                "   m.receiver," +
                "   m.sender," +
                "   m.data AS signCode," +
                "   m.title," +
                "   m.content AS message," +
                "   m.type," +
                "   m.platform," +
                "   m.state," +
                "   m.has_read AS 'read'," +
                "   m.readonly," +
                "   m.czrq," +
                "   m.del," +
                "   m.over AS status," +
                "   m.value1," +
                "   m.value2," +
                "   m.sign_status AS signStatus," +
                "   m.receiver_name AS receiverName," +
                "   m.sender_photo AS senderPhoto," +
                "   m.sender_name AS senderName," +
                "   m.reason," +
                "   m.sex," +
                "   m.relation_code AS relationCode," +
                "   m.create_time AS createTime " +
                " FROM wlyy_message m " +
                " WHERE m.receiver ='"+doctor+"'  " +
                " AND m.over = '1' " +
                " AND m.has_read =1 " +
                " AND m.type IN (1,101) ";
        if (id > 0) {
            sql +=" AND id >"+id;
        }
        sql += " ORDER BY m.id DESC LIMIT 0,"+pagesize;
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        return list;
    }
    /**
     * 查询已签约总数
     *
@ -3261,7 +3342,8 @@ public class FamilyContractService extends BaseService {
                    "  sp.id labelid, " +
                    " CASE WHEN sp.label_name is null THEN '未标注' WHEN sp.label_name='' THEN '未标注' else sp.label_name END labelname, " +
                    "  sp.label_type labeltype, " +
                    "  p.idcard idcard " +
                    "  p.idcard idcard ," +
                    "  p.openid" +
                    " FROM " +
                    " wlyy_sign_family sf " +
                    " JOIN wlyy_patient p ON sf.patient = p.CODE " +
@ -3964,8 +4046,13 @@ public class FamilyContractService extends BaseService {
                " f.patient, " +
                " f.sign_year, " +
                " t.server_type AS serverType, " +
                " t.server_type_name AS specialPopulation " +
                "FROM " +
                " t.server_type_name AS specialPopulation," +
                " p.name," +
                " p.sex," +
                " IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age," +
                " p.photo," +
                " CASE WHEN p.openid is null THEN '0' WHEN p.openid='' THEN '0' else 1 END hasopenid" +
                " FROM " +
                " wlyy_sign_family_server t, " +
                " ( " +
                "  SELECT " +
@ -3978,9 +4065,11 @@ public class FamilyContractService extends BaseService {
                "   s.`status` >= 0 " +
                "  AND s.admin_team_code = " + teamCode +
                "  AND s.doctor_health IS NULL " +
                " ) f " +
                "WHERE " +
                " t.sign_code = f. CODE ";
                " ) f," +
                " wlyy_patient p " +
                " WHERE " +
                " t.sign_code = f. CODE AND " +
                " p.code = f.patient ";
        List<Map<String, Object>> patientList = jdbcTemplate.queryForList(patientSql);
        String totalSql = " SELECT " +
                " s.patient" +
@ -4000,19 +4089,17 @@ public class FamilyContractService extends BaseService {
            if (patientList != null) {
                for (Map<String, Object> map : serlist) {
                    String labelCode = (String) map.get("labelCode");
                    List<Map<String, String>> codes = new ArrayList<>();
                    List<Map<String, Object>> codes = new ArrayList<>();
                    Iterator iterator = patientList.iterator();
                    while (iterator.hasNext()) {
                        Map<String, Object> p = (Map<String, Object>) iterator.next();
                        String serverType = p.get("serverType") == null ? "" : ((String) p.get("serverType"));
                        if (labelCode.equals(serverType)) {
                            Map<String, String> code = new HashMap<>();
                            code.put("code", (String) p.get("patient"));
                            codes.add(code);
                            codes.add(p);
                            iterator.remove();
                        }
                    }
                    map.put("codes", codes);
                    map.put("ps", codes);
                    map.put("number", (codes != null && codes.size() > 0) ? codes.size() : 0);
                }
            }
@ -4024,9 +4111,14 @@ public class FamilyContractService extends BaseService {
    public JSONObject getCountryPatientList(Long teamCode) {
        String totalSql = " SELECT " +
                " s.patient,ifnull(s.sick_village,0) as labelCode" +
                " s.patient,ifnull(s.sick_village,0) as labelCode," +
                " p.name," +
                " p.sex," +
                " IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age," +
                " p.photo," +
                " CASE WHEN p.openid is null THEN '0' WHEN p.openid='' THEN '0' else 1 END hasopenid " +
                " FROM " +
                " wlyy_sign_family s " +
                " wlyy_sign_family s JOIN  wlyy_patient p ON p.code = s.patient" +
                " WHERE " +
                " s.`status` >= 0 " +
                " AND s.admin_team_code = ? " +
@ -4054,19 +4146,17 @@ public class FamilyContractService extends BaseService {
            for (Map<String, Object> map : patientList) {
                String labelCode = (String) map.get("labelCode");
                if (StringUtils.isNotBlank(labelCode)) {
                    List<Map<String, String>> codes = new ArrayList<>();
                    List<Map<String, Object>> codes = new ArrayList<>();
                    Iterator iterator = totalList.iterator();
                    while (iterator.hasNext()) {
                        Map<String, Object> p = (Map<String, Object>) iterator.next();
                        String lbCode = p.get("labelCode") == null ? "" : ((String) p.get("labelCode"));
                        if (labelCode.equals(lbCode)) {
                            Map<String, String> code = new HashMap<>();
                            code.put("code", (String) p.get("patient"));
                            codes.add(code);
                            codes.add(p);
                            iterator.remove();
                        }
                    }
                    map.put("codes", codes);
                    map.put("ps", codes);
                }
            }
        }
@ -4076,9 +4166,14 @@ public class FamilyContractService extends BaseService {
    public JSONObject getTeamCountryPatientChangeDoctorList(Long teamCode, String level, String oldDoctorCode) {
        String totalSql = " SELECT " +
                " s.patient,ifnull(s.sick_village,0) as labelCode" +
                " s.patient,ifnull(s.sick_village,0) as labelCode," +
                " p.name," +
                " p.sex," +
                " IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age," +
                " p.photo," +
                " CASE WHEN p.openid is null THEN '0' WHEN p.openid='' THEN '0' else 1 END hasopenid" +
                " FROM " +
                " wlyy_sign_family s " +
                " wlyy_sign_family s JOIN wlyy_patient p ON p.code = s.patient" +
                " WHERE " +
                " s.`status` >= 0 " +
                " AND s.admin_team_code = ? ";
@ -4095,7 +4190,7 @@ public class FamilyContractService extends BaseService {
                " f.sick_village_name AS label, " +
                " COUNT(1) AS number " +
                " FROM " +
                " wlyy_sign_family f " +
                " wlyy_sign_family f JOIN wlyy" +
                " WHERE " +
                " f.`status` >= 0 " +
                " AND f.sick_village IS NOT NULL " +
@ -4114,19 +4209,17 @@ public class FamilyContractService extends BaseService {
            for (Map<String, Object> map : patientList) {
                String labelCode = (String) map.get("labelCode");
                if (StringUtils.isNotBlank(labelCode)) {
                    List<Map<String, String>> codes = new ArrayList<>();
                    List<Map<String, Object>> codes = new ArrayList<>();
                    Iterator iterator = totalList.iterator();
                    while (iterator.hasNext()) {
                        Map<String, Object> p = (Map<String, Object>) iterator.next();
                        String lbCode = p.get("labelCode") == null ? "" : ((String) p.get("labelCode"));
                        if (labelCode.equals(lbCode)) {
                            Map<String, String> code = new HashMap<>();
                            code.put("code", (String) p.get("patient"));
                            codes.add(code);
                            codes.add(p);
                            iterator.remove();
                        }
                    }
                    map.put("codes", codes);
                    map.put("ps", codes);
                }
            }
        }
@ -4148,7 +4241,12 @@ public class FamilyContractService extends BaseService {
        String patientSql = "SELECT  " +
                " f.patient, " +
                " s.server_type AS serverType, " +
                " s.server_type_name AS serverTypeName " +
                " s.server_type_name AS serverTypeName, " +
                " p.name," +
                " p.sex," +
                " IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age," +
                " p.photo," +
                " CASE WHEN p.openid is null THEN '0' WHEN p.openid='' THEN '0' else 1 END hasopenid " +
                " FROM  " +
                " wlyy_sign_family_server s, " +
                "( " +
@ -4166,7 +4264,7 @@ public class FamilyContractService extends BaseService {
        } else {
            patientSql = patientSql + " AND s.doctor_health ='" + oldDoctorCode + "'";
        }
        patientSql = patientSql + " ) f WHERE f.`code` =s.sign_code";
        patientSql = patientSql + " ) f,wlyy_patient p WHERE f.`code` =s.sign_code AND p.code = f.patient";
        List<Map<String, Object>> patientList = jdbcTemplate.queryForList(patientSql);
        String totalSql = " SELECT " +
@ -4192,19 +4290,17 @@ public class FamilyContractService extends BaseService {
            if (patientList != null) {
                for (Map<String, Object> map : serlist) {
                    String labelCode = (String) map.get("labelCode");
                    List<Map<String, String>> codes = new ArrayList<>();
                    List<Map<String, Object>> codes = new ArrayList<>();
                    Iterator iterator = patientList.iterator();
                    while (iterator.hasNext()) {
                        Map<String, Object> p = (Map<String, Object>) iterator.next();
                        String serverType = p.get("serverType") == null ? "" : ((String) p.get("serverType"));
                        if (labelCode.equals(serverType)) {
                            Map<String, String> code = new HashMap<>();
                            code.put("code", (String) p.get("patient"));
                            codes.add(code);
                            codes.add(p);
                            iterator.remove();
                        }
                    }
                    map.put("codes", codes);
                    map.put("ps", codes);
                    map.put("number", (codes != null && codes.size() > 0) ? codes.size() : 0);
                }
            }

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

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