Browse Source

Merge branch '20230223_xt_api_new_branch' of http://git.shengws.com/csx/XT_New into 20230223_xt_api_new_branch

28169 1 week ago
parent
commit
466f410bc0
1 changed files with 64 additions and 24 deletions
  1. 64 24
      controllers/his_api_controller.go

+ 64 - 24
controllers/his_api_controller.go View File

@@ -10732,35 +10732,57 @@ func (c *HisApiController) GetUploadInfo() {
10732 10732
 		for _, item := range prescriptions {
10733 10733
 			if item.Type == 1 { //药品a
10734 10734
 				for _, subItem := range item.HisDoctorAdviceInfo {
10735
-					cus := &Custom{
10736
-						AdviceId:         subItem.ID,
10737
-						ProjectId:        0,
10738
-						DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*subItem.PrescribingNumber),
10739
-						Cut:              fmt.Sprintf("%.4f", subItem.PrescribingNumber),
10740
-						FeedetlSn:        subItem.FeedetlSn,
10741
-						Price:            fmt.Sprintf("%.4f", subItem.Price),
10742
-						MedListCodg:      subItem.MedListCodg,
10743
-						Type:             1,
10744
-						CostType:         9,
10735
+					if subItem.Drug.IsUser != 1 {
10736
+						cus := &Custom{
10737
+							AdviceId:         subItem.ID,
10738
+							ProjectId:        0,
10739
+							DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*subItem.PrescribingNumber),
10740
+							Cut:              fmt.Sprintf("%.4f", subItem.PrescribingNumber),
10741
+							FeedetlSn:        subItem.FeedetlSn,
10742
+							Price:            fmt.Sprintf("%.4f", subItem.Price),
10743
+							MedListCodg:      subItem.MedListCodg,
10744
+							Type:             1,
10745
+							CostType:         9,
10746
+						}
10747
+						customs = append(customs, cus)
10745 10748
 					}
10746
-					customs = append(customs, cus)
10747 10749
 				}
10748 10750
 			}
10749 10751
 			if item.Type == 2 { //项目
10750 10752
 				for _, subItem := range item.HisPrescriptionProject {
10751
-					cnt, _ := strconv.ParseFloat(subItem.Count, 64)
10752
-					cus := &Custom{
10753
-						AdviceId:         0,
10754
-						ProjectId:        subItem.ID,
10755
-						DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*cnt),
10756
-						Cut:              fmt.Sprintf("%.4f", cnt),
10757
-						FeedetlSn:        subItem.FeedetlSn,
10758
-						Price:            fmt.Sprintf("%.4f", float64(subItem.Price)),
10759
-						MedListCodg:      subItem.MedListCodg,
10760
-						Type:             2,
10761
-						CostType:         subItem.HisProject.CostClassify,
10753
+					if subItem.Type == 2 {
10754
+						cnt, _ := strconv.ParseFloat(subItem.Count, 64)
10755
+						cus := &Custom{
10756
+							AdviceId:         0,
10757
+							ProjectId:        subItem.ID,
10758
+							DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*cnt),
10759
+							Cut:              fmt.Sprintf("%.4f", cnt),
10760
+							FeedetlSn:        subItem.FeedetlSn,
10761
+							Price:            fmt.Sprintf("%.4f", float64(subItem.Price)),
10762
+							MedListCodg:      subItem.MedListCodg,
10763
+							Type:             2,
10764
+							CostType:         subItem.HisProject.CostClassify,
10765
+						}
10766
+						customs = append(customs, cus)
10767
+					} else {
10768
+						if subItem.GoodInfo.IsUser != 1 {
10769
+							cnt, _ := strconv.ParseFloat(subItem.Count, 64)
10770
+							cus := &Custom{
10771
+								AdviceId:         0,
10772
+								ProjectId:        subItem.ID,
10773
+								DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*cnt),
10774
+								Cut:              fmt.Sprintf("%.4f", cnt),
10775
+								FeedetlSn:        subItem.FeedetlSn,
10776
+								Price:            fmt.Sprintf("%.4f", float64(subItem.Price)),
10777
+								MedListCodg:      subItem.MedListCodg,
10778
+								Type:             2,
10779
+								CostType:         subItem.HisProject.CostClassify,
10780
+							}
10781
+							customs = append(customs, cus)
10782
+						}
10783
+
10762 10784
 					}
10763
-					customs = append(customs, cus)
10785
+
10764 10786
 				}
10765 10787
 			}
10766 10788
 			for _, item := range item.HisAdditionalCharge {
@@ -11284,6 +11306,23 @@ func (this *HisApiController) GetLastOrNextHisPrescription() {
11284 11306
 	}
11285 11307
 }
11286 11308
 
11309
+func RemoveRepeatedPurviewElementByHP(arr []service.VMOtherHisPrescriptionInfo) (newArr []service.VMOtherHisPrescriptionInfo) {
11310
+	newArr = make([]service.VMOtherHisPrescriptionInfo, 0)
11311
+	for i := 0; i < len(arr); i++ {
11312
+		repeat := false
11313
+		for j := i + 1; j < len(arr); j++ {
11314
+			if arr[i].PatientId == arr[j].PatientId && arr[i].RecordDate == arr[j].RecordDate {
11315
+				repeat = true
11316
+				break
11317
+			}
11318
+		}
11319
+		if !repeat {
11320
+			newArr = append(newArr, arr[i])
11321
+		}
11322
+	}
11323
+	return
11324
+}
11325
+
11287 11326
 func (this *HisApiController) GetCallHisPrescription() {
11288 11327
 	patient_id, _ := this.GetInt64("patient_id", 0)
11289 11328
 	timeLayout := "2006-01-02"
@@ -11295,8 +11334,9 @@ func (this *HisApiController) GetCallHisPrescription() {
11295 11334
 
11296 11335
 	endtime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
11297 11336
 	adminUserInfo := this.GetAdminUserInfo()
11298
-	prescriptions, err := service.GetCallHisPrescriptions(startime.Unix(), endtime.Unix(), adminUserInfo.CurrentOrgId, patient_id, p_type)
11337
+	new_prescriptions, err := service.GetCallHisPrescriptions(startime.Unix(), endtime.Unix(), adminUserInfo.CurrentOrgId, patient_id, p_type)
11299 11338
 
11339
+	prescriptions := RemoveRepeatedPurviewElementByHP(new_prescriptions)
11300 11340
 	//if
11301 11341
 	//storeConfig, _ := service.GetAllStoreHouseConfig(adminUserInfo.CurrentOrgId)
11302 11342
 	//