|  | @@ -1209,8 +1209,6 @@ function clearUser(flag) {
 | 
	
		
			
				|  |  |      $("#patientAge").html("");
 | 
	
		
			
				|  |  |      $("#patientGender").html("");
 | 
	
		
			
				|  |  |      $("#patientId").text(null);
 | 
	
		
			
				|  |  | -    $("#transferTreatment").css("display", "none");
 | 
	
		
			
				|  |  | -    $("#consultation").css("display", "none");
 | 
	
		
			
				|  |  |      $("#editUser").css("display", "none");
 | 
	
		
			
				|  |  |      $("#clearUser").css("display", "none");
 | 
	
		
			
				|  |  |      $("#fetchSpcSlwinfo").css("display", "none");
 | 
	
	
		
			
				|  | @@ -1220,6 +1218,8 @@ function clearUser(flag) {
 | 
	
		
			
				|  |  |      $("#first").next().click();
 | 
	
		
			
				|  |  |      $("#patientHisData").text("");
 | 
	
		
			
				|  |  |      if (flag) {
 | 
	
		
			
				|  |  | +        $("#transferTreatment").css("display", "none");
 | 
	
		
			
				|  |  | +        $("#consultation").css("display", "none");
 | 
	
		
			
				|  |  |          $("#mzfzSerialNoInClick").val(null);
 | 
	
		
			
				|  |  |          $("#mzfzReqTypeNoInClick").val(null);
 | 
	
		
			
				|  |  |          $("#turnToConsultationIdInClick").val(null);
 | 
	
	
		
			
				|  | @@ -1582,7 +1582,7 @@ function clinicalReception(patientId, serialNo, reqType) {
 | 
	
		
			
				|  |  |              $("#confirmPrescriptionButton").off("click").on("click", function (t) {
 | 
	
		
			
				|  |  |                  $("#messagePrescriptionModal").modal("hide");
 | 
	
		
			
				|  |  |                  //先保存目前接诊信息,再切换就诊人
 | 
	
		
			
				|  |  | -                var jsonData = getParamsForpPrescription();
 | 
	
		
			
				|  |  | +                var jsonData = getParamsForpPrescription(1);
 | 
	
		
			
				|  |  |                  $.ajax({
 | 
	
		
			
				|  |  |                      type: "POST",
 | 
	
		
			
				|  |  |                      url: '/thmz/savePrescription',
 | 
	
	
		
			
				|  | @@ -1780,13 +1780,13 @@ function fetchSpcSlwinfo() {
 | 
	
		
			
				|  |  |   * @param reqType 号表类别
 | 
	
		
			
				|  |  |   */
 | 
	
		
			
				|  |  |  function realClinicalReception(patientId, serialNo, reqType) {
 | 
	
		
			
				|  |  | -   var turnToConsultationIdInClick=$("#turnToConsultationIdInClick").val();
 | 
	
		
			
				|  |  | -   if(turnToConsultationIdInClick==null || turnToConsultationIdInClick=="null"){
 | 
	
		
			
				|  |  | -       turnToConsultationIdInClick=0;
 | 
	
		
			
				|  |  | -   }
 | 
	
		
			
				|  |  | +    var turnToConsultationIdInClick = $("#turnToConsultationIdInClick").val();
 | 
	
		
			
				|  |  | +    if (turnToConsultationIdInClick == null || turnToConsultationIdInClick == "null") {
 | 
	
		
			
				|  |  | +        turnToConsultationIdInClick = 0;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |      $.ajax({
 | 
	
		
			
				|  |  |          type: "GET",
 | 
	
		
			
				|  |  | -        url: '/thmz/saveClinic?patientId=' + patientId + "&serialNo=" + serialNo+"&turnToConsultationId="+turnToConsultationIdInClick,
 | 
	
		
			
				|  |  | +        url: '/thmz/saveClinic?patientId=' + patientId + "&serialNo=" + serialNo + "&turnToConsultationId=" + turnToConsultationIdInClick,
 | 
	
		
			
				|  |  |          contentType: "application/json;charset=UTF-8",
 | 
	
		
			
				|  |  |          dataType: "json",
 | 
	
		
			
				|  |  |          headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
 | 
	
	
		
			
				|  | @@ -4409,7 +4409,7 @@ function calculateTotalAmount() {
 | 
	
		
			
				|  |  |      $("div.alert ").each(function (index, obj) {
 | 
	
		
			
				|  |  |          $(obj).remove();
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  | -    var jsonData = getParamsForpPrescription();
 | 
	
		
			
				|  |  | +    var jsonData = getParamsForpPrescription(3);
 | 
	
		
			
				|  |  |      $.ajax({
 | 
	
		
			
				|  |  |          type: "POST",
 | 
	
		
			
				|  |  |          url: '/thmz/getAmountForTempPrescription',
 | 
	
	
		
			
				|  | @@ -7101,9 +7101,10 @@ function zTreeOnClick(event, treeId, treeNode) {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  /**
 | 
	
		
			
				|  |  |   * 构建处方参数
 | 
	
		
			
				|  |  | + * @param type 1 保存处方 2 保存模板 3 计算金额
 | 
	
		
			
				|  |  |   * @returns {any}
 | 
	
		
			
				|  |  |   */
 | 
	
		
			
				|  |  | -function getParamsForpPrescription() {
 | 
	
		
			
				|  |  | +function getParamsForpPrescription(type) {
 | 
	
		
			
				|  |  |      var codes = $("#diagnoseValue").val();
 | 
	
		
			
				|  |  |      var icdCode = null;
 | 
	
		
			
				|  |  |      if (codes != null && codes.length > 0) {
 | 
	
	
		
			
				|  | @@ -7125,7 +7126,9 @@ function getParamsForpPrescription() {
 | 
	
		
			
				|  |  |      jsonData.firstOrNot = $("input[name='firstOrNot']:checked").val();
 | 
	
		
			
				|  |  |      jsonData.icdCode = icdCode;
 | 
	
		
			
				|  |  |      jsonData.serialNo = $("#mzfzSerialNoInClick").val();
 | 
	
		
			
				|  |  | -    jsonData.turnToConsultationId=$("#turnToConsultationIdInClick").val();
 | 
	
		
			
				|  |  | +    if (type == 1) {
 | 
	
		
			
				|  |  | +        jsonData.turnToConsultationId = $("#turnToConsultationIdInClick").val();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |      jsonData.mzBlRecord.firstOrNot = jsonData.firstOrNot;
 | 
	
		
			
				|  |  |      jsonData.mzBlRecord.emrChiefComplaint = $("#symptom").val();
 | 
	
		
			
				|  |  |      jsonData.mzBlRecord.emrHpi = $("#emrHpi").val();
 | 
	
	
		
			
				|  | @@ -7295,7 +7298,7 @@ function savePrescription() {
 | 
	
		
			
				|  |  |      $("#messageButton").off("click").on("click", function (t) {
 | 
	
		
			
				|  |  |          //$("#messageModal").modal("hide");
 | 
	
		
			
				|  |  |          $("#messageButton").attr("disabled", true);
 | 
	
		
			
				|  |  | -        var jsonData = getParamsForpPrescription();
 | 
	
		
			
				|  |  | +        var jsonData = getParamsForpPrescription(1);
 | 
	
		
			
				|  |  |          $.ajax({
 | 
	
		
			
				|  |  |              type: "POST",
 | 
	
		
			
				|  |  |              url: '/thmz/savePrescription',
 | 
	
	
		
			
				|  | @@ -7361,7 +7364,7 @@ function saveapidAccepts() {
 | 
	
		
			
				|  |  |      $("#messageContent").html("确认保存医疗范文吗?");
 | 
	
		
			
				|  |  |      $("#messageButton").off("click").on("click", function (t) {
 | 
	
		
			
				|  |  |          $("#messageModal").modal("hide");
 | 
	
		
			
				|  |  | -        var jsonData = getParamsForpPrescription();
 | 
	
		
			
				|  |  | +        var jsonData = getParamsForpPrescription(2);
 | 
	
		
			
				|  |  |          $.ajax({
 | 
	
		
			
				|  |  |              type: "POST",
 | 
	
		
			
				|  |  |              url: '/thmz/saveTemplate',
 | 
	
	
		
			
				|  | @@ -7473,7 +7476,7 @@ function getMzPrescriptionVoUnPaid(patientId, times, clnicId) {
 | 
	
		
			
				|  |  |          $("#confirmPrescriptionButton").off("click").on("click", function (t) {
 | 
	
		
			
				|  |  |              $("#messagePrescriptionModal").modal("hide");
 | 
	
		
			
				|  |  |              //先保存目前接诊信息,再切换就诊人
 | 
	
		
			
				|  |  | -            var jsonData = getParamsForpPrescription();
 | 
	
		
			
				|  |  | +            var jsonData = getParamsForpPrescription(1);
 | 
	
		
			
				|  |  |              $.ajax({
 | 
	
		
			
				|  |  |                  type: "POST",
 | 
	
		
			
				|  |  |                  url: '/thmz/savePrescription',
 | 
	
	
		
			
				|  | @@ -7638,7 +7641,7 @@ function repeatAcceptsConfirm(patientId, times, clnicId) {
 | 
	
		
			
				|  |  |          $("#confirmPrescriptionButton").off("click").on("click", function (t) {
 | 
	
		
			
				|  |  |              $("#messagePrescriptionModal").modal("hide");
 | 
	
		
			
				|  |  |              //先保存目前接诊信息,再切换就诊人
 | 
	
		
			
				|  |  | -            var jsonData = getParamsForpPrescription();
 | 
	
		
			
				|  |  | +            var jsonData = getParamsForpPrescription(1);
 | 
	
		
			
				|  |  |              $.ajax({
 | 
	
		
			
				|  |  |                  type: "POST",
 | 
	
		
			
				|  |  |                  url: '/thmz/savePrescription',
 | 
	
	
		
			
				|  | @@ -10057,7 +10060,7 @@ function consultation() {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              $.ajax({
 | 
	
		
			
				|  |  |                  type: "GET",
 | 
	
		
			
				|  |  | -                url: '/thmz/getUnConsultation?serialNo='+$("#mzfzSerialNoInClick").val(),
 | 
	
		
			
				|  |  | +                url: '/thmz/getUnConsultation?serialNo=' + $("#mzfzSerialNoInClick").val(),
 | 
	
		
			
				|  |  |                  dataType: "json",
 | 
	
		
			
				|  |  |                  headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
 | 
	
		
			
				|  |  |                  success: function (res) {
 | 
	
	
		
			
				|  | @@ -10065,8 +10068,8 @@ function consultation() {
 | 
	
		
			
				|  |  |                          window.location.href = '/thmz/login/view'
 | 
	
		
			
				|  |  |                          return;
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  | -                    var data=res.data;
 | 
	
		
			
				|  |  | -                    if(data!=null && data.length>0){
 | 
	
		
			
				|  |  | +                    var data = res.data;
 | 
	
		
			
				|  |  | +                    if (data != null && data.length > 0) {
 | 
	
		
			
				|  |  |                          $('#consultationDept').selectpicker('val', data);
 | 
	
		
			
				|  |  |                          $('#consultationDept').selectpicker('refresh');
 | 
	
		
			
				|  |  |                      }
 | 
	
	
		
			
				|  | @@ -10107,13 +10110,13 @@ function setTurnToConsultation() {
 | 
	
		
			
				|  |  |      if (opType == 2 || opType == "2") {
 | 
	
		
			
				|  |  |          title = "确认提交本次会诊操作吗?";
 | 
	
		
			
				|  |  |          var consultationDept = $("#consultationDept").val();
 | 
	
		
			
				|  |  | -        if(consultationDept!=null && consultationDept.length>0){
 | 
	
		
			
				|  |  | -            targetDeptNo=null;
 | 
	
		
			
				|  |  | -            for(var i=0;i<consultationDept.length;i++){
 | 
	
		
			
				|  |  | -                if(targetDeptNo==null){
 | 
	
		
			
				|  |  | -                    targetDeptNo=consultationDept[i];
 | 
	
		
			
				|  |  | -                }else {
 | 
	
		
			
				|  |  | -                    targetDeptNo+=","+consultationDept[i];
 | 
	
		
			
				|  |  | +        if (consultationDept != null && consultationDept.length > 0) {
 | 
	
		
			
				|  |  | +            targetDeptNo = null;
 | 
	
		
			
				|  |  | +            for (var i = 0; i < consultationDept.length; i++) {
 | 
	
		
			
				|  |  | +                if (targetDeptNo == null) {
 | 
	
		
			
				|  |  | +                    targetDeptNo = consultationDept[i];
 | 
	
		
			
				|  |  | +                } else {
 | 
	
		
			
				|  |  | +                    targetDeptNo += "," + consultationDept[i];
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 |