Ver código fonte

update dtp换着管理

wangshuangpan 2 semanas atrás
pai
commit
e181679e4c

+ 14 - 10
health-admin/src/main/java/com/bzd/web/controller/dtp/ConfigInfoController.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.StringUtils;
 import com.bzd.system.service.DTPService;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -13,6 +14,7 @@ import org.springframework.stereotype.Controller;
 import org.springframework.ui.ModelMap;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.Arrays;
 import java.util.List;
 
 /**
@@ -113,25 +115,27 @@ public class ConfigInfoController extends BaseController {
     public AjaxResult addSave() throws Exception {
         PageData pd = new PageData();
         pd = this.getPageData();
-        if (!dtpService.checkPatientNameAndPhoneUnique(pd))
-        {
-            return error("处方登记新增: '" + pd.getString("patientName") +"+"+ pd.getString("patientPhone")+"'失败,患者姓名或电话已存在");
-        }
-        Integer integer = dtpService.save(pd);
-        return toAjax(integer);
+
+        return AjaxResult.error("暂无此接口");
     }
 
-    @Log(title = "配置信息删除", businessType = BusinessType.DELETE)
+    @Log(title = "一店一目删除", businessType = BusinessType.DELETE)
     @PostMapping("/remove")
     @ResponseBody
     public AjaxResult remove() throws Exception
     {
         PageData pd = new PageData();
         pd = this.getPageData();
-        Integer integer = dtpService.del(pd);
-        return toAjax(integer);
-    }
+        Object id = pd.get("ids");
+        if(StringUtils.isNotNull(id)){
+            String[] split = id.toString().split(",");
+            List<String> ids = Arrays.asList(split);
+            Integer integer = dtpService.deleteProductList(ids);
+            return toAjax(integer);
 
+        }
+        return AjaxResult.success("请选择要删除的数据");
+    }
     @RequiresPermissions("dtp:configInfo:edit")
     @GetMapping("/edit/{id}")
     public String edit(@PathVariable("id") Long id, ModelMap mmap)throws Exception

+ 2 - 3
health-admin/src/main/java/com/bzd/web/controller/dtp/PharmaceuticalServiceController.java

@@ -95,7 +95,7 @@ public class PharmaceuticalServiceController extends BaseController {
      */
     @RequiresPermissions("dtp:pmService:edit")
     @GetMapping("/archivesEdit/{id}")
-    public String archivesView(@PathVariable("id") Long Id, ModelMap mmap) throws Exception {
+    public String archivesView(@PathVariable("id") String Id, ModelMap mmap) throws Exception {
         PageData pd = this.getPageData();
         pd.put("id", Id);
         PageData pageData = pharmaceuticalService.findArchivesList(pd).get(0);
@@ -153,10 +153,9 @@ public class PharmaceuticalServiceController extends BaseController {
           Integer age = ServletUtils.calculateAge(dateBirth);//根据出生日期字符串计算年龄
            pd.put("age",age);
        }
-
         if (!pharmaceuticalService.checkPatientIsExist(pd))
         {
-            return error("患者建档新增保存: '" + pd.getString("name") +"+"+ pd.getString("phoneNumber")+"'失败,患者姓名或电话已存在");
+            return error("患者建档新增保存: '" + pd.getString("name") +"+"+ pd.getString("documentNumber") +"+" +pd.getString("phoneNumber")+"'失败,患者姓,身份证名或电话已存在");
         }
         Integer integer = pharmaceuticalService.addArchives(pd);
         return toAjax(integer);

+ 40 - 13
health-admin/src/main/java/com/bzd/web/controller/dtp/RecipeRegisterController.java

@@ -6,14 +6,17 @@ 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.common.utils.poi.ExcelUtil;
 import com.bzd.system.service.DTPService;
+import com.bzd.system.service.PharmaceuticalService;
 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.util.Arrays;
 import java.util.List;
 
 /**
@@ -29,8 +32,6 @@ public class RecipeRegisterController extends BaseController {
 
     @Autowired
     private DTPService dtpService;
-
-
     @RequiresPermissions("dtp:recipe:view")
     @GetMapping()
     public String recipe()
@@ -63,21 +64,28 @@ public class RecipeRegisterController extends BaseController {
         return prefix + "/add";
     }
     /**
+     * 药品信息页面
+     */
+    @RequiresPermissions("dtp:recipe:view")
+    @GetMapping("/drugInfo")
+    public String drugInfo(ModelMap mmap)
+    {
+        mmap.put("posts", 1);
+        return prefix + "/drugInfo";
+    }
+
+    /**
      * 处方登记新增保存
      */
     //@RequiresPermissions("server:serv:add")
     @Log(title = "处方登记新增", businessType = BusinessType.INSERT)
-    @PostMapping("/add")
+    @PostMapping("/SaveRecipe")
     @ResponseBody
-    public AjaxResult addSave() throws Exception {
+    public AjaxResult SaveRecipe() throws Exception {
         PageData pd = new PageData();
         pd = this.getPageData();
-        if (!dtpService.checkPatientNameAndPhoneUnique(pd))
-        {
-            return error("处方登记新增: '" + pd.getString("patientName") +"+"+ pd.getString("patientPhone")+"'失败,患者姓名或电话已存在");
-        }
-        Integer integer = dtpService.save(pd);
-        return toAjax(integer);
+        PageData object = dtpService.save(pd);
+        return AjaxResult.success(object.get("result").toString(),object);
     }
 
     @Log(title = "处方登记删除", businessType = BusinessType.DELETE)
@@ -87,13 +95,20 @@ public class RecipeRegisterController extends BaseController {
     {
         PageData pd = new PageData();
         pd = this.getPageData();
-        Integer integer = dtpService.del(pd);
-        return toAjax(integer);
+       Object id = pd.get("ids");
+       if(StringUtils.isNotNull(id)){
+           String[] split = id.toString().split(",");
+           List<String> ids = Arrays.asList(split);
+           Integer integer = dtpService.del(ids);
+           return toAjax(integer);
+
+       }
+        return AjaxResult.success("请选择要删除的数据");
     }
 
     @RequiresPermissions("dtp:recipe:edit")
     @GetMapping("/edit/{id}")
-    public String view(@PathVariable("id") Long id, ModelMap mmap)throws Exception
+    public String view(@PathVariable("id") String id, ModelMap mmap)throws Exception
     {
         PageData pd = this.getPageData();
         pd.put("id",id);
@@ -102,6 +117,18 @@ public class RecipeRegisterController extends BaseController {
         return prefix + "/edit";
     }
 
+    @RequiresPermissions("dtp:recipe:edit")
+    @GetMapping("/BandingPatient/{id}")
+    public String Banding(@PathVariable("id") String id, ModelMap mmap)throws Exception
+    {
+        PageData pd = this.getPageData();
+        pd.put("id",id);
+        PageData pageData = dtpService.findForList(pd).get(0);
+        mmap.putAll(pageData);
+        return prefix + "/edit";
+    }
+
+
     /**
      * 保存处方登记修改信息
      */

+ 60 - 0
health-admin/src/main/java/com/bzd/web/controller/jkgl/SjkglmbhzController.java

@@ -0,0 +1,60 @@
+package com.bzd.web.controller.jkgl;
+
+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.ServletUtils;
+import com.bzd.common.utils.StringUtils;
+import com.bzd.system.service.PharmaceuticalService;
+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.util.List;
+
+/**
+ * 慢病患者管理
+ * creator wsp
+ */
+@Controller
+@RequestMapping("/jkgl/mbhzServers")
+public class SjkglmbhzController extends BaseController {
+
+    // 档案馆
+    private String prefix= "jkgl";
+    @Autowired
+    private PharmaceuticalService pharmaceuticalService;
+    /**
+     * 档案管理页
+     *
+     * @return
+     */
+    @RequiresPermissions("jkgl:bmhz:view")
+    @GetMapping("/archivesmbhzList")
+    public String archives() {
+        return prefix + "/archivesmbhzList";
+    }
+
+    /**
+     * 档案管理数据查询
+     *
+     * @return
+     * @throws Exception
+     */
+    @RequiresPermissions("jkgl:bmhz:view")
+    @PostMapping("/archivesmbhzList")
+    @ResponseBody
+    public TableDataInfo archivesList() throws Exception {
+        PageData pd = this.getPageData();
+        startPage();
+        List<PageData> pageData = pharmaceuticalService.findArchivesList(pd);
+        return getDataTable(pageData);
+    }
+
+
+}

+ 89 - 2
health-admin/src/main/resources/templates/dtp/archives/archivesAdd.html

@@ -4,7 +4,27 @@
     <th:block th:include="include :: header('新建档案')" />
 </head>
 <style>
-
+    .ibox {
+        width: 700px;
+        margin-bottom: 20px;
+        border: 1px solid #e7eaec;
+        border-radius: 4px;
+    }
+    .ibox-title {
+        background-color: #f3f3f4;
+        border-bottom: 1px solid #e7eaec;
+        padding: 10px 15px;
+        font-size: 16px;
+    }
+    .ibox-content {
+        padding: 15px;
+    }
+    .ibox-content h4 {
+        margin-top: 0;
+    }
+    input[type=file] {
+        display: none;
+    }
 </style>
 <script>
 
@@ -13,6 +33,21 @@
 <div class="wrapper wrapper-content animated fadeInRight ibox-content">
     <form id="form-server-add" class="customize-search-form">
         <div class="customize-form-group-container">
+            <div class="ibox float-e-margins">
+                <label class="font-noraml">身份证上传</label>
+                <div class="new-contentarea tc">
+                    <a href="javascript:void(0)" class="upload-img"><label for="inputImage" >上传图像</label> </a>
+                    <input type="file" name="avatar" id="inputImage" onchange="uploadImage(this)" accept="image/*"/>
+                </div>
+
+            </div>
+            <div class="ibox">
+                <div class="ibox-title">
+                    <img id="uploadedImage" src="" alt="上传的图片" style="max-width: 100%; display: block;">
+                </div>
+            </div>
+
+
             <div class="customize-form-group">
                 <label class="col-sm-1 control-label">姓名:</label>
                 <input name="name" placeholder="请输入姓名" class="styled-input" type="text" maxlength="30" required>
@@ -61,11 +96,35 @@
                 <label class="col-sm-1 control-label">联系人手机号:</label>
                 <input name="contactPhone" placeholder="请输入联系人手机号" class="styled-input isPhone" type="text" maxlength="11"  required>
             </div>
+
+            <div class="customize-form-group">
+                <label class="col-sm-1 control-label">建档时间:</label>
+                <div class="customize-form-group select-time">
+                    <input name="createTime" placeholder="建档时间"  id="createTime" class="time-input time-input2" type="text">
+                </div>
+            </div>
+
+            <div class="customize-form-group">
+                <label class="col-sm-1 control-label">建档门店:</label>
+                <select name="storeName" class="styled-input" th:with="type=${@dict.getType('sys_select_dtp_ysfw_lxryhzgx')}">
+                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"
+                    ></option>
+                </select>
+            </div>
+
+            <div class="customize-form-group">
+                <label class="col-sm-1 control-label">建档人:</label>
+                <select name="creator" class="styled-input" th:with="type=${@dict.getType('sys_select_dtp_ysfw_lxryhzgx')}">
+                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"
+                    ></option>
+                </select>
+            </div>
         </div>
     </form>
 </div>
 	<th:block th:include="include :: footer" />
-<script th:src="@{/health/js/input-styles.js?v=4.7.9}"></script>
+<th:block th:include="include :: select2-js" />
+<th:block th:include="include :: bootstrap-fileinput-js" />
 </body>
 </html>
 
@@ -104,6 +163,34 @@
             }
         });
     }
+    function uploadImage(input) {
+        if (input.files && input.files[0]) {
+            var reader = new FileReader();
+            reader.onload = function(e) {
+                $('#uploadedImage').attr('src', e.target.result).show();
+                sendImageToServer(e.target.result);
+            };
+            reader.readAsDataURL(input.files[0]);
+        }
+    }
 
+    function sendImageToServer(imageData) {
+        $.ajax({
+            url: '/upload-and-recognize',
+            type: 'POST',
+            contentType: 'application/json',
+            data: JSON.stringify({ imageData: imageData }),
+            success: function(response) {
+                $('#hospital').val(response.hospital);
+                $('#prescriptionDate').val(response.prescriptionDate);
+                $('#prescriptionDoctor').val(response.prescriptionDoctor);
+                $('#clinicalDiagnosis').val(response.clinicalDiagnosis);
+                $('#department').val(response.department);
+            },
+            error: function(error) {
+                console.error('Error:', error);
+            }
+        });
+    }
 
 </script>

+ 1 - 1
health-admin/src/main/resources/templates/dtp/archives/archivesEdit.html

@@ -505,7 +505,7 @@
                                          <div class="customize-search-form">
                                              <div class="customize-form-group edit">
                                                  <div style="display: flex;">
-                                                     <label>用药情况:</label>
+                                                     <label>当前用药情况:</label>
                                                      <table id="yyqkTable" style="width: 480px;">
                                                          <thead>
                                                          <tr>

+ 0 - 4
health-admin/src/main/resources/templates/dtp/archives/archivesList.html

@@ -164,10 +164,6 @@
 		                	var actions = [];
 			                actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑档案</a> ');
 			                actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a> ');
-			                var more = [];
-			                /*more.push("<a class='btn btn-default btn-xs " + resetPwdFlag + "' href='javascript:void(0)' onclick='resetPwd(" + row.userId + ")'><i class='fa fa-key'></i>重置密码</a> ");
-			                more.push("<a class='btn btn-default btn-xs " + editFlag + "' href='javascript:void(0)' onclick='authRole(" + row.userId + ")'><i class='fa fa-check-square-o'></i>分配角色</a>");
-			                actions.push('<a tabindex="0" class="btn btn-info btn-xs" role="button" data-container="body" data-placement="left" data-toggle="popover" data-html="true" data-trigger="hover" data-content="' + more.join('') + '"><i class="fa fa-chevron-circle-right"></i>更多操作</a>');*/
 			                return actions.join('');
 		            	} else {
 		                    return "";

+ 138 - 0
health-admin/src/main/resources/templates/dtp/archives/archivesyygyList.html

@@ -0,0 +1,138 @@
+<!DOCTYPE html>
+<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
+<head>
+	<th:block th:include="include :: header('档案管理')" />
+	<th:block th:include="include :: layout-latest-css" />
+	<th:block th:include="include :: ztree-css" />
+</head>
+<body class="gray-bg">
+
+	<div class="ui-layout-center">
+		<div class="container-div">
+			<div class="row">
+
+				<div class="col-sm-12 select-table table-striped" style="width: 100%; overflow-x: auto;">
+					<table id="bootstrap-table" class="fixed-layout-table"></table>
+				</div>
+			</div>
+		</div>
+	</div>
+
+	<th:block th:include="include :: footer" />
+	<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" />
+	<script th:inline="javascript">
+		var editFlag = [[${@permission.hasPermi('dtp:RecipeRegister:edit')}]];
+		var removeFlag = [[${@permission.hasPermi('dtp:RecipeRegister:remove')}]];
+		var prefix = ctx + "dtp/pmService";
+		$(function() {
+		    var panehHidden = false;
+		    if ($(this).width() < 1590) {
+		        panehHidden = true;
+		    }
+		    $('body').layout({ initClosed: panehHidden, west__size: 185, resizeWithWindow: false });
+	     	// 回到顶部绑定
+	    	if ($.fn.toTop !== undefined) {
+	    		var opt = {
+	    			win:$('.ui-layout-center'),
+	    			doc:$('.ui-layout-center')
+	    		};
+	    		$('#scroll-up').toTop(opt);
+	    	}
+			queryArchivesList();
+		});
+
+		function queryArchivesList() {
+		    var options = {
+		        url: prefix + "/archivesList",
+		        viewUrl: prefix + "/archivesView/{id}",
+		        createUrl: prefix + "/archivesAdd",
+		        updateUrl: prefix + "/archivesEdit/{id}",
+		        removeUrl: prefix + "/archivesRemove",
+		        /*exportUrl: prefix + "/export",
+		        importUrl: prefix + "/importData",
+		        importTemplateUrl: prefix + "/importTemplate",*/
+		        sortName: "id",
+		        sortOrder: "asc",
+		        modalName: "用药购药信息",
+				fitColumns: true,
+				striped: true,
+				autoRowHeight: true,
+				rowNumbers: true,
+				showFooter:true,  //是否显示表格底部区域。
+				clickToSelect: true, //是否启用点击行时选中整行的功能。
+                singleSelect: false, //是否仅允许选择一行
+				fixedColumns: true,
+				//fixedNumber: 3,
+				fixedRightNumber: 1,
+		        columns: [
+					{
+						checkbox: true
+					},
+				{field: 'name', title: '姓名', align: 'center'},
+				{field: 'gender', title: '性别', align: 'center'},
+				{field: 'age', title: '年龄', align: 'center'},
+				{field: 'phoneNumber', title: '手机号', align: 'center'},
+				{field: 'documentType', title: '证件类型', align: 'center'},
+				{field: 'documentNumber', title: '证件号码', align: 'center'},
+				{field: 'realNameStatus', title: '实名状态', align: 'center'},
+				{field: 'flipStatus', title: '上翻状态', align: 'center'},
+				{field: 'disease', title: '疾病', align: 'center'},
+				{field: 'genericName', title: '药品通用名', align: 'center'},
+				{field: 'productName', title: '商品名', align: 'center'},
+				{field: 'mdmCode', title: 'MDM编码', align: 'center'},
+				{field: 'manufacturer', title: '厂家', align: 'center'},
+				{field: 'storeName', title: '门店', align: 'center'},
+				{field: 'archiveCreator', title: '档案创建人', align: 'center'},
+				{field: 'archiveCompleter', title: '档案完善人', align: 'center'},
+				{field: 'acceptFollowUp', title: '是否接受随访', align: 'center'},
+				{field: 'followUpPerson', title: '随访跟进人', align: 'center'},
+				{field: 'archiveCompleteStatus', title: '档案是否完善', align: 'center'},
+				{field: 'charityAssistance', title: '有无慈善援助', align: 'center'},
+				{field: 'joinProject', title: '是否参加共建项目', align: 'center'},
+				{field: 'followUpStatus', title: '随访状态', align: 'center'},
+				{field: 'updateTime2', title: '更新时间', align: 'center'},
+		        {
+		            title: '操作',
+		            align: 'center',
+		            formatter: function(value, row, index) {
+		                if (row.id) {
+		                	var actions = [];
+			                actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')"><i class="fa fa-edit"></i>查看用药购药详情</a> ');
+			             return actions.join('');
+		            	} else {
+		                    return "";
+		                }
+		            }
+		        }]
+		    };
+		    $.table.init(options);
+		}
+
+		/* 自定义重置-表单重置/隐藏框/树节点选择色/搜索 */
+		function resetPre() {
+			resetDate();
+			$("#archives-form")[0].reset();
+			$("#deptId").val("");
+			$("#parentId").val("");
+			$(".curSelectedNode").removeClass("curSelectedNode");
+			$.table.search();
+			var resetButton = document.getElementById('archives-form');
+			resetButton.addEventListener('click', function() {
+				_refresh();
+			});
+		}
+
+		/* 用户状态显示 */
+		function statusTools(row) {
+		    if (row.status == 1) {
+    			return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="enable(\'' + row.userId + '\')"></i> ';
+    		} else {
+    			return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="disable(\'' + row.userId + '\')"></i> ';
+    		}
+		}
+	</script>
+</body>
+
+</html>

