浏览代码

修改随访表单

bzd_wsp 3 月之前
父节点
当前提交
c6188ea9c4

+ 4 - 0
health-admin/src/main/java/com/bzd/web/controller/dtp/PharmaceuticalServiceController.java

@@ -164,6 +164,9 @@ public class PharmaceuticalServiceController extends BaseController {
             mmap.put("xl",pageData1.get("xl"));
             mmap.putAll(pageData1);
         }
+        pd.put("patientId", Id);
+        PageData  Degree =pharmaceuticalService.getPerfectionDegree(pd);
+        mmap.put("Degree",Degree);
         /*Object updatePatientBasicInfo =  pharmaceuticalService.findBasicInfoById(pd);
         if(StringUtils.isNotNull(updatePatientBasicInfo)){
             PageData BasicpageData = (PageData) updatePatientBasicInfo;
@@ -179,6 +182,7 @@ public class PharmaceuticalServiceController extends BaseController {
         pd.put("archiveId", Id);
         List<PageData>  records =pharmaceuticalService.findrecordsByarchiveId(pd);
         mmap.put("recordsData",records);
+
         return prefix_archives + "/archivesEdit";
     }
 

+ 246 - 0
health-admin/src/main/java/com/bzd/web/controller/gxhpz/FollowTaskController.java

@@ -0,0 +1,246 @@
+package com.bzd.web.controller.gxhpz;
+
+import com.bzd.common.annotation.Log;
+import com.bzd.common.config.dao.PageData;
+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.StringUtils;
+import com.bzd.system.service.PharmaceuticalService;
+import com.bzd.system.service.gxhpz.FollowPlanService;
+import com.bzd.system.service.gxhpz.FollowTaskService;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.*;
+
+import java.math.BigDecimal;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * 随访任务任务控制层
+ * creator wsp
+ */
+@Controller
+@RequestMapping("/task/followTask")
+public class FollowTaskController extends BaseController {
+    private String prefix = "task";
+    @Autowired
+    private FollowTaskService followTaskService;
+
+    @Autowired
+    private FollowPlanService followPlanService;
+    @Autowired
+    private PharmaceuticalService pharmaceuticalService;
+
+    // 随访任务
+    private String prefix_followUp = "dtp/followUp";
+    /**
+     *
+     * 任务查询
+     */
+    @RequiresPermissions("gxhpz:task:list")
+    @PostMapping("/followTaskList")
+    @ResponseBody
+    public TableDataInfo TaskList() throws Exception {
+        PageData pd = this.getPageData();
+        startPage();
+        List<PageData> pageData = followTaskService.findForList(pd);
+        return  getDataTable(pageData);
+    }
+    /**
+     *
+     * 计划查询
+     */
+    @RequiresPermissions("gxhpz:task:list")
+    @PostMapping("/followPlanList")
+    @ResponseBody
+    public TableDataInfo PlanList() throws Exception {
+        PageData pd = this.getPageData();
+        startPage();
+        List<PageData> pageData = followPlanService.findForList(pd);
+        return  getDataTable(pageData);
+    }
+
+    /**
+     * 任务新增保存
+     */
+    @Log(title = "任务新增", businessType = BusinessType.INSERT)
+    @PostMapping("/saveFollowTask")
+    @ResponseBody
+    public AjaxResult saveFollowTask() throws Exception {
+        PageData pd = this.getPageData();
+        int result = followTaskService.save(pd);
+        if(result>0){
+            return AjaxResult.success("成功");
+        }else {
+            return AjaxResult.error("失败");
+        }
+
+    }
+    /**
+     * 计划新增保存
+     */
+    @Log(title = "计划新增", businessType = BusinessType.INSERT)
+    @PostMapping("/saveFollowPlan")
+    @ResponseBody
+    public AjaxResult saveFollowPlan() throws Exception {
+        PageData pd = this.getPageData();
+        int result = followPlanService.save(pd);
+        if(result>0){
+            return AjaxResult.success("成功");
+        }else {
+            return AjaxResult.error("失败");
+        }
+
+    }
+    @Log(title = "任务删除", businessType = BusinessType.DELETE)
+    @PostMapping("/removeTask")
+    @ResponseBody
+    public AjaxResult removeTask() throws Exception
+    {
+        PageData pd = new PageData();
+        pd = this.getPageData();
+       Object id = pd.get("ids");
+       if(StringUtils.isNotNull(id)){
+           String[] split = id.toString().split(",");
+           List<String> ids = Arrays.asList(split);
+           Integer integer = followTaskService.del(ids);
+           return toAjax(integer);
+
+       }
+        return AjaxResult.success("请选择要删除的数据");
+    }
+    @Log(title = "计划删除", businessType = BusinessType.DELETE)
+    @PostMapping("/removePlan")
+    @ResponseBody
+    public AjaxResult removePlan() throws Exception
+    {
+        PageData pd = new PageData();
+        pd = this.getPageData();
+        Object id = pd.get("ids");
+        if(StringUtils.isNotNull(id)){
+            String[] split = id.toString().split(",");
+            List<String> ids = Arrays.asList(split);
+            Integer integer = followPlanService.del(ids);
+            return toAjax(integer);
+
+        }
+        return AjaxResult.success("请选择要删除的数据");
+    }
+
+    /**
+     * 保存任务修改信息
+     */
+    @RequiresPermissions("gxhpz:task:edit")
+    @Log(title = "任务管理", businessType = BusinessType.UPDATE)
+    @PostMapping("/followTaskEdit")
+    @ResponseBody
+    public AjaxResult followTaskEdit() throws Exception
+    {
+        PageData pd = this.getPageData();
+        Integer update = followTaskService.update(pd);
+        if(update<=0){
+            return error("修改失败");
+        }
+        return toAjax(update);
+    }
+
+    /**
+     * 随访任务数据修改
+     *
+     * @return
+     * @throws Exception
+     */
+    @RequiresPermissions("gxhpz:task:edit")
+    @GetMapping("/FollowTaskEdit/{id}")
+    public String FollowTaskEdit(@PathVariable("id") Long id, ModelMap mmap) throws Exception {
+        PageData pd = this.getPageData();
+        pd.put("id", id);
+        PageData pd1 =new PageData();
+        PageData pd2 =new PageData();
+        PageData pd3=new PageData();
+        PageData pd4=new PageData();
+        PageData pd5=new PageData();
+        PageData pdt1=new PageData();
+        PageData pdt2=new PageData();
+        PageData pageData = followTaskService.selectOneById(pd);//根据任务id查询随访任务数据
+
+        if (StringUtils.isNotNull(pageData)) {
+            pd2.put("patientId", pageData.get("patientId"));
+
+            pd3.put("patientId", pageData.get("patientId"));//去查计划的条件 常规随访的
+            pd3.put("mdmCode", pageData.get("mdmCode"));//去查计划的条件 常规随访的
+            pd3.put("businessBelonging", "常规随访");//去查计划的条件 常规随访的
+
+            pd4.put("patientId", pageData.get("patientId"));//去查计划的条件 脱落召回
+            pd4.put("mdmCode", pageData.get("mdmCode"));//去查计划的条件 脱落召回
+            pd4.put("businessBelonging", "脱落召回");//去查计划的条件 脱落召回
+
+            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);//去查任务 落召回
+
+            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);
+            }
+            mmap.putAll(pd1);
+        }else{
+            mmap.put("未查询到数据 id",id);
+        }
+
+        return prefix_followUp + "/followUpEdit";
+    }
+
+    /**
+     * 保存计划修改信息
+     */
+    @RequiresPermissions("gxhpz:task:edit")
+    @Log(title = "计划管理", businessType = BusinessType.UPDATE)
+    @PostMapping("/followPlanEdit")
+    @ResponseBody
+    public AjaxResult followPlanEdit() throws Exception
+    {
+        PageData pd = this.getPageData();
+        Integer update = followPlanService.update(pd);
+        if(update<=0){
+            return error("修改失败");
+        }
+        return toAjax(update);
+    }
+
+
+
+
+
+
+
+}

+ 228 - 81
health-admin/src/main/resources/templates/dtp/followUp/followUpEdit.html

@@ -211,16 +211,14 @@
         </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"/>
             &nbsp; <i class="fa" th:class="${realNameStatus == 1 ? 'fa fa-check' : 'fa fa-close'}" id="checkName"  ></i>
             <input name="realNameStatus" id="realNameStatus" class="status" type="text"   th:value="${realNameStatus == 1 ? '已实名' : (realNameStatus == 0 ? '未实名' : '')}" readonly>
             <label>性别:</label>
