Commit 1a76459e6ca292bfc78226ea8fae2f99a8bb948a
1 parent
105ef40ee7
Exists in
master
and in
1 other branch
第二版优化内容
Showing 11 changed files with 116 additions and 52 deletions
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ChatGroupController.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/TkRecordController.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsTcardMapper.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsTkrecordMapper.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsTcardService.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsTkrecordService.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsTcardServiceImpl.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsTkrecordServiceImpl.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/PushChatInfoTask.java
- talkonlineweb/src/main/resources/mapper/LymsTcardMapper.xml
- talkonlineweb/src/main/resources/mapper/LymsTkrecordMapper.xml
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ChatGroupController.java
View file @
1a76459
| ... | ... | @@ -434,15 +434,17 @@ |
| 434 | 434 | * @return |
| 435 | 435 | */ |
| 436 | 436 | @GetMapping("getChatStat") |
| 437 | - @TokenRequired | |
| 437 | + //@TokenRequired | |
| 438 | 438 | public BaseResponse getChatStat(String groupId){ |
| 439 | 439 | BaseResponse baseResponse =new BaseResponse(); |
| 440 | 440 | try { |
| 441 | 441 | final LymsChatgroup chatgroup = lymsChatgroupService.getOne(new QueryWrapper<LymsChatgroup>() |
| 442 | 442 | .lambda().eq(LymsChatgroup::getHxgroupid, groupId)); |
| 443 | - final LymsTkrecord tkrecord = lymsTkrecordService.getOne(new QueryWrapper<LymsTkrecord>() | |
| 443 | + //应该查询这个组的最新tkrecord记录状态 | |
| 444 | + /*final LymsTkrecord tkrecord = lymsTkrecordService.getOne(new QueryWrapper<LymsTkrecord>() | |
| 444 | 445 | .lambda().eq(LymsTkrecord::getHxgroupid, groupId) |
| 445 | - .groupBy(LymsTkrecord::getHxgroupid)); | |
| 446 | + .groupBy(LymsTkrecord::getHxgroupid));*/ | |
| 447 | + final LymsTkrecord tkrecord = lymsTkrecordService.getLeastRecordByHxgroupId(groupId); | |
| 446 | 448 | Map<String,Object> map= new LinkedHashMap<>(); |
| 447 | 449 | map.put("groupStat",null==chatgroup?"":chatgroup.getStat()); |
| 448 | 450 | map.put("tkrecordStat",null==tkrecord?"":tkrecord.getStat()); |
| ... | ... | @@ -578,7 +580,8 @@ |
| 578 | 580 | tkrecord.setFid((byte) 1); |
| 579 | 581 | }else{ |
| 580 | 582 | baseResponse.setErrorcode(1); |
| 581 | - throw new RuntimeException("已经没有咨询卡,请联系客服购买!"); | |
| 583 | + baseResponse.setErrormsg("已经没有咨询卡,请联系客服购买!"); | |
| 584 | + return baseResponse; | |
| 582 | 585 | } |
| 583 | 586 | } |
| 584 | 587 | |
| ... | ... | @@ -588,6 +591,7 @@ |
| 588 | 591 | tkrecord.setDid(patientInfo.getDtid()); |
| 589 | 592 | tkrecord.setDid(patientInfo.getDtid()); |
| 590 | 593 | tkrecord.setHxgroupid(chatgroup.getHxgroupid()); |
| 594 | + tkrecord.setStat(0); | |
| 591 | 595 | tkrecord.setCreatedtime(new Date()); |
| 592 | 596 | final boolean save = lymsTkrecordService.save(tkrecord); |
| 593 | 597 | if (!save) { |
| 594 | 598 | |
| ... | ... | @@ -596,16 +600,12 @@ |
| 596 | 600 | throw new RuntimeException("回滚状态,执行失败,请联系管理员"); |
| 597 | 601 | } |
| 598 | 602 | //修改同一群组记录的状态 |
| 599 | - final List<LymsTkrecord> tkrecordList = lymsTkrecordService.list(new QueryWrapper<LymsTkrecord>() | |
| 603 | + /*final List<LymsTkrecord> tkrecordList = lymsTkrecordService.list(new QueryWrapper<LymsTkrecord>() | |
| 600 | 604 | .lambda().eq(LymsTkrecord::getHxgroupid, chatgroup.getHxgroupid())); |
| 601 | 605 | for (LymsTkrecord lymsTkrecord : tkrecordList) { |
| 602 | 606 | lymsTkrecord.setStat(0); |
| 603 | 607 | final boolean saveOrUpdate = lymsTkrecordService.updateById(lymsTkrecord); |
| 604 | - if (!saveOrUpdate) { | |
| 605 | - baseResponse.setErrorcode(1); | |
| 606 | - throw new RuntimeException("回滚状态,执行失败,请联系管理员"); | |
| 607 | - } | |
| 608 | - } | |
| 608 | + }*/ | |
| 609 | 609 | baseResponse.setErrorcode(0); |
| 610 | 610 | baseResponse.setErrormsg("成功"); |
| 611 | 611 | } catch (Exception e) { |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/TkRecordController.java
View file @
1a76459
| ... | ... | @@ -90,9 +90,14 @@ |
| 90 | 90 | .lambda().eq(LymsChatgroup::getPcid, tkrecord.getPcid())); |
| 91 | 91 | //之前有这个病例的问诊就不用新创建组 |
| 92 | 92 | if(gLst.size() > 0){ |
| 93 | - group=gLst.get(0); | |
| 93 | + group = gLst.get(0); | |
| 94 | 94 | tkrecord.setHxgroupid(group.getHxgroupid()); |
| 95 | 95 | lymsTkrecordService.save(tkrecord); |
| 96 | + //如果对应的聊天组已关闭,重新打开聊天组 | |
| 97 | + if(group.getStat() == 1){ | |
| 98 | + group.setStat(0); | |
| 99 | + lymsChatgroupService.updateById(group); | |
| 100 | + } | |
| 96 | 101 | baseResponse.setObject(group); |
| 97 | 102 | baseResponse.setErrormsg("成功"); |
| 98 | 103 | return baseResponse; |
| ... | ... | @@ -209,6 +214,23 @@ |
| 209 | 214 | } catch (Exception e) { |
| 210 | 215 | baseResponse.setErrormsg("失败"); |
| 211 | 216 | e.printStackTrace(); |
| 217 | + } | |
| 218 | + | |
| 219 | + return baseResponse; | |
| 220 | + } | |
| 221 | + @GetMapping("queryUnusedCardCount") | |
| 222 | + @TokenRequired | |
| 223 | + public BaseResponse queryTkCardCountBYPcid(Integer pcid){ | |
| 224 | + BaseResponse baseResponse=new BaseResponse(); | |
| 225 | + try { | |
| 226 | + LymsTcard card = new LymsTcard(); | |
| 227 | + card.setPcid(pcid); | |
| 228 | + Integer count = lymsTcardService.queryUnusedCount(card); | |
| 229 | + baseResponse.setObject(count == null ? 0 : count); | |
| 230 | + baseResponse.setErrormsg("成功"); | |
| 231 | + } catch (Exception e) { | |
| 232 | + baseResponse.setErrormsg("失败"); | |
| 233 | + log.error("查询未使用就诊卡数量异常",e); | |
| 212 | 234 | } |
| 213 | 235 | |
| 214 | 236 | return baseResponse; |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsTcardMapper.java
View file @
1a76459
talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsTkrecordMapper.java
View file @
1a76459
| ... | ... | @@ -2,6 +2,7 @@ |
| 2 | 2 | |
| 3 | 3 | import com.lyms.talkonlineweb.domain.LymsTkrecord; |
| 4 | 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| 5 | +import org.apache.ibatis.annotations.Param; | |
| 5 | 6 | |
| 6 | 7 | /** |
| 7 | 8 | * @Entity com.lyms.talkonlineweb.domain.LymsTkrecord |
| ... | ... | @@ -11,5 +12,8 @@ |
| 11 | 12 | * 批量修改未结束的聊天记录为结束 |
| 12 | 13 | */ |
| 13 | 14 | void batchUpdateStatEnd(); |
| 15 | + | |
| 16 | + LymsTkrecord getLeastRecordByHxgroupId(@Param("hxgroupId") String hxgroupId); | |
| 17 | + | |
| 14 | 18 | } |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsTcardService.java
View file @
1a76459
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsTkrecordService.java
View file @
1a76459
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsTcardServiceImpl.java
View file @
1a76459
| ... | ... | @@ -7,6 +7,7 @@ |
| 7 | 7 | import org.springframework.beans.factory.annotation.Autowired; |
| 8 | 8 | import org.springframework.stereotype.Service; |
| 9 | 9 | |
| 10 | +import javax.annotation.Resource; | |
| 10 | 11 | import java.util.List; |
| 11 | 12 | import java.util.Map; |
| 12 | 13 | |
| ... | ... | @@ -16,7 +17,7 @@ |
| 16 | 17 | @Service |
| 17 | 18 | public class LymsTcardServiceImpl extends ServiceImpl<LymsTcardMapper, LymsTcard> |
| 18 | 19 | implements LymsTcardService{ |
| 19 | - @Autowired | |
| 20 | + @Resource | |
| 20 | 21 | private LymsTcardMapper lymsTcardMapper; |
| 21 | 22 | |
| 22 | 23 | @Override |
| ... | ... | @@ -27,6 +28,11 @@ |
| 27 | 28 | @Override |
| 28 | 29 | public List<LymsTcard> queryUnused(LymsTcard lymsTcard) { |
| 29 | 30 | return lymsTcardMapper.queryUnused(lymsTcard); |
| 31 | + } | |
| 32 | + | |
| 33 | + @Override | |
| 34 | + public Integer queryUnusedCount(LymsTcard lymsTcard) { | |
| 35 | + return lymsTcardMapper.queryUnusedCount(lymsTcard); | |
| 30 | 36 | } |
| 31 | 37 | } |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsTkrecordServiceImpl.java
View file @
1a76459
| ... | ... | @@ -6,6 +6,8 @@ |
| 6 | 6 | import com.lyms.talkonlineweb.mapper.LymsTkrecordMapper; |
| 7 | 7 | import org.springframework.stereotype.Service; |
| 8 | 8 | |
| 9 | +import javax.annotation.Resource; | |
| 10 | + | |
| 9 | 11 | /** |
| 10 | 12 | * |
| 11 | 13 | */ |
| 12 | 14 | |
| ... | ... | @@ -13,9 +15,17 @@ |
| 13 | 15 | public class LymsTkrecordServiceImpl extends ServiceImpl<LymsTkrecordMapper, LymsTkrecord> |
| 14 | 16 | implements LymsTkrecordService{ |
| 15 | 17 | |
| 18 | + @Resource | |
| 19 | + LymsTkrecordMapper lymsTkrecordMapper; | |
| 20 | + | |
| 16 | 21 | @Override |
| 17 | 22 | public void batchUpdateStatEnd() { |
| 18 | 23 | |
| 24 | + } | |
| 25 | + | |
| 26 | + @Override | |
| 27 | + public LymsTkrecord getLeastRecordByHxgroupId(String hxgroupId) { | |
| 28 | + return lymsTkrecordMapper.getLeastRecordByHxgroupId(hxgroupId); | |
| 19 | 29 | } |
| 20 | 30 | } |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/PushChatInfoTask.java
View file @
1a76459
| ... | ... | @@ -82,8 +82,10 @@ |
| 82 | 82 | if(!on_off){ |
| 83 | 83 | return; |
| 84 | 84 | } |
| 85 | + log.info("自动回访功能定时任务,开始...."); | |
| 85 | 86 | //用户下的病例信息。每个环信群组代表一个病例,一个病例下有多个疾病种类。 |
| 86 | 87 | List<Map<String,Object>> PcInfoList=lymsPatientService.getPcInfoList(); |
| 88 | + log.info("自动回访功能定时任务,病例数size = {}",PcInfoList.size()); | |
| 87 | 89 | for (Map<String, Object> map : PcInfoList) { |
| 88 | 90 | |
| 89 | 91 | try { |
| ... | ... | @@ -96,6 +98,7 @@ |
| 96 | 98 | |
| 97 | 99 | //计算(自动回复周期上传病例后- 1:第二天2:第五天3:第十天4:第二十天5:第三十天) |
| 98 | 100 | int day = DateUtil.daysBetween(DateUtil.parseYMD(map.get("createdtime").toString()),new Date()); |
| 101 | + log.info("自动回访功能定时任务,pcid={},day={}",map.get("pcid"),day); | |
| 99 | 102 | switch (day) { |
| 100 | 103 | case 1: |
| 101 | 104 | getEverydayInfo(map,patient,doctor,0,1); |
| 102 | 105 | |
| 103 | 106 | |
| ... | ... | @@ -109,15 +112,16 @@ |
| 109 | 112 | case 19: |
| 110 | 113 | getEverydayInfo(map,patient,doctor,0,4); |
| 111 | 114 | break; |
| 112 | - case 20: | |
| 115 | + case 29: | |
| 113 | 116 | getEverydayInfo(map,patient,doctor,1,5); |
| 114 | 117 | break; |
| 115 | 118 | } |
| 116 | 119 | } catch (Exception e) { |
| 117 | - e.printStackTrace(); | |
| 120 | + log.error(e); | |
| 118 | 121 | } |
| 119 | 122 | |
| 120 | 123 | } |
| 124 | + log.info("自动回访功能定时任务,end....."); | |
| 121 | 125 | } |
| 122 | 126 | |
| 123 | 127 | /** |
| ... | ... | @@ -151,6 +155,7 @@ |
| 151 | 155 | }else { |
| 152 | 156 | doctor2=doctor; |
| 153 | 157 | } |
| 158 | + log.info("自动回访功能定时任务,pcid={},doctor={}",map.get("pcid"),doctor2); | |
| 154 | 159 | //环信群组 |
| 155 | 160 | LymsChatgroup chatgroup=null; |
| 156 | 161 | //病例下的疾病 |
| ... | ... | @@ -167,6 +172,7 @@ |
| 167 | 172 | chatgroup = lymsChatgroupService.getOne(new QueryWrapper<LymsChatgroup>() |
| 168 | 173 | .lambda().eq(LymsChatgroup::getPcid, (Integer)map.get("pcid"))); |
| 169 | 174 | if(null==chatgroup){ |
| 175 | + log.info("自动回访功能定时任务,pcid={},开始创建聊天组...",map.get("pcid")); | |
| 170 | 176 | //创建聊天群组 |
| 171 | 177 | List<String> adminDlogins=new ArrayList<>(); |
| 172 | 178 | adminDlogins.add(patient.getIdno()); |
| 173 | 179 | |
| 174 | 180 | |
| 175 | 181 | |
| ... | ... | @@ -174,46 +180,20 @@ |
| 174 | 180 | groupnames.add(patient.getPname()); |
| 175 | 181 | //患者注册环信 |
| 176 | 182 | if (StringUtil.isEmpty(patient.getHxid())) { |
| 177 | - JSONObject json = hxService.addUser(patient.getIdno(), Constant.COMMON_PASSWD, patient.getPname()); | |
| 178 | - JSONArray rArr = json.getJSONArray("entities"); | |
| 179 | - if (rArr.size() > 0) { | |
| 180 | - patient.setHxid(rArr.getJSONObject(0).getString("uuid")); | |
| 181 | - final boolean b = lymsPatientService.updateById(patient); | |
| 182 | - if (!b) { | |
| 183 | - throw new Exception("回滚状态,执行失败,请联系管理员"); | |
| 184 | - } | |
| 185 | - }else { | |
| 186 | - throw new Exception("回滚状态,执行失败,请联系管理员"); | |
| 187 | - } | |
| 183 | + lymsPatientService.addPatientHxId(patient); | |
| 188 | 184 | } |
| 189 | 185 | //科室值班医生注册环信 |
| 190 | 186 | for (LymsDoctor lymsDoctor : doctorAminList) { |
| 191 | 187 | if(StringUtil.isEmpty(lymsDoctor.getHxid())) { |
| 192 | - JSONObject json = hxService.addUser(lymsDoctor.getDlogin(), Constant.COMMON_PASSWD, lymsDoctor.getDname()); | |
| 193 | - JSONArray rArr = json.getJSONArray("entities"); | |
| 194 | - if (rArr.size() > 0) { | |
| 195 | - lymsDoctor.setHxid(rArr.getJSONObject(0).getString("uuid")); | |
| 196 | - final boolean b = lymsDoctorService.updateById(lymsDoctor); | |
| 197 | - if (!b) { | |
| 198 | - throw new Exception("回滚状态,执行失败,请联系管理员"); | |
| 199 | - } | |
| 200 | - } | |
| 188 | + lymsDoctorService.addDoctorHxId(lymsDoctor); | |
| 201 | 189 | } |
| 202 | 190 | adminDlogins.add(lymsDoctor.getDlogin()); |
| 203 | 191 | groupnames.add(lymsDoctor.getDname()); |
| 204 | 192 | } |
| 205 | - if ( ! adminDlogins.contains(doctor.getDlogin())) { | |
| 193 | + if (!adminDlogins.contains(doctor.getDlogin())) { | |
| 206 | 194 | //医生注册环信 |
| 207 | 195 | if (StringUtil.isEmpty(doctor.getHxid())) { |
| 208 | - JSONObject json = hxService.addUser(doctor.getDlogin(), Constant.COMMON_PASSWD, doctor.getDname()); | |
| 209 | - JSONArray rArr = json.getJSONArray("entities"); | |
| 210 | - if (rArr.size() > 0) { | |
| 211 | - doctor.setHxid(rArr.getJSONObject(0).getString("uuid")); | |
| 212 | - final boolean b = lymsDoctorService.updateById(doctor); | |
| 213 | - if (!b) { | |
| 214 | - throw new Exception("回滚状态,执行失败,请联系管理员"); | |
| 215 | - } | |
| 216 | - } | |
| 196 | + lymsDoctorService.addDoctorHxId(doctor); | |
| 217 | 197 | } |
| 218 | 198 | adminDlogins.add(doctor.getDlogin()); |
| 219 | 199 | groupnames.add(doctor.getDname()); |
| 220 | 200 | |
| ... | ... | @@ -236,8 +216,10 @@ |
| 236 | 216 | } |
| 237 | 217 | chatgroup=group; |
| 238 | 218 | } |
| 219 | + log.info("自动回访功能定时任务,pcid={},chatgroup={}",map.get("pcid"),chatgroup); | |
| 239 | 220 | //推送回访消息和保存发送记录 |
| 240 | 221 | JSONObject jsonObject = hxService.sendGroupMsg(new String[]{chatgroup.getHxgroupid()}, chatInfo.getConten(), doctor2.getDlogin()); |
| 222 | + log.info("自动回访功能定时任务,pcid={},推送回访消息返回值={}",map.get("pcid"),jsonObject); | |
| 241 | 223 | if (null!=jsonObject) { |
| 242 | 224 | //保存发送消息记录 |
| 243 | 225 | LymsMessage message=new LymsMessage(); |
| 244 | 226 | |
| ... | ... | @@ -249,10 +231,10 @@ |
| 249 | 231 | message.setType(1); |
| 250 | 232 | final boolean save = lymsMessageService.save(message); |
| 251 | 233 | if (! save) { |
| 252 | - throw new Exception("回滚状态,执行失败,请联系管理员"); | |
| 234 | + throw new Exception("自动回访功能定时任务,执行失败,请联系管理员"); | |
| 253 | 235 | } |
| 254 | 236 | }else { |
| 255 | - throw new Exception("回滚状态,执行失败,请联系管理员"); | |
| 237 | + throw new Exception("自动回访功能定时任务,执行失败,请联系管理员"); | |
| 256 | 238 | } |
| 257 | 239 | //同时推送公众号消息 |
| 258 | 240 | Map<String,Object> mapTemplate=new HashMap<>(); |
| ... | ... | @@ -277,7 +259,7 @@ |
| 277 | 259 | lymsPushVisitRecord.setRemark("推送短消息-> " + VisitEnum.getName(chatInfo.getType())+" - "+patient.getPname()+" ;回访医生:"+doctor2.getDname()+";疾病名称:"+ lymsIllness.getIname() + "; [ "+(lymsPushVisitRecord.getState()==1?"成功":"失败")+"]; code:" + code); |
| 278 | 260 | lymsPushVisitRecordService.save(lymsPushVisitRecord); |
| 279 | 261 | }else { |
| 280 | - throw new Exception("回滚操作,没有疾病话术。"); | |
| 262 | + throw new Exception("自动回访功能定时任务,执行失败,没有疾病话术。"); | |
| 281 | 263 | } |
| 282 | 264 | } |
| 283 | 265 | //增加回访记录,修改环信群组状态,修改问诊记录状态 |
| 284 | 266 | |
| ... | ... | @@ -285,9 +267,11 @@ |
| 285 | 267 | returnVisitRecord.setDlogin(doctor2.getDlogin()); |
| 286 | 268 | returnVisitRecord.setDpid(doctor2.getDpid()); |
| 287 | 269 | returnVisitRecord.setIdno(patient.getIdno()); |
| 270 | + //0 自动回访 1 医生回访 | |
| 288 | 271 | returnVisitRecord.setType(0); |
| 289 | 272 | returnVisitRecord.setHxgroupid(chatgroup.getHxgroupid()); |
| 290 | 273 | returnVisitRecord.setPcid(chatgroup.getPcid()); |
| 274 | + returnVisitRecord.setCreatedtime(new Date()); | |
| 291 | 275 | final boolean save = lymsReturnVisitRecordService.save(returnVisitRecord); |
| 292 | 276 | if (!save) { |
| 293 | 277 | throw new Exception("回滚状态,执行失败,请联系管理员"); |
| ... | ... | @@ -299,7 +283,7 @@ |
| 299 | 283 | throw new Exception("回滚状态,执行失败,请联系管理员"); |
| 300 | 284 | } |
| 301 | 285 | //修改同一群组记录的状态 |
| 302 | - final List<LymsTkrecord> tkrecordList = lymsTkrecordService.list(new QueryWrapper<LymsTkrecord>() | |
| 286 | + /*final List<LymsTkrecord> tkrecordList = lymsTkrecordService.list(new QueryWrapper<LymsTkrecord>() | |
| 303 | 287 | .lambda().eq(LymsTkrecord::getHxgroupid, chatgroup.getHxgroupid())); |
| 304 | 288 | for (LymsTkrecord lymsTkrecord : tkrecordList) { |
| 305 | 289 | lymsTkrecord.setStat(0); |
| 306 | 290 | |
| ... | ... | @@ -307,10 +291,9 @@ |
| 307 | 291 | if (!saveOrUpdate) { |
| 308 | 292 | throw new Exception("回滚状态,执行失败,请联系管理员"); |
| 309 | 293 | } |
| 310 | - } | |
| 294 | + }*/ | |
| 311 | 295 | } catch (Exception e) { |
| 312 | - e.printStackTrace(); | |
| 313 | - throw new Exception("回滚状态,执行失败,请联系管理员"); | |
| 296 | + log.error(e); | |
| 314 | 297 | } |
| 315 | 298 | } |
| 316 | 299 |
talkonlineweb/src/main/resources/mapper/LymsTcardMapper.xml
View file @
1a76459
| ... | ... | @@ -42,5 +42,24 @@ |
| 42 | 42 | card.fid desc,card.createdtime ASC |
| 43 | 43 | |
| 44 | 44 | </select> |
| 45 | + | |
| 46 | + <select id="queryUnusedCount" parameterType="com.lyms.talkonlineweb.domain.LymsTcard" resultType="java.lang.Integer"> | |
| 47 | + | |
| 48 | + select | |
| 49 | + count(1) | |
| 50 | + from lyms_tcard card | |
| 51 | + where 1 = 1 | |
| 52 | + <if test="pid != null"> | |
| 53 | + and card.pid = #{pid} | |
| 54 | + </if> | |
| 55 | + <if test="pcid != null"> | |
| 56 | + and card.pcid = #{pcid} | |
| 57 | + </if> | |
| 58 | + <if test="fid != null"> | |
| 59 | + and card.fid = #{fid} | |
| 60 | + </if> | |
| 61 | + and not EXISTS ( SELECT r.cid FROM lyms_tkrecord r where r.cid = card.id ) | |
| 62 | + | |
| 63 | + </select> | |
| 45 | 64 | </mapper> |
talkonlineweb/src/main/resources/mapper/LymsTkrecordMapper.xml
View file @
1a76459
| ... | ... | @@ -12,6 +12,7 @@ |
| 12 | 12 | <result property="cid" column="cid" jdbcType="INTEGER"/> |
| 13 | 13 | <result property="fid" column="fid" jdbcType="TINYINT"/> |
| 14 | 14 | <result property="stat" column="stat" jdbcType="INTEGER"/> |
| 15 | + <result property="hxgroupid" column="hxgroupid" jdbcType="VARCHAR"/> | |
| 15 | 16 | <result property="createdby" column="createdby" jdbcType="INTEGER"/> |
| 16 | 17 | <result property="createdtime" column="createdtime" jdbcType="TIMESTAMP"/> |
| 17 | 18 | <result property="updatedby" column="updatedby" jdbcType="INTEGER"/> |
| ... | ... | @@ -21,7 +22,7 @@ |
| 21 | 22 | <sql id="Base_Column_List"> |
| 22 | 23 | id,pid,pcid, |
| 23 | 24 | did,cid,fid, |
| 24 | - stat,createdby,createdtime, | |
| 25 | + stat,hxgroupid,createdby,createdtime, | |
| 25 | 26 | updatedby,updatedtime |
| 26 | 27 | </sql> |
| 27 | 28 | |
| ... | ... | @@ -30,5 +31,13 @@ |
| 30 | 31 | set stat = 1 |
| 31 | 32 | where stat = 0 |
| 32 | 33 | </update> |
| 34 | + | |
| 35 | + <select id="getLeastRecordByHxgroupId" parameterType="java.lang.String" resultMap="BaseResultMap"> | |
| 36 | + select | |
| 37 | + <include refid="Base_Column_List"></include> | |
| 38 | + from lyms_tkrecord where hxgroupid =#{hxgroupId} | |
| 39 | + order by createdtime desc | |
| 40 | + limit 1 | |
| 41 | + </select> | |
| 33 | 42 | </mapper> |