瀏覽代碼

feat:新增小程序医生端

lsw 9 月之前
父節點
當前提交
7a18a92e5b

+ 0 - 1
admin-ui/src/views/work/knowledge/index.vue

@@ -62,7 +62,6 @@ export default {
         pageSize: 10,
         type: null,
         title: null,
-        deptId: this.$store.state.user.deptId,
         orderByColumn: 'id', //排序字段
         isAsc: 'desc' //排序方式
       }

+ 1 - 0
app/common/common.scss

@@ -409,6 +409,7 @@
 			}
 			.edit{
 				float: right;
+				color: $main-color;
 			}
 			.del {
 				color: red;

+ 1 - 15
app/pages.json

@@ -167,17 +167,10 @@
 			}
 		},
 		{
-			"path" : "pages/follow/doctor/remind",
-			"style" : 
-			{
-				"navigationBarTitleText" : "复诊提醒"
-			}
-		},
-		{
 			"path" : "pages/follow/doctor/add",
 			"style" : 
 			{
-				"navigationBarTitleText" : "新增随访"
+				"navigationBarTitleText" : "新增"
 			}
 		},
 		{
@@ -186,13 +179,6 @@
 			{
 				"navigationBarTitleText" : "选择患者"
 			}
-		},
-		{
-			"path" : "pages/follow/doctor/detail",
-			"style" : 
-			{
-				"navigationBarTitleText" : "查看详情"
-			}
 		}
 	],
 	"tabBar": {

+ 8 - 4
app/pages/follow/detail.vue

@@ -21,7 +21,7 @@
 			</view>
 		</view>
 		<u-divider text="结束"></u-divider>
-		<button class="btn" @click="add()" v-if="item.state == 0">立即提交</button>
+		<button class="btn" @click="add()" v-if="!look">立即提交</button>
 	</view>
 </template>
 
@@ -35,10 +35,14 @@ export default {
 	},
 	onLoad(e) {
 		this.http.request({
-			url: '/app/follow/detail/' + e.id,
+			url: this.getUser().doctor ? '/work/record/detail/' + e.id : '/app/follow/detail/' + e.id,
 			success: (res) => {
 				this.item = res.data.data;
-				this.look = this.item.state != 0 ? true : false;
+				if (this.getUser().doctor) {
+					this.look = true;
+				} else {
+					this.look = this.item.state != 0 ? true : false;
+				}
 				this.item.op = JSON.parse(this.item.op);
 			}
 		});
@@ -46,7 +50,7 @@ export default {
 	methods: {
 		//单选或多选
 		check(item, op) {
-			if (this.item.state != 0) {
+			if (this.look) {
 				return;
 			}
 			if (item.input == '单选' || item.input == '判断') {

+ 15 - 10
app/pages/follow/doctor/add.vue

@@ -5,7 +5,11 @@
 				<view class="lable">所属科室</view>
 				<input :value="user.dept.deptName || '无科室'" disabled />
 			</view>
-			<view class="form_group">
+			<view class="form_group" v-if="item.type == 0">
+				<view class="lable">提醒标题</view>
+				<input v-model="item.templateName" placeholder="请输入提醒标题" />
+			</view>
+			<view class="form_group" v-if="item.type == 1">
 				<view class="lable">随访模板</view>
 				<picker :range="templateList" range-key="title" @change="picker">
 					<input placeholder="请选择" v-model="item.templateName" :disabled="true" />
@@ -20,6 +24,10 @@
 				</picker>
 				<input :value="item.patientName" v-else />
 			</view>
+			<view class="form_group" v-if="item.type == 0">
+				<view class="lable">提醒内容</view>
+				<textarea v-model="item.op" placeholder="请输入提醒内容"></textarea>
+			</view>
 		</view>
 		<button class="btn" @click="add()">确认</button>
 	</view>
@@ -30,7 +38,7 @@ export default {
 	data() {
 		return {
 			user: this.getUser(),
-			item: { templateName: '', patientList: [] },
+			item: { patientList: [], op: '根据您于本院做的体检结果异常,请到岑溪人民医院做复诊' },
 			templateList: []
 		};
 	},
@@ -50,7 +58,7 @@ export default {
 					success: (res) => {
 						this.item = res.data.data;
 						this.item.patientName = e.patientName;
-						uni.setNavigationBarTitle({ title: '编辑随访' });
+						uni.setNavigationBarTitle({ title: '编辑' });
 					}
 				});
 			}
@@ -60,6 +68,7 @@ export default {
 			this.item.op = this.templateList[e.detail.value].op;
 			this.$forceUpdate();
 		},
+		//随访模板
 		getTemplateList() {
 			this.http.request({
 				url: '/work/record/template/list',
@@ -68,16 +77,12 @@ export default {
 				}
 			});
 		},
+		//指定患者
 		go() {
-			uni.navigateTo({
-				url: '/pages/follow/doctor/selectUser?selected=' + JSON.stringify(this.item.patientList)
-			});
+			uni.navigateTo({ url: '/pages/follow/doctor/selectUser?selected=' + JSON.stringify(this.item.patientList) });
 		},
 		add() {
-			let rule = [
-				{ name: 'templateName', checkType: 'notnull', errorMsg: '请选择随访模板' },
-				{ name: 'patientList', checkType: 'notnull', errorMsg: '请选择患者' }
-			];
+			let rule = [{ name: 'templateName', checkType: 'notnull', errorMsg: this.item.type == 0 ? '提醒标题' : '请选择随访模板' }];
 			if (!this.verify.check(this.item, rule)) {
 				uni.showModal({ content: this.verify.error, showCancel: false });
 				return false;

+ 0 - 19
app/pages/follow/doctor/detail.vue

@@ -1,19 +0,0 @@
-<template>
-	<view>
-		
-	</view>
-</template>
-
-<script>
-	export default {
-		data() {
-			return {
-				
-			};
-		}
-	}
-</script>
-
-<style lang="scss">
-
-</style>

+ 14 - 5
app/pages/follow/doctor/index.vue

@@ -4,7 +4,7 @@
 			<u-search placeholder="搜索患者" v-model="param.patientName" bgColor="white" :showAction="false" @search="refresh()" @clear="(param.patientName = ''), refresh()"></u-search>
 		</view>
 		<view class="listv">
-			<view class="item" v-for="(item, index) in list" :key="index" @click="go('/pages/follow/doctor/detail?id=' + item.id)">
+			<view class="item" v-for="(item, index) in list" :key="index" @click="detail(item)">
 				<view class="title omit">
 					<text class="icon" v-if="item.top === 1">&#xe61f;</text>
 					<text>{{ item.templateName }}</text>
@@ -14,14 +14,14 @@
 					<text>{{ item.createTime }}</text>
 					<text class="del" @click.stop="del(item, index)">删除</text>
 					<text class="edit" @click.stop="go('/pages/follow/doctor/add?id=' + item.id + ' &patientName=' + item.patientName)">编辑</text>
-					<text class="icon state" :style="{ color: item.state == 0 ? '#b5b5b5' : '#4CAF50' }">&#xe830;{{ item.state == 0 ? '待回访' : '已回访' }}</text>
+					<text class="icon state" :style="{ color: item.state == 0 ? '#b5b5b5' : '#4CAF50' }" v-if="param.type == 1">&#xe830;{{ item.state == 0 ? '待回访' : '已回访' }}</text>
 				</view>
 			</view>
 			<view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
 			<u-empty v-if="!loadMore && list.length == 0"></u-empty>
 		</view>
 		<view class="mfooter">
-			<button class="btn" @click="go('/pages/follow/doctor/add?type=1')">
+			<button class="btn" @click="go('/pages/follow/doctor/add?type=' + param.type)">
 				<text class="icon">&#xe8d5;</text>
 				<text>新增</text>
 			</button>
@@ -34,15 +34,19 @@ export default {
 	data() {
 		return {
 			list: [],
-			param: { pageNum: 1, pageSize: 10, type: 1, orderByColumn: 'k.id', isAsc: 'desc' },
+			param: { pageNum: 1, pageSize: 10, orderByColumn: 'k.id', isAsc: 'desc' },
 			loadMore: true
 		};
 	},
 	onLoad(e) {
+		this.param.type = e.type || 0;
 		this.getData();
 		uni.$on('record', (res) => {
 			this.refresh();
 		});
+		setTimeout(() => {
+			uni.setNavigationBarTitle({ title: this.param.type == 0 ? '复诊提醒' : '随访记录' });
+		}, 300);
 	},
 	methods: {
 		getData() {
@@ -62,7 +66,7 @@ export default {
 		del(item, index) {
 			uni.showModal({
 				title: '提示',
-				content: '确定删除该知识?',
+				content: '确定删除该内容?',
 				success: (res) => {
 					if (res.confirm) {
 						this.http.request({
@@ -76,6 +80,11 @@ export default {
 				}
 			});
 		},
+		detail(item) {
+			if (this.param.type == 1) {
+				uni.navigateTo({ url: '/pages/follow/detail?id=' + item.id });
+			}
+		},
 		go(url) {
 			uni.navigateTo({ url: url });
 		},

+ 0 - 19
app/pages/follow/doctor/remind.vue

@@ -1,19 +0,0 @@
-<template>
-	<view>
-		
-	</view>
-</template>
-
-<script>
-	export default {
-		data() {
-			return {
-				
-			};
-		}
-	}
-</script>
-
-<style lang="scss">
-
-</style>

+ 2 - 10
app/pages/user/bind/add.vue

@@ -1,6 +1,6 @@
 <template>
 	<view class="main">
-		<view class="bgm">
+		<view class="form">
 			<view class="form_group">
 				<view class="lable">绑定方式</view>
 				<picker :range="bindType" @change="picker">
@@ -65,12 +65,4 @@ export default {
 };
 </script>
 
-<style lang="scss">
-.bgm {
-	border-radius: 5px;
-	overflow: hidden;
-}
-.btn {
-	margin-top: 35px;
-}
-</style>
+<style lang="scss"></style>

+ 3 - 3
app/pages/user/index.vue

@@ -10,7 +10,7 @@
 				<view v-else @click="go('/pages/user/bind/index')">
 					<view class="nickName">
 						<text>{{ user.patientName ? user.patientName : '还未绑定就诊人' }}</text>
-						<text class="icon" v-if="user.bindUserList" @click.stop="show = true">&#xe6a7;切换就诊人</text>
+						<text class="icon" v-if="user.bindUserList && user.bindUserList.length > 1" @click.stop="show = true">&#xe6a7;切换就诊人</text>
 					</view>
 					<view class="welcome">欢迎使用岑溪人民医院小程序</view>
 				</view>
@@ -24,12 +24,12 @@
 		<view class="cmd">
 			<!--医生菜单-->
 			<view v-if="user.doctor">
-				<view class="s_item" @click="go('/pages/follow/doctor/remind')">
+				<view class="s_item" @click="go('/pages/follow/doctor/index?type=0')">
 					<text class="icon ic" style="color: #03a9f4">&#xe716;</text>
 					<text class="title">复诊提醒</text>
 					<text class="icon arrow">&#xe62b;</text>
 				</view>
-				<view class="s_item" @click="go('/pages/follow/doctor/index')">
+				<view class="s_item" @click="go('/pages/follow/doctor/index?type=1')">
 					<text class="icon ic" style="color: #607d8b">&#xe60b;</text>
 					<text class="title">随访记录</text>
 					<text class="icon arrow">&#xe62b;</text>

+ 4 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/work/controller/FollowRecordController.java

@@ -4,6 +4,7 @@ import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.core.validate.Groups;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.web.work.domain.FollowRecord;
 import com.ruoyi.web.work.domain.FollowTemplate;
@@ -13,6 +14,7 @@ import com.ruoyi.web.work.service.IFollowRecordService;
 import com.ruoyi.web.work.service.IFollowTemplateService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.Arrays;
@@ -64,14 +66,14 @@ public class FollowRecordController extends BaseController {
     @PreAuthorize("@ss.hasAnyPermi('work:record:add,work:up:add')")
     @Log(title = "回访记录", businessType = BusinessType.INSERT)
     @PostMapping("/add")
-    public AjaxResult add(@RequestBody FollowRecord followRecord) {
+    public AjaxResult add(@Validated({Groups.Add.class}) @RequestBody FollowRecord followRecord) {
         return followRecordService.add(followRecord);
     }
 
     @PreAuthorize("@ss.hasAnyPermi('work:record:edit,work:up:edit')")
     @Log(title = "回访记录", businessType = BusinessType.UPDATE)
     @PostMapping("/edit")
-    public AjaxResult edit(@RequestBody FollowRecord followRecord) {
+    public AjaxResult edit(@Validated({Groups.Edit.class}) @RequestBody FollowRecord followRecord) {
         return toAjax(followRecordService.updateById(followRecord));
     }
 

+ 8 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/work/domain/FollowRecord.java

@@ -3,10 +3,13 @@ package com.ruoyi.web.work.domain;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.ruoyi.common.core.domain.BaseData;
+import com.ruoyi.common.core.validate.Groups;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.experimental.Accessors;
 
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
 import java.util.List;
 
 /**
@@ -21,6 +24,8 @@ public class FollowRecord extends BaseData {
 
     private Long id;
 
+
+    @NotNull(message = "推送类型不能为空", groups = {Groups.Add.class, Groups.Edit.class})
     @ApiModelProperty(value = "提醒类型:0=复诊,1=回访")
     private Integer type;
 
@@ -30,15 +35,18 @@ public class FollowRecord extends BaseData {
     @ApiModelProperty(value = "患者姓名")
     private String patientName;
 
+    @NotBlank(message = "模板名称或提醒标题不能为空", groups = {Groups.Add.class, Groups.Edit.class})
     @ApiModelProperty(value = "模板名称")
     private String templateName;
 
+    @NotBlank(message = "回访内容或者提醒内容不能为空", groups = {Groups.Add.class, Groups.Edit.class})
     @ApiModelProperty(value = "回访内容")
     private String op;
 
     @ApiModelProperty(value = "状态:0=未回访,1=已回访")
     private Integer state;
 
+    @NotNull(message = "指定患者不能为空", groups = {Groups.Add.class})
     @TableField(exist = false)
     private List<Patient> patientList;
 }

+ 2 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/work/service/IFollowRecordService.java

@@ -48,4 +48,6 @@ public interface IFollowRecordService extends IService<FollowRecord> {
      * @return
      */
     AjaxResult add(FollowRecord followRecord);
+
+    void sendMessage(FollowRecord record);
 }

+ 43 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/work/service/impl/FollowRecordServiceImpl.java

@@ -1,5 +1,8 @@
 package com.ruoyi.web.work.service.impl;
 
+import cn.hutool.http.HttpUtil;
+import cn.hutool.json.JSONObject;
+import cn.hutool.json.JSONUtil;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.common.annotation.DataScope;
 import com.ruoyi.common.core.domain.AjaxResult;
@@ -11,7 +14,9 @@ import com.ruoyi.web.work.domain.dto.VisitDto;
 import com.ruoyi.web.work.domain.vo.VisitVoList;
 import com.ruoyi.web.work.mapper.FollowRecordMapper;
 import com.ruoyi.web.work.service.IFollowRecordService;
+import com.ruoyi.web.work.service.IUserService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
 import org.springframework.stereotype.Service;
 
 import java.util.ArrayList;
@@ -26,6 +31,12 @@ public class FollowRecordServiceImpl extends ServiceImpl<FollowRecordMapper, Fol
     @Autowired
     private FollowRecordMapper followRecordMapper;
 
+    @Autowired
+    IUserService userService;
+
+    @Autowired
+    private Environment env;
+
     @DataScope(deptAlias = "k")
     @Override
     public List<FollowRecord> selectList(FollowRecord followRecord) {
@@ -85,4 +96,36 @@ public class FollowRecordServiceImpl extends ServiceImpl<FollowRecordMapper, Fol
         }
         return AjaxResult.success();
     }
+    @Override
+    public void sendMessage(FollowRecord record) {
+        JSONObject jsonObject = JSONUtil.parseObj(HttpUtil.get("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + env.getProperty("wx.appid") + "&secret=" + env.getProperty("wx.appSecret")));
+        JSONObject body = new JSONObject();
+        body.set("appid", env.getProperty("wx.appid"));
+        JSONObject content = new JSONObject();
+        //复诊提醒
+        if (record.getType()==0) {
+           /* User user = userService.getById(record.getPatientId);
+            body.set("touser", user.getOpenId());
+            body.set("template_id", "PtdKbqfzmpvGsJPx_YekDX4-cljbhOXcvoUB3XJaVLg");
+            body.set("page", "pages/user/money/index");
+            content.set("amount3", new JSONObject().set("value", pay.getMoney() + "元"));//提现金额
+            content.set("character_string4", new JSONObject().set("value", pay.getNums()));//交易单号
+            content.set("time2", new JSONObject().set("value", DateUtils.getTime())); //提现时间*/
+        }
+        //随访提醒
+        if (record.getType()==1) {
+           /* User user = userService.getById(pay.getUserId());
+            body.set("touser", user.getOpenId());
+            body.set("template_id", "NIqSQq0j765o9Iz9gMiSelnuxMgPIPeCnk3lvEnWJlo");
+            body.set("page", "pages/user/money/index");
+            content.set("amount3", new JSONObject().set("value", pay.getMoney() + "元"));//提现金额
+            content.set("character_string4", new JSONObject().set("value", pay.getNums()));//交易单号
+            content.set("thing5", new JSONObject().set("value", pay.getMsg())); //失败原因
+            content.set("time2", new JSONObject().set("value", DateUtils.getTime())); //提现时间*/
+        }
+        body.set("data", content);
+        String result = HttpUtil.post("https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=" + jsonObject.getStr("access_token"), body.toString());
+        System.out.println("body:" + body);
+        System.out.println("小程序订阅消息:" + result);
+    }
 }