-            <select name="gender" class="select-input" th:with="type=${@dict.getType('sys_user_sex')}" disabled="true" />
-                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
-                        th:selected="${dict.dictValue} == ${gender}" ></option>
-            </select>
+            <input name="gender" id="gender"  type="text" class="select-input"  th:value="${gender == 1 ? '女' : (gender == 0 ? '男' : '')}" readonly>
             <span class="span_line" readonly></span>
             <label>出生年月:</label>
             <input name="dateBirth" id="dateBirth" placeholder="出生年月" class="select-input"  type="text"    th:value="${dateBirth}" disabled="true" />
@@ -231,10 +229,11 @@
 
         <div class="ibox-content">
             <div>
-                <span>信息完整度:已完善---></span>
-                <div class="stat-percent">90%</div>
+                <span>档案完善度:已完善---><div></div></span>
+                <div class="stat-percent" th:text="${completenessPercentage} + ' %'"></div>
                 <div class="progress progress-mini">
-                    <div style="width: 90%;" class="progress-bar"></div>
+                    <!-- 使用 Thymeleaf 的 th:style 属性动态设置样式 -->
+                    <div class="progress-bar" th:style="'width: ' + ${completenessPercentage} + '%;'"></div>
                 </div>
             </div>
         </div>
@@ -301,32 +300,32 @@
                                     <div class="customize-form-group-container">
                                         <div class="customize-form-group">
                                             <label class="col-sm-1 control-label">肿瘤发病部位疾病:</label>
-                                            <select id="category-select1"   class="styled-input edit_inputs select2-multiple" disabled="true">
+                                            <select id="category-select1"   class="styled-input edit_inputs select2-multiple"  placeholder="肿瘤发病部位疾病" disabled="true">
                                             </select>
                                         </div>
                                         <div class="customize-form-group">
                                             <label class="col-sm-1 control-label">肿瘤治疗并发症与合并症:</label>
-                                            <select id="category-select2" class="styled-input edit_inputs select2-multiple" disabled="true">
+                                            <select id="category-select2" class="styled-input edit_inputs select2-multiple"  placeholder="肿瘤治疗并发症与合并症" disabled="true">
                                             </select>
                                         </div>
                                         <div class="customize-form-group">
                                             <label class="col-sm-1 control-label">风湿免疫疾病名称:</label>
-                                            <select id="category-select3"   class="styled-input edit_inputs select2-multiple"  disabled="true">
+                                            <select id="category-select3"   class="styled-input edit_inputs select2-multiple"  placeholder="风湿免疫疾病名称" disabled="true">
                                             </select>
                                         </div>
                                         <div class="customize-form-group">
                                             <label class="col-sm-1 control-label">罕见病疾病:</label>
-                                            <select id="category-select4" class="styled-input edit_inputs select2-multiple"  disabled="true">
+                                            <select id="category-select4" class="styled-input edit_inputs select2-multiple"  placeholder="罕见病疾病" disabled="true">
                                             </select>
                                         </div>
                                         <div class="customize-form-group">
                                             <label class="col-sm-1 control-label">感染类疾病:</label>
-                                            <select id="category-select5"   class="styled-input edit_inputs select2-multiple" disabled="true">
+                                            <select id="category-select5"   class="styled-input edit_inputs select2-multiple"  placeholder="感染类疾病" disabled="true">
                                             </select>
                                         </div>
                                         <div class="customize-form-group">
                                             <label class="col-sm-1 control-label">临时慢病:</label>
-                                            <select id="category-select6"   class="styled-input edit_inputs select2-multiple" disabled="true">
+                                            <select id="category-select6"   class="styled-input edit_inputs select2-multiple"  placeholder="临时慢病" disabled="true">
                                             </select>
                                         </div>
                                     </div>
@@ -476,7 +475,7 @@
                                 <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}==${currentEconomicSituation}">
+                                        <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}">
                                     </div>
 
                                     <span class="status"></span>
@@ -496,24 +495,24 @@
                                     <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="${weight}">
+                                            <input name="mfjilu" id="mfjilu" placeholder="请输入面访记录" class="styled-input edit_inputs" type="text" th:value="${record}">
                                         </div>
                                         <span class="status"></span>
                                     </div>
                                 </div>
                                 <div class="customize-form-group">
                                     <label>回访对象:</label>
-                                    <select name="bloodPressureStatus" class="select-input edit_inputs" th:with="type=${@dict.getType('sys_select_dtp_ysfw_huifangduixaing')}">
+                                    <select name="ReturnObject" class="select-input edit_inputs" 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}==${bloodPressureStatus}"></option>
+                                                th:selected="${dict.dictLabel}==${ReturnObject}"></option>
                                     </select>
                                     <span class="status"></span>
                                 </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}==${followUpFeedbackDoctor}"  name="followUpFeedbackDoctor" >
+                                        <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>
                                     <span class="status"></span>
                                 </div>
@@ -522,7 +521,7 @@
                                 <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}==${currentEconomicSituation}" >
+                                        <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}" >
                                     </div>
                                     <span class="status"></span>
                                 </div>
@@ -537,7 +536,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}==${followUpFeedbackDoctor}"  name="followUpFeedbackDoctor" >
+                                        <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" >
                                     </div>
                                     <span class="status"></span>
                                 </div>
@@ -551,16 +550,16 @@
                                     <span class="status"></span>
                                 </div>
                                 <div class="customize-form-group edit">
-                                    <label>永久停药原因:</label>
+                                    <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}==${followUpFeedbackDoctor}"  name="followUpFeedbackDoctor" >
+                                        <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" >
                                     </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}==${followUpFeedbackDoctor}"  name="followUpFeedbackDoctor" >
+                                        <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" >
                                     </div>
                                     <span class="status"></span>
                                     <span class="status"></span>
@@ -570,7 +569,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}==${followUpFeedbackDoctor}"  name="followUpFeedbackDoctor" >
+                                        <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" >
                                     </div>
                                     <span class="status"></span>
                                     <span class="status"></span>
@@ -578,18 +577,18 @@
                                 </div>
                                 <div id="ycgyycjy" class="hidden">
                                 <div class="customize-form-group edit">
-                                    <label>延迟购药(医嘱建议):</label>
+                                    <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}==${followUpFeedbackDoctor}"  name="followUpFeedbackDoctor" >
+                                        <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" >
                                     </div>
                                     <span class="status"></span>
                                 </div>
                                 </div>
                                 <div id="ycgyhzyybgf" class="hidden">
                                 <div class="customize-form-group edit">
-                                    <label>延迟购药(用药不规范):</label>
+                                    <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}==${followUpFeedbackDoctor}"  name="followUpFeedbackDoctor" >
+                                        <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" >
                                     </div>
                                     <span class="status"></span>
                                 </div>
@@ -597,9 +596,9 @@
                              </div>
                             <div id="tab-7" class="tab-pane active">
                                 <div class="customize-form-group edit">
-                                    <label  >是否出现不良反应:</label>
+                                    <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}==${currentEconomicSituation}">
+                                        <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}">
                                     </div>
                                     <span class="status"></span>
                                 </div>
@@ -608,7 +607,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="nyfysj" placeholder="不良反应时间" class="time-input time-input2" type="text"  th:value="${timeFirstDiagnosis}" required>
                                         </div>
                                         <span class="status"></span>
                                     </div>
@@ -620,7 +619,7 @@
                                             <div class="customize-form-group edit">
                                                 <div style="/*display: flex;*/">
                                                     <label style="width: auto;">不良反应症状:</label>
-                                                    <button type="button" data-toggle="modal"  class="btn btn-xs btn-primary" data-target="#myModal5">新增不良反应</button>
+                                                    <button type="button" data-toggle="modal"  class="btn btn-ms btn-primary" data-target="#myModal5">新增</button>
                                                     <table id="byfyTable" style="width: 340px;">
                                                         <thead>
                                                         <tr>
@@ -704,23 +703,32 @@
 <th:block th:include="include :: layout-latest-js" />
 <th:block th:include="include :: bootstrap-table-fixed-columns-js" />
 <th:block th:include="include :: ztree-js" />
+
+<th:block th:include="include :: select2-css" />
+<th:block th:include="include :: bootstrap-select-css" />
+</body>   <th:block th:include="include :: select2-js" />
+<th:block th:include="include :: bootstrap-select-js" />
 </body>
 </html>
 
-<script>
+<script th:inline="javascript">
     var formSubmitted = true;
     var prefix = ctx + "dtp/pmService";
     var  blfyindex=0;