+ 455 - 183
health-admin/src/main/resources/templates/dtp/recipe/add.html

@@ -3,219 +3,413 @@
 <head>
     <th:block th:include="include :: header('新增处方')" />
     <th:block th:include="include :: select2-css" />
+    <th:block th:include="include :: bootstrap-fileinput-css" />
 </head>
 <body>
 <div class="main-content">
-    <form id="form-user-add" class="form-horizontal">
-        <input name="deptId" type="hidden" id="treeId"/>
-        <h4 class="form-header h4">处方信息</h4>
-        <div class="row">
-            <div class="col-sm-4">
-                <div class="form-group">
-                    <label class="col-sm-4 control-label is-required">患者姓名:</label>
-                    <div class="col-sm-8">
-                        <input name="patientName" placeholder="请输入患者姓名" class="form-control" type="text" maxlength="30" >
-                    </div>
-                </div>
-            </div>
-            <div class="col-sm-4">
-                <div class="form-group">
-                    <label class="col-sm-4 control-label is-required">手机号码:</label>
-                    <div class="col-sm-8">
-                        <div class="input-group">
-                            <input id="patientPhone" name="patientPhone" placeholder="请输入手机号码" class="form-control" type="number" maxlength="11">
-                            <span class="input-group-addon"><i class="fa fa-mobile"></i></span>
-                        </div>
-                    </div>
+    <form id="form-prescription-add" class="form-horizontal">
+            <div class="ibox float-e-margins">
+                <label class="font-noraml">处方上传</label>
+                <div class="new-contentarea tc">
+                    <a href="javascript:void(0)" class="upload-img"><label for="inputImage" >上传图像</label> </a>
+                    <input type="file" name="avatar" id="inputImage" onchange="uploadImage(this)" accept="image/*"/>
                 </div>
-            </div>
 
-            <div class="col-sm-4">
-                <div class="form-group">
-                    <label class="col-sm-4 control-label is-required">药品通用名:</label>
-                    <div class="col-sm-8">
-                        <input name="genericName" placeholder="请输入药品通用名" class="form-control" type="text" maxlength="30" >
-                    </div>
-                </div>
             </div>
-        </div>
-        <div class="row">
-            <div class="col-sm-4">
-            <div class="form-group">
-                <label class="col-sm-4 control-label is-required">门店:</label>
-                <div class="col-sm-8">
-                    <div class="input-group">
-                    <input name="storeName" onclick="selectDeptTree()" id="treeName" type="text" placeholder="请选择门店" class="form-control">
-                    <span class="input-group-addon">
-                        <i class="fa fa-search"></i>
-                    </span>
-
-                    </div>
-                </div>
-            </div>
-            </div>
-
-            <div class="col-sm-4">
-                <div class="form-group">
-                    <label class="col-sm-4 control-label">厂家:</label>
-                    <div class="col-sm-8">
-                        <input id="manufacturer" name="manufacturer" placeholder="请输入厂家" class="form-control" type="text" maxlength="30">
-                    </div>
+            <div class="ibox">
+                <div class="ibox-title">
+                <img id="uploadedImage" src="" alt="上传的图片" style="max-width: 100%; display: block;">
                 </div>
             </div>
