Browse Source

修改随访表单

bzd_wsp 3 months ago
parent
commit
93d3819bf7

+ 144 - 28
health-admin/src/main/java/com/bzd/web/controller/gxhpz/FollowTaskController.java

@@ -6,6 +6,7 @@ import com.bzd.common.core.controller.BaseController;
 import com.bzd.common.core.domain.AjaxResult;
 import com.bzd.common.core.page.TableDataInfo;
 import com.bzd.common.enums.BusinessType;
+import com.bzd.common.utils.DateUtils;
 import com.bzd.common.utils.StringUtils;
 import com.bzd.system.service.PharmaceuticalService;
 import com.bzd.system.service.gxhpz.FollowPlanService;
@@ -18,6 +19,7 @@ import org.springframework.web.bind.annotation.*;
 
 import java.math.BigDecimal;
 import java.util.Arrays;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -133,7 +135,7 @@ public class FollowTaskController extends BaseController {
     }
 
     /**
-     * 保存任务修改信息
+     * 保存任务修改信息/保存随访表单信息/保存随访计划信息
      */
     @RequiresPermissions("gxhpz:task:edit")
     @Log(title = "任务管理", businessType = BusinessType.UPDATE)
@@ -142,9 +144,22 @@ public class FollowTaskController extends BaseController {
     public AjaxResult followTaskEdit() throws Exception
     {
         PageData pd = this.getPageData();
+        String id = (String) pd.get("id");
+        String patientId = (String)pd.get("patientId");
+        String returnMethod = (String)pd.get("returnMethod");
+        String iscoordinate = (String)pd.get("iscoordinate");
+        String returnObject = (String)pd.get("returnObject");
+        if(StringUtils.isNotEmpty(returnMethod) && StringUtils.isNotEmpty(iscoordinate)
+         && StringUtils.isNotEmpty(returnObject) && StringUtils.isNotEmpty(patientId) && StringUtils.isNotEmpty(id)){
+            pd.put("taskStatus", "已完成");//任务状态:\r\n,0待执行,\r\n1已完成,\r\n2未完成,\r\n3已下发,\r\n4已取消
+        }
+        pd.put("operator", getSysUser().getLoginName());//登记人
+        pd.put("updatedAt", DateUtils.getTime());//更新时间
+        pd.put("actualFollowUpTime", DateUtils.getTime());//实际随访时间
+        pd.put("completionTime", DateUtils.getTime());//完成时间
         Integer update = followTaskService.update(pd);
         if(update<=0){
-            return error("修改失败");
+            return error("保存失败");
         }
         return toAjax(update);
     }
@@ -182,41 +197,111 @@ public class FollowTaskController extends BaseController {
 
             pd5.put("id", pageData.get("patientId"));//去查购药记录的条件
             PageData Plan1 = followPlanService.selectPlanByCPB(pd3);//去查计划 常规随访的
-            pdt1.put("planId", Plan1.get("id"));
-            PageData Plan2 = followPlanService.selectPlanByCPB(pd4);//去查计划 落召回
-            pdt2.put("planId", Plan2.get("id"));
-            List<PageData> listTask1= followTaskService.findForList(pdt1);//去查任务 常规随访
-            List<PageData> listTask2= followTaskService.findForList(pdt2);//去查任务 落召回
+            pd1 = pharmaceuticalService.selectPatientById(pd2);//查询患者信息
+            if(StringUtils.isNotNull(Plan1)){
+
+                pdt1.put("planId_cg", Plan1.get("id"));
+                pd1.put("Plan1",Plan1);//常规随访的 类型的计划
+                pd1.put("follow_up_person",Plan1.get("follow_up_person"));
+                pd1.put("productName",Plan1.get("productName"));
+                pd1.put("specification",Plan1.get("specification"));
+                pd1.put("businessBelonging",Plan1.get("businessBelonging"));
+                pd1.put("createdBy",Plan1.get("createdBy"));
+                pd1.put("createdTime",  Plan1.get("createdTime1"));
+                pd1.put("updatedBy",Plan1.get("updatedBy"));
+                pd1.put("updatedTime",Plan1.get("updatedTime1"));
+                // 获取原始的状态值并进行处理
+                Integer status  = (Integer) Plan1.get("status");
+                if (status != null) {
+                    switch (status) {
+                        case 0:
+                            pd1.put("status","关闭");
+                            break;
+                        case 1:
+                            pd1.put("status","进行中");
+                            break;
+                        case 2:
+                            pd1.put("status","待开启");
+                            break;
+                        default:
+                            pd1.put("status","待开启");
+                            break;
+                    }
+                }
+                List<PageData> listTask1= followTaskService.findForList(pdt1);//去查任务 常规随访
+                if(listTask1.size()>0){
+                    pd1.put("listTask1",listTask1);
+                }
+            }
 
+            PageData Plan2 = followPlanService.selectPlanByCPB(pd4);//去查计划 脱落召回
+            if(StringUtils.isNotNull(Plan2)){
+                pdt2.put("planId_tl", Plan2.get("id"));
+                List<PageData> listTask2= followTaskService.findForList(pdt2);//去查任务 脱落召回
+                pd1.put("follow_up_person2",Plan2.get("follow_up_person"));
+                pd1.put("productName2",Plan2.get("productName"));
+                pd1.put("specification2",Plan2.get("specification"));
+                pd1.put("businessBelonging2",Plan2.get("businessBelonging"));
+                pd1.put("createdBy2",Plan2.get("createdBy"));
+                pd1.put("createdTime2",Plan2.get("createdTime1"));
+                pd1.put("updatedBy2",Plan2.get("updatedBy"));
+                pd1.put("updatedTime2",Plan2.get("updatedTime1"));
+                pd1.put("Plan2",Plan2);//脱落召回 类型的计划
+                //pd1.put("status2",Plan2.get("status"));
+                // 获取原始的状态值并进行处理
+                Integer status2  = (Integer) Plan2.get("status");
+                if (status2 != null) {
+                    switch (status2) {
+                        case 0:
+                            pd1.put("status2","关闭");
+                            break;
+                        case 1:
+                            pd1.put("status2","进行中");
+                            break;
+                        case 2:
+                            pd1.put("status2","待开启");
+                            break;
+                        default:
+                            pd1.put("status2","待开启");
+                            break;
+                    }
+                }
+                if(listTask2.size()>0){
+                    pd1.put("listTask2",listTask2);
+                }
+            }
             PageData  Degree =followPlanService.getPerfectionDegree(pd2);//查询档案完善度百分比
-            pd1 = pharmaceuticalService.selectPatientById(pd2);//查询患者信息
             List<PageData>  records =pharmaceuticalService.getDrugPurchaseList(pd5);//去查购药记录
             pd1.put("taskId", pageData.get("id"));
             pd1.put("patientId", pd1.get("id"));
-            pd1.put("filledFieldsCount",Degree.get("filledFieldsCount"));//字段完成数量
-            // 获取原始的完成度百分比并四舍五入
-            Object completenessObj = Degree.get("completenessPercentage");
-            if (completenessObj instanceof BigDecimal) {
-                BigDecimal completenessPercentage = (BigDecimal) completenessObj;
-            // 使用 BigDecimal 的setScale 方法进行四舍五入
-                BigDecimal roundedPercentage = completenessPercentage.setScale(0, BigDecimal.ROUND_HALF_UP);
-                pd1.put("completenessPercentage", roundedPercentage.intValue()); // 将四舍五入后的值放入 pd1
-            }
-            pd1.put("recordsData",records);
-                pd1.put("Plan1",Plan1);
-                pd1.put("Plan2",Plan2);
-
-            if(listTask1.size()>0){
-                pd1.put("listTask1",listTask1);
-            }
-            if(listTask2.size()>0){
-                pd1.put("listTask2",listTask2);
+            if(StringUtils.isNotNull(Degree)){
+                pd1.put("filledFieldsCount",Degree.get("filledFieldsCount"));//字段完成数量
+                // 获取原始的完成度百分比并四舍五入
+                Object completenessObj = Degree.get("completenessPercentage");
+                if (completenessObj instanceof BigDecimal) {
+                    BigDecimal completenessPercentage = (BigDecimal) completenessObj;
+                    // 使用 BigDecimal 的setScale 方法进行四舍五入
+                    BigDecimal roundedPercentage = completenessPercentage.setScale(0, BigDecimal.ROUND_HALF_UP);
+                    pd1.put("completenessPercentage", roundedPercentage.intValue()); // 将四舍五入后的值放入 pd1
+                }
             }
+           if(records.size()>0){
+               pd1.put("recordsData",records);
+           }
+            //本次任务单个
+            pd1.put("bc_id",pageData.get("id"));//本次任务id
+            pd1.put("bc_planId",pageData.get("planId"));//本次任务的计划id
+            pd1.put("bc_appointmentDate",pageData.get("appointmentDate1"));//预约日期
+            pd1.put("bc_businessBelonging",pageData.get("businessBelonging"));//businessBelonging
+            pd1.put("bc_taskName",pageData.get("taskName"));//任务名称
+            pd1.put("bc_taskTheme",pageData.get("taskTheme"));//任务主题
+            pd1.put("bc_productName",pageData.get("productName"));//商品名
+            pd1.put("bc_taskFollower",pageData.get("taskFollower"));//任务跟进人
+            pd1.put("bc_taskStatus",pageData.get("taskStatus"));//任务状态 0待执行,\r\n1已完成,\r\n2未完成,\r\n3已下发,\r\n4已取消
             mmap.putAll(pd1);
         }else{
             mmap.put("未查询到数据 id",id);
         }
-
         return prefix_followUp + "/followUpEdit";
     }
 
@@ -239,7 +324,38 @@ public class FollowTaskController extends BaseController {
 
 
 
-
+    /**
+     * 关闭计划
+     */
+    @RequiresPermissions("gxhpz:task:edit")
+    @Log(title = "关闭计划", businessType = BusinessType.UPDATE)
+    @PostMapping("/closePlan")
+    @ResponseBody
+    public AjaxResult closePlan() throws Exception
+    {
+        PageData pd = this.getPageData();
+        Integer update = followPlanService.closePlan(pd);
+        if(update<=0){
+            return error("关闭计划失败");
+        }
+        return toAjax(update);
+    }
+    /**
+     * 关闭任务
+     */
+    @RequiresPermissions("gxhpz:task:edit")
+    @Log(title = "关闭任务", businessType = BusinessType.UPDATE)
+    @PostMapping("/closeTask")
+    @ResponseBody
+    public AjaxResult closeTask() throws Exception
+    {
+        PageData pd = this.getPageData();
+        Integer update = followTaskService.closeTask(pd);
+        if(update<=0){
+            return error("关闭任务划失败");
+        }
+        return toAjax(update);
+    }
 
 
 

+ 234 - 112
health-admin/src/main/resources/templates/dtp/followUp/followUpEdit.html

@@ -215,9 +215,6 @@
             <button class="btn btn-w-m btn-primary"  onclick="editArchives()">完善档案</button>
             <button type="button" class="btn btn-sm btn-danger pull-right" onclick="closeItem()">返回上一级</button>
         </div>
-
-        <input type="hidden" id="id" name="id" th:value="${id}">
-        <input type="hidden" id="patientId" name="patientId" th:value="${patientId}">
         <div class="customize-form-group">
             <label>姓名:</label>
             <input name="name" id="name"   class="select-input" type="text"  th:value="${name}" disabled="true"/>
@@ -349,28 +346,37 @@
                     <div id="tab-3" class="tab-pane">
                             <div class="task-follow-up">
                                 <div class="follow-up-person">
-                                    <label for="followUpPerson" style="padding-left: 50px;">随访跟进人:</label>
-                                    <input type="text" id="followUpPerson" value="蒋娟" style="border: none; width: 40px; color: red;" />
-                                    <input type="hidden" id="followUpPersonId" name="followUpPersonId"/>
-                                    <a href="#" onclick="editGenJinRen()">修改<i class="glyphicon glyphicon-pencil"></i></a>
+<!--                                    <label  style="padding-left: 10px;">随访跟进人:</label>-->
+                                    <code style="font-size: 1.5rem;width: 200px;padding-left: 15px;">
+                                        随访跟进人:
+                                    </code>
+                                    <code style="font-size: 1.5rem;width: 200px;" th:text="${follow_up_person}">
+                                    </code>
+<!--                                    <code type="text" id="follow_up_person"  style="border: none; width: 55px; color: red;"  th:value="${follow_up_person}"/>-->
+                                    <input type="hidden" id="follow_up_person_id" name="follow_up_person_id"/>
+<!--                                    <a href="#" onclick="editGenJinRen()">修改<i class="glyphicon glyphicon-pencil"></i></a>-->
                                 </div>
                                 <div class="plan-buttons">
-                                    <button class="btn btn-w-m btn-primary" onclick="showAllPlan()">查看全部计划</button>
+<!--                                    <button class="btn btn-w-m btn-primary" onclick="showAllPlan()">查看全部计划</button>-->
                                 </div>
                             </div>
                             <div class="row">
                                 <div class="ibox-content">
                                     <div class="ibox-title2">
-                                             <code style="font-size: 1.5rem;padding-right: 30px;">
-                                                 甲磺酸仑伐替尼胶囊药名
-                                                 <a onclick="editGenJinRen()"><i class="glyphicon glyphicon-pencil"></i></a>
+                                             <code style="font-size: 1.5rem;width: 200px;" th:text="${productName}">
+
+
                                              </code>
-                                        <code style="font-size: 1.5rem; padding-right: 30px;">
-                                            20mg(1ml)/瓶
+                                        <code style="font-size: 1.5rem; width: 200px;" th:text="${specification}">
+
+                                        </code>
+                                        <code style="font-size: 1.5rem;color: #00B83F;padding-right: 30px;"><i class="glyphicon glyphicon-ice-lolly" th:text="${businessBelonging}"></i></code>
+                                        <code style="font-size: 1.5rem;color: #00B83F;padding-right: 30px;"
+                                              th:text="${status == '关闭'? '已关闭' : status}">
+                                            <!-- 默认文本将被 Thymeleaf 动态替换 -->
                                         </code>
-                                        <code style="font-size: 1.5rem;color: #00B83F;padding-right: 30px;"><i class="glyphicon glyphicon-ice-lolly">常规随访</i></code>
-                                        <code style="font-size: 1.5rem;color: #00B83F;padding-right: 30px;">进行中</code>
-                                        <a onclick="closePlane()" href="javascript:void(0)" class="right-aligned-link">关闭计划</a>
+                                        <!-- 根据 status 的值决定是否显示关闭计划按钮 -->
+                                        <a th:if="${status != '关闭'}" onclick="closePlan(1)" href="javascript:void(0)" class="right-aligned-link">关闭计划</a>
                                     </div>
                                     </div>
                             </div>
@@ -378,11 +384,11 @@
                                 <div class="ibox-content">
                                     <div class="ibox-title2">
                                         <span style="padding-left: 10px;font-size:15px;">创建人:</span>
-                                        <span style="width: 120px;color: #2E2D3C;font-size:15px;padding-right: 40px;">系统订单</span>
-                                        <span style="font-size:15px;">开始时间:</span> <span style="width: 120px;color: #2E2D3C;font-size:15px;padding-right: 40px;">2024-08-19</span>
-                                        <span style="font-size:15px;">更新人:</span> <span style="width: 100px;color: #2E2D3C;font-size:15px;">宝智达</span>
-                                        <span style="font-size:15px;">更新时间:</span> <span style="width: 100px;color: #2E2D3C;font-size:15px;">2024-08-19</span>
-                                        <a href="javascript:void(0)" onclick="ViewOperationLog()" class="right-aligned-link">查看操作记录</a>
+                                        <span style="width: 120px;color: #2E2D3C;font-size:15px;padding-right: 40px;" th:text="${createdBy}"></span>
+                                        <span style="font-size:15px;">开始时间:</span> <span style="width: 220px;color: #2E2D3C;font-size:15px;padding-right: 70px;" th:text="${createdTime}"></span>
+                                        <span style="font-size:15px;">更新人:</span> <span style="width: 100px;color: #2E2D3C;font-size:15px;" th:text="${updatedBy}"></span>
+                                        <span style="font-size:15px;">更新时间:</span> <span style="width: 220px;color: #2E2D3C;font-size:15px;padding-right: 70px;" th:text="${updatedTime}"></span>
+<!--                                    <a href="javascript:void(0)" onclick="ViewOperationLog()" class="right-aligned-link">查看操作记录</a>-->
                                     </div>
 
                                 </div>
@@ -392,34 +398,37 @@
                                     <table id="bootstrap-table-4"></table>
                                 </div>
                             </div>
-                            <div class="row">
-                                <div class="ibox-content">
-                                    <div class="ibox-title2">
-                                        <code style="font-size: 1.5rem; padding-right: 30px;">
-                                            甲磺酸仑伐替尼胶囊药名
-                                            <a onclick="editGenJinRen()"><i class="glyphicon glyphicon-pencil"></i> </a>
-                                        </code>
-                                        <code style="font-size: 1.5rem; padding-right: 30px;">
-                                            20mg(1ml)/瓶
-                                        </code>
-                                        <code style="font-size: 1.5rem; color:#ec971f;padding-right: 30px;"><i class="glyphicon glyphicon-ice-lolly-tasted">脱落召回</i></code>
-                                        <code style="font-size: 1.5rem;color: #00B83F;padding-right: 30px;">进行中</code>
-                                        <a onclick="closePlane()" href="javascript:void(0)" class="right-aligned-link">关闭计划</a>
-                                    </div>
+                        <div class="row">
+                            <div class="ibox-content">
+                                <div class="ibox-title2">
+                                    <code style="font-size: 1.5rem;width: 200px;" th:text="${productName2}">
+
+
+                                    </code>
+                                    <code style="font-size: 1.5rem; width: 200px;" th:text="${specification2}">
+                                    </code>
+                                    <code style="font-size: 1.5rem;color:#ec971f;padding-right: 30px;"><i class="glyphicon glyphicon-ice-lolly-tasted" th:text="${businessBelonging2}"></i></code>
+                                    <code style="font-size: 1.5rem;color: #00B83F;padding-right: 30px;"
+                                          th:text="${status2 == '关闭'? '已关闭' : status2}">
+                                        <!-- 默认文本将被 Thymeleaf 动态替换 -->
+                                    </code>
+                                    <a th:if="${status2 != '关闭'}" onclick="closePlan(2)" href="javascript:void(0)" class="right-aligned-link">关闭计划</a>
                                 </div>
                             </div>
-                            <div class="row">
-                                <div class="ibox-content">
-                                    <div class="ibox-title2">
-                                        <span style="padding-left: 10px;font-size:15px;">创建人:</span>
-                                        <span style="width: 120px;color: #2E2D3C;font-size:15px;padding-right: 40px;">系统订单</span>
-                                        <span style="font-size:15px;">开始时间:</span> <span style="width: 120px;color: #2E2D3C;font-size:15px;padding-right: 40px;">2024-08-19</span>
-                                        <span style="font-size:15px;">更新人:</span> <span style="width: 100px;color: #2E2D3C;font-size:15px;">宝智达</span>
-                                        <span style="font-size:15px;">更新时间:</span> <span style="width: 100px;color: #2E2D3C;font-size:15px;">2024-08-19</span>
-                                        <a href="javascript:void(0)" onclick="ViewOperationLog()" class="right-aligned-link">查看操作记录</a>
-                                    </div>
+                        </div>
+                        <div class="row">
+                            <div class="ibox-content">
+                                <div class="ibox-title2">
+                                    <span style="padding-left: 10px;font-size:15px;">创建人:</span>
+                                    <span style="width: 120px;color: #2E2D3C;font-size:15px;padding-right: 40px;" th:text="${createdBy2}"></span>
+                                    <span style="font-size:15px;">开始时间:</span> <span style="width: 220px;color: #2E2D3C;font-size:15px;padding-right: 70px;" th:text="${createdTime2}"></span>
+                                    <span style="font-size:15px;">更新人:</span> <span style="width: 100px;color: #2E2D3C;font-size:15px;" th:text="${updatedBy2}"></span>
+                                    <span style="font-size:15px;">更新时间:</span> <span style="width: 220px;color: #2E2D3C;font-size:15px;padding-right: 70px;" th:text="${updatedTime2}"></span>
+                                    <!--                                    <a href="javascript:void(0)" onclick="ViewOperationLog()" class="right-aligned-link">查看操作记录</a>-->
                                 </div>
+
                             </div>
+                        </div>
                             <div class="row">
                                 <div class="col-sm-12 select-table table-striped">
                                     <table id="bootstrap-table-5"></table>
@@ -433,11 +442,23 @@
         <div class="ibox-content">
             <div class="ibox-title2">
                 <div class="task-info">
-                    <h4>本次任务 <code style="font-size: 1.5rem;">待执行</code></h4>
+<!--                    pd1.put("bc_id",pageData.get("id"));//-->
+<!--                    pd1.put("bc_appointmentDate",pageData.get("appointmentDate1"));//预约日期-->
+<!--                    pd1.put("bc_businessBelonging",pageData.get("businessBelonging"));//businessBelonging-->
+<!--                    pd1.put("bc_taskName",pageData.get("taskName"));//任务名称-->
+<!--                    pd1.put("bc_taskTheme",pageData.get("taskTheme"));//任务主题-->
+<!--                    pd1.put("bc_productName",pageData.get("productName"));//商品名-->
+<!--                    pd1.put("bc_taskFollower",pageData.get("taskFollower"));//任务跟进人-->
+<!--                    //pd1.put("bc_taskStatus",pageData.get("taskStatus"));//任务状态 0待执行,\r\n1已完成,\r\n2未完成,\r\n3已下发,\r\n4已取消  写到这李里-->
+                    <h4>本次任务 <code style="font-size: 1.5rem;" th:text="${bc_taskStatus}"></code></h4>
                 </div>
                 <div class="task-details">
                     <span style="font-size:15px;">任务名称:
-                        <span style="font-size:15px;">随访</span>
+                        <span style="font-size:15px;" th:text="${bc_taskName}"></span>
+
+                    </span>
+                    <span style="font-size:15px;">药品:
+                        <span style="font-size:15px;" th:text="${bc_productName}"></span>
                     </span>
 <!--                        <span style="font-size:15px;">任务主题:-->
 <!--                            <span>-->
@@ -448,13 +469,13 @@
 <!--                           </span>-->
 <!--                       </span>-->
                     <span style="font-size:15px;">任务跟进人:
-                        <span style="color: #2E2D3C;font-size:15px;"><code style="font-size: 1.4rem;font-size:15px;">蒋娟</code>
-                       <a onclick="editGenJinRen()" style="font-size:15px;"> 修改 <i class="glyphicon glyphicon-pencil"></i></a>
+                        <span style="color: #2E2D3C;font-size:15px;"><code style="font-size: 1.4rem;font-size:15px;" th:text="${bc_taskFollower}"></code>
+<!--                       <a onclick="editGenJinRen()" style="font-size:15px;"> 修改 <i class="glyphicon glyphicon-pencil"></i></a>-->
                        </span>
                     </span>
                 </div>
                 <div class="task-buttons">
-                    <button class="btn btn-w-m btn-primary" onclick="showDetailHistory()">查看历史随访</button>
+<!--                    <button class="btn btn-w-m btn-primary" onclick="showDetailHistory()">查看历史随访</button>-->
                 </div>
             </div>
         </div>
@@ -481,7 +502,11 @@
                                 <div class="customize-form-group edit">
                                     <label class="is-required">回访方式:</label>
                                     <div class="input-groups" th:with="type=${@dict.getType('sys_select_dtp_ysfw_huifangfangshi')}">
-                                        <input type="radio" class="form-check-radio" name="huifanffs" id="huifanffs" th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"   th:checked="${dict.dictLabel}==${ReturnMethod}">
+                                        <input type="hidden" id="id" name="id" th:value="${bc_id}">
+                                        <input type="hidden" id="planId_cg" name="planId_cg" th:value="${planId_cg}">
+                                        <input type="hidden" id="planId_tl" name="planId_tl" th:value="${planId_tl}">
+                                        <input type="hidden" id="patientId" name="patientId" th:value="${patientId}">
+                                        <input type="radio" class="form-check-radio" name="returnMethod" id="returnMethod" th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"   th:checked="${dict.dictLabel}==${returnMethod}">
                                     </div>
 
                                     <span class="status"></span>
@@ -489,10 +514,10 @@
 
                                 <div id="weixin" class="hidden">
                                     <div class="customize-form-group edit">
-                                        <label class="is-required" for="adverseReactionImage">回访图片:</label>
+                                        <label class="is-required" for="returnImgUrl">回访图片:</label>
                                         <div class="custom-file-upload">
-                                            <input type="file" id="adverseReactionImage" accept=".jpg,.jpeg,.png,.gif">
-                                            <label for="adverseReactionImage"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#007bff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-plus-circle"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="16"></line><line x1="8" y1="12" x2="16" y2="12"></line></svg></label>
+                                            <input type="file" id="returnImgUrl" accept=".jpg,.jpeg,.png,.gif">
+                                            <label for="returnImgUrl"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#007bff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-plus-circle"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="16"></line><line x1="8" y1="12" x2="16" y2="12"></line></svg></label>
                                         </div>
                                     </div>
                                 </div>
@@ -501,14 +526,14 @@
                                     <div class="customize-form-group edit">
                                         <label>面访记录:</label>
                                         <div class="input-groups"  style="width: 50%">
-                                            <input name="mfjilu" id="mfjilu" placeholder="请输入面访记录" class="styled-input edit_inputs" type="text" th:value="${record}">
+                                            <input name="InterviewRecord" id="InterviewRecord" placeholder="请输入面访记录" class="styled-input edit_inputs" type="text" th:value="${InterviewRecord}">
                                         </div>
                                         <span class="status"></span>
                                     </div>
                                 </div>
                                 <div class="customize-form-group">
                                     <label>回访对象:</label>
-                                    <select name="ReturnObject" class="select-input edit_inputs" th:with="type=${@dict.getType('sys_select_dtp_ysfw_huifangduixaing')}">
+                                    <select name="returnObject" class="select-input edit_inputs" id="returnObject" th:with="type=${@dict.getType('sys_select_dtp_ysfw_huifangduixaing')}">
                                         <option value="">请选择</option>
                                         <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"
                                                 th:selected="${dict.dictLabel}==${ReturnObject}"></option>
@@ -517,8 +542,8 @@
                                 </div>
                                 <div class="customize-form-group edit">
                                     <label class="is-required">是否配合:</label>
-                                    <div class="input-groups" th:with="type=${@dict.getType('sys_yes_no')}">
-                                        <input type="radio" class="form-check-radio" th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"  th:checked="${dict.dictLabel}==${yystatus}"  name="yystatus" >
+                                    <div class="input-groups" th:with="type=${@dict.getType('sys_select_yes_no')}">
+                                        <input type="radio" class="form-check-radio" th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"  th:checked="${dict.dictLabel}==${iscoordinate}"  name="iscoordinate" id="iscoordinate">
                                     </div>
                                     <span class="status"></span>
                                 </div>
@@ -527,14 +552,14 @@
                                 <div class="customize-form-group edit" >
                                     <label>用药状态:</label>
                                     <div class="input-groups" style="width: 90%" th:with="type=${@dict.getType('sys_gxhpz_yyycx')}">
-                                        <input type="radio" class="form-check-radio" name="ischixuyystatus"  id="ischixuyystatus" th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"   th:checked="${dict.dictLabel}==${yystatus}" >
+                                        <input type="radio" class="form-check-radio" name="medicationStatus"  id="medicationStatus" th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"   th:checked="${dict.dictLabel}==${medicationStatus}" >
                                     </div>
                                     <span class="status"></span>
                                 </div>
                                 <div class="customize-form-group edit">
                                     <label class="is-required">确诊后首次用药日期:</label>
                                     <div class="input-groups select-time">
-                                        <input name="timeFirstDiagnosis" placeholder="确诊后首次用药日期" class="time-input time-input2" type="text"  th:value="${timeFirstDiagnosis}" required>
+                                        <input name="timeFirstDiagnosis" id="timeFirstDiagnosis" placeholder="确诊后首次用药日期" class="time-input time-input2" type="text"  th:value="${timeFirstDiagnosis}" required>
                                     </div>
                                     <span class="status"></span>
                                 </div>
@@ -542,7 +567,7 @@
                                 <div class="customize-form-group edit" >
                                     <label>慈善援助用药:</label>
                                     <div class="input-groups" th:with="type=${@dict.getType('sys_gxhpz_chishan_yzyy')}">
-                                        <input type="radio" class="form-check-radio" th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"  th:checked="${dict.dictLabel}==${chishanyy}"  name="chishanyy" >
+                                        <input type="radio" name="charitable" id="charitable" class="form-check-radio" th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"  th:checked="${dict.dictLabel}==${chishanyy}"  >
                                     </div>
                                     <span class="status"></span>
                                 </div>
@@ -551,21 +576,21 @@
                                 <div class="customize-form-group edit">
                                     <label>永久停药时间:</label>
                                     <div class="input-groups">
-                                        <input name="timeFirstDiagnosis" placeholder="永久停药时间" class="time-input time-input2" type="text"  th:value="${timeFirstDiagnosis}" required>
+                                        <input name="permanentStopTime" id="permanentStopTime" placeholder="永久停药时间" class="time-input time-input2" type="text"  th:value="${permanentStopTime}" required>
                                     </div>
                                     <span class="status"></span>
                                 </div>
                                 <div class="customize-form-group edit">
                                     <label class="is-required">永久停药原因:</label>
                                     <div class="input-groups" style="width: 90%" th:with="type=${@dict.getType('sys_gxhpz_yong_jiu_ting_yao_yuanyin')}">
-                                        <input type="radio" class="form-check-radio" th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"  th:checked="${dict.dictLabel}==${stopyuanyin}"  name="stopyuanyin" >
+                                        <input type="radio" id="perpetual_stopdrug_cause" name="perpetual_stopdrug_cause" class="form-check-radio" th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"  th:checked="${dict.dictLabel}==${perpetual_stopdrug_cause}"  >
                                     </div>
                                     <span class="status"></span>
                                 </div>
                                 <div class="customize-form-group edit">
                                     <label>直接永久停药:</label>
                                     <div class="input-groups" th:with="type=${@dict.getType('sys_yes_no')}">
-                                        <input type="radio" class="form-check-radio" th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"  th:checked="${dict.dictLabel}==${stop}"  name="stop" >
+                                        <input type="radio" id="stoped" name="stoped" class="form-check-radio" th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"  th:checked="${dict.dictLabel}==${stoped}"   >
                                     </div>
                                     <span class="status"></span>
                                     <span class="status"></span>
@@ -575,7 +600,7 @@
                                 <div class="customize-form-group edit">
                                     <label>其他渠道购药:</label>
                                     <div class="input-groups" style="width: 90%" th:with="type=${@dict.getType('sys_gxhpz_othetqd_gy')}">
-                                        <input type="radio" class="form-check-radio" th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"  th:checked="${dict.dictLabel}==${othetqd}"  name="othetqd" >
+                                        <input type="radio" id="other_channels"   name="other_channels" class="form-check-radio" th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"  th:checked="${dict.dictLabel}==${other_channels}">
                                     </div>
                                     <span class="status"></span>
                                     <span class="status"></span>
@@ -585,7 +610,7 @@
                                 <div class="customize-form-group edit">
                                     <label class="is-required">延迟购药(医嘱建议):</label>
                                     <div class="input-groups" style="width: 90%" th:with="type=${@dict.getType('sys_gxhpz_yanchi_gy_ys_jy')}">
-                                        <input type="radio" class="form-check-radio" th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"  th:checked="${dict.dictLabel}==${ycyyysjy}"  name="ycyyysjy" >
+                                        <input type="radio" id="delay_purchase_doctor"   name="delay_purchase_doctor" class="form-check-radio" th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"  th:checked="${dict.dictLabel}==${delay_purchase_doctor}">
                                     </div>
                                     <span class="status"></span>
                                 </div>
@@ -594,7 +619,7 @@
                                 <div class="customize-form-group edit">
                                     <label class="is-required">延迟购药(用药不规范):</label>
                                     <div class="input-groups" style="width: 90%" th:with="type=${@dict.getType('sys_gxhpz_yanchi_gyhzyybgf')}">
-                                        <input type="radio" class="form-check-radio" th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"  th:checked="${dict.dictLabel}==${gyhzyybgf}"  name="gyhzyybgf" >
+                                        <input type="radio" id="delayed_purchase_drugs"   name="delayed_purchase_drugs"  class="form-check-radio" th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"  th:checked="${dict.dictLabel}==${delayed_purchase_drugs}">
                                     </div>
                                     <span class="status"></span>
                                 </div>
@@ -604,7 +629,7 @@
                                 <div class="customize-form-group edit">
                                     <label class="is-required">是否出现不良反应:</label>
                                     <div class="input-groups" th:with="type=${@dict.getType('sys_yes_no')}">
-                                        <input type="radio" class="form-check-radio"  th:each="dict : ${type}"  name="blfyyesOrno" id="blfyyesOrno" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"   th:checked="${dict.dictLabel}==${blfyyesOrno}">
+                                        <input type="radio" class="form-check-radio"  th:each="dict : ${type}"  name="is_adverse_reaction" id="is_adverse_reaction" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"   th:checked="${dict.dictLabel}==${is_adverse_reaction}">
                                     </div>
                                     <span class="status"></span>
                                 </div>
@@ -613,7 +638,7 @@
                                     <div class="customize-form-group edit">
                                         <label>不良反应时间:</label>
                                         <div class="input-groups" th:with="type=${@dict.getType('sys_yes_no')}">
-                                            <input name="nyfysj" placeholder="不良反应时间" class="time-input time-input2" type="text"  th:value="${timeFirstDiagnosis}" required>
+                                            <input name="adverse_reaction_time" id="adverse_reaction_time" placeholder="不良反应时间" class="time-input time-input2" type="text"  th:value="${adverse_reaction_time}" required>
                                         </div>
                                         <span class="status"></span>
                                     </div>
@@ -720,6 +745,7 @@
 <script th:inline="javascript">
     var formSubmitted = true;
     var prefix = ctx + "dtp/pmService";
+    var prefix_task = ctx + "task/followTask";
     var  blfyindex=0;
     //购药记录
     var recordsData;
@@ -730,46 +756,76 @@
     var listTask1;
     var listTask2;
     function submitHandler() {
-        var selectedValue = $('input[name="huifanffs"]:checked').val();
+        var selectedValue = $('input[name="returnMethod"]:checked').val();
         if (!selectedValue) {
-            alert('请选择回访方式!');
+            $.modal.alert('请选择回访方式!');
             return;
         }
-        if (selectedValue === '微信' && !$('#adverseReactionImage')[0].files.length) {
-            alert('微信回访时,回访图片为必填项!');
+        if (selectedValue === '微信' && !$('#returnImgUrl')[0].files.length) {
+            $.modal.alert('微信回访时,回访图片为必填项!');
             return;
         }
-
-        if (selectedValue === '面访' && !$('#mfjilu').val()) {
-            alert('面访时,面访记录为必填项!');
+        if (selectedValue === '面访' && !$('#InterviewRecord').val()) {
+            $.modal.alert('面访时,面访记录为必填项!');
+            return;
+        }
+        var iscoordinate = $('input[name="iscoordinate"]:checked').val();//是否配合
+        if (!iscoordinate) {
+            $.modal.alert('请选择是否配合!');
             return;
         }
-        if ($.validate.form()) {
-            var data = $("#form-followUp-edit").serializeArray();
-            $.operate.saveTab(prefix + "/followUpEdit", data);
+        var returnObject = $("#form-followUp-edit3").serializeArray().find(item => item.name === 'returnObject');
+        if (returnObject.value === '') {
+            $.modal.alertWarning("请选择回访对象");
+            return;
         }
 
-        const byfyTableBody = document.getElementById('byfyTableBody');
-        const rows2 = byfyTableBody.getElementsByTagName('tr');
+        var data = $("#form-followUp-edit3").serializeArray();
+        var patientId = $("#patientId").val();
+        var id = $("#id").val();
+        console.log("id=",id);
+        var planId = $("#planId_cg").val();
 
+        // data.push({name:"patientId",value:patientId});
+        // data.push({name:"id",value:id});
+        // data.push({name:"planId",value:planId});
 
-        if (rows2.length > 0) {
-            const rowsbyfys = [];//用药情况table
-            $('#byfyTableBody tr').each(function () {
-                const row = {
-                    id:  $("#id").val(),
-                    byfyData: $(this).find('td:eq(1)').text(),
-                };
-                rowsbyfys.push(row);
-            });
-            data.push({name:"rowsbyfys",value:JSON.stringify(rowsbyfys)})
+        var is_adverse_reaction = $('input[name="is_adverse_reaction"]:checked').val();
+        if (!is_adverse_reaction) {
+            $.modal.alert('请选择不良反应!');
+            return;
         }
+        if (is_adverse_reaction === '是') {
+            var adverse_reaction_time = $("#form-followUp-edit3").serializeArray().find(item => item.name === 'adverse_reaction_time');
+            if (adverse_reaction_time.value === '') {
+                $.modal.alertWarning("请选择不良反应时间");
+                return;
+            }
 
+            const blfyTableBody = document.getElementById('blfyTableBody');
+            const rows2 = blfyTableBody.getElementsByTagName('tr');
+            if (rows2.length > 0) {
+                const rowsbyfys = [];//不良反应table
+                $('#blfyTableBody tr').each(function () {
+                    const row = {
+                        id:  $("#id").val(),
+                        byfyData: $(this).find('td:eq(1)').text(),
+                    };
+                    rowsbyfys.push(row);
+                });
+                data.push({name:"adverse_reaction_rows",value:JSON.stringify(rowsbyfys)})
+            }
+            // else{
+            //     $.modal.alertWarning("请选择不良反应症状");
+            //     return;
+            // }
+        }
 
+        $.operate.saveTab(prefix_task + "/followTaskEdit", data);
 
+    }
 
 
-    }
     function deleteRow(button) {
         const row = button.parentNode.parentNode;
         row.remove();
@@ -815,11 +871,11 @@
         updateVisibility();
 
         // 监听回访方式的选择变化
-        $('input[name="huifanffs"]').on('change', updateVisibility);
+        $('input[name="returnMethod"]').on('change', updateVisibility);
         // 监听用药状态的选择变化
-        $('input[name="ischixuyystatus"]').on('change', updateVisibility);
+        $('input[name="medicationStatus"]').on('change', updateVisibility);
         // 监听不良反应的选择变化
-        $('input[name="blfyyesOrno"]').on('change', updateVisibility);
+        $('input[name="is_adverse_reaction"]').on('change', updateVisibility);
 
         // 监听点击事件,激活指定的选项卡
         $('#myUlTabs li a').click(function(e) {
@@ -961,7 +1017,7 @@
         var weixinDiv = $('#weixin');
         var mianfangDiv = $('#mianfang');
 
-        var selectedValue = $('input[name="huifanffs"]:checked').val();
+        var selectedValue = $('input[name="returnMethod"]:checked').val();
         if (selectedValue === '微信') {
             weixinDiv.removeClass('hidden');
             mianfangDiv.addClass('hidden');
@@ -973,46 +1029,46 @@
             mianfangDiv.removeClass('hidden');
         }
 
-        var ischixuyystatus = $('input[name="ischixuyystatus"]:checked').val();
+        var medicationStatus = $('input[name="medicationStatus"]:checked').val();
         var csyzyy = $('#csyzyy');//慈善援助用药
         var yjty = $('#yjty');//永久停药
         var qtgyqgy = $('#qtgyqgy');//其他渠道购药
         var ycgyycjy = $('#ycgyycjy');//延迟购药(医嘱建议)
         var ycgyhzyybgf = $('#ycgyhzyybgf');//延迟购药(患者用药不规范
             debugger
-        if (ischixuyystatus === '持续购药') {
+        if (medicationStatus === '持续购药') {
             csyzyy.addClass('hidden');
             yjty.addClass('hidden');
             qtgyqgy.addClass('hidden');
             ycgyycjy.addClass('hidden');
             ycgyhzyybgf.addClass('hidden');
-        } else if (ischixuyystatus === '领取慈善赠药') {
+        } else if (medicationStatus === '领取慈善赠药') {
             csyzyy.removeClass('hidden');
             yjty.addClass('hidden');
             qtgyqgy.addClass('hidden');
             ycgyycjy.addClass('hidden');
             ycgyhzyybgf.addClass('hidden');
-        } else if (ischixuyystatus === '永久停药') {
+        } else if (medicationStatus === '永久停药') {
             yjty.removeClass('hidden');
             csyzyy.addClass('hidden');
             qtgyqgy.addClass('hidden');
             ycgyycjy.addClass('hidden');
             ycgyhzyybgf.addClass('hidden');
-        }else if (ischixuyystatus === '其他渠道购药') {
+        }else if (medicationStatus === '其他渠道购药') {
             qtgyqgy.removeClass('hidden');
             yjty.addClass('hidden');
             csyzyy.addClass('hidden');
             ycgyycjy.addClass('hidden');
             ycgyhzyybgf.addClass('hidden');
         }
-        else if (ischixuyystatus === '延迟用药(医嘱建议)') {
+        else if (medicationStatus === '延迟用药(医嘱建议)') {
             ycgyycjy.removeClass('hidden');
             qtgyqgy.addClass('hidden');
             yjty.addClass('hidden');
             csyzyy.addClass('hidden');
             ycgyhzyybgf.addClass('hidden');
         }
-        else if (ischixuyystatus === '延迟购药 (患者用药不规范)') {
+        else if (medicationStatus === '延迟购药 (患者用药不规范)') {
             ycgyhzyybgf.removeClass('hidden');
             qtgyqgy.addClass('hidden');
             yjty.addClass('hidden');
@@ -1022,11 +1078,11 @@
 
         //是否出现不良反应
         var bulfydiv = $('#bulfydiv');
-        var blfyyesOrno = $('input[name="blfyyesOrno"]:checked').val();
-        if (blfyyesOrno === '是') {
+        var is_adverse_reaction = $('input[name="is_adverse_reaction"]:checked').val();
+        if (is_adverse_reaction === '是') {
             bulfydiv.removeClass('hidden');
         }
-        if (blfyyesOrno === '否') {
+        if (is_adverse_reaction === '否') {
             bulfydiv.addClass('hidden');
         }
     }
@@ -1145,12 +1201,17 @@
                             align: 'center',
                             width: '180px',
                             formatter: function(value, row, index) {
-                                if (row.id) {
+                                if (row.id && !['已取消', '已完成'].includes(row.taskStatus)) {
+                                    var actions = [];
+                                    actions.push('<a class="btn-xs" href="javascript:void(0)" onclick="edit(\'' + row.id + '\')">查看</a> ');
+                                    actions.push('<a class="btn-xs" href="javascript:void(0)" onclick="closeTask(\'' + row.id + '\')">关闭任务</a> ');
+                                    return actions.join('');
+                                }
+                                if (row.id && ['已取消', '已完成'].includes(row.taskStatus)) {
                                     var actions = [];
                                     actions.push('<a class="btn-xs" href="javascript:void(0)" onclick="edit(\'' + row.id + '\')">查看</a> ');
-                                    actions.push('<a class="btn-xs" href="javascript:void(0)" onclick="edit(\'' + row.id + '\')">关闭任务</a> ');
                                     return actions.join('');
-                                } else {
+                                }else {
                                     return "";
                                 }
                             }
@@ -1188,12 +1249,17 @@
                                     align: 'center',
                                     width: '180px',
                                     formatter: function(value, row, index) {
-                                        if (row.id) {
+                                        if (row.id && !['已取消', '已完成'].includes(row.taskStatus)) {
+                                            var actions = [];
+                                            actions.push('<a class="btn-xs" href="javascript:void(0)" onclick="edit(\'' + row.id + '\')">查看</a> ');
+                                            actions.push('<a class="btn-xs" href="javascript:void(0)" onclick="closeTask(\'' + row.id + '\')">关闭任务</a> ');
+                                            return actions.join('');
+                                        }
+                                        if (row.id && ['已取消', '已完成'].includes(row.taskStatus)) {
                                             var actions = [];
                                             actions.push('<a class="btn-xs" href="javascript:void(0)" onclick="edit(\'' + row.id + '\')">查看</a> ');
-                                            actions.push('<a class="btn-xs" href="javascript:void(0)" onclick="edit(\'' + row.id + '\')">关闭任务</a> ');
                                             return actions.join('');
-                                        } else {
+                                        }else {
                                             return "";
                                         }
                                     }
@@ -1210,4 +1276,60 @@
         var prefix = ctx + "dtp/pmService/archivesEdit/{id}";
         $.modal.openTab("修改档案", prefix.replace("{id}", id));
     }
+
+
+    // 关闭计划
+    function closePlan(planFlag){
+            $.modal.confirm("确认要关闭计划吗?,关闭计划后将停止该计划下的所有任务", function() {
+                $.modal.alert("确认");
+            });
+
+        var formData = new FormData();
+        if(planFlag==1){
+            var taskId = $("#id").val();
+            var id = $("#planId_cg").val();
+        }
+        if(planFlag==2){
+            var taskId = $("#id").val();
+            var id = $("#planId_tl").val();
+        }
+
+        formData.append('taskId', taskId);
+        formData.append('id', id);
+        $.ajax({
+            url: prefix_task + "/closePlan",
+            data: formData,
+            type: "post",
+            processData: false,
+            contentType: false,
+            success: function(result) {
+                $.modal.success("关闭计划成功",result);
+            },
+            error: function(xhr, status, error) {
+                $.modal.alertError("关闭计划失败");
+            }
+        });
+    }
+    // 关闭任务
+    function closeTask(id){
+        $.modal.confirm("确认要关闭任务吗?,关闭任务后将停止该任务的随访操作", function() {
+            $.modal.alert("确认");
+        });
+        var formData = new FormData();
+        formData.append('id', id);
+        $.ajax({
+            url: prefix_task + "/closeTask",
+            data: formData,
+            type: "post",
+            processData: false,
+            contentType: false,
+            success: function(result) {
+                $.modal.success("关闭任务成功",result);
+            },
+            error: function(xhr, status, error) {
+                $.modal.alertError("关闭任务失败");
+            }
+        });
+    }
+
 </script>

+ 21 - 19
health-admin/src/main/resources/templates/dtp/followUp/followUpList.html

@@ -240,34 +240,35 @@
 						}
 					} },
 				{ field: 'age', title: '年龄', align: 'center' },
-				{ field: 'followUpSummary', title: '随访小结',width: 500, align: 'center' },
-				{ field: 'disease', title: '疾病', align: 'center' },
-				{ field: 'storeName', title: '门店', align: 'center' },
-				{ field: 'genericName', title: '药品通用名', align: 'center' },
-				{ field: 'productName', title: '商品名', align: 'center' },
-				{ field: 'taskFollower', title: '任务跟进人', align: 'center' },
+
 					{ field: 'taskStatus', title: '任务状态', align: 'center' ,
 						formatter: function(value, row, index) {
 							switch (value) {
 								case '待执行':
-									return '<span class=\"btn-danger">待执行</span>';
+									return '<span class=\"btn-warning">待执行</span>';
 									break;
 								case '已完成':
-									return '<span class=\"btn-primary">已完成</span>';
+									return '<span class=\"btn-success">已完成</span>';
 									break;
 								case '未完成':
-									return '<span class=\"btn-primary">未完成</span>';
+									return '<span class=\"btn-warning">未完成</span>';
 									break;
 								case '已下发':
-									return '<span class=\"btn-primary">已下发</span>';
+									return '<span class=\"btn-info">已下发</span>';
 									break;
 								case '已取消':
-									return '<span class=\"btn-primary">已取消</span>';
+									return '<span class=\"btn-danger">已取消</span>';
 									break;
 								default:
 									return '<span class=\"btn-warning">'-'</span>';
 							}
 						}},
+					{ field: 'genericName', title: '药品通用名', align: 'center' },
+					{ field: 'productName', title: '商品名', align: 'center' },
+					{ field: 'followUpSummary', title: '随访小结',width: 500, align: 'center' },
+					{ field: 'taskFollower', title: '任务跟进人', align: 'center' },
+					{ field: 'disease', title: '疾病', align: 'center' },
+					{ field: 'storeName', title: '门店', align: 'center' },
 					{ field: 'lastOutboundStatus', title: '最后外呼状态', align: 'center',
 						formatter: function(value, row, index) {
 							switch (value) {
@@ -304,14 +305,15 @@
 		            align: 'center',
 					width: '180px',
 		            formatter: function(value, row, index) {
-		                if (row.id) {
-		                	var actions = [];
-			                actions.push('<a class="btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')">去随访</a> ');
-			                actions.push('<a class="btn-info btn-xs' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')">查看全部</a> ');
-			                return actions.join('');
-		            	} else {
-		                    return "";
-		                }
+						// 根据任务状态决定是否显示操作按钮
+						if (row.id && !['已取消', '已完成'].includes(row.taskStatus)) {
+							var actions = [];
+							actions.push('<a class="btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')">去随访</a> ');
+							actions.push('<a class="btn-info btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')">查看全部</a> ');
+							return actions.join('');
+						} else {
+							return "";
+						}
 		            }
 		        }]
 		    };

+ 1 - 0
health-system/src/main/java/com/bzd/system/service/DTPService.java

@@ -828,6 +828,7 @@ public class DTPService {
                             pd.put("gender", "3");
                         }
                     }
+
                 }
             if (StringUtils.isNull(pd.get("registrant"))){
                 pd.put("registrant", getSysUser().getLoginName());

+ 27 - 0
health-system/src/main/java/com/bzd/system/service/gxhpz/FollowPlanService.java

@@ -3,6 +3,7 @@ package com.bzd.system.service.gxhpz;
 import com.bzd.common.config.dao.DaoBase;
 import com.bzd.common.config.dao.DaoSupport;
 import com.bzd.common.config.dao.PageData;
+import com.bzd.common.utils.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -10,6 +11,8 @@ import org.springframework.transaction.annotation.Transactional;
 import javax.annotation.Resource;
 import java.util.List;
 
+import static com.bzd.common.utils.ShiroUtils.getSysUser;
+
 @Service
 public class FollowPlanService {
     @Autowired
@@ -91,4 +94,28 @@ public class FollowPlanService {
         return pjd;
     }
 
+    /**
+     * 关闭计划
+     * @param pd
+     * @return
+     * @throws Exception
+     */
+    public Integer closePlan(PageData pd) throws Exception {
+        pd.put("status", 0);
+        pd.put("taskStatus", "已取消");//0待执行,\r\n1已完成,\r\n2未完成,\r\n3已下发,\r\n4已取消
+        pd.put("updatedAt", DateUtils.getTime());//'更新时间'
+        pd.put("operator", getSysUser().getLoginName());//'操作人'
+        pd.put("updatedTime", DateUtils.getTime());//'更新时间'
+        pd.put("updatedBy", getSysUser().getLoginName());//更新人
+
+        int task = daoSupport.update("followTaskMapper.stopFollowTask", pd);
+        int plan = daoSupport.update("followPlanMapper.closeFollowPlan", pd);
+        if (task > 0 && plan > 0) {
+            return 1;
+        } else {
+            return -1;
+        }
+    }
+
+
 }

+ 24 - 0
health-system/src/main/java/com/bzd/system/service/gxhpz/FollowTaskService.java

@@ -3,11 +3,15 @@ package com.bzd.system.service.gxhpz;
 import com.bzd.common.config.dao.DaoBase;
 import com.bzd.common.config.dao.DaoSupport;
 import com.bzd.common.config.dao.PageData;
+import com.bzd.common.utils.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import javax.annotation.Resource;
 import java.util.List;
+
+import static com.bzd.common.utils.ShiroUtils.getSysUser;
+
 @Service
 public class FollowTaskService {
     @Autowired
@@ -68,4 +72,24 @@ public class FollowTaskService {
         return daoSupport.update("followTaskMapper.updateFollowTask", pd);
     }
 
+
+    /**
+     * 关闭任务
+     * @param pd
+     * @return
+     * @throws Exception
+     */
+    public Integer closeTask(PageData pd) throws Exception {
+        pd.put("taskStatus", "已取消");//0待执行,\r\n1已完成,\r\n2未完成,\r\n3已下发,\r\n4已取消
+        pd.put("updatedAt", DateUtils.getTime());//'更新时间'
+        pd.put("operator", getSysUser().getLoginName());//'操作人'
+        int task = daoSupport.update("followTaskMapper.closeTask", pd);
+        if (task > 0) {
+            return 1;
+        } else {
+            return -1;
+        }
+    }
+
+
 }

+ 17 - 1
health-system/src/main/resources/mapper/gxhpz/followPlanMapper.xml

@@ -35,13 +35,29 @@
 
     <!-- 根据药品编码和患者id查询计划 只能出现一条数据 -->
     <select id="selectPlanByCPB" parameterType="pd" resultType="pd">
-        select * from s_gxhpz_follow_plan where mdmCode = #{mdmCode} and patientId = #{patientId} and businessBelonging=#{businessBelonging}
+        select p.*,DATE_FORMAT(p.updatedTime, '%Y-%m-%d %H:%i:%s') AS updatedTime1 ,DATE_FORMAT(p.createdTime, '%Y-%m-%d %H:%i:%s') AS createdTime1  from s_gxhpz_follow_plan  p where p.mdmCode = #{mdmCode} and p.patientId = #{patientId} and p.businessBelonging=#{businessBelonging}
     </select>
     <!-- 根据ID查询单个计划 -->
     <select id="selectOneById" parameterType="pd" resultType="pd">
         select * from s_gxhpz_follow_plan where id = #{id}
     </select>
 
+    <!-- 关闭计划 -->
+    <update id="closeFollowPlan" parameterType="pd">
+        update s_gxhpz_follow_plan
+        <set>
+            <if test="status != null">
+                status = #{status},
+            </if>
+            <if test="updatedBy != null and updatedBy != ''">
+                updatedBy = #{updatedBy},
+            </if>
+            <if test="updatedTime != null and updatedTime != ''">
+                updatedTime = #{updatedTime},
+            </if>
+        </set>
+        where id = #{id}
+    </update>
     <!-- 插入新计划 -->
     <insert id="insertFollowPlan" parameterType="pd">
         insert into s_gxhpz_follow_plan

+ 72 - 1
health-system/src/main/resources/mapper/gxhpz/followTaskMapper.xml

@@ -38,9 +38,43 @@
 
     <!-- 根据ID查询单个任务 -->
     <select id="selectOneById" parameterType="pd" resultType="pd">
-        select * from s_gxhpz_follow_task where id = #{id}
+        select t.*,DATE_FORMAT(t.appointmentDate, '%Y-%m-%d %H:%i:%s') AS appointmentDate1 from s_gxhpz_follow_task t  where t.id = #{id}
     </select>
 
+
+    <!-- 停止任务 -->
+    <update id="stopFollowTask" parameterType="pd">
+        update s_gxhpz_follow_task
+        <set>
+            <if test="taskStatus != null">
+                taskStatus = #{taskStatus},
+            </if>
+            <if test="updatedAt != null and updatedAt != ''">
+                updatedAt = #{updatedAt},
+            </if>
+            <if test="operator != null and operator != ''">
+                operator = #{operator},
+            </if>
+        </set>
+        where planId = #{id}
+    </update>
+    <!-- 关闭任务 -->
+    <update id="closeTask" parameterType="pd">
+        update s_gxhpz_follow_task
+        <set>
+            <if test="taskStatus != null">
+                taskStatus = #{taskStatus},
+            </if>
+            <if test="updatedAt != null and updatedAt != ''">
+                updatedAt = #{updatedAt},
+            </if>
+            <if test="operator != null and operator != ''">
+                operator = #{operator},
+            </if>
+        </set>
+        where id = #{id}
+    </update>
+
     <!-- 插入新任务 -->
     <insert id="insertFollowTask" parameterType="pd">
         insert into s_gxhpz_follow_task
@@ -98,6 +132,18 @@
             <if test="returnMethod != null and returnMethod != ''">
                 returnMethod,
             </if>
+            <if test="iscoordinate != null and iscoordinate != ''">
+                iscoordinate,
+            </if>
+            <if test="InterviewRecord != null and InterviewRecord != ''">
+                InterviewRecord,
+            </if>
+            <if test="timeFirstDiagnosis != null and timeFirstDiagnosis != ''">
+                timeFirstDiagnosis,
+            </if>
+            <if test="permanentStopTime != null and permanentStopTime != ''">
+                permanentStopTime,
+            </if>
             <if test="returnObject != null and returnObject != ''">
                 returnObject,
             </if>
@@ -230,6 +276,19 @@
             <if test="returnMethod != null and returnMethod != ''">
                 #{returnMethod},
             </if>
+            <if test="iscoordinate != null and iscoordinate != ''">
+                #{iscoordinate},
+            </if>
+            <if test="InterviewRecord != null and InterviewRecord != ''">
+                #{InterviewRecord},
+            </if>
+            <if test="timeFirstDiagnosis != null and timeFirstDiagnosis != ''">
+                #{timeFirstDiagnosis},
+            </if>
+            <if test="permanentStopTime != null and permanentStopTime != ''">
+                #{permanentStopTime},
+            </if>
+
             <if test="returnObject != null and returnObject != ''">
                 #{returnObject},
             </if>
@@ -367,6 +426,18 @@
             <if test="returnMethod != null and returnMethod != ''">
                 returnMethod = #{returnMethod},
             </if>
+            <if test="iscoordinate != null and iscoordinate != ''">
+                iscoordinate = #{iscoordinate},
+            </if>
+            <if test="InterviewRecord != null and InterviewRecord != ''">
+                InterviewRecord = #{InterviewRecord},
+            </if>
+            <if test="timeFirstDiagnosis != null and timeFirstDiagnosis != ''">
+                timeFirstDiagnosis = #{timeFirstDiagnosis},
+            </if>
+            <if test="permanentStopTime != null and permanentStopTime != ''">
+                permanentStopTime = #{permanentStopTime},
+            </if>
             <if test="returnObject != null and returnObject != ''">
                 returnObject = #{returnObject},
             </if>

+ 59 - 1
health-system/src/main/resources/mapper/pmServiceMapper/PharmaceuticalServiceMapper.xml

@@ -199,7 +199,65 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</select>
 
 	<select id="selectPatientById" parameterType="pd" resultType="pd">
-		select * from s_dtp_ysfw_archive_management where  1=1 and id=#{patientId}
+		select
+			h.id as id,
+			h.name,
+			h.gender,
+			h.age,
+			h.height,
+			h.weight,
+			h.BMI,
+			h.insurance,
+			h.waist,
+			h.hip,
+			h.bloodPressure,
+			h.healingLineCollection,
+			h.bloodSugar,
+			h.medicalHistory,
+			h.hasSurgicalTraumaHistory,
+			h.infectiousDiseaseHistory,
+			h.allergyHistory,
+			h.businessBelonging,
+			h.zlfq,
+			h.jytb,
+			h.treatmentStage,
+			h.pdl1,
+			h.fzjc,
+			h.zlsd,
+			h.tnb,
+			h.tnbhbz,
+			h.gxy,
+			h.gxyhbz,
+			h.gxz,
+			h.gxzhbz,
+			h.dateBirth,
+			h.phoneNumber,
+			h.documentNumber,
+			h.documentType,
+			h.idCardImg,
+			h.landlineNumber,
+			h.createTime,
+			h.archiveCreator,
+			h.archiveCompleter,
+			h.creator,
+			h.dl,
+			h.xl,
+			h.timeFirstDiagnosis,
+			h.addr,
+			h.contactPhone,
+			h.contactName,
+			h.followUpPerson,
+			h.followUpStatus,
+			h.acceptFollowUp,
+			h.archiveCompleteStatus,
+			h.charityAssistance,
+			h.storeName,
+			h.disease,
+			h.flipStatus,
+			h.joinProject,
+			h.documentType,
+			h.realNameStatus,
+			h.archiveCompleter from s_dtp_ysfw_archive_management h where  1=1 and h.id=#{patientId}
 	</select>
 
 	<!-- 插入新的档案记录 -->