+    //购药记录
+    var recordsData;
+    // 回显数据随访计划
+    var listPlan1;
+    var listPlan2;
+    // 回显数据随访任务
+    var listTask1;
+    var listTask2;
     function submitHandler() {
         var selectedValue = $('input[name="huifanffs"]:checked').val();
-
-
-
         if (!selectedValue) {
             alert('请选择回访方式!');
             return;
         }
-
         if (selectedValue === '微信' && !$('#adverseReactionImage')[0].files.length) {
             alert('微信回访时,回访图片为必填项!');
             return;
@@ -869,6 +877,141 @@
            // initializeTableForTab(tableId);
         });
 
+
+        // 初始化 Select2 插件
+        for (let i = 1; i <= 6; i++) {
+            $(`#category-select${i}`).select2({
+                placeholder: "",
+                allowClear: true
+            });
+        }
+
+        // 获取所有下拉选项的数据
+        $.ajax({
+            url: ctx + 'sp/sp/typeDate',
+            method: 'GET',
+            dataType: 'json',
+            success: function(data) {
+                var options1 = $('#category-select1');
+                var options2 = $('#category-select2');
+                var options3 = $('#category-select3');
+                var options4 = $('#category-select4');
+                var options5 = $('#category-select5');
+                var options6 = $('#category-select6');
+
+                // 清空已有选项(除了第一个默认选项)
+                options1.find('option').not(':first').remove();
+                options2.find('option').not(':first').remove();
+                options3.find('option').not(':first').remove();
+                options4.find('option').not(':first').remove();
+                options5.find('option').not(':first').remove();
+                options6.find('option').not(':first').remove();
+
+                // 添加默认选项
+                $('<option>', {
+                    value: '',
+                    text : '请选择疾病'
+                }).appendTo(options1);
+                $('<option>', {
+                    value: '',
+                    text : '请选择疾病'
+                }).appendTo(options2);
+                $('<option>', {
+                    value: '',
+                    text : '请选择疾病'
+                }).appendTo(options3);
+                $('<option>', {
+                    value: '',
+                    text : '请选择疾病'
+                }).appendTo(options4);
+                $('<option>', {
+                    value: '',
+                    text : '请选择疾病'
+                }).appendTo(options5);
+                $('<option>', {
+                    value: '',
+                    text : '请选择疾病'
+                }).appendTo(options6);
+                // 回显数据
+                var dl = /*[[${dl}]]*/ '';
+                // 直接使用 dl 数据预填充下拉列表
+                var dlParsed = JSON.parse(dl);
+                if (Array.isArray(dlParsed)) {
+                    var dlIds = dlParsed.map(function (item) {
+                        return item.id;
+                    }); // 转换为 ID 数组
+                    // 遍历返回的数据并添加选项
+                    $.each(data.value, function(index, item) {
+                        if(item.dict_key == 1){
+                            $('<option>', {
+                                value: item.id,
+                                text : item.categoryName
+                            }).appendTo(options1);
+                            $(`#category-select1`).val(dlIds).trigger('change');
+                        }
+                        if(item.dict_key == 2){
+                            $('<option>', {
+                                value: item.id,
+                                text : item.categoryName
+                            }).appendTo(options2);
+                            $(`#category-select2`).val(dlIds).trigger('change');
+                        }
+                        if(item.dict_key == 3){
+                            $('<option>', {
+                                value: item.id,
+                                text : item.categoryName
+                            }).appendTo(options3);
+                            $(`#category-select3`).val(dlIds).trigger('change');
+
+                        }
+                        if(item.dict_key == 4){
+                            $('<option>', {
+                                value: item.id,
+                                text : item.categoryName
+                            }).appendTo(options4);
+                            $(`#category-select4`).val(dlIds).trigger('change');
+                        }
+                        if(item.dict_key == 5){
+                            $('<option>', {
+                                value: item.id,
+                                text : item.categoryName
+                            }).appendTo(options5);
+                            $(`#category-select5`).val(dlIds).trigger('change');
+                        }
+                        if(item.dict_key == 6){
+                            $('<option>', {
+                                value: item.id,
+                                text : item.categoryName
+                            }).appendTo(options6);
+                            $(`#category-select6`).val(dlIds).trigger('change');
+                        }
+                    });
+
+                    // 重新初始化 Select2 以反映新的选项
+                    options1.trigger('change');
+                    options2.trigger('change');
+                    options3.trigger('change');
+                    options4.trigger('change');
+                    options5.trigger('change');
+                    options6.trigger('change');
+
+
+                }
+
+            },
+            error: function(xhr, status, error) {
+                console.error("Failed to load disease categories:", error);
+            }
+        });
+        //购药记录
+         recordsData = /*[[${recordsData}]]*/ '';
+        // 回显数据随访计划
+         listPlan1 = /*[[${Plan1}]]*/ '';
+        listPlan2 = /*[[${Plan2}]]*/ '';
+
+        // 回显数据随访计划
+        listTask1 = /*[[${listTask1}]]*/ '';
+        listTask2 = /*[[${listTask2}]]*/ '';
     });
     // 默认显示/隐藏逻辑
     function updateVisibility() {
@@ -962,22 +1105,25 @@
         };
         console.log("tabId="+tabId.substring(4));
         if(tabId==='tab-2'){
+            debugger
+            //购药记录
             var data2=[];
+            data2=recordsData;
             // 初始化表格 getDrugPurchaseList
-            $.ajax({
-                cache : true,
-                type : "POST",
-                url : ctx + "dtp/pmService/getDrugPurchaseList",
-                data : data,
-                async : false,
-                error : function(request) {
-                    $.modal.alertError("系统错误");
-                },
-                success : function(data) {
-                    data2=data.rows;
-                    $.operate.successCallback(data);
-                }
-            });
+            // $.ajax({
+            //     cache : true,
+            //     type : "POST",
+            //     url : ctx + "dtp/pmService/getDrugPurchaseList",
+            //     data : data,
+            //     async : false,
+            //     error : function(request) {
+            //         $.modal.alertError("系统错误");
+            //     },
+            //     success : function(data) {
+            //         data2=data.rows;
+            //         $.operate.successCallback(data);
+            //     }
+            // });
 
                 var options = {
                     data: data2,
@@ -1006,27 +1152,28 @@
         }
         if(tabId==='tab-3'){
             var tableElement4 = $('#bootstrap-table-4');
+            // 回显数据随访计划
             var data4=[];
             var data5=[];
-            // 初始化表格 getDrugPurchaseList
-            $.ajax({
-                cache : true,
-                type : "POST",
-                url : ctx + "dtp/pmService/getDrugPurchaseList",
-                data : data,
-                async : false,
-                error : function(request) {
-                    $.modal.alertError("系统错误");
-                },
-                success : function(data) {
-                    data4=data.rows;
-                    data5=data.rows;
-                    $.operate.successCallback(data);
-                }
-            });
-
-
 
+            data4=listTask1;
+            data5=listTask2;
+            // 初始化表格 getDrugPurchaseList
+            // $.ajax({
+            //     cache : true,
+            //     type : "POST",
+            //     url : ctx + "dtp/pmService/getDrugPurchaseList",
+            //     data : data,
+            //     async : false,
+            //     error : function(request) {
+            //         $.modal.alertError("系统错误");
+            //     },
+            //     success : function(data) {
+            //         data4=data.rows;
+            //         data5=data.rows;
+            //         $.operate.successCallback(data);
+            //     }
+            // });
            var options ={
                 // 配置表格的相关属性
                 // 例如数据源、列定义等
@@ -1044,12 +1191,12 @@
                 fixedRightNumber: 1,
                 columns : [
                         { field: 'id', title: '序号' },
-                        { field: 'followUpPersonName', title: '任务名称' },
-                        { field: 'disease', title: '任务类型'},
-                        { field: 'filingDate', title: '预约时间' },
-                        { field: 'lastPurchaseDate', title: '完成时间' },
-                        { field: 'patientName', title: '任务跟进人' },
-                        { field: 'patientAssignmentStatus', title: '任务状态' },
+                        { field: 'taskName', title: '任务名称' },
+                        { field: 'taskTheme', title: '任务类型'},
+                        { field: 'appointmentDate', title: '预约时间' },
+                        { field: 'completionTime', title: '完成时间' },
+                        { field: 'taskFollower', title: '任务跟进人' },
+                        { field: 'taskStatus', title: '任务状态' },
                         {
                             title: '操作',
                             align: 'center',
@@ -1087,12 +1234,12 @@
                         fixedRightNumber: 1,
                         columns : [
                                 { field: 'id', title: '序号' },
-                                { field: 'followUpPersonName', title: '任务名称' },
-                                { field: 'disease', title: '任务类型'},
-                                { field: 'filingDate', title: '预约时间' },
-                                { field: 'lastPurchaseDate', title: '完成时间' },
-                                { field: 'patientName', title: '任务跟进人' },
-                                { field: 'patientAssignmentStatus', title: '任务状态' },
+                                { field: 'taskName', title: '任务名称' },
+                                { field: 'taskTheme', title: '任务类型'},
+                                { field: 'appointmentDate', title: '预约时间' },
+                                { field: 'completionTime', title: '完成时间' },
+                                { field: 'taskFollower', title: '任务跟进人' },
+                                { field: 'taskStatus', title: '任务状态' },
                                 {
                                     title: '操作',
                                     align: 'center',

+ 25 - 10
health-admin/src/main/resources/templates/dtp/followUp/followUpList.html

@@ -171,7 +171,7 @@
 	<script th:inline="javascript">
 		var editFlag = [[${@permission.hasPermi('dtp:pmService:edit')}]];
 		var removeFlag = [[${@permission.hasPermi('dtp:pmService:remove')}]];
-		var prefix = ctx + "dtp/pmService";
+		var prefix = ctx + "task/followTask";
 		$(function() {
 		    var panehHidden = false;
 		    if ($(this).width() < 1590) {
@@ -191,11 +191,11 @@
 
 		function queryArchivesList() {
 		    var options = {
-		        url: prefix + "/followUpList",
-		        viewUrl: prefix + "/followUpView/{id}",
-		        createUrl: prefix + "/followUpAdd",
-		        updateUrl: prefix + "/followUpEdit/{id}",
-		        removeUrl: prefix + "/followUpRemove",
+		        url: prefix + "/followTaskList",
+		        viewUrl: prefix + "/FollowTaskView/{id}",
+		        createUrl: prefix + "/saveFollowTask",
+		        updateUrl: prefix + "/FollowTaskEdit/{id}",
+		        removeUrl: prefix + "/removeTask",
 		        /*exportUrl: prefix + "/export",
 		        importUrl: prefix + "/importData",
 		        importTemplateUrl: prefix + "/importTemplate",*/
@@ -232,7 +232,13 @@
 							return "";
 						}
 					} },
-				{ field: 'gender', title: '性别', align: 'center' },
+				{ field: 'gender', title: '性别', align: 'center', formatter: function(value, row, index) {
+						switch (value) {
+							case 0: return "男";
+							case 1: return "女";
+							default: return "未知";
+						}
+					} },
 				{ field: 'age', title: '年龄', align: 'center' },
 				{ field: 'followUpSummary', title: '随访小结',width: 500, align: 'center' },
 				{ field: 'disease', title: '疾病', align: 'center' },
@@ -244,13 +250,22 @@
 						formatter: function(value, row, index) {
 							switch (value) {
 								case '待执行':
-									return '<span class=\"btn-danger">'+value+'</span>';
+									return '<span class=\"btn-danger">待执行</span>';
 									break;
 								case '已完成':
-									return '<span class=\"btn-primary">'+value+'</span>';
+									return '<span class=\"btn-primary">已完成</span>';
+									break;
+								case '未完成':
+									return '<span class=\"btn-primary">未完成</span>';
+									break;
+								case '已下发':
+									return '<span class=\"btn-primary">已下发</span>';
+									break;
+								case '已取消':
+									return '<span class=\"btn-primary">已取消</span>';
 									break;
 								default:
-									return '<span class=\"btn-warning">'+value+'</span>';
+									return '<span class=\"btn-warning">'-'</span>';
 							}
 						}},
 					{ field: 'lastOutboundStatus', title: '最后外呼状态', align: 'center',

+ 17 - 3
health-system/src/main/java/com/bzd/system/service/PharmaceuticalService.java

@@ -246,9 +246,9 @@ public class PharmaceuticalService {
             return false;
         }
     }
-    public Object selectPatientById(PageData pd) throws Exception{
-        Object PageData =daoSupport.findForList("PharmaceuticalServiceMapper.selectPatientById", pd);
-        return PageData;
+    public PageData selectPatientById(PageData pd) throws Exception{
+        PageData Pdo = (PageData) daoSupport.findForObject("PharmaceuticalServiceMapper.selectPatientById", pd);
+        return Pdo;
 
     }
 
@@ -333,4 +333,18 @@ public class PharmaceuticalService {
         pd.put("msg","新建失败");
         return pd;
     }
+
+    /**
+     * 统计患者档案完善度
+     * filledFieldsCount 字段完成数量 completenessPercentage完成百分比 id 患者id name 患者姓名
+     * @param pd
+     * @return
+     * @throws Exception
+     */
+    public PageData getPerfectionDegree(PageData pd) throws Exception {
+        PageData pjd= (PageData) daoSupport.findForObject("PharmaceuticalServiceMapper.statisticsPerfectionDegree", pd);
+        return pjd;
+    }
+
+
 }

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

@@ -0,0 +1,94 @@
+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 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;
+
+@Service
+public class FollowPlanService {
+    @Autowired
+    private DaoBase dao;
+    @Resource(name = "daoSupport")
+    private DaoSupport daoSupport;
+
+    /**
+     * 查询列表 
+     * @param pd
+     * @return 
+     * @throws Exception
+     */
+    public List<PageData> findForList(final PageData pd) throws Exception {
+        return (List<PageData>) daoSupport.findForList("followPlanMapper.selectFollowPlans", pd);
+    }
+    /**
+     * 根据药品编码和患者id,业务归属 查询计划 只能出现一条数据
+     * @param pd
+     * @return
+     * @throws Exception
+     */
+    public PageData selectPlanByCPB(final PageData pd) throws Exception {
+        PageData pdo= (PageData) daoSupport.findForObject("followPlanMapper.selectPlanByCPB", pd);
+        return pdo;
+    }
+    /**
+     * 查询单个
+     * @param pd
+     * @return
+     * @throws Exception
+     */
+    public Object selectOneById(final PageData pd) throws Exception {
+        return daoSupport.findForObject("followPlanMapper.selectOneById", pd);
+    }
+
+    /**
+     * 添加
+     * @param pd
+     * @return
+     * @throws Exception
+     */
+    @Transactional(rollbackFor = Exception.class)
+    public int save(final PageData pd) throws Exception {
+      return  daoSupport.save("followPlanMapper.insertFollowPlan", pd);
+
+    }
+
+    /**
+     *
+     * @param ids
+     * @return
+     * @throws Exception
+     */
+    public Integer del(List<String> ids) throws Exception {
+        return daoSupport.delete("followPlanMapper.deleteFollowPlansByIds", ids);
+    }
+
+    /**
+     * 修改配置
+     * @param pd
+     * @return
+     * @throws Exception
+     */
+    public Integer update(PageData pd) throws Exception {
+        return daoSupport.update("followPlanMapper.updateFollowPlan", pd);
+    }
+
+
+    /**
+     * 统计患者档案完善度
+     * filledFieldsCount 字段完成数量 completenessPercentage完成百分比 id 患者id name 患者姓名
+     * @param pd
+     * @return
+     * @throws Exception
+     */
+    public PageData getPerfectionDegree(PageData pd) throws Exception {
+        PageData pjd= (PageData) daoSupport.findForObject("PharmaceuticalServiceMapper.statisticsPerfectionDegree", pd);
+        return pjd;
+    }
+
+}

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

@@ -0,0 +1,71 @@
+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 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;
+@Service
+public class FollowTaskService {
+    @Autowired
+    private DaoBase dao;
+    @Resource(name = "daoSupport")
+    private DaoSupport daoSupport;
+
+    /**
+     * 查询列表 
+     * @param pd
+     * @return 
+     * @throws Exception
+     */
+    public List<PageData> findForList(final PageData pd) throws Exception {
+        return (List<PageData>) daoSupport.findForList("followTaskMapper.selectFollowTasks", pd);
+    }
+
+    /**
+     * 查询单个
+     * @param pd
+     * @return
+     * @throws Exception
+     */
+    public PageData selectOneById(final PageData pd) throws Exception {
+        PageData pdo= (PageData) daoSupport.findForObject("followTaskMapper.selectOneById", pd);
+        return pdo;
+    }
+
+    /**
+     * 添加
+     * @param pd
+     * @return
+     * @throws Exception
+     */
+    @Transactional(rollbackFor = Exception.class)
+    public int save(final PageData pd) throws Exception {
+      return  daoSupport.save("followTaskMapper.insertFollowTask", pd);
+
+    }
+
+    /**
+     *
+     * @param ids
+     * @return
+     * @throws Exception
+     */
+    public Integer del(List<String> ids) throws Exception {
+        return daoSupport.delete("followTaskMapper.deleteFollowTasksByIds", ids);
+    }
+
+    /**
+     * 修改配置
+     * @param pd
+     * @return
+     * @throws Exception
+     */
+    public Integer update(PageData pd) throws Exception {
+        return daoSupport.update("followTaskMapper.updateFollowTask", pd);
+    }
+
+}

+ 223 - 0
health-system/src/main/resources/mapper/gxhpz/followPlanMapper.xml

@@ -0,0 +1,223 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="followPlanMapper">
+    <!-- 查询多个计划 -->
+    <select id="selectFollowPlans" parameterType="pd" resultType="pd">
+        select * from s_gxhpz_follow_plan where 1=1
+        <if test="id != null">
+            and id = #{id}
+        </if>
+        <if test="productName != null and productName != ''">
+            and productName = #{productName}
+        </if>
+        <if test="mdmCode != null and mdmCode != ''">
+            and mdmCode = #{mdmCode}
+        </if>
+        <if test="specification != null and specification != ''">
+            and specification = #{specification}
+        </if>
+        <if test="patientId != null">
+            and patientId = #{patientId}
+        </if>
+        <if test="businessBelonging != null and businessBelonging != ''">
+            and businessBelonging = #{businessBelonging}
+        </if>
+        <if test="planName != null and planName != ''">
+            and planName = #{planName}
+        </if>
+        <if test="storeId != null and storeId != ''">
+            and storeId = #{storeId}
+        </if>
+        <!-- 省略其他字段条件... -->
+    </select>
+
+    <!-- 根据药品编码和患者id查询计划 只能出现一条数据 -->
+    <select id="selectPlanByCPB" parameterType="pd" resultType="pd">
+        select * from s_gxhpz_follow_plan where mdmCode = #{mdmCode} and patientId = #{patientId} and businessBelonging=#{businessBelonging}
+    </select>
+    <!-- 根据ID查询单个计划 -->
+    <select id="selectOneById" parameterType="pd" resultType="pd">
+        select * from s_gxhpz_follow_plan where id = #{id}
+    </select>
+
+    <!-- 插入新计划 -->
+    <insert id="insertFollowPlan" parameterType="pd">
+        insert into s_gxhpz_follow_plan
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="productName != null and productName != ''">
+                productName,
+            </if>
+            <if test="mdmCode != null and mdmCode != ''">
+                mdmCode,
+            </if>
+            <if test="specification != null and specification != ''">
+                specification,
+            </if>
+            <if test="patientId != null">
+                patientId,
+            </if>
+            <if test="businessBelonging != null and businessBelonging != ''">
+                businessBelonging,
+            </if>
+            <if test="planName != null and planName != ''">
+                planName,
+            </if>
+            <if test="storeId != null and storeId != ''">
+                storeId,
+            </if>
+            <if test="storeName != null and storeName != ''">
+                storeName,
+            </if>
+            <if test="templateId != null and templateId != ''">
+                templateId,
+            </if>
+            <if test="taskId != null and taskId != ''">
+                taskId,
+            </if>
+            <if test="follow_up_person != null and follow_up_person != ''">
+                follow_up_person,
+            </if>
+            <if test="follow_up_person_id != null and follow_up_person_id != ''">
+                follow_up_person_id,
+            </if>
+            <if test="createdBy != null and createdBy != ''">
+                createdBy,
+            </if>
+            <if test="status != null">
+                status,
+            </if>
+            <if test="updatedBy != null and updatedBy != ''">
+                updatedBy,
+            </if>
+            <if test="createdTime != null">
+                createdTime,
+            </if>
+            <if test="updatedTime != null and updatedTime != ''">
+                updatedTime,
+            </if>
+        </trim>
+        values
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="productName != null and productName != ''">
+                #{productName},
+            </if>
+            <if test="mdmCode != null and mdmCode != ''">
+                #{mdmCode},
+            </if>
+            <if test="specification != null and specification != ''">
+                #{specification},
+            </if>
+            <if test="patientId != null">
+                #{patientId},
+            </if>
+            <if test="businessBelonging != null and businessBelonging != ''">
+                #{businessBelonging},
+            </if>
+            <if test="planName != null and planName != ''">
+                #{planName},
+            </if>
+            <if test="storeId != null and storeId != ''">
+                #{storeId},
+            </if>
+            <if test="storeName != null and storeName != ''">
+                #{storeName},
+            </if>
+            <if test="templateId != null and templateId != ''">
+                #{templateId},
+            </if>
+            <if test="taskId != null and taskId != ''">
+                #{taskId},
+            </if>
+            <if test="follow_up_person != null and follow_up_person != ''">
+                #{follow_up_person},
+            </if>
+            <if test="follow_up_person_id != null and follow_up_person_id != ''">
+                #{follow_up_person_id},
+            </if>
+            <if test="createdBy != null and createdBy != ''">
+                #{createdBy},
+            </if>
+            <if test="status != null">
+                #{status},
+            </if>
+            <if test="updatedBy != null and updatedBy != ''">
+                #{updatedBy},
+            </if>
+            <if test="createdTime != null">
+                #{createdTime},
+            </if>
+            <if test="updatedTime != null and updatedTime != ''">
+                #{updatedTime},
+            </if>
+        </trim>
+    </insert>
+
+    <!-- 更新计划 -->
+    <update id="updateFollowPlan" parameterType="pd">
+        update s_gxhpz_follow_plan
+        <set>
+            <if test="productName != null and productName != ''">
+                productName = #{productName},
+            </if>
+            <if test="mdmCode != null and mdmCode != ''">
+                mdmCode = #{mdmCode},
+            </if>
+            <if test="specification != null and specification != ''">
+                specification = #{specification},
+            </if>
+            <if test="patientId != null">
+                patientId = #{patientId},
+            </if>
+            <if test="businessBelonging != null and businessBelonging != ''">
+                businessBelonging = #{businessBelonging},
+            </if>
+            <if test="planName != null and planName != ''">
+                planName = #{planName},
+            </if>
+            <if test="storeId != null and storeId != ''">
+                storeId = #{storeId},
+            </if>
+            <if test="storeName != null and storeName != ''">
+                storeName = #{storeName},
+            </if>
+            <if test="templateId != null and templateId != ''">
+                templateId = #{templateId},
+            </if>
+            <if test="taskId != null and taskId != ''">
+                taskId = #{taskId},
+            </if>
+            <if test="follow_up_person != null and follow_up_person != ''">
+                follow_up_person = #{follow_up_person},
+            </if>
+            <if test="follow_up_person_id != null and follow_up_person_id != ''">
+                follow_up_person_id = #{follow_up_person_id},
+            </if>
+            <if test="createdBy != null and createdBy != ''">
+                createdBy = #{createdBy},
+            </if>
+            <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>
+
+    <!-- 删除计划 -->
+    <delete id="deleteFollowPlansByIds" parameterType="java.util.List">
+        <if test="list != null and list.size() > 0">
+            delete from s_gxhpz_follow_plan
+            where id in
+            <foreach item="id" index="index" collection="list" open="(" separator="," close=")">
+                #{id}
+            </foreach>
+        </if>
+    </delete>
+</mapper>

+ 462 - 0
health-system/src/main/resources/mapper/gxhpz/followTaskMapper.xml

@@ -0,0 +1,462 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="followTaskMapper">
+    <!-- 查询任务 -->
+    <select id="selectFollowTasks" parameterType="pd" resultType="pd">
+        select * from s_gxhpz_follow_task where 1=1
+        <if test="id != null">
+            and id = #{id}
+        </if>
+        <if test="appointmentDate != null">
+            and appointmentDate = #{appointmentDate}
+        </if>
+        <if test="businessBelonging != null and businessBelonging != ''">
+            and businessBelonging = #{businessBelonging}
+        </if>
+        <if test="taskName != null and taskName != ''">
+            and taskName = #{taskName}
+        </if>
+        <if test="patientId != null and patientId != ''">
+            and patientId = #{patientId}
+        </if>
+        <if test="planId != null and planId != ''">
+            and planId = #{planId}
+        </if>
+        <if test="patientName != null and patientName != ''">
+            and patientName = #{patientName}
+        </if>
+        <if test="gender != null">
+            and gender = #{gender}
+        </if>
+        <if test="age != null">
+            and age = #{age}
+        </if>
+        <!-- 省略其他字段条件... -->
+    </select>
+
+    <!-- 根据ID查询单个任务 -->
+    <select id="selectOneById" parameterType="pd" resultType="pd">
+        select * from s_gxhpz_follow_task where id = #{id}
+    </select>
+
+    <!-- 插入新任务 -->
+    <insert id="insertFollowTask" parameterType="pd">
+        insert into s_gxhpz_follow_task
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="appointmentDate != null">
+                appointmentDate,
+            </if>
+            <if test="businessBelonging != null and businessBelonging != ''">
+                businessBelonging,
+            </if>
+            <if test="taskName != null and taskName != ''">
+                taskName,
+            </if>
+            <if test="taskTheme != null and taskTheme != ''">
+                taskTheme,
+            </if>
+            <if test="planId != null and planId != ''">
+                planId,
+            </if>
+            <if test="patientId != null and patientId != ''">
+                patientId,
+            </if>
+            <if test="patientName != null and patientName != ''">
+                patientName,
+            </if>
+            <if test="gender != null">
+                gender,
+            </if>
+            <if test="age != null">
+                age,
+            </if>
+            <!-- 省略其他字段... -->
+            <!-- 新增字段 -->
+            <if test="followUpSummary != null and followUpSummary != ''">
+                followUpSummary,
+            </if>
+            <if test="followUpSummaryid != null and followUpSummaryid != ''">
+                followUpSummaryid,
+            </if>
+            <if test="disease != null and disease != ''">
+                disease,
+            </if>
+            <if test="storeName != null and storeName != ''">
+                storeName,
+            </if>
+            <if test="genericName != null and genericName != ''">
+                genericName,
+            </if>
+            <if test="productName != null and productName != ''">
+                productName,
+            </if>
+            <if test="taskFollower != null and taskFollower != ''">
+                taskFollower,
+            </if>
+            <if test="returnMethod != null and returnMethod != ''">
+                returnMethod,
+            </if>
+            <if test="returnObject != null and returnObject != ''">
+                returnObject,
+            </if>
+            <if test="returnImgUrl != null and returnImgUrl != ''">
+                returnImgUrl,
+            </if>
+            <if test="medicationStatus != null and medicationStatus != ''">
+                medicationStatus,
+            </if>
+            <if test="stoped != null">
+                stoped,
+            </if>
+            <if test="charitable != null and charitable != ''">
+                charitable,
+            </if>
+            <if test="perpetual_stopdrug_cause != null and perpetual_stopdrug_cause != ''">
+                perpetual_stopdrug_cause,
+            </if>
+            <if test="other_channels != null and other_channels != ''">
+                other_channels,
+            </if>
+            <if test="delay_purchase_doctor != null and delay_purchase_doctor != ''">
+                delay_purchase_doctor,
+            </if>
+            <if test="delayed_purchase_drugs != null and delayed_purchase_drugs != ''">
+                delayed_purchase_drugs,
+            </if>
+            <if test="is_adverse_reaction != null and is_adverse_reaction != ''">
+                is_adverse_reaction,
+            </if>
+            <if test="adverse_reaction_time != null and adverse_reaction_time != ''">
+                adverse_reaction_time,
+            </if>
+            <if test="good_response_symptom_id != null and good_response_symptom_id != ''">
+                good_response_symptom_id,
+            </if>
+            <if test="nutrition_evaluation_id != null and nutrition_evaluation_id != ''">
+                nutrition_evaluation_id,
+            </if>
+            <if test="medication_record_id != null and medication_record_id != ''">
+                medication_record_id,
+            </if>
+            <if test="other != null and other != ''">
+                other,
+            </if>
+            <if test="actualFollowUpTime != null">
+                actualFollowUpTime,
+            </if>
+            <if test="callConnectedCount != null">
+                callConnectedCount,
+            </if>
+            <if test="nextCallTime != null">
+                nextCallTime,
+            </if>
+            <if test="lastOutboundFlag != null and lastOutboundFlag != ''">
+                lastOutboundFlag,
+            </if>
+            <if test="outboundCallCount != null">
+                outboundCallCount,
+            </if>
+            <if test="nextOutboundCallCount != null">
+                nextOutboundCallCount,
+            </if>
+            <if test="taskStatus != null and taskStatus != ''">
+                taskStatus,
+            </if>
+            <if test="completionTime != null">
+                completionTime,
+            </if>
+            <if test="lastOutboundStatus != null and lastOutboundStatus != ''">
+                lastOutboundStatus,
+            </if>
+            <if test="operator != null and operator != ''">
+                operator,
+            </if>
+        </trim>
+        values
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <!-- 基础字段 -->
+            <if test="appointmentDate != null">
+                #{appointmentDate},
+            </if>
+            <if test="businessBelonging != null and businessBelonging != ''">
+                #{businessBelonging},
+            </if>
+            <if test="taskName != null and taskName != ''">
+                #{taskName},
+            </if>
+            <if test="taskTheme != null and taskTheme != ''">
+                #{taskTheme},
+            </if>
+            <if test="planId != null and planId != ''">
+                #{planId},
+            </if>
+            <if test="patientId != null and patientId != ''">
+                #{patientId},
+            </if>
+            <if test="patientName != null and patientName != ''">
+                #{patientName},
+            </if>
+            <if test="gender != null">
+                #{gender},
+            </if>
+            <if test="age != null">
+                #{age},
+            </if>
+
+            <!-- 新增字段 -->
+            <if test="followUpSummary != null and followUpSummary != ''">
+                #{followUpSummary},
+            </if>
+            <if test="followUpSummaryid != null and followUpSummaryid != ''">
+                #{followUpSummaryid},
+            </if>
+            <if test="disease != null and disease != ''">
+                #{disease},
+            </if>
+            <if test="storeName != null and storeName != ''">
+                #{storeName},
+            </if>
+            <if test="genericName != null and genericName != ''">
+                #{genericName},
+            </if>
+            <if test="productName != null and productName != ''">
+                #{productName},
+            </if>
+            <if test="taskFollower != null and taskFollower != ''">
+                #{taskFollower},
+            </if>
+            <if test="returnMethod != null and returnMethod != ''">
+                #{returnMethod},
+            </if>
+            <if test="returnObject != null and returnObject != ''">
+                #{returnObject},
+            </if>
+            <if test="returnImgUrl != null and returnImgUrl != ''">
+                #{returnImgUrl},
+            </if>
+            <if test="medicationStatus != null and medicationStatus != ''">
+                #{medicationStatus},
+            </if>
+            <if test="stoped != null">
+                #{stoped},
+            </if>
+            <if test="charitable != null and charitable != ''">
+                #{charitable},
+            </if>
+            <if test="perpetual_stopdrug_cause != null and perpetual_stopdrug_cause != ''">
+                #{perpetual_stopdrug_cause},
+            </if>
+            <if test="other_channels != null and other_channels != ''">
+                #{other_channels},
+            </if>
+            <if test="delay_purchase_doctor != null and delay_purchase_doctor != ''">
+                #{delay_purchase_doctor},
+            </if>
+            <if test="delayed_purchase_drugs != null and delayed_purchase_drugs != ''">
+                #{delayed_purchase_drugs},
+            </if>
+            <if test="is_adverse_reaction != null and is_adverse_reaction != ''">
+                #{is_adverse_reaction},
+            </if>
+            <if test="adverse_reaction_time != null and adverse_reaction_time != ''">
+                #{adverse_reaction_time},
+            </if>
+            <if test="good_response_symptom_id != null and good_response_symptom_id != ''">
+                #{good_response_symptom_id},
+            </if>
+            <if test="nutrition_evaluation_id != null and nutrition_evaluation_id != ''">
+                #{nutrition_evaluation_id},
+            </if>
+            <if test="medication_record_id != null and medication_record_id != ''">
+                #{medication_record_id},
+            </if>
+            <if test="other != null and other != ''">
+                #{other},
+            </if>
+            <if test="actualFollowUpTime != null">
+                #{actualFollowUpTime},
+            </if>
+            <if test="callConnectedCount != null">
+                #{callConnectedCount},
+            </if>
+            <if test="nextCallTime != null">
+                #{nextCallTime},
+            </if>
+            <if test="lastOutboundFlag != null and lastOutboundFlag != ''">
+                #{lastOutboundFlag},
+            </if>
+            <if test="outboundCallCount != null">
+                #{outboundCallCount},
+            </if>
+            <if test="nextOutboundCallCount != null">
+                #{nextOutboundCallCount},
+            </if>
+            <if test="taskStatus != null and taskStatus != ''">
+                #{taskStatus},
+            </if>
+            <if test="completionTime != null">
+                #{completionTime},
+            </if>
+            <if test="lastOutboundStatus != null and lastOutboundStatus != ''">
+                #{lastOutboundStatus},
+            </if>
+            <if test="operator != null and operator != ''">
+                #{operator},
+            </if>
+
+        </trim>
+    </insert>
+
+
+    <!-- 更新任务 -->
+    <update id="updateFollowTask" parameterType="pd">
+        update s_gxhpz_follow_task
+        <set>
+            <if test="appointmentDate != null">
+                appointmentDate = #{appointmentDate},
+            </if>
+            <if test="businessBelonging != null and businessBelonging != ''">
+                businessBelonging = #{businessBelonging},
+            </if>
+            <if test="taskName != null and taskName != ''">
+                taskName = #{taskName},
+            </if>
+            <if test="taskTheme != null and taskTheme != ''">
+                taskTheme = #{taskTheme},
+            </if>
+            <if test="planId != null and planId != ''">
+                planId = #{planId},
+            </if>
+            <if test="patientId != null and patientId != ''">
+                patientId = #{patientId},
+            </if>
+            <if test="patientName != null and patientName != ''">
+                patientName = #{patientName},
+            </if>
+            <if test="gender != null">
+                gender = #{gender},
+            </if>
+            <if test="age != null">
+                age = #{age},
+            </if>
+            <!-- 省略其他字段... -->
+            <!-- 新增字段 -->
+            <if test="followUpSummary != null and followUpSummary != ''">
+                followUpSummary = #{followUpSummary},
+            </if>
+            <if test="followUpSummaryid != null and followUpSummaryid != ''">
+                followUpSummaryid = #{followUpSummaryid},
+            </if>
+            <if test="disease != null and disease != ''">
+                disease = #{disease},
+            </if>
+            <if test="storeName != null and storeName != ''">
+                storeName = #{storeName},
+            </if>
+            <if test="genericName != null and genericName != ''">
+                genericName = #{genericName},
+            </if>
+            <if test="productName != null and productName != ''">
+                productName = #{productName},
+            </if>
+            <if test="taskFollower != null and taskFollower != ''">
+                taskFollower = #{taskFollower},
+            </if>
+            <if test="returnMethod != null and returnMethod != ''">
+                returnMethod = #{returnMethod},
+            </if>
+            <if test="returnObject != null and returnObject != ''">
+                returnObject = #{returnObject},
+            </if>
+            <if test="returnImgUrl != null and returnImgUrl != ''">
+                returnImgUrl = #{returnImgUrl},
+            </if>
+            <if test="medicationStatus != null and medicationStatus != ''">
+                medicationStatus = #{medicationStatus},
+            </if>
+            <if test="stoped != null">
+                stoped = #{stoped},
+            </if>
+            <if test="charitable != null and charitable != ''">
+                charitable = #{charitable},
+            </if>
+            <if test="perpetual_stopdrug_cause != null and perpetual_stopdrug_cause != ''">
+                perpetual_stopdrug_cause = #{perpetual_stopdrug_cause},
+            </if>
+            <if test="other_channels != null and other_channels != ''">
+                other_channels = #{other_channels},
+            </if>
+            <if test="delay_purchase_doctor != null and delay_purchase_doctor != ''">
+                delay_purchase_doctor = #{delay_purchase_doctor},
+            </if>
+            <if test="delayed_purchase_drugs != null and delayed_purchase_drugs != ''">
+                delayed_purchase_drugs = #{delayed_purchase_drugs},
+            </if>
+            <if test="is_adverse_reaction != null and is_adverse_reaction != ''">
+                is_adverse_reaction = #{is_adverse_reaction},
+            </if>
+            <if test="adverse_reaction_time != null and adverse_reaction_time != ''">
+                adverse_reaction_time = #{adverse_reaction_time},
+            </if>
+            <if test="good_response_symptom_id != null and good_response_symptom_id != ''">
+                good_response_symptom_id = #{good_response_symptom_id},
+            </if>
+            <if test="nutrition_evaluation_id != null and nutrition_evaluation_id != ''">
+                nutrition_evaluation_id = #{nutrition_evaluation_id},
+            </if>
+            <if test="medication_record_id != null and medication_record_id != ''">
+                medication_record_id = #{medication_record_id},
+            </if>
+            <if test="other != null and other != ''">
+                other = #{other},
+            </if>
+            <if test="actualFollowUpTime != null">
+                actualFollowUpTime = #{actualFollowUpTime},
+            </if>
+            <if test="callConnectedCount != null">
+                callConnectedCount = #{callConnectedCount},
+            </if>
+            <if test="nextCallTime != null">
+                nextCallTime = #{nextCallTime},
+            </if>
+            <if test="lastOutboundFlag != null and lastOutboundFlag != ''">
+                lastOutboundFlag = #{lastOutboundFlag},
+            </if>
+            <if test="outboundCallCount != null">
+                outboundCallCount = #{outboundCallCount},
+            </if>
+            <if test="nextOutboundCallCount != null">
+                nextOutboundCallCount = #{nextOutboundCallCount},
+            </if>
+            <if test="taskStatus != null and taskStatus != ''">
+                taskStatus = #{taskStatus},
+            </if>
+            <if test="completionTime != null">
+                completionTime = #{completionTime},
+            </if>
+            <if test="lastOutboundStatus != null and lastOutboundStatus != ''">
+                lastOutboundStatus = #{lastOutboundStatus},
+            </if>
+            <if test="updatedAt != null">
+                updatedAt = #{updatedAt},
+            </if>
+            <if test="operator != null and operator != ''">
+                operator= #{operator},
+            </if>
+        </set>
+        where id = #{id}
+    </update>
+
+    <!-- 删除任务 -->
+    <delete id="deleteFollowTasksByIds" parameterType="java.util.List">
+        <if test="list != null and list.size() > 0">
+            delete from s_gxhpz_follow_task
+            where id in
+            <foreach item="id" index="index" collection="list" open="(" separator="," close=")">
+                #{id}
+            </foreach>
+        </if>
+    </delete>
+</mapper>

+ 136 - 0
health-system/src/main/resources/mapper/pmServiceMapper/PharmaceuticalServiceMapper.xml

@@ -70,6 +70,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		    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,
@@ -1804,4 +1830,114 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
 	</select>
 
+
+
+	<!-- 统计患者档案完善度 -->
+	<select id="statisticsPerfectionDegree" parameterType="pd" resultType="pd">
+		SELECT
+			id,
+			name,
+			(
+				-- 统计完成度
+				CASE WHEN realNameStatus IS NOT NULL THEN 1 ELSE 0 END +
+				CASE WHEN gender IN (0, 1) THEN 1 ELSE 0 END + -- 假设2未知不算作已填写
+				CASE WHEN age IS NOT NULL THEN 1 ELSE 0 END +
+				CASE WHEN dateBirth IS NOT NULL THEN 1 ELSE 0 END +
+				CASE WHEN address IS NOT NULL AND address != '' THEN 1 ELSE 0 END +
+				CASE WHEN idCardImg IS NOT NULL AND idCardImg != '' THEN 1 ELSE 0 END +
+				CASE WHEN contactRelation IS NOT NULL AND contactRelation != '' THEN 1 ELSE 0 END +
+				CASE WHEN contactPhone IS NOT NULL AND contactPhone != '' THEN 1 ELSE 0 END +
+				CASE WHEN contactName IS NOT NULL AND contactName != '' THEN 1 ELSE 0 END +
+				CASE WHEN noFlipCause IS NOT NULL AND noFlipCause != '' THEN 1 ELSE 0 END +
+				CASE WHEN flipStatus IS NOT NULL THEN 1 ELSE 0 END +
+				CASE WHEN height IS NOT NULL THEN 1 ELSE 0 END +
+				CASE WHEN weight IS NOT NULL THEN 1 ELSE 0 END +
+				CASE WHEN BMI IS NOT NULL AND BMI != '' THEN 1 ELSE 0 END +
+				CASE WHEN timeFirstDiagnosis IS NOT NULL THEN 1 ELSE 0 END +
+				CASE WHEN ownedStore IS NOT NULL AND ownedStore != '' THEN 1 ELSE 0 END +
+				CASE WHEN acceptFollowUp IS NOT NULL THEN 1 ELSE 0 END +
+				CASE WHEN openId IS NOT NULL AND openId != '' THEN 1 ELSE 0 END +
+				CASE WHEN followUpPerson IS NOT NULL AND followUpPerson != '' THEN 1 ELSE 0 END +
+				CASE WHEN charityAssistance IS NOT NULL THEN 1 ELSE 0 END +
+				CASE WHEN storeId IS NOT NULL AND storeId != '' THEN 1 ELSE 0 END +
+				CASE WHEN storeName IS NOT NULL AND storeName != '' THEN 1 ELSE 0 END +
+				CASE WHEN followUpStatus IS NOT NULL THEN 1 ELSE 0 END +
+				CASE WHEN dl IS NOT NULL AND dl != '' THEN 1 ELSE 0 END +
+				CASE WHEN addr IS NOT NULL AND addr != '' THEN 1 ELSE 0 END +
+				CASE WHEN waist IS NOT NULL AND waist != '' THEN 1 ELSE 0 END +
+				CASE WHEN hip IS NOT NULL AND hip != '' THEN 1 ELSE 0 END +
+				CASE WHEN bloodPressure IS NOT NULL AND bloodPressure != '' THEN 1 ELSE 0 END +
+				CASE WHEN bloodSugar IS NOT NULL AND bloodSugar != '' THEN 1 ELSE 0 END +
+				CASE WHEN medicalHistory IS NOT NULL AND medicalHistory != '' THEN 1 ELSE 0 END +
+				CASE WHEN hasSurgicalTraumaHistory IS NOT NULL AND hasSurgicalTraumaHistory != '' THEN 1 ELSE 0 END +
+				CASE WHEN infectiousDiseaseHistory IS NOT NULL AND infectiousDiseaseHistory != '' THEN 1 ELSE 0 END +
+				CASE WHEN allergyHistory IS NOT NULL AND allergyHistory != '' THEN 1 ELSE 0 END +
+				CASE WHEN businessBelonging IS NOT NULL AND businessBelonging != '' THEN 1 ELSE 0 END +
+				CASE WHEN zlfq IS NOT NULL AND zlfq != '' THEN 1 ELSE 0 END +
+				CASE WHEN jytb IS NOT NULL AND jytb != '' THEN 1 ELSE 0 END +
+				CASE WHEN treatmentStage IS NOT NULL AND treatmentStage != '' THEN 1 ELSE 0 END +
+				CASE WHEN fzjc IS NOT NULL AND fzjc != '' THEN 1 ELSE 0 END +
+				CASE WHEN pdl1 IS NOT NULL AND pdl1 != '' THEN 1 ELSE 0 END +
+				CASE WHEN zlsd IS NOT NULL AND zlsd != '' THEN 1 ELSE 0 END +
+				CASE WHEN tnb IS NOT NULL AND tnb != '' THEN 1 ELSE 0 END +
+				CASE WHEN tnbhbz IS NOT NULL AND tnbhbz != '' THEN 1 ELSE 0 END +
+				CASE WHEN gxy IS NOT NULL AND gxy != '' THEN 1 ELSE 0 END +
+				CASE WHEN gxyhbz IS NOT NULL AND gxyhbz != '' THEN 1 ELSE 0 END +
+				CASE WHEN gxz IS NOT NULL AND gxz != '' THEN 1 ELSE 0 END +
+				CASE WHEN gxzhbz IS NOT NULL AND gxzhbz != '' THEN 1 ELSE 0 END
+				) AS filledFieldsCount,
+			ROUND((
+					  -- 计算百分比
+					  (
+						  CASE WHEN realNameStatus IS NOT NULL THEN 1 ELSE 0 END +
+						  CASE WHEN gender IN (0, 1) THEN 1 ELSE 0 END +
+						  CASE WHEN age IS NOT NULL THEN 1 ELSE 0 END +
+						  CASE WHEN dateBirth IS NOT NULL THEN 1 ELSE 0 END +
+						  CASE WHEN address IS NOT NULL AND address != '' THEN 1 ELSE 0 END +
+						  CASE WHEN idCardImg IS NOT NULL AND idCardImg != '' THEN 1 ELSE 0 END +
+						  CASE WHEN contactRelation IS NOT NULL AND contactRelation != '' THEN 1 ELSE 0 END +
+						  CASE WHEN contactPhone IS NOT NULL AND contactPhone != '' THEN 1 ELSE 0 END +
+						  CASE WHEN contactName IS NOT NULL AND contactName != '' THEN 1 ELSE 0 END +
+						  CASE WHEN noFlipCause IS NOT NULL AND noFlipCause != '' THEN 1 ELSE 0 END +
+						  CASE WHEN flipStatus IS NOT NULL THEN 1 ELSE 0 END +
+						  CASE WHEN height IS NOT NULL THEN 1 ELSE 0 END +
+						  CASE WHEN weight IS NOT NULL THEN 1 ELSE 0 END +
+						  CASE WHEN BMI IS NOT NULL AND BMI != '' THEN 1 ELSE 0 END +
+						  CASE WHEN timeFirstDiagnosis IS NOT NULL THEN 1 ELSE 0 END +
+						  CASE WHEN ownedStore IS NOT NULL AND ownedStore != '' THEN 1 ELSE 0 END +
+						  CASE WHEN acceptFollowUp IS NOT NULL THEN 1 ELSE 0 END +
+						  CASE WHEN openId IS NOT NULL AND openId != '' THEN 1 ELSE 0 END +
+						  CASE WHEN followUpPerson IS NOT NULL AND followUpPerson != '' THEN 1 ELSE 0 END +
+						  CASE WHEN charityAssistance IS NOT NULL THEN 1 ELSE 0 END +
+						  CASE WHEN storeId IS NOT NULL AND storeId != '' THEN 1 ELSE 0 END +
+						  CASE WHEN storeName IS NOT NULL AND storeName != '' THEN 1 ELSE 0 END +
+						  CASE WHEN followUpStatus IS NOT NULL THEN 1 ELSE 0 END +
+						  CASE WHEN dl IS NOT NULL AND dl != '' THEN 1 ELSE 0 END +
+						  CASE WHEN addr IS NOT NULL AND addr != '' THEN 1 ELSE 0 END +
+						  CASE WHEN waist IS NOT NULL AND waist != '' THEN 1 ELSE 0 END +
+						  CASE WHEN hip IS NOT NULL AND hip != '' THEN 1 ELSE 0 END +
+						  CASE WHEN bloodPressure IS NOT NULL AND bloodPressure != '' THEN 1 ELSE 0 END +
+						  CASE WHEN bloodSugar IS NOT NULL AND bloodSugar != '' THEN 1 ELSE 0 END +
+						  CASE WHEN medicalHistory IS NOT NULL AND medicalHistory != '' THEN 1 ELSE 0 END +
+						  CASE WHEN hasSurgicalTraumaHistory IS NOT NULL AND hasSurgicalTraumaHistory != '' THEN 1 ELSE 0 END +
+						  CASE WHEN infectiousDiseaseHistory IS NOT NULL AND infectiousDiseaseHistory != '' THEN 1 ELSE 0 END +
+						  CASE WHEN allergyHistory IS NOT NULL AND allergyHistory != '' THEN 1 ELSE 0 END +
+						  CASE WHEN businessBelonging IS NOT NULL AND businessBelonging != '' THEN 1 ELSE 0 END +
+						  CASE WHEN zlfq IS NOT NULL AND zlfq != '' THEN 1 ELSE 0 END +
+						  CASE WHEN jytb IS NOT NULL AND jytb != '' THEN 1 ELSE 0 END +
+						  CASE WHEN treatmentStage IS NOT NULL AND treatmentStage != '' THEN 1 ELSE 0 END +
+						  CASE WHEN fzjc IS NOT NULL AND fzjc != '' THEN 1 ELSE 0 END +
+						  CASE WHEN pdl1 IS NOT NULL AND pdl1 != '' THEN 1 ELSE 0 END +
+						  CASE WHEN zlsd IS NOT NULL AND zlsd != '' THEN 1 ELSE 0 END +
+						  CASE WHEN tnb IS NOT NULL AND tnb != '' THEN 1 ELSE 0 END +
+						  CASE WHEN tnbhbz IS NOT NULL AND tnbhbz != '' THEN 1 ELSE 0 END +
+						  CASE WHEN gxy IS NOT NULL AND gxy != '' THEN 1 ELSE 0 END +
+						  CASE WHEN gxyhbz IS NOT NULL AND gxyhbz != '' THEN 1 ELSE 0 END +
+						  CASE WHEN gxz IS NOT NULL AND gxz != '' THEN 1 ELSE 0 END +
+						  CASE WHEN gxzhbz IS NOT NULL AND gxzhbz != '' THEN 1 ELSE 0 END
+						  ) / 45.0 * 100 -- 假设有45个可选字段
+					  ), 2) AS completenessPercentage
+		FROM
+			s_dtp_ysfw_archive_management where id=#{patientId};
+	</select>
 </mapper>

+ 1 - 0
health-system/src/main/resources/mapper/system/RecipeRegisterMapper.xml

@@ -155,4 +155,5 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</delete>
 
 
+
 </mapper>