-            <div class="col-sm-4">
-                <div class="form-group">
-                    <label class="col-sm-4 control-label">登记人:</label>
-                    <div class="col-sm-8">
-
-                        <input id="registrar" name="registrar" placeholder="请输入登记人" class="form-control" type="text" maxlength="30" >
-                    </div>
+                    <ul class="list-group list-group-striped">
+                        <li class="list-group-item hidden"  id="prescriptionNumberItem"><i class="fa fa-user"></i>
+                            <b  class="font-noraml">处方单号:</b>
+                            <p class="pull-right">
+                            <div class="customize-form-group select-time">
+                                <input id="prescriptionNumber" name="prescriptionNumber" placeholder="请输入处方单号" class="styled-input" type="text">
+                            </div>
+                            </p>
+                        </li>
+                        <li class="list-group-item hidden"  id="prescriptionSourceItem"><i class="fa fa-user"></i>
+                            <b  class="font-noraml">处方来源:</b>
+                            <p class="pull-right">
+                            <div class="customize-form-group select-time">
+                                <input id="prescriptionSource" name="prescriptionSource" placeholder="处方来源" class="styled-input" type="text">
+                            </div>
+                            </p>
+                        </li>
+                        <li class="list-group-item"><i class="fa fa-envelope-o"></i>
+                            <b class="font-noraml">处方日期:</b>
+                            <p class="pull-right">
+                            <div class="customize-form-group select-time">
+                            <input name="prescriptionDate" placeholder="处方日期"  id="prescriptionDate" class="time-input time-input2" type="text">
+                            </div>
+                            </p>
+                        </li>
+                        <li class="list-group-item"><i class="fa fa-user"></i>
+                            <b  class="font-noraml">医院:</b>
+                            <p class="pull-right">
+                            <div class="customize-form-group select-time">
+                                <select name="hospital" class="styled-input" th:with="type=${@dict.getType('sys_select_dtp_hospital')}">
+                                <option value="">请选择</option>
+                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}" >
+                                </option>
+                            </select>
+                            </div>
+                            </p>
+                        </li>
+                        <li class="list-group-item"><i class="fa fa-user"></i>
+                            <b  class="font-noraml">处方医生:</b>
+                            <p class="pull-right">
+                            <div class="customize-form-group select-time">
+                                <input id="doctor" name="doctor" placeholder="请输入医生" class="styled-input" type="text" maxlength="30" >
+                            </div>
+                            </p>
+                        </li>
+                        <li class="list-group-item"><i class="fa fa-envelope-o"></i>
+                            <b  class="font-noraml">科室:</b>
+                            <p class="pull-right">
+                            <div class="customize-form-group select-time">
+                                <input id="department" name="department" placeholder="请输入科室" class="form-control" type="text" maxlength="50">
+                            </div>
+                            </p>
+                        </li>
+                        <li class="list-group-item">
+                            <i class="fa fa-envelope-o"></i>
+                            <b class="font-noraml">疾病类型:</b>
+                            <p class="pull-right">
+                            <div class="customize-form-group2 select-time">
+                                <select name="diseaseType" id="diseaseType" class="styled-input2"  th:with="type=${@dict.getType('sys_select_dtp_ysfw_mbzllx')}" required>
+                                    <option value="">请选择</option>
+                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"></option>
+                                </select>
+                            </div>
+                            <div class="customize-form-group2 select-time" id="specificDiseaseDiv1" style="display: none;" >
+                                <select name="specificDisease" id="specificDisease1" class="styled-input2"  th:with="type=${@dict.getType('sys_select_dtp_ysfw_mbzllx_mb')}" required>
+                                    <option value="">请选择</option>
+                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"></option>
+                                </select>
+                            </div>
+                            <div class="customize-form-group2 select-time" id="specificDiseaseDiv2" style="display: none;">
+                                <select name="specificDisease" id="specificDisease2" class="styled-input2"  th:with="type=${@dict.getType('sys_select_dtp_ysfw_mbzllx_zl')}" required>
+                                    <option value="">请选择</option>
+                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"></option>
+                                </select>
+                            </div>
+                            </p>
+                        </li>
 
-                </div>
-            </div>
-        </div>
-        <div class="row">
-            <div class="col-sm-4">
-                <div class="form-group">
-                    <label class="col-sm-4 control-label">规格:</label>
-                    <div class="col-sm-8">
-                        <select name="specification" class="form-control" th:with="type=${@dict.getType('sys_select_specification')}">
-                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
-                                    th:selected="${dict.dictLabel}==${specification}"></option>
-                        </select>
-                    </div>
-                </div>
-            </div>
-            <div class="col-sm-4">
-                <div class="form-group">
-                    <label class="col-sm-4 control-label">数量:</label>
-                        <div class="col-sm-8">
-                            <input id="quantity" name="quantity" placeholder="请输入数量" class="form-control" type="number" maxlength="30" >
+                        <li class="list-group-item"><i class="fa fa-envelope-o"></i>
+                            <b  class="font-noraml">临床诊断:</b>
+                            <p class="pull-right">
+                            <div class="customize-form-group select-time">
+                                <select name="clinicalDiagnosis" class="styled-input" th:with="type=${@dict.getType('sys_select_dtp_ysfw_lczd')}"  >
+                                <option value="">请选择</option>
+                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}">
+                                </option>
+                                </select>
+                            </div>
+                            </p>
+                        </li>
+                    </ul>
+    </form>
+    <div class="form-horizontal">
+        <h4 class="form-header h4">药品信息</h4>
+        <p class="pull-right">
+        <div class="customize-form-group select-time">
+            <div class="panel-body">
+                <strong>药品信息</strong>
+                <div class="form-group" id="formGroup">
+                    <div class="col-sm-12">
+                        <div class="col-sm-11" id="carGroup">
+                            <div id="iboxContainer">
+                                <ul class="list-group list-group-striped" id="inputList">
+                                    <!-- 输入框将在这里动态添加 -->
+                                </ul>
+                            </div>
+                        </div>
+                        <div class="col-sm-offset-5 col-sm-10">
+                            <button type="button"  onclick="selectUsersToParentCallBack2()" class="btn-danger">添加药品</button>
                         </div>
-                </div>
-            </div>
-            <div class="col-sm-4">
-                <div class="form-group">
-                    <label class="col-sm-4 control-label">商品名:</label>
-                    <div class="col-sm-8">
-                            <input id="productName" name="productName"  type="text" maxlength="100"  class="form-control" placeholder="请输入商品名">
                     </div>
                 </div>
             </div>
         </div>
+        </p>
+    </div>
 
-        <div class="row">
-            <div class="col-sm-4">
 
-                <div class="form-group">
-                    <label class="col-sm-4 control-label">处方类型:</label>
-                    <div class="col-sm-8">
-                        <select name="prescriptionType" class="form-control" th:with="type=${@dict.getType('sys_select_prescription_ype')}">
-                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
-                                    th:selected="${dict.dictLabel}==${prescriptionType}"></option>
-                        </select>
-                        </div>
-                    </div>
-                </div>
+</div>
 
-            <div class="col-sm-4">
-                <div class="form-group">
-                    <label class="col-sm-4 control-label">配送方式:</label>
-                    <div class="col-sm-8">
-                        <select name="deliveryMethod" class="form-control" th:with="type=${@dict.getType('sys_select_delivery_method')}">
-                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
-                                    th:selected="${dict.dictLabel}==${deliveryMethod}"></option>
-                        </select>
-                    </div>
-                </div>
-            </div>
-            <div class="col-sm-4">
-                <div class="form-group">
-                    <label class="col-sm-4 control-label">MDM编码:</label>
+<th:block th:include="include :: footer" />
+<th:block th:include="include :: select2-js" />
+<th:block th:include="include :: bootstrap-fileinput-js" />
+<script>
+    var prefix = ctx + "dtp/recipe";
+    var jbtype='';
+    function uploadImage(input) {
+        if (input.files && input.files[0]) {
+            var reader = new FileReader();
+            reader.onload = function(e) {
+                $('#uploadedImage').attr('src', e.target.result).show();
+                sendImageToServer(e.target.result);
+            };
+            reader.readAsDataURL(input.files[0]);
+        }
+    }
 
-                    <div class="col-sm-8">
-                        <input id="mdmCode" name="mdmCode" placeholder="请输入MDM编码" class="form-control" type="text" maxlength="50" >
-                    </div>
-                </div>
-            </div>
+    function sendImageToServer(imageData) {
+        $.ajax({
+            url: '/upload-and-recognize',
+            type: 'POST',
+            contentType: 'application/json',
+            data: JSON.stringify({ imageData: imageData }),
+            success: function(response) {
+                $('#hospital').val(response.hospital);
+                $('#prescriptionDate').val(response.prescriptionDate);
+                $('#prescriptionDoctor').val(response.prescriptionDoctor);
+                $('#clinicalDiagnosis').val(response.clinicalDiagnosis);
+                $('#department').val(response.department);
+            },
+            error: function(error) {
+                console.error('Error:', error);
+            }
+        });
+    }
 
 
-        </div>
-        <div class="row">
-            <div class="col-sm-4">
-                <div class="form-group">
-                    <label class="col-sm-4 control-label is-required">医生:</label>
-                    <div class="col-sm-8">
-                        <input id="doctor" name="doctor" placeholder="请输入医生" class="form-control" type="text" maxlength="30" >
-                    </div>
-                </div>
-            </div>
-            <div class="col-sm-4">
-                <div class="form-group">
-                    <label class="col-sm-4 control-label is-required">医院:</label>
-                    <div class="col-sm-8">
-                        <input name="hospital" placeholder="请输入医院" class="form-control" type="text" maxlength="30" >
-                    </div>
-                </div>
-            </div>
-            <div class="col-sm-4">
-                <div class="form-group">
-                    <label class="col-sm-4 control-label ">科室:</label>
-                    <div class="col-sm-8">
-                            <input id="department" name="department" placeholder="请输入科室" class="form-control" type="text" maxlength="50">
-                        </div>
-                    </div>
-                </div>
-            </div>
+    document.getElementById('diseaseType').addEventListener('change', function() {
+        jbtype = this.value;
 
-        <h4 class="form-header h4">其他信息</h4>
-        <div class="row">
-            <div class="col-sm-4">
-                <div class="form-group">
-                    <label class="col-sm-6 control-label">pos会员姓名:</label>
-                        <div class="col-sm-6">
-                            <input id="posMemberName" name="posMemberName" placeholder="请输入pos会员姓名" class="form-control" type="text" maxlength="30" >
-                    </div>
-                </div>
-            </div>
-                <div class="col-sm-4">
-                    <div class="form-group">
-                        <label class="col-sm-6 control-label">pos会员手机号:</label>
-                            <div class="col-sm-6">
-                                <input id="posMemberPhone" name="posMemberPhone" placeholder="请输入pos会员手机号" class="form-control" type="number" maxlength="11" >
-                            </div>
-                        </div>
-                </div>
-            <div class="col-sm-4">
-                <div class="form-group">
+            if(jbtype=='慢病'){
+                specificDiseaseDiv1
+                $('#specificDiseaseDiv1').show();
+                $('#specificDiseaseDiv2').hide();
+                $('#specificDisease2').prop('selectedIndex', 0);
+            }else if(jbtype=='肿瘤'){
+                $('#specificDiseaseDiv2').show();
+                $('#specificDiseaseDiv1').hide();
+                $('#specificDisease1').prop('selectedIndex', 0);
+            }else{
+                $('#specificDisease1').prop('selectedIndex', 0);
+                $('#specificDisease2').prop('selectedIndex', 0);
+                $('#specificDiseaseDiv2').hide();
+                $('#specificDiseaseDiv1').hide();
+            }
 
-                </div>
-            </div>
+        console.log('Selected value:', this.value);
+    });
+    $(document).ready(function () {
 
-        </div>
+        //$('#prescriptionSourceItem').hide();//控制是第三方存入后 登记处方时的信息显示字段
+        //$('#prescriptionNumberItem').hide();//控制是第三方存入后 登记处方时的信息显示字段
+        // 单图上传
+        $("#singleFile").fileinput({
+            uploadUrl: ctx + 'common/upload',
+            maxFileCount: 1,
+            autoReplace: true
+        }).on('fileuploaded', function (event, data, previewId, index) {
+            var rsp = data.response;
+            log.info("return url:" + rsp.url)
+            log.info("reutrn fileName:" + rsp.fileName)
+            log.info("reutrn newFileName:" + rsp.newFileName)
+            log.info("return originalFilename:" + rsp.originalFilename)
+        }).on('fileremoved', function (event, id, index) {
+            $("input[name='" + event.currentTarget.id + "']").val('')
+        })
+    });
 
