Browse Source

修复搜索时患者变量使用错误

Sand 8 years ago
parent
commit
bf4d046cdc
2 changed files with 8 additions and 8 deletions
  1. 1 1
      src/doctor/models/search.js
  2. 7 7
      src/doctor/repository/search.repo.js

+ 1 - 1
src/doctor/models/search.js

@ -60,7 +60,7 @@ class Search extends BaseModel{
                        lastPatient.code = chat.code;
                        lastPatient.name = chat.name;
                        lastPatient.sex = chat.sex;
                        lastPatient.birthday = objectUtil.timestampToLong(patient.birthday);
                        lastPatient.birthday = objectUtil.timestampToLong(chat.birthday);
                        lastPatient.avatar = chat.photo === null ? "" : chat.photo;
                        data.chats.push(lastPatient);

+ 7 - 7
src/doctor/repository/search.repo.js

@ -3,13 +3,13 @@
 */
"use strict";
var imRepo = require('./database/im.db.js');
let imRepo = require('./database/im.db.js');
/**
 * 搜索与医生签约过的患者,条件:患者姓名。
 */
module.exports.searchPatients = function (userId, userRole, keyword, handler) {
    var sql = "SELECT p.code, p.name, p.birthday, p.sex, p.photo " +
    let sql = "SELECT p.code, p.name, p.birthday, p.sex, p.photo " +
        "FROM wlyy.wlyy_sign_family f, wlyy.wlyy_patient p " +
        "WHERE f.patient = p.code AND p.name LIKE ? ";
@ -32,7 +32,7 @@ module.exports.searchPatients = function (userId, userRole, keyword, handler) {
 * 搜索与患者的私信。
 */
module.exports.searchPatientPM = function (userId, keyword, handler) {
    var sql = "SELECT p.code, p.name, p.birthday, p.sex, p.photo, m.msg_id, m.content " +
    let sql = "SELECT p.code, p.name, p.birthday, p.sex, p.photo, m.msg_id, m.content " +
        "FROM (SELECT CASE WHEN msg.from_uid = ? THEN msg.to_uid ELSE msg.from_uid END peer_id, msg.msg_id, msg.content " +
        "      FROM msg_p2p msg " +
        "      WHERE (msg.from_uid = ? OR msg.to_uid = ?) AND msg.content LIKE ? AND type = 1) m, wlyy.wlyy_patient p " +
@ -49,7 +49,7 @@ module.exports.searchPatientPM = function (userId, keyword, handler) {
 * 搜索聊天过的医生及行政团队内成员,条件:医生姓名。
 */
module.exports.searchDoctors = function (userId, keyword, handler) {
    var sql = "SELECT DISTINCT d.code, d.name, d.photo, d.hospital " +
    let sql = "SELECT DISTINCT d.code, d.name, d.photo, d.hospital " +
        "FROM msg_statistic ms, wlyy.wlyy_doctor d " +
        "WHERE d.code = ? AND ms.from_gid IS NULL AND (ms.peer_uid = d.code OR ms.uid = d.code) AND d.name like ?" +
        "UNION " +
@ -68,7 +68,7 @@ module.exports.searchDoctors = function (userId, keyword, handler) {
 * 搜索医生消息内容。
 */
module.exports.searchDoctorMessages = function (userId, keyword, handler) {
    var sql = "SELECT d.code, d.name, d.photo, m.msg_id, m.content " +
    let sql = "SELECT d.code, d.name, d.photo, m.msg_id, m.content " +
        "FROM (SELECT CASE WHEN msg.from_uid = ? THEN msg.to_uid ELSE msg.from_uid END peer_id, msg.msg_id, msg.content " +
        "      FROM msg_p2p msg " +
        "      WHERE (msg.from_uid = ? OR msg.to_uid = ?) AND msg.content LIKE ? AND type = 1) m, wlyy.wlyy_doctor d " +
@ -85,7 +85,7 @@ module.exports.searchDoctorMessages = function (userId, keyword, handler) {
 * 搜索医生的讨论组,使用名称。
 */
module.exports.searchGroups = function (userId, keyword, handler) {
    var sql = "SELECT g.code, g.name, m.member_code, m.member_name " +
    let sql = "SELECT g.code, g.name, m.member_code, m.member_name " +
        "FROM wlyy.wlyy_talk_group g left join wlyy.wlyy_talk_group_member m on g.code = m.group_code " +
        "WHERE g.name like ? OR m.member_name LIKE ? AND m.member_code = ?";
@ -100,7 +100,7 @@ module.exports.searchGroups = function (userId, keyword, handler) {
 * 搜索医生的讨论组消息,使用消息内容。
 */
module.exports.searchGroupMessages = function (userId, keyword, handler) {
    var sql = "SELECT g.code, g.name, gm.msg_id, gm.content FROM msg_group gm, " +
    let sql = "SELECT g.code, g.name, gm.msg_id, gm.content FROM msg_group gm, " +
        "   (SELECT t.id code, t.name name " +
        "    FROM wlyy.wlyy_admin_team t, wlyy.wlyy_admin_team_member m " +
        "    WHERE m.doctor_code = ? AND t.id = m.team_id " +