+    function submitHandler() {
+            add();
+    }
+    function add() {
+        debugger
+        var formData = [];
+        $('.ibox').each(function() {
+            var productId = $(this).find('input[name="productId"]').val();
+            var mdmCode = $(this).find('input[name="mdmCode"]').val();
+            var isFlipItem = $(this).find('input[name="isFlipItem"]').val();
+            var specification = $(this).find('input[name="specification"]').val();
+            var genericName = $(this).find('input[name="genericName"]').val();
+            var productName = $(this).find('input[name="productName"]').val();
+            var quantity = $(this).find('input[name="quantity"]').val();
+            var usageMethod = $(this).find('select[name="usageMethod"]').val();
+            var frequency = $(this).find('select[name="frequency"]').val();
+            var wordUsage = $(this).find('input[name="wordUsage"]').val();
+            var medicationCycle = $(this).find('input[name="medicationCycle"]').val();
+            if (productId && quantity && usageMethod && frequency && wordUsage && medicationCycle && productName && genericName && mdmCode && isFlipItem && specification ) {
+                formData.push({
+                    productId: productId,
+                    mdmCode: mdmCode,
+                    quantity: quantity,
+                    genericName: genericName,
+                    isFlipItem: isFlipItem,
+                    specification: specification,
+                    productName: productName,
+                    usageMethod: usageMethod,
+                    frequency: frequency,
+                    wordUsage: wordUsage,
+                    medicationCycle: medicationCycle
+                });
+            }
+        });
+        if ($.validate.form()) {
+            var data = $("#form-prescription-add").serializeArray();
+            data.push({name:'drugList',value:JSON.stringify(formData)});
+        }
 
+        log.info(data);
+        $.ajax({
+            cache : true,
+            type : "POST",
+            url : ctx + "dtp/recipe/SaveRecipe",
+            data : data,
+            async : false,
+            error : function(request) {
+                $.modal.alertError("系统错误");
+            },
+            success : function(data) {
+                if (data.result == "200") {
+                    $.modal.msg("保存成功,正在刷新数据请稍后……有个问题同事添加相同药品", modal_status.SUCCESS);
+                } else if (data.code == web_status.WARNING) {
+                    $.modal.alertWarning(data.msg)
+                } else {
+                    $.modal.alertError(data.msg);
+                }
 
-    </form>
-</div>
+                $.operate.successCallback(data);
 
-<div class="row">
-    <div class="col-sm-offset-5 col-sm-10">
-        <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保 存</button>&nbsp;
-        <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
-    </div>
-</div>
-<th:block th:include="include :: footer" />
-<th:block th:include="include :: select2-js" />
-<script>
-    var prefix = ctx + "dtp/recipe";
+            }
+        });
+    }
+    // callBack获取父窗口方法(方式二)
+    function selectUsersToParentCallBack2(){
+        var options = {
+            title: '药品信息',
+            url: prefix + "/drugInfo",
+            callBack: doSubmit2
+        };
+        $.modal.openOptions(options);
+    }
+    function doSubmit2(index, layero){
+        var rows = layero.find("iframe")[0].contentWindow.selectTableObject();
+        if (rows.length == 0) {
+            $.modal.alertWarning("请至少选择一条记录");
+            return;
+        }
+        rows.forEach(function(item, index) {
+            // 生成 ibox 容器
+            var ibox = '<div class="ibox" id="ibox-' + item.productId[0] + '">' +
+                '<div class="ibox-title">' +
+                '<h5>' + item.mdmCode[0] + ' - ' + item.productName[0] + '</h5>' +
+                '<input name="isFlipItem" placeholder="是否为上翻品" id="isFlipItem-' + item.isFlipItem[0] + '"  class="styled-input3" type="hidden" value="' + item.isFlipItem[0] + '">' +
+                '<input name="productId" placeholder="商品id" id="productId-' + item.productId[0] + '"  class="styled-input3" type="hidden" value="' + item.productId[0] + '">' +
+                '<input name="genericName" placeholder="商品通用名" id="genericName-' + item.genericName[0] + '"  class="styled-input3" type="hidden" value="' + item.genericName[0] + '">' +
+                '<input name="productName" placeholder="商品名" id="productName-' + item.productName[0] + '"  class="styled-input3" type="hidden" value="' + item.productName[0] + '">' +
+                '<input name="mdmCode" placeholder="MD编码" id="mdmCode-' + item.mdmCode[0] + '"  class="styled-input3" type="hidden" value="' + item.mdmCode[0] + '">' +
+                '<input name="specification" placeholder="规格" id="specification-' + item.specification[0] + '"  class="styled-input3" type="hidden" value="' + item.specification[0] + '">' +
+                '</div>' +
+                '<div class="ibox-content">' +
+                '<table class="table table-bordered">' +
+                '<tbody>' +
+                '<tr>' +
+                '<td>通用名</td>' +
+                '<td>' + item.genericName[0] + '</td>' +
+                '</tr>' +
+                '<tr>' +
+                '<td>规格</td>' +
+                '<td>' + item.specification[0] + '</td>' +
+                '</tr>' +
+                '</tbody>' +
+                '</table>' +
+                '<div class="form-group row">' +
+                '<label class="col-sm-2">数量</label>' +
+                '<div class="col-sm-4">' +
+                '<input name="quantity" placeholder="数量" id="quantity-' + item.productId[0] + '"  class="styled-input3" type="number">' +
+                '</div>' +
+                '<label class="col-sm-2">用法</label>' +
+                '<div class="col-sm-4">' +
+                '<select name="usageMethod"  id="usageMethod-' + item.productId[0] + '" class="styled-input3">' +
+                '<option value="">请选择</option>' +
+                '<option value="口服">口服</option>' +
+                '<option value="注射">注射</option>' +
+                '</select>' +
+                '</div>' +
+                '</div>' +
+                '<div class="form-group row">' +
+                '<label class="col-sm-2">使用频次</label>' +
+                '<div class="col-sm-4">' +
+                '<select name="frequency"  id="frequency-' + item.productId[0] + '" class="styled-input4">' +
+                '<option value="">请选择</option>' +
+                '<option value="每日一次">每日一次</option>' +
+                '<option value="每日两次">每日两次</option>' +
+                '</select>' +
+                '</div>' +
+                '<label class="col-sm-2">单次用量</label>' +
+                '<div class="col-sm-4">' +
+                '<input name="wordUsage" placeholder="单次用量" id="wordUsage-' + item.productId[0] + '"  class="styled-input4" type="text">' +
+                '</div>' +
+                '</div>' +
+                '<div class="form-group row">' +
+                '<label class="col-sm-2">用药周期(天)</label>' +
+                '<div class="col-sm-4">' +
+                '<input name="medicationCycle" placeholder="用药周期" id="medicationCycle-' + item.productId[0] + '" class="styled-input4" type="text">' +
+                '</div>' +
+                '<div class="col-sm-6 text-right">' +
+                '<button onclick="deleteRow(\'' + item.productId[0] + '\')" class="btn btn-danger">删除</button>' +
+                '</div>' +
+                '</div>' +
+                '</div>' +
+                '</div>';
 
-    function submitHandler() {
-        if ($.validate.form()) {
-            var data = $("#form-user-add").serializeArray();
+            // 添加到容器
+            $('#iboxContainer').append(ibox);
+        });
+        $.modal.close(index);
+    }
+    function deleteRow(productId) {
+        // 删除 ibox 容器
+        $('#ibox-' + productId).remove();
 
-            $.operate.saveTab(prefix + "/add", data);
+        // 更新 productId 显示
+        $('#productId').html('');
+    }
+    $('#inputImage').on('change', function() {
+        var reader = new FileReader();
+        var file = $('#inputImage')[0].files[0];
+        if (/^image\/\w+$/.test(file.type)) {
+            reader.onload = function(e) {
+                if(croppable){
+                    cropper.replace(e.target.result)
+                }
+            }
+            reader.readAsDataURL(this.files[0]);
+        } else {
+            $.modal.alertWarning('请选择一个图片文件。');
         }
+    });
+    function avatar() {
+        var url = ctx + 'system/user/profile/avatar';
+        top.layer.open({
+            type: 2,
+            area: [$(window).width() + 'px', $(window).height() + 'px'],
+            fix: false,
+            //不固定
+            maxmin: true,
+            shade: 0.3,
+            title: "身份证信息",
+            content: url,
+            btn: ['确定', '关闭'],
+            // 弹层外区域关闭
+            shadeClose: true,
+            yes: function(index, layero) {
+                var iframeWin = layero.find('iframe')[0];
+                iframeWin.contentWindow.submitHandler(index, layero);
+            },
+            cancel: function(index) {
+                return true;
+            }
+        });
     }
 
     /* 用户管理-新增-选择门店树 */
@@ -239,7 +433,85 @@
         $.modal.close(index);
     }
 
+
+
 </script>
+<style>
+    .hidden {
+        display: none;
+    }
+    .ibox {
+        width: 700px;
+        margin-bottom: 20px;
+        border: 1px solid #e7eaec;
+        border-radius: 4px;
+    }
+    .ibox-title {
+        background-color: #f3f3f4;
+        border-bottom: 1px solid #e7eaec;
+        padding: 10px 15px;
+        font-size: 16px;
+    }
+    .ibox-content {
+        padding: 15px;
+    }
+    .ibox-content h4 {
+        margin-top: 0;
+    }
+    .customize-form-group2 {
+        display: inline-block;
+    }
+    .styled-input2 {
+        padding: 5px;
+        border: 1px solid #ccc;
+        border-radius: 4px;
+        width: 200px;
+    }
+    .styled-input3 {
+        display: inline-block;
+        padding: 5px;
+        border: 1px solid #ccc;
+        border-radius: 4px;
+        width: 100px;
+    }
+    .styled-input4 {
+        display: inline-block;
+        padding: 5px;
+        border: 1px solid #ccc;
+        border-radius: 4px;
+        width: 100px;
+    }
+    .col-sm-6 {
+        width: 125%;
+    }
+    .form-horizontal .form-group {
+        margin-right: 384px;
+        margin-left: 3px;
+    }
+    input[type=file] {
+        display: none;
+    }
+    .form-group {
+        margin-bottom: -1px;
+    }
+    /* 添加一些基础样式 */
+    body {
+        font-family: Arial, sans-serif;
+    }
+    table {
+        width: 400px;
+        border-collapse: collapse;
+    }
+    th, td {
+        text-align: left;
+        padding: 8px;
+        border-bottom: 1px solid #ddd;
+    }
+    tr:nth-child(even) {
+        width: 15px;
+        background-color: #f2f2f2;
+    }
+</style>
 </body>
 </html>
 

+ 165 - 0
health-admin/src/main/resources/templates/dtp/recipe/drugInfo.html

@@ -0,0 +1,165 @@
+<!DOCTYPE html>
+<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
+<head>
+	<meta charset="UTF-8">
+	<meta name="format-detection" content="telephone=no">
+	<th:block th:include="include :: header('药品信息')" />
+	<th:block th:include="include :: layout-latest-css" />
+	<th:block th:include="include :: ztree-css" />
+</head>
+
+<body class="gray-bg">
+<div class="ui-layout-center">
+<input type="hidden" id="rowIds">
+	<div class="row">
+		<div class="col-sm-12 search-collapse">
+			<div class="query-condition-container">
+				<h4 class="query-condition-title">查询条件</h4>
+				<div class="query-buttons">
+					<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
+					<a class="btn btn-warning btn-rounded btn-sm" onclick="resetPre()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
+				</div>
+			</div>
+			<form id="tag-form" class="customize-search-form">
+				<div class="customize-form-group-container">
+					<div class="customize-form-group">
+						<label>药品:</label>
+						<input type="text" class="styled-input" placeholder="请输入MDM编码或药品商品名" name="query" style="width: 300px;"/>
+					</div>
+				</div>
+			</form>
+		</div>
+
+	</div>
+	<div class="row">
+		<div class="col-sm-12 select-table table-striped">
+			<table id="bootstrap-table"></table>
+		</div>
+	</div>
+</div>
+<th:block th:include="include :: footer" />
+<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" />
+<script th:inline="javascript">
+	var viewFlag = [[${@permission.hasPermi('dtp:configInfo:list')}]];
+	var prefix = ctx + "dtp/configInfo";
+
+	$(function() {
+		var panehHidden = false;
+		if ($(this).width() < 1590) {
+			panehHidden = true;
+		}
+		$('body').layout({ initClosed: panehHidden, west__size: 185, resizeWithWindow: false });
+		// 回到顶部绑定
+		if ($.fn.toTop !== undefined) {
+			var opt = {
+				win:$('.ui-layout-center'),
+				doc:$('.ui-layout-center')
+			};
+			$('#scroll-up').toTop(opt);
+		}
+		queryUserList();
+	});
+
+	function queryUserList() {
+		var options = {
+			url: prefix + "/storeTagList",//storeTagListByproductNameAndMdmCode
+			viewUrl: prefix + "/view/{id}",
+			exportUrl: prefix + "/export",
+			sortName: "createTime",
+			sortOrder: "desc",
+			modalName: "药品信息",
+			showFooter:true,  //是否显示表格底部区域。
+			clickToSelect: true, //是否启用点击行时选中整行的功能。
+			singleSelect: true, //是否仅允许选择一行
+			fixedColumns: true,
+			//fixedNumber: 3,
+			//fixedRightNumber: 1,
+			columns: [{
+				checkbox: true
+			},
+				{
+					field: "id",
+					title: "id",
+					//hidden:false
+					visible: true,
+				},
+				{
+					"field": "storeName",
+					"title": "门店名称"
+				},{
+					"field": "mdmCode",
+					"title": "MDM编码"
+				},{
+					"field": "productName",
+					"title": "药品商品名"
+				},{
+					"field": "genericName",
+					"title": "药品通用名"
+				},{
+					"field": "specification",
+					"title": "规格"
+				},{
+					"field": "isPrescriptionItem",
+					"title": "是否为处方登记品"
+				},{
+					"field": "isFlipItem",
+					"title": "是否为上翻品"
+				},{
+					"field": "isFollowUpItem",
+					"title": "是否为随访品"
+				}]
+		};
+		$.table.init(options);
+	}
+
+	/* 自定义重置-表单重置/隐藏框/树节点选择色/搜索 */
+	function resetPre() {
+		resetDate();
+		$("#tag-form")[0].reset();
+		$("#deptId").val("");
+		$("#parentId").val("");
+		$(".curSelectedNode").removeClass("curSelectedNode");
+		$.table.search();
+	}
+	/* 添加用户-选择用户-提交(子页面调用父页面形式) */
+	function submitHandler(index, layero) {
+		debugger
+		var rows = $.table.selectFirstColumns();
+
+		if (rows.length == 0) {
+			$.modal.alertWarning("请至少选择一条记录");
+			return;
+		}
+		$.modal.close();
+		// 父页面的方法
+		// activeWindow().selectUsers();
+		// 父页面的变量
+		activeWindow().$('#userids').html('我是通过方式一来的:' + rows.join());
+	}
+
+	/* 添加用户-选择用户-提交(回调形式-父页面调用子页面) */
+	function getSelections() {
+		return $.table.selectFirstColumns();
+	}
+
+	function selectTableObject() {
+		var productName = $.table.selectColumns('productName');
+		var mdmCode = $.table.selectColumns('mdmCode');
+		var genericName = $.table.selectColumns('genericName');
+		var specification = $.table.selectColumns('specification');
+		var isFlipItem = $.table.selectColumns('isFlipItem');
+		var productId = $.table.selectColumns('id');
+		var column = [{productName:productName,genericName:genericName,mdmCode:mdmCode,specification:specification,isFlipItem:isFlipItem,productId:productId}];
+		return column;
+	}
+	$("#bootstrap-table").on("check.bs.table check-all.bs.table uncheck.bs.table uncheck-all.bs.table", function (e, rowsAfter, rowsBefore) {
+		var rows = $.common.equals("uncheck-all", e.type) ? rowsBefore : rowsAfter;
+		var rowIds = $.table.affectedRowIds(rows);
+		$("#rowIds").val(rowIds);
+	});
+</script>
+</body>
+
+</html>

+ 4 - 4
health-admin/src/main/resources/templates/dtp/recipe/recipe.html

@@ -75,8 +75,8 @@
 				</div>
 
 		        <div class="btn-group-sm" id="toolbar" role="group">
-		        	<a class="btn btn-success" onclick="$.operate.addTab()" shiro:hasPermission="dtp:recipe:add">
-		                <i class="fa fa-plus"></i> 新增
+		        	<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="dtp:recipe:add">
+		                <i class="fa fa-plus"></i> 处方登记APP
 		            </a>
 		             <a class="btn btn-primary single disabled" onclick="$.operate.editTab()" shiro:hasPermission="dtp:recipe:edit">
 			            <i class="fa fa-edit"></i> 修改
@@ -201,10 +201,10 @@
 						title: "处方类型",
 						formatter: function(value, row, index) {
 							switch (value) {
-								case "1":
+								case 1:
 									return "电子处方";
 									break;
-								case "2":
+								case 2:
 									return "纸质处方";
 									break;
 								default:

+ 206 - 0
health-admin/src/main/resources/templates/jkgl/archivesmbhzList.html

@@ -0,0 +1,206 @@
+<!DOCTYPE html>
+<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
+<head>
+	<th:block th:include="include :: header('档案管理')" />
+	<th:block th:include="include :: layout-latest-css" />
+	<th:block th:include="include :: ztree-css" />
+</head>
+<body class="gray-bg">
+
+	<div class="ui-layout-center">
+		<div class="container-div">
+			<div class="row">
+				<div class="col-sm-12 search-collapse" >
+					<div class="query-condition-container">
+						<h4 class="query-condition-title">查询条件</h4>
+						<div class="query-buttons">
+							<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
+							<a class="btn btn-warning btn-rounded btn-sm" onclick="resetPre()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
+						</div>
+					</div>
+					<form id="archives-form" class="customize-search-form">
+						<div class="customize-form-group">
+							<label>患者信息:</label>
+							<input type="text" placeholder="请输入姓名手机号" class="styled-input" name="name"/>
+						</div>
+						<div class="customize-form-group">
+							<label>	药品:</label>
+							<input type="text"  placeholder="请输入商品名/通用名/MDM编码" class="styled-input" name="query"/>
+						</div>
+						<div class="customize-form-group">
+							<label>随访跟进人:</label>
+							<input type="text"  placeholder="请输入随访跟进人" class="styled-input" name="followUpPerson"/>
+						</div>
+						<div class="customize-form-group">
+							<label>是否接受随访:</label>
+							<select name="acceptFollowUp" id="acceptFollowUpSelect" class="styled-input" th:with="type=${@dict.getType('sys_select_yes_no')}">
+								<option value="">所有</option>
+								<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"></option>
+							</select>
+						</div>
+						<div class="customize-form-group">
+							<label>档案是否完善:</label>
+							<select name="archiveCompleteStatus"  class="styled-input" th:with="type=${@dict.getType('sys_doc_yes_no')}">
+								<option value="">所有</option>
+								<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}" ></option>
+							</select>
+						</div>
+						<div class="customize-form-group">
+							<label>门店:</label>
+							<input type="text"  placeholder="请输入门店" class="styled-input" name="storeName"/>
+						</div>
+
+					</form>
+				</div>
+
+		        <div class="btn-group-sm" id="toolbar" role="group">
+		        <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:user:add">
+		                <i class="fa fa-plus"></i> 患者建档(APP)
+		            </a>
+		             <a class="btn btn-primary single disabled" onclick="$.operate.editTab()" shiro:hasPermission="system:user:edit">
+			            <i class="fa fa-edit"></i> 完善档案
+			        </a>
+		            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:user:remove">
+		                <i class="fa fa-remove"></i> 删除
+		            </a>
+
+		        </div>
+
+				<div class="col-sm-12 select-table table-striped" style="width: 100%; overflow-x: auto;">
+					<table id="bootstrap-table" class="fixed-layout-table"></table>
+				</div>
+			</div>
+		</div>
+	</div>
+
+	<th:block th:include="include :: footer" />
+	<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" />
+	<script th:inline="javascript">
+		var editFlag = [[${@permission.hasPermi('dtp:RecipeRegister:edit')}]];
+		var removeFlag = [[${@permission.hasPermi('dtp:RecipeRegister:remove')}]];
+		var prefix = ctx + "jkgl/mbhzServers";
+		$(function() {
+		    var panehHidden = false;
+		    if ($(this).width() < 1590) {
+		        panehHidden = true;
+		    }
+		    $('body').layout({ initClosed: panehHidden, west__size: 185, resizeWithWindow: false });
+	     	// 回到顶部绑定
+	    	if ($.fn.toTop !== undefined) {
+	    		var opt = {
+	    			win:$('.ui-layout-center'),
+	    			doc:$('.ui-layout-center')
+	    		};
+	    		$('#scroll-up').toTop(opt);
+	    	}
+			queryArchivesList();
+		});
+
+		function queryArchivesList() {
+		    var options = {
+		        url: prefix + "/archivesmbhzList",
+		        viewUrl: prefix + "/archivesView/{id}",
+		        createUrl: prefix + "/archivesAdd",
+		        updateUrl: prefix + "/archivesEdit/{id}",
+		        removeUrl: prefix + "/archivesRemove",
+		        /*exportUrl: prefix + "/export",
+		        importUrl: prefix + "/importData",
+		        importTemplateUrl: prefix + "/importTemplate",*/
+		        sortName: "id",
+		        sortOrder: "asc",
+		        modalName: "档案",
+				fitColumns: true,
+				striped: true,
+				autoRowHeight: true,
+				rowNumbers: true,
+				showFooter:true,  //是否显示表格底部区域。
+				clickToSelect: true, //是否启用点击行时选中整行的功能。
+                singleSelect: false, //是否仅允许选择一行
+				fixedColumns: true,
+				//fixedNumber: 3,
+				fixedRightNumber: 1,
+		        columns: [
+					{
+						checkbox: true
+					},
+				{field: 'name', title: '姓名', align: 'center'},
+				{field: 'gender', title: '性别', align: 'center'},
+				{field: 'age', title: '年龄', align: 'center'},
+				{field: 'phoneNumber', title: '手机号', align: 'center'},
+				{field: 'documentType', title: '证件类型', align: 'center'},
+				{field: 'documentNumber', title: '证件号码', align: 'center'},
+				{field: 'realNameStatus', title: '实名状态', align: 'center'},
+				{field: 'flipStatus', title: '上翻状态', align: 'center'},
+				{field: 'disease', title: '疾病', align: 'center'},
+				{field: 'genericName', title: '药品通用名', align: 'center'},
+				{field: 'productName', title: '商品名', align: 'center'},
+				{field: 'mdmCode', title: 'MDM编码', align: 'center'},
+				{field: 'manufacturer', title: '厂家', align: 'center'},
+				{field: 'storeName', title: '门店', align: 'center'},
+				{field: 'archiveCreator', title: '档案创建人', align: 'center'},
+				{field: 'archiveCompleter', title: '档案完善人', align: 'center'},
+				{field: 'acceptFollowUp', title: '是否接受随访', align: 'center'},
+				{field: 'followUpPerson', title: '随访跟进人', align: 'center'},
+				{field: 'archiveCompleteStatus', title: '档案是否完善', align: 'center'},
+				{field: 'charityAssistance', title: '有无慈善援助', align: 'center'},
+				{field: 'joinProject', title: '是否参加共建项目', align: 'center'},
+				{field: 'followUpStatus', title: '随访状态', align: 'center'},
+				{field: 'updateTime2', title: '更新时间', align: 'center'},
+				/*{
+		        	formatter: function (value, row, index) {
+						console.log(value+"-------v");
+						console.log(row+"-------r");
+		        		return statusTools(row);
+		        	}
+		        },*/
+
+		        {
+		            title: '操作',
+		            align: 'center',
+		            formatter: function(value, row, index) {
+		                if (row.id) {
+		                	var actions = [];
+			                actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑档案</a> ');
+			                actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a> ');
+			                var more = [];
+			                /*more.push("<a class='btn btn-default btn-xs " + resetPwdFlag + "' href='javascript:void(0)' onclick='resetPwd(" + row.userId + ")'><i class='fa fa-key'></i>重置密码</a> ");
+			                more.push("<a class='btn btn-default btn-xs " + editFlag + "' href='javascript:void(0)' onclick='authRole(" + row.userId + ")'><i class='fa fa-check-square-o'></i>分配角色</a>");
+			                actions.push('<a tabindex="0" class="btn btn-info btn-xs" role="button" data-container="body" data-placement="left" data-toggle="popover" data-html="true" data-trigger="hover" data-content="' + more.join('') + '"><i class="fa fa-chevron-circle-right"></i>更多操作</a>');*/
+			                return actions.join('');
+		            	} else {
+		                    return "";
+		                }
+		            }
+		        }]
+		    };
+		    $.table.init(options);
+		}
+
+		/* 自定义重置-表单重置/隐藏框/树节点选择色/搜索 */
+		function resetPre() {
+			resetDate();
+			$("#archives-form")[0].reset();
+			$("#deptId").val("");
+			$("#parentId").val("");
+			$(".curSelectedNode").removeClass("curSelectedNode");
+			$.table.search();
+			var resetButton = document.getElementById('archives-form');
+			resetButton.addEventListener('click', function() {
+				_refresh();
+			});
+		}
+
+		/* 用户状态显示 */
+		function statusTools(row) {
+		    if (row.status == 1) {
+    			return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="enable(\'' + row.userId + '\')"></i> ';
+    		} else {
+    			return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="disable(\'' + row.userId + '\')"></i> ';
+    		}
+		}
+	</script>
+</body>
+
+</html>

+ 150 - 27
health-system/src/main/java/com/bzd/system/service/DTPService.java

@@ -4,17 +4,25 @@ 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.core.domain.entity.DtpDeliveryPrint;
+import com.bzd.common.utils.DateUtils;
 import com.bzd.common.utils.StringUtils;
+import com.bzd.common.utils.uuid.IdUtils;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
-import java.util.List;
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import static com.bzd.common.utils.ShiroUtils.getSysUser;
+
+
 @Service
 public class DTPService {
     @Autowired
@@ -22,8 +30,10 @@ public class DTPService {
 
     @Resource(name = "daoSupport")
     private DaoSupport daoSupport;
+
     /**
      * 处方列表
+     *
      * @param pd
      * @return
      * @throws Exception
@@ -31,44 +41,125 @@ public class DTPService {
     public List<PageData> findForList(final PageData pd) throws Exception {
         return (List<PageData>) daoSupport.findForList("DTPMapper.RecipeRegisterList", pd);
     }
+
     /**
      * 处方信息
+     *
      * @param pd
      * @return
      * @throws Exception
      */
     public Object findOne(final PageData pd) throws Exception {
-        return  daoSupport.findForObject("DTPMapper.selectOne", pd);
+        return daoSupport.findForObject("DTPMapper.selectOne", pd);
     }
+
     /**
      * 处方登记 添加
+     *
      * @param pd
      * @return
      * @throws Exception
      */
-    public Integer save(final PageData pd) throws Exception {
+    @Transactional(rollbackFor = Exception.class)
+    public PageData save(final PageData pd) throws Exception {
+        pd.put("createTime", DateUtils.getTime());//处方表 处方单号时间
+        Object prescriptionNumber = pd.get("prescriptionNumber");
+        Object prescriptionImg = pd.get("prescriptionImg");
+        Object prescriptionDate =pd.get("prescriptionDate");
+        if (StringUtils.isNull(prescriptionNumber)) {
+            pd.put("prescriptionNumber", IdUtils.fastSimpleUUID());//处方表 处方单号 如果没有就自动生成
+            if( StringUtils.isNull(prescriptionImg)){
+                pd.put("status",5);//待上传处方
+            }
+            if( StringUtils.isNull(prescriptionDate)){
+                pd.put("prescriptionDate", DateUtils.getTime());
+            }
 
-                pd.put("orderId","1111");//订单编号
-                pd.put("saleOrderNumber","22323421");//销售单号
-                LocalDateTime now = LocalDateTime.now();
-                DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");//2024-01-01 10:00:00
-                String formattedOrderTime = now.format(formatter);
-                pd.put("orderTime",formattedOrderTime);//订单时间
-                pd.put("prescriptionNumber","22323422223321");//处方单号
+        }
+        String isFlipItemStr = "否"; // 初始化 isFlipItemStr
+        boolean isFlipItemFound = false; // 标志变量
+        String Id = IdUtils.fastSimpleUUID();
+        List<PageData> addList = new ArrayList<>();
+        Object drugList = pd.get("drugList");//获取药品信息列表
+        if (StringUtils.isNotNull(drugList)) {
+            try {
+                // 将 JSON 字符串转换为 List<Map<String, Object>>
+                ObjectMapper objectMapper = new ObjectMapper();
+                List<Map<String, Object>> rowsdrugList = objectMapper.readValue(drugList.toString(), List.class);
+                // 遍历列表并调用插入数据接口
+                if (rowsdrugList.size() > 0) {
+                    for (Map<String, Object> lxr : rowsdrugList) {
+                        PageData pageData = new PageData();
+                        pageData.put("creator", getSysUser().getLoginName());
+                        pageData.put("createTime", DateUtils.getTime());
+                        pageData.put("productName", lxr.get("productName"));
+                        pageData.put("genericName", lxr.get("genericName"));
+                        pageData.put("prescriptionNumber", Id);//处方药品信息表d的处方单号是处方表的主键id
+                        pageData.put("specification", lxr.get("specification"));
+                        pageData.put("usageMethod", lxr.get("usageMethod"));
+                        pageData.put("quantity", lxr.get("quantity"));
+                        pageData.put("frequency", lxr.get("frequency"));
+                        pageData.put("wordUsage", lxr.get("wordUsage"));
+                        pageData.put("medicationCycle", lxr.get("medicationCycle"));
+                        pageData.put("mdmCode", lxr.get("mdmCode"));
+                        pageData.put("drugCode", lxr.get("productId"));
+                        pageData.put("isFlipItem", lxr.get("isFlipItem"));
+                        // 检查 isFlipItem 字段的值
+                        if ("是".equals(lxr.get("isFlipItem")) && !isFlipItemFound) {
+                            isFlipItemStr = "是";
+                            isFlipItemFound = true; // 设置标志变量
+                        }
+                        addList.add(pageData);
+                    }
+                    final HashMap<String, Object> addMap = new HashMap<String, Object>();
+                    addMap.put("dataList", addList);
+                    int resultDrug= dao.executeBatch("DTPMapper.batchAddPrescriptionDrug", addMap);
+                }
 
-        return daoSupport.save("DTPMapper.insertRecipe", pd);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+
+        }
+        pd.put("id", Id);//处方单表id主键
+        pd.put("isFlipItem", isFlipItemStr);//是否包含有上翻品
+       int result = daoSupport.save("DTPMapper.insertRecipe", pd);
+        PageData resultpageData = new PageData();
+       if(result>0){
+           resultpageData.put("id", Id);//处方单表id主键
+           Object prescription =  daoSupport.findForObject("DTPMapper.selectOne", resultpageData);
+           resultpageData.put("result", "200");
+           resultpageData.put("prescription", prescription);
+           return resultpageData;
+       }else{
+           resultpageData.put("id", Id);//处方单表id主键
+           resultpageData.put("result","300");
+           return resultpageData;
+       }
     }
+
+
     /**
      * 处方删除
-     * @param pd
+     *
+     * @param ids
      * @return
      * @throws Exception
      */
-    public Integer del(PageData pd) throws Exception {
-        return daoSupport.delete("DTPMapper.deleteRecipe", pd);
+    public Integer del(List<String> ids) throws Exception {
+        return daoSupport.delete("DTPMapper.deleteRecipe", ids);
+    }
+    /**
+     * 一店一目删除
+     * @param ids
+     */
+    public Integer deleteProductList(List<String> ids) throws Exception {
+        return daoSupport.delete("DTPMapper.deleteProductList", ids);
     }
+
     /**
      * 处方修改
+     *
      * @param pd
      * @return
      * @throws Exception
@@ -76,20 +167,36 @@ public class DTPService {
     public Integer update(PageData pd) throws Exception {
         return daoSupport.delete("DTPMapper.updateRecipe", pd);
     }
+
     /**
      * 校验患者姓名和电话
+     *
      * @param pd
      * @return
      * @throws Exception
      */
     public boolean checkPatientNameAndPhoneUnique(PageData pd) throws Exception {
 
-        Object obj=   daoSupport.findForObject("DTPMapper.checkPatientNameAndPhoneUnique", pd);
+        Object obj = daoSupport.findForObject("DTPMapper.checkPatientNameAndPhoneUnique", pd);
+        return StringUtils.isNull(obj);
+    }
+
+    /**
+     * 校验患者姓名和身份证号
+     *
+     * @param pd
+     * @return
+     * @throws Exception
+     */
+    public boolean checkPatientNameAndIdCardUnique(PageData pd) throws Exception {
+
+        Object obj = daoSupport.findForObject("DTPMapper.checkPatientNameAndIdCardUnique", pd);
         return StringUtils.isNull(obj);
     }
 
     /**
      * 冷链配送列表
+     *
      * @param pd
      * @return
      * @throws Exception
@@ -100,23 +207,26 @@ public class DTPService {
 
     /**
      * 冷链配送登记 添加
+     *
      * @param pd
      * @return
      * @throws Exception
      */
     public Integer saveCold(final PageData pd) throws Exception {
 
-        pd.put("orderNumber","1113333");//订单编号
+        pd.put("orderNumber", "1113333");//订单编号
         LocalDateTime now = LocalDateTime.now();
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");//2024-01-01 10:00:00
         String formattedOrderTime = now.format(formatter);
-        pd.put("create_time",formattedOrderTime);//订单时间
-        pd.put("creationTime",formattedOrderTime);//订单创建时间
-        pd.put("createdBy","admin");//订单创建时间
+        pd.put("create_time", formattedOrderTime);//订单时间
+        pd.put("creationTime", formattedOrderTime);//订单创建时间
+        pd.put("createdBy", "admin");//订单创建时间
         return daoSupport.save("DTPMapper.insertDistributionOrder", pd);
     }
+
     /**
      * 配送订单修改
+     *
      * @param pd
      * @return
      * @throws Exception
@@ -125,11 +235,13 @@ public class DTPService {
         LocalDateTime now = LocalDateTime.now();
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");//2024-01-01 10:00:00
         String formattedOrderTime = now.format(formatter);
-        pd.put("updatedTime",formattedOrderTime);//订单时间
+        pd.put("updatedTime", formattedOrderTime);//订单时间
         return daoSupport.update("DTPMapper.updateDistributionOrder", pd);
     }
+
     /**
      * 配送订单软删除
+     *
      * @param pd
      * @return
      * @throws Exception
@@ -140,6 +252,7 @@ public class DTPService {
 
     /**
      * 配送单据打印列表
+     *
      * @param pd
      * @return
      * @throws Exception
@@ -148,8 +261,10 @@ public class DTPService {
 
         return (List<PageData>) daoSupport.findForList("DTPMapper.listPrintPd", pd);
     }
+
     /**
      * 配送单据打印导出
+     *
      * @param pd
      * @return
      * @throws Exception
@@ -157,8 +272,10 @@ public class DTPService {
     public List<DtpDeliveryPrint> listPrintReport(final PageData pd) throws Exception {
         return (List<DtpDeliveryPrint>) daoSupport.findForList("DTPMapper.listPrintEntity", pd);
     }
+
     /**
      * 配送单据打印 添加
+     *
      * @param pd
      * @return
      * @throws Exception
@@ -168,16 +285,18 @@ public class DTPService {
         LocalDateTime now = LocalDateTime.now();
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");//2024-01-01 10:00:00
         String formattedOrderTime = now.format(formatter);
-        pd.put("create_time",formattedOrderTime);//订单时间
-        pd.put("creationTime",formattedOrderTime);//订单创建时间
-        pd.put("createdBy","admin");//订单创建人
-        pd.put("businessId","10359");//业务ID
-        pd.put("status","待打印");//打印状态
+        pd.put("create_time", formattedOrderTime);//订单时间
+        pd.put("creationTime", formattedOrderTime);//订单创建时间
+        pd.put("createdBy", "admin");//订单创建人
+        pd.put("businessId", "10359");//业务ID
+        pd.put("status", "待打印");//打印状态
 
         return daoSupport.save("DTPMapper.savePrint", pd);
     }
+
     /**
      * 配送单据打印修改
+     *
      * @param pd
      * @return
      * @throws Exception
@@ -186,11 +305,13 @@ public class DTPService {
         LocalDateTime now = LocalDateTime.now();
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");//2024-01-01 10:00:00
         String formattedOrderTime = now.format(formatter);
-        pd.put("updatedTime",formattedOrderTime);//订单时间
+        pd.put("updatedTime", formattedOrderTime);//订单时间
         return daoSupport.update("DTPMapper.editPrint", pd);
     }
+
     /**
      * 配送单据打印软删除
+     *
      * @param pd
      * @return
      * @throws Exception
@@ -200,10 +321,10 @@ public class DTPService {
     }
 
 
-
     /**配置信息查询模块**/
     /**
      * 一店一目标签列表
+     *
      * @param pd
      * @return
      * @throws Exception
@@ -211,8 +332,10 @@ public class DTPService {
     public List<PageData> findstoreTagList(final PageData pd) throws Exception {
         return (List<PageData>) daoSupport.findForList("DTPMapper.StoreProductList", pd);
     }
+
     /**
      * DTP医院列表
+     *
      * @param pd
      * @return
      * @throws Exception

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

@@ -31,11 +31,11 @@ public class PharmaceuticalService {
     private DaoSupport daoSupport;
 
     public List<PageData> findArchivesList(PageData pd) throws Exception{
-        List<PageData> list= (List<PageData>) daoSupport.findForList("PharmaceuticalServiceMapper.selectArchivesList", pd);
-        pd.put("archiveId", pd.get("id"));
-        List<PageData> listBasicInfomation= (List<PageData>) daoSupport.findForList("PharmaceuticalServiceMapper.selectPatientBasicInfo", pd);
-        list.addAll(listBasicInfomation);
-        return list;
+        return (List<PageData>) daoSupport.findForList("PharmaceuticalServiceMapper.selectArchivesList", pd);
+//        pd.put("archiveId", pd.get("id"));
+//        List<PageData> listBasicInfomation= (List<PageData>) daoSupport.findForList("PharmaceuticalServiceMapper.selectPatientBasicInfo", pd);
+//        list.addAll(listBasicInfomation);
+//        return list;
 
     }
     public List<PageData> findBasicInfomation(PageData pd) throws Exception{

+ 5 - 3
health-system/src/main/resources/mapper/pmServiceMapper/PharmaceuticalServiceMapper.xml

@@ -57,13 +57,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		</if>
 
 	</select>
-	<!-- 检查患者是否存在 -->
+	<!-- 检查患者是否存在name LIKE CONCAT('%', #{name}, '%') -->
 	<select id="checkPatientIsExist" parameterType="pd" resultType="pd">
 		select name,phoneNumber from s_dtp_ysfw_archive_management where 1=1
 		<if test="name!= null and name!=''">
-			and name=#{name}
+			and name =#{name}
+		</if>
+		<if test="documentNumber!= null and documentNumber!=''">
+			and documentNumber=#{documentNumber}
 		</if>
-
 		<if test="phoneNumber!= null and phoneNumber!=''">
 			and phoneNumber=#{phoneNumber}
 		</if>

+ 345 - 43
health-system/src/main/resources/mapper/system/DTPMapper.xml

@@ -3,14 +3,11 @@
         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="DTPMapper">
-<!--处方登记 -->
+<!--处方登记信息查询 -->
     <select id="RecipeRegisterList" parameterType="pd" resultType="pd">
-        select id, orderId, saleOrderNumber, genericName, productName, specification, quantity, manufacturer, mdmCode,
-        posMemberName, posMemberPhone, prescriptionType, prescriptionNumber, hospital, department,
-        doctor, patientName, patientPhone, storeName, registrar, completionTime,lastUpdated, deliveryMethod, paymentCode,
-        paymentMethod, status , createTime  from s_dtp_cfdj_prescription
+        select * from s_dtp_cfdj_prescription
         <where>
-            <if test="id != null">AND id = #{id}</if>
+            <if test="id != null and id!=''">AND id = #{id}</if>
             <if test="orderId != null and orderId!=''">AND orderId = #{orderId}</if>
             <if test="saleOrderNumber != null and saleOrderNumber!=''">AND saleOrderNumber = #{saleOrderNumber}</if>
             <if test="genericName != null and genericName!=''">AND genericName = #{genericName}</if>
@@ -25,6 +22,8 @@
             <if test="beginTime != null and beginTime!='' and endTime != null and endTime!=''">
                 and createTime between #{beginTime} and #{endTime}
             </if>
+            <if test="orderTime != null and orderTime!=''">AND orderTime= #{orderTime}</if>
+            <if test="saleOrderTime != null and saleOrderTime!=''">AND saleOrderTime= #{saleOrderTime}</if>
             <if test="prescriptionNumber != null and prescriptionNumber!=''">AND prescriptionNumber = #{prescriptionNumber}</if>
             <if test="hospital != null and hospital!=''">AND hospital = #{hospital}</if>
             <if test="department != null and department!=''">AND department = #{department}</if>
@@ -40,7 +39,9 @@
             <if test="paymentCode != null and paymentCode!=''">AND paymentCode = #{paymentCode}</if>
             <if test="paymentMethod != null and paymentMethod!=''">AND paymentMethod = #{paymentMethod}</if>
             <if test="status != null  and status!=''">AND status = #{status}</if>
+            <if test="isFlipItem != null  and isFlipItem!=''">AND isFlipItem = #{isFlipItem}</if>
             <if test="createTime != null and createTime!=''">AND createTime = #{createTime}</if>
+
             and del_flag = '0'
         </where>
         order by createTime desc
@@ -49,6 +50,7 @@
     <insert id="insertRecipe" parameterType="pd">
         insert into s_dtp_cfdj_prescription
         <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">
+            <if test="id != null and id!=''">id,</if>
             <if test="orderId != null and orderId!=''">orderId,</if>
             <if test="saleOrderNumber != null and saleOrderNumber!=''">saleOrderNumber,</if>
             <if test="genericName != null and genericName!=''">genericName,</if>
@@ -72,11 +74,17 @@
             <if test="deliveryMethod != null and deliveryMethod!=''">deliveryMethod,</if>
             <if test="paymentCode != null and paymentCode!=''">paymentCode,</if>
             <if test="paymentMethod != null and paymentMethod!=''">paymentMethod,</if>
-            <if test="status != null and status!=''">status},</if>
+            <if test="status != null and status!=''">status,</if>
+            <if test="isFlipItem != null and isFlipItem!=''">isFlipItem,</if>
             <if test="lastUpdated != null and lastUpdated!=''">lastUpdated,</if>
             <if test="createTime != null and createTime!=''">createTime,</if>
+            <if test="orderTime != null and orderTime!=''">orderTime,</if>
+            <if test="saleOrderTime != null and saleOrderTime!=''">saleOrderTime,</if>
+
+
         </trim>
         <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
+            <if test="id != null and id!=''">#{id},</if>
             <if test="orderId != null and orderId!=''">#{orderId},</if>
             <if test="saleOrderNumber != null and saleOrderNumber!=''">#{saleOrderNumber},</if>
             <if test="genericName != null and genericName!=''">#{genericName},</if>
@@ -101,17 +109,23 @@
             <if test="paymentCode != null and paymentCode!=''">#{paymentCode},</if>
             <if test="paymentMethod != null and paymentMethod!=''">#{paymentMethod},</if>
             <if test="status != null and status!=''">#{status},</if>
+            <if test="isFlipItem != null and isFlipItem!=''">#{isFlipItem},</if>
             <if test="lastUpdated != null and lastUpdated!=''">#{lastUpdated},</if>
             <if test="createTime != null and createTime!=''">#{createTime},</if>
+            <if test="orderTime != null and orderTime!=''">#{orderTime},</if>
+            <if test="saleOrderTime != null and saleOrderTime!=''">#{saleOrderTime},</if>
+
         </trim>
     </insert>
 
-    <delete id="deleteRecipe" parameterType="pd">
-        <if test="ids != null and ids!=''">
+    <delete id="deleteRecipe" parameterType="java.util.List">
+        <if test="list != null and list.size() > 0">
             delete from s_dtp_cfdj_prescription
-            where id in (${ids})
+            where id in
+            <foreach item="id" index="index" collection="list" open="(" separator="," close=")">
+                #{id}
+            </foreach>
         </if>
-
     </delete>
 
     <update id="updateRecipe" parameterType="pd">
@@ -141,19 +155,22 @@
             <if test="paymentCode != null and paymentCode!=''">paymentCode=#{paymentCode},</if>
             <if test="paymentMethod != null and paymentMethod!=''">paymentMethod=#{paymentMethod},</if>
             <if test="status != null and status!=''">status=#{status},</if>
+            <if test="isFlipItem != null and isFlipItem!=''">isFlipItem=#{isFlipItem},</if>
             <if test="lastUpdated != null and lastUpdated!=''">lastUpdated=#{lastUpdated},</if>
             <if test="createTime != null and createTime!=''">createTime=#{createTime},</if>
+            <if test="orderTime != null and orderTime!=''">orderTime=#{orderTime},</if>
+            <if test="saleOrderTime != null and saleOrderTime!=''">saleOrderTime=#{saleOrderTime},</if>
         </trim>
         where id=#{id}
     </update>
     <select id="checkPatientNameAndPhoneUnique" parameterType="pd" resultType="pd">
-        select patientName, patientPhone from s_dtp_cfdj_prescription where patientName=#{patientName} and patientPhone=#{patientPhone} and del_flag = '0' limit 1
+        select name, phoneNumber from s_dtp_ysfw_archive_management where name=#{name} and phoneNumber=#{phoneNumber} and del_flag = '0' limit 1
+    </select>
+    <select id="checkPatientNameAndIdCardUnique" parameterType="pd" resultType="pd">
+        select documentNumber, name from s_dtp_ysfw_archive_management where documentNumber=#{documentNumber} and name=#{name} and del_flag = '0' limit 1
     </select>
     <select id="selectOne" parameterType="pd" resultType="pd">
-        select id, orderId, saleOrderNumber, genericName, productName, specification, quantity, manufacturer, mdmCode,
-        posMemberName, posMemberPhone, prescriptionType, prescriptionNumber, hospital, department,
-        doctor, patientName, patientPhone, storeName, registrar, completionTime, lastUpdated,deliveryMethod, paymentCode,
-        paymentMethod, status ,createTime  from s_dtp_cfdj_prescription where id=#{id}
+        select * from s_dtp_cfdj_prescription where id=#{id}
     </select>
 
 
@@ -433,27 +450,10 @@
             </if>
     </update>
 
-    <!--配置信息查询模块-->
+    <!--配置信息查询模块一店一目-->
     <select id="StoreProductList" parameterType="pd" resultType="pd">
         select
-        id,
-        createdBy,
-        createdDate,
-        storeId,
-        storeCode,
-        storeName,
-        mdmCode,
-        genericName,
-        productName,
-        manufacturer,
-        specification,
-        isPrescriptionItem,
-        isFlipItem,
-        isFollowUpItem,
-        isMandatoryRegistration,
-        isColdChainItem,
-        create_time as createTime,
-        updatedAt
+        *
         from s_dtp_pzxx_store_product_list
         <where>
             <if test="id != null">AND id = #{id}</if>
@@ -479,21 +479,27 @@
                 AND updatedAt BETWEEN #{updatedAt_start} AND #{updatedAt_end}
             </if>
             <if test="query != null and query != ''">
-                AND (genericName LIKE CONCAT('%', #{query}, '%') OR productName LIKE CONCAT('%', #{query}, '%'))
+                AND (genericName LIKE CONCAT('%', #{query}, '%') OR productName LIKE CONCAT('%', #{query}, '%') OR mdmCode LIKE CONCAT('%', #{query}, '%'))
             </if>
             AND del_flag = '0'
         </where>
         order by create_time desc
     </select>
+    <!--配置信息删除 一店一目-->
+    <delete id="deleteProductList" parameterType="java.util.List">
+        <if test="list != null and list.size() > 0">
+            delete from s_dtp_pzxx_store_product_list
+            where id in
+            <foreach item="id" index="index" collection="list" open="(" separator="," close=")">
+                #{id}
+            </foreach>
+        </if>
+    </delete>
+
+
     <select id="HospitalList" parameterType="pd" resultType="pd">
         select
-        id,
-        createdBy,
-        standardName,
-        address,
-        phone,
-        create_time as createTime,
-        updated_time as updatedTime
+      *
         from s_dtp_pzxx_hospital_list
         <where>
             <if test="id != null and id != ''">AND id = #{id}</if>
@@ -514,4 +520,300 @@
         order by create_time desc
     </select>
 
+
+    <!-- 查询处方药品信息 -->
+    <select id="selectPrescriptionDrugs" parameterType="pd" resultType="pd">
+        SELECT * FROM s_dtp_cfdj_prescription_drug WHERE 1=1
+        <if test="id != null and id != ''">
+            AND id = #{id}
+        </if>
+        <if test="productName != null and productName != ''">
+            AND productName =#{productName}
+        </if>
+        <if test="genericName != null and genericName != ''">
+            AND genericName = #{genericName}
+        </if>
+        <if test="prescriptionNumber != null and prescriptionNumber != ''">
+            AND prescriptionNumber = #{prescriptionNumber}
+        </if>
+        <if test="drugCode != null and drugCode != ''">
+            AND drugCode = #{drugCode}
+        </if>
+        <if test="specification != null and specification != ''">
+            AND specification= #{specification}
+        </if>
+        <if test="usageMethod != null and usageMethod != ''">
+            AND usageMethod = #{usageMethod}
+        </if>
+        <if test="quantity != null">
+            AND quantity = #{quantity}
+        </if>
+        <if test="frequency != null and frequency != ''">
+            AND frequency = #{frequency}
+        </if>
+        <if test="wordUsage != null and wordUsage != ''">
+            AND wordUsage = #{wordUsage}
+        </if>
+        <if test="medicationCycle != null and medicationCycle != ''">
+            AND medicationCycle = #{medicationCycle}
+        </if>
+        <if test="mdmCode != null and mdmCode != ''">
+            AND mdmCode = #{mdmCode}
+        </if>
+        <if test="dosage != null and dosage != ''">
+            AND dosage = #{dosage}
+        </if>
+        <if test="indication != null and indication != ''">
+            AND indication= #{indication}
+        </if>
+        <if test="sideEffects != null and sideEffects != ''">
+            AND sideEffects =#{sideEffects}
+        </if>
+        <if test="creator != null and creator != ''">
+            AND creator = #{creator}
+        </if>
+        <if test="createTime != null">
+            AND createTime = #{createTime}
+        </if>
+        <if test="status != null">
+            AND status = #{status}
+        </if>
+
+    </select>
+
+    <!-- 插入处方药品信息 -->
+    <insert id="insertPrescriptionDrug" parameterType="pd">
+        INSERT INTO s_dtp_cfdj_prescription_drug
+        <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">
+            <if test="productName != null and productName != ''">productName,</if>
+            <if test="genericName != null and genericName != ''">genericName,</if>
+            <if test="prescriptionNumber != null and prescriptionNumber != ''">prescriptionNumber,</if>
+            <if test="drugCode != null and drugCode != ''">drugCode,</if>
+            <if test="specification != null and specification != ''">specification,</if>
+            <if test="usageMethod != null and usageMethod != ''">usageMethod,</if>
+            <if test="quantity != null">quantity,</if>
+            <if test="frequency != null and frequency != ''">frequency,</if>
+            <if test="wordUsage != null and wordUsage != ''">wordUsage,</if>
+            <if test="medicationCycle != null and medicationCycle != ''">medicationCycle,</if>
+            <if test="mdmCode != null and mdmCode != ''">mdmCode,</if>
+            <if test="dosage != null and dosage != ''">dosage,</if>
+            <if test="indication != null and indication != ''">indication,</if>
+            <if test="sideEffects != null and sideEffects != ''">sideEffects,</if>
+            <if test="creator != null and creator != ''">creator,</if>
+            <if test="createTime != null">createTime,</if>
+            <if test="status != null">status,</if>
+            <if test="isFlipItem != null">isFlipItem,</if>
+            <if test="remarks != null and remarks != ''">remarks</if>
+        </trim>
+        VALUES
+        <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">
+            <if test="productName != null and productName != ''">#{productName},</if>
+            <if test="genericName != null and genericName != ''">#{genericName},</if>
+            <if test="prescriptionNumber != null and prescriptionNumber != ''">#{prescriptionNumber},</if>
+            <if test="drugCode != null and drugCode != ''">#{drugCode},</if>
+            <if test="specification != null and specification != ''">#{specification},</if>
+            <if test="usageMethod != null and usageMethod != ''">#{usageMethod},</if>
+            <if test="quantity != null">#{quantity},</if>
+            <if test="frequency != null and frequency != ''">#{frequency},</if>
+            <if test="wordUsage != null and wordUsage != ''">#{wordUsage},</if>
+            <if test="medicationCycle != null and medicationCycle != ''">#{medicationCycle},</if>
+            <if test="mdmCode != null and mdmCode != ''">#{mdmCode},</if>
+            <if test="dosage != null and dosage != ''">#{dosage},</if>
+            <if test="indication != null and indication != ''">#{indication},</if>
+            <if test="sideEffects != null and sideEffects != ''">#{sideEffects},</if>
+            <if test="creator != null and creator != ''">#{creator},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="status != null">#{status},</if>
+            <if test="isFlipItem != null">#{isFlipItem},</if>
+
+            <if test="remarks != null and remarks != ''">#{remarks}</if>
+        </trim>
+    </insert>
+    <!-- 批量插入处方药品信息 -->
+    <insert id="batchAddPrescriptionDrug" parameterType="java.util.List" useGeneratedKeys="false">
+        INSERT INTO s_dtp_cfdj_prescription_drug
+        <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">
+            <if test="dataList[0].productName != null and dataList[0].productName != ''">productName,</if>
+            <if test="dataList[0].genericName != null and dataList[0].genericName != ''">genericName,</if>
+            <if test="dataList[0].prescriptionNumber != null and dataList[0].prescriptionNumber != ''">prescriptionNumber,</if>
+            <if test="dataList[0].drugCode != null and dataList[0].drugCode != ''">drugCode,</if>
+            <if test="dataList[0].specification != null and dataList[0].specification != ''">specification,</if>
+            <if test="dataList[0].usageMethod != null and dataList[0].usageMethod != ''">usageMethod,</if>
+            <if test="dataList[0].quantity != null">quantity,</if>
+            <if test="dataList[0].frequency != null and dataList[0].frequency != ''">frequency,</if>
+            <if test="dataList[0].wordUsage != null and dataList[0].wordUsage != ''">wordUsage,</if>
+            <if test="dataList[0].medicationCycle != null and dataList[0].medicationCycle != ''">medicationCycle,</if>
+            <if test="dataList[0].mdmCode != null and dataList[0].mdmCode != ''">mdmCode,</if>
+            <if test="dataList[0].dosage != null and dataList[0].dosage != ''">dosage,</if>
+            <if test="dataList[0].indication != null and dataList[0].indication != ''">indication,</if>
+            <if test="dataList[0].sideEffects != null and dataList[0].sideEffects != ''">sideEffects,</if>
+            <if test="dataList[0].creator != null and dataList[0].creator != ''">creator,</if>
+            <if test="dataList[0].createTime != null">createTime,</if>
+            <if test="dataList[0].status != null">status,</if>
+            <if test="dataList[0].isFlipItem != null and dataList[0].isFlipItem != ''">isFlipItem,</if>
+            <if test="dataList[0].remarks != null and dataList[0].remarks != ''">remarks</if>
+        </trim>
+        VALUES
+        <foreach item="item" index="index" collection="dataList" separator=",">
+            <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">
+                <if test="item.productName != null and item.productName != ''">#{item.productName},</if>
+                <if test="item.genericName != null and item.genericName != ''">#{item.genericName},</if>
+                <if test="item.prescriptionNumber != null and item.prescriptionNumber != ''">#{item.prescriptionNumber},</if>
+                <if test="item.drugCode != null and item.drugCode != ''">#{item.drugCode},</if>
+                <if test="item.specification != null and item.specification != ''">#{item.specification},</if>
+                <if test="item.usageMethod != null and item.usageMethod != ''">#{item.usageMethod},</if>
+                <if test="item.quantity != null">#{item.quantity},</if>
+                <if test="item.frequency != null and item.frequency != ''">#{item.frequency},</if>
+                <if test="item.wordUsage != null and item.wordUsage != ''">#{item.wordUsage},</if>
+                <if test="item.medicationCycle != null and item.medicationCycle != ''">#{item.medicationCycle},</if>
+                <if test="item.mdmCode != null and item.mdmCode != ''">#{item.mdmCode},</if>
+                <if test="item.dosage != null and item.dosage != ''">#{item.dosage},</if>
+                <if test="item.indication != null and item.indication != ''">#{item.indication},</if>
+                <if test="item.sideEffects != null and item.sideEffects != ''">#{item.sideEffects},</if>
+                <if test="item.creator != null and item.creator != ''">#{item.creator},</if>
+                <if test="item.createTime != null">#{item.createTime},</if>
+                <if test="item.status != null">#{item.status},</if>
+                <if test="item.isFlipItem != null and item.isFlipItem != ''">#{item.isFlipItem},</if>
+                <if test="item.remarks != null and item.remarks != ''">#{item.remarks}</if>
+            </trim>
+        </foreach>
+    </insert>
+    <!-- 批量修改处方药品信息 -->
+    <update id="batchUpdatePrescriptionDrug" parameterType="java.util.List">
+        <foreach item="item" index="index" collection="list" separator=";">
+            UPDATE s_dtp_cfdj_prescription_drug
+            SET
+            <trim prefix="" suffixOverrides=",">
+                <if test="item.productName != null and item.productName != ''">
+                    productName = #{item.productName},
+                </if>
+                <if test="item.genericName != null and item.genericName != ''">
+                    genericName = #{item.genericName},
+                </if>
+                <if test="item.drugCode != null and item.drugCode != ''">
+                    drugCode = #{item.drugCode},
+                </if>
+                <if test="item.specification != null and item.specification != ''">
+                    specification = #{item.specification},
+                </if>
+                <if test="item.usageMethod != null and item.usageMethod != ''">
+                    usageMethod = #{item.usageMethod},
+                </if>
+                <if test="item.quantity != null">
+                    quantity = #{item.quantity},
+                </if>
+                <if test="item.frequency != null and item.frequency != ''">
+                    frequency = #{item.frequency},
+                </if>
+                <if test="item.wordUsage != null and item.wordUsage != ''">
+                    wordUsage = #{item.wordUsage},
+                </if>
+                <if test="item.medicationCycle != null and item.medicationCycle != ''">
+                    medicationCycle = #{item.medicationCycle},
+                </if>
+                <if test="item.mdmCode != null and item.mdmCode != ''">
+                    mdmCode = #{item.mdmCode},
+                </if>
+                <if test="item.dosage != null and item.dosage != ''">
+                    dosage = #{item.dosage},
+                </if>
+                <if test="item.indication != null and item.indication != ''">
+                    indication = #{item.indication},
+                </if>
+                <if test="item.sideEffects != null and item.sideEffects != ''">
+                    sideEffects = #{item.sideEffects},
+                </if>
+                <if test="item.creator != null and item.creator != ''">
+                    creator = #{item.creator},
+                </if>
+                <if test="item.createTime != null">
+                    createTime = #{item.createTime},
+                </if>
+                <if test="item.status != null">
+                    status = #{item.status},
+                </if>
+                <if test="item.isFlipItem != null and item.isFlipItem != ''">
+                    isFlipItem = #{item.isFlipItem},
+                </if>
+
+                <if test="item.remarks != null and item.remarks != ''">
+                    remarks = #{item.remarks}
+                </if>
+            </trim>
+            WHERE prescriptionNumber = #{item.prescriptionId}
+        </foreach>
+    </update>
+
+    <!-- 更新处方药品信息 -->
+    <update id="updatePrescriptionDrug" parameterType="pd">
+        UPDATE s_dtp_cfdj_prescription_drug SET
+        <trim prefix="" suffixOverrides="," prefixOverrides=",">
+            <if test="productName != null and productName != ''">
+                productName = #{productName},
+            </if>
+            <if test="genericName != null and genericName != ''">
+                genericName = #{genericName},
+            </if>
+            <if test="prescriptionNumber != null and prescriptionNumber != ''">
+                prescriptionNumber = #{prescriptionNumber},
+            </if>
+            <if test="drugCode != null and drugCode != ''">
+                drugCode = #{drugCode},
+            </if>
+            <if test="specification != null and specification != ''">
+                specification = #{specification},
+            </if>
+            <if test="usageMethod != null and usageMethod != ''">
+                usageMethod = #{usageMethod},
+            </if>
+            <if test="quantity != null">
+                quantity = #{quantity},
+            </if>
+            <if test="frequency != null and frequency != ''">
+                frequency = #{frequency},
+            </if>
+            <if test="wordUsage != null and wordUsage != ''">
+                wordUsage = #{wordUsage},
+            </if>
+            <if test="medicationCycle != null and medicationCycle != ''">
+                medicationCycle = #{medicationCycle},
+            </if>
+            <if test="mdmCode != null and mdmCode != ''">
+                mdmCode = #{mdmCode},
+            </if>
+            <if test="dosage != null and dosage != ''">
+                dosage = #{dosage},
+            </if>
+            <if test="indication != null and indication != ''">
+                indication = #{indication},
+            </if>
+            <if test="sideEffects != null and sideEffects != ''">
+                sideEffects = #{sideEffects},
+            </if>
+            <if test="creator != null and creator != ''">
+                creator = #{creator},
+            </if>
+            <if test="createTime != null">
+                createTime = #{createTime},
+            </if>
+            <if test="status != null">
+                status = #{status},
+            </if>
+            <if test="isFlipItem != null and isFlipItem != ''">
+                isFlipItem = #{isFlipItem},
+            </if>
+            <if test="remarks != null and remarks != ''">
+                remarks = #{remarks}
+            </if>
+        </trim>
+        WHERE id = #{id}
+    </update>
+
+    <!-- 删除处方药品信息 -->
+    <update id="deletePrescriptionDrug" parameterType="pd">
+        DELETE FROM s_dtp_cfdj_prescription_drug WHERE id = #{id}
+    </update>
+
+
+
 </